raspicam_node package from raspicam_node repo

raspicam_node

Package Summary

Tags No category tags.
Version 0.4.0
License BSD
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/UbiquityRobotics/raspicam_node.git
VCS Type git
VCS Version kinetic
Last Updated 2019-05-03
Dev Status UNMAINTAINED
Released UNRELEASED

Package Description

Package to access the Raspberry Pi Camera from ROS.

Additional Links

No additional links.

Maintainers

  • Rohan Agrawal
  • Wayne Gramlich

Authors

No additional authors.

raspicam_node

ROS node for the Raspberry Pi Camera Module. Works with both the V1.x and V2.x versions of the module. We recommend using the v2.x cameras as they have better auto gain, and the general image quality is better.

Installation

A binary can be found at https://packages.ubiquityrobotics.com/ follow the instructions there to add the repository.

Then run sudo apt install ros-kinetic-raspicam-node

Build Intructions

If you want to build from source instead of using the binary follow this section.

This node is primarily supported on ROS Kinetic, and Ubuntu 16.04, and that is what these instuctions presume.

Go to your catkin_ws cd ~/catkin_ws/src.

Download the source for this node by running

git clone https://github.com/UbiquityRobotics/raspicam_node.git

There are some dependencies that are not recognized by ros, so you need to create the file /etc/ros/rosdep/sources.list.d/30-ubiquity.list and add this to it.

yaml https://raw.githubusercontent.com/UbiquityRobotics/rosdep/master/raspberry-pi.yaml

Then run rosdep update.

Install the ros dependencies,

cd ~/catkin_ws
rosdep install --from-paths src --ignore-src --rosdistro=kinetic -y

Compile the code with catkin_make.

Running the Node

Once you have the node built, you can run it using a launch file.

For a V2.x camera, run roslaunch raspicam_node camerav2_1280x960.launch

For a V1.x camera, run roslaunch raspicam_node camerav1_1280x720.launch

Use rqt_image_view on a connected computer to view the published image.

Configuring the node with dynamic reconfigure

The raspicam_node supports dynamically reconfiguring the camera parameters.

Run the dynamic reconfigure node on a connected computer:

rosrun rqt_reconfigure rqt_reconfigure

It should bring up a user interface like the one below. Paramaters can be dynamically adjusted via this interface.

rqt_reconfigure

Troubleshooting

  1. Make sure that your user is in the video group by running groups|grep video.

  2. If you get an error saying: Failed to create camera component, make sure that the camera cable is properly seated on both ends, and that the cable is not missing any pins.

  3. If the publish rate of the image over the network is lower than expected, consider using a lower resolution to reduce the amount of bandwidth required.

Node Information

Topics:

  • ~/image/compressed: Publishes sensor_msgs/CompressedImage with jpeg from the camera module.

  • ~/image: Publishes sensor_msgs/Image from the camera module (if parameter enable_raw is set).

  • ~/motion_vectors: Publishes raspicam_node/MotionVectors from the camera module (if parameter enable_imv is set).

  • ~/camera_info: Publishes sensor_msgs/CameraInfo camera info for each frame.

Services:

  • ~/set_camera_info: Used to update calibration info for the camera.

Parameters:

  • ~private_topics (bool): By default the topics are private, meaning the node name will be added in front of every topic name. If you don't want the topics to be private, you can set this parameter to "true". This parameter is mainly present in order to keep backward compatibility.

  • ~camera_frame_id (tf frame): The frame identifier to associate the camera.

  • ~camera_info_url: The URL of the camera calibration .yaml file.

  • ~camera_name (string): The name of the camera, should match with name in camera_info file.

  • ~framerate (fps): Framerate to capture at. Maximum 90fps

  • ~height (pixels): Height to capture images at.

  • ~width (pixels): Width to capture images at.

  • ~quality (0-100): Quality of the captured images.

  • ~enable_raw (bool): Publish a raw image (takes more CPU and memory)

  • ~enable_imv (bool): Publish inline motion vectors computed by the GPU

  • ~camera_id (int): The camera id (only supported on Compute Module)

Calibration

The raspicam_node package contains a calibration file for the raspberry PI camera versions 1 and 2.

A tutorial Monocular Camera Calibration tutorial shows how to calibrate a single camera.

The 8x6 checkerboard and the 7x6 checkerboard are rather large and require specialized printers to print out at full scale. They can be printed on more common printer sizes with auto scaling turned on. Be sure to carefully measure the square size in millimeters and convert to meters by dividing by 1000.

Running calibration requires raw publishing enabled. Add enable_raw:=true to the camera roslaunch command.

If you are not sure which launch file to use camerav2_1280x960_10fps.launch is probably what you are looking for.

On the Pi

roslaunch raspicam_node camerav2_1280x960_10fps.launch enable_raw:=true

On your workstation:

rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.074 image:=/raspicam_node/image camera:=/raspicam_node

Motion vectors

The raspicam_node is able to output motion vectors calculated by the Raspberry Pi's hardware video encoder. These motion vectors can be used for various applications such as motion detection.

On the Pi, add enable_imv:=true to the camera roslaunch command:

roslaunch raspicam_node camerav2_410x308_30fps.launch enable_imv:=true

On your workstation, build raspicam_node so that the MotionVectors ROS message is recognized by Python:

cd ~/catkin_ws
catkin_make
source ~/catkin_ws/devel/setup.bash

Finally, run script imv_view.py to visualize the motion vectors:

rosrun raspicam_node imv_view.py

CHANGELOG

Changelog for package raspicam

0.4.0 (2018-11-07)

  • Add support for optionally publishing raw image
  • Add parameter for selecting the camera id (Compute Module)
  • Don\'t allocate new messages for every frame
  • Cleanup log noise
  • Fix gcc warnings (enable -Wall)
  • Fix dynamic reconfigure bug (Fixes #31)
  • Remove old unused cruft
  • Use unique_ptr with custom deleters to manage mmal components
  • Pass state around by reference instead of as a global
  • Use C++14
  • Use clang format from https://github.com/davetcoleman/roscpp_code_format
  • Contributors: Jose Eduardo Laruta Espejo, Rohan Agrawal

0.3.0 (2018-09-28)

  • use user writeable calibration after the package one
  • set camera name everywhere
  • Contributors: Rohan Agrawal

0.2.3 (2018-09-20)

  • new calibration parameters
  • Contributors: Rohan Agrawal

0.2.2 (2017-11-19)

  • add proper includes to header RaspiCamControl
  • applied clang format
  • Add low res mode for tracking
  • Add note about publish rate over the network.
  • Add note about dynamic reconfigure
  • Contributors: Jan Koniarik, Jim Vaughan, Rohan Agrawal, davecrawley

0.2.1 (2017-02-25)

  • Dependency fixes
  • Contributors: Rohan Agrawal

0.2.0 (2017-02-25)

  • Add launch files and camera calibrations
  • Add documentation to get pi-deps
  • Proper dependancy declaration
  • Pull in all SV-ROS development
  • Dynamic reconfigure support
  • Support for both CameraV1 and V2
  • Contributors: Girts Linde, Jim Vaughan, Rohan Agrawal

0.1.0 (2016-04-14)

  • Fixed link order bug
  • Make structs char const instead of char Prevents lots of compile warnings
  • Cleanup package.xml, using format 2
  • Move find_lib stuff to more appropriate place in CMakeLists
  • More robust CMakeLists
  • Got raspicam to compile a fake node on the x86_64 architecture without any modification to CMakelists.txt
  • Initial commit
  • Contributors: David Datjko, Girts Linde, Jim Vaughan, Kent Williams, Rohan Agrawal, Wayne C. Gramlich, atp42, datjko, fpasteau

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Dependant Packages

No known dependants.

Launch files

  • launch/camerav2_1280x720.launch
      • enable_raw [default: false]
      • enable_imv [default: false]
      • camera_id [default: 0]
      • camera_frame_id [default: raspicam]
      • camera_name [default: camerav2_1280x720]
  • launch/camerav2_410x308_30fps.launch
      • enable_raw [default: false]
      • enable_imv [default: false]
      • camera_id [default: 0]
      • camera_frame_id [default: raspicam]
      • camera_name [default: camerav2_410x308]
  • launch/camerav1_1280x720.launch
      • enable_raw [default: false]
      • enable_imv [default: false]
      • camera_id [default: 0]
      • camera_frame_id [default: raspicam]
      • camera_name [default: camerav1_1280x720]
  • launch/camerav2_1280x960_10fps.launch
      • enable_raw [default: false]
      • enable_imv [default: false]
      • camera_id [default: 0]
      • camera_frame_id [default: raspicam]
      • camera_name [default: camerav2_1280x960]
  • launch/camerav2_1280x960.launch
      • enable_raw [default: false]
      • enable_imv [default: false]
      • camera_id [default: 0]
      • camera_frame_id [default: raspicam]
      • camera_name [default: camerav2_1280x960]

Services

No service files found

Plugins

No plugins found.

Recent questions tagged raspicam_node at answers.ros.org

raspicam_node package from raspicam_node repo

raspicam_node

Package Summary

Tags No category tags.
Version 0.3.0
License BSD
Build type CATKIN
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/UbiquityRobotics/raspicam_node.git
VCS Type git
VCS Version indigo
Last Updated 2018-10-08
Dev Status UNMAINTAINED
Released UNRELEASED

Package Description

Package to access the Raspberry Pi Camera from ROS.

Additional Links

No additional links.

Maintainers

  • Rohan Agrawal
  • Wayne Gramlich

Authors

No additional authors.

raspicam_node

ROS node for the Raspberry Pi Camera Module. Works with both the V1.x and V2.x versions of the module. We recommend using the v2.x cameras as they have better auto gain, and the general image quality is better.

Build Intructions

This node is primarily supported on ROS Kinetic, and Ubuntu 16.04, and that is what these instuctions presume.

Go to your catkin_ws cd ~/catkin_ws/src.

Download the source for this node by running

git clone https://github.com/UbiquityRobotics/raspicam_node.git

There are some dependencies that are not recognized by ros, so you need to create the file /etc/ros/rosdep/sources.list.d/30-ubiquity.list and add this to it.

yaml https://raw.githubusercontent.com/UbiquityRobotics/rosdep/master/raspberry-pi.yaml

Then run rosdep update.

Install the ros dependencies,

cd ~/catkin_ws
rosdep install --from-paths src --ignore-src --rosdistro=kinetic -y

Compile the code with catkin_make.

Running the Node

Once you have the node built, you can run it using a launch file.

For a V2.x camera, run roslaunch raspicam_node camerav2_1280x960.launch

For a V1.x camera, run roslaunch raspicam_node camerav1_1280x720.launch

Use rqt_image_view to view the published image.

Configuring the node with dynamic reconfigure

This section describes how to use a second computer to dynamically adjust the paramaters of the node. It assumes that the Raspberry PI on which the raspicam_node is running has a hostname of raspi.local and that the reconfiguration is being run on a second computer with a hostname of laptop.local.

  1. Ensure that the ROS environment variables on raspi.local are set so that other machines can interact with its ROS nodes. If they varaiables contain the string localhost, they need to be changed.
ubuntu@raspi:~$ echo $ROS_HOSTNAME 
raspi.local
ubuntu@raspi:~$ echo $ROS_MASTER_URI 
http://raspi.local:11311

If necessary they can be adjusted thus:

export ROS_HOSTNAME=`hostname`.local
export ROS_MASTER_URI=${ROS_HOSTNAME}:11311

The changes can be made persistent by adding those two lines to ~/.bashrc.

  1. One the laptop, set the environment variable ROS_MASTER_URI as above:
export ROS_MASTER_URI=${ROS_HOSTNAME}:11311

  1. Run the dynamic reconfigure node on laptop.local:
rosrun rqt_reconfigure rqt_reconfigure 

It should bring up a user interface like the one below. Paramaters can be dynamically adjusted via this interface.

rqt_reconfigure

Troubleshooting

  1. Make sure that your user is in the video group by running groups|grep video.

  2. If you get an error saying: Failed to create camera component, make sure that the camera cable is properly seated on both ends, and that the cable is not missing any pins. If this doesn't work update your firmware with rpi-update.

  3. If the publish rate of the image over the network is lower than expected, consider using a lower resolution to reduce the amount of bandwidth required.

Node Information

Topics:

  • /raspicam_node/compressed: Publishes sensor_msgs/CompressedImage with jpeg from the camera module.

  • /raspicam_node/camera_info: Publishes sensor_msgs/CameraInfo camera info for each frame.

Services:

  • /set_camera_info: Used to update calibration info for the camera.

Parameters:

  • camera_frame_id (tf frame): The frame identifier to associate the camera.

  • camera_info_url: The URL of the camera calibration .yaml file.

  • camera_name (string): The name of the camera, should match with name in camera_info file.

  • framerate (fps): Framerate to capture at. Maximum 90fps

  • height (pixels): Height to capture images at.

  • width (pixels): Width to capture images at.

  • quality (0-100): Quality of the captured images.

Calibration

The raspicam_node package contains a calibration file for the raspberry PI camera versions 1 and 2. The procedure for calibrating a camera is only necessary if you change the lens or image size used.

A tutorial Monocular Camera Calibration tutorial shows how to calibrate a single camera.

The 8x6 checkerboard and the 7x6 checkerboard are rather large and require specialized printers to print out at full scale. They can be printed on more common printer sizes with auto scaling turned on. Be sure to carefully measure the square size in millimeters and convert to meters by dividing by 1000.

A camera calibration can be run with the following commands:

$ rosrun image_transport republish compressed in:=/raspicam_node/image raw out:=/raspicam_node/image
$ rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.074 image:=/raspicam_node/image camera:=/raspicam_node

See http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration for a guide on calibration

By default the camera calibrations are saved in the camera_info directory of this package.

CHANGELOG

Changelog for package raspicam

0.3.0 (2018-09-28)

  • use user writeable calibration after the package one
  • set camera name everywhere
  • Contributors: Rohan Agrawal

0.2.3 (2018-09-20)

  • new calibration parameters
  • Contributors: Rohan Agrawal

0.2.2 (2017-11-19)

  • add proper includes to header RaspiCamControl
  • applied clang format
  • Add low res mode for tracking
  • Add note about publish rate over the network.
  • Add note about dynamic reconfigure
  • Contributors: Jan Koniarik, Jim Vaughan, Rohan Agrawal, davecrawley

0.2.1 (2017-02-25)

  • Dependency fixes
  • Contributors: Rohan Agrawal

0.2.0 (2017-02-25)

  • Add launch files and camera calibrations
  • Add documentation to get pi-deps
  • Proper dependancy declaration
  • Pull in all SV-ROS development
  • Dynamic reconfigure support
  • Support for both CameraV1 and V2
  • Contributors: Girts Linde, Jim Vaughan, Rohan Agrawal

0.1.0 (2016-04-14)

  • Fixed link order bug
  • Make structs char const instead of char Prevents lots of compile warnings
  • Cleanup package.xml, using format 2
  • Move find_lib stuff to more appropriate place in CMakeLists
  • More robust CMakeLists
  • Got raspicam to compile a fake node on the x86_64 architecture without any modification to CMakelists.txt
  • Initial commit
  • Contributors: David Datjko, Girts Linde, Jim Vaughan, Kent Williams, Rohan Agrawal, Wayne C. Gramlich, atp42, datjko, fpasteau

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Package Dependencies

System Dependencies

No direct system dependencies.

Dependant Packages

No known dependants.

Recent questions tagged raspicam_node at answers.ros.org