payload.modes.PayloadDualApproachMode#
PayloadDualApproachMode: single-mode approach that fuses AprilTag tracking with HSV colour-blob tracking for a string obstacle.
Every frame the mode attempts AprilTag detection first (provides yaw
correction). When no tag is visible it falls back to HSV colour tracking
of the string. Termination is based on the pixel height of the colour
blob’s bounding box exceeding stop_height_px.
If both the tag and the colour target are lost for lost_timeout_s
seconds the payload stops.
Classes#
Approach using AprilTag when visible, HSV colour fallback otherwise. |
Functions#
|
Largest contour centroid, area, and bounding-box height. |
Module Contents#
- _color_blob_info(mask: numpy.ndarray, min_area: float) Tuple[float, float, int, int] | None#
Largest contour centroid, area, and bounding-box height.
Returns
(cx, cy, area, bbox_height)orNone.
- class PayloadDualApproachParams#
Bases:
vehicle_common.mode_loader.ParamsBase- tag_id: int | None = 0#
- tag_size_m: float = 0.0508#
- tag_family: str = 'tag36h11'#
- tag_forward_gain: float = 0.5#
- tag_max_forward_speed: float = 0.2#
- tag_angular_gain: float = 0.003#
- tag_yaw_gain: float = 0.6#
- lower_hsv: list[int] = (20, 100, 100)#
- upper_hsv: list[int] = (35, 255, 255)#
- color_forward_speed: float = 0.015#
- color_angular_gain: float = 0.003#
- color_centering_threshold_px: int = 15#
- color_drive_angular_scale: float = 0.0#
- color_min_detect_pixels: int = 50#
- prime_height_px: int = 100#
- stop_height_px: int = 300#
- post_prime_lost_frames: int = 5#
- lost_timeout_s: float = 5.0#
- compressed_image: bool = False#
- class PayloadDualApproachMode#
Bases:
vehicle_common.mode.ModeApproach using AprilTag when visible, HSV colour fallback otherwise.
- required_vision_nodes = ()#
- requires_camera = True#
- transition_labels = ()#
- initialize(node: rclpy.node.Node, vehicle: payload.payload.Payload, params: PayloadDualApproachParams) None#
- _on_image(msg) None#
- _on_camera_info(msg: sensor_msgs.msg.CameraInfo) None#
- _get_bgr() numpy.ndarray | None#
- _now() float#
- _publish_debug(bgr: numpy.ndarray, mask: numpy.ndarray, source: str, tag, color_cx: float | None, color_cy: float | None, color_height_px: int) None#
- _detect_tag(bgr: numpy.ndarray)#
Return the target TagObservation or None.
- _detect_color(bgr: numpy.ndarray) Tuple[numpy.ndarray, float | None, float | None, int, int]#
Return (mask, cx, cy, area, bbox_height_px).
- on_enter() None#
- on_update(time_delta: float) None#
- check_status() str#
- on_exit() None#