ROS 2 Integration
Prerequisites
Before you start, ensure you have:
- ROS 2 Humble, Iron, or Jazzy installed on your host machine
- A TK actuator with firmware v1.2+ (check with
tknd_fw_version) - USB-to-UART adapter for initial micro-ROS transport (or Ethernet for EtherCAT path)
micro_ros_agentpackage installed:sudo apt install ros-$ROS_DISTRO-micro-ros-agent
micro-ROS Agent Setup
The TK firmware runs a micro-ROS node on the STM32. The micro-ROS agent bridges the UART transport to your ROS 2 graph. Start the agent:
ros2 run micro_ros_agent micro_ros_agent serial \
--dev /dev/ttyUSB0 \
--baudrate 921600
Once connected, the actuator announces itself on the ROS 2 graph. Verify with:
ros2 node list
# /tk_joint_0 (or whichever node ID is configured)
Topic Layout
Each actuator node exposes these standard topics:
| Topic | Type | Direction |
|---|---|---|
/tk_joint_N/joint_state | sensor_msgs/JointState | Published |
/tk_joint_N/cmd_pos | std_msgs/Float64 | Subscribed |
/tk_joint_N/cmd_vel | std_msgs/Float64 | Subscribed |
/tk_joint_N/cmd_torque | std_msgs/Float64 | Subscribed |
/tk_joint_N/impedance_params | tknd_msgs/ImpedanceParams | Subscribed |
/tk_joint_N/diagnostics | diagnostic_msgs/DiagnosticArray | Published |
Where N is the actuator node ID (0–63), set in firmware via EEPROM[0x2001].
Launch Files
A sample launch file for a 6-DOF arm with TK-120 at each joint:
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
agents = []
for i in range(6):
agents.append(Node(
package='micro_ros_agent',
executable='micro_ros_agent',
name=f'tk_agent_{i}',
arguments=['serial', '--dev', f'/dev/ttyUSB{i}',
'--baudrate', '921600'],
))
return LaunchDescription(agents)
Note: For EtherCAT transport, use the tknd_ethercat_bridge package instead of direct serial agents. See the EtherCAT guide for setup.
MoveIt 2 SRDF
The TK firmware package includes URDF and SRDF files for each actuator model. Copy them into your MoveIt 2 config package:
cp $TKND_FIRMWARE_PKG/urdf/tk_120.urdf.xacro \
~/ros2_ws/src/my_robot_moveit/config/
cp $TKND_FIRMWARE_PKG/srdf/tk_120.srdf \
~/ros2_ws/src/my_robot_moveit/config/
The included SRDF defines one planning group per joint (joint_group_N) and a default virtual joint for each axis. Edit as needed for your kinematic chain.
Joint State Publisher
To aggregate all TK joint state topics into a single /joint_states message for robot_state_publisher:
ros2 run joint_state_publisher joint_state_publisher \
--ros-args -p source_list:="[
'/tk_joint_0/joint_state',
'/tk_joint_1/joint_state',
'/tk_joint_2/joint_state'
]"
This is required for RViz and MoveIt 2 to track the robot's current configuration. Adjust the list for your DOF count.