odometry in place
I am setting up a Gazebo model for use with the navigation stack. I have been reading the Navigation Tuning Guide and am confused about the lidar data in the odom frame. I would think that the tuning guide, when it says:
"The first test checks how reasonable the odometry is for rotation. I open up rviz, set the frame to "odom," display the laser scan the robot provides, set the decay time on that topic high (something like 20 seconds), and perform an in-place rotation. Then, I look at how closely the scans match each other on subsequent rotations. Ideally, the scans will fall right on top of each other, but some rotational drift is expected, so I just make sure that the scans aren't off by more than a degree or two. (Nav Stack Tuning)"
it means that the lidar data is supposed to be in approximately the same place before, during, and after the rotation. I have been reading and it seems that these sweeping swirls that I see are correct? I have been trying to use gmapping in my simulation and whenever I rotate the map gets horridly disfigured - I believe that odometry is to blame.
I have recorded what the lidar data looks like in the odom frame. Is this correct or should it look differently?
Edit 1: I followed this tutorial to build the initial model and simulate it. I created a (visually) crude model with two wheels (left and right) that move and two frictionless casters (front and back) using their general framework. I changed the shape of the robot but just followed their procedure and tried to reproduce it. I have tried to flip the x rotation for the left and right wheels from -pi/2 to pi/2 and that just reversed the direction of motion, which I expected, but does not change the issue of streaky lidar from the odom frame. I am puzzled because the straight odometry data keeps the laser scans in the same position (as one would expect) but when I rotate the robot I get the streaks. I don't really know the mechanism behind calculating the odometry data in Gazebo so I am stuck as to fixing this issue.
The urdf file is shown:
<?xml version="1.0"?>
<robot name="bender" xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:property name="pi" value="3.141592653589794" />
<xacro:property name="base_len" value="0.89" />
<xacro:property name="base_wid" value="0.80" />
<xacro:property name="base_height" value="0.20" />
<xacro:property name="caster_length" value="0.10" />
<xacro:property name="caster_radius" value="0.15" />
<xacro:property name="wheel_length" value="0.10" />
<xacro:property name="wheel_radius" value="0.15" />
<xacro:property name="update_rate" value="50"/>
<xacro:property name="hokuyo_size" value="0.05"/>
<xacro:macro name="default_inertial" params="mass">
<inertial>
<mass value="${mass}" />
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0" />
</inertial>
</xacro:macro>
<material name="white">
<color rgba ...
It shouldn't swirl like that. The gazebo robot appears to be rotating the opposite direction as in rviz - or is the rviz display upside down looking through the floor?
Should the robot spawn in the same direction in both? I didn't set any parameters it just was that way. When I went through URDF tutorials the R2D2 we made appeared that way. Plus, it drives forward the way I expect and the lidar scanning with large decay stays in a constant position.
Maybe there is a way to flip the direction of the odometry rotation (the crudest way would be to subscribe to it, flip the sign, then republish under a new name and have rviz use that.)
Do you have a custom urdf you can post? Update the question with it if so. What is the link to the tutorial you are following, and are you following it exactly or what changes have you made?
I have been following another example as outlined in Edit 2 in above post. The 'streaking' behavior occurs in the x direction rather than when rotating. What could make this occur?
If you are able to individually turn wheels it would be good to verify that the left wheel in gazebo is the left wheel in rviz and is turning in a consistent direction and the same for the right wheel.