Skip to content

lakizuru/Turtlebot3-Maze-Solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Turtlebot3-Maze-Solver

A simple Python/ROS controller for solving a maze using the TurtleBot3 Burger.

This repository contains a single-node ROS program (main.py) that reads laser scans and odometry to perform wall-following, detect openings (doors), and navigate around cylindrical obstacles. The code was written for educational/demo purposes (assignment artifact in Docs/).

Quick summary:

  • Language: Python 2/3 with rospy (script currently uses Python-style ROS APIs)
  • Robot: TurtleBot3 Burger (uses /cmd_vel, /scan, /odom topics)
  • Main file: main.py

Note about platforms: This project is intended to run in a ROS environment (typically Ubuntu with ROS). If you're on Windows, run it inside WSL2/Ubuntu or a Linux VM with ROS installed.

Tested / expected environment

  • Ubuntu 18.04/20.04 with ROS Melodic/Noetic (the code uses rospy and tf.transformations)
  • TurtleBot3 packages installed (turtlebot3 and turtlebot3_simulations if using Gazebo)

Contents

  • main.py - controller node: subscribes to /scan and /odom, publishes to /cmd_vel.
  • Docs/ - assignment PDF and screenshots documenting the original work.

Prerequisites

  • ROS installed (Melodic/Noetic as appropriate for your Ubuntu version)
  • turtlebot3 packages (for robot definitions, URDF, and simulation launch files)
  • Python rospy and tf packages (installed with ROS)

Installation / Setup

  1. Clone this repository into your ROS workspace (example ~/catkin_ws/src):
cd ~/catkin_ws/src
git clone https://github.com/lakizuru/Turtlebot3-Maze-Solver.git
cd ~/catkin_ws
catkin_make
source devel/setup.bash
  1. Install TurtleBot3 packages (if not already installed):
# Example for ROS Noetic on Ubuntu 20.04
sudo apt update
sudo apt install ros-noetic-turtlebot3 ros-noetic-turtlebot3-simulations
  1. Set the TurtleBot3 model environment variable (example):
export TURTLEBOT3_MODEL=burger

Running the node

The main.py script is a standalone ROS node. You can either run it from a ROS package using rosrun (recommended) or run it directly after sourcing your workspace. Example steps for simulation using TurtleBot3 in Gazebo:

# start roscore (if not already running)
roscore &

# in a new terminal: launch turtlebot3 world (Gazebo)
export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_gazebo turtlebot3_world.launch

# in another terminal: run this node (assumes repo is in a sourced workspace)
rosrun Turtlebot3-Maze-Solver main.py

If you do not have the code inside a ROS package, create a small package and place main.py in the scripts/ folder with executable permissions, then catkin_make.

Notes & configuration

  • Goal positions used by the node are hard-coded near the top of main.py in the DES_POS1..DES_POS5 variables. Adjust these if you want to change target coordinates.
  • The node expects a standard sensor_msgs/LaserScan on /scan and nav_msgs/Odometry on /odom.
  • The logic is simple and geared toward demonstration; you may want to harden it for production (robustness to NaNs/inf, dynamic reconfiguration, parameterization).

Contributing

  • If you want to contribute, consider:
    • Moving the code into a proper ROS package with package.xml and CMakeLists.txt.
    • Adding a ROS launch file and command-line parameters for configurable goals.
    • Adding unit tests for helper functions and simulation CI.

Acknowledgements

  • This repository contains an assignment PDF in Docs/ which documents the original coursework that this code was created for.

License

  • No license is included. If you want to make this repository public, add a suitable open-source license (e.g., MIT, Apache-2.0) in a LICENSE file.

Releases

No releases published

Packages

No packages published

Languages