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"/>

    <link name="base_link">

    <link name="body_link">
            <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"/>

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

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

            <material name="grey"/>


    <gazebo reference="body_link">

    <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"/>


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.


@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 , 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"?>
    <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" />

Great, thank you sharing the solution.

1 Like

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