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

Floating robot moves in rviz, not gazebo ?

asked 2020-02-09 07:42:27 -0500

dmb gravatar image

updated 2020-02-09 08:16:12 -0500

I feel I should apologize before I even start this post as I'm sure I've made some wild assumptions - forgive a newbie :)

I've built a real robot based on ROS, but it doesn't do anything sophisticated as yet - one Arduino node just listens for remote control signals, converts and publishes these as Twists on /cmd_vel, and then another Arduino node picks these up and converts them to motor controller signals. The ROS master runs on a raspberry PI. Then winter arrived and I haven't taken it outside since !

So now I want to add SLAM to the mix, and decided to build a simulated version to work on. I wrote the URDF, and tried to get things working in rviz and gazebo. In rviz the robot moves around fine, though it floats above the ground plane. In gazebo, the front wheels gradually swivel around for some reason even when no movement commands are received, and while the main wheels spin in the right directions when commands are sent to /cmd_vel, the robot remains stationary. URDF below .. I don't have enough points to upload the screenshots but hope my description is sufficient..

I've been trying to find out what I'm doing wrong over the last couple of weeks but now I'm running dry ... I'd really appreciate any advice. I'm sure the wheels should touch the ground, so my positioning is wrong., and I suspect I need more parameters in the gazebo part for friction (mu ? mu2 ?).

I'm running Ubuntu 18.04 on the ROS master, and also on the remote rviz/gazebo node (an Nvidia Jetson Nano), gazebo 9.0.0, rviz 1.13.4, ROS melodic.

Thanks for any help !

David

display.launch:

<launch>

  <param name="robot_description" textfile="urdf/storm.urdf" />

  <include file="$(find gazebo_ros)/launch/empty_world.launch" />

  <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -model storm" />

</launch>

storm.urdf:

<?xml version="1.0"?>
<robot name="myfirst">
    <material name="black">
        <color rgba="0 0 0 2.0"/>
    </material>

    <material name="cyan">
        <color rgba="0 1.0 1.0 1.0"/>
    </material>

    <material name="silver">
        <color rgba="0.92 0.92 0.92 2.0"/>
    </material>

    <material name="magenta">
        <color rgba="1.00 0 1.0 1.0"/>
    </material>

    <material name="red">
        <color rgba="1.00 0 0.0 2.0"/>
    </material>

    <!-- the main box - this is the base reference for the robot -->

    <link name="base_link">
        <visual>
            <origin xyz="0 0 1" rpy="0 0 0" />
            <geometry>
                <box size="2 1 1" />
            </geometry>
            <material name="cyan"/>
        </visual>
        <collision>
            <origin xyz="0.5 0 0.75" rpy="0 0 0" />
            <geometry>
                <box size="3 1.75 1.75" />
            </geometry>
        </collision>
        <inertial>
            <mass value="50"/>
            <inertia ixx="7.5" ixy="0.0 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-04-12 08:32:36 -0500

juxyper gravatar image

A bit of a necro, but hopefully this will be helpful to others.
Seems like you haven't entered <origin> tags on your <visual>, <collision>, and <inertial> tags where necessary.
From the wiki: links joints

<origin> (optional: defaults to identity if not specified)

So the thing that's going on here is that your link origin is at xyz="0 0 0" rpy="0 0 0" but your other given positions for the link vary, so the contact is awkward. I've suffered from a similar problem, and explicitly defining the origin helped a lot to at least place the robot on the ground. My own problem proceeding afterwards is to make the ground contact work properly, given that URDF doesn't really communicate that information easily.
Hope this helps.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-02-09 07:42:27 -0500

Seen: 528 times

Last updated: Feb 09 '20