Manipulator Basics · Bridge to production software
From Manipulator Basics to ROS 2
Everything in Manipulator Basics has a counterpart in the ROS 2 manipulation stack. This page maps each concept to the package that implements it, shows how the pieces connect, and gives small, practical examples to start a real robot project.
What this page is, and is not
This site does not run ROS 2. All simulations in Manipulator Basics, the labs and the capstone run in your browser on the site's own JavaScript engine: kinematics, dynamics, trajectories, control, collision checking and planning written for teaching. No ROS 2 nodes, topics, MoveIt 2 or ros2_control run here, and nothing on this site connects to a robot. This page explains how the same ideas appear in ROS 2, so that what you learned transfers to a real project.
ROS 2 is the most widely used open-source framework for robot software. For manipulators, the main pieces are the robot description (URDF), the transform library (TF2), the controller framework (ros2_control) and the motion-planning framework (MoveIt 2). Package names and defaults change between ROS 2 distributions: check the documentation of the distribution you use.
Concept map: this section → ROS 2
| In Manipulator Basics | In ROS 2 | Where you met it |
|---|---|---|
| Links, joints, joint types and limits | URDF <link> and <joint> (revolute, continuous, prismatic, fixed) with <limit> | Module 01, Lab 01 |
| Frames and homogeneous transforms | TF2: a tree of time-stamped transforms between named frames | Module 03, Lab 02 |
| DH parameters | Not used directly: each URDF joint has a full origin (xyz, rpy) and an axis | Module 05 |
| Forward kinematics | robot_state_publisher computes every link pose from joint states and publishes it to TF2 | Module 06 |
| Joint values for display | joint_state_publisher (and its GUI) publishes /joint_states without hardware | Lab 04 |
| Inverse kinematics | MoveIt 2 kinematics plugins: KDL (numerical), TRAC-IK, IKFast (analytic, generated), pick_ik | Module 07 |
| Jacobian, singularities | MoveIt's RobotState Jacobian; MoveIt Servo for real-time Cartesian jogging with singularity handling | Module 08 |
| Dynamics | Inertial tags in URDF; dynamics libraries (for example KDL, Pinocchio) and simulators | Module 09 |
| Trajectories and time scaling | trajectory_msgs/JointTrajectory; MoveIt time parameterisation (for example TOTG, Ruckig smoothing) | Module 10 |
| Joint control | ros2_control: controller_manager, hardware interfaces, joint_trajectory_controller, PID gains | Module 11 |
| Gripper and grasping | Gripper action controllers in ros2_controllers; grasp pipelines such as MoveIt Task Constructor | Module 12 |
| C-space, collision checking, RRT | MoveIt planning scene, FCL collision checking, OMPL planners (RRTConnect, RRT*, PRM, …) | Module 13 |
| Calibration | Calibrated values applied in the robot description or the driver; hand-eye results as static TF transforms | Module 14 |
Architecture
Reading the diagram from the robot outwards:
- The hardware interface of ros2_control talks to the motor drives (or to a simulator or mock hardware) and exposes state interfaces (position, velocity, effort) and command interfaces.
- The joint_state_broadcaster publishes
/joint_states. robot_state_publisher combines them with the URDF (forward kinematics) and publishes every link frame to/tf, and fixed frames to/tf_static. - MoveIt 2 (the
move_groupnode) keeps a planning scene: the robot model, its current state, and the world's collision objects (added by code or from perception). For a goal pose it calls the kinematics plugin (IK), a planner (OMPL by default) that checks configurations and edges with collision checking, then smooths and time-parameterises the path under the joint limits. - The trajectory goes to the joint_trajectory_controller through the
FollowJointTrajectoryaction, which interpolates it and commands the joints every control cycle. A gripper controller opens and closes the jaws through its own action.
The capstone of this section follows the same sequence in miniature: base and tool frames, target poses, IK, limit checks, collision-checked planning, timed execution with monitoring, and a gripper with its own conditions.
URDF: links, joints and limits
A URDF describes the robot as a tree of links (rigid bodies with visual, collision and inertial properties) joined by joints. Each joint has a type, a parent and a child link, an origin (the fixed transform from the parent link frame to the joint frame, as xyz in metres and roll-pitch-yaw in radians) and an axis in the joint frame. Here is the planar 2R arm of the labs (0.4 m and 0.3 m links) with a fixed tool0 frame at the tip:
<robot name="planar_2r">
<link name="base_link"/>
<link name="link1">
<collision>
<origin xyz="0.2 0 0" rpy="0 1.5708 0"/>
<geometry><cylinder radius="0.03" length="0.4"/></geometry>
</collision>
<inertial>
<origin xyz="0.2 0 0"/>
<mass value="2.0"/>
<inertia ixx="0.001" iyy="0.0267" izz="0.0267" ixy="0" ixz="0" iyz="0"/>
</inertial>
</link>
<link name="link2"/>
<link name="tool0"/>
<joint name="joint1" type="revolute">
<parent link="base_link"/>
<child link="link1"/>
<origin xyz="0 0 0" rpy="0 0 0"/>
<axis xyz="0 0 1"/>
<limit lower="-2.967" upper="2.967" effort="40" velocity="2.5"/>
</joint>
<joint name="joint2" type="revolute">
<parent link="link1"/>
<child link="link2"/>
<origin xyz="0.4 0 0" rpy="0 0 0"/> <!-- L1 along x of link1 -->
<axis xyz="0 0 1"/>
<limit lower="-2.967" upper="2.967" effort="20" velocity="2.5"/>
</joint>
<joint name="tool0_joint" type="fixed"> <!-- the TCP: L2 along x of link2 -->
<parent link="link2"/>
<child link="tool0"/>
<origin xyz="0.3 0 0" rpy="0 0 0"/>
</joint>
</robot>From a DH table to URDF origins
For a standard DH row , the joint itself supplies . The rest, , is a fixed transform that becomes the origin of the next joint (or of the tool frame after the last row): , . A constant DH offset in has no URDF slot of its own: it is handled with an extra yaw in that origin, or as a joint offset in the driver. For the engine's 4-DOF arm this gives:
| Origin of | xyz (m) | rpy (rad) |
|---|---|---|
| joint2 | 0.000 0.000 0.300 | 1.5708 0.0000 0.0000 |
| joint3 | 0.320 0.000 0.000 | 0.0000 0.0000 0.0000 |
| joint4 | 0.280 0.000 0.000 | 0.0000 0.0000 0.0000 |
| tool0_joint | 0.100 0.000 0.000 | 0.0000 0.0000 0.0000 |
Multiplying these origins and the joint rotations reproduces the engine's DH forward kinematics exactly: at the largest element-wise difference is . Tools such as xacro macros make such descriptions shorter and parameterised.
TF2, robot_state_publisher and joint_state_publisher
TF2 stores the transforms between named frames over time and composes them on request: ask for base_link → tool0 and it multiplies the chain for you, at the time stamp you choose. This is Module 03 as a service.
- robot_state_publisher reads the URDF (the
robot_descriptionparameter) and the/joint_statestopic, computes forward kinematics and publishes the link frames. Fixed joints go to/tf_staticonce. - joint_state_publisher publishes joint states when no real robot does, for example to view a URDF in RViz; joint_state_publisher_gui adds a slider per joint, much like the sliders of Lab 04. On a real or simulated robot, ros2_control's joint_state_broadcaster publishes the measured states instead.
# view a URDF with sliders (launch files differ per package)
ros2 run robot_state_publisher robot_state_publisher --ros-args -p robot_description:="$(cat planar_2r.urdf)"
ros2 run joint_state_publisher_gui joint_state_publisher_gui
# what the robot reports, and where the tool is
ros2 topic echo /joint_states --once
ros2 run tf2_ros tf2_echo base_link tool0ros2_control, joint trajectory and gripper controllers
ros2_control separates hardware interfaces (plugins that read sensors and write commands to the real robot, a simulator or mock hardware) from controllers (plugins that compute commands). The controller_manager loads both and runs the read–update–write loop at a fixed rate. The URDF declares which interfaces each joint has:
<ros2_control name="Planar2RSystem" type="system">
<hardware>
<plugin>mock_components/GenericSystem</plugin> <!-- replace with the real driver's plugin -->
</hardware>
<joint name="joint1">
<command_interface name="position"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
</joint>
<joint name="joint2">
<command_interface name="position"/>
<state_interface name="position"/>
<state_interface name="velocity"/>
</joint>
</ros2_control>controller_manager:
ros__parameters:
update_rate: 500 # Hz, like the 500 Hz controller of Module 11
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
arm_controller:
type: joint_trajectory_controller/JointTrajectoryController
arm_controller:
ros__parameters:
joints: [joint1, joint2]
command_interfaces: [position]
state_interfaces: [position, velocity]
constraints:
goal_time: 0.5
joint1: {trajectory: 0.05, goal: 0.01} # rad: abort if tracking error exceeds these
joint2: {trajectory: 0.05, goal: 0.01}With a position command interface, the drive's own cascaded loops do the servoing (Module 11); with velocity or effort interfaces the joint trajectory controller closes a PID loop itself. Sending a trajectory by hand:
ros2 control list_controllers
ros2 action send_goal /arm_controller/follow_joint_trajectory control_msgs/action/FollowJointTrajectory \
"{trajectory: {joint_names: [joint1, joint2], points: [
{positions: [0.0, 0.0], time_from_start: {sec: 0}},
{positions: [0.5236, 0.7854], time_from_start: {sec: 2}}]}}"Grippers are usually driven by a gripper action controller from ros2_controllers (the exact controller type depends on the distribution and the gripper), which accepts a target position and a maximum effort, and reports whether the jaws stalled on an object. That stall signal is the real-world counterpart of the grasp checks in Lab 09.
MoveIt 2: kinematics, planning scene, collision checking
MoveIt 2 turns "put the tool here, without hitting anything" into a trajectory for the controllers. Its configuration (usually generated with the MoveIt Setup Assistant) adds an SRDF to the URDF: planning groups (for example arm and gripper), the end effector, named poses such as home, and link pairs that can never collide and need not be checked.
Kinematics plugins
arm:
kinematics_solver: kdl_kinematics_plugin/KDLKinematicsPlugin
kinematics_solver_search_resolution: 0.005
kinematics_solver_timeout: 0.05Planning scene and collision checking
The planning scene holds the robot's current state and the collision objects of the world: boxes, cylinders and meshes added by code, or occupancy data from a depth camera. Objects can be attached to a link when grasped, so they move with the gripper and are checked against the world: exactly what the capstone does with a carried part. Collision checking uses FCL by default, with the self-collision matrix from the SRDF to skip pairs that can never touch.
Planning and execution
A planning request names the group, the goal (joint values, a pose, or constraints) and options such as the planner, the time limit and velocity scaling. OMPL's sampling-based planners (RRTConnect by default, RRT*, PRM and others) find a collision-free path in C-space. MoveIt then smooths it, applies time parameterisation within the joint velocity and acceleration limits, and executes it through the joint trajectory controller, monitoring the execution. A minimal C++ use of the MoveGroup interface:
#include <moveit/move_group_interface/move_group_interface.h> // header path varies by distribution
// ... inside a node, after rclcpp::init:
moveit::planning_interface::MoveGroupInterface arm(node, "arm");
arm.setMaxVelocityScalingFactor(0.5);
geometry_msgs::msg::Pose target;
target.position.x = 0.40; target.position.y = 0.0; target.position.z = 0.15;
target.orientation.x = 1.0; target.orientation.w = 0.0; // tool z axis pointing down (180° about x)
arm.setPoseTarget(target);
moveit::planning_interface::MoveGroupInterface::Plan plan;
if (arm.plan(plan) == moveit::core::MoveItErrorCode::SUCCESS)
arm.execute(plan); // IK, collision-checked planning, time parameterisation, then the controllerPick-and-place pipelines are often built with MoveIt Task Constructor, which chains stages (open gripper, approach, grasp, attach object, lift, place, retreat) and plans them together, so a grasp is only chosen if the whole sequence is feasible.
Next steps toward a real robot
- Write (or download from the manufacturer) the URDF of your arm. View it with joint_state_publisher_gui and check every joint direction and limit against the datasheet.
- Add a ros2_control tag with mock hardware and a joint trajectory controller; send trajectories by hand.
- Generate a MoveIt 2 configuration with the Setup Assistant; plan and execute in RViz with mock hardware.
- Add collision objects for your table and fixtures; plan around them.
- Switch to a simulator, then to the real driver, at reduced speed and with the robot's safety functions configured.
- Calibrate the TCP and the base or user frames (Module 14) before relying on poses from CAD or vision.
Official documentation: the ROS 2 documentation (docs.ros.org), the ros2_control documentation (control.ros.org) and the MoveIt 2 documentation (moveit.picknik.ai). Choose the pages for your ROS 2 distribution, because interfaces and defaults change between releases.