Including odometry with a laser2D

Simulate, build and deploy your algorithms with Erle-Rover

Source code

Erle-Rover doesn't have odometry, but using a 2D laser, we are going to be able to estimate the movement of Erle-Rover and create a topic /odom, which is necessary for the following tutorials.

The laser_scan_matcher package is an incremental laser scan registration tool. The package allows to scan match between consecutive sensor_msgs/LaserScan messages, and publish the estimated position of the laser as a geometry_msgs/Pose2D or a tf transform.

The package can be used without any odometry estimation provided by other sensors. Thus, it can serve as a stand-alone odometry estimator. Alternatively, you can provide several types of odometry input to improve the registration speed and accuracy.

Install the ros package:

sudo apt-get install ros-indigo-laser-scan-matcher

Remember that can install from source this package:

cd ~/ros_catkin_ws/src
git clone https://github.com/ccny-ros-pkg/scan_tools
cd ~/ros_catkin_ws
catkin_make_isolated --pkg laser_scan_matcher

Create the following launch file (odom.launch):

<launch>
  <node pkg="laser_scan_matcher" type="laser_scan_matcher_node" name="laser_scan_matcher_node" output="screen">
    <param name="base_frame"    value="base_footprint"/>
    <param name="_fixed_frame"  value="map"/>
    <param name="use_imu"       value="false"/>
    <param name="use_odom"      value="false"/>
    <param name="use_vel"       value="false"/>
    <param name="max_iterations" value="10"/>
    <param name="publish_tf"    value="false"/>
    <param name="publish_pose"  value="true"/>
  </node>
</launch>

As you can see in the launch file above, no other sensors are used (use_odom, use_vel and use_imu are set to false).

Now we can launch the node:

roslaunch ros_erle_rover_navigation odom.launch
... logging to /home/ahcorde/.ros/log/a32224e0-6ace-11e6-bb5e-74da3869ff31/roslaunch-ciri-12769.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ciri:42052/

SUMMARY
========

PARAMETERS
 * /laser_scan_matcher_node/_fixed_frame: map
 * /laser_scan_matcher_node/base_frame: base_footprint
 * /laser_scan_matcher_node/max_iterations: 10
 * /laser_scan_matcher_node/publish_pose: True
 * /laser_scan_matcher_node/publish_tf: False
 * /laser_scan_matcher_node/use_imu: False
 * /laser_scan_matcher_node/use_odom: False
 * /laser_scan_matcher_node/use_vel: False
 * /rosdistro: indigo
 * /rosversion: 1.11.20

NODES
  /
    laser_scan_matcher_node (laser_scan_matcher/laser_scan_matcher_node)

ROS_MASTER_URI=http://10.0.0.1:11311

core service [/rosout] found
process[laser_scan_matcher_node-1]: started with pid [12781]
[ INFO] [1472194138.660837252]: Starting LaserScanMatcher

rosrun ros_erle_cpp_teleoperation_erle_rover teleoperation
ErleRoverManager : using linear  vel step [10].
ErleRoverManager : using linear  vel max  [1560, 1440].
ErleRoverManager : using angular vel step [50].
ErleRoverManager : using angular vel max  [1900, 1100].
Reading from keyboard
---------------------------
Forward/back arrows : linear velocity incr/decr.
Right/left arrows : angular velocity incr/decr.
Spacebar : reset linear/angular velocities.
q : quit.

Using rviz we are going to be able to visualize the odometry. Also if we have an available map (from de previous tutorial) we can launch map_server to visualize the map.

rosrun map_server map_server my_map.yaml
[ INFO] [1472193111.778090474]: Loading map from image "./map.pgm"
[ INFO] [1472193111.840535180]: Read a 2048 X 2048 map @ 0.050 m/cell

When a map is requested this message will appear:

[ INFO] [1472193901.189821495]: Sending map

Now we are able to visualize the desire information. In this case: the map, the odometry and the laser scan. First at all, we need to launch rviz:

rosrun rviz rviz

Clicking in "Add button" and then in the tab "By topic", we are able to select which information is going to be visualize in the render. The following picture shows the laser (colors close to the walls map), the odometry (green arrow), and the map.

Also we can show the path of Erle-Rover estimates by the laser odometry: