Autonomous navigation stack for a simulated robot: costmap from lidar, persistent global map, A* path planning, and Pure Pursuit for path following. Built as four ROS 2 nodes that communicate over standard topics.
In this repo: costmap turns lidar into an occupancy grid and inflates obstacles; map_memory merges costmaps into a global map using odometry; planner plans paths with A* and publishes them; control tracks the path using Pure Pursuit and publishes twist commands.
- A on a grid* — planner_node.cpp uses a min-heap open set (
std::priority_queue) with a custom comparator andstd::unordered_mapwith a custom hash forCellIndexso cells can be used as keys forcame_fromandg_score. - Quaternion → yaw — Control and map_memory use tf2
QuaternionandMatrix3x3::getRPY()to get robot yaw for heading and for transforming local costmap cells into the global map frame. - Periodic work with wall timers — Planning, control, and map updates are driven by
create_wall_timer(e.g. 500 ms planner, 100 ms control loop) instead of blocking loops. - Occupancy grid as 1D buffer — Grids are stored as
std::vector<int8_t>with row-major indexing (y * width + x) in costmap_node.cpp, map_memory_node.cpp, and planner. - Oriented robot footprint — planner_node.cpp samples a rectangle in robot frame and transforms points to world frame with the current yaw to check occupancy for the robot's footprint along the path.
- Costmap inflation — costmap_node.cpp inflates each lidar hit with a distance-based cost decay (e.g.
100 - (dis/inflation_radius)*100) over a local grid window. - Pure Pursuit — control_node.cpp uses a fixed lookahead distance to pick a target pose on the path, then computes linear and angular velocity from the heading error and distance to goal (proportional gains).
- ROS 2 — Node runtime, topics, and build integration.
- C++ — C++17; used for all robot packages.
- Docker — Containerization for build and run.
- Foxglove — Visualization (see config for layout).
- CMake — Build system via ament_cmake for ROS 2 packages.
├── README.md
├── LICENSE
├── modules/ # Env / secrets (e.g. .env)
├── config/ # Root config (e.g. Foxglove layout)
└── src/
├── robot/ # Four ROS 2 navigation packages
│ ├── costmap/ # Lidar → occupancy grid + inflation
│ │ ├── config/
│ │ ├── include/
│ │ └── src/
│ ├── control/ # Pure Pursuit path following, cmd_vel
│ │ ├── config/
│ │ ├── include/
│ │ └── src/
│ ├── map_memory/ # Costmap → global map with odometry
│ │ ├── config/
│ │ ├── include/
│ │ └── src/
│ └── planner/ # A* path planning
│ ├── config/
│ ├── include/
│ └── src/
└── samples/ # Sample C++ and Python packages
├── cpp/
│ ├── producer/
│ └── transformer/
└── python/
├── producer/
└── transformer/
