ON THIS PAGE

  • Quickstart - Basic App installation
  • Developing ROS Apps for RVC4
  • Modifying basic example
  • Custom workspace and pipeline

Quickstart - Basic App installation

After setting up your camera, you should be able to see the ROS Packages App category in Hub App Store.If you install and run it, the camera will run ROS driver onboard and publish RGB, Depth and IMU data. You can inspect and visualize this data on host PC that is connected to the same network same way you would with a normal ROS running device.

Developing ROS Apps for RVC4

All examples below can be found in examples repository.

Modifying basic example

Let's take a look how basic example that is published to the store is built. You can find it in ros-driver-basic directory.What interests us the most are oakapp.toml and parameters.yaml files. In parameters.yaml we can set parameters for the driver as described in parameters description article.
Yaml
1/**:
2  ros__parameters:
3    driver:
4      i_enable_ir: true
5    pipeline_gen:
6      i_pipeline_type: RGBD
oakapp.toml describes the environment in which our app is running. It uses a base ROS Kilted image in which depthai-ros package is installed, and to which the parameters file is copied into. After setup, the driver is launched and parameter file is passed into it.
Toml
1identifier = "example.apps.ros.ros-driver-basic"
2app_version = "0.9.0"
3
4prepare_container = [
5    { type = "COPY", source = "resolv.conf", target = "/etc/resolv.conf" },
6    { type = "RUN", command = "apt-get update" },
7    { type = "RUN", command = "apt-get install -y ros-kilted-depthai-ros"},
8]
9
10prepare_build_container = [
11
12]
13
14build_steps = [
15]
16
17entrypoint = ["bash", "-c", "source /opt/ros/kilted/setup.bash && ros2 launch depthai_ros_driver driver.launch.py params_file:=/app/parameters.yaml"]
18
19[base_image]
20api_url = "https://registry-1.docker.io" 
21service = "registry.docker.io" 
22oauth_url = "https://auth.docker.io/token"
23auth_type = "repository" 
24auth_name = "library/ros"
25image_name = "library/ros"
26image_tag = "kilted-ros-base"
ros-driver-rgb-pcl and ros-driver-spatial-bb examples follow similar logic, they use different launch files and parameters.
Toml
1identifier = "example.apps.ros.driver-rgb-pcl"
2app_version = "0.9.0"
3
4prepare_container = [
5    { type = "COPY", source = "resolv.conf", target = "/etc/resolv.conf" },
6    { type = "RUN", command = "apt-get update" },
7    { type = "RUN", command = "apt-get install -y ros-kilted-depthai-ros"},
8]
9
10prepare_build_container = [
11
12]
13
14build_steps = [
15]
16
17entrypoint = ["bash", "-c", "source /opt/ros/kilted/setup.bash && ros2 launch depthai_ros_driver rgbd_pcl.launch.py"]
18
19[base_image]
20api_url = "https://registry-1.docker.io" 
21service = "registry.docker.io" 
22oauth_url = "https://auth.docker.io/token"
23auth_type = "repository" 
24auth_name = "library/ros"
25image_name = "library/ros"
26image_tag = "kilted-ros-base"
Toml
1identifier = "example.apps.ros.driver-spatial-bb"
2app_version = "0.9.0"
3
4prepare_container = [
5    { type = "COPY", source = "resolv.conf", target = "/etc/resolv.conf" },
6    { type = "RUN", command = "apt-get update" },
7    { type = "RUN", command = "apt-get install -y ros-kilted-depthai-ros"},
8]
9
10prepare_build_container = [
11
12]
13
14build_steps = [
15]
16
17entrypoint = ["bash", "-c", "source /opt/ros/kilted/setup.bash && ros2 launch depthai_filters spatial_bb.launch.py"]
18
19[base_image]
20api_url = "https://registry-1.docker.io" 
21service = "registry.docker.io" 
22oauth_url = "https://auth.docker.io/token"
23auth_type = "repository" 
24auth_name = "library/ros"
25image_name = "library/ros"
26image_tag = "kilted-ros-base"

Custom workspace and pipeline

Another interesting example is located in ros-driver-custom-workspace. In it we can see how one can develop a full ROS application performing directly on the device.As in the previous example, we have oakapp.toml and parameters.yaml files.Additionally a src directory which corresponds to how src directory is set up in a classical ROS workspace. In it, we have two packages example_package which is based on a ROS publisher tutorial and contains a custom launch file used for this demonstration.We can also see dai_ros_plugins package which shows how one could create a custom plugin pipeline which then can be loaded directly in the driver.The pipeline plugin type is specified in parameters.yaml file which is passed to the custom launch file.In oakapp.toml file we can see how our custom workspace is built (directly on the device!) and loaded.
Toml
1identifier = "example.apps.ros.driver-custom-workspace"
2app_version = "0.9.0"
3
4prepare_container = [
5    { type = "COPY", source = "resolv.conf", target = "/etc/resolv.conf" },
6    { type = "RUN", command = "apt-get update -qq" },
7    { type = "RUN", command = "apt install -y ros2-testing-apt-source"},
8    { type = "RUN", command = "apt-get update -qq" },
9    { type = "RUN", command = "apt-get install -qy ros-kilted-depthai-ros python3-colcon-common-extensions"},
10]
11
12prepare_build_container = [
13
14]
15
16build_steps = [
17    "mkdir -p /ws/src",
18    "cp -r /app/src/ /ws/",
19    'bash -c "cd /ws && source /opt/ros/kilted/setup.bash && colcon build"'
20]
21
22entrypoint = ["bash", "-c", "source /ws/install/setup.bash && ros2 launch example_package example.launch.py"]
23
24[base_image]
25api_url = "https://registry-1.docker.io" 
26service = "registry.docker.io" 
27oauth_url = "https://auth.docker.io/token"
28auth_type = "repository" 
29auth_name = "library/ros"
30image_name = "library/ros"
31image_tag = "kilted-ros-base"