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

wheels are moving but the bot is not moving in gazebo [closed]

asked 2023-07-19 01:01:10 -0500

the_one gravatar image

updated 2023-07-21 06:06:00 -0500

i developed a basic 4 wheel bot and i can make it move with the help of diff_drive_controller. The bot is working and moving fine in rviz, but in gazebo wheels only moving, not the bot. you guys can refer my github link using this link. And the urdf file added here

rover.urdf.xacro

   <?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="my_rover">


    <xacro:property name="constant"     value = "0.083333333"/> #1/12
    <xacro:property name="mass"         value = "0.5"/>
    <xacro:property name="width"        value = "0.75"/> 
    <xacro:property name="height"       value = "0.15"/>
    <xacro:property name="depth"        value = "0.4"/>
    <xacro:property name="radius"        value = "0.033"/>
    <xacro:property name="length"        value = "0.018"/>

    <xacro:macro name="default_inertial" params="mass">
        <inertial>
        <mass value="${mass}" />
        <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0" />
        </inertial>
    </xacro:macro>


    <!-- rover base link -->
    <link name="world"> 

    </link>

    <joint name="Chassis_joint" type="fixed">
        <parent link="world"/>
        <child link="Chassis"/>
        <origin xyz="0.0 0.0 0.165"/>
    </joint>

    <link name="Chassis">

        <xacro:default_inertial mass="1"/>
        <visual>
            <geometry>
                <box size="0.75 0.4 0.15" />
            </geometry>
            <material name="">
                <color rgba="1.0 0.3 0.1 1.0"/>
            </material>
        </visual>
        <collision>
            <geometry>
                <box size="0.75 0.4 0.15" />
            </geometry>
        </collision>
    </link>

    <gazebo reference = "Chassis">
        <material> Gazebo/Orange </material>
    </gazebo> 

        <!-- camera/sensor mount -->
    <joint name="mount_joint" type="fixed">
        <parent link="Chassis"/>
        <child link="mount_link"/>
        <origin xyz="0.2 0.0 0.124" rpy="0.0 0.0 0.0"/>
        <axis xyz="0.0 0.0 0.0"/> 
    </joint>

    <link name="mount_link">
        <inertial>
            <mass value="0.0"/>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <inertia ixx="0.0" ixy="0.0" ixz="0.0"
                    iyy="0.0" iyz="0.0"
                    izz="0.0" />
        </inertial>  
        <visual>                     
            <geometry>
                <cylinder radius="0.08" length="0.1"/>
            </geometry>
            <material name="">
                <color rgba="0.0 0.0 0.0 1.0"/>
            </material>
        </visual>
        <collision>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <cylinder radius="0.08" length="0.1"/>
            </geometry>
        </collision>
    </link> 

    <gazebo reference = "mount_link">
        <material> Gazebo/Black</material>
    </gazebo>  

    <!-- defining xacro style for repeating elements -->
    <xacro:macro name="wheel" params="name path x y">

        <joint name="${name}_wheel_joint" type="continuous">
            <parent link="Chassis"/>
            <child link="${name}_wheel"/>
            <origin xyz="${x} ${y} 0.0" rpy="0.0 0.0 0.0"/>
            <axis xyz="0.0 1.0 0.0"/>
            <limit effort="100.0" lower ...
(more)
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by the_one
close date 2023-07-25 00:57:44.023112

Comments

Hi!

From the Github link you provided, I see you are just starting with ROS. It is important that you have a good understanding of the difference between Rviz (a tool to visualize, e.g., ROS messages) and Gazebo (a physics simulator). You can look for related questions (as this one) here on ROS Answers.

Then, your actual question. The fact that you can see the robot "move" in Rviz means that you are publishing the messages that you want. Contrarily, the fact that it does not work as expected in Gazebo, suggests that something is not set properly in the URDF model of your robot. If you have a clue on "who" could be responsible (joints? friction?), looking for related questions on Gazebo Answers would be a good idea.

bluegiraffe-sc gravatar image bluegiraffe-sc  ( 2023-07-19 08:51:26 -0500 )edit

well, I don't have any clue on who could be responsible (joints/ friction) for that specifically. I can't find any related questions there in gazebo.answers.org. Is there any way to figure out what's wrong or what i am missing in the urdf file i wrote? I validated the urdf file using "check_urdf" command. No error showsn.

the_one gravatar image the_one  ( 2023-07-19 23:48:27 -0500 )edit

Alright, so here's my observation. the reason why the bot did not move is, because i gave the joint name called "Chassis_joint" which is fixed type and set offset of 0.165 in z axis. if i commented out the dummy link called "world" and this "Chassis_joint" it moves in gazebo(but the bot buried half in the surface, and when i increase the velocity it stated to jump like the clutch is released suddenly in the car). I really don't know the reason how and why it happened! Also this error came up when i run after i commented out the world and chassis_joint.

[ WARN] [1689917802.754065574]: The root link Chassis has an inertia specified in the URDF, but KDL does not support a root link with an inertia.  As a workaround, you can add an extra dummy link to your URDF.
the_one gravatar image the_one  ( 2023-07-21 00:38:11 -0500 )edit

I suggest you post your comment as an answer, as it actually solves the problem in your question.

As for the warning, you should just do what the warning itself is telling you to do. You can add a dummy link (a common choice for its name is base_link), with no inertia. Then you define a fixed link between base_link and your Chassis_joint.

bluegiraffe-sc gravatar image bluegiraffe-sc  ( 2023-07-21 05:13:36 -0500 )edit

sorry to say, but it did not completely solved the problem. I updated the question with my urdf file attached. I would be really glad if you tell me what wrong with this code or what wrong i did.

the_one gravatar image the_one  ( 2023-07-21 06:07:23 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-07-25 00:57:16 -0500

the_one gravatar image

so I managed to solve the issue... the reason why the bot buried in the surface is because i mentioned the "cylinder" in the geometry tag in wheel link, but i added an stl file thru mesh in the visual tag in the same wheel link.... which is not relevant. after i changed the wheel link like this and defined the inertia value for each wheels, gave the friction value in gazebo reference....

    <visual> 
    <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>          
    <geometry>
        <mesh filename="${path}" scale="0.005 0.005 0.005"/> #length = 0.018 radius = "0.066"
    </geometry>
    <material name="">
        <color rgba="1.0 0.0 0.0 1.0"/>
    </material>
</visual>
<collision>
    <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
    <geometry>
        <mesh filename="${path}" scale="0.005 0.005 0.005"/> #length = 0.018 radius = "0.066"
    </geometry>
</collision>

the bot behaves good.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2023-07-19 01:01:10 -0500

Seen: 189 times

Last updated: Jul 25 '23