joint_state_publisher_gui

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_gui node provides a graphical user interface for manually controlling robot joint positions. It extends the joint_state_publisher node with an interactive Qt-based GUI featuring sliders for each movable joint. Users can manually adjust joint positions, randomize all joints, or center them to their zero positions. This tool is particularly useful for testing robot configurations, visualizing joint ranges, and manual joint control during development.

Publishers

  • joint_states (sensor_msgs/msg/JointState)

    • Publishes the current state of all robot joints based on GUI slider positions

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_list parameter

    • Updates GUI sliders from external joint state 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 based on slider positions

  • 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

    • Updates GUI sliders when messages are received

  • 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

  • delta (double, default: 0.0)

    • Not typically used with GUI (would cause automatic joint movement)

  • zeros.{joint_name} (double)

    • Set the zero/center position for a specific joint

    • Used when “Center” button is clicked

  • dependent_joints.{joint_name}.parent (string)

    • Specifies the parent joint for a dependent/mimic joint relationship

  • 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_gui joint_state_publisher_gui /path/to/robot.urdf

Using robot_description topic

ros2 run joint_state_publisher_gui joint_state_publisher_gui

With custom parameters

ros2 run joint_state_publisher_gui joint_state_publisher_gui \
  --ros-args \
  -p rate:=50 \
  -p use_mimic_tags:=false

With custom zero positions

ros2 run joint_state_publisher_gui joint_state_publisher_gui \
  --ros-args \
  -p zeros.shoulder_pan_joint:=1.57 \
  -p zeros.elbow_joint:=0.785

With external joint source synchronization

ros2 run joint_state_publisher_gui joint_state_publisher_gui \
  --ros-args \
  -p source_list:=['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_gui',
            executable='joint_state_publisher_gui',
            name='joint_state_publisher_gui',
            parameters=[{
                'rate': 50,
                'use_mimic_tags': True,
                'zeros': {
                    'joint1': 0.0,
                    'joint2': 1.57
                }
            }]
        )
    ])

Usage with RViz for visualization

# Terminal 1: Start the GUI
ros2 run joint_state_publisher_gui joint_state_publisher_gui /path/to/robot.urdf

# Terminal 2: Publish robot description
ros2 topic pub -1 /robot_description std_msgs/msg/String \
  "data: '$(cat /path/to/robot.urdf)'"

# Terminal 3: Start robot_state_publisher
ros2 run robot_state_publisher robot_state_publisher /path/to/robot.urdf

# Terminal 4: Start RViz
ros2 run rviz2 rviz2

GUI Features

  • Sliders: One slider per movable joint with current value display

  • Randomize Button: Sets all joints to random positions within their limits

  • Center Button: Returns all joints to their zero/center positions

  • Scrollable Layout: Automatically handles robots with many joints

  • Real-time Updates: Sliders update when receiving external joint states

  • Dynamic Reconfiguration: GUI rebuilds when robot description changes