feat: person detection + tracking (YOLOv8n TensorRT) #54
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "sl-jetson/person-detection"
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
New package
saltybot_perception— person detection and tracking for person-following mode.ApproximateTimeSynchronizer(50ms slop)base_link(fallback tocamera_color_optical_frame)Published Topics
/person/detectionsvision_msgs/Detection2DArray/person/targetgeometry_msgs/PoseStampedbase_link/person/debug_imagesensor_msgs/ImageConfig defaults (
person_detection_params.yaml)confidence_threshold: 0.40min_depth/max_depth: 0.5 m – 5.0 mtrack_hold_duration: 2.0 starget_frame:base_linkFiles
person_detector_node.py— main node (TRT/ONNX backends, preprocessing, postprocessing, depth lookup, TF)tracker.py—SimplePersonTracker(IoU association, hold, track ID)detection_utils.py— pure helpers:nms(),letterbox(),get_depth_at(),pixel_to_3d()scripts/build_trt_engine.py— ONNX → TensorRT FP16 engine builderlaunch/person_detection.launch.py,config/person_detection_params.yamlTest plan
pytest jetson/ros2_ws/src/saltybot_perception/test/ -vros2 launch saltybot_perception person_detection.launch.pystarts without errors (model not found is OK — logs warning)/person/detectionspublishes when person in frame/person/targetPoseStamped frame =base_linkbuild_trt_engine.py --onnx yolov8n.onnx --engine yolov8n.engine --verifysucceeds on Orin🤖 Generated with Claude Code
New package: saltybot_perception person_detector_node.py: - Subscribes /camera/color/image_raw + /camera/depth/image_rect_raw (ApproximateTimeSynchronizer, slop=50ms) - Subscribes /camera/color/camera_info for intrinsics - YOLOv8n inference via TensorRT FP16 engine (Orin Nano 67 TOPS) Falls back to ONNX Runtime when engine not found (dev/CI) - Letterbox preprocessing (640x640), YOLOv8n post-process + NMS - Median-window depth lookup at bbox centre (7x7 px) - Back-projects 2D pixel + depth to 3D point in camera frame - tf2 transform to base_link (fallback: camera_color_optical_frame) - Publishes: /person/detections vision_msgs/Detection2DArray all persons /person/target geometry_msgs/PoseStamped tracked person 3D /person/debug_image sensor_msgs/Image (optional) tracker.py — SimplePersonTracker: - Single-target IoU-based tracker - Picks closest valid person (smallest depth) on first lock - Re-associates across frames using IoU threshold - Holds last known position for configurable duration (default 2s) - Monotonically increasing track IDs detection_utils.py — pure helpers (no ROS2 deps, testable standalone): - nms(), letterbox(), remap_bbox(), get_depth_at(), pixel_to_3d() scripts/build_trt_engine.py: - Converts ONNX to TensorRT FP16 engine using TRT Python API - Prints trtexec CLI alternative - Includes YOLOv8n download instructions config/person_detection_params.yaml: - confidence_threshold: 0.40, min_depth: 0.5m, max_depth: 5.0m - track_hold_duration: 2.0s, target_frame: base_link launch/person_detection.launch.py: - engine_path, onnx_path, publish_debug_image, target_frame overridable Tests: 26/26 passing (test_tracker.py + test_postprocess.py) - IoU computation, NMS suppression, tracker state machine, depth filtering, hold duration, re-association, track ID Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>