Skip to content

Implementation of a wall-following algorithm in a robot using an e-puck in Webots.

Notifications You must be signed in to change notification settings

Gandalf789/pathfinder-robot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pathfinding robot in a maze

Finding the shortest path outside a maze following a wall

Documentation

Contents


  1. Installing Webots
  2. Extracting the .zip file
  3. Opening the world file
  4. Before running the simulation
  5. Running the simulation
  6. How it works
  7. Editing the source code
  8. Structure of the code
  9. The enviroment

1. Installing Webots

  • On Linux, run the command sudo apt install webots in terminal to install the Webots app.
  • On Windows, install the official executable file from the Webots website and run it.

2. Extracting the .zip file

Extract the .zip file. It contains two folders:

  • worlds folder containing the world files
  • controllers folder with the actual source code for the controller of the e-puck

3. Opening the world file

To open the world file of this particular simulation you have to first

  1. open Webots, then
  2. go to File and
  3. click the Open World button.
  4. navigate then in the location where you extracted the .zip file
  5. go to Worlds and
  6. select one of the two simulation.

4. Before running the simulation

In some cases it may be neccesary to give running permission to the executable of the code manually.

If you run the simulation and the Webots console prompts you to do this:

  • open up a console
  • type $cd /location_of_the_extracted_folder/controllers/Comenzi
  • then to give executing permission type chmod u+x Comenzi

5. Running the simulation

To run the simulation simply click the play button from the above or press Ctrl+2

To increase the speed of the simulation press the button next to the play button or Ctrl+3

A console should pop-up in the bottom of the screen, if not, it can be activated using Ctrl+N

Running the simulationsimulation

6. How it works

-The robot must always begin from the left side (the left wall).

-The start line and the finish line are physically denoted by two small black tapes on the floor.

-The robot has four phases:

  1. Following the left wall from the start towards the finish line.
  2. Once arrived at the finish line, it stores the distance from the start line to the finish using left wall. It then continues its run along the same left wall.
  3. At the start line once again in stores the distance of the right wall.
  4. A last run is made following the shortest wall found towards the finish line.

6. Editing the source code

If you want to change the source code, select edit from the controller menu

Screenshot from 2024-01-01 17-59-08

  • Select the file you wish to edit then press open

  • Edit the code then build the code by pressing the Screenshot from 2024-01-01 18-03-24 button ( don't forget to save it before)

  • Press Reset the start the simulation

    7. Structure of the code

    The code is modularized in 4 different modules that are connected through an header file with the main source as shown below

    Screenshot from 2024-01-04 14-14-56

    More about every module can be found here

    8. The enviroment

    There are two world files included in the worlds folder, each one containing a maze.

    More about the world files can be found here

About

Implementation of a wall-following algorithm in a robot using an e-puck in Webots.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published