ROS 2 for Robot Arms
Learn ROS 2 the way it's used on real arms, in your browser. Write rclpy nodes that command the Pick & Place arm through its controllers, listen to its joint states, read its URDF, publish its tf tree, call and serve services, take parameters, and pick a ball with trajectory and gripper actions. It's real ROS 2 Jazzy Python, ready to move to a real robot.
What you'll learn
- Write rclpy nodes with publishers, subscriptions, timers and logging
- Read joint states by name and publish stamped messages in the right frame
- Parse a URDF and compute forward kinematics from it
- Broadcast and look up transforms with tf2
- Call and serve services without blocking the executor
- Configure nodes with parameters and validate changes
- Drive ros2_control controllers with trajectory and gripper actions
Before you start
Finish Pick & Place first: this course drives the same arm and reuses its forward kinematics and pick phases. ROS 2 nodes are Python classes, and step 1 explains the little you need. There's nothing to install: a built-in ROS 2 runs in your browser and takes the same rclpy code (Jazzy) you'd run on a real robot. Building packages, launch files and the ros2 command line need a real machine, so the course explains them rather than running them.
Steps
- 1Your first ROS 2 nodeWrite a node whose timer publishes joint commands to the arm's controller, and make the base wave.Nodes and topicsPublishers and timersLoggingOpen
- 2Listening to the robotSubscribe to /joint_states, find each joint by name, and publish where the gripper is as a stamped point in base_link.Subscriptions and callbackssensor_msgs/JointStateStamped messagesPro
- 3Describing the robot (URDF)Read the arm's URDF from its latched topic, compute forward kinematics straight from it, and keep commands inside its joint limits.URDF links and jointsLatched topics (durability)Joint limitsPro
- 4Frames with tf2Be the robot_state_publisher: broadcast every link's frame, then let tf2 find the gripper and move camera detections into the arm's frame.The tf treeStatic and dynamic transformsLookups with a BufferPro
- 5Asking and answering (services)Ask the robot where the balls are and how to reach them, visit each one, and offer a /go_home service of your own.ServicesFutures and call_asyncServing requestsPro
- 6Configuring nodes (parameters)Make the mover's speed and home pose parameters, take them from a launch configuration, and reject bad values at runtime.ParametersOverrides from launch and YAMLValidating changesPro
- 7Controllers and actionsSwitch the arm to its trajectory controller and pick a ball into the cup with FollowJointTrajectory and GripperCommand goals.ros2_controlActions: goal, feedback, resultJoint trajectoriesPro
- ★Bonus: A pick-and-place systemSplit pick and place into perception, planning and picking nodes that cooperate over topics, and clear the table.System designAsync callbacksCallback groupsPro