Full text
Technischen Universität Wien (TU Wien) Automation and Control Institute (ACIN) Master Thesis Project Approach to grasp with Romeo robot using RTM Lluís Salord Quetglas [email protected] June 18, 2016
Abstract Romeo as humanoid robot, which has for main goal help people who has some kind of disability, needs to be capable to grasp objects. Considering that it has led to do this first approach to grasp with Romeo. Moreover, it is wanted to grasp object which has been recognised by the RTM software (Recognition, Tracking and Modelling Objects) with a Romeo camera or an external one. This approach is included in the ROS framework as an independent package named romeo_grasper whose code is free to be shared or improved. The general idea of the approach starts with the RTM software getting the position, on camera reference, of the object, which has to be previously modelled or at least in the database. Then, this pose is transformed on robot reference and sent to MoveIt, that combined with the Rviz simulator and some ROS packages for Romeo, moves the arm of the robot to an optimal position for the grasp. Currently, it is used the IK solver from the KDL library, but here it is also explained how has been tried to implement the IKFast solver on Romeo, but without success. Finally, it is achieved to make work together all the systems, but the grasp has a some imprecision, producing that sometime it cannot be accomplish. However, in the experiments, it has been discerned where this inaccuracy comes from and it has been proposed some ways to reduce it. Furthermore, some guidelines has been set to lead Romeo to achieve a grasp using machine learning and allowing it to accomplish its goal, help the ones who need it.
ii Approach to grasp with Romeo robot using RTM
Approach to grasp with Romeo robot using RTM iii Contents Acknowledgements xi 1 Introduction 1 1.1 Motivation.................................... 1 1.2 Presentation of the problem . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.3 Aimoftheproject ............................... 2 1.4 Repository.................................... 3 1.5 Structure .................................... 3 2 Related works 5 2.1 Grasping by Romeo with visual servoing . . . . . . . . . . . . . . . . . . . 5 2.2 MoveItsimplegrasps.............................. 6 2.3 AGILEgrasp .................................. 6 2.4 RomeoMoveItConfig.............................. 7 2.5 RomeoMoveItActions............................. 7 3 Robot and camera system 13 3.1 Romeorobot .................................. 13 3.1.1 Hardware ................................ 13 3.1.2 NAOqi.................................. 15 3.2 Softwarerequired................................ 17 3.2.1 ROS (Robotic Operative System) . . . . . . . . . . . . . . . . . . . 17 3.2.2 Ros packages for Romeo . . . . . . . . . . . . . . . . . . . . . . . . 17 3.2.3 RTM (Recognition, Tracking and Modelling of Objects) . . . . . . . 22 3.2.4 Inverse kinematic solvers . . . . . . . . . . . . . . . . . . . . . . . . 24 4 Design of Romeo grasper package 27 4.1 Get position of the object . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.1.1 Positioning the camera . . . . . . . . . . . . . . . . . . . . . . . . . 28 4.1.2 Calculate the object position . . . . . . . . . . . . . . . . . . . . . . 29
iv Approach to grasp with Romeo robot using RTM 4.2 Move the hand to object position . . . . . . . . . . . . . . . . . . . . . . . 29 4.3 Configuration and launching . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5 Implementation 35 5.1 ModelObjectclass ............................... 35 5.2 Approach to camera position . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.2.1 Use of pre-known distance . . . . . . . . . . . . . . . . . . . . . . . 38 5.2.2 Use of visual recognition . . . . . . . . . . . . . . . . . . . . . . . . 39 5.3 Planning and execution of trajectory . . . . . . . . . . . . . . . . . . . . . 42 5.3.1 Planning pre-grasp . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 5.3.2 User answer service . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 5.3.3 Execute pre-grasp plan and picking . . . . . . . . . . . . . . . . . . 44 5.3.4 RomeoSimulator class . . . . . . . . . . . . . . . . . . . . . . . . . 45 5.4 Setupofromeograsper............................. 45 5.5 Communication between packages . . . . . . . . . . . . . . . . . . . . . . . 46 6 Experiments 49 6.1 Movementinsimulation ............................ 49 6.2 Implementation of IKFast on Romeo . . . . . . . . . . . . . . . . . . . . . 53 6.3 Get pre-known camera position . . . . . . . . . . . . . . . . . . . . . . . . 55 6.4 Visual camera positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 6.5 Error produces by the camera positioning . . . . . . . . . . . . . . . . . . . 61 7 Discussion 63 7.1 Simulationresults................................ 63 7.2 IKFastonRomeo................................ 64 7.3 Camerapositioning............................... 65 7.4 Error produced by the camera positioning . . . . . . . . . . . . . . . . . . 65 7.5 Final global execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 8 Future works 67 8.1 Implementation new inverse kinematics . . . . . . . . . . . . . . . . . . . . 67 8.2 ImproveuseofRTM .............................. 67 8.3 Objectidentification .............................. 69 8.4 Improvement of visual camera positioning . . . . . . . . . . . . . . . . . . 70 8.5 FixtheRomeomodel.............................. 70 8.6 Implementation of AGILE grasp . . . . . . . . . . . . . . . . . . . . . . . . 71 8.7 Dependencies of packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 9 Conclusion 73
Approach to grasp with Romeo robot using RTM v 9.1 Approachtograsp ............................... 73 9.2 Improvements on other packages . . . . . . . . . . . . . . . . . . . . . . . . 74 9.3 AllinaROSpackage.............................. 75 9.4 Understanding of romeo_grasper . . . . . . . . . . . . . . . . . . . . . . . 75 References 79 Appendices 80 A Software requirements and installation 83 A.1 Softwarerequirements ............................. 83 A.2 Romeo grasper installation . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 A.3 Camera drivers installation . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 A.4 V4Rinstallation................................. 84 A.5 OpenRAVEinstallation............................. 86
vi Approach to grasp with Romeo robot using RTM
Approach to grasp with Romeo robot using RTM vii List of Figures 1.1 Aldebaran’s robot family. Pepper on the left; Romeo on the right and Nao inthemiddle[19]. ............................... 2 2.1 Main functions of the necessary packages for Romeo MoveIt Actions . . . . 7 2.2 Topics and service of the package romeo_moveit_actions ......... 9 2.3 Flow sequence for function graspPlan(...) ................. 9 2.4 Flow sequence for function reachAction(...) ................ 10 2.5 Flow sequence for function pickAction(...) ................ 11 3.1 Romeorobot[24] ................................ 13 3.2 Links of Romeo left arm [5] . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.3 Behaviour of DCM module [5] . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.4 Communication between Romeo and ROS . . . . . . . . . . . . . . . . . . 19 3.5 Overview NAOqi driver package . . . . . . . . . . . . . . . . . . . . . . . . 19 3.6 Overview Pose controller node . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.7 Overview Romeo DCM package . . . . . . . . . . . . . . . . . . . . . . . . 21 3.8 Flow sequence of Romeo DCM package . . . . . . . . . . . . . . . . . . . . 21 3.9 Comparative images from the depth camera. . . . . . . . . . . . . . . . . . 22 3.10 Communication between V4R - ROS - Cameras RGB-D . . . . . . . . . . . 23 3.11 Topics and services of the module Object Tracker . . . . . . . . . . . . . . 24 4.1 Overview of the Romeo grasper package ................... 28 5.1 Flow sequence of ModelObject class . . . . . . . . . . . . . . . . . . . . . . 36 5.2 Position transformation from camera reference to base reference . . . . . . 37 5.3 Orientations of the camera_link respect to the robot base_link ...... 38 5.4 Process of having camera position using pre-known distance . . . . . . . . 39 5.5 Position change due to the offset of the modeled object. . . . . . . . . . . . 40 5.6 Flow sequence for function responsible of the robot planning and execution 43 5.7 Flow sequence for romeo_grasper setup ................... 46 5.8 Flow of data from object pose to commands to NAOqi . . . . . . . . . . . 46
2 Approach to grasp with Romeo robot using RTM Figure 1.1: Aldebaran’s robot family. Pepper on the left; Romeo on the right and Nao in the middle [19]. In order to be able to achieve this aim, Romeo has to be capable of doing several tasks, which a lot of them requires to recognize objects and grasping them. Therefore, recognition and grasp objects is a huge step forward for the development of Romeo. Currently, exists some approaches to grasp objects with several robots, but there is only one for Romeo [8], which is explained in Section 2.1, but it can not be used to achieve the main aim of Romeo. Therefore, it should be done a grasp approach in a way which consider this main goal. 1.3 Aim of the project The main goal of this project is to achieve that the Romeo robot can recognise some specific objects and, if they are inside its workspace, then grasp them. It is known that this task is difficult to accomplish, due to the wide range of parts that are involve, as recognition, movement of the robot, interaction with the environment, etc. So another goal is to discern from where it comes the main error and solve it or at least propose possible solutions. Moreover, another important goal of this project is to do the task of grasping in the way of the aim of Romeo. Therefore, it has to be coherent with the idea of helping people. Furthermore, this task is not only important for Romeo, a wide range of robots need to achieve that. Therefore, share the code and make it open source could help other research programs, and other people could help to continue and improve our work. So this work is not over when the master thesis is done, but it can be continued with any restrictions. Moreover, the code of this project should be put in a package, which should be as flexible as possible to be complemented with any kind of packages. Finally, another main goal of this project is to be explained in a way that other people can understand perfectly how it works and then improve the code. Due to the nature of the project itself there are some limitations or requirements that it should be accomplish. Firstly, it needs to be stated that this work is a first approach to make Romeo capable to recognize and grasp objects. Due to be a master thesis, which it should be done in only a few months, and it is required some time to get used with the robot, it is probably that the final result won’t be totally perfect.
Approach to grasp with Romeo robot using RTM 3 Moreover, there are some software constraints which should be accomplished. On one hand, the use of an acknowledged software like ROS, explained in Section 3.2.1, so it can be easily implemented with other packages and it is a perfect framework for an open-source robotic project. On the other hand, the use of the RTM software, explained in Section 3.2.3, which is from our institute (ACIN), due to is a novel software for the recognition of objects. Finally, the packages from which this project depends should be used as they are officially. So if they need to be modify, the changes should be send to the maintainer of the package and updated. Summarizing the main goals with their subgoals are the following: •Approach to grasp an object recognised with the RTM software. –Discern by parts where comes the possible error that can be in the approach. –Grasp using a method coherent with the Romeo aim to help people. •Share the work in order to help the community and also they can help us. –Share it in a ROS package. –This dissertation should explain all the concepts in a way that makes easy to understand the code and so it can be improved by the community. 1.4 Repository One of the main ideas of this project is to be open source, so everybody can use and improve it. In order to accomplish this, all the code can be found in the following repository with also this document: https://github.com/lluissalord/romeo_grasper 1.5 Structure As the idea of this document is to help people, who want to use or improve the package, to understand all the parts, the document is structures as Chapter 3 explains some knowledge that should be known before to understand perfectly all the document. Chapter 4 is a brief summary of how it works the package and the most important if only wants to know how to use the package. Chapter 5 describes in detail all the parts of the package. In Chapter 6 are shown several experiments to see how precise is the package in any part. Chapter 7 explains the results from the previous chapter. Chapter 8 proposes several fields to improve the package. Finally, Chapter 9 explains the conclusions of the project.
4 Approach to grasp with Romeo robot using RTM
Approach to grasp with Romeo robot using RTM 5 Chapter 2 Related works 2.1 Grasping by Romeo with visual servoing Firstly, talk about a work previously done by another research group. The work [8] consist in grasping an object using visual servoing. The robot has to detect and to track with its gaze a box placed on a table in front of him, estimate the pose of the box with respect to one of its eye’s camera, approach its arm near the box and then move the arm using visual feedback so that it is able to grasp the box accurately. Once this is achieved, it detects a human and delivers the box. A video demonstration can be found at [14]. In order to know where is the hand with respect to the eye’s camera, the hand have a QR-Code. So firstly it moves the arm in a close position to the box using odometry, then with the detection of the QR-Code compute the pose and finally using visual servoing get the arm closer to the box. The approach proposed, grasping with visual servoing, is a good initial approach, but it is not appropriate to achieve the main Romeo’s goal of helping old people or people who has some kind of disability. Firstly, it only can accomplish the grasp with one arm, and, in a complex environment, probably it should be necessary to use both arms. Secondly, to know where is the hand it needs a specific position for the head, looking at the hand, and then track it all the time. However, Romeo is supposed to have a good interaction with humans, but this features doesn’t help it.
6 Approach to grasp with Romeo robot using RTM 2.2 MoveIt simple grasps On the ROS environment exists some packages with the aim of generate grasps, one of them and very useful to do a first approach to grasping is the moveit_simple_grasps package. This one is thought to be used with simple object as blocks or cylinders. The package generate a lot of potentials grasps taking as an input position and orientation of the object. Firstly, is needed a configuration file that describes the geometry of the robot’s end effector. Currently the tested robots are Baxter and REEM, but there are some more of the mentioned configuration files for others robots such as Romeo, Pepper, Nao and Clam. For Romeo the configuration file is named romeo_grasp_data.yaml, but the most recent version of the file is in this repository [20]. It should be stated that this one has been designed to use the left arm to made a side grasp and the right arm for a top grasp. Finally, the way of generate grasps for this package is trying all the directions, with a given resolution, in the plains made by the X-Z axis and by the Y-Z axis. The source of the official package with this and more information can be found at [9]. 2.3 AGILE grasp AGILE (Antipodal Grasp Identification and LEarning) grasp is a ROS package [22] which localize antipodal grasps1in 3D point clouds. This work [23] proposes a new approach to using machine learning to detect grasp poses on novel objects presented in clutter. The input to the algorithm is a point cloud and the geometric parameters of the robot hand. The output is a set of hand poses that are expected to be good grasps. According to [23], the grasp success rate with this algorithm is 87.8% for objects presented in isolation and 73% for objects presented in clutter. Firstly, it is used the geometry information to reduce the size of the sample space. In order to do that the grasps have to fulfil the condition of the hand must be collision -free and part of the object surface must be contained between the two fingers. Secondly, the geometry is also used to automatically label the training set. In order to label a subset of grasp hypotheses is used the condition of having an antipodal configuration. Therefore, a large amount of training data can be used and so improving the performance. 1In an antipodal grasp, the robot hand is able to apply opposite and co-linear forces at two points where the line connecting the contact points lies inside both friction cones [23].
Approach to grasp with Romeo robot using RTM 7 2.4 Romeo MoveIt Config At some point is necessary to use an interface and simulations to work with a robot. An option to do this, using the MoveIt platform, is the romeo_moveit_config. This package gives the necessary configuration files and launchers to use MoveIt with Romeo. Therefore, it allow to launch Rviz with a model of Romeo and interact with it. This model can represent a simulation or a real one which should be connected to ROS. There are two main launch files: (1) demo.launch, which run Rviz with MoveIt and a Romeo model but executing a fake joint control, so doesn’t move the real joints; (2) moveit_planner.launch, the same as before but this time it moves the real joints. Inside both files it also launchs the move_group class which allows to use a planner for the movements of some groups of links and joints. This class is explained with more details in the next section. 2.5 Romeo MoveIt Actions As the last one, the romeo_moveit_action package allow to use moveit_simple_grasps with Romeo. Moreover, it also use the move_group class to make an easier use of high level commands such as reach to pose, pick or place at a pose, among others. In Figure 2.1 can be seen the relation between these packages and their main functions. Therefore, the romeo_moveit_action package should allow the user to control Romeo to do tasks as picking or placing. Figure 2.1: Main functions of the necessary packages for Romeo MoveIt Actions Firstly, before start to describe romeo_moveit_action, is necessary to explain a bit the move_group class. This is the class in MoveIt that controls the current state, the target state, the planner and the movement of a group of links and joints. These groups are defined in an specific .srdf file in romeo_moveit_config. Usually, to work with a
8 Approach to grasp with Romeo robot using RTM robot like this, with 7 DoF, is used the left_arm or right_arm group with left_hand or right_hand group as end effector, this is explained in Section 3.1.1. In order to be able to make plans and execute the movements, the move_group class is working together with the simulator Rviz and the pertinent solver. Moreover, can be set a tolerance for the goal and the target state of the plan can be set as a: (1) pose on a reference or (2) joint state. Referring to romeo_moveit_action package, the most important part is the planning and execution of the grasping. Although, there are two ways of doing that: •Using graspPlan function, Figure 2.3. •Using reachAction function, Figure 2.4. The main differences between one and other are: 1. How to calculate the target pose (a) reachAction use the geometry of the gripper given by romeo_moveit_config and put the target pose in a way that the gripper will be close to the object applying the offset of the romeo_grasp_data.yaml from moveit_simple_grasps. (b) graspPlan use moveit_simple_grasps to generate all the possible grasps for the object and choose one of them to make a plan. Therefore, this way, also using the romeo_grasp_data.yaml file, but it adapts to the orientation of the object. 2. Attempts and approximate solutions (a) reachAction first try with different tolerances till the plan succeeded or reach the maximum attempts. In this last case, try to get an approximate solution. (b) graspPlan only try with one tolerance, but, as said before, it tries a lot of different grasps. Once the gripper is at the right position is time to make the picking. Therefore, is used the pickAction function to pick the object, Figure 2.5. In this case is used again the grasps generated by moveit_simple_grasps, but this time in the picking stage. This function executes automatically the movement when, after testing all the pickings, there is at least one that works. Furthermore, there is another interesting function named publishPlanInfo which publish in /trajectory topic the planned trajectory and the last position of the plan. Moreover, it calculates the distance between target position and the final position of the plan.
Approach to grasp with Romeo robot using RTM 9 Although, the trajectory is in the joint space, using the forward kinematics can know the position of the final position. Finally, a summary of the topics and services used and provided by romeo_moveit_actions is showed in Figure 2.2. Romeo MoveIt Actions /compute_fk Services Topics Figure 2.2: Topics and service of the package romeo_moveit_actions Start function graspPlan(...) Set parameters to MoveGroup class Generate Plan Plan succeeded? True False Start function publishPlanInfo(...) Generate and set grasps from moveit_simple_grasps Remove Plan Figure 2.3: Flow sequence for function graspPlan(...)
10 Approach to grasp with Romeo robot using RTM Start function reachAction(...) Set parameters to MoveGroup class Publish target pose While not plan succeeded and attempts < attempts_max Set goal tolerance to MoveGroup class Generate Plan Plan succeeded? Move flag ON? Execute Plan Generate Plan with approximate solution Plan succeeded? Remove Plan True True False False True Start function publishPlanInfo(...) Calculate and set target pose using gripper geometry Figure 2.4: Flow sequence for function reachAction(...)
Approach to grasp with Romeo robot using RTM 11 Start function reachAction(...) Set parameters to MoveGroup class While not plan succeeded and attempts < attempts_max Set goal tolerance to MoveGroup class Generate Pick and execute Generate and set grasps from moveit_simple_grasps Figure 2.5: Flow sequence for function pickAction(...)
18 Approach to grasp with Romeo robot using RTM On one hand, there are the packages used for the three robots that are in the ros-naoqi repository [4]: •naoqi_bridge metapackage which include the following packages: –naoqi_driver_py Python code in charge of getting data from joints. –naoqi_pose which handle the movement of the robot. –naoqi_sensor_py get the information from sensors as camera, contact sensors, microphone and sonar. –naoqi_tools allow to generate and modify Aldebaran’s robot models easily. •naoqi_dirver another version of naoqi_driver_py in C++, but less developed •naoqi_bridge_msgs contains all the needed messages, services and actions to use the naoqi packages. On the other hand, the packages used from ros-aldebaran repository [3] are the following: •romeo_robot metapackage which include the following packages: –romeo_bringup used to launch the essentials nodes of the metapackage. –romeo_dcm which handle the communication with the Romeo electronic devices. –romeo_description contains the model of the robot in different type of files –romeo_sensors_py add the depth camera and reuse naoqi_sensor_py. •romeo_moveit_config explained in Section 2.4. •romeo_moveit_actions explained in Section 2.5. As described in Section 3.1.2, NAOqi proxies are used to connect to a NAOqi module. Therefore, the base of all these packages is to create the pertinent proxies to send data to NAOqi or to get data from NAOqi and then publish it on ROS. This way of working is shown in Figure 3.4. Below are explained the most important packages to work with romeo_grasper package.
Approach to grasp with Romeo robot using RTM 19 +Programming Code NAOqi Romeo ROS packages Motion Proxy Memory Proxy Camera Proxy DCM Proxy NAOqi Modules DCM Figure 3.4: Communication between Romeo and ROS NAOqi driver As said previously, there are two different NAOqi driver packages: (1) naoqi_driver_py and (2) naoqi_driver. Due to unknown reason naoqi_driver_py is more developed than naoqi_driver, so it is better to work with the first one. In order to get the information from the robot joints, this package is connected to ALMotion module. Then, it gets and publish this data to ROS with a frequency of 25 Hz. As shown in Figure 3.5, the topics where it is published are /joint_states and /joint_stiffness. Figure 3.5: Overview NAOqi driver package NAOqi pose Although, this package uses two nodes: (1) pose controller node and (2) pose manager node; only pose controller node is important for romeo_grasper. Whereas the pose controller node is in charge of sending the goal angle or goal trajectory to the joints, pose manager only is used to move the joints to a predefined posture. Therefore, below is only explained the pose controller node. Therefore, using the motion proxy it sends the pertinent commands to ALMotion module depending on from where the pose controller node take the information. There are several ways to communicate with this node, as can be seen in Figure 3.6. Among these, the one used in romeo_grasper is the action /joint_trajectory. In order to run this
20 Approach to grasp with Romeo robot using RTM action the request message has to contain the angles of the joint for each specific time from start. Then, the ALMotion function angleInterpolation is run in another thread and when the action is done it sends the final joint state. Figure 3.6: Overview Pose controller node DCM driver Although, previously is said that the DCM handle the communication with the Romeo electronic devices, till the moment of writing this, the code developed only implements the communication with the Romeo joints to set the pertinent angle at the precise moment. Despite the fact that the naoqi_pose can also do this, using DCM is more efficient and more direct, as explained in Section 3.1.2. In robotics is needed to make a realtime control of the joints, in this case to do that is used controller manager from the ROS Control metapackage. Therefore, when someone or a package wants to send commands through DCM should communicate with controller manager and then this send the commands to DCM driver in the right way to have realtime control. An overview of this communication is shown in Figure 3.7. Moreover, in Figure 3.8 can be seen how it works this package.
Approach to grasp with Romeo robot using RTM 21 Figure 3.7: Overview Romeo DCM package Launch DCM driver Initialize Controller Manager with the controled joints Load params from ROS and connect to Romeo proxies While ROS is OK Read Joints from ALMemory Update Controller Manager Send commands to DCM proxy Publish in /joint_states ROS Parameters Figure 3.8: Flow sequence of Romeo DCM package Romeo sensor Because of romeo_sensor_py is an addition of naoqi_sensor_py, it should be understood how works this last one. Firstly, initialize the ROS publishers and the camera proxy. Secondly, it gets and applies the camera parameters. After that, the function subscribeCamera is used to then can get the image container. Finally, it transforms all the received data to image messages to publish in the pertinent ROS topic. In order to add the depth camera is used the same code structure as in naoqi_sensor_py, but changing the camera index and adapting the image type to ROS. Unfortunately, it seems that this part is not well implemented, because at least with the test done here it gets a dark image, this fact is shown in Figure 3.9.
22 Approach to grasp with Romeo robot using RTM (a) Image from Monitor, which is Aldebaran official program to see the what are the cameras recording. (b) Image from the topic where romeo_sensor publish. Figure 3.9: Comparative images from the depth camera. Looking in the code one tested idea to solve it has been to change the camera index which currently is 2 (names kDepthCamera) which, according to [5], to connect to ASUS Xtion should be 4 (named kXTION). After a lot of tests, changing the encoding and other features, it hasn’t reach any good result. 3.2.3 RTM (Recognition, Tracking and Modelling of Objects) RTM-Toolbox (Recognition, Tracking and Modelling of Object) [27] which is a software part of a global package named V4R (Vision for Robots). The RTM-Toolbox includes, as its names says, the three features: recognition, tracking and modelling of objects. However, concerning to this project, two of them are the most interesting: (1) RGB- D object modelling for object recognition and tracking and (2) real-time object pose tracking. On one hand, RTM-Toolbox includes a flexible system to reconstruct 3D models of objects captured with an RGB-D sensor. A major advantage of the method is that unlike other modelling tools, this reconstruction pipeline allows the user to acquire a full 3D model of the object. This is achieved by acquiring several partial 3D models in different sessions that are automatically merged together to reconstruct a full 3D model. On the other hand, the real-time object pose tracking [26] [6], combines complementary interest points, for textured objects and for uniformly colored objects, in a common tracking framework which allows to handle a broad variety of objects regardless of their appearance and shape. Then, the point cloud around the detected object is analysed to
Approach to grasp with Romeo robot using RTM 23 confirm that the depth of the object is the right one. Although, the V4R library is independent from ROS, there are wrappers for ROS [33]. Therefore, the features described above can be used though ROS. However, there are some limitations. Even using a RGB-D sensor, to run RTM-Toolbox with the modelling tool is necessary to have the sensor launched though OpenNi. The problem appears with some RGB-D cameras that are not supported by OpenNi like the Intel RealSense.1Therefore, it cannot use the RTM-Toolbox with the modelling tool and only can use this application the Microsoft Kinect and ASUS Xtion cameras. Except for this, in all the others features is possible to use any camera which can publish PointsClouds in a topic, see Figure 3.10. RealSense ROS package Other V4R Libraries V4R ROS wrappers Figure 3.10: Communication between V4R - ROS - Cameras RGB-D In order to use the toolbox and the tracker in [33] is explained the instructions to install and a brief tutorial. However, it is good to add some information. Firstly, the way to be able to make a full 3D model of an object, for this is needed to use the multi-session modelling as explained in [25]. Secondly, If the object itself is texture-less, the software relies on background texture in order to successfully model these kind of objects. So a good option is to add a textured sheet of paper on the supporting surface. Thirdly, the origin of the modeled object is posed automatically by the toolbox, so probably is not on the center of the object which is needed for the grasping process. Finally, by default the tracker is looking for the camera topic in the /camera/depth_registered namespace. Although, OpenNi use this namespace, the RealSense ROS package uses /camera/depth.2 So to change it is needed to use the prefix -t NAMESPACE when the service is started as the following example: 1Installation of the camera drivers explained in Appendix A.3 2RealSense-ROS doesn’t have support for /camera/depth_registered by now, but is in process [16].
24 Approach to grasp with Romeo robot using RTM rosrun object_tracker object_tracker_service −m MODEL_PATH −t /camera/depth Referring to the tracker and how to interact with it, see Figure 3.11. Firstly, it should be launched with a command like the one above, then if it finds the .../camera_info topic and the model the service start_recording can be called. After that, the broker is looking for the modeled object and if it has enough confidence publish a message with the pose and the confidence in /object_tracker/object_pose. Moreover, the tracker is publishing constantly images of the camera with the axis at the origin of the object, if is found, and with a bar representing the confidence in /object_tracker/debug. Finally, in order to change the model use to track, it is needed to call the change_tracking_model service with the path of the new model and after that start the recording again. Object tracker start_recording stop_recording change_tracking_model clean_up Services Topics Figure 3.11: Topics and services of the module Object Tracker It should be stated that the way to identify an object is done transforming the point clouds to an image and then from this are extracted a kind of SIFT features which describe the object. Then, the depth information is used to reaffirm that is the right object. 3.2.4 Inverse kinematic solvers For solving inverse kinematics problems there are two main approaches: (1) numerical solution and (2) analytical (closed forms) solutions. On one hand, KDL (Kinematics and Dynamics Library)[32] is a library for computing forward and inverse kinematic queries with numeric recursive solving. This library is included in the MoveIt packages and it is the default solver if another one is not specified. However, it might be very slow or trap in local maximums due to recursive nature of numerical solutions for solving IK problems.
Approach to grasp with Romeo robot using RTM 25 On the other hand, OpenRAVE (Open Robotics Automation Virtual Environment)[10] is a software for simulating and deploying planning algorithm. It provides a tool called IKFast which can generate C++ code (independent of any library) representing the model of the manipulator for solving forward and inverse kinematic queries. The generated code is able to solve the request on the order of 4 microseconds [11]. In order to generate the C++ code for the robot, it should be provided a Collada model [17] of the robot. Besides, as stated in Section 3.1.1, the arms have one redundancy so for the C++ code generation is needed to specify which should be the free joint. Therefore, to solve IK queries with IKFast some of the key issues is to find proper values for this free joint and which joint should be selected.
26 Approach to grasp with Romeo robot using RTM
Approach to grasp with Romeo robot using RTM 27 Chapter 4 Design of Romeo grasper package The next stage introduces the general idea of the package here exposed. After this chapter, on the Implementation Chapter 5, the package is explained in detail. Before the overview of the package, it should be stated that the purpose of romeo_grasper is to combine the different dependencies to achieve that Romeo grasps an object recognised by the camera. There are several dependencies, such as: (1) ROS packages which communicates with Romeo; (2) simulator and kinematic solvers to move the robot to the desired position; (3) ROS packages which generates the grasps; (4) camera drivers and (5) RTM (Recognition, Tracking and Modelling of Objects) software which allow to know where is the object respect to the camera. A brief overview of this package can be understood by the Figure 4.1. First of all, the position of the object is got with the camera and RTM software. Then is time to compute a pre-grasping trajectory and a picking trajectory using inverse kinematics. The next stage is using the simulation to test these trajectories. After that, we send the joint commands to NAOqi through the Romeo ROS packages to finally move the robot joints and make the grasp. 4.1 Get position of the object In order to be able of grasping object which has been recognized by the camera, we need the position of the object on the robot reference. This position is got by the camera which should be positioned too. The ideal case would be using the Romeo RGB-D camera mentioned in Section 3.1.1, because the relative position of the camera from the robot is known by the romeo_description package and we don’t need extra connections. But is
34 Approach to grasp with Romeo robot using RTM
Approach to grasp with Romeo robot using RTM 35 Chapter 5 Implementation At this stage the details of every process are explained. So the parts briefly exposed previously are analysed deeply. Sometimes are used knowledge described in previous chapters, but they have the corresponding reference to make easier the reading. 5.1 Model Object class This class represent, in the Romeo grasper package, an object that has been previously modeled with the RTM-Toolbox. This class allow to create, remove and update every object independently in the simulator and to calculate its own position with the pertinent correction on the robot reference, given the position on camera reference. At the initialization of this class, it should be associated with one of the modeled object with the pertinent configuration file model_config.yaml in the same folder of the modeled object.1The config file has the following parameters: •offset_x/y/z: the origin established by the RTM-Toolbox may be is not the desired one for the grasp. This offset use the orientation provided by RTM-Toolbox. •shapeType: shape used in the simulator. For now only supports cylinder. •size: set the radius of the cylinder. •size_l: set the longitude of the cylinder. 1In the package the folder for every model is placed at data/models/MODEL_NAME.
36 Approach to grasp with Romeo robot using RTM Every modeled object that wants to be used must have the configuration file loaded in the launch file. So the following line should be used for every model in the node namespace MODEL_NAME for the name of the model. <rosparam command="load " ns="models/MODEL_NAME" f i l e="$ ( fi nd romeo_grasper ) ,→/data/models/MODEL_NAME/model_config . yaml" /> An overview of the processes done by this class is showed below, on Figure 5.1. Moreover, the last part of the flow sequence is explained in detail on Figure 5.2. Model Object Class Creation Load object and enviornment parameters Wait till first data from camera Transform pose with offset from camera frame to base_link frame Update final pose Publish transform from base_link frame to object frame every 100 ms Wait till first pose update done Wait new data from camera ROS Parameters Figure 5.1: Flow sequence of ModelObject class 5.2 Approach to camera position The aim of having the position and orientation of the camera is to have a transformation from camera reference to base reference. So when the position of the object is given on camera reference, we can transform this to base reference, and then do the grasp. Previously in Section 4.1.1, has been explained a summary of how to let known to the robot the camera position. As mentioned previously, we have to ways of doing that: (1) using pre-known distance between a link of the robot and the camera; (2) using the camera to know its own position. These two ways are described in detail in Section 5.2.1 and 5.2.2, respectively.
Approach to grasp with Romeo robot using RTM 37 Start Transformation Get position from camera Wait till transformation from camera to object is published Apply offset in camera reference Publish transform from camera to object Look up for transform from base to object Update final pose Romeo_grasper package Figure 5.2: Position transformation from camera reference to base reference Firstly, these two ways start with the assumption that we have the camera perfectly orientated at 90 degrees or 180 degrees in yaw rotation. So the camera is next to the robot or in front of the robot, as in the Figures 5.3a and 5.3b, respectively. Therefore, the matrix rotation from camera_link to base_link for this cases are expressed as Equation (5.1) for camera next to the robot and as Equation (5.2) for in front. Then, when we configure the package, with file romeo_grasper.yaml we should indicate which case is the current orientation by the boolean parameter camera_in_front. So this estimated orientation is used, depending of the way to get the position, as the final orientation or only as a seed. Scam base = −1 0 0 0 0 −1 0−1 0 (5.1) Scam base = 0 0 −1 1 0 0 0−1 0 (5.2) It should be stated that to let know the camera position to the simulator and others part of the package is used a separated thread. This one is in charge of publishing the position of the camera on TF when this is available. Moreover, if currently is not using a real camera it publishes the pose of the camera optical frame according to REP 103 [13], which is used to get the position of the object, as explained in 4.1.2.
38 Approach to grasp with Romeo robot using RTM (a) Next to the robot (b) In front of the robot Figure 5.3: Orientations of the camera_link respect to the robot base_link 5.2.1 Use of pre-known distance In an environment where we can know the position of the camera respect to a link of the robot, use this way is a good option. Therefore we only need to set the configuration in the romeo_grasper.yaml file. So with the camera_ref_frame_id parameter we set the link used as reference and with camera_pose_x/y/zspecify the coordinates where is the camera. However, we have to take in account that the orientation for this parameters is the base_link orientation. That is done in that way to facilitate the user to take the coordinates. Therefore, the process to calculate the position of the camera is, as described in Equation (5.3), taking position of the reference link in base_link coordinates and adding the values of the parameters camera_pose_x/y/z. Pcam base =Plink base + camera_pose_x camera_pose_y camera_pose_z =Plink base +Pcam base −Plink base (5.3) Moreover, optionally we can set the orientation transformation from base_link to camera_link in RPY using the parameters camera_pose_roll/pitch/yaw. Therefore the Scam base matrix is calculated with these parameters or, in case they don’t exist, use the initial assumption. Finally, the transformation between camera_link and base_link is expressed like Equation (5.4) Tcam base = Scam base Pcam base 0 0 0 1 (5.4)
Approach to grasp with Romeo robot using RTM 39 An overview of the flow sequence done by the package in order to get this transformation is described in Figure 5.4. Start function Are thera all camera_pose parameters? Is tracking ON? Change to tracking mode Wait for params or tracking ON Check for params and load tracking boolean Is tracking ON? Apply equations Publish transform on TF Create bloc on simulator Yes No No No Yes Yes Figure 5.4: Process of having camera position using pre-known distance 5.2.2 Use of visual recognition The original idea of this method is that wouldn’t be necessary the help of the user to get the camera position. So the package should recognise one or more parts of the robot. Then, it should calculate the position and orientation of the camera knowing the position and orientation2from the camera_link reference and from the base_link reference. For now, this initial idea is not totally implemented due to difficulties to recognise parts of the robot, as mentioned in Section 4.1.1, and for others problems explained later. In order to be able to get the pose of the links of the robot is used a modeled object with a special offset and easy to recognised for the software. This object is placed next to the link of the robot in a precise location, as showed on Figure 5.5, so the final origin 2The use of the orientation of a robot part depends on the approach used.
40 Approach to grasp with Romeo robot using RTM Figure 5.5: Position change due to the offset of the modeled object. of the object is established on the link origin. This modeled object, when it’s initialised must have boolean is_reference_object with value true to work properly. Below are explained the three different approaches done for this method. Although, only the first one is implemented in the package, the others are prepared in the Matlab files on the directory data/matlab/. (1) Using only one link In this case, is used the assumption of having the camera next to or in front of the robot as a final orientation. Therefore, the only unknown variable is the camera position on base reference, Pcam base . So as to solve this is needed the position of a link on camera reference, Plink cam , that is known also on base reference, Plink base . Finally the Equation (5.5) is the one to solve. Pcam base −Plink base +Scam base ·Plink cam = 0 (5.5) (2) Using three links On the other hand, this case only used the assumption of the orientation to have a seed to solve the problem. The idea of this way is to implement the resolution of an optimisation problem with non-linear constraints to have an exact position and orientation of the camera.
Approach to grasp with Romeo robot using RTM 41 The equation that have to be minimized are Equation (5.5), for every link, and Equation (5.6), for two combination of the three links.3Therefore, the error of every equation is put as absolute value and introduce in the minimization function. Moreover, the solution have three non-linear constraints: the three axis of the orientation should be perpendicular between them. The axis of the orientation are the unitary vectors of the columns of matrix Scam base. Therefore, the constraints are Equation (5.7), for every combination of the axis. −−→ PiPjbase −Scam base −−→ PiPjcam = 0 ∀i6=j i, j = [link1, link2, link3](5.6) < vi, vj>= 0 ∀i6=j i, j = [x, y, z](5.7) The reason to use three link for this case is that a minimum of 12 equation are required to determine the 12 variables (3 for the camera position and 9 for the orientation). Using three links we get 15 equations and 3 non-linear constraints. Otherwise with two link we would have 9 equation and 3 non-linear constraints, which is not enough. As said previously, the fact of having the camera in front or next to the robot is used as a seed. So the depending of the case is used the matrix from Equation (5.1) or from Equation (5.2). Furthermore, for the position there are also seeds, these are extracted experimentally. Finally mention that in Matlab is used the optimization solver GlobalSearch because it allows non-linear constraints and also search in a big range of solutions. Therefore, apart from looking for the best solution from the given seed, it generates some trial points in all the space inside the constraints. These trial points are potential start points as the seed, so this method allow to not remain in a local minimum. (3) Using multiples transformations The RTM software, apart from giving the position of the object, gives the orientation. So instead of only using the position of the link placing the reference object at a certain place, we could use also the orientation of the object. Therefore, we could discover the position and orientation of the camera placing the object in a precise position and orientation from the known link. In order to do that we should know: (1) the transform 3Only two combination of Equation (5.6) because the third one is linear dependent of the other two.
42 Approach to grasp with Romeo robot using RTM from object to link reference, because of that reference object is placed by us; (2) the transform from link to base, provided by the model of the robot; (3) the transform from camera to object, known by using the information of the RTM software. With all this information we could have the transformation from camera to base, as showed in Equation (5.8), so finally get position and orientation of the camera. Tcam base =Tlink base ·Tobj link ·Tcam obj (5.8) 5.3 Planning and execution of trajectory A brief description of this part is in Section 4.2. Firstly, before planning the ROS parameters named as runtime parameters are constantly updated. And secondly, is needed to accomplish the following conditions: •The modeled object which should be grasp has the position updated. •The position of the object is a new one which has not been processed. •Be sure is not doing other processes that can effect the planning and execution After that, is time to start with the planning and execute function, an overview can be seen in Figure 5.6. Therefore, below is explained in more detail some parts of this function. 5.3.1 Planning pre-grasp As said in Section 2.5, there are two ways of planning the grasp. Therefore, here depending on the parameter reachVsGrasp can be chosen which way. On one hand, for the reachAction case, first is set the flag to not move the arm and then is called the reachPregrasp function. This function call reachAction but modifying the target pose subtracting the coords from the gripper, stored in the file romeo_grasp_data.yaml of package moveit_simple_grasps. Therefore, it goes to a position near the object but without touching it. On the other hand, for the graspPlan case, using the block from the modeled object generates a large number of grasps and from them takes the variable grasp_pose which defines the position of the parent link of the end effector for the grasp. All these positions, from every grasp, are given to the Action class as target positions. Therefore, to make the plan will test them and will choose one which doesn’t collide.
Approach to grasp with Romeo robot using RTM 43 Start planning and execute function Planning pre-grasp Automatic execution Switch (answer_service) Move Execute Plan Replan Wait user’s service call Load runtime parameters answer_service = Move isPregrasp isPregrasp = false isPregrasp Picking Abort Pose changed = false True False True True True True False False False False True Figure 5.6: Flow sequence for function responsible of the robot planning and execution Finally, both ways ask to the move_group class for a plan. This plan contain the information of: (1) the starting state of the robot used for planning; (2) the planned trajectory for the joints of the group and (3) the amount of time it took to generate the plan.
50 Approach to grasp with Romeo robot using RTM Position [m] x y z Cylinder 1 -0.3 0 0.5 Cylinder 2 -0.25 0 0.45 Cylinder 3 -0.20 0 0.40 Cylinder 4 -0.15 0 0.35 Cylinder 5 -0.05 0 0.35 Cylinder 6 -0.3 -0.1 0.5 Cylinder 7 -0.25 -0.1 0.45 Cylinder 8 -0.20 -0.1 0.40 Cylinder 9 -0.15 -0.1 0.35 Cylinder 10 -0.05 -0.1 0.35 Table 6.1: Positions on camera reference of the cylinders used for the tests. described in Section 2.5, the reachAction function has two methods of solve the inverse kinematics: (1) looking for solutions inside a given goal tolerance and (2) solving with approximated solutions without taking in account the goal tolerance. Besides, one of the other important factors is the maximum time for the planning. Therefore, it is tested different possibilities of planning time. Then, for this experiment has been made 178 different tests combining, graspPlan, reachAction (toleranced or approximated solutions), different planning time and with both computers. Even more which has not been introduced in the statistics but taken in account by me. Some observations of the results are the following ones: •32 solutions inside the tolerance found out of 77. The rest are solved with approximated solutions with computer C1. –10 out of 20 with 2 seconds of planning time. –12 out of 37 with 5 seconds of planning time. –10 out of 20 with 60 seconds of planning time. •6 solutions inside the tolerance found out of 60. The rest are solved with approximated solutions with computer C0. –2 out of 20 with 2 seconds of planning time. –2 out of 20 with 5 seconds of planning time. –2 out of 20 with 20 seconds of planning time.
Approach to grasp with Romeo robot using RTM 51 •Average distance of graspPlan is 0.0916 m. –4 out of 14 solutions with graspPlan found with 2 seconds of planning time by computer C1. These solutions have a mean of 0.077 m. –6 out of 7 solutions with graspPlan found with 60 seconds of planning time by computer C1.These solutions have a mean of 0.136 m. –2 out of 16 solutions with graspPlan found with 2 seconds of planning time by computer C0.These solutions have a mean of 0.071 m. –10 out of 21 solutions with graspPlan found with 20 seconds of planning time by computer C0.These solutions have a mean of 0.075 m. •The graspPlan function after planning spend a lot of time doing something unknown (there is not any log in the terminal). Therefore, the real planning time is different and depends on the computer. Moreover, there is no differences changing the planning time. –Average real planning time of computer C1 is 250 seconds. –Average real planning time of computer C0 is 135 seconds. •Average times: –Approximated solutions always last less than 1 second, usually with a mean around 0.1 seconds. –Solutions inside tolerance are usually below 5 seconds, with a mean around 1.5 seconds and it has been two isolated cases of 20 seconds out of around 40 samples. –graspPlan solutions with 20 seconds of planning time have a mean of 8.35 seconds and the ones with 60 seconds of planning time have a mean of 10.39 seconds. •It has been noticed it gets more solutions inside the goal tolerance if instead of large planning times uses small planning times but with a lot of attempts. The best way is starting in a low goal tolerance, using a low goal tolerance step and do a lot of attempts increasing the goal tolerance at each attempt. After that, it should be shown a comparative of the resulting distance with the approximated solution between the two computers and with planning times of 2 and 5 seconds. That can be seen in Figure 6.1.
52 Approach to grasp with Romeo robot using RTM Figure 6.1: Confidence interval of distance of the approximated solutions. Finally, for this experiment has been used a maximum tolerance of 0.10 m. Below, the confidence interval of the distance for approximated solutions and for solutions inside tolerance are shown in Figure 6.2. Figure 6.2: Confidence interval of distance for approximated and inside tolerance solutions. Only for solutions with computer C1
Approach to grasp with Romeo robot using RTM 53 6.2 Implementation of IKFast on Romeo Currently, the inverse kinematic solver used is from the KDL library, explained in Section 3.2.4. However, it gives some results that could be better and the planning time is an important factor as shown above. Therefore, a solution for this problem could be implement the IKFast solver, also explained in Section 3.2.4, which is more precise and faster, usually it last around 4 ms to calculate the operations [10]. In order to implement the IKFast on the Romeo robot, firstly is needed to generate the C++ code which solve the inverse kinematics. However, This OpenRAVE software has several dependencies to generate the C++ code, explained with the installation in Section A.5. Secondly, once the code is already generated, it should be create a package which provides the kinematic solver, based on the previous C++ code. Although, it is needed to have the moveit_ikfast ROS package to create the kinematic solver package. Referring to the code, it is created from a Collada model file which is not found in the romeo_description package. Then, this can be created, using the command below, from an URDF model of Romeo which is contained in the previous package. rosrun collada_urdf urdf_to_collada romeo . urdf romeo_raw . dae After that, as recommended by the author of IKFast [10], it is good to round at the fifth decimal the values of the Collada model to make easier to find aligned axes. The rounding program is found in the moveit_ikfast package, more information in [21], and is run with the following command: rosrun moveit_ikfast round_collada_numbers . py <myrobot_name>.dae < ,→myrobot_name>.rounded . dae 5 Once the Collada model is ready, it is time to generate the IKFast solver code. As said in Section 3.1.1, the Romeo arms have 7 DoF, so the inverse kinematic type should be transform6d with one redundancy to be able to go to a specific position and orientation. Moreover, has to be defined which is the base link and the end effector of the group. So between these are contained the joints of the arm, Table 3.1 can help to know parent and child link for every joint. The index of the arm links of Romeo are shown in Table 6.2. Therefore, the generation process is executed with the command below. Finally, it should be stated that if for the configuration are contained 7 joints, it should be add the freeindex parameter defining which is a free joint.2The index for the joints is shown in Table 6.3. 2The free joints are specified before the IK is run, these values are known at runtime, but not known at IK generation time [10].
54 Approach to grasp with Romeo robot using RTM Body Link index base_link 0 torso 1 Left arm Rigth arm Link index index Link LShoulder 2 43 RShoulder LShoulderYaw_link 3 44 RShoulderYaw_link LForeArm 4 45 RForeArm LElbow 5 46 RElbow LWristRoll_link 6 47 RWristRoll_link LWristYaw_link 7 48 RWristYaw_link l_wrist 8 49 r_wrist l_gripper 18 59 r_gripper Table 6.2: Index of every link of the robot base and arms. python ‘ openrave−config −−python−dir ‘/ openravepy/_openravepy_/ i k f a s t . py −− ,→robot=<myrobot_name>.rounded . dae −−iktype=transform6d −−bas eli nk=< ,→base_index> −−eelink=<end_effector_index> −−savefile=< ,→ikfast_output_path> Left arm Rigth arm Joint index index Joint LShoulderPitch 0 16 RShoulderPitch LShoulderYaw 1 17 RShoulderYaw LElbowRoll 2 18 RElbowRoll LElbowYaw 3 19 RElbowYaw LWristRoll 4 20 RWristRoll LWristYaw 5 21 RWristYaw LWristPitch 6 22 RWristPitch LHand 7 23 RHand Table 6.3: Index of every joint of the robot arms. After that, it is time to generate the IK solver code. As explained in Section 3.1.1, the usually way of working is to split the arm in two group. So the right way is to take the first 6 joint of the arm in the main group which is the one controlling the position and orientation. Therefore, the logical configuration is with –eelink equal to 7 or 48 depending on the left or right arm and –baselink equal to 0 or 1.3 Unfortunately any of this configuration can generate a C++ code with the Romeo model. The problem is that, after one or two hours of execution of the command above, 3It doesn’t matter if is used base_link or torso link because they are fixed, so there is only a fixed transformation between them.
Approach to grasp with Romeo robot using RTM 55 the program, and sometime also the computer, is frozen. Then, it has to be tested others configuration which are less logical but also useful. Therefore, these are taking the 7 joints but adding the freeindex parameter. The most logical free joint is the WristRoll because is the one closest to the end effector, doing the same movement than ElbowRoll and it is the slowest joint of the arm. Finally, neither this configuration nor any other joint as the free joint can generate the IK solver code. Currently, there is a commit in the Natalia Lyubova repository4where the URDF model has been changed to use a new convention of the joints. But, it also gives the same results. It should be stated that to be sure the installation it was well done, it has been tried to generate the IKFast for another robot and it worked. Moreover, there is a discussion in the official repository of Romeo package where all this IKFast issue is discussed on [30]. 6.3 Get pre-known camera position Another very important factor which can lead to have some deviation on the results is to get the right position of the camera. As said before, there are two ways to get it: (1) with a pre-known position, which is the one tested here; and (2) from the visual information got from the camera itself, tested in the next Section 6.4. So below is explained how the position of the camera respect to the robot is got. However, it is only tested for the camera on the left side of the robot. Currently, the experiments are made with the Romeo robot secured with a support holding it without touching the floor. However, this makes that the robot is tilt forward. Therefore, the X and Z coordinates are difficult to measure due to the Romeo tilt. Moreover, the base_link origin is inside the robot, so it is difficult to get where is it precisely. So the solution to be able to get a good estimation of the position is using a Romeo link as the l_wrist which its origin is easy to find. Furthermore, this link can be moved easily in a position aligned with the Y axe to the camera, so the X and Z coordinates of the l_wrist, which are given by the simulator in the base_link reference, are the same as the camera. Then, the only needed measure is in the Y axe where the Y camera coordinate is the Y l_wrist coordinate plus the offset from l_wrist to the camera. However, it should be stated that this measure can have some error, which is estimated to be around ±1.5 cm. The photos in Figure 6.3 can help to understand how is the experiment done. Therefore, the experiment is done as explained above and result with the following Table 6.5: 4https://github.com/nlyubova/romeo_robot/commit/05bf217b73c389c461414412fd43d84ecb0c4115
56 Approach to grasp with Romeo robot using RTM (a) Aligned with Z axe. (b) Aligned with X axe. (c) Global view. Figure 6.3: Photos of the different points of view to pose the l_wrist. The origin of the link is in the center of the blue spherical joint. l_wrist position Offset Camera position x 0.0869 m 0.0 m 0.0869 m y 0.470 m 0.26 m 0.730 m z -0.1897 m 0.0 m -0.1897 m Table 6.4: Measures in base_link reference to get camera position. After that, the next information to get is the orientation of the camera. As the robot is tilt forward and the camera is on next to the robot aligned with the Y axe of the robot, can be estimated that the Z axe of the optical camera frame is the Y robot axe, but with the sign changed.5 As the origin of the robot is fixed in the simulation, on the camera is where it has to be applied all the rotation. Then, it is needed to measure the tilt angle, with the experiments it has been worked with an approximate angle of 15o. So the final transformation of the camera is the one shown in Table 6.5. 5REP 103 [13] states the convention of the cameras optical frames as: Z forward, X right and Y down.
Approach to grasp with Romeo robot using RTM 57 Position [m] Orientation [rad] x y z roll pitch yaw Camera from base_link frame 0.0869 0.730 -0.1897 π 2011π 12 Table 6.5: Transformation from base_link frame to camera. 6.4 Visual camera positioning The method presented above is used to get the position of the camera precisely, but repeat this process every time that the robot or the camera has been moved may be is not the most comfortable way. Therefore, the process automation is the next step. In Section 5.2.2, is shown the three different possibilities to get the position of the camera using the visual information of the camera itself. Below this three ways are tested to see how good precise are they. Therefore, they have to be compared with the most accurate information which is the one got in the previous experiment. It should be stated that place the modeled object to get the position of the links has an error estimated around ±2 cm. However, the most precisely estimated link position is for the l_wrist, then the LElbow due to use the same offset for both but it is optimised for the l_wrist, and the LShoulder can have less precision due to it was to apply an extra offset because the camera didn’t recognise the modeled object in the right place. Moreover, for the following test it has always used the robot in the same position, shown in Figure 6.4. (a) Position of the left arm (b) Values of the joints for this position Figure 6.4: Description of the position used for this experiment.
58 Approach to grasp with Romeo robot using RTM (1) Using only one link The first approach is based on the information of only one link and using the assumption of being perfectly oriented in front or on side of the robot. Therefore, given the position from camera of the link and the position of the link in robot reference (information extracted from the simulator), applying Equation (5.5) results on the position of the camera. Moreover, for the next approach it is needed this information also for other links, so it can be used to see if the final result is changing between different data. Therefore, the following Table 6.6 shows the information every link with the result with that information: Link used Coord Position [m] from Camera position [m]camera base_link l_wrist x -0.1297 0.1974 0.0677 y 0.1588 0.1763 0.7294 z 0.5081 -0.2990 -0.1401 LElbow x -0.1328 0.1180 -0.0148 y -0.0116 0.1858 0.7387 z 0.5079 -0.1259 -0.1375 LShoulder x -0.1386 0.0502 -0.0884 y -0.2637 0.1899 0.7862 z 0.5513 0.0739 -0.1898 Table 6.6: Data and results for the first approach with visual positioning. (2) Using three links The next experiment is on the second approach solves a non-linear problem which use the information of three links and then, given a seed, tries to minimise Equation (5.5), for every link, and Equation (5.6), using as constraints Equation (5.7). The data used for this is the same as used above, and to calculate the solution it has been done with Matlab. Moreover, the Matlab code of this can be found in the romeo_grasper repository, specified in Sectio 1.4, in the folder /data/matlab. In order to make the experiment has been given three types of seeds: (1) with the exact position and orientation of the camera; (2) without the exact orientation, given as it is in the orientation assumption and (3) as before and also an imprecise position. Therefore, the seeds are as in the following Table 6.7:
Approach to grasp with Romeo robot using RTM 59 Position [m] Orientation [rad] x y z roll pitch yaw Seed 1 0.0869 0.730 -0.1897 −π 2011π 12 Seed 2 0.0869 0.730 -0.1897 −π 20π Seed 3 0.0 0.90 -0.10 −π 20π Table 6.7: Seeds used for the non-linear problem. Applying the positions of the links of the Table 6.6 and with the different seeds the final results are the ones in Table 6.8. Moreover, to approach the position of the camera has been tested to average the results of the Equation (6.1), with all the link, giving as a result an average position of the camera. Pcam base =Plink base −Scam base ·Plink cam (6.1) Method Position [m] Orientation [rad] x y z roll pitch yaw Seed 1 Result 0.1308 1.040 0.2141 -1.8846 0.3717 1.9934 Average 0.0845 0.7705 -0.010 Seed 2 Result -0.2659 0.9928 0.045 -1.7483 -0.5772 2.147 Average -0.0281 0.7579 -0.0615 Seed 3 Result -0.0264 1.0466 0.151 -1.8424 -0.2995 2.0552 Average 0.055 0.7647 -0.0446 Table 6.8: Results from the optimization problem and the average camera position, for every seed. (3) Using multiples transformations Finally, the last approach which use all the information given by the camera, both position and orientation. So it has to use several transformations: (1) from base_link to link; (2) from link to modeled object and (3) from modeled object to camera. The first one is given by the simulator. Then, the second one is estimated by the user placing the object on a specific position and orientation respect to the link. Finally, the last one is known from the information given by the camera. It should be stated that for this test has been used the l_wrist link which is the one placed more precisely. Therefore, the information used is shown in Table 6.9 which should be convert to transformation matrix (rotation plus translation), as eqs. (6.2) to (6.4).
66 Approach to grasp with Romeo robot using RTM 7.5 Final global execution Unfortunately, the last days I could go to the place where is Romeo, I could not use the robot because it had a problem with the calibration of the motors and it was always on a different angle from the one specified. Therefore, it was impossible to measure the error of the global system. Although, looking on the results of the other experiments it should have an error around 8-10 cm. However, the error could be in any direction and depending on which one it could grasp the object. Therefore, this final result shows that as said in the introduction, the romeo_package is only an approach where there is still work to do, but it is pointing in the right direction.
Approach to grasp with Romeo robot using RTM 67 Chapter 8 Future works 8.1 Implementation new inverse kinematics Currently, there is some variability in the error produced by the inverse kinematic solver KDL to go to the position of the object. Moreover, it depends a lot on the planning time which is too big to allow to properly interact with the robot. Therefore, the implementation of a new IK solver should be a great improvement for the work. Moreover, currently the picking action is not working well due to the IK solver doesn’t find a good picking plan, so with this new solver it is supposed that this should be solved. The first recommendation would be to implement the IKFast from OpenRAVE, because it is a close form solver and so it very fast and precise. As seen in Section 6.2, currently is not working, but may be can solve it editing the URDF model trying to make it easier or changing the initial pose. Also is recommended to read this issue [30], where there is a lot about it discussed. In case that the previous solver could not be used, there is an other option used in [8] named Metapod from LAAS, which is also a numerical solver. Therefore, probably it has almost the same problems as KDL, but at least has been already tested with Romeo. 8.2 Improve use of RTM The RTM software is a very powerful tool to recognise objects and tracking them. However, it has to be complemented with the convenient camera to get the best performance. Currently, the Kinect camera, which sends the images to ROS through OpenNi framework, gives some problems. On one hand, after some seconds or minutes the RGB
68 Approach to grasp with Romeo robot using RTM camera starts to send partial or full black images, example of it in Figure 8.1. Therefore, the RTM software cannot be used properly. On the other hand, the OpenNi nodes after a while usually fail due to memory or pointers errors and then they are automatically shut down. (a) Normal performance (b) While is not working Figure 8.1: Kinect problem, RGB camera sending black images. Moreover, RTM process the images with a kind of SIFT on the RGB image, so having a good quality of the RGB camera it could lead to a better performance. Unfortunately, the Kinect used is the worst in terms of RGB camera in comparison with the Xtion and the RealSense, as shown in Table 8.1. Therefore, to improve the performance of the recognition would be great to use RealSense or Xtion. On one hand, currently, the use of RealSense is possible,1but the object must be modeled with another camera because RealSense is not supported by RTM-Toolbox and that decrease dramatically the confidence of the tracking. Therefore, this option would be great if the RTM-Toolbox is 1The use_realsense argument enables to launch the romeo_grasper using the RealSense camera.
Approach to grasp with Romeo robot using RTM 69 improved and gives support to RealSense. On the other hand, for the Xtion there are two possibilities. First, with an external one as it has been done with Kinect in this work. Second, using the one on the Romeo cap. For this last one, only could work with objects on a specific and small range because of the camera range. However, it would remove some error produced by the camera positioning because the position of this camera is established in the model. Moreover, in order to solve the problem with dark images may be a possibility is to try to execute ROS with OpenNi inside the robot. Camera RGB resolution Depth resolution Range Microsoft Kinect v1 [31] 640x480 320x240 0.5-4.5 m ASUS Xtion PRO Live [7] 1280x1024 640x480 0.8-3.5 m RealSense SR300 [15] 1920x1080 640x480 0.2-1.5 m Table 8.1: Comparison of the RGB-D cameras: Kinect, Xtion and RealSense. 8.3 Object identification Although, it is not explained before how it works, RTM can recognise several objects at once with the Recognition feature. These objects should be in a specific database. A detailed description of this feature can be found in the tutorial of V4R ROS wrappers repository [33]. There are several factors of the object recognition that can improve the performance of the romeo_grasper package: •Provides the centroid of the cluster, which could be used to give to the package where it have to make the grasp. •Provides a bounding box of the object, which is how the object is represent in the simulation by now. So this would make to don’t need to use a custom bounding box made by the user. •Provides a point cloud of the model transformed into camera coordinates. This information could be used for the AGILE grasp to grasp the desired object in a better way. •Identifying several objects at one could be used to implement a better way to use the visual positioning of the camera. Using a different identifier for every element could be possible to know the position of every link at once. Therefore, it makes the process more robust to find the camera position and orientation. The only problem of this way of get the position of the object is that it is not optimal for a real-time tracking. This feature works as a service, so in order to work with it, the service should be called periodically to know always where are the object.
70 Approach to grasp with Romeo robot using RTM 8.4 Improvement of visual camera positioning As seen in the experiments, the positioning of the camera identifying parts of the robot doesn’t give good results. Above has been explained an improvement for this, being able to identify every link at one. Therefore, implementing that and also QR-Codes, as in [8], for every link, it could give a better result. These method has two main advantages: (1) a QR-Code is easy to recognise by SIFT because it has a lot of interesting points and (2) these QR-Codes are fixes respect to the robot, so they can have their own offset precisely measured. The main disadvantages are that the QR-Codes should be visible always when the package is launched and that after the initialization they are not used any more and may occlude part of the environment. 8.5 Fix the Romeo model Currently, the grippers in the Romeo model are posed in a wrong position, see Figure 8.2. However, at the moment, this is not used because the grasp position is specified by romeo_grasp_data.yaml of the moveit_simple_grasps package. Then, the grasp position is set adding an offset from the WristYaw_link position. Therefore, should be great to make the model more standard and have the gripper in the right place and set the grasp from the gripper itself. Figure 8.2: Current position of grippers in Romeo model.
Approach to grasp with Romeo robot using RTM 71 8.6 Implementation of AGILE grasp Once the first approach of grasping works perfectly, it is time to implement a more advanced grasping process. As explained in Section 2.3, the AGILE grasp use machine learning to detect an antipodal grasp pose on novel objects, using as input a point cloud and the geometric parameters of the robot hand. However, the implementation could be made in two different ways. First, it could use the general point cloud of the camera which it will have some occluded parts of the object. Second, if the recognition object, explained in Section 8.3, is implemented then use the point cloud of the model transformed into camera coordinates which it won’t have occluded parts because it is a combination of the modeled object and the real object. 8.7 Dependencies of packages A package is more flexible and can be reused in other fields as independent is of other packages. On one hand, it would be great to make this package as general as possible, in order to be able to be used for other robots. That could be made if the romeo_moveit_actions have the same functions of the moveit actions of others robots, then it is supposed that it should not be very difficult with the right definitions for the building part. On the other hand, making the code be independent of the recognition software could lead to used this grasping package in a wider range of fields.
72 Approach to grasp with Romeo robot using RTM
Approach to grasp with Romeo robot using RTM 73 Chapter 9 Conclusion The work done during this months is reflected in the achieved results, which can be considered to be succeed, in the terms of being a first approach. However, there is still work to do to improve romeo_grasper, so it is needed to follow, as the next steps, the guidelines set in Future works, Chapter 8. For this work had been set some goals in Section 1.3 which are analysed if they have been or not accomplish and in which grade. 9.1 Approach to grasp Firstly the main goal of the work is to make a first approach to grasp with Romeo. Moreover, the grasp has to be accomplish on objects that have been previously recognised by Romeo using the RTM (Recognition, Tracking and Modelling Objects) software. It has been attained to make the global system (Romeo, camera, ROS, RTM and computer) to work all together, so the process is working well. Despite the lack of time for this kind of work, it has achieve enough good results. However, it is true that due to the inaccuracy sometimes Romeo doesn’t grasp the object. Although, this imprecision is logical to happen in a first approach, it leads us to the next goal, discern from where comes the error in the grasping process. In order to accomplish that it has been made different experiments which allow to isolate the error to know what is causing the problem. From this experiments has been seen that the process where it has to put more effort to improve are the improvement of the inverse kinematic solver and the camera positioning. Furthermore, it has been proposed some guidelines in the Future works to solve this.
74 Approach to grasp with Romeo robot using RTM Moreover, on the Introduction it has been set to achieve that being coherent with the main aim of Romeo, which is help old people or people who has some kind of disability. Then, to accomplish that the process of grasping has to be able to complement all kind of other tasks without imposing constraints. That has been accomplish partially, because right now it is needed to use an external camera which have to see the grasping object and it has to be known the position of it in robot reference. However, there are several ways to solve it explained in Future works. Concluding this main goal seems to has been accomplish, in a good way and making easier for who wants to continue the work to achieve even better results. 9.2 Improvements on other packages As explained in the Introduction, this work has been set inside some constraints as using ROS and RTM software. Therefore, it had to do all the possible efforts to make the global system works with this. Moreover, in order to make the package as good as possible, it has been tried to implement some powerful and recent software. Because of that in some cases it has been needed to improve the external package from the version found at the first stages of the work. Among this improvements highlight two of them: (1) on the romeo_moveit_actions package and (2) on the object tracker from the RTM software. It should be stated that the descriptions made in the dissertation are on the final version of these packages. Firstly, the improvement on romeo_moveit_actions has faced several frontlines. On one hand, it allows to modify externally parameters such as: planning time, minimum tolerance, tolerance step, maximum scale factor of velocity, maximum attempts and if it is wanted to use or not verbose mode. On the other side, the use of a flag that controls when the plan is done to execute or not automatically the movement. Finally, apart from other minor code fixes, it has been implemented two different publishers: (1) for the planned trajectory and (2) for the planned final position of the end effector of the controlled group of joints and links. Secondly, the improvement on the object tracker from RTM software implement the use of the ObjectInfo ROS message which include all the information in one. Instead of the old method which it was publishing the object pose on a topic and the confidence of the tracker in another topic. The new way leads to a more robust control of the position knowing all the time if it is or not a reliable information.
Approach to grasp with Romeo robot using RTM 75 Moreover, although IKFast has not been implemented, there is a huge improvement in knowing what is happening and the tests already done. Therefore, the use of IKFast on Romeo now it is a bit closer which it will make a huge improvement on the Romeo inverse kinematics and so being possible to simulate the robot in all kind of environments. Therefore, it can be said that only because of doing this works it has been a global improvement around Romeo with ROS and the RTM software. 9.3 All in a ROS package From the beginning it has been working directly with different ROS packages, so the most logical is also to create one to include all the desired functionalities. However, the creation of this packages has followed the ROS guidelines, being a code as independent and flexible as possible inside the constraints and attending to the REPs (ROS Enhancement Proposals). Therefore, facilitating to reuse the code on other robots or propose. It is supposed that installing the romeo_grasper dependencies, specified in the same package, it should work perfectly. However, there was a problem linking romeo_grasper to the romeo_moveit_actions package, so a temporally fix is to integrate this package inside romeo_grasper. Moreover, all the code and this dissertation have been uploaded on the GitHub below. Therefore, that makes the code easily to be shared and improved it by the community. Finally, it has been achieve to create a ROS package which allows to accomplish the tasks of the work. Furthermore, this work is now a tool which can be easily implemented for other robotics researchers. https://github.com/lluissalord/romeo_grasper 9.4 Understanding of romeo_grasper The way how the dissertation has been written is focused on make the code easy to understand both at general point of view, reading the Introduction and the Design chapters, and at deep level reading all the work. Even reading it and comparing with the code, one understand all the things done. Moreover, as a responsible code, the name of functions and variable are self-explanatory and comments are used constantly to make explain what is done there or way in that way. Therefore, whoever wants to improve the code or understand it in a deep way can do it reading this work and also won’t have any misunderstanding problem looking at the code.
Approach to grasp with Romeo robot using RTM 83 Appendix A Software requirements and installation A.1 Software requirements In this study there are some software that must be installed to be able to do it. Here it is explained briefly which are these software and their installation. Firstly, a table with the software required with his version A.1. Software Version Ubuntu 14.04 ROS Indigo Choregraphe 2.1.4.5 (1.14.5)1 C++ NAOqi SDK 2.1.4.5 (1.14.5)1 QiBuild from installation2 QtCreator recent3 Table A.1: Software required with his version A.2 Romeo grasper installation Make sure the following ROS dependencies are installed: •naoqi_bridge_msgs •romeo_bringup 1NAO robot use version 1.14.5 and Romeo use 2.1.4.5. So if you want to test first in Nao like in this master thesis you need both versions. 2Recommended installing using pip as is said in qiBuild documentation [2] 3As is said in NAO documentation [1]
84 Approach to grasp with Romeo robot using RTM •romeo_moveit_config •romeo_moveit_actions but should be installed from source from the following repository: https://github.com/ros-aldebaran/romeo_moveit_config •moveit_ros_planning_interface •moveit_visual_tools •moveit_simple_grasps but should be installed from source from the following repository: https://github.com/davetcoleman/moveit_simple_grasps •object_tracker_msg_definitions •object_tracker_srv_definitions After install them and their dependencies clone the repository into a catkin workspace: cd my_catkin_ws/ sr c git clone https :// github . com/ l l u i s s a l o r d /romeo_grasper . git cd . . catkin_make A.3 Camera drivers installation In order to install the Kinect camera with openNi has been used the following url [18]. For the RealSense camera has been used this repository [16] following the installation instructions. Unfortunately, the Asus Xtion camera has not been possible to use so here there is no description about the installation. A.4 V4R installation In order to use the RTM software it should be installed the full V4R library which can be installed from ubuntu package or from source. After that, it should be installed the V4R ROS wrappers [33].
Approach to grasp with Romeo robot using RTM 85 From ubuntu package Following these steps: •Enable the STRANDS repositories: –Add the STRANDS public key to verify packages: curl −s http :// l ca s . l i n c o l n . ac . uk/ repos / public . key | sudo apt−key ,→add − –Add the STRANDS repository: sudo apt−add−r epository http :// l c a s . l i n c o l n . ac . uk/ repos / r e l e a s e •Update index: sudo apt−get update •Install: sudo apt−get i n s t a l l ros−indigo −v4r From source cd ~/somewhere git clone ’ https :// github . com/ strands−p roject /v4r ’ cd v4r mkdir build cd build cmake . . make sudo make i n s t a l l ( optio na l ) V4R ROS wrappers Finally, the wrappers should be installed from source because there are some features that are not yet implemented in the ubuntu package. cd my_catkin_ws/ sr c git clone https :// github . com/ strands−p r oject /v4r_ros_wrappers . git cd . . catkin_make
86 Approach to grasp with Romeo robot using RTM A.5 OpenRAVE installation OpenRAVE is the software which allows to create the inverse kinematics solver IKFast. This software have some dependencies which should be installed from source and it is recommended in the same order: •libccd which is a library for collision detection between two convex shapes https://github.com/danfis/libccd •octomap, an efficient probabilistic 3D mapping framework based on octrees https://github.com/OctoMap/octomap •FCL (Flexible Collision Library) https://github.com/flexible-collision-library/fcl •ODE (Open Dynamics Engine) https://sourceforge.net/projects/opende/ After installing these dependencies, it should be installed bullet-2.80, the recommendation is to use the following ppa because is the version which works well with OpenRAVE. Another recommendation is to remember to enable shared libraries in the installations, because in some of them it is not enabled by default. http://ppa.launchpad.net/joern-schoenyan/libbullet280/ubuntu/ Finally, the installation of OpenRAVE is also recommended to do it from source. Moreover, my installation I had to disable some plugins as qtosgrave and fclrave. This can be done using the command ccmake. https://github.com/rdiankov/openrave