ros2 / rviz

ROS 3D Robot Visualizer
BSD 3-Clause Clear License
293 stars 211 forks source link

Parameters have invalid type: is of type {double}, setting it to {string} is not allowed #808

Closed NebuDa closed 2 years ago

NebuDa commented 2 years ago

I have built ROS2 Galactic, Moveit2 and Main Branch of UR Driver https://github.com/UniversalRobots/Universal_Robots_ROS2_Driver on Ubuntu. By starting like the tutorial from driver with MoveIt I got the following error on different parameters:

[rviz2-3] [INFO] [1639652465.916282193] [moveit_rdf_loader.rdf_loader]: Loaded robot model in 0.00852234 seconds
[rviz2-3] [INFO] [1639652465.917162913] [moveit_robot_model.robot_model]: Loading robot model 'ur'...
[rviz2-3] [ERROR] [1639652465.936346953] [moveit_background_processing.background_processing]: Exception caught while processing action 'loadRobotModel': parameter 'robot_description_planning.joint_limits.shoulder_pan_joint.max_position' has invalid type: Wrong parameter type, parameter {robot_description_planning.joint_limits.shoulder_pan_joint.max_position} is of type {double}, setting it to {string} is not allowed.

It comes from a yaml File like this:

joint_limits:
  shoulder_pan_joint:
    # acceleration limits are not publicly available
    has_acceleration_limits: false
    has_effort_limits: true
    has_position_limits: true
    has_velocity_limits: true
    max_effort: 330.0
    max_position: !degrees  360.0
    max_velocity: !degrees  120.0
    min_position: !degrees -360.0

  shoulder_lift_joint:
    # acceleration limits are not publicly available
    has_acceleration_limits: false
    has_effort_limits: true
    has_position_limits: true
    has_velocity_limits: true
    max_effort: 330.0
    max_position: !degrees  360.0
    max_velocity: !degrees  120.0
    min_position: !degrees -360.0
  elbow_joint:
[....]

And loaded in a Launch File:

[....]
description_package = LaunchConfiguration("description_package")
[....]
joint_limit_params = PathJoinSubstitution(
   [FindPackageShare(description_package), "config", ur_type, "joint_limits.yaml"])
[....]
robot_description_content = Command(
        [ [....] " ",
            "joint_limit_params:=",
            joint_limit_params,
            " ",[....]   ])
robot_description = {"robot_description": robot_description_content}
[....]
# rviz with moveit configuration
rviz_config_file = PathJoinSubstitution(
    [FindPackageShare(moveit_config_package), "rviz", "view_robot2.rviz"]
)
rviz_node = Node(
    package="rviz2",
    condition=IfCondition(launch_rviz),
    executable="rviz2",
    name="rviz2_moveit",
    output="log",
    arguments=["-d", rviz_config_file],
    parameters=[
        robot_description,
        robot_description_semantic,
        ompl_planning_pipeline_config,
        robot_description_kinematics,
        robot_description_planning,
        octomap_config,
        octomap_updater_config,
    ],
)[....]

Is there anything wrong with the Launch File, Ubuntu or ROS2 configuration, that it tries to load it as string?

Perhaps it could have something to do with it: I am not allowed now to publish a double with to_string to the RCLCPP Logger. It was absolutely working under Foxy on the same Machine. RCLCPP_INFO(LOGGER, std::to_string(q.x()));

This Issue is also posted in the UR Driver Repository here https://github.com/UniversalRobots/Universal_Robots_ROS2_Driver/issues/265 but I thought it could be a problem in RViz.

clalancette commented 2 years ago

The problem is in your parameters, here:

max_position: !degrees  360.0

That is definitely a string, and it looks like MoveIt is declaring that as a double. With Galactic and later, that won't work; we automatically check the types now. My guess is that MoveIt changed between Foxy and Galactic, and something else in your configuration has to change.

Given that this is almost certainly not a problem in rviz2, I'm going to close this. I'll suggest asking a question on https://answers.ros.org about this, tagged with MoveIt, or opening an issue on the MoveIt repository at https://github.com/ros-planning/MoveIt2