Start position in rviz off when using gazebo

asked 2020-01-02 21:26:35 -0500

ed gravatar image

I am trying to compare dwa_local_planner, base_local_planner, and teb_local_planner in a gazebo simulation of my living room. I created a world of 4 walls, a "couch" (a long rectangle), a set of stairs, and a bookcase. I am using the turtlebot3_burger.

My sim launch file is below. Note the spawn_model parameters for x y z are set to 0

<launch>
  <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
  <arg name="x_pos" default="0.0"/>
  <arg name="y_pos" default="0.0"/>
  <arg name="z_pos" default="0.0"/>
  <param name="/rosout/omit_topics" type="bool" value="true" />
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/wlroom.world"/>
    <arg name="paused" value="false"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="verbose" value="true"/>    
    <arg name="gui" value="false"/>
    <arg name="headless" value="true"/>
    <arg name="debug" value="false"/>
  </include>

  <param name="robot_description" command="$(find xacro)/xacro --inorder $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" /> 

  <node pkg="gazebo_ros" type="spawn_model" name="spawn_urdf" args="-urdf -model turtlebot3_$(arg model) -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description" />
</launch>

Now when I launch the navigation launch file which launches a map server using a map generated from the gazebo world launched above, amcl, move_base with any of the local planners and rviz the robot model is shifted slightly to the right of the grid center.

The relevant parts of the amcl launch file are

  <arg name="initial_pose_x" default="0.0"/>
  <arg name="initial_pose_y" default="0.0"/>
  <arg name="initial_pose_a" default="0.0"/>

and 

  <node pkg="amcl" type="amcl" name="amcl">
    <param name="initial_pose_x"            value="$(arg initial_pose_x)"/>
    <param name="initial_pose_y"            value="$(arg initial_pose_y)"/>
    <param name="initial_pose_a"            value="$(arg initial_pose_a)"/>

See pictures in the simstarted.pgn you can see the robot model centered on the grid axis center. In the rviz started you can see the robot model is right of the grid axis. Also I echoed odom and it is showing x=0.0, y = 0.0, z was .0002

why is this offset. image description image description

edit retag flag offensive close merge delete