A compilation of concepts I want to remember...

Navigation
 » Home
 » About Me
 » Github

ROS + RaspberryPi Camera Module #1: Publishing image from raspi on different host machine.

28 Aug 2017 » ros, raspberrypi

TL;DR: Make sure your environment is setup correctly and remember (stating the obvious) that you will be working on a ARM architecture as opposed to a x86 most likely found on your laptop.

Setup

Environment: Raspi3 running UbuntuMATE 16.04.2 using the Raspi Camera v2.1. ROS Kinetic is used and one can install ROS Kinetic for Ubuntu running on ARM architecture using instructions found here

These notes assumes you have enabled the camera through raspi-config. Make sure raspistill and raspivid are functioning as expected. (ex. raspistill -o test.png should result in an image named test.png placed in the current directory.)

Using the raspicam_node

One can take the time to program their own Raspi camera node, but for this exercise we will be using raspicam_node created by UbiquityRobotics. The ROS node can be installed following the instructions found here.

Network configuration

Some steps need to be taken to address the network configuration, in order for Raspi to communicate with a master on a different machine.

  1. http://wiki.ros.org/ROS/Tutorials/MultipleMachines
  2. http://wiki.ros.org/ROS/NetworkSetup

In summary, ROS_MASTER_URI that is set for the machine considered the master (laptop in my case), needs to be set exactly the same for the child (raspberry-pi in my case). In my particular case, the hostnames were not resolving, and was getting an error message Couldn't find an AF_INET address for on my master machine. To resolve this issue, I explicitly specified the ROS_IP of the child. (Use ifconfig to find IP address of the child).

Once the network is setup, roscore needs to be initialized on the master (laptop), before launching the launch file related to raspicam_node, otherwise you will get an error message indicating that the master can not be reached.

The raspicam_node outputs the following topics:

/raspicam_node/camera_info
/raspicam_node/image/compressed
/raspicam_node/parameter_descriptions
/raspicam_node/parameter_updates
/rosout
/rosout_agg

Notice that the /raspicam_node/image/compressed is only available, thus without the appropriate conversion, the image will not be viewable using rosrun image_view image_view image:=/topic_name. Thus we will need to publish a conversion from /image/compressed topic to /image by using ` rosrun image_transport republish compressed in:=/raspicam_node/image raw out:=/raspicam_node/image. Another way to access the image is by using rqt_image_view` which starts a GUI and allows for the visualization of the capture.

Next steps

Now that we have the camera working on a child machine separate from the master, we can work on more interesting robotics projects related to collaboration across multiple machines.

References

  1. https://ubuntu-mate.org/raspberry-pi/
  2. http://wiki.ros.org/kinetic/Installation/Ubuntu
  3. https://github.com/UbiquityRobotics/raspicam_node)
  4. http://wiki.ros.org/ROS/Tutorials/MultipleMachines
  5. http://wiki.ros.org/ROS/NetworkSetup