Giter VIP home page Giter VIP logo

slam-with-lego-mindstorms's Introduction

SLAM with LEGO Mindstorms

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.

Examples

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.

An example of the LEGO robot An example of a simulated robot

Here is how the above example with the LEGO robot looked like in practice (just much much slower):

LEGO robot in action

Explanation of the map:

  • 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

How do I run it?

  1. If the most recent version of Python that you have installed is below 3.8, you can't1. I'm sorry.
  2. Clone this repository.
  3. In the root directory, run:
    1. make init to create a virtual environment and install requirements,
    2. make run to run the program.
  4. 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.

But I have a LEGO EV3 Brick and I want to see it in action!

  1. Check that you have Python 3.8 (or higher) installed on your computer.
  2. Build a robot - see what I have done.
  3. Clone this repository.
  4. Set HOST and PORT in slam/config.py and slam/mindstorms/slam_lego/config.py. HOST should be the IP address of the EV3. Make sure the ports in both files are the same.
  5. Connect your EV3 Brick to WiFi. You will need a USB WiFi Dongle.
  6. Upload the content of slam/mindstorms/slam_lego to your EV3 (I'm using ev3dev).
  7. Run python3 main.py on the EV3.
  8. On your computer, run the following from the root directory:
    1. make init
    2. make runlego
  9. In the subsequent runs, only make runlego is needed.

What can be done next?

  • Use a better path planning algorithm
  • Improve scalability to be able to run on bigger worlds
  • Decouple ObservedWorld, Planner and PathPlanner
  • 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.

slam-with-lego-mindstorms's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jimmyh99

slam-with-lego-mindstorms's Issues

Need to help!

Hi! I have a couple of questions about your work. What method was used here? Kalman filter or particle filter? How does it all work?
I don't quite understand the principle by which the next point is selected to move the robot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.