PRACTICAL P2: Using ROS to implement a real robotic system

This practical is devoted to implement EXERCISE 5 in the lab with the real robot and the real camera, i.e. the system must be composed of several nodes to detect a given object using a 2D camera and the aruco library, broadcast a grasping transform, compute the joint values to move the end effector to the grasp transform and move the robot to that configuration.

Differently to exercise 5 the images are now published by a node that controls the real camera and the service to move the robot is provide by node that interacts with the robot controller through actions using the UR driver. The exact pose of the camera is a critical issue and therefore a calibration procedure should be executed first.

As in exercise 5 the world reference frame is located at the center of the chessboard.

Packages

Once logged in with the user student you will find a folder called RIS that contains your working directory catkin_ws. The src subfolder contains the packages to be used for this practical:

  • tablesens: it contains the main launch files and the calibration node for the camera.
  • robot_arm: it contains the node to move the robot using the UR driver.

Camera calibration

Camera and aruco nodes

Copy inside the catkin_ws/src folder your exercise 5 solution and build the project:

$ catkin build
$ source devel/setup.bash

Launch the nodes to start the camera and the node that visualizes the aruco markers.

$ roslaunch tablesens p5_1_realsense_camera.launch

Move the camera such that is lies completely inside the field of view of the camera.

Calibration node

In another terminal execute the calibration node:

$ roslaunch tablesens tablecalibrator.launch

The result is the position of the camera; write it down!!

For the calibration different markers whose position and orientation is known are used. The codes and poses are written in the following configuration file:

$(find tablesens)/conf/tablesetup-esaii-pl2.yaml

More markers can be used, by adding them in this file, which might improve the calibration procedure.

 >>> EXERCISE
Take four different chess pieces and place them in known location within the chessboard, and update the calibration file accordingly.
Run again the calibration node. Which is the new pose of the camera? is it different from the previous one?

Detection of poses with aurco

Now let’s modify some of the launch files of the tablesens package in order to detect a given chess pieces of your choice.

1- Modify the aruco_realsense.launch with the camera pose obtained previously.

2- Modify the p5_2_realsense_camera.launch with the marker codes that you have chosen.

3- Launch the pose detection nodes:

$ roslaunch tablesens p5_2_realsense_camera.launch

4- Check the detected poses using the tf package:

$ rosrun tf tf_echo /world /aruco_frame_XXX

where XXX is the marker code you have chosen.

5- Modify the code of exercise 5 such that is listens to the chosen marker code and broadcasts the transform grasp01. This is a pre-grasping transform and should be placed high enough to avoid collisions.

Moving the robot

Now the robot can be moved to the grasp01 pre-grasp transform. To do so the robot_arm package will be used.

The driver

First the driver must be launched with the robot IP address as an argument. A different instruction should be used according to the type of robot:

  • For the CB3 Series:
$ roslaunch robot_arm ur3_bringup_custom.launch robot_ip:=XX.XX.XX.XX
  • For the CB3e-series:
$ roslaunch robot_arm ur3e_bringup_custom.launch robot_ip:=XX.XX.XX.XX

The motion server

Then launch the node which will be connected to the driver by means of an action, and that will offer the service that will allow us to move the robot.

$ roslaunch robot_arm robot_arm.launch

The provided service is:

/ur3/MoveRobotJointPositionTime

which has the following request:

  • float64[] goalPositions: a vector of goalPositions with the desired joint values (in radians), with the joints ordered as follows:
elbow_joint, shoulder_lift_joint, shoulder_pan_joint, wrist_1_joint, wrist_2_joint, wrist_3_joint
  • float64 time: the desired duration of the motion (in seconds).

The motion client

Now the service to move the robot is available and can be used by defining the corresponding client, or by calling it from the terminal.

First modify Exercise 5 to print the joint values and call the service from the terminal:

$ rosservice call /ur3/MoveRobotJointPositionTime

Then, add a client in Exercise 5 by filling the request with the values obtained from the IK.

EXERCISE

Write a report discussing on the calibration, the pose estimation and the robot motion processes.

Calibration

Briefly describe the calibration procedure used and the results obtained.

Are the values those expected? Is there any variability when executing the procedure several times? Is the error the same in all directions? How could the procedure be modified to improve the accuracy?

Pose detection

Which are the results of the detection process? Which are the errors in the different directions?

Robot motion

Briefly describe the changes done in the code w.r.t. exercise 5 to make the real system work.

Is the error in the location of the robot relevant? Can the grasping of the part be guaranteed despite all the errors in the system?