Following previous success fixing laser scan drift, I have upgraded the Perceptor robot from a basic SLAM platform into a modular autonomous navigation system with advanced features like keepout zones and variable speed control.
Overview
In the previous entry, I addressed laser scan drift on an RPLiDAR-equipped iRobot Create 2. After frame correction and sensor calibration, SLAM stability was achieved. This post focuses on the transition from mapping to fully autonomous navigation using ROS 2 and Nav2.
SLAM to Navigation with Nav2
Autonomous navigation requires multiple components beyond SLAM:
-
Localization: Determining robot pose on a known map
-
Path Planning: Computing viable paths to target poses
-
Obstacle Avoidance: Adapting to static and dynamic objects
-
Motion Control: Executing velocity commands safely
ROS 2’s Navigation Stack (Nav2) enables this functionality but demands hardware-aware configuration.
Replacing SLAM with AMCL
I replaced SLAM with AMCL (Adaptive Monte Carlo Localization) to localize using a static map. This allowed me to retain the same sensor suite while shifting to a particle filter approach:
amcl: ros__parameters: laser_model_type: "likelihood_field" max_particles: 2000 min_particles: 500 initial_pose: x: 0.0 y: 0.0 yaw: 0.0
Despite a minimal sensor stack, AMCL yielded reliable localization across varied test environments.
Modular Launch Design
To streamline development and debugging, I adopted a modular launch approach across four terminals:
# Terminal 1: Base and sensor drivers ros2 launch perceptor launch_robot.launch.py # Terminal 2: Localization ros2 launch perceptor localization_launch.py map:=home.yaml # Terminal 3: Nav2 stack ros2 launch perceptor navigation_launch.py # Terminal 4: Optional filters and extensions ros2 launch perceptor keepout_extension.launch.py
Benefits:
-
Isolated debugging per component
-
Independent lifecycle control
-
Scalable architecture for feature integration
-
Faster iteration during development
Keepout Zones via Costmap Filters
To restrict the robot from entering specific regions, I implemented keepout zones using Nav2's costmap filters. Required components:
-
Binary mask image defining exclusion zones
-
Filter info server to define spatial metadata
-
Integration with global costmap
Correct alignment between map and mask was critical. Misalignment led to unintended path planning behavior.
keepout_filter: plugin: "nav2_costmap_2d::KeepoutFilter" enabled: True filter_info_topic: "/costmap_filter_info"
Configuration Issue: Missing Publisher
Initial implementation failed due to the absence of a speed limit publisher:
ros2 topic info /speed_limit --verbose # Publisher count: 0 <- No effect on speed
Adding the following parameter resolved the issue:
speed_filter: plugin: "nav2_costmap_2d::SpeedFilter" enabled: True filter_info_topic: "/speed_filter_info" speed_limit_topic: "/speed_limit"
Without this, the filter parses the mask but never communicates velocity limits to the controller.
Integration Challenges
Coordinate Frame Alignment
All masks and maps required:
-
Identical origins
-
Same resolution (0.05 m/pixel)
-
Cross-verification tools to ensure alignment
Simultaneous Filter Operation
Running multiple filters required:
-
Unique topic names
-
Independent node lifecycles
-
Distinct map servers per filter
Performance Optimization
On Raspberry Pi 5:
-
CPU usage was monitored during planning
-
Memory overhead increased with additional costmap layers
-
Modular design enabled disabling unused filters to conserve resources
Current Capabilities
Perceptor now supports:
-
Stable indoor localization (±5 cm)
-
Obstacle avoidance and path planning (planning time < 200 ms)
-
Keepout enforcement with high spatial precision
-
Speed-controlled navigation based on map zones
-
Modular launch for component-based deployment
Best Practices and Takeaways
-
Configuration Depth: Many critical parameters are buried in reference docs or only mentioned briefly.
-
Launch Modularity: Greatly improves debugging and experimentation.
-
Tooling: Developed utility scripts for verifying map alignment and topic health.
Roadmap
Planned enhancements:
-
Waypoint Follower: Multi-point missions and patrols
-
Dynamic Obstacles: Real-time costmap updates for moving objects
-
Fleet Support: Multi-robot coordination
-
Sensor Fusion: IMU and camera integration for robust localization
Vipin M
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.