This project extends Nav2 with the ability to navigate across multiple maps, using a custom action and a wormhole database. Compatible with ROS 2 Humble.
This package contains codes to run the Nav2 System and the Multi-Map System. Multi-Map system uses BFS to find paths between maps that are not directly connected through a wormhole.
- Navigate to goals that may exist in different maps.
- Handle map switching dynamically.
- Access wormhole connections between maps.
- Provide a custom action server (multi_map_navigate).
# Goal
string target_map
float64 x
float64 y
float64 yaw
---
# Result
bool success
string message
---
# Feedback
string current_map
This package contains codes to run SLAM (slam_toolbox) and the Map Saver node which saves the map as well as wormhole coordinates straight into SQL DB through an exposed service.
- Perform Mapping
- Automate storage of map details into a SQL DB
# Request
string map_from
string map_to
string map_name
---
# Response
bool success
string message
Location: maps/multimap.db
CREATE TABLE wormhole (
map_from TEXT,
map_to TEXT,
x REAL,
y REAL,
yaw REAL
);
Each row defines a wormhole:
- map_from: Source map name
- map_to: Target map name
- (x, y, yaw): Pose of wormhole in the source map Each connection is bidirectional, so two entries are inserted.
This package contains necessary URDF and Xacro files for simulation.
This package contains custom WASD / Arrow key Teleop node.
This package contains launch files to run the simulation.
sudo apt update
sudo apt install sqlite3
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install
Note: Source every terminal hence forth
ros2 launch simulation_pkg sim.launch.py
ros2 launch anscer_slam slam_launcher.launch.py
ros2 run anscer_slam wormhole_saver_service
Sample Call:
ros2 service call /save_wormhole anscer_slam/srv/SaveWormhole "{map_from: 'Hallway', map_to: 'Room1', map_name: 'Hallway_map'}"
ros2 run anscer_teleop teleop_node
ros2 launch anscer_navigation anscer_bringup.launch.py
ros2 run anscer_navigation multi_map_node
Sample Goal:
ros2 action send_goal /multi_map_navigate anscer_navigation/action/MultiMapNavigate "{target_map: 'Room1', x: 0.0, y: 0.0, yaw: 0.0}"
flowchart TD
subgraph SLAM_Map_Creation["SLAM & Map Saving"]
A1[Run SLAM Toolbox / slam_toolbox] --> A2[Explore environment]
A2 --> A3[Save map with map_saver]
A3 --> A4[Generate map.yaml + map.pgm]
end
subgraph Database_Setup["Database Setup"]
B1[Create SQLite multimap.db] --> B2[Insert wormhole entries]
B2 --> B3[Each wormhole: from_map, to_map, x, y, yaw]
end
subgraph Localization["Localization & Odometry"]
C1[AMCL Node] --> C2[Uses map + laser scan + odom]
C2 --> C3[Publishes pose in map frame]
C1 --> C4[Requires initial pose after map switch]
C5[Odometry Source e.g. gazebo/odom] --> C2
end
subgraph MultiMap_Navigation["Multi-Map Navigation Node"]
D1[User sends MultiMapNavigate Action Goal] --> D2{Is target map == current map?}
D2 -- Yes --> D3[NavigateToPose Action Client] --> D4[Robot navigates to target pose] --> Z[Success]
D2 -- No --> D5[Find Path via Wormholes in multimap.db]
D5 -->|No path| D6[Abort: No wormhole path found]
D5 -->|Path found| D7[Traverse wormhole sequence]
D7 --> D8[Navigate to wormhole exit pose]
D8 -->|Success| D9[Switch Map via LoadMap Service]
D9 -->|Success| D10[Set AMCL initial pose for new map]
D10 --> D11[Update current_map]
D11 --> D7
D7 -->|Last wormhole reached| D12[NavigateToPose to final goal]
D12 --> Z[Success]
end
SLAM_Map_Creation --> Database_Setup
Database_Setup --> MultiMap_Navigation
Localization --> MultiMap_Navigation
- Once Map Switches, Re-initialization of Map doesn't take place if you have created the new Room map in the same SLAM Session without resetting Odometry.
- Certain File Paths are Hardcoded.
- Launch File Creation Left to make it easier to use.