Streaming images from Raspi over Network: video_stream_opencv
For this particular project, I originally started off by using the
raspicam_node developed by Ubiquitous
Robotics, which handles JPEG compression on the RaspberryPi leveraging the
videocore found locally.
The publish rate tested on the Raspi was ~30hz, but over the network the
performance degrades and is unable to maintain a reasonable fps unless the dimensions are set to around 640x480. There is
also another ROS package
video_stream_opencv  that works on the Raspi pretty
much out of the box and provides ~25hz+ over the network as well with dimensions set at
640x480. The good thing with this package is that we can simply start by
sudo apt-get install ros-kinetic-video-stream-opencv and
then finish the installation process by building the package.
After installing and building the package the
webcam.launch file can be
launched which will publish the following topics.
/webcam/camera_info /webcam/image_raw /webcam/image_raw/compressed /webcam/image_raw/compressed/parameter_descriptions /webcam/image_raw/compressed/parameter_updates /webcam/image_raw/compressedDepth /webcam/image_raw/compressedDepth/parameter_descriptions /webcam/image_raw/compressedDepth/parameter_updates /webcam/image_raw/theora /webcam/image_raw/theora/parameter_descriptions /webcam/image_raw/theora/parameter_updates
Checking the publishing rate over the network from the master computer results in satisfactory results.
$ rostopic hz /webcam/image_raw/compressed subscribed to [/webcam/image_raw/compressed] average rate: 31.105 min: 0.020s max: 0.040s std dev: 0.00453s window: 27 average rate: 29.865 min: 0.004s max: 0.153s std dev: 0.01801s window: 55 average rate: 29.978 min: 0.000s max: 0.167s std dev: 0.02493s window: 86