Using the RealSense Camera

Setup and launch the camera

Beginner Tutorial | Expected duration is 20 minutes

By: Akkshaj Singh, Ramon Qu, Rosario Scalise



Introduction

This tutorial will get your car’s camera operational and teach you to modify your camera data.

Goal

To get you viewing your car’s live camera feed.

Requirements

  • Complete the hardware setup with your car
  • Complete the quickstart tutorial. (Required for rviz)
  • Complete the first_steps tutorial.
  • A desktop/laptop computer that can ssh into the car.
  • An SSH-capable text editor, like Vim or Visual Studio Code (requires the SSH plugin)

SSH into the Car

$ ssh <user>@<car ip> 

Power on the Jetson, and SSH into the car, like in the first_steps tutorial. Do this in three separate terminal windows. If you’re familiar with tools like tmux or GNU Screen, feel free to use those, but they are outside the scope of the tutorial.

ROS Setup

Now that you’re connected to the car, let’s launch ROS.

$ roscore 

Normally, we would launch tele-op here in order to be able to drive the car around, but let’s try launching just the camera.

Launching the Intel RealSense Camera

First, navigate to the directory containing the realsense2 package for ROS.

$ cd ~/catkin_ws/src/realsense2/realsense2_camera/launch/

Here, you can now launch the camera by running the launchfile. Ensure your RealSense camera is connected to the Jetson’s USB port. You can verify this with the lsusb command.

$ roslaunch rs_camera.launch

If you get an error along the lines of failed to find nodelet to unload try reconnecting the camera to the Jetson and running the command again.

$ rostopic list

Run the above command, and you should be able to see the topics for the camera, like this:

/camera/color/camera_info
/camera/color/image_raw

Launching RViz on your computer

Set the ROS_IP to your IP. Your IP can be found in a variety of ways: Linux, Mac, Windows.

Note: the following commands in this section should be run in a terminal window connected to your local device, NOT the SSH window to the car.

Set ROS_IP with:

$ export ROS_IP=YOUR-IP

Set the ROS_MASTER_URI to the IP of the car. (You used this to SSH into it earlier.)

$ export ROS_MASTER_URI=http://CAR_IP_GOES_HERE:11311

Now, launch RViz.

$ rviz

If you get errors make sure the following are correct:

  • Teleop is running
  • Your laptop is connnected properly
    $ rostopic list
    This should output a bunch of camera-related topics. If not, check your ROS_MASTER_URI and ROS_IP to ensure they are correct.
/camera/color/camera_info
/camera/color/image_raw

Viewing Camera Output in RViz

In your RViz window, you can add topics to view various camera feeds from the RealSense. It is able to publish RGB, Depth, and Infrared camera data. Clicking add will allow you to view those feeds, like so:

Adding the Color Input from the RealSense. Other inputs are also visible.

Adding the Color Input from the RealSense. Other inputs are also visible.

After selecting the topic, you should be able to see the camera feed in RViz.

Changing Camera Settings

It is also possible to change camera settings and parameters, like resolution, framerate, image compression, etc. You can do this by editing the launchfile we used previously to launch the camera in the ~/catkin_ws/src/realsense2/realsense2_camera/launch/ directory. Make sure that it is not running when you do this. Open it with your text editor of choice and edit the parameters in the .launch file.

Citation

If you plan to use any part of the the MuSHR platform (including tutorials, codebase, or hardware instructions) for a project or paper, please cite MuSHR: A Low-Cost, Open-Source Robotic Racecar for Education and Research.

@article{srinivasa2019mushr,
 title={{MuSHR}: A Low-Cost, Open-Source Robotic Racecar for Education and Research},
 author={Srinivasa, Siddhartha S. and Lancaster, Patrick and Michalove, Johan and Schmittle, Matt and Summers, Colin and Rockett, Matthew and Smith, Joshua R. and Chouhury, Sanjiban and Mavrogiannis, Christoforos and Sadeghi, Fereshteh},
 journal={CoRR},
 volume={abs/1908.08031},
 year={2019}
}