Skip to content

Running in simulation

Shobhit Singhal edited this page Jul 10, 2023 · 13 revisions

Basic Usage

First, Navigate to you catkin workspace and source it. Then, start the simulation in Gazebo and RViz, by running:

$ roslaunch smb_gazebo sim.launch tracking_camera:=true world:=planner_tutorial launch_gazebo_gui:=true

Once the simulation is started, start the local and global planners. If you want to use OMPL-based global planners, run:

$ roslaunch smb_navigation navigate2d_ompl.launch sim:=true global_frame:=tracking_camera_odom

Otherwise, to use a standard global planner from move_base, run:

$ roslaunch smb_navigation navigate2d.launch sim:=true global_frame:=tracking_camera_odom

It is now time to give a goal to the planner. To send a global goal position there a set of different possibilities:

  • Set a goal with the planning panel and press the button Start Planning;
  • Use RViz direcly by using the button 2D Nav Goal and setting the goal pose;
  • Publish directly on the topic /move_base_simple/goal.

Make sure that the goal is given in the tracking_camera_odom frame.

Tuning

It is possible to change some of the parameters online by using the rqt_reconfigure tool ($ rosrun rqt_reconfigure rqt_reconfigure), such as:

  • Local planner parameters (e.g. robot velocity and acceleration);
  • Global / Local costmaps (e.g. activate / deactivate layers).

Advanced usage

In the following, additional features of the path planner are introduced. Notice that all these features are supported both in the case of the OMPL-based global planner and the global planner from move_base. They can also be used both in simulation and with the real robot.

Specification of odometry topic

To use a different odometry topic than the default one, you need to specify it when launching the planner. There are two options:

  1. Edit the launch file;
  2. Specify the reference frames from command line.

For example, if the odometry topic is /odom, then the command looks like:

$ roslaunch smb_navigation navigate2d_ompl.launch odom_topic:=/odom

To check if the odometry topic is set correctly, check that you get this message in the terminal where you run the planner: odom received!.

Specification of reference frames

To use reference frames for planning that are different from the default ones, you need to specify them when launching the planner.
There are two options:

  1. Edit the launch file;
  2. Specify the reference frames from command line.

For example, if the global frame is now called odom and the base frame of the robot is base, then the command looks like:

$ roslaunch smb_navigation navigate2d_ompl.launch global_frame:=odom robot_base_frame:=base

To check if the reference frames are set correctly, check that both the global costmap and the local costmap look reasonable in RViz.

Use pre-existing global maps

If an existing global map is available, it makes sense to use it for global planning. The global planner can accept maps are in the format specified here. In this section you can find the instructions on how to generate such maps.

To use a global map:

  • Specify the path to the map. Similar to before this can be done either in the launch file (change the parameter global_map to the yaml file of the map) or in the command line (set the global_map argument to the global path including the name of the map);
  • Run the planner specifying you want to use a global map for planning. Also, specify a map frame that aligns the global map correctly:
  $ roslaunch smb_navigation navigate2d_ompl.launch sim:=true global_frame:=world_graph_msf use_global_map:=true map_frame:=map_graph_msf
  • If no map frame (which corresponds to the origin of the global map) is available, the global_frame must coincide with the global map origin for the global map to align well:
  $ roslaunch smb_navigation navigate2d_ompl.launch sim:=true global_frame:=tracking_camera_odom use_global_map:=true

In this case, the global map uses only the map created offline. To update the map with laser scans, activate the obstacle_layer and the inflation_layer of the global costmap by using the rqt_reconfigure tool ($ rosrun rqt_reconfigure rqt_reconfigure).

Notice that it is necessary to specify a global reference frame that is the same as the one of the global map. If everything is set up correctly, the global map loaded from memory should show up in RViz.

How to follow multiple waypoints

To automate missions, it is possible to specify a list of waypoints to follow. This functionality is based on the follow_waypoints package.

To follow multiple waypoints, run this command:

$ roslaunch smb_navigation navigate2d_ompl.launch sim:=true global_frame:=tracking_camera_odom follow_waypoints:=true

The waypoints can be specified either as a csv file, or they can be set online using RViz.

  • To use an input file, specify the path to the file in smb_path_planner/smb_navigation_scripts/launch/follow_waypoints.launch (parameters: output_folder, input_filename);

    • To start the mission, call the topic: $ rostopic pub /start_journey std_msgs/Empty -1
  • To specify the waypoints online, use the 2D Pose Estimate button in RViz to specify the target poses as an ordered list;

    • To start the mission, call the topic: $ rostopic pub /path_ready std_msgs/Empty -1
    • In this case, the waypoints will be stored in a file (parameters: output_folder, output_filename in the launch file).

This tool makes a lot of sense if used in combination with a global occupancy map created offline.

Running with traversability estimation

Note: This component has not been fully tested yet!
Note: In order to use this feature, make sure that the traversability_estimation package is installed (link).

Start the simulation as in the previous case, and then run:

$ roslaunch smb_navigation navigate2d_ompl.launch run_traversability:=true

Notice that in this case, there are 3 different cost layers (static, laser scans and inflation layers), but only the static layer is active.

It is also possible to use a custom layer (traversability_layer). To use it, follow the instructions in the configuration file smb_navigation/config/move_base_costmaps/local_costmap_params_traversability.yaml.

In this case, notice that it is not possible to run the obstacle layer (based on laser scans) and the traversability layer at the same time in the current configuration, as the laser scan clears the traversability map. You are more than welcome to find a proper way to fuse these two maps!