A system that helps a robot to explore the world. By collecting measurements from the robot's sensors and telling the robot where to go next, it constructs a map of the world.
The robot can be either a real LEGO Mindstorms robot or a simulated one. It is easier to develop the logic using the simulated robot, but it is much more fun observing a physical robot wandering around.
The GIFs below show two examples - one with the LEGO robot (left/top) and one simulated (right/bottom). For the explanation of symbols, see below.
Here is how the above example with the LEGO robot looked like in practice (just much much slower):
- Red dots 🔴 and the solid black line: Position of the robot through time
- Gray circles 🌑 around the red dots: The size of the robot
- Orange dots 🟠 and the black dashed line: Planned path
- Blue dots 🔵: Detected obstacles
- Light green dots 🟢: Detected free spots (the sensor has a limited view and can't see obstacles further than that)
- Dark green dots 🟢: Possible locations to continue exploration
- Blue cells 🟦 in the grid: Expected obstacle positions
- Brown cells 🟫 in the grid: Expected free positions
- If the most recent version of Python that you have installed is below 3.8, you can't1. I'm sorry.
- Clone this repository.
- In the root directory, run:
make init
to create a virtual environment and install requirements,make run
to run the program.
- In the subsequent runs, only
make run
is needed.
That's it for the simulated robot! Nothing difficult, you should try it out2!
To change the world the robot is in, try changing WORLD_NUMBER
and
ROBOT_SIZE
in slam/config.py
. You can as well define your own world in
slam/world/simulated.py
.
- Check that you have Python 3.8 (or higher) installed on your computer.
- Build a robot - see what I have done.
- Clone this repository.
- Set HOST and PORT in
slam/config.py
andslam/mindstorms/slam_lego/config.py
. HOST should be the IP address of the EV3. Make sure the ports in both files are the same. - Connect your EV3 Brick to WiFi. You will need a USB WiFi Dongle.
- Upload the content of
slam/mindstorms/slam_lego
to your EV3 (I'm using ev3dev). - Run
python3 main.py
on the EV3. - On your computer, run the following from the root directory:
make init
make runlego
- In the subsequent runs, only
make runlego
is needed.
- Use a better path planning algorithm
- Improve scalability to be able to run on bigger worlds
- Decouple
ObservedWorld
,Planner
andPathPlanner
- Add touch and gyro sensors to the robot to help with orientation
1There is not so much Python 3.8 syntax. It should not be that difficult to rewrite the program in Python 3.7 - if you really want, feel free to do so.
2Developed on (Arch) Linux. Not tested on different platforms.