rh_cameras (hydro)

Maintainer: Gerardo Aragon-Camarasa

1. Overview

This package contains the library driver based on gphoto2 API to control the CloPeMa robot head cameras (Nikon D5100 - http://www.dpreview.com/reviews/nikond5100). It also contains various utility functions.

2. Nodes

2.1 RHcam_left and RHcam_right

Nodes for the left and right camera. In order to use this nodes, it has to be defined the usb port (/RH/usbcam_left and /RH/usbcam_right parameters) at which the left and right cameras are connected. The system package libgphoto2-2-dev is required (Installation of the Robot Head Stack Instructions).

2.1.1 Subscribed Topics

Topic that contains the acquisition command and camera synchronization parameters.

2.1.2 Published Topics

Main topic message where captured images are transmitted.

Contains the camera calibration(if calibrated) and extra data about the camera configuration for the left and right images, respectively.

2.1.3 Services

Used by rh_calibration (hydro) to save the calibration parameters for the left and right cameras.

2.1.4 Parameters

  • /RH/usbcam_left (string, XXX:YYY)
  • /RH/usbcam_right (string, XXX:YYY)

USB port given by lsusb where the left or right camera are connected. For example:

$ lsusb
...
Bus 001 Device 006: ID 04b0:0429 Nikon Corp. [LEFT CAMERA]
Bus 002 Device 005: ID 04b0:0429 Nikon Corp. [RIGHT CAMERA]
...

thus, "/RH/usbcam_left" should be "001:006" and "/RH/usbcam_right" should be "002:005". Both cameras should be connected to two different buses otherwise acquisition will have a delay.

  • /RH/left_camera/camera_info_url (string)
  • /RH/right_camera/camera_info_url (string)

File path where camera information is saved for the left and right camera. By default, this is saved in "../rh_cameras/calibrations/calL.xml" for the left camera and "../rh_cameras/calibrations/calR.xml" for the right camera.

  • /CAM/capturemode (double)

This controls the capturing mode of the cameras. "0" indicates full resolution mode (16 MP) whereas "1", preview mode (VGA resolution). If it is not set, "RHcam_left" node sets it to the mode given in the message "/RH/cmd/acquire".

2.2 RHcam_resize

Node that re-sizes captured images from the left and right camera by an integer scale factor.

2.2.1 Subscribed Topics

Main topic message where captured images are transmitted.

2.2.2 Published Topics

Main topic message where re-sized captured images are transmitted.

2.2.3 Parameters

  • /RH/resize_imgs (float)

Integer value used to re-size captured images. This will resize images by 1/"/RH/resize_imgs".

2.3 RHcam_saveImgs

Node that saves captured images to "../rh_cameras/src/extra_functions/out_images/"

2.2.1 Subscribed Topics

Main topic message where captured images are transmitted.

2.3 RHcam_test

Nodes that displays captured images using OpenCV.

2.2.1 Subscribed Topics

Main topic message where captured images are transmitted.

3. Launch files

3.1 capture_simulation_c3d.launch

Loads the camera capture nodes for the left and right cameras. After a succesfull launching, it is required to issue the following command in a terminal:

rostopic pub -1 /RH/cmd/acquire rh_cameras/CamerasSync '{timeStamp: now, data: full}'

3.2 RHcam_stereo_test.launch

Loads the camera capture nodes and RHcam_test. This launch file is primarily used for testing the camera capturing functions.

4. Camera calibration parameters

Calibration parameters (as determined in rh_calibration (hydro) are stored in this package. During initialisation, these parameters are loaded in memory and these will be updated according to the PTU angles while operating in order to maintain camera calibration. Thus, for each acquisition command receive, the cameras will read the current state of the PTU and update accordingly extrinsic camera parameters.

For each camera, calibration parameters are saved in XML format with the following structure:

<?xml version="1.0"?>
<opencv_storage>
<camera_name>camera_left</camera_name>
<height>4928</height>
<width>3264</width>
<K type_id="opencv-matrix"> <!-- Camera intrinsic matrix -->
  <rows>3</rows>
  <cols>3</cols>
  <dt>d</dt>
  <data>
        .........
    </data></K>
<D type_id="opencv-matrix"> <!-- Distortion coefficients -->
  <rows>1</rows>
  <cols>5</cols>
  <dt>d</dt>
  <data>
        .........
    </data></D>
<P type_id="opencv-matrix"> <!-- Camera matrix (includes intrinsic and extrinsic parameters) -->
  <rows>3</rows>
  <cols>4</cols>
  <dt>d</dt>
  <data>
        .........
    </data></P>
<F type_id="opencv-matrix">  <!-- Fundamental matrix -->
  <rows>3</rows>
  <cols>3</cols>
  <dt>d</dt>
  <data>
        .........
    </data></F>
</opencv_storage>

The estimated fundamental matrix is only defined for a rigid stereo configuration, thus if PTU are updated with a new position, the fundamental matrix cannot longer be used for metric stereo reconstruction. Likewise, the fundamental matrix is defined with respect to the left camera.