ROS-Industrial Basic Developer’s
Training Class
July 2023
Southwest Research Institute
1
Session 3:
Motion Control of Manipulators
Southwest Research Institute
2
Outline
• URDF
• TF
• Motion Planning in ROS
3
HowTo:
Set Up a New Robot
1. Create a URDF
2. Create a MoveIt! Package
3. Update MoveIt! Package for ROS-I
4. Test on ROS-I Simulator
5. Test on “Real” Robot
4
URDF:
Unified Robot
Description Format
5
URDF: Overview
• URDF is an XML-formatted file containing:
– Links : coordinate frames and associated geometry
– Joints : connections between links
• Similar to DH-parameters (but way less painful)
• Can describe entire workspace, not just robots
links
also
a “link”
joint
6
URDF: Link
• A Link describes a physical or virtual object
– Physical: robot link, workpiece, end-effector, ...
– Virtual : TCP, robot base frame, ...
• Each link becomes a TF frame
• Can contain visual/collision geometry [optional]
• http://wiki.ros.org/urdf/XML/link
<link name=“link_4“>
<visual>
<geometry>
<mesh filename=“link_4.stl"/>
</geometry>
<origin xyz="0 0 0" rpy="0 0 0" />
</visual>
<collision> visual
<geometry>
<cylinder length="0.5" radius="0.1"/> geometry collision
</geometry> frame geometry
<origin xyz="0 0 -0.05" rpy="0 0 0" />
</collision>
</link>
URDF Transforms
X/Y/Z Roll/Pitch/Yaw
Meters Radians
7
URDF: Joint
• A Joint connects two Links
– Defines a transform between parent and child frames
• Types: fixed, free, linear, rotary
– Denotes axis of movement (for linear / rotary)
– Contains joint limits on position and velocity
• ROS-I conventions
– X-axis front, Z-Axis up
– Keep all frames similarly rotated when possible
• http://wiki.ros.org/urdf/XML/joint
<joint name=“joint_2" type="revolute“>
<parent link=“link_1"/> link_2
<child link=“link_2"/>
<origin xyz=“0.2 0.2 0" rpy="0 0 0"/>
<axis xyz=“0 0 1"/>
<limit lower="-3.14" upper="3.14" velocity="1.0"/>
</joint>
8
URDF Tips
• create from datasheet or use Solidworks Add-In
• double-check joint-offsets for accuracy
• round near-zero offsets (if appropriate)
• use “base_link” and “tool0”
• use simplified collision models
– convex-hull or primitives
9
Verify the URDF
• It is critical to verify that your URDF matches
the physical robot:
– each joint moves as expected
– joint-coupling issues are identified
– min/max joint limits
– joint directions (pos/neg)
– correct zero-position, etc.
– check forward kinematics
10
Exercise 3.0
Exercise 3.0
Create a simple urdf
camera_frame
table
world
11
URDF: XACRO
• XACRO is an XML-based “macro language” for building URDFs
– <Include> other XACROs, with parameters
– Simple expressions: math, substitution
• Used to build complex URDFs
– multi-robot workcells
– reuse standard URDFs (e.g. robots, tooling)
<xacro:include filename=“myRobot.xacro”/>
<xacro:myRobot prefix=“left_”/>
<xacro:myRobot prefix=“right_”/>
<property name=“offset” value=“1.3”/>
<joint name=“world_to_left" type=“fixed“>
<parent link=“world"/>
<child link=“left_base_link"/>
<origin xyz=“${offset/2} 0 0" rpy="0 0 0"/>
</joint>
12
Exercise 3.1
Exercise 3.1
Combine simple urdf with ur5 xacro
camera_frame
base_link
table
world
14
TF – Transforms in ROS
15
TF: Overview
• TF is a distributed framework
to track coordinate frames
• Each frame is related to at least one other frame
16
TF: Time Sync
• TF tracks frame history
– can be used to find transforms in the past!
– essential for asynchronous / distributed system
world camera camera camera
robot base widget widget widget
Transform
widget
time
To
TCP?
world robot base robot base robot base robot base robot base
camera TCP TCP TCP TCP TCP
17
TF: c++
• Each node has its own TransformListener
– listens to all TF messages, calculates relative transforms
– Can try to transform in the past
➢ Can only look as far back as it has been running
tf2_ros::Buffer buffer(node->get_clock());
tf2_ros::TransformListener listener(buffer);
geometry_msgs::msg::TransformStamped transform;
transform = buffer.lookupTransform(“target”, “source”, tf2::TimePointZero);
Parent Frame Child Frame
Result Time
(“reference”) (“object”)
• Note confusing “target/source” naming convention
• Tf2::TimePointZero gives latest available transform
18
TF Timing
• When requesting a transform, you must specify a
time:
– Latest Received
lookupTransform(“from”, “to”, tf2::TimePointZero)
– Current Time (will probably fail)
lookupTransform(“from”, “to”, now)
– Current Time (wait for it to be available)
lookupTransform(“from”, “to”, now, 50ms)
19
TF: Sources
• A robot_state_publisher provides TF data from a URDF
• Nodes can also publish TF data
– DANGER! TF data can be conflicting
Camera
URDF
Robot TCP TCP
State Tracker
Publisher Node
base
TF
20
Exercise 3.2
Exercise 3.2
Param: base_frame
Introduction to TF
fake_ar_pub myworkcell_node
myworkcell_support
vision_node
descartes_node
TF
myworkcell_moveit_cfg ur5_driver
world->target = world->camera
* camera->target
21
Motion Planning
in ROS
(using MoveIt)
22
Motion Planning
in ROS
23
Traditional Robot Programming
User Application Robot Controller
Interpolate Execute
Joint
Move J1 J2 J1 J2
Linear
Move P1 P2 P1 P2
• Motion Types: limited, but well-defined. One motion task.
• Environment Model: none
24
ROS Motion Planning
Robot Controller
Execute
User Application ROS Motion Planning
Move
Request Start Goal
Planning Filtering
• Motion Types: flexible, goal-driven, with constraints
but minimal control over actual path
• Environment Model: yes (fixed CAD or sensor-driven)
25
Motion Planning Components
Interactive Motion Planning
(rviz plugin)
Kinematics
ROS Actions Robot
Path Planning
Collision Checking
C++ API
26
MoveIt Components
Sensor Input
http://moveit.ros.org/wiki/High-level_Overview_Diagram
http://moveit.ros.org/wiki/Pipeline_Overview_Diagram 27
MoveIt Nodes
ROS Parameters
http://moveit.ros.org/documentation/concepts/
28
MoveIt! Package - Motivation
For each new robot model...
create a new MoveIt! package
• Kinematics
– physical configuration, lengths, etc.
• MoveIt! configuration
– plugins, default parameter values
– self-collision testing
– pre-defined poses
• Robot connection
– FollowJointTrajectory Action name
29
MoveIt! Package Contents
• A MoveIt! Package...
– includes all required nodes, config, launch files
• motion planning, filtering, collision detection, etc.
– is unique to each individual robot model
• includes references to URDF robot data
– uses a standard interface to robots
• publish trajectory, listen to joint angles
– can (optionally) include workcell geometry
• e.g. for collision checking
30
Create a MoveIt! Package
• Use the MoveIt! Setup Assistant
– can create a new package or edit an existing one
31
Update MoveIt! Package
• Setup Assistant generates a generic package
– missing config. data to connect to a specific robot
– ROS-I robots use a standard interface
32
Exercise 3.3
Exercise 3.3:
Create a MoveIt! Package Param: base_frame
fake_ar_pub myworkcell_node
myworkcell_support
vision_node
descartes_node
myworkcell_moveit_config ur5_driver
34
Motion Planning using MoveIt!
1. Motion Planning using Rviz
2. Motion Planning using C++
35
Motion Planning in RViz
Display Options
36
Motion Planning in RViz
Planning Options
37
Exercise 3.4
Exercise 3.4:
Motion Planning using RVIZ
38
Review
ROS ROS-Industrial
• URDF • Robot Drivers
• MoveIt • Path Planners
• Path Planners
• RViz Planning
39
Questions?
• ROS-I Architecture
• Setup Assistant
• Robot Launch Files
• RViz Planning
40