Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Python implementation of Bug2 algorithm to navigate a quadcopter/multirotor in the AirSim simulator.

License

NotificationsYou must be signed in to change notification settings

MehdiShahbazi/AirSim-Multirotor-Bug2-Algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository contains a python implementation of the Bug2 algorithm for path-planning and obstacle-avoidance of a multirotor in the AirSim simulator.

Introduction to Bug Algorithms

Bug algorithms belong to a category of path-planning methods that take inspiration from maze-solving algorithms. They are specifically designed to navigate in environments with no knowledge about obstacles and rely solely on the relative positioning of their target. These algorithms move towards their destination by following the boundaries of obstacles they encounter.There are several variations of the Bug algorithms that currently exist[1]:

  1. Com:Common Sense algorithm, abbreviated asCom, initiates by tracing the shape of the object, but it quickly deviates from its path when it has the opportunity to head straight towards the goal. In general, this algorithm doesn't ensure that the robot will reach its destination successfully.

  2. Bug 1: When confronted with an obstacle, Bug 1 starts by exploring the obstacle's entire border while simultaneously figuring out the nearest position to the target. After reaching this initial point of contact, Bug 1 moves towards the closest position to the target and then deviates from the obstacle at that specific point. Bug 1 excels in environments where Com's performance falls short.

  3. Bug 2: Bug 1 tends to generate longer paths than necessary because it needs to map the entire border of the obstacle. However, Bug 2 introduces a new concept called M-line, which is an imaginary line drawn between the starting and target positions. Bug 2 follows along the obstacle's border until it reaches the same M-line on the opposite side. If the point on this M-line is closer to the target than where it currently hit the obstacle, Bug 2 will then navigate away from it.

Bugs_1

The behavior of simple Bug Algorithms.

Bugs_1

Generated paths by Bug Algorithms.

Requirements

The code is written in Python 3.8 and has been tested on Windows 10 without any issues. It utilizes the following libraries:

airsim==1.8.1numpy==1.22.0

Additionally,Unreal Engine 4.27 is required to simulate the environment.

Usage

  1. Clone the repository.
  2. Navigate to the./AirSim_Settings directory, then copy thesettings.json file and paste it into the./Users/YourUserName/Documents/AirSim directory.
  3. Download the environment precompiled binaries fromhere.
  4. Unzip the downloaded file, then go to the./Environment Bug2/WindowsNoEditor directory and launchEnvironment_1.exe.
  5. Navigate to./Bug2 directory and runAutoPilot.py and enjoy the simulation.

Please note that each run maynot always successfully complete due to potential noise in the quadcopter's movement and sensors. If a run fails, consider re-running the code.

Multirotor Trajectory Visualization

In theAutoPilot.py script, the default setting for thesave_plot_list variable isTrue. After a successful run, a compressed pickle file namedpath_plot_points.pbz2 is generated in the./Bug2/Saved directory. You can visualize the trajectory points in two ways:

  1. Set theplot_path_planning variable fromFalse toTrue in the script. This will continuously plot the trajectory points in real-time as the multirotor moves towards its target destination.
  2. Go to the./AirSim_Settings directory. Copy thesettings_computervision.json file and paste it into the./Users/YourUserName/Documents/AirSim directory. Rename the file fromsettings_computervision.json tosettings.json. Finally, run./Bug2/PathPlot.py to plot the saved trajectory points separately. You can control the camera using the keyboard's A, W, S, D, and arrow keys.

Showcase

You can view examples of movement through the following GIFs, providing a visual showcase of navigation.

Full Video Demonstration

For a more in-depth demonstration, please visitthis link to observe the multirotor navigation in action within the AirSim simulator.

Acknowledgement

This repository is inspired by the work ofMohammad Hashemi, a fellow alumnus who has implemented the Bug algorithms on a 3-wheel omnidirectional robot in theWebots simulator. You can find his workhere.

References


[8]ページ先頭

©2009-2025 Movatter.jp