feat: Person-following head tracking (Issue #549) #555
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "sl-perception/issue-549-head-tracking"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements
saltybot_head_tracking— a ROS2 Python node that provides automatic person-following by computing pan/tilt angle setpoints from YOLOv8n person detection bounding boxes./saltybot/objects(DetectedObjectArray), filters forclass_id==0(person)score = 0.6 * 1/(1+dist_m) + 0.4 * confidence— prefers closest, breaks ties by confidence; falls back to confidence-only whendistance_m==0geometry_msgs/Pointto/saltybot/gimbal/cmd:x=pan_deg, y=tilt_deg, z=confidence/saltybot/head_tracking/stateState machine
hold_duration_s(3 s default) → CENTERINGcenter_speed_deg_s(20°/s) → IDLEKey parameters (
head_tracking_params.yaml)pan/tilt_kppan/tilt_kipan/tilt_kdpan_min/max_degtilt_min/max_deghold_duration_sdead_zone_pxcontrol_hzIntegration with pan_tilt_node
saltybot_pan_tiltsubscribes to/saltybot/target_track(pixel coords).head_trackingpublishes to/saltybot/gimbal/cmd(angle degrees).Bridge via topic remap in
pan_tiltlaunch:target_track → gimbal/cmd(or update
pan_tilt_nodeto accept angle setpoints directly).Files
jetson/ros2_ws/src/saltybot_head_tracking/saltybot_head_tracking/head_tracking_node.pyconfig/head_tracking_params.yamllaunch/head_tracking.launch.pypackage.xml,setup.py,setup.cfg,resource/Test plan
colcon build --packages-select saltybot_head_trackingsucceedsros2 run saltybot_head_tracking head_tracking/saltybot/objects/saltybot/gimbal/cmdpublishes at 20 HzCloses #549
Add saltybot_head_tracking — ROS2 Python node for automatic person- following using dual-axis PID control targeting the pan/tilt camera head. Pipeline: 1. Subscribe to /saltybot/objects (DetectedObjectArray from YOLOv8n) 2. Filter for class_id==0 (person); select best target by score: score = 0.6 * 1/(1+dist_m) + 0.4 * confidence (falls back to confidence-only when distance_m==0 / unknown) 3. Compute pixel error of bbox centre from image centre 4. Apply dead-zone (10 px default) to suppress micro-jitter 5. Convert pixel error to angle error via camera FOV 6. Independent PID controllers for pan and tilt axes 7. Accumulate PID output into absolute angle setpoint 8. Publish geometry_msgs/Point to /saltybot/gimbal/cmd: x = pan_angle_deg, y = tilt_angle_deg, z = confidence State machine: IDLE -> waiting for first detection TRACKING -> active PID LOST -> hold last angle for hold_duration_s (3 s) CENTERING -> return to (0, 0) at 20 deg/s -> IDLE Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>