Interbotix / interbotix_ros_rovers

ROS Packages for Interbotix Rovers
BSD 3-Clause "New" or "Revised" License
31 stars 31 forks source link

Feature: Add slam_toolbox option for navigation2 #33

Closed stephenadhi closed 1 year ago

stephenadhi commented 1 year ago

Hi,

I hope the commits and coding style fit your conventions. So in this PR, I have finished your _slam_toolboxdevel branch. Everything is now integrated into the humble version and running smoothly using simulation.

Summary

[xslocobot_descriptions]

  1. lidar.urdf.xacro
    • Appended missing namespace to the LaserScan topic.

[xslocobot_nav]

  1. xslocobot_slam_toolbox.launch.py

    • Added sync slam toolbox node in slam_toolbox.launch.py (previously only async and localization).
    • Added launch argument of use_slam_toolbox: 'true' and passing slam_mode when including the nav2_bringup launch file.
    • Added launch argument of map yaml file in the case of localization mode (default=' ').
  2. xslocobot_nav2_bringup.launch.py

    • Galactic to Humble migration: rename the nav2_recoveries to nav2_behaviors.
    • Added _tfremappings to specific nodes following https://github.com/ros-planning/navigation2/tree/humble/nav2_bringup/launch.
    • Added launch argument use_slam_toolbox (default: false).
    • Automatic launching of nav2_nodes such as amcl, lifecycle manager slam, lifecycle manager localization, map server, and map saver server, conditioned on the slam_mode and use_slam_toolbox launch arguments.
  3. nav2_params.yaml

    • Galactic to Humble migration: rename the nav2_recoveries to nav2_behaviors.
    • Fix costmap issues (sensor out of bounds error), change default values.
    • Global costmap default: height x width 20 x 20m, resolution: 0.1.
    • Place robot at the centre of the global costmap (origin -10.0, -10.0).
    • Local costmap default: height x width 5 x 5m, resolution: 0.05.

[xslocobot_sim]

  1. xslocobot_gz_classic.rviz
    • Additional RViZ config for visualizing map and costmap topics.
    • Change scan topic to /locobot/scan.

Testing

  1. Launch simulator with RViZ ros2 launch interbotix_xslocobot_sim xslocobot_gz_classic.launch.py robot_model:=locobot_base robot_name:=locobot use_lidar:=true use_rviz:=true use_gazebo_gui:=true
  2. Launch slam_toolbox ros2 launch interbotix_xslocobot_nav xslocobot_slam_toolbox.launch.py launch_driver:=false slam_mode:=online_sync

image

  1. Move the robot around by publishing the twist messages to the topic _/locobot/diffdrive_controller/cmd_velunstamped

image

stephenadhi commented 1 year ago

Hi Luke,

I applied the changes, and should be ready to merge!

A note regarding localization mode: I found that slam_toolbox needs to take in a pose-graph map instead of a yaml file. So I suggest only using amcl when bringing up the nav2 nodes and remove localization option offered by slam_toolbox.

I also found more issues with nav2, for example, the new syntaxes in nav2_behavior_server and failing to plan when given a goal.

I should be able to fix those issues by next week or so, and make new PRs. Please let me know whether you would like to actively work on these issues, so we don't work on the same thing!

Thanks,

Stephen

lukeschmitt-tr commented 1 year ago

@stephenadhi

Please let me know whether you would like to actively work on these issues, so we don't work on the same thing!

Yes, please do! Thanks again for your great contributions!