Spawned model not alligned to ground_plane in Gazebo (Not spawned at origin)

Below is the URDF file i am spawning into Gazebo.

<?xml version="1.0"?>
<robot name="mira">

    <material name="grey">
        <color rgba="0.75 0.75 0.75 1"/>
    </material>

    <link name="base_link">
    </link>


    <link name="body_link">
        <inertial>
            <origin xyz="0 0 0" rpy="0.0 0 0"/>
            <mass value="0.18" />
            <inertia ixx="0.0002835" ixy="0.0" ixz="0.0" iyy="0.0002835" iyz="0.0" izz="0.000324"/>
        </inertial>

        <collision>
            <origin xyz="0 0 0" rpy="0 0 0"/>
            <geometry>
                <cylinder radius="0.06" length="0.09"/>
            </geometry>
        </collision>

        <visual>
            <origin rpy="0.0 0 0" xyz="0 0 0"/>
            <geometry>
                <cylinder radius="0.06" length="0.09"/>
            </geometry>

            <material name="grey"/>

        </visual>
    </link>

    <gazebo reference="body_link">
        <kp>100000.0</kp>
        <kd>100000.0</kd>
        <mu1>10.0</mu1>
        <mu2>10.0</mu2>
        <material>Gazebo/GreyTransparent</material>
    </gazebo>

    <joint name="base_joint" type="fixed">
        <parent link="base_link"/>
        <child link="body_link"/>
        <origin xyz="0.0 0 0.0" rpy="0 0 0"/>
    </joint>


</robot>

When i spawn it, The model is not aligned to the ground frame. When i checked the gazebo properties for both the model and the ground plane, they are both xyz=0 0 0.
image

image.

@staff Then can you tell me why the model is not aligned with the ground plane even when the gazeb0 properties tab show that they share the same position values?

Hi @Joseph1001 ,

Could you share the launch file you are using to spawn the robot model?

Hi @marco.nc.arruda , it was a mistake on my part, its was mentioned in the launch file that the model should spawn at -0.2 0.2 0.2.Thanks for looking into it.

<?xml version="1.0" encoding="UTF-8"?>
<launch>
    <include file="$(find my_mira_description)/launch/spawn_urdf.launch">
        <arg name="x" value="-0.2" />
        <arg name="y" value="0.2" />
        <arg name="z" value="0.2" />
        <arg name="urdf_robot_file" value="$(find my_mira_description)/urdf/mira_simple_origins.urdf" />
        <arg name="robot_name" value="mira" />
    </include>
</launch>
2 Likes

Great, thank you sharing the solution.

1 Like

This topic was automatically closed after 21 hours. New replies are no longer allowed.