ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Raspberry Pi CSI Camera Driver/Support

asked 2013-06-06 14:24:46 -0500

Marco Poli gravatar image

updated 2014-01-28 17:16:48 -0500

ngrennan gravatar image

I am thinking on buying one of the just-released Pi Cameras, a camera that seems to communicate with a Raspberry Pi module through CSI (Camera Serial Interface).

Is there support for the CSI cameras somewhere in ROS already?


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-06-07 01:37:30 -0500

davinci gravatar image

updated 2013-06-07 04:06:09 -0500

I can't find any modules for it. But the camera code is available so it could be put in a node.

Another option would be to create a mjpg stream as described here. And modify the Axis camera node to work with a non Axis mjpg stream.

edit flag offensive delete link more


Those references will surely be a good place to start. I just bought one and will get my hands on it soon, I might give this development a try. Thanks.

Marco Poli gravatar image Marco Poli  ( 2013-06-07 14:49:12 -0500 )edit

answered 2013-06-22 20:09:15 -0500

Josh Whitley gravatar image

updated 2013-11-01 14:14:12 -0500

There's a gentleman over at the Raspberry Pi forums who has broken down the example code and figured out the MMAL API that is being used. The thread with all of his info is here:

I am attempting to make a node for the Raspberry Pi camera as well so I've been working on this for a little while.

EDIT: I found a solution that works pretty well using existing software! Here are the steps that are required:

  1. Get the Raspberry Pi UV4L camera driver from
  2. Download gencam_cu from (this is still a dry package so you'll have to create a separate rosbuild workspace, overlay it on your catkin workspace using the instructions at and build it using rosmake [BUT DON'T BUILD YET]).
  3. Modify gencam_cu to include a link to the uv4l driver at build-time by modifying ~/rosbuild_ws/gencam_cu/src/CMakeLists.txt. Add the line link_directories(/usr/lib/uv4l/uv4lext/armv6l/) at the top and the line target_link_libraries(gencam_cu uv4lext) at the end.
  4. Now you can rosmake gencam_cu.
  5. Launch the uv4l driver using uv4l --driver raspicam --auto-video_nr --width 640 --height 480 --nopreview which will create an MJPEG-based camera at /dev/videoX (where X is auto-incremented starting at 0).
  6. Launch roscore, then rosrun gencam_cu gencam_cu.

I get about 16-18 fps at 640x480 and you get compressed image streams!

edit flag offensive delete link more


It will be greatly appreciated!:)

Marco Poli gravatar image Marco Poli  ( 2013-07-05 14:25:18 -0500 )edit

any progress on this? Maybe a github repo? I would be willing to contribute

kalectro gravatar image kalectro  ( 2013-08-13 04:49:50 -0500 )edit

The problem so far has been that the conversion from the camera's YUV stream to an RGB stream (needed for ROS) has caused too much overhead. However, Broadcom has recently modified the RPi firmware to allow this in the GPU. I've got an app that outputs a raw YUV stream (next comment)

Josh Whitley gravatar image Josh Whitley  ( 2013-08-13 04:55:31 -0500 )edit - This just needs to now output RGB. See the updated raspistillYUV with the -rgb option from Userland on how to accomplish this (though I've been unable to so far). Once this is added to my app, we should be able to wrap it up in C++ and make a node.

Josh Whitley gravatar image Josh Whitley  ( 2013-08-13 04:57:39 -0500 )edit

FYI - my app may be missing the vcos_semaphore that is necessary at the end of each frame since it isn't being run through the encoder. Can't remember - it's been a little while since I worked on it.

Josh Whitley gravatar image Josh Whitley  ( 2013-08-13 05:03:10 -0500 )edit

thanks, I will look into it

kalectro gravatar image kalectro  ( 2013-08-13 05:14:45 -0500 )edit

A ROS driver *could* publish a "yuv422" encoding instead of "rgb8". Maybe conversion from YUV420p to YUV422 would be easier. (I don't know whether the ROS image pipeline handles that correctly or not.)

joq gravatar image joq  ( 2013-08-13 06:13:42 -0500 )edit

There is a node that I've been developping for the camera module of the raspberry pi. The node is designed to output images in jpeg format to a topic. More information can be obtained from

machack gravatar image machack  ( 2013-09-02 05:40:05 -0500 )edit

Question Tools



Asked: 2013-06-06 14:24:46 -0500

Seen: 8,181 times

Last updated: Nov 01 '13