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


asked 2013-01-18 01:27:20 -0500

camilla gravatar image

updated 2013-01-22 02:49:55 -0500

When I ran a simulation in gazebo and I use rviz to send goals what my robot does in rviz is different from what it does in gazebo.
More precisely if I set a goal with the rviz tool 2d nav goal i can see the robot in gazebo moving in a smooth way but not in the right direction to reach the goal and the robot in rviz which change its position in a non-continuous way (e.g. it disappear from (x,y) and reapper in (x2,y2) which is far from the previous position).
Further more while the robot in gazebo does a rotation of k rad the one in rviz does a rotation of h rad (with h < k).
Setting the laser decay time to 10 and teleoperating the robot I can see that the scans are coinciding if I move the robot forward or backward but they're totally not coinciding if I let the robot rotate in place. Instead I was expecting to see the same translation and rotation performed by the robot in gazebo and the robot in rviz. What could be the issue?

What i do is: To launch pioneer3dx.gazebo.launch to simulate the p3dx robot.


  <include file="$(find gazebo_worlds)/launch/office_world.launch"/>

  <include file="$(find p2os_urdf)/launch/upload_pioneer3dx.xml"/>

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

  <!-- Controller Manager -->
  <include file="$(find pr2_controller_manager)/controller_manager.launch" />

  <!-- load controllers -->
  <node name="diffdrive" pkg="gazebo_plugins" type="gazebo_ros_diffdrive" respawn="true" output="screen"/>


Then I'm launching the navigation.launch file:

    <master auto="start"/>

    <!-- Run the map server (you can run it here or in another terminal) -->
    <node name="map_server" pkg="map_server" type="map_server" args="$(find p2os_nav)/simple_office_map.yaml" respawn="true"/> 

    <!--- Run AMCL -->
    <include file="$(find p2os_launch)/amcl.launch" />

    <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
        <rosparam file="$(find p2os_launch)/costmap_common_params.yaml" command="load" ns="global_costmap" />
        <rosparam file="$(find p2os_launch)/costmap_common_params.yaml" command="load" ns="local_costmap" />
        <rosparam file="$(find p2os_launch)/local_costmap_params.yaml" command="load" />
        <rosparam file="$(find p2os_launch)/global_costmap_params.yaml" command="load" />
        <rosparam file="$(find p2os_launch)/base_local_planner_params.yaml" command="load" />
        <param name="base_global_planner" type="string" value="navfn/NavfnROS" />
        <param name="conservative_reset_dist" type="double" value="3.0" />
        <param name="controller_frequency" type="double" value="15.0" />
        <remap from="odom" to="erratic_odometry/odom"/>


and also rviz (with the command rosrun rviz rviz). Surfing on the web i read that it could be a problem of too slow odometry, but what to do to fix it?

The /tf between /odom and /base_link and the nav_msgs odom received by move_base is published by the gazebo diffdrive plugin:

#include <gazebo/gazebo.h>
#include <gazebo/GazeboError.hh>
#include <gazebo/Quatern.hh>

#include <ros/ros.h>
#include <tf/transform_broadcaster.h>
#include <geometry_msgs/Twist.h>
#include <nav_msgs/Odometry.h>

#include <boost/bind.hpp>

class DiffDrive {
  libgazebo::PositionIface *posIface;
  ros::NodeHandle* rnh_;
  ros::Subscriber ...
edit retag flag offensive close merge delete



Your question is a bit vague. Please clarify what you mean with goals and list the commands you are using.

davinci gravatar image davinci  ( 2013-01-18 01:41:21 -0500 )edit

I added some infos

camilla gravatar image camilla  ( 2013-01-18 01:58:46 -0500 )edit

Please edit your question so we know what you expected to happen, and what happened instead.

joq gravatar image joq  ( 2013-01-19 13:49:35 -0500 )edit

Is this a duplicate of the other question?

joq gravatar image joq  ( 2013-01-19 13:50:30 -0500 )edit

edited! :)

camilla gravatar image camilla  ( 2013-01-20 20:37:39 -0500 )edit

You need to describe precisely what the actual problem is by stating/showing what exactly happens and what you would expect, i.e. the symptoms. Listing possible guesses where the problem lies is not helpful as currently no one else understands what the problem is.

dornhege gravatar image dornhege  ( 2013-01-22 01:03:35 -0500 )edit

thx i added a more detailed description

camilla gravatar image camilla  ( 2013-01-22 01:39:42 -0500 )edit

Is rviz displaying Odometry published by gazebo_ros_diffdrive or by amcl?

joq gravatar image joq  ( 2013-01-22 03:27:36 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-02-03 22:18:25 -0500

camilla gravatar image

I solved the problem of the rotation:

Further more while the robot in gazebo does a rotation of k rad the one in rviz does a rotation of h rad (with h < k).

changing the value of the wheel radius in pioneer3dx.xacro from 0.15 to 0.22.
But I still have problem in the robot localization.

edit flag offensive delete link more

answered 2013-01-20 23:16:49 -0500

dornhege gravatar image

I'll guess that it has to do with tf/frames somehow. Either you didn't set the fixed frame to /map in rviz or the localization is not initialized and localized properly.

edit flag offensive delete link more


in rviz i set the fixed frame and the target frame to /map and the 2d Nav goal to /move_base_simple/goal

camilla gravatar image camilla  ( 2013-01-20 23:21:24 -0500 )edit

Did you initialize the localization?

dornhege gravatar image dornhege  ( 2013-01-20 23:48:08 -0500 )edit

Before sending the goal I set the initial pose with rviz that publishes on the topic /initial_pose

camilla gravatar image camilla  ( 2013-01-21 01:37:20 -0500 )edit

So common errors might be out. You'll need to be more specific to get useful help. Please follow @joq's comments.

dornhege gravatar image dornhege  ( 2013-01-21 03:15:26 -0500 )edit

I added my rxgraph

camilla gravatar image camilla  ( 2013-01-21 20:45:05 -0500 )edit

I still think that there is a problem with tf in particular odometry, but I can't get where it is.

camilla gravatar image camilla  ( 2013-01-21 21:08:46 -0500 )edit

Question Tools


Asked: 2013-01-18 01:27:20 -0500

Seen: 647 times

Last updated: Feb 03 '13