This is the best ROS example in the repo for turning spatial detections into robot motion commands. It combines a stock spatial-bounding-box launch with a local follow_object node that filters for one class label and publishes /cmd_vel.
- You need a packaged ROS workspace plus a custom control node.
- You want to consume
/spatial_bband drive robot motion from it. - You need a concrete example of extending a stock DepthAI ROS launch with local behavior.
- You want a simpler custom ROS app than building a template workspace from scratch.
- You only need visualization of spatial detections.
- You need local ROS source but no control logic.
- You need browser frontend interaction or non-ROS apps.
- You need a production-ready robot controller with safety layers.
Category:apps/ros/ros-follow-objectShape:rosPrimary task:follow a selected detected class by publishing/cmd_velEntrypoint:entrypoint.shStandalone path:oakapp.tomlFrontend:noneRuns on:RVC4 standalone onlyRequires:RVC4 device; host ROS 2 environment; a robot or simulator listening on/cmd_velif you want actual motionInput:/spatial_bbmarker messages from the background spatial-bounding-box launchOutput:/cmd_velModels:spatial-detection details come from the installed external ROS launch packages, not local repo sourceVisualizer / UI:ROS 2 tools such asrviz2
- README.md: host usage, target-object note, and deployment context
- oakapp.toml: workspace build and app entrypoint
- entrypoint.sh: actual runtime orchestration
- parameters.yaml: driver parameter overrides
- src/follow_object/follow_object/follow_object_node.py: the local control node
- The build copies the local ROS workspace into
/ws/srcand runscolcon build. - entrypoint.sh sources the built workspace.
- It launches
depthai_filters spatial_bb.launch.pyin the background. - It then runs the local
follow_object_node. - The node subscribes to
/spatial_bb, picks the first marker whosetextmatchesOBJECT_MARKER_TEXT, and publishes aTwistto/cmd_vel.
device detections -> external spatial_bb launch -> /spatial_bb/spatial_bb -> follow_object_node.py -> /cmd_vel
Safe to change:target class label, controller gains, desired following distance, launch orchestration in entrypoint.shRequires care:topic names, marker text semantics, controller stability, workspace/package namingLikely to break if changed blindly:the startup sequence between the background launch and the control node, or the assumptions about marker contents in/spatial_bb
To follow a different class:editOBJECT_MARKER_TEXTin src/follow_object/follow_object/follow_object_node.pyTo change motion behavior:tuneANGULAR_SPEED_COEF,LINEAR_SPEED_COEF,KEEP_LINEAR_DIST_M, andMAX_ANG_SPEEDTo replace the stock spatial launch with your own:compare against apps/ros/ros-driver-custom-workspaceTo use this only for visualization:compare against apps/ros/ros-driver-spatial-bb
- This example is RVC4 standalone only.
- The controller is intentionally simple and does not include safety, obstacle avoidance, or watchdog logic.
- The object-selection mechanism is a hardcoded label match on marker text.
- The actual detection and spatial-bounding-box publication come from an external ROS launch, not local repo code.
- The control node searches for the first matching marker rather than tracking identities across frames.
- If the target label is not present, the node keeps rotating using the sign of the previous angular command.
- oakapp.toml installs
ros-kilted-teleop-twist-keyboard, but the default app entrypoint does not launch it.
- apps/ros/ros-driver-spatial-bb: use this when you only need
/spatial_bbvisualization - apps/ros/ros-driver-custom-workspace: use this when you need a more general custom ROS workspace template
- apps/ros/ros-driver-basic: use this when you only need stock driver topics
- neural-networks/object-tracking/people-tracker: use this when you want a non-ROS people-tracking reference
Run:oakctl app run .Host validation:ros2 topic list,ros2 topic echo /cmd_vel, andrviz2if neededSuccess looks like:/spatial_bbis present, matching detections cause/cmd_velupdates, and changingOBJECT_MARKER_TEXTchanges the target classCommon failure meaning:the workspace did not build,/spatial_bbis not being published by the background launch, or the target class label does not match the marker text