This is an example of ROS driver being run as an OAK 4 app. It launches ROS driver in standalone and publishes RGB, Stereo and IMU data. These topics can be accessible for viewing and/or further processing directly on host. It is based on ROS2 Kilted, but you should be able to subscribe to topics in other distributions such as Humble or Jazzy. To change the behavior of the driver, you can use parameters.yaml file which is passed to the driver.
Before you begin, ensure you have the following installed on your host machine:
- ROS2 (Humble, Jazzy, or Kilted)
- Rviz2
-
Install the required ROS packages:
sudo apt update sudo apt install ros-$ROS_DISTRO-image-transport-plugins ros-$ROS_DISTRO-rviz2
-
Source your ROS2 environment:
source /opt/ros/$ROS_DISTRO/setup.bash
-
Launch the OAK 4 app with the ROS driver:
cd <path_to_this_example> oakctl app run .
-
In a new terminal, source your ROS2 environment and run Rviz2:
source /opt/ros/$ROS_DISTRO/setup.bash rviz2
-
In Rviz, add a new display by clicking the "Add" button in the bottom toolbar. Note, you can add by display type, or just by topic which will automatically add the correct display type.
-
For RGB camera visualization:
- Add a "Image" display
- Set the topic to
/oak/rgb/image_raw - Adjust the display settings as needed
-
For depth stream visualization:
- Add a "Image" display for left camera:
/oak/stereo/image_raw
- Add a "Image" display for left camera:
-
For IMU data visualization:
- Add a "IMU" display
- Set the topic to
/oak/imu/data
-
Save your Rviz configuration for future use by clicking "File" > "Save Config".
If you encounter issues with topic names or data types, verify that your ROS2 distribution matches the one used in the example. You may need to adjust topic names or data types accordingly.
sudo apt install ros-$ROS_DISTRO-rmw-cyclonedds-cpp
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp