A compilation of concepts I want to remember...

 » Home
 » About Me
 » Github

Turtlepi #3: Getting RGB image to display in RViz using the Astra Pro Camera

03 May 2017 » RViz, turtlebot

Update: 2020/1/22

If you find this article at all helpful, please consider a supportive contribution.



This is somewhat specific to the Turtlebot 2 that is being shipped with the Astra Pro by Clearpath Robotics.

At least in my case, there were some obstacles in getting the RGB camera and depth camera working simultaneously out of the box. This post is an attempt to document a working solution.

Appears that others have had similar issues fwiw.

Getting the Launch file

I will quickly outline the solution to get the Astra Pro working such that depth and RGB image topics are recognized by RViz. (I specify the objective as getting RViz to recognize /camera/rgb/image_raw topic as this is a result that was necessary for the current ongoing project.

First get the astra_pro.launch file following the below steps:

mkdir -p turtlebot_ws/src
cd turtlebot_ws/src
git clone https://github.com/tonybaltovski/ros_astra_launch.git --branch
git clone https://github.com/tonybaltovski/ros_astra_camera.git --branch
cd ..
rosdep install --from-paths src --ignore-src --rosdistro=indigo -y
source devel/setup.bash
rosrun astra_camera create_udev_rules
(you may need to reboot here)
roslaunch astra_launch astra_pro.launch

You can investigate the launch file to get a better idea of what is being called, and what parameters are being set.

This will allow for the depth camera to function as well as the RGB camera. After launching roslaunch astra_pro.launch, we can run rostopic list and the list of all available topics will be outputted to the terminal.

We should be able to confirm that the below topics related to the depth camera and RGB image camera are available as well.



At this point rosrun image_view image_view image:=/camera/rgb/image_raw works but trying to subscribe to the /camera/rgb/image_raw topic in RViz will result in the following status error message:

CameraInfo/P resulted in an invalid position calculation (nans or infs)

This requires a relatively manual step that is most likely not obvious to new comers. To resolve this we need to:

  1. Create a yaml file related to the RGB camera calibrations, which will be named rgb_Astra_Orbbec.yaml.
  2. Edit the astra_pro.launch to reflect the location of the yaml file.

Camera calibration


In order to generate the rgb_Astra_Orbbec.yaml file we can follow the tutorial “How to Calibrate a Monocular Camera”.[1] A couple points to note:

  1. They use a large checker board for calibration, with the checker dimensions set at 108mm. You can use a smaller checker board but make sure that you set the --square argument to reflect the size that you use. A checker board printed to A4 printing paper will be associated with 2.5cm sized checkers, based on my measurements. Note that a checker board template is made available in the tutorial.

  2. After calibrating hit commit, (it does really take a minute or so, and the screen does appear to freeze temporarily), and this should create a directory in .ros called camera_info if it doesn’t exist already and place a file named rgb_Astra_Orbbec.yaml.

Edits to Launch file

Before making the amends, launch astra_pro.launch and run rostopic echo /camera/rgb/camera_info. You should notice that the values are not populated and filled with zeros.

  seq: 416
    secs: 1493810620
    nsecs:  89788527
  frame_id: camera_rgb_optical_frame
height: 0
width: 0
distortion_model: ''
D: []
K: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
R: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
P: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
binning_x: 0
binning_y: 0
  x_offset: 0
  y_offset: 0
  height: 0
  width: 0
  do_rectify: False

Open the launch file and direct your attention to 19-23:

<!-- By default, calibrations are stored to
where ${NAME} is of the form "[rgb|depth]_[serial#]", e.g.
See camera_info_manager docs for calibration URL details. -->
<arg name="rgb_camera_info_url" default="" />
<arg name="depth_camera_info_url" default="" />

Set the default argument for rgb_camera_info_url file:///$HOME/.ros/camera_info/rgb_Astra_Orbbec.yaml

Now go to line 132, where you should see

<!-- <param name="camera_info_url" value="file:///tmp/cam.yaml"/> -->

Uncomment and replace with:

<param name="camera_info_url" value="$(arg rgb_camera_info_url)"/>

This should resolve the issue and rostopic echo /camera/rgb/camera_info should output the correct values derived from the calibration yaml file we generated earlier.

  seq: 44
    secs: 1493810762
    nsecs: 374881266
  frame_id: camera_rgb_optical_frame
height: 480
width: 640
distortion_model: plumb_bob
D: [0.1924862242666659, -0.1428745350678355, -0.008005953314755045,
-0.01514558091529794, 0.0]
K: [631.9627446307516, 0.0, 292.3340769022051, 0.0, 626.7628503190605,
231.5643918983762, 0.0, 0.0, 1.0]
R: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
P: [663.3839721679688, 0.0, 285.5615141729359, 0.0, 0.0, 662.3782348632812,
228.5056059693034, 0.0, 0.0, 0.0, 1.0, 0.0]
binning_x: 0
binning_y: 0
  x_offset: 0
  y_offset: 0
  height: 0
  width: 0
  do_rectify: False

Further, subscribing to /camera/rgb/image_raw should not output a status error in RViz, and you should be able to visualize the RGB image properly.


  1. http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration