Skip to content

Python implementation of Bug algorithms on 3-wheel omnidirectional and Webots simulation.

Notifications You must be signed in to change notification settings

mohammadhashemii/Bug-Algorithms-Simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bug-Algorithms-Simulation

This is the course final project of the Fundamental of Robotics - Fall 2021 course at Shahid Beheshti University. This repository contains the Python implementation of Bug algorithms and simulation with 3-wheel omnidirectional robot in Webots simulation software.

Introduction to Bug algorithms

The Bug algorithm is perhaps the simplest obstacle-avoidance algorithm one could imagine. The basic idea is to follow the contour of each obstacle in the robot’s way and thus circumnavigate it. A number of variations and extensions of the Bug algorithm exist, otherwise we have implemented the three main ones in Python.

  • Bug 0: With Bug0, the robot begins to follow the object’s contour, but departs immediately when it is able to move directly toward the goal. In general this algorithm does not guarantees that the robot reach the goal.

  • Bug 1: With Bug1, the robot fully circles the object first, then departs from the point with the shortest distance toward the goal. This approach is, of course, very inefficient but it guarantees that the robot will reach any reachable goal.

  • Bug 2: With Bug2 the robot begins to follow the object’s contour, but departs immediately when it is able to move directly(on M-line) toward the goal. In general this improved Bug algorithm will have significantly shorter total robot travel. However, one can still construct situations in which Bug2 is arbitrarily inefficient.

You can see the behavior of simple Bug Algorithms here:

Implementation

We have implemented the three main bug algorithms in Python. Additionally, we simulated these algorithms on 3-wheel omnidirectional robot using Webots.

If your are just interested in controllers, there are three distinct Python files which bug algorithms have been coded there. The conrollers are in : SBU_omni_robot/controllers/final_controller/.

Algorithm Controller
Bug 0 BUG0_controller.py
Bug 1 BUG1_controller.py
Bug 2 BUG2_controller.py

Simulation

The simulation results in Webots are as follows. Also you can watch the full videos of the simulations here: Simulation Videos


Bug 0 snapshots:


Bug 1 snapshots:


Bug 2 snapshots:

How to run

For simulation, you need to install Webots software on your system. After installing Webots:

1. clone the repository
2. open /SBU_omni_robot project in Webots
3. Run and Happy Simulation!

State diagrams

For better intuition, we also plot the state diagram of these three main bug algorithms:

About

Python implementation of Bug algorithms on 3-wheel omnidirectional and Webots simulation.

Topics

Resources

Stars

Watchers

Forks

Languages