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

I have problem when rosrun xacro xacro demo05.urdf.xacro>demo05.urdf

asked 2021-11-02 10:43:57 -0500

yikai gravatar image

updated 2021-11-04 10:44:18 -0500

Mike Scheutzow gravatar image

xacro:macro: unknown attribute(s): param when processing file: demo05_car_base.urdf.xacro Invalid parameter "wheel_name" when instantiating macro: wheel_func (demo05_car_base.urdf.xacro) in file: demo05_car_base.urdf.xacro

I am running this xacro

<robot name="car" xmlns:xacro="http://www.ros.org/wiki/xacro">
    <xacro:property name="footprint_radius" value="0.001"/>
    <link name="base_footprint">
         <visual>
             <geometry>
                  <sphere radius="${footprint_radius}"/>
             </geometry>

         </visual>

    </link>

    <xacro:property name="base_radius" value="0.1"/>
    <xacro:property name="base_length" value="0.08"/>
    <xacro:property name="lidi" value="0.015"/>
    <xacro:property name="base_joint_z" value="${base_length/2+lidi}"/>
    <link name="base_link">
        <visual>
            <geometry>
                <cylinder radius="0.1" length="0.08"/>
            </geometry>


               <origin xyz="0 0 0" rpy="0 0 0"/>


            <material name="color">

               <color rgba="1 0.2 0.2 1"/>

            </material>

        </visual>
    </link>
    <joint name="link2footprint" type="fixed" >
        <parent link="base_footprint"/>
        <child link="base_link"/>
        <origin xyz="0 0 0.055" rpy="0 0 0"/>
    </joint>

    <xacro:property name="wheel_radius" value="0.035"/>
    <xacro:property name="wheel_length" value="0.015"/>
    <xacro:property name="PI" value="3.1415927"/>
    <xacro:property name="wheel_joint_z" value="${-base_length/2-lidi+wheel_radius}"/>

    <xacro:macro name="wheel_func" param="wheel_name flag">

        <link name="${wheel_name}_wheel">
            <visual>
                <geometry>
                    <cylinder radius="${wheel_radius}" length="${wheel_length}"/>
                </geometry>


                <origin xyz="0 0 0" rpy="${PI/2} 0 0"/>


                <material name="wheel_color">

                <color rgba="0 0 0 1"/>

                </material>

            </visual>
        </link>
        <joint name="${wheel_name}2link" type="continuous" >
            <parent link="base_link"/>
            <child link="${wheel_name}_wheel"/>
            <origin xyz="0 ${0.1*flag} ${base_joint_z}" rpy="0 0 0"/>
            <axis xyz="0 1 0"/>
        </joint>

    </xacro:macro>

    <xacro:wheel_func wheel_name="left" flag="1"/>
    <xacro:wheel_func wheel_name="right" flag="-1"/>

</robot>
edit retag flag offensive close merge delete

Comments

Hi @yikai what distribution of ROS are you running? Also can you explain what have you tried so far or show the file that is giving the error

osilva gravatar image osilva  ( 2021-11-03 05:46:10 -0500 )edit

Hi @yikai pls delete the answer and add the code to your question. Otherwise it will looked like it’s already answered

osilva gravatar image osilva  ( 2021-11-03 10:15:26 -0500 )edit

@yikai You can edit your description using the "edit" button at the end of the text.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-11-03 10:18:42 -0500 )edit

Thank you. The problem is solved.

yikai gravatar image yikai  ( 2021-11-03 11:28:08 -0500 )edit

I have moved your xacro file content into your description.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-11-04 10:42:16 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2021-11-03 10:17:23 -0500

Mike Scheutzow gravatar image

You have a typo. In the first line of your macro definition for wheel_func, the attribute should be params, not param.

Also, the first lines of your file have invalid syntax, but I'll assume that is just a copy/paste artifact.

edit flag offensive delete link more

Comments

Thank you Yes,it's copy/paste artifact. I just begun learning ROS.

yikai gravatar image yikai  ( 2021-11-03 11:25:15 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2021-11-02 10:43:57 -0500

Seen: 81 times

Last updated: Nov 04 '21