Vision task action server
Expose generic vision-task execution and TF reset, and warm the spincoater inference model in a daemon thread. motion_kind is inferred from the detected-pose result rather than the executed target type.
beambot.action_servers.vision_task_server · Source
Perception and mapping · Guide · Symbol index
How it is used
The orchestrator sends generic detector-and-motion requests to beambot_vision_task. This server constructs VisionTaskStages, delegates each goal, and copies detection and execution results into VisionTaskAction.Result.
create_stages() connects beamline camera settings to the coordinator. Startup also warms the spincoater model in a background thread; the TF-reset service updates the engine after tool-model changes.
Start here
Callable |
Purpose |
|---|---|
Run VisionTaskActionServer through the shared multithreaded ROS server runner. |
|
Load beamline camera settings and construct the generic vision coordinator. |
|
Run vision stages, map error strings to failed results, and copy unchecked vacuum_ok and optional detected approach. motion_kind is NONE when last_detected_pose is truthy, otherwise CARTESIAN_POSE, including joint-target executions. |
Functions
main()
Run VisionTaskActionServer through the shared multithreaded ROS server runner.
Entry point · Source
main(args=None)
Parameter |
Meaning |
|---|---|
|
Optional ROS initialization arguments; None uses normal rclpy argument handling. |
Returns: None when the server exits.
Errors: KeyboardInterrupt during spin is handled by run_server; initialization/construction and other executor errors propagate.
Side effects: Initializes ROS, constructs the action node, spins until shutdown and destroys the node/context.
VisionTaskActionServer
Concrete BaseActionServer around the generic vision coordinator. Its execution override supplies vision-specific result fields; camera, detection, and motion sequencing live in VisionTaskStages.
Inherits from: BaseActionServer.
VisionTaskActionServer.create_stages()
Load beamline camera settings and construct the generic vision coordinator.
Extension hook · Source
create_stages(self)
Returns: VisionTaskStages instance.
Errors: Configuration or VisionTaskStages initialization errors propagate.
Side effects: Reads configuration, initializes the vision engine and logs camera configuration.
VisionTaskActionServer._execute()
Run vision stages, map error strings to failed results, and copy unchecked vacuum_ok and optional detected approach. motion_kind is NONE when last_detected_pose is truthy, otherwise CARTESIAN_POSE, including joint-target executions.
Extension hook · Source
_execute(self, goal_handle)
Parameter |
Meaning |
|---|---|
|
Accepted VisionTaskAction handle. |
Returns: VisionTaskAction.Result with optional metre XYZ and XYZW quaternion.
Errors: Stage exceptions propagate to the base wrapper.
Side effects: Runs perception/motion; fills result fields. Goal finalization belongs to BaseActionServer.
VisionTaskActionServer.__init__()
Register beambot_vision_task and its TF reset service, then start best-effort spincoater model warmup.
Lifecycle · Source
__init__(self)
Errors: Vision/configuration/ROS initialization errors propagate; warmup errors are handled in its worker.
Side effects: Creates stage/camera/ROS resources and starts a daemon inference thread.
Internal callbacks and helpers
VisionTaskActionServer._warmup_spincoater_model()
Start a daemon thread that loads the shared sample detector and performs one dummy inference to initialize its resources.
Internal helper · Source
_warmup_spincoater_model(self)
Returns: None immediately after starting the thread.
Errors: Thread-start errors propagate; worker exceptions are logged and suppressed.
Side effects: Starts a background thread; may load model weights and initialize inference resources.
Referenced in source (1)
VisionTaskActionServer.__init__— beambot.action_servers.vision_task_server
VisionTaskActionServer._warmup_spincoater_model._warmup()
Load the spincoater sample model and infer on a black 640×640 uint8 RGB image with confidence 0.5.
Internal helper · Source
_warmup()
Returns: None.
Errors: Catches import/load/inference exceptions and logs a skipped-warmup warning.
Side effects: Loads/caches model weights, allocates a dummy image and initializes model inference resources; logs readiness.
Referenced in source (1)
VisionTaskActionServer._warmup_spincoater_model— beambot.action_servers.vision_task_server
VisionTaskActionServer._reset_tf_callback()
Delegate stage TF reset and populate a successful Trigger response.
Callback · Source
_reset_tf_callback(self, request, response)
Parameter |
Meaning |
|---|---|
|
Trigger request; unused. |
|
Response object to populate. |
Returns: Same response with success=True and reset message.
Errors: Reset exceptions propagate.
Side effects: Replaces engine TF resources and mutates response.
Referenced in source (1)
VisionTaskActionServer.__init__— beambot.action_servers.vision_task_server