Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Robot spawns upside down

When loading a robot model in gazebo from ROS and URDF the robot always spawns upside down and I am unable to figure out why. The URDF is included below:

wheel.urdf: <robot xmlns:xacro="http://ros.org/wiki/xacro" name="juno_wheel">

    <xacro:macro name="juno_wheel" params="wheel_prefix wheel_parent *joint_pose">
        <link name="${wheel_prefix}_wheel_link">
            <inertial>
                <mass value="${wheel_mass}" />
                <origin xyz="0 0 0" />
                <inertia  ixx="0.000175" ixy="0.000000" ixz="0.000110" iyy="0.000000" iyz="0.000000" izz="0.000110" />
            </inertial>
            <visual>
                <origin xyz="0 0 0" rpy="0 0 0" />
                <geometry>
                    <mesh filename="package://juno_description/meshes/wheel/wheel.dae"/>
                </geometry>
            </visual>
            <collision>
                <origin xyz="0 0 0" rpy="0 0 0" />
                <geometry>
                    <cylinder length="${wheel_radius}" radius="${wheel_width}" />
                </geometry>
            </collision>
        </link>

        <gazebo reference="${wheel_prefix}_wheel_link">
            <mu1 value="1.0"/>
            <mu2 value="1.0"/>
            <kp value="10000000.0" />
            <kd value="1.0" />
            <fdir1 value="1 0 0"/>
        </gazebo>

        <joint name="${wheel_prefix}_wheel" type="continuous">
            <parent link="${wheel_parent}"/>
            <child link="${wheel_prefix}_wheel_link"/>
            <xacro:insert_block name="joint_pose"/>
            <axis xyz="1 0 0" rpy="0 0 0" />
        </joint>

        <transmission name="${wheel_prefix}_wheel_trans" type="SimpleTransmission">
            <type>transmission_interface/SimpleTransmission</type>
            <actuator name="${wheel_prefix}_wheel_motor">
                <mechanicalReduction>1</mechanicalReduction>
            </actuator>
            <joint name="${wheel_prefix}_wheel">
                <hardwareInterface>VelocityJointInterface</hardwareInterface>
            </joint>
        </transmission>

    </xacro:macro>
</robot>

base.urdf <robot name="juno_rover" xmlns:xacro="http://ros.org/wiki/xacro">

    <xacro:include filename="$(find juno_description)/urdf/wheel.urdf.xacro" />

    <property name="M_PI" value="3.1415926535897931" />

    <!-- Simplified Collision Geometry for the Base -->
    <property name="base_size_x" value="1.420"/>
    <property name="base_size_y" value="1.620"/>
    <property name="base_size_z" value="0.420"/>
    <property name="base_mass" value="160.000"/>
    <property name="base_height_offset" value="0.200"/>

    <!-- Simplified Collusion Geometry for the Wheels -->
    <property name="wheel_radius" value="0.31"/>
    <property name="wheel_width" value="0.26"/>
    <property name="wheel_mass" value="9.000"/>

    <!-- Offset for the wheel motors from the root rover frame -->
    <property name="caster_offset_x" value="0.5"/>
    <property name="caster_offset_y" value="0.2"/>
    <property name="caster_offset_z" value="0.00"/>

    <!-- wheel offsets -->
    <property name="wheel_offset_x" value="0.0"/>
    <property name="wheel_offset_y" value="0.0"/>
    <property name="wheel_offset_z" value="0.0"/>

    <xacro:macro name="juno_base" params="name">

    <link name="base_footprint">
        <visual>
            <origin xyz="0 0 0" rpy="0 0 0"/>
            <geometry>
                <box size="0.001 0.001 0.001"/>
            </geometry>
        </visual>
        <collision>
            <origin xyz="0 0 0" rpy="0 0 0"/>
            <geometry>
                <box size="0.001 0.001 0.001"/>
            </geometry>
        </collision>
    </link>

    <link name="base_link">
        <visual>
            <origin xyz="0 0 0" rpy="0 0 0"/>
            <geometry>
                <mesh filename="package://juno_description/meshes/base/base.dae"/>
            </geometry>
        </visual>
    </link>

    <link name="inertial_link">
        <inertial>
            <mass value="${base_mass}"/>
            <origin xyz="0 0 0.6"/>
            <inertia ixx="0.018276" ixy="0.000041" ixz="0.000065" iyy="0.001884" iyz="-0.000331" izz="0.035991"/>
        </inertial>
    </link>

    <joint name="inertial_joint" type="fixed">
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <parent link="base_link"/>
        <child  link="inertial_link"/>
    </joint>

    <joint name="${name}_footprint_joint" type="fixed">
        <origin xyz="0 0 -0.6" rpy="0 0 0"/>
        <parent link="base_link"/>
        <child  link="base_footprint"/>
    </joint>

    <!-- JUNO wheel macros -->
    <xacro:juno_wheel wheel_prefix="front_left" wheel_parent="base_link">
        <origin xyz="-0.7 0.55 0" rpy="0 0 0" />
    </xacro:juno_wheel>

    <xacro:juno_wheel wheel_prefix="front_right" wheel_parent="base_link">
        <origin xyz="0.7 0.55 0" rpy="0 0 0" />
    </xacro:juno_wheel>

    <xacro:juno_wheel wheel_prefix="rear_left" wheel_parent="base_link">
        <origin xyz="-0.7 -0.45 0" rpy="0 0 0" />
    </xacro:juno_wheel>

    <xacro:juno_wheel wheel_prefix="rear_right" wheel_parent="base_link">
        <origin xyz="0.7 -0.45 0" rpy="0 0 0" />
    </xacro:juno_wheel>

    </xacro:macro>
</robot>