Run Edge Impulse Object Detection with ROS 2
edgeimpulse_ros is a ROS 2 package that runs an Edge Impulse Linux .eim model and publishes the results as standard ROS 2 messages. In this series, it is the shared perception layer used by the JetBot on Rubik Pi tutorial and by generic rover-style inspection systems.
The UNO Q Braccio tutorial uses a different, repo-native Edge Impulse runner pipeline, so treat this page as the generic edgeimpulse_ros reference rather than the literal backend for every robot tutorial.
The node is a pure inference processor: it subscribes to a standard sensor_msgs/Image topic and publishes vision_msgs out. A separate camera driver supplies the frames, and the node does not control a robot. Those responsibilities stay in robot-specific ROS 2 packages.
What you will build
You will run a ROS 2 inference node that subscribes to a camera driver’s image topic, runs local Edge Impulse inference, and publishes bounding boxes, latched label metadata, and diagnostics.
A JetBot simulation environment used to develop robot-side ROS 2 workflows
Prerequisites
- A ROS 2 workspace on Jazzy or Rolling (which ship
vision_msgs4.x). The robot tutorials in this series use ROS 2 Jazzy on Ubuntu 24.04. Humble support is on the roadmap but not yet validated in CI. - A camera driver that publishes a
sensor_msgs/Imagetopic, such asv4l2_camerafor a USB camera at/dev/video*. - An Edge Impulse account and a trained image project (object detection, classification, FOMO, or visual anomaly).
- A Linux
.eimdeployment downloaded from Edge Impulse Studio, matching your device architecture.
pyaudio install into your user site with --break-system-packages:
The Edge Impulse Linux SDK imports
pyaudio at load time even for image models, so portaudio19-dev is required to build it. Install the SDK into the same Python environment that ROS 2 uses to start the node, and do not clone the Linux Python SDK inside a colcon workspace; colcon can mistake it for a ROS package.1. Export an Edge Impulse model
- Train and test an object detection impulse in Edge Impulse Studio.
- Open Deployment and select the Linux deployment.
- Build and download the
.eimfile. - Copy the file to the inference host, for example
~/models/object-detector.eim.
2. Build the package
Clone the package into a ROS 2 workspace and build it:3. Run the detector
The node needs frames on an image topic. The quickest way to see it working is the bundled webcam demo, which also starts av4l2_camera driver for you (needs ros-$ROS_DISTRO-v4l2-camera):
ros2 run:
confidence_threshold filters low-confidence boxes before publishing. The default -1.0 uses the model’s own threshold; set a value such as 0.5 to raise it when false positives are costly, or lower it while assessing recall in a controlled test.
Outputs
Topics are published relative to the node, whose default namespace is/edgeimpulse_detector. Which result topics appear depends on the model type.
Inspect the output in another terminal:
Detection2DArray contains every accepted bounding box in one frame, mapped back from the model input resolution to the original image pixels. For 2D detection, the pose and covariance fields exposed by vision_msgs are not meaningful; they are present because of the standard message definition.
Useful parameters
A ready-to-edit parameter file ships at
config/edgeimpulse_detector.yaml in the package.
Troubleshooting
Use it with a robot
After the detector is publishing stable messages, connect the output to robot-specific logic:- Follow Run Edge Impulse Vision on a JetBot with Rubik Pi to combine detector output with JetBot motor control.
- Follow Build a Mobile Inspection System with Edge Impulse and ROS 2 to design a rover-style inspection architecture with detection, anomaly scoring, and operator traceability.
- Follow Run Edge Impulse Pick and Place with UNO Q Braccio for the current Braccio-specific runner pipeline and arm workflow.
.eim deployments, keep the same separation of concerns: run a camera driver, use edgeimpulse_ros for perception, then create a separate ROS 2 node that subscribes to /edgeimpulse_detector/detections and applies the robot’s safety checks, state machine, and actuation logic.
Next steps
- Validate the
.eimmodel with the final camera, lighting, and object distance. - Watch
/diagnostics(FPS and latency) while the robot is under load. - Add robot-specific gating before any autonomous motion.
- Package the launch file and parameters with the robot repository rather than modifying the generic detector node.