Skip to content

Camera feed and depth camera

Adnan Munawar edited this page Oct 12, 2021 · 6 revisions

These features only work on Linux with ROS installed. Additionally, you should have the following packages installed on your system.

cv-bridge # Can be installed via apt install ros-<version>-cv-bridge
image-transport # Can be installed via apt install ros-<version>-image-transport

Once these packages are installed, you can rebuild ambf to automatically enable support.

Now you can edit your world.yaml file that contains the cameras for which you want to enable camera feed and/or depth pointcloud publishing.

The default world file is located here: https://github.com/WPI-AIM/ambf/blob/ambf-1.0/ambf_models/descriptions/world/world.yaml

Inspecting its contents:

enclosure size: {length: 10.0, width: 10.0, height: 3.0}
lights: [light1]
cameras: [camera1] # You can see, we are going to load a camera called camera1 which is defined later in this file
environment: "./checkered_floor.yaml"
namespace: /ambf/env/
max iterations: 50
gravity: {x: 0.0, y: 0.0, z: -9.81}
...
...
camera1:
  namespace: cameras/
  name: default_camera
  location: {x: 4.0, y: 0.0, z: 2.0}
  look at: {x: 0.0, y: 0.0, z: -0.5}
  up: {x: 0.0, y: 0.0, z: 1.0}
  clipping plane: {near: 0.1, far: 10.0}
  field view angle: 0.8
  monitor: 0
  # multipass: True
  # publish image: True
  # publish image interval: 1 # Publish every nth scene update
  # publish depth: True
  # publish depth interval: 10 # Publish every nth scene update

By uncommenting/adding the following line, we can enable camera feed publishing

  publish image: True
  # publish image interval: 1 # Publish every nth scene update. Default 1

and by uncommenting this field, we can enable depth pointcloud computation and publishing

  publish depth: True
  # publish depth interval: 10 # Publish every nth scene update. Default 10

The camera feed is published to the following topic:

/<namespace>/<camera_name>/ImageData/*

and the depth pointcloud is published to the following topics:

/<namespace>/<camera_name>/DepthData/

You can also view either topic in RViz.

Here is an example image:

Clone this wiki locally