Discussion - Concept Design Gazebo (Making a Mobile Robot Pt 3)

Main question: How do I fix a link to the Gazebo world so it’s immobile?

Background:
I’ve gone through all the non-physical parts of Making a Mobile Robot before, with a lot of success.
I’m now at the point I want to buy parts for my own robot, so I’ve gone back and updated everything to a simple robot configuration that is interesting to me, and I’m having a bit of trouble with Gazebo.

My robot is a little flashlight holding bot, with an XY prismatic gantry and an AB revolute flashlight pointing head. It’s going to be mounted above my workbench and point a light at things I’m working on.

I want the base XY gantry to just be stuck floating in Gazebo about 1 m off the ground, and completely insensitive to inertial effects, like it’s been fastened to my workbench overhang.

Does anyone know how to do that? I haven’t found a good way to mark a URDF element as kinematic instead of dynamic for Gazebo.

My URDF is below, with placeholder inertial info for each link just to get it working in Gazebo:

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" >
    <xacro:include filename="inertial_macros.xacro"/>



    <!-- Materials -->
    
    <material name="white">
        <color rgba="1 1 1 1"/>
    </material>

    <material name="orange">
        <color rgba="1 0.3 0.1 1"/>
    </material>

    <material name="blue">
        <color rgba="0.2 0.2 1 1"/>
    </material>

    <material name="black">
        <color rgba="0 0 0 1"/>
    </material>



    <!-- Base Link -->

    <link name="base_link">

    </link>

    <!-- Chassis Link -->

    <joint name="chassis_joint" type="fixed">
        <parent link="base_link" />
        <child link="chassis"/>
        <origin xyz="0 0 1" />
    </joint>

    <link name="chassis">
        <visual>
            <!-- Rear X Rail -->
            <origin xyz="0 -0.25 0" />
            <geometry>
                <box size="1 0.05 0.05"/>
            </geometry>
            <material name="white"/>
        </visual>
        <visual>
            <!-- Front X Rail -->
            <origin xyz="0 0.25 0" />
            <geometry>
                <box size="1 0.05 0.05"/>
            </geometry>
            <material name="white"/>
        </visual>
        <visual>
            <!-- Left Y Support -->
            <origin xyz="-0.5 0 0" />
            <geometry>
                <box size="0.05 0.5 0.05"/>
            </geometry>
            <material name="white"/>
        </visual>
        <visual>
            <!-- Right Y Support -->
            <origin xyz="0.5 0 0" />
            <geometry>
                <box size="0.05 0.5 0.05"/>
            </geometry>
            <material name="white"/>
        </visual>
        <collision>
            <!-- Rear X Rail -->
            <origin xyz="0 -0.25 0" />
            <geometry>
                <box size="1 0.05 0.05"/>
            </geometry>
        </collision>
        <collision>
            <!-- Front X Rail -->
            <origin xyz="0 0.25 0" />
            <geometry>
                <box size="1 0.05 0.05"/>
            </geometry>
        </collision>
        <collision>
            <!-- Left Y Support -->
            <origin xyz="-0.5 0 0" />
            <geometry>
                <box size="0.05 0.5 0.05"/>
            </geometry>
        </collision>
        <collision>
            <!-- Right Y Support -->
            <origin xyz="0.5 0 0" />
            <geometry>
                <box size="0.05 0.5 0.05"/>
            </geometry>
        </collision>
        <xacro:inertial_box mass="0.5" x="0.3" y="0.3" z="0.15">
            <origin xyz="0.15 0 0.075" rpy="0 0 0"/>
        </xacro:inertial_box>
    </link>

    <!-- <gazebo reference="chassis">
        <material>Gazebo/Grey</material>
        <selfCollide>false</selfCollide>
    </gazebo> -->

    <!-- X Axis Link -->

    <joint name="x_axis_joint" type="prismatic">
        <parent link="chassis" />
        <child link="x_axis"/>
        <origin xyz="-0.45 0 0" />
        <axis xyz="1 0 0"/>
        <limit lower="0" upper="0.9" effort="20" velocity="0.05"/>
    </joint>

    <link name="x_axis">
        <visual>
            <origin xyz="0 0 0"/>
            <geometry>
                <box size="0.025 0.5 0.025"/>
            </geometry>
            <material name="black"/>
        </visual>
        <collision>
            <origin xyz="0 0 0"/>
            <geometry>
                <box size="0.025 0.5 0.025"/>
            </geometry>
        </collision>
        <xacro:inertial_box mass="0.5" x="0.3" y="0.3" z="0.15">
            <origin xyz="0.15 0 0.075" rpy="0 0 0"/>
        </xacro:inertial_box>
    </link>

    <!-- Y Axis Link -->

    <joint name="y_axis_joint" type="prismatic">
        <parent link="x_axis" />
        <child link="y_axis"/>
        <origin xyz="0 -0.175 -0.025" />
        <axis xyz="0 1 0"/>
        <limit lower="0" upper="0.35" effort="20" velocity="0.05"/>
    </joint>

    <link name="y_axis">
        <visual>
            <origin xyz="0 0 0"/>
            <geometry>
                <box size="0.1 0.1 0.025"/>
            </geometry>
            <material name="orange"/>
        </visual>
        <collision>
            <origin xyz="0 0 0"/>
            <geometry>
                <box size="0.1 0.1 0.025"/>
            </geometry>
        </collision>
        <xacro:inertial_box mass="0.5" x="0.3" y="0.3" z="0.15">
            <origin xyz="0.15 0 0.075" rpy="0 0 0"/>
        </xacro:inertial_box>
    </link>

    <!-- A Axis Link -->

    <joint name="a_axis_joint" type="revolute">
        <parent link="y_axis" />
        <child link="a_axis"/>
        <origin xyz="0 0 0" />
        <axis xyz="0 0 1"/>
        <limit lower="-3.14" upper="3.14" effort="20" velocity="12"/>

    </joint>

    <link name="a_axis">
        <visual>
            <origin xyz="0 0 0"/>
            <geometry>
                <sphere radius="0.05"/>
            </geometry>
            <material name="orange"/>
        </visual>
        <collision>
            <origin xyz="0 0 0"/>
            <geometry>
                <sphere radius="0.05"/>
            </geometry>
        </collision>
        <xacro:inertial_box mass="0.5" x="0.3" y="0.3" z="0.15">
            <origin xyz="0.15 0 0.075" rpy="0 0 0"/>
        </xacro:inertial_box>
    </link>

    <!-- B Axis Link -->

    <joint name="b_axis_joint" type="revolute">
        <parent link="a_axis" />
        <child link="b_axis"/>
        <origin  rpy="-1.0 0 0 " xyz="0 0 0" />
        <axis xyz="1 0 0"/>
        <limit lower="0" upper="2.0" effort="20" velocity="12"/>
    </joint>
    
    <link name="b_axis">
        <visual>
            <origin xyz="0 0 -.05"/>
            <geometry>
                <box size="0.025 0.025 0.015"/>
            </geometry>
            <material name="orange"/>
        </visual>
        <collision>
            <origin xyz="0 0 -.05"/>
            <geometry>
                <box size="0.025 0.025 0.015"/>
            </geometry>
        </collision>
        <xacro:inertial_box mass="0.5" x="0.3" y="0.3" z="0.15">
            <origin xyz="0.15 0 0.075" rpy="0 0 0"/>
        </xacro:inertial_box>
    </link>
</robot>

I solved my problem, but wanted to leave this here in case anyone else runs into it.

In order to stick a link to some place in the Gazebo world, add a fixed joint to a link named world.

I attached mine to my base_link, with a Z offset of 1 m:

    <!-- World Fix Link -->
    <link name="world">

    </link>
    
    <joint name="weld" type="fixed">
        <parent link="world" />
        <child link="base_link" />
        <origin xyz="0 0 1" />
    </joint>

I have problems, to run the robot on gazebo harmonic (on ros2 Jazzy) . When I’ll do the command: “ros2 run articubot_one spawn_entity.py -topic robot_description -entity bot_name” the error is: “No executable found”.

I have followed the step of this tutorial, but it still doesn’t work.

any help?

Gazebo was updated and the packages of ros were also updated from jazzy ros , follow up the update video from articulated robotics to understand the change.

I found the issue was to do with new release versions. the commands are different to when josh first made the videos

https://gazebosim.org/docs/latest/ros2_spawn_model/

I am struggling through this myself and have had to revamp the launch files a bit.

I can get gazebo to run now but cant get my model to spawn :frowning:

Does anyone have a solution to this? I am having the same issue. Teleop Twist is publishing to /cmd_vel but gazebo is not subscribed. I have tried adding in /cmd_vel </command Topic> to the gazebo_control.xacro file. But it doesn’t change anything. I have ran
ros2 topic echo /cmd_vel
and verified teleop twist is publishing velocity commands, so it seems like it is something on the gazebo side.

the robot is spawned in the gazebo. All the colors are working, but I cannot figure out why gazebo is not connected.

I am running gazebo version 11.11
Ros2 Foxy
and Ubuntu MATE 20.04.6

Can anyone help?