Author: Jordi Pages < jordi.pages@pal-robotics.com >
Maintainer: Jordi Pages < jordi.pages@pal-robotics.com >
Support: tiago-support@pal-robotics.com
Source: https://github.com/pal-robotics/tiago_tutorials.git
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Playing pre-defined upper body motions
Description: Tutorial on how to play back pre-defined upper body motions with TIAGo using the play_motion package.Keywords: play_motion, joint_trajectory_controller, motion planning
Tutorial Level: BEGINNER
Contents
Purpose
The purpose of this tutorials is to show how to run pre-defined upper body motions with TIAGo. This is pretty easy by using the play_motion package, which enables executing simultaneous trajectories in multiple groups of joints.
Pre-requisites
First make sure that the tutorials are properly installed along with the TIAGo simulation, as shown in the Tutorials Installation Section.
Execution
First open two consoles and source the public simulation workspace as follows:
cd /tiago_public_ws/ source ./devel/setup.bash
Launching the simulation
In the first console launch for example the following simulation
roslaunch tiago_gazebo tiago_gazebo.launch public_sim:=true end_effector:=pal-hey5 world:=empty
Gazebo will show up with TIAGo in an empty world.
When the simulation is launched, the play_motion action server is automatically launched and the motions defined in tiago_motions_pal-hey5_schunk-ft.yaml have been loaded in the ros parameter server.
In order to see the names of the motions defined run the following instruction in the second console:
rosparam list | grep "play_motion/motions" | grep "meta/name" | cut -d '/' -f 4
For TIAGo equipped with the Hey5 hand the following motions are available in the public simulation:
close close_half do_weights gun_hand head_tour home inspect_surroundings offer open pick_from_floor pinch_hand point pregrasp_weight prepare_grasp reach_floor reach_max shake_hands thumb_up_hand unfold_arm wave
The relevant information of a motion, i.e. the wave motion, is stored in the following parameters:
/play_motion/motions/wave/joints /play_motion/motions/wave/points
In the case of the wave motion the joints parameter specifies which joints intervene in the motion:
rosparam get /play_motion/motions/wave/joints
[arm_1_joint, arm_2_joint, arm_3_joint, arm_4_joint, arm_5_joint, arm_6_joint, arm_7_joint]
which denotes that in order to execute this motion the group of joints of the arm will be used.
The joint trajectory, i.e. timed sequence of positions (see http://wiki.ros.org/joint_trajectory_controller for details), that composes this motion can be retrieved as follows
rosparam get /play_motion/motions/wave/points
- positions: [0.06337464909724033, -0.679638896132783, -3.1087325315620733, 2.0882339360702575, -1.1201172410014792, -0.031008601325809293, -2.0744261217334135] time_from_start: 0.0 - positions: [0.06335930908588873, -0.7354151774072313, -2.939624246421942, 1.8341256735249563, -1.1201355028397157, -0.031008601325809293, -2.0744261217334135] time_from_start: 1.0 - positions: [0.06335930908588873, -0.7231278283145929, -2.9385504456273295, 2.2121050027803877, -1.1201355028397157, -0.031008601325809293, -2.0744261217334135] time_from_start: 2.0 - positions: [0.06335930908588873, -0.7354151774072313, -2.939624246421942, 1.8341256735249563, -1.1201355028397157, -0.031008601325809293, -2.0744261217334135] time_from_start: 3.0
Each row of positions denote the position that each joint has to attain at the given time with respect to the start of the motion.
Playing motions
As said, the play_motion is an action server. In order to run a motion the following graphical action client can be used for melodic:
rosrun actionlib axclient.py /play_motion
and for noetic:
rosrun actionlib_tools axclient.py /play_motion
In the GUI the name of the motion to run must be filled. The skip_planning is set by default to False, which means that the transition to the first position of the joint trajectory will use planning to prevent collisions. The remaining of the trajectory is always executed without planning as it is responsibility of the programmer to define a safe trajectory. Set skip_planning to True only if you are sure that it is safe to reach the first positions in the trajectory from the current kinematic configuration of the robot.
By pressing the SEND GOAL button the request will be sent to /play_motion Action Server and the motion will start executing as shown in the pictures.
|
|
|
|
An example of motions execution for the titanium version of TIAGo is shown in the following video:
C++ and Python action clients
In tiago_tutorials/run_motion there are play_motion action clients in C++ and Python.
The usage of the C++ action client node is as follows
rosrun play_motion run_motion wave
where the argument is the name of the motion. If no motion is given the list of available motions will be printed out.
The Python action client node is run as follows
rosrun play_motion run_motion_python_node.py home