Ask Your Question
0

Xacro include breaks including xacro file

asked 2018-09-29 12:06:17 -0600

Julian98 gravatar image

updated 2018-09-29 13:54:04 -0600

I have a xacro file named "diff_wheeled_robot.urdf.xacro" to describe a robot and it works just fine. It is including other xacro files and their xacro macros. Now I want to include another xacro file describing a laser. The following code is the laser file ("rplidar.urdf.xacro"):

<?xml version="1.0"?>
<robot name="rplidar" xmlns:xacro="http://www.ros.org/wiki/xacro">

    <xacro:include filename="$(find testbot_description)/urdf/inertias.urdf.xacro" /> 
    <xacro:include filename="$(find testbot_description)/urdf/materials.urdf.xacro" /> 

    <xacro:property name="rplidar_mass" value="0.2" /> 
    <xacro:property name="rplidar_radius" value="0.0757" /> 
    <xacro:property name="rplidar_height" value="0.04080" />

    <xacro:macro name="rplidar" params="parent translateX translateY">
        <link name="rplidar_link">
            <inertial>
                <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
                <mass value="${rplidar_mass}"/>
                <cylinder_inertia m="${rplidar_mass}" r="${rplidar_radius}" h="${rplidar_height}"/>
            </inertial>
            <visual>
                <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
                <geometry>
                    <cylinder length="${rplidar_height}" radius="${rplidar_radius}" />
                </geometry>
                <material name="Blue" />
            </visual>
            <collision>
                <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
                <geometry>
                    <cylinder length="${rplidar_height}" radius="${rplidar_radius}" />
                </geometry>
            </collision>
        </link>

        <joint name="rplidar_joint" type="fixed">
            <parent link="${parent}"/>
            <child link="rplidar_link"/>
        </joint>

        <gazebo reference="rplidar_link">
            <material>Gazebo/Blue</material>
            <turnGravityOff>false</turnGravityOff>
            <sensor type="ray" name="rplidar_sensor">
                <pose>${rplidar_radius/2} 0 0 0 0 0</pose>
                <visualize>true</visualize>
                <update_rate>10</update_rate>
                <ray>
                    <scan>
                        <horizontal>
                            <samples>8000</samples>
                            <min_angle>0</min_angle>
                            <max_angle>3.14159265359</max_angle>
                        </horizontal>
                    </scan>
                    <range>
                        <min>0.15</min>
                        <max>8.0</max>
                        <resolution>0.001</resolution>
                    </range>
                </ray>
                <plugin name="gazebo_ros_head_rplidar_controller" filename="libgazebo_ros_laser.so">
                    <topicName>/scan</topicName>
                    <frameName>rplidar_link</frameName>
                </plugin>
            </sensor>
        </gazebo>
    </xacro:macro>
</robot>

But when I try to include it via

<xacro:include filename="${find testbot_description)/urdf/rplidar.urdf.xacro" />

and I run

rosrun xacro xacro --inorder diff_wheeled_robot.urdf.xacro

I get an error:

No such file or directory:  None None
when processing file: diff_wheeled_robot.urdf.xacro

What am I doing wrong?

ROS Kinetic

Ubuntu 16.04

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-09-29 16:43:17 -0600

gvdhoorn gravatar image
<xacro:include filename="${find testbot_description)/urdf/rplidar.urdf.xacro" />

It should be $(find ..), not ${find ..).

edit flag offensive delete link more

Comments

Thanks, I'm so stupid. Or it was too late ;)

Julian98 gravatar imageJulian98 ( 2018-09-30 02:24:10 -0600 )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

Stats

Asked: 2018-09-29 12:06:17 -0600

Seen: 309 times

Last updated: Sep 29 '18