Skip to content

moveit can't fetch the joint_states #286

@Enzo-let

Description

@Enzo-let

hello, i wanna get the joint_states by move_group_interface.getCurrentPose().pose; ,but it always show the erro can't fetch the current state joint_states. I know the point is the name of joint_states is "/lbr/joint_states", so i remap the "/joint_states" to "/lbr/joint_states", but it still didn't work and seems like the remapping didn't work.

[INFO] [launch]: All log files can be found below /home/let/.ros/log/2025-07-02-18-03-42-726823-let-virtual-machine-11654
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [hello_moveit-1]: process started with pid [11655]
[hello_moveit-1] [INFO] [1751450623.032841011] [hello_moveit]: Initializing MoveGroupInterface with namespace: lbr
[hello_moveit-1] [INFO] [1751450623.032963000] [hello_moveit]: Configured joint state topic: /joint_states
[hello_moveit-1] [INFO] [1751450623.039425587] [moveit_rdf_loader.rdf_loader]: Loaded robot model in 0.00618439 seconds
[hello_moveit-1] [INFO] [1751450623.039500426] [moveit_robot_model.robot_model]: Loading robot model 'iiwa7'...
[hello_moveit-1] [INFO] [1751450623.039516601] [moveit_robot_model.robot_model]: No root/virtual joint specified in SRDF. Assuming fixed joint
[hello_moveit-1] [INFO] [1751450623.088055766] [move_group_interface]: Ready to take commands for planning group arm.
[hello_moveit-1] [INFO] [1751450623.088611415] [moveit_ros.current_state_monitor]: Listening to joint states on topic 'joint_states'
[hello_moveit-1] [INFO] [1751450627.147455738] [moveit_ros.current_state_monitor]: Didn't receive robot state (joint angles) with recent timestamp within 1.000000 seconds. Requested time 1751450626.147250, but latest received state has time 0.000000.
[hello_moveit-1] Check clock synchronization if your are running ROS across multiple machines!
[hello_moveit-1] [ERROR] [1751450627.147554250] [move_group_interface]: Failed to fetch current robot state
[hello_moveit-1] [INFO] [1751450627.147578944] [hello_moveit]: Current End Effector Pose:
[hello_moveit-1] Position -> x: 0.000, y: 0.000, z: 0.000
[hello_moveit-1] Orientation -> x: 0.000, y: 0.000, z: 0.000, w: 1.000
[INFO] [hello_moveit-1]: process has finished cleanly [pid 11655]


i have no idea, so can you give me some suggestions. And i paste the change below
hello_moveit,launch.py

from typing import List
from launch import LaunchContext, LaunchDescription, LaunchDescriptionEntity
from launch.actions import OpaqueFunction
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
from launch_ros.actions import Node
from lbr_bringup.description import LBRDescriptionMixin
from lbr_bringup.moveit import LBRMoveGroupMixin


def hidden_setup(context: LaunchContext) -> List[LaunchDescriptionEntity]:
    ld = LaunchDescription()


    model = LaunchConfiguration("model").perform(context)
    mode = LaunchConfiguration("mode").perform(context)
    use_sim_time = False
    if mode == "gazebo":
        use_sim_time = True

    # generate moveit configs
    moveit_configs = LBRMoveGroupMixin.moveit_configs_builder(
        robot_name=model,
        package_name=f"{model}_moveit_config",
    )

    # launch demo node
    ld.add_action(
        Node(
            package="lbr_moveit_cpp",
            executable="hello_moveit",
            parameters=[
                moveit_configs.to_dict(),
                {"use_sim_time": use_sim_time},
                LBRDescriptionMixin.param_robot_name(),
            ],
            **remappings=[
            ("joint_states", "/lbr/joint_states"),
            
        ],**
        )
    )
    return ld.entities


def generate_launch_description() -> LaunchDescription:
    ld = LaunchDescription()

    ld.add_action(LBRDescriptionMixin.arg_model())
    ld.add_action(LBRDescriptionMixin.arg_mode())

    ld.add_action(OpaqueFunction(function=hidden_setup))

    return ld
     

move_group.launch.py

from typing import List
from launch import LaunchContext, LaunchDescription, LaunchDescriptionEntity
from launch.actions import OpaqueFunction
from launch.conditions import IfCondition
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
from lbr_bringup.description import LBRDescriptionMixin
from lbr_bringup.moveit import LBRMoveGroupMixin
from lbr_bringup.rviz import RVizMixin


def hidden_setup(context: LaunchContext) -> List[LaunchDescriptionEntity]:
    ld = LaunchDescription()

    ld.add_action(LBRDescriptionMixin.arg_robot_name())
    ld.add_action(LBRMoveGroupMixin.arg_allow_trajectory_execution())
    ld.add_action(LBRMoveGroupMixin.arg_capabilities())
    ld.add_action(LBRMoveGroupMixin.arg_disable_capabilities())
    ld.add_action(LBRMoveGroupMixin.arg_monitor_dynamics())
    ld.add_action(LBRMoveGroupMixin.args_publish_monitored_planning_scene())

    model = LaunchConfiguration("model").perform(context)
    moveit_configs_builder = LBRMoveGroupMixin.moveit_configs_builder(
        robot_name=model,
        package_name=f"{model}_moveit_config",
    )
    move_group_params = LBRMoveGroupMixin.params_move_group()

    mode = LaunchConfiguration("mode").perform(context)
    use_sim_time = False
    if mode == "gazebo":
        use_sim_time = True

    # MoveGroup
    robot_name = LaunchConfiguration("robot_name")
    ld.add_action(
        LBRMoveGroupMixin.node_move_group(
            parameters=[
                moveit_configs_builder.to_dict(),
                move_group_params,
                {"use_sim_time": use_sim_time},
                
            ],
            namespace=robot_name,
            **remappings=[
            ("joint_states", "/lbr/joint_states"),  
        ]**
           
    
            
        )
    )

    # RViz if desired
    rviz = RVizMixin.node_rviz(
        rviz_cfg_pkg=f"{model}_moveit_config",
        rviz_cfg="config/moveit.rviz",
        parameters=LBRMoveGroupMixin.params_rviz(
            moveit_configs=moveit_configs_builder.to_moveit_configs()
        )
        + [{"use_sim_time": use_sim_time}],
        remappings=[
            (
                "display_planned_path",
                PathJoinSubstitution([robot_name, "display_planned_path"]),
            ),
            ("joint_states", PathJoinSubstitution([robot_name, "joint_states"])),
            (
                "monitored_planning_scene",
                PathJoinSubstitution([robot_name, "monitored_planning_scene"]),
            ),
            ("planning_scene", PathJoinSubstitution([robot_name, "planning_scene"])),
            (
                "planning_scene_world",
                PathJoinSubstitution([robot_name, "planning_scene_world"]),
            ),
            (
                "robot_description",
                PathJoinSubstitution([robot_name, "robot_description"]),
            ),
            (
                "robot_description_semantic",
                PathJoinSubstitution([robot_name, "robot_description_semantic"]),
            ),
            (
                "recognized_object_array",
                PathJoinSubstitution([robot_name, "recognized_object_array"]),
            ),
        ],
        condition=IfCondition(LaunchConfiguration("rviz")),
    )

    ld.add_action(rviz)
    return ld.entities


def generate_launch_description() -> LaunchDescription:
    ld = LaunchDescription()

    ld.add_action(LBRDescriptionMixin.arg_mode())
    ld.add_action(LBRDescriptionMixin.arg_model())
    ld.add_action(RVizMixin.arg_rviz())

    ld.add_action(OpaqueFunction(function=hidden_setup))
    return ld

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions