Ask Your Question
0

Robot spawn at a wrong location in rviz

asked 2021-07-09 11:38:01 -0600

buzzport93 gravatar image

I have a quadruped model that I have made it to spawn in gazebo successfully with contact sensing. However, when I launch the file in rviz using below snippet in my launch file, the robot spawns in rviz in a way that its foot is not touching the ground but the body is rather floating on the XY plane. (Picture attached). What could be my issue? URDF seems fine since the model spawns successfully in gazebo, but it just seems wrong in rviz.

<param name="robot_description" command="cat '$(find a1_description)/urdf/a1.urdf'" />
<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" output="screen"
      args="-urdf -z 0.6 -param robot_description -model a1_gazebo -unpause" />

image description

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-07-09 12:54:16 -0600

gvdhoorn gravatar image

There is (likely) nothing wrong.

There is no concept of "ground" in RViz. Nor of "touching".

RViz is a pure visualisation tool. It does not simulate any physics, does not do any modelling, nor does it even "know" what it is rendering.

All robot models are floating in a 3D space in RViz. Only if other meshes or surfaces are rendered in the vicinity of your robot model will it appear robots are "on the ground" or "touching a wall". But in reality, it's all 3D models floating in space that happen to get rendered close to each other.

As to what you observe: the render engine in RViz must be told what the "root" of the scene graph is, as everything else it wants to render (ie: place in the virtual 3D space) will be placed relative to that root.

You configure that root using the Fixed Frame setting of the Global Options (on the left side of the window typically).

It's possible you have that set to base_link.

For most robot models, base_link is located in "a logical place in the robot's body". Unfortunately that does not always mean it's going to be "on the bottom", or "between its feet" (in this case).

If the base_link for your robot model is actually somewhere inside its body, then RViz will make that link the root of the tree and place it in the middle of your screen. Other objects are rendered relative to that, so the (cost?) map display you have in the screenshot will be rendered at z==0 metres offset from base_link. Result: robot appears to be stuck in the groundplane (but again: there is no ground).

edit flag offensive delete link more

Comments

Thanks. I fixed this by setting the fixed frame w.r.t. base_footprint rather than base_link.

buzzport93 gravatar image buzzport93  ( 2021-07-12 17:58:46 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-07-09 11:38:01 -0600

Seen: 111 times

Last updated: Jul 09