Followerο
This package contains ROS2 nodes that allow a target robot to follow joint positions published by a teachbot device.
Overviewο
The teachbot device publishes joint states on /teachbot/<target_robot>/joint_states, and these nodes command the UR robot to move to match those positions.
Quick Startο
Launch Control (Recommended)ο
ros2 launch teachbot_follower follower_action.launch.py
This starts:
TeachBot follower action client
Available Nodesο
1. follower_action β
RECOMMENDED - Action Clientο
This node uses action client to send trajectory goals. Robust with feedback and result handling.
Usage:
ros2 launch teachbot_follower follower_action.launch.py
Parameters:
teachbot_topic(default:/teachbot/joint_states) - Topic to subscribe to for teachbot commandsenable_topic(default:/teachbot/enable) - Topic for enable/disable controlcontroller_name(default:scaled_joint_trajectory_controller) - Name of the joint trajectory controllerupdate_rate(default:0.5) - Seconds between updatesposition_tolerance(default:0.01) - Minimum position change (radians) to trigger movementtrajectory_duration(default:2.0) - Duration for each trajectory segment
2. teachbot_follower_moveit_commander π Alternative - Direct Commands - Experimentalο
This node directly publishes trajectory commands to the robot controller.
Usage:
ros2 run teachbot_follower follower_moveit_commander
Parameters:
teachbot_topic(default:/teachbot/joint_states)enable_topic(default:/teachbot/enable)controller_name(default:scaled_joint_trajectory_controller)update_rate(default:0.5)position_tolerance(default:0.01)trajectory_duration(default:0.5)
Complete Workflowο
Build the package:
cd ~/teachbot_ws colcon build --packages-select teachbot_follower --symlink-install source install/setup.bash
Launch your UR robot with MoveIt:
# For simulation: ros2 launch my_ur_bringup simulation.launch.py # Or for real robot: ros2 launch my_ur_bringup real_robot.launch.py robot_ip:=<ROBOT_IP>
Start your teachbot device (ensure it publishes to
/teachbot/joint_states)Run the follower node:
# For simulation: ros2 launch teachbot_follower follower_action.launch.py sim:=true # Or for real robot: ros2 launch teachbot_follower follower_action.launch.py
Joint Namesο
Make sure the joint names in the teachbot message match the UR robot joint names:
shoulder_pan_jointshoulder_lift_jointelbow_jointwrist_1_jointwrist_2_jointwrist_3_joint
Troubleshootingο
Robot doesnβt moveο
Check that
/teachbot/joint_statesis being published:ros2 topic echo /teachbot/joint_statesVerify MoveIt is running:
ros2 node list | grep move_groupCheck for errors:
ros2 topic echo /rosout
Movement is too slow/fastο
Adjust
update_rateparameter (lower = faster updates)For
ur_teachbot_simple, adjustvelocity_scalingandacceleration_scalingFor
teachbot_follower_actionorteachbot_follower_moveit_commander, adjusttrajectory_duration
Joint names donβt matchο
Check your teachbot joint names:
ros2 topic echo /teachbot/<target_robot>/joint_states --onceVerify UR joint names:
ros2 topic echo /joint_states --once
Safety Notesο
β οΈ Warning: This node will command the robot to follow the teachbot positions. Ensure:
The workspace is clear of obstacles
Emergency stop is accessible
The robot is in a safe starting configuration
You start with slow update rates and small movements to test