RH_calibration

Maintainer: Gerardo Aragon-Camarasa

1. Overview

This package contains the camera and hand-eye calibration ROS nodes for the CloPeMa robot head. SMACH python wrappers for camera and hand-eye calibration and ROS services are also available for further integration with the dual-arm robot and SMACH CloPeMa nodes. This package uses the standard OpenCV check board; this is attached to this WIKI entry.

2. Nodes

2.1 RHcalibration_services

This node implements standard OpenCV mono and stereo camera calibration procedures and, also, Tsai's camera/hand-eye calibration. This node utilises tf to find the transformation while performing hand-eye calibration between the camera frame and the base of the CloPeMa robot head. This node is essentially the RHcalibration node (RHcalibration is now obsolete but it is left in the package for completion purposes) but structured as services such that they can be called as SMACH processes. Camera acquisition topics are not enable in this node (see RH_calibration_smach.py for an example).

2.1.1 Subscribed 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.2 Services

Finds corners of the calibration target and stores them in memory

Calibrates each camera of the stereo rig and saves calibration parameters.

Captures images, processes them and controls PTUs for hand-eye calibration. Its functionality is the same as in RHcalibration while performing hand-eye calibration.

2.1.3 Services Called

Sets camera calibration parameters and extra data about the camera configuration for the left and right images, respectively.

Gets the current state of the PTU units in radians.

Service that commands the PTU units to move to the desired position.

2.1.4 Parameters

  • /PTU/stepsPerPixelX (double)
  • /PTU/stepsPerPixelY (double)

Steps per pixel ratio in X and Y axes, respectively, as described in Actuator calibration MATLAB functions.

  • /PTU/pan_left_res (double)
  • /PTU/tilt_left_res (double)
  • /PTU/pan_right_res (double)
  • /PTU/tilt_right_res (double)

Resolution of the pan and tilt units.

  • /CAM/capturemode (float)

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".

  • /RH/calibration/input (string)

XML file where camera and hand-eye calibration parameters are set. An example of this file can be found here calibration_input.xml

2.1.5 tf joints

  • left_to_pan
  • left_to_tilt
  • right_to_pan
  • right_to_tilt
  • left_tilt_optic
  • right_tilt_optic
  • left_base
  • right_base

Link names as defined in the XACRO script of the robot head located at the RH_ptu package.

2.2 RHcal_getImages

This node simulates acquisition capabilities and camera information services found in RH_cameras. It reads images from a XML file given in calibration_input.xml as follows:

  <!-- DEFINE FOR DEBUG PURPOSES ONLY!!
      The input to use for calibration.
    To use an image list -> give the path to the XML file containing the list of the images 
  -->
  <Input>"src/simulation_nodes/input_images_models.xml"</Input>

2.2.1 Subscribed Topics

Topic that contains the acquisition command and camera synchronization parameters.

2.2.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.2.3 Services

Used by RH_calibration to save the calibration parameters for the left and right cameras.

2.2.4 Parameters

  • /RH/calibration/input (string)

XML file where camera and hand-eye calibration parameters are set. An example of this file can be found here calibration_input.xml

  • /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.

2.3 RHsavetfpoints

Utility node that listens to tf transformations of the dual-arm robot and saves them in a python compatible file upon exit. This node is used when it is required to store the arm's pose for camera and had-eye calibration purposes. See RH_robotInterface package and Range Imaging and Calibration using OpenCV and C3D matcher tutorial for more information.

2.3.1 Usage

RHsavetfpoints source_frame target_frame filename.py

Specifically, this node will save robot transforms from the coordinate frame of the source_frame to the coordinate frame of the target_frame. "filename.py" stores recorded positions of the arm selected and the output is as below.

<replace_for_variable>.append([x, y, z, qx, qy, qz, qw])

where x, y and z are the Cartesian coordinates of the target frame and, qx, qy, qz and qw, the quaternion tuple of the target frame.

2.4 RH_calibration_smach.py

SMACH python script that performs camera and hand-eye calibration. This node is mainly use for testing purposes, however, it can be used when calibrating the CloPeMa robot head by manually changing the pose of the calibration target or using simulation nodes.

2.4.1 Usage

rosrun RH_calibration RH_calibration_smach.py

3. SMACH python bindings

3.1 calibration_service.py

This python bindings can be included as follows:

from calibration_service import* 

These are structured as services in order to communicate with camera and hand-eye calibration functions.

3.1.1 capture_images_state ( State )

State machine that commands to capture images from the robot head cameras. See RH_cameras for more information. This employs the standard camera acquisition topic published as:

3.1.2 process_target_state ( ServiceState )

Service state machine that finds corners in the calibration target using:

It is required to have a pair of images in memory before invoking this service.

3.1.3 camera_calibration_state ( ServiceState )

Service state machine that triggers mono and stereo camera calibration functions. The service that calls is:

3.1.4 handeye_state ( ServiceState )

Service state machine that controls the hand-eye calibration process. The service that calls is:

4. Launch files

4.1 RHcalibration_service.launch

Loads the camera and hand-eye calibration services node, camera acquisition, PTU control and robot state publisher nodes and set parameters accordingly. This is normally used with the RH_robotInterface package.

For example,

roslaunch RH_calibration RHcalibration_service.launch
rosrun RH_robotInterface calibration_rh_complete.py

This launch file can take as an argument "rviz" which essentially acts as flag to visualise the robot head while doing camera calibration in rviz (0: means no rviz and 1: with rviz). Its usage is as follow:

roslaunch RH_calibration RHcalibration_service.launch rviz:=1

4.2 RHcalibration_simNodes.launch

Loads simulation nodes of the calibration, camera acquisition, PTU control and robot state publisher nodes and set parameters accordingly. This launch file features the same arguments as in RHcalibration_service.launch. Its usage is as follows:

roslaunch RH_calibration RHcalibration_simNodes.launch rviz:=1

4.3 RHcalibration_simHETransform.launch

Launch file used to verify the hand-eye calibration. The output of this launch file is shown below where the camera frame axis is defined in both cameras (yellow dot at the front of both lenses).

4.4 RHcalibration.launch

Loads the camera and hand-eye calibration node, camera acquisition, PTU control and robot state publisher nodes and set parameters accordingly. This launch file is used when one needs to change the calibration target manually.

rviz_simHe.png (71.6 KB) Gerardo Aragon, 09/10/2013 18:06