Ask Your Question
0

Problem with xacro files

asked 2018-07-03 22:01:44 -0500

timmx gravatar image

updated 2018-07-03 22:05:55 -0500

I'm following this tutorial: https://www.generationrobots.com/blog...

and get this when trying to launch:

timmx@timmx-NV52L:~/catkin_ws/src/mybot_description/urdf$ roslaunch  mybot_gazebo mybot_world.launch 
... logging to /home/timmx/.ros/log/f8a88710-7f35-11e8-80fd-20689d9ebc85/roslaunch-timmx-NV52L-27035.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

xacro: Traditional processing is deprecated. Switch to --inorder processing!
To check for compatibility of your document, use option --check-order.
For more infos, see http://wiki.ros.org/xacro#Processing_Order
xacro:arg: missing attribute 'default'
when processing file: /home/timmx/catkin_ws/src/mybot_description/urdf/mybot.xacro
Invalid <param> tag: Cannot load command parameter [robot_description]: command [/opt/ros/kinetic/share/xacro/xacro.py '/home/timmx/catkin_ws/src/mybot_description/urdf/mybot.xacro'] returned with code [2]. 

Param xml is <param command="$(find xacro)/xacro.py '$(find mybot_description)/urdf/mybot.xacro'" name="robot_description"/>
The traceback for the exception was written to the log file

I have written the following files:

MYBOT.XACRO

<?xml version="1.0"?>
<robot name="mybot" xmlns:xacro="http://www.ros.org/wiki/xacro">
  <!-- First ROS-Gazebo robot -->

  <xacro:property name="PI" value="3.1415926535897931"/>
  <xacro:property name="chassisHeight" value="0.1"/>
  <xacro:property name="chassisLength" value="0.4"/>
  <xacro:property name="chassisWidth" value="0.2"/>
  <xacro:property name="chassisMass" value="50"/>

  <xacro:property name="casterRadius" value="0.05"/>
  <xacro:property name="casterMass" value="5"/>

  <xacro:property name="wheelWidth" value="0.05"/>
  <xacro:property name="wheelRadius" value="0.1"/>
  <xacro:property name="wheelPos" value="0.2"/>
  <xacro:property name="wheelMass" value="5"/>

  <xacro:property name="cameraSize" value="0.05"/>
  <xacro:property name="cameraMass" value="0.1"/>

  <xacro:arg name="gui" value="true"/>

  <xacro:include filename="$(find mybot_description)/urdf/mybot.gazebo" />
  <xacro:include filename="$(find mybot_description)/urdf/materials.xacro" />
  <xacro:include filename="$(find mybot_description)/urdf/macros.xacro" />

  <link name="footprint" />

  <joint name="base_joint" type="fixed">
    <parent link="footprint"/>
    <child link="chassis"/>
  </joint>

  <link name="chassis">
    <collision>
      <origin xyz="0 0 ${wheelRadius}" rpy="0 0 0" />
      <geometry>
        <box size="${chassisLength} ${chassisWidth} ${chassisHeight}" />
      </geometry>
    </collision>
    <visual>
      <origin xyz="0 0 ${wheelRadius}" rpy="0 0 0"/>
      <geometry>
        <box size="${chassisLength} ${chassisWidth} ${chassisHeight}" />
      </geometry>
      <material name="orange"/>
    </visual>
    <inertial>
      <origin xyz="0 0 ${wheelRadius}" rpy="0 0 0"/>
      <mass value="${chassisMass}"/>
      <box_inertia m="${chassisMass}" x="${chassisLength}" y="${chassisWidth}" z="${chassisHeight}"/>
    </inertial>
  </link>

</robot>

MACROS.XACRO

<?xml version="1.0"?>
<robot name="mybot_macros" xmlns:xacro="http://www.ros.org/wiki/xacro">
        <!-- Put here the robot description -->

  <xacro:macro name="cylinder_inertia" params="m r h">
    <inertia ixx="${m * (3 * r * r + h * h) / 12}" ixy="0" ixz="0"
      iyy="${m * (3 * r * r + h * h) / 12}" iyz="0"
      izz="${m * r * r / 2}"
    />
  </xacro:macro>

  <xacro:macro name="box_inertia" params="m x y z">
    <inertia ixx="${m * (y * y + z * z) / 12}" ixy="0" ixz="0"
      iyy="${m * (x * x + z * z) / 12}" iyz="0"
      izz="${m * (x * x + z * z) / 12}"
    />
  </xacro:macro>

  <xacro:macro name="sphere_inertia" params="m r">
    <inertia ixx="${2 * m * r * r / 5}" ixy="0 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-07-04 01:44:40 -0500

Reamees gravatar image

updated 2018-07-04 02:20:45 -0500

(edit)

Actually just delete the line:

<xacro:arg name="gui" value="true"/>

As far as I can tell it is a launch parameter for Gazebo. So it shouldn't be in your robot description at all.


(original answer)

In mybot.xacro change the line

<xacro:arg name="gui" value="true"/>

to

<xacro:arg name="gui" default="true"/>

It is somewhat explained in the ros wiki for xacros in point 6:

http://wiki.ros.org/xacro?distro=kinetic#Rospack_commands

edit flag offensive delete link more

Comments

Thank you :)

timmx gravatar imagetimmx ( 2018-07-04 13:21:32 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-07-03 22:01:44 -0500

Seen: 1,504 times

Last updated: Jul 04 '18