This repository contains the ROS2-based implementation for the final project in MEC-E5012: Vehicle Mechatronics - Control at Aalto University.
The task is to navigate a TurtleBot through a custom 5x5 maze track in Gazebo, avoiding obstacles and finding a valid path to the goal using autonomous control strategies.
Latest exercise update: September 15, 2025
- Implement a Python ROS2 node (
navigator.py) to control the TurtleBot. - Apply perception, control, and path planning strategies to navigate a challenging maze environment.
- Handle dynamic path planning using the A* algorithm when blocked.
- Avoid hardcoding: the solution must generalize to other mazes.
- Achieve robust and repeatable navigation performance.
project_track.zip– Maze track with obstaclesproject_track_no_obs.zip– Maze track without obstaclesvmc2_project.zip– ROS2 package containing simulation setup and template node
Implementation should be structured around the following modules:
- Detects whether a path between two nodes is blocked or passable using sensor data.
- Controls the robot’s motion through the maze using PID or other strategies.
- Avoids collisions with maze walls and obstacles.
- Computes the best route to the goal using A* algorithm.
- Recomputes when a path becomes blocked.
The TurtleBot uses a finite state machine with four key states:
FORWARD– Moves forward and checks passabilityBACKTRACK– Returns to the previous node if blockedREPLAN– Recomputes the path using A* if the current path is invalidDONE– Goal reached
- Start with the obstacle-free map for debugging and tuning.
- Avoid hardcoded paths or positions.
- Use built-in or custom PID controllers as needed.
- Rotate the TurtleBot at nodes before moving to the next segment.
- For testing, use teleportation commands to jump between checkpoints (see below).
Use these commands to teleport the robot (after stopping navigator.py):
Checkpoint 1
ros2 service call /set_entity_state gazebo_msgs/srv/SetEntityState "{
state: {
name: 'burger',
pose: {
position: {x: 3.560, y: -4.272, z: 0.0},
orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}
},
reference_frame: 'world'
}
}"Checkpoint 2
ros2 service call /set_entity_state gazebo_msgs/srv/SetEntityState "{
state: {
name: 'burger',
pose: {
position: {x: 4.984, y: -4.272, z: 0.0},
orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}
},
reference_frame: 'world'
}
}"Checkpoint 3
ros2 service call /set_entity_state gazebo_msgs/srv/SetEntityState "{
state: {
name: 'burger',
pose: {
position: {x: 7.120, y: -5.696, z: 0.0},
orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}
},
reference_frame: 'world'
}
}"| Criteria | Points |
|---|---|
| Complete maze without collisions | 60 |
| Finish within 2.5 minutes | 10 |
| Presentation at Gala | 5 |
| Each checkpoint reached | 20 each (max 60, partial credit available) |
Passing Threshold: 30 points
vmc2_project/
├── launch/
│ └── project.launch.py
├── models/
│ └── (Gazebo model files)
├── src/
│ └── navigator.py
├── world/
│ └── (Custom world files)
└── README.md
- Don't hardcode the maze layout or coordinates.
- Avoid modifying or deleting the provided structure unless necessary.
- Use the PID class only if your strategy needs it.
- Be consistent across test runs to ensure reliability.
- Start simple, debug in the no-obstacle map first.
This project is part of the academic course MEC-E5012 at Aalto University. Not intended for commercial or production use.