Skip to main content

Run Edge Impulse Vision on a JetBot with Rubik Pi

This tutorial runs an Edge Impulse object-detection model on a JetBot-class robot using a Qualcomm Rubik Pi, Ubuntu 24.04, and ROS 2 Jazzy. It combines the robot-specific jetbot_ros package with edgeimpulse_ros. edgeimpulse_ros subscribes to a sensor_msgs/Image topic and publishes detections; the JetBot launch file starts a v4l2_camera driver to supply those frames. jetbot_ros provides motor control, teleoperation, navigation, and launch integration. Keeping these roles separate makes the same perception node reusable across different robot platforms.
JetBot Gazebo simulation with a camera stream

JetBot Gazebo development environment and simulated camera stream

What you will build

You will run local object detection on the robot’s camera feed, publish the results into ROS 2, and keep the mobile base control path available for robot-specific behavior nodes.

Prerequisites

  • A Rubik Pi running Ubuntu 24.04 and ROS 2 Jazzy.
  • A SparkFun JetBot AI Kit v2.0 or compatible JetBot-class chassis with a SparkFun or Waveshare motor controller.
  • A USB camera connected to the Rubik Pi.
  • A Linux .eim object-detection model exported from Edge Impulse Studio.
  • Local copies of ei_jetbot_ros_rubikpi and edgeimpulse-ros.
Read Run Edge Impulse Object Detection with ROS 2 first for the shared model export, runtime, and topic details.

1. Provision the Rubik Pi

On the Rubik Pi, run the repository’s provisioner:
It installs the ROS 2 Jazzy base packages, V4L2 camera support, vision_msgs, diagnostic_msgs, OpenCV, NumPy, PortAudio (for the SDK’s pyaudio dependency), and the JetBot hardware dependencies. For the SparkFun hardware path, confirm the Qwiic driver is available:

2. Build a shared ROS 2 workspace

The JetBot helper links both packages into the same workspace:
Install the Edge Impulse Linux SDK and the JetBot runtime requirements:
The repository currently installs the Edge Impulse runtime into the system Python on Ubuntu 24.04 by using —break-system-packages. That matches the repo, but treat it as a dedicated robot-image or disposable development-machine workflow rather than a general-purpose Python setup.

3. Start motor control and object detection

The integrated launch file starts the motor node, a v4l2_camera driver, and the edgeimpulse_ros detector. Give it the model path and the camera device:
For a Waveshare motor board, install the required motor-driver package first:
Then replace the motor executable:
The launch file already starts a v4l2_camera driver on video_device. Do not start a second camera driver on the same /dev/video* device at the same time. On the validated Rubik Pi camera path, use YUYV if MJPG causes an empty encoding or a cv_bridge exception.

4. Inspect inference output

The detector publishes these topics:
Keep the vision pipeline observational until detections are stable. A downstream behavior node should gate any autonomous action on confidence, label, and robot state rather than acting on every frame.

Motor and camera checks

Before connecting detection output to autonomy, verify the base robot path independently. Start normal hardware control:
Then publish a short forward command and a stop:

Simulation notes

The repository includes Gazebo Classic worlds for navigation and data collection. Use them on an Ubuntu or WSL development machine where Gazebo Classic is available:
The current edgeimpulse_ros package subscribes to a sensor_msgs/Image topic, so it can in principle consume the Gazebo camera stream by pointing image_topic at it. This repo validates the detector against the real V4L2 camera path, so treat the Gazebo integration as unvalidated.

Troubleshooting

Next steps

  • Add a behavior node that subscribes to /edgeimpulse_detector/detections and publishes guarded /cmd_vel commands.
  • Watch /diagnostics (FPS and latency) under load to understand the inference budget.
  • Collect additional training data from the final camera position.
  • Validate any autonomous behavior at low speed before increasing robot velocity.