ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Caught exception in launch (see debug for traceback): Unable to parse the value of parameter robot_description as yaml

asked 2023-07-11 10:19:18 -0500

Djinn gravatar image

updated 2023-07-11 10:21:51 -0500

Hello,

I am currently trying to run my TurtleBot2 on ROS2 Humble (using Ubuntu 22.04), but have troubles to import my modified URDF files. The bringup launch file worked for the preset URDF files but after importing the URDF files of my TurtleBot2 (it has a construction frame with a Asus Xtion Pro live, a Hokuyo URG-04-LX-UG01 , aswell as 2 Dynamixel AX12A mounted on ) it keeps showing me this error whenever I launch the turtlebot_bringup.launch.py file:

`[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): Unable to parse the value of parameter robot_description as yaml. If the parameter is meant to be a string, try wrapping it in launch_ros.parameter_descriptions.ParameterValue(value, value_type=str)`

turtlebot_bringup.launch.py:

    import os
from struct import pack

from setuptools import Command

from ament_index_python import get_package_share_directory, get_package_share_path

import launch
import launch.launch_description_sources
import launch.substitutions
import launch_ros
import launch_ros.substitutions

def generate_launch_description():
    kobuki_package = launch_ros.substitutions.FindPackageShare(package='kobuki_node').find('kobuki_node')
    urg_package = launch_ros.substitutions.FindPackageShare(package='urg_node2').find('urg_node2')
    turtlebot2_bringup_package = launch_ros.substitutions.FindPackageShare(package='turtlebot2_bringup').find('turtlebot2_bringup')
    turtlebot2_description_package = launch_ros.substitutions.FindPackageShare(package='turtlebot2_description').find('turtlebot2_description')

    ekf_config_params = os.path.join(turtlebot2_bringup_package,'config/ekf_config.yaml')

    kobuki_node_launch = launch.actions.IncludeLaunchDescription(
        launch.launch_description_sources.PythonLaunchDescriptionSource(
            os.path.join(
                kobuki_package,
                'launch/kobuki_node-launch.py')
        )
    )

    ekf_node = launch_ros.actions.Node(
            package='robot_localization',
            executable='ekf_node',
            output='screen',
            parameters=[ekf_config_params],
            remappings=[("odometry/filtered", "odom")]
        )

    urg_node = launch.actions.IncludeLaunchDescription(
        launch.launch_description_sources.PythonLaunchDescriptionSource(
            os.path.join(
                urg_package,
                'launch/urg_node2.launch.py'
            )
        ),
        launch_arguments= {'sensor_interface':'serial'}.items()
    )

    robot_state_publisher_node = launch_ros.actions.Node(
        package='robot_state_publisher',
        executable='robot_state_publisher',
        parameters=[{'robot_description': launch.substitutions.Command(['xacro ',os.path.join(turtlebot2_description_package,'robots/kobuki_conveyor.urdf.xacro')])}]
    )

    joint_state_publisher_node = launch_ros.actions.Node(
        package='joint_state_publisher',
        executable='joint_state_publisher',
        name='joint_state_publisher'
    )

    rviz_node = launch_ros.actions.Node(
        package='rviz2',
        executable='rviz2',
        name='rviz2',
        output='screen',
        arguments=['-d',os.path.join(turtlebot2_bringup_package,'rviz/bringup.rviz')],
        condition=launch.conditions.IfCondition(launch.substitutions.LaunchConfiguration("open_rviz")) 
    )


    return launch.LaunchDescription([
        launch.actions.DeclareLaunchArgument(
            'open_rviz',
            default_value='false',
            description='open rviz'),
        kobuki_node_launch,
        urg_node,
        robot_state_publisher_node,
        joint_state_publisher_node,
        rviz_node,
        #ekf_node
    ])

kobuki_conveyor.urdf.xacro:

<?xml version="1.0"?>
<!--
    - Base      : kobuki
    - Stacks    : conveyor
    - 3d Sensor : asus xtion pro live 
            : hokuyo
-->    
<robot name="turtlebot" xmlns:xacro="http://ros.org/wiki/xacro">

  <!-- <xacro:include filename="$(find turtlebot2_description)/urdf/turtlebot_library.urdf.xacro" /> -->
  <xacro:include filename="$(find turtlebot2_description)/urdf/turtlebot_common_library.urdf.xacro" />
  <!-- <xacro:include filename="$(find turtlebot2_description)/urdf/turtlebot_properties.urdf.xacro" /> -->
    <xacro:include filename="$(find kobuki_description)/urdf/kobuki.urdf.xacro" />
  <xacro:include filename="$(find turtlebot2_description)/urdf/stacks/conveyor.urdf.xacro" />



  <xacro:kobuki/>
  <xacro:stack_conveyor         parent="base_link"/>
  <!--
  <xacro:sensor_asus_xtion_pro1  parent="base_link"/>
  <xacro:sensor_asus_xtion_pro2  parent="base_link"/>
  <xacro:sensor_hokuyo parent="base_link"/>
  -->

</robot>

conveyor.urdf.xacro:

 <?xml version="1.0"?>
    <!--
      Hexagon stacks
     -->
    <robot name="stack_conveyor" xmlns:xacro="http://ros.org/wiki/xacro">
      <xacro:include filename="$(find turtlebot2_description)/urdf/common_properties.urdf.xacro"/>
      <!--<xacro:include filename="$(find turtlebot2_description)/urdf/turtlebot_properties.urdf.xacro"/> -->
      <!-- Xacro properties -->
      <xacro:property name="M_SCALE" value="0.001 ...
(more)
edit retag flag offensive close merge delete

Comments

@djchopp I've seen that you've answered a similiar question, I hope you don't mind me tagging you. Could you maybe take a look and tell me if you see any mistakes?

Djinn gravatar image Djinn  ( 2023-07-17 10:44:08 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-07-17 12:28:12 -0500

djchopp gravatar image

updated 2023-07-17 12:29:06 -0500

Try this:

Add an import for launch_ros.descriptions to your launch file:

import launch_ros.descriptions

Then wrap your xacro command with a parameter value:

parameters=[{'robot_description': launch_ros.descriptions.ParameterValue( launch.substitutions.Command(['xacro ',os.path.join(turtlebot2_description_package,'robots/kobuki_conveyor.urdf.xacro')]), value_type=str)  }]

Not using the ParameterValue to wrap the xacro output is unsafe unless you have a well curated xacro/urdf. If ANY text in the xacro output can be interpreted as yaml, the roslaunch system will try to interpret the ENTIRE text as yaml instead of passing on the string. The biggest cause of this false interpretation is commenting out xacro calls since the xacro:property or similar looks a lot like a yaml key:value pair. Comments are not removed by xacro so they are included in the output.

In this case the Error text is trying to guide you on how to fix this exact issue.

Hope this helps!

edit flag offensive delete link more

Comments

It worked, thank you very much!

Djinn gravatar image Djinn  ( 2023-07-18 09:37:16 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2023-07-11 10:19:18 -0500

Seen: 2,240 times

Last updated: Jul 17 '23