Robotics StackExchange | Archived questions

How to load urdf.xacro in ros-noetic?

I trid two ways(way1 and way2) to load urdf ,it's all ok in ros-kinetic(ubuntn16.04);but the ways all failed in ros-noetic(ubuntu20.04).What can I do to solve this problem?

when test in ros-noetic,I get:

ylh@ylh:~$ roslaunch test test.launch 

... logging to /home/ylh/.ros/log/151c452e-a09c-11ea-9172-8f7723f9d611/roslaunch-ylh-25551.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

No such file or directory: /home/ylh/catkin_ws/src/arobot_ws/test/urdf/test.urdf.xacro [Errno 2] No such file or directory: '/home/ylh/catkin_ws/src/arobot_ws/test/urdf/test.urdf.xacro'
RLException: Invalid <param> tag: Cannot load command parameter [robot_description]: command [['/opt/ros/noetic/lib/xacro/xacro', '/home/ylh/catkin_ws/src/arobot_ws/test/urdf/test.urdf.xacro']] returned with code [2]. 

Param xml is 

     (way1)  param name="robot_description" command="$(find xacro)/xacro '$(find test)/urdf/test.urdf.xacro'"

The traceback for the exception was written to the log file


ylh@ylh:~$ roslaunch test test.launch 

... logging to /home/ylh/.ros/log/3203c572-a09c-11ea-9172-8f7723f9d611/roslaunch-ylh-25605.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

cat: /home/ylh/catkin_ws/src/arobot_ws/test/urdf/test.urdf.xacro: No such file or directory
RLException: Invalid <param> tag: Cannot load command parameter [robot_description]: command [['cat', '/home/ylh/catkin_ws/src/arobot_ws/test/urdf/test.urdf.xacro']] returned with code [1]. 

Param xml is 

      (way2)  param name="robot_description" command="cat '$(find test)/urdf/test.urdf.xacro'"

The traceback for the exception was written to the log file

ylh@ylh:~$ 

test.urdf.xacro:

<robot xmlns:xacro = "http://www.ros.org/wiki/xacro"  name="test">

 <link name="base_link">
    <visual>
       <geometry>
          <box size="1 1 0.1"/>
       </geometry>
   </visual>
   <collision>
        <geometry>
          <box size="1 1 0.1"/>
        </geometry>
   </collision>
    <inertial>
       <mass value="40" />
       <origin xyz="0 0 0" rpy="0 0 0"/>
       <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1" />
     </inertial>
 </link>

 <joint name="wheel_to_base_link" type="continuous">
     <parent link="base_link"/>
     <child link="board"/>
     <origin xyz="0 0 -0.4" rpy="0 0 0"/>
     <axis xyz="0 1 0" rpy="0 0 0" />
 </joint>
 <link name="board">
    <visual>
       <geometry>
          <cylinder length="0.1" radius="0.2"/>
       </geometry>
     <origin rpy="1.5707 0 0" xyz="0 0 0"/>
   </visual>
   <collision>
        <geometry>
          <cylinder length="0.1" radius="0.2"/>
        </geometry>
    <origin rpy="1.5707 0 0" xyz="0 0 0"/>
   </collision>
    <inertial>
       <mass value="1" />
       <origin xyz="0 0 0" rpy="0 0 0"/>
       <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1" />
     </inertial>
 </link> 

< /robot >

What can I do to solve this problem? I searched for a long time, but I couldn't find the right way.

Asked by ylh on 2020-05-27 23:57:15 UTC

Comments

Answers

Without seeing the content of test.launch I cannot be entirely certain. That said, I can say and guess the following:

  • The error RLException: Invalid <param> tag: Cannot load command parameter [robot_description] is happening because xacro failed to return an output, as you guessed.
  • xacro probably couldn't find the .xacro file, as the error No such file or directory: /home/ylh/catkin_ws/src/arobot_ws/test/urdf/test.urdf.xacro [Errno 2] No such file or directory: indicates.

I'd guess test.urdf.xacro isn't present in the path xacro can look up. I see $(find test) in the launch file. On command line (e.g. on bash), make sure rospack find test returns the absolute path that test should reside in.

Asked by 130s on 2020-11-25 02:54:43 UTC

Comments

Thank you for your reply, I will have a try another day.

Asked by ylh on 2020-11-26 22:21:02 UTC

I found this example in the Turtlebot3 repository, it works in my local installation of ROS Noetic

<param name="robot_description" command="$(find xacro)/xacro --inorder $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />

You could adjust to your launch file.

Basically, it is getting rid of the old command="cat xacro_file.xacro" and using the xacro processor

Hope it helps you

Regards

Asked by marcoarruda on 2021-09-21 16:52:55 UTC

Comments