IEEE Robotics & Automation Magazine - September 2010 - 24
The PR2 robot is designed to do
human-scale tasks in environments
where people are present.
A key criterion for the selection was promised open-source
contributions back to ROS, and we expect that the robotics
community will benefit greatly from the work of these groups
over the next two years. The groups will leverage the core
capabilities that have already been put into ROS. In the next
section, we will explore one particularly powerful such capability, the transform library (TF).
Using the ROS TF on PR2
Robots like the PR2 move around in and manipulate the
three-dimensional (3-D) world. They have to reason about
how the sensor reading taken one second can be used to
manipulate an object some time later, while the linkage
between the sensor platform and the robot's hand moves in
arbitrary ways. The ROS TF library (named for either TransForm or for its author Tully Foote) is designed to make this
common problem trivial. TF is part of the ROS base functionality and is useful on a wide variety of robot hardware.
TF is a coordinate frame-tracking system designed to work
with distributed systems such as ROS. Frames are parts of the
robot or the environment that contain a unique coordinate
system. A robot like the PR2 has a large number of frames:
one for each camera, one for the base of the robot, one or
more for the maps the robot keeps of the environment, and
one for each link in each arm. The key idea behind TF is that
individual components can publish their own frames, so that
one program can monitor the joints of the robot and report
frames for them, another program can report the frame for the
map, and yet another can publish frames for objects that are
being tracked.
Let us look at a simple example. Imagine a simple planar
robot moving through a flat world. We can talk about the
robot moving from Point A to B, but even that simple way of
speaking presumes a coordinate frame in which A and B are
defined. A and B could be defined in the map frame, but,
when we program the robot to move from A to B, we need to
think in terms of the robot's frame, and the crux of the program is often transforming the goal B into robot coordinates
instead of map coordinates.
As the robot moves from A to B, it will observe objects at
different times. Its range sensor might detect an object at one
time and another object half a second later. TF lets a programmer easily transform the sensor-centric coordinates of those
readings into map coordinates, compensating for time, so that
the programmer can build an accurate model of the world. In
a much more complicated robot like the PR2, this means that
we can use a camera embedded in the forearm to detect a wall
24
IEEE Robotics & Automation Magazine
outlet and register its coordinates in the frame of the robot's
base, and then move that arm to a position where it can grasp a
plug and robustly insert the plug into the outlet. It also means
that making the robot's parts move in harmony is a trivial
programming task. The code sample below is a simple ROS
Python program for pointing the PR2's head at a point in
space. Lines 1-4 just set up the program's environment by
bringing in the relevant modules. Line 6 creates a new ROS
node called move_the_head. Lines 8-10 use ActionLib
to create a simple controller that will aim the head at a goal.
(ActionLib will be the subject of a future column and is
already the subject of a number of tutorials on ros.org.)
1 import rospy
2 from actionlib import SimpleActionClient
3 from pr2_controllers_msgs.msg import
PointHeadAction, PointHeadGoal
4 from geometry_msgs.msg import Point
5
6 rospy.init_node('move_the_head')
7
8 client = SimpleActionClient(
9 '/head_traj_controller/point_head_
action', PointHeadAction)
10 client.wait_for_server()
11
12 g = PointHeadGoal()
13 g.target.header.frame_id = 'base_link'
14 g.target.point = Point(1.0, 0.0, 1.0)
15 g.min_duration = rospy.Duration(1)
16
17 client.send_goal(g)
18 client.wait_for_result()
For purposes of this article, the interesting lines are 12-15,
and especially line 13. Line 12 creates a PointHeadGoal that
can be passed to the head controller (client). How do we
express that goal? We express it with respect to a frame. In line
13, the frame_id is set to base_link, which is welldefined on the PR2, the base of the robot. So far, this example
is a bit boring. Line 14 sets the goal to (1.0, 0.0, 1.0) relative to
the base of the robot, and if we run the example, the robot
would stare off at a point in space. By adjusting the (x,y,z) of the
goal, we could make the head stare at a different point in space.
What is really cool is that TF allows us to automatically reason about lots of other interesting points that the robot implicitly
knows about. Instead of using base_link, we could ask the
robot to point the head at (0.0, 0.0, 0.0) of r_gripper_r_
finger_tip_link (the right gripper's right finger tip) and
without any more thought we run the program and the robot
looks at its right hand. Furthermore, it is a trivial adaptation to
the program to add a loop so that the head follows the hand
where ever it moves. And that simple 20-line program will
make the head follow the hand, no matter whether the hand is
being commanded to move by another program or moved by a
person touching the robot. Similarly, by using a map frame, the
SEPTEMBER 2010
http://www.ros.org
Table of Contents for the Digital Edition of IEEE Robotics & Automation Magazine - September 2010
IEEE Robotics & Automation Magazine - September 2010 - Cover1
IEEE Robotics & Automation Magazine - September 2010 - Cover2
IEEE Robotics & Automation Magazine - September 2010 - 1
IEEE Robotics & Automation Magazine - September 2010 - 2
IEEE Robotics & Automation Magazine - September 2010 - 3
IEEE Robotics & Automation Magazine - September 2010 - 4
IEEE Robotics & Automation Magazine - September 2010 - 5
IEEE Robotics & Automation Magazine - September 2010 - 6
IEEE Robotics & Automation Magazine - September 2010 - 7
IEEE Robotics & Automation Magazine - September 2010 - 8
IEEE Robotics & Automation Magazine - September 2010 - 9
IEEE Robotics & Automation Magazine - September 2010 - 10
IEEE Robotics & Automation Magazine - September 2010 - 11
IEEE Robotics & Automation Magazine - September 2010 - 12
IEEE Robotics & Automation Magazine - September 2010 - 13
IEEE Robotics & Automation Magazine - September 2010 - 14
IEEE Robotics & Automation Magazine - September 2010 - 15
IEEE Robotics & Automation Magazine - September 2010 - 16
IEEE Robotics & Automation Magazine - September 2010 - 17
IEEE Robotics & Automation Magazine - September 2010 - 18
IEEE Robotics & Automation Magazine - September 2010 - 19
IEEE Robotics & Automation Magazine - September 2010 - 20
IEEE Robotics & Automation Magazine - September 2010 - 21
IEEE Robotics & Automation Magazine - September 2010 - 22
IEEE Robotics & Automation Magazine - September 2010 - 23
IEEE Robotics & Automation Magazine - September 2010 - 24
IEEE Robotics & Automation Magazine - September 2010 - 25
IEEE Robotics & Automation Magazine - September 2010 - 26
IEEE Robotics & Automation Magazine - September 2010 - 27
IEEE Robotics & Automation Magazine - September 2010 - 28
IEEE Robotics & Automation Magazine - September 2010 - 29
IEEE Robotics & Automation Magazine - September 2010 - 30
IEEE Robotics & Automation Magazine - September 2010 - 31
IEEE Robotics & Automation Magazine - September 2010 - 32
IEEE Robotics & Automation Magazine - September 2010 - 33
IEEE Robotics & Automation Magazine - September 2010 - 34
IEEE Robotics & Automation Magazine - September 2010 - 35
IEEE Robotics & Automation Magazine - September 2010 - 36
IEEE Robotics & Automation Magazine - September 2010 - 37
IEEE Robotics & Automation Magazine - September 2010 - 38
IEEE Robotics & Automation Magazine - September 2010 - 39
IEEE Robotics & Automation Magazine - September 2010 - 40
IEEE Robotics & Automation Magazine - September 2010 - 41
IEEE Robotics & Automation Magazine - September 2010 - 42
IEEE Robotics & Automation Magazine - September 2010 - 43
IEEE Robotics & Automation Magazine - September 2010 - 44
IEEE Robotics & Automation Magazine - September 2010 - 45
IEEE Robotics & Automation Magazine - September 2010 - 46
IEEE Robotics & Automation Magazine - September 2010 - 47
IEEE Robotics & Automation Magazine - September 2010 - 48
IEEE Robotics & Automation Magazine - September 2010 - 49
IEEE Robotics & Automation Magazine - September 2010 - 50
IEEE Robotics & Automation Magazine - September 2010 - 51
IEEE Robotics & Automation Magazine - September 2010 - 52
IEEE Robotics & Automation Magazine - September 2010 - 53
IEEE Robotics & Automation Magazine - September 2010 - 54
IEEE Robotics & Automation Magazine - September 2010 - 55
IEEE Robotics & Automation Magazine - September 2010 - 56
IEEE Robotics & Automation Magazine - September 2010 - 57
IEEE Robotics & Automation Magazine - September 2010 - 58
IEEE Robotics & Automation Magazine - September 2010 - 59
IEEE Robotics & Automation Magazine - September 2010 - 60
IEEE Robotics & Automation Magazine - September 2010 - 61
IEEE Robotics & Automation Magazine - September 2010 - 62
IEEE Robotics & Automation Magazine - September 2010 - 63
IEEE Robotics & Automation Magazine - September 2010 - 64
IEEE Robotics & Automation Magazine - September 2010 - 65
IEEE Robotics & Automation Magazine - September 2010 - 66
IEEE Robotics & Automation Magazine - September 2010 - 67
IEEE Robotics & Automation Magazine - September 2010 - 68
IEEE Robotics & Automation Magazine - September 2010 - 69
IEEE Robotics & Automation Magazine - September 2010 - 70
IEEE Robotics & Automation Magazine - September 2010 - 71
IEEE Robotics & Automation Magazine - September 2010 - 72
IEEE Robotics & Automation Magazine - September 2010 - 73
IEEE Robotics & Automation Magazine - September 2010 - 74
IEEE Robotics & Automation Magazine - September 2010 - 75
IEEE Robotics & Automation Magazine - September 2010 - 76
IEEE Robotics & Automation Magazine - September 2010 - 77
IEEE Robotics & Automation Magazine - September 2010 - 78
IEEE Robotics & Automation Magazine - September 2010 - 79
IEEE Robotics & Automation Magazine - September 2010 - 80
IEEE Robotics & Automation Magazine - September 2010 - 81
IEEE Robotics & Automation Magazine - September 2010 - 82
IEEE Robotics & Automation Magazine - September 2010 - 83
IEEE Robotics & Automation Magazine - September 2010 - 84
IEEE Robotics & Automation Magazine - September 2010 - 85
IEEE Robotics & Automation Magazine - September 2010 - 86
IEEE Robotics & Automation Magazine - September 2010 - 87
IEEE Robotics & Automation Magazine - September 2010 - 88
IEEE Robotics & Automation Magazine - September 2010 - 89
IEEE Robotics & Automation Magazine - September 2010 - 90
IEEE Robotics & Automation Magazine - September 2010 - 91
IEEE Robotics & Automation Magazine - September 2010 - 92
IEEE Robotics & Automation Magazine - September 2010 - 93
IEEE Robotics & Automation Magazine - September 2010 - 94
IEEE Robotics & Automation Magazine - September 2010 - 95
IEEE Robotics & Automation Magazine - September 2010 - 96
IEEE Robotics & Automation Magazine - September 2010 - 97
IEEE Robotics & Automation Magazine - September 2010 - 98
IEEE Robotics & Automation Magazine - September 2010 - 99
IEEE Robotics & Automation Magazine - September 2010 - 100
IEEE Robotics & Automation Magazine - September 2010 - 101
IEEE Robotics & Automation Magazine - September 2010 - 102
IEEE Robotics & Automation Magazine - September 2010 - 103
IEEE Robotics & Automation Magazine - September 2010 - 104
IEEE Robotics & Automation Magazine - September 2010 - Cover3
IEEE Robotics & Automation Magazine - September 2010 - Cover4
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2023
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2023
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2023
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2023
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2022
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2022
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2022
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2022
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2021
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2021
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2021
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2021
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2020
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2020
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2020
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2020
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2019
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2019
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2019
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2019
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2018
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2018
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2018
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2018
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2017
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2017
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2017
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2017
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2016
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2016
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2016
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2016
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2015
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2015
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2015
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2015
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2014
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2014
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2014
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2014
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2013
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2013
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2013
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2013
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2012
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2012
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2012
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2012
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2011
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2011
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_june2011
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_march2011
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_december2010
https://www.nxtbook.com/nxtbooks/ieee/roboticsautomation_september2010
https://www.nxtbookmedia.com