Skip to content

Control, odometry, navigation and mapping

Yoshua Nava edited this page Dec 18, 2017 · 3 revisions

IMPORTANT

To successfully follow this tutorial, first set up either the Gazebo simulator, or a connection to a real Ridgeback robot. (See real robot nodes and simulator nodes)

Control

There are three quick ways to send your Ridgeback control commands:

  1. Using the provided PS4 gamepad. See How to drive Ridgeback with the provided PS4 Controller.
  2. Using the rviz instance after running roslaunch ridgeback_viz view_robot.launch. If you select the Interact option in the top toolbar, an interactive marker will appear around the Ridgeback, which can be used to control its speed.
  3. The rqt_robot_steering plugin. Run the rqt_gui, and select Plugins->Robot Tools->Robot Steering from the top menu.

Ridgeback uses twist_mux to mix four separate geometry_msgs/Twist control channels into the /cmd_vel topic. These channels are (in order of decreasing priotity):

Topic Description Priority
joy_teleop/cmd_vel Joystick teleop input 4
twist_marker_server/cmd_vel Interactive marker teleop input 3
move_base/cmd_vel Autonomous movement input for the ridgeback_navigation samples 2
cmd_vel Miscellaneous external input 1

Additional velocity channels can be defined in by means of the file twist_mux.yaml, or can be piped into the lowest-priority cmd_vel topic.

Odometry

Ridgeback publishes odometry information on the odometry/filtered topic, as nav_msgs/Odometry messages. These are generated by ekf_localization_node, which processes data from several sensor sources using an Extended Kalman filter (EKF). This includes data from the wheel encoders and IMU.

Topic Sources Description
ridgeback_velocity_controller/odom ridgeback_node Raw odometry as read from Ridgeback encoders
imu/data imu_filter_madgwick Orientation estimate from the IMU
odometry/filtered ekf_localization_node Fused odometry estimate (encoders and IMU)

Additional odometry information sources can be added to the EKF in ridgeback_control/config/control.yaml.

Navigation

Without a map

In the odometry navigation demo Ridgeback attempts to reach a given goal in the world within a user-specified tolerance. The 2D navigation, generated by move_base, takes in information from odometry, laser scanner, and a goal pose and outputs safe velocity commands. In this demo the configuration of move_base is set for navigation without a map in an odometric frame (that is, without reference to a map).

To launch the navigation demo, run:

roslaunch ridgeback_navigation odom_navigation_demo.launch

To visualize with the suggested rviz configuration launch:

roslaunch ridgeback_viz view_robot.launch mode:=navigation

To send goals to the robot, select the 2D Nav Goal tool from the top toolbar, and then click anywhere in the rviz view to set the position. Alternatively, click and drag slightly to set the goal position and orientation.

With a map

Using amcl, Ridgeback is able to globally localize itself in a known map. AMCL takes in information from odometry, laser scanner and an existing map and estimates the robot’s pose.

To start the AMCL demo:

roslaunch ridgeback_navigation amcl_demo.launch map_file:=/path/to/my/map.yaml

If you don’t specify map_file, it defaults to an included pre-made map of the default “Ridgeback Race” environment which Ridgeback simulator spawns in. If you’re using a real Ridgeback in your own environment, you’ll definitely want to override this with the map created using the gmapping demo.

Before navigating, you need to initialize the localization system by setting the pose of the robot in the map. This can be done using 2D Pose Estimate in rviz or by setting the amcl initial_pose parameters. To visualize with the suggested rviz configuration launch:

roslaunch ridgeback_viz view_robot.launch mode:=localization

When rviz appears, select the Set 2D Pose tool from the toolbar, and click on the map to indicate to the robot approximately where it is.

Mapping

Making a map using Gmapping

In this demonstration, Ridgeback generates a map using gmapping. Begin by launching the gmapping demo launch file (preferably on the robot):

roslaunch ridgeback_navigation gmapping_demo.launch

On your workstation, launch rviz with the suggested configuration:

roslaunch ridgeback_viz view_robot.launch mode:=gmapping

You must slowly drive Ridgeback around to build the map. As obstacles come into view of the laser scanner, they will be added to the map, which is shown in rviz. You can either drive manually using the interactive markers, or semi-autonomously by sending navigation goals (as above).

Occasionally, the gmapping algorithm will relocalize the robot, causing a discrete jump in the map->odom transform.

When you’re satisfied, you can save the produced map using map_saver:

rosrun map_server map_saver -f mymap

This will create a mymap.yaml and mymap.pgm file in your current directory.

Credits

This guide is based on the instructions present in the Clearpath Support Tutorials for their robots Ridgeback, Husky, Jackal, and Kingfisher.