joint_state_publisher
This file is ai generated. Do not edit this file directly. Instead, edit the node source code and run the generate-node-docs command to update this file.
Description
The joint_state_publisher node publishes sensor_msgs/JointState messages for a robot described with URDF, SDF, or COLLADA formats. It reads the robot description from the robot_description topic or a file and publishes joint states for all non-fixed joints. The node can operate in several modes: publishing default/zero positions, subscribing to external joint state sources, or automatically updating joint positions with a configurable delta for animation.
Publishers
joint_states (
sensor_msgs/msg/JointState)Publishes the current state of all robot joints including positions, velocities, and efforts depending on configuration
Subscribers
robot_description (
std_msgs/msg/String)Receives robot description in URDF, SDF, or COLLADA format
QoS: Depth 1, Transient Local durability
{source_topics} (
sensor_msgs/msg/JointState)Dynamically subscribes to topics specified in the
source_listparameterUpdates joint states from external sources
Parameters
publish_default_efforts (bool, default:
false)Whether to publish default effort values (0.0) for all joints
publish_default_positions (bool, default:
true)Whether to publish default position values (zero position) for all joints
publish_default_velocities (bool, default:
false)Whether to publish default velocity values (0.0) for all joints
rate (int, default:
10)Publishing rate in Hz for joint state messages
source_list (string[], default:
[])List of topics to subscribe to for joint state updates
Joint states from these sources override default values
use_mimic_tags (bool, default:
true)Whether to process and use mimic joint tags from the robot description
use_smallest_joint_limits (bool, default:
true)Whether to use safety controller soft limits when available (reduces joint range)
delta (double, default:
0.0)Amount to increment joint positions each publish cycle
When > 0, joints automatically move within their limits for animation
Joints reverse direction at limits (continuous joints wrap around)
zeros.{joint_name} (double)
Set the zero/center position for a specific joint
Example:
zeros.joint1:=0.5sets joint1’s zero position to 0.5 radians
dependent_joints.{joint_name}.parent (string)
Specifies the parent joint for a dependent/mimic joint relationship
Required for each dependent joint
dependent_joints.{joint_name}.factor (double, default:
1.0)Multiplier for the dependent joint position relative to parent
dependent_joints.{joint_name}.offset (double, default:
0.0)Offset added to the dependent joint position
Example Usage
Basic usage with URDF file
ros2 run joint_state_publisher joint_state_publisher /path/to/robot.urdf
Using robot_description topic
ros2 run joint_state_publisher joint_state_publisher
With custom parameters
ros2 run joint_state_publisher joint_state_publisher \
--ros-args \
-p rate:=50 \
-p publish_default_velocities:=true \
-p use_mimic_tags:=false
With animation (auto-moving joints)
ros2 run joint_state_publisher joint_state_publisher \
--ros-args \
-p delta:=0.01
With custom zero positions
ros2 run joint_state_publisher joint_state_publisher \
--ros-args \
-p zeros.shoulder_pan_joint:=1.57 \
-p zeros.elbow_joint:=0.785
Subscribing to external joint sources
ros2 run joint_state_publisher joint_state_publisher \
--ros-args \
-p source_list:=['arm_controller/joint_states','gripper_controller/joint_states']
Launch file example
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
Node(
package='joint_state_publisher',
executable='joint_state_publisher',
name='joint_state_publisher',
parameters=[{
'rate': 50,
'publish_default_positions': True,
'use_mimic_tags': True,
'source_list': ['controller/joint_states']
}]
)
])