URDF spawn error, robot float on the ground plane

asked 2020-04-11 07:13:59 -0500

yanaing gravatar image

updated 2021-04-24 02:43:27 -0500

miura gravatar image

Hi, I build a robot model in the URDF file and also tested with the Rviz. The robot model can be visualized in the Rviz and it also correct.When I spawn the URDF file to spawn the robot in Gazebo, it spawned wrongly. The robot floating at the ground plane by the centre of base_link. This is the launch file used for spawning.

<launch>
   <!-- these are the arguments you can pass this launch file, for example paused:=true -->
   <arg name="paused" default="false"/>
   <arg name="use_sim_time" default="true"/>
   <arg name="gui" default="true"/>
   <arg name="headless" default="false"/>
   <arg name="debug" default="false"/>
   <arg name="model" default="$(find description)/urdf/description.urdf.xacro"/>

   <!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
   <include file="$(find gazebo_ros)/launch/empty_world.launch">
     <arg name="debug" value="$(arg debug)" />
     <arg name="gui" value="$(arg gui)" />
     <arg name="paused" value="$(arg paused)"/>
     <arg name="use_sim_time" value="$(arg use_sim_time)"/>
     <arg name="headless" value="$(arg headless)"/>
  </include>

  <param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />
  <!-- <param name="robot_description" command="$(find xacro)/xacro $(arg model)" /> -->

  <!-- push robot_description to factory and spawn robot in gazebo -->
  <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model"
    args="-z 0 -unpause -urdf -model robot -param robot_description" respawn="false" output="screen" />

  <node pkg="robot_state_publisher" type="robot_state_publisher"  name="robot_state_publisher">
     <param name="publish_frequency" type="double" value="30.0" />
  </node>

</launch>

I have no idea why this one is floating like this. Many thanks for your help!!!

edit retag flag offensive close merge delete

Comments

Hi @yanaing,

When you spawn your robot in Gazebo you can change the Pose at wich the robot appears. Actually you are doing that when you launch the spawner. The -z is spawning the robot in 0 so you can try to increase the height to see if that is the problem. Besides, try to launch the Gazebo client paused for the moment, it will let you see the first steps of the simulation.

On the other hand, take into account that you may want to adjust the Gazebo physics parameters for collision and friction because it is possible that your robor is sunking into the ground because the friction parameters are not properly tuned.

Weasfas gravatar image Weasfas  ( 2020-04-12 05:49:00 -0500 )edit

According to your instruction, I set the parameter to PAUSE, I spawn above the ground with the value of -z. If PAUSE value is FALSE, can I still use this launch file for further simulation with gazebo?

yanaing gravatar image yanaing  ( 2020-04-12 22:45:24 -0500 )edit

The pause parameter is use only to see the very first pose of the robot in Gazebo world, you can start the simulation by clicking on the play button on the bottom of the GUI. It usually helps to see if you spawn the robot properly and if there are certain physics parameter involved in your problem. As I said in my last comment you probably want to stablish a good Z, ensure with the pause argument that the robot does spawn in that Z and then try to click the play button on the GUI to see how the model behaves with the floor contacts. If the floor contacts are erratic you should adjust the physics parameters for friction and colision.

Weasfas gravatar image Weasfas  ( 2020-04-13 13:19:30 -0500 )edit