Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic obstacle avoidance #13

Closed
axe007 opened this issue Apr 6, 2021 · 0 comments · Fixed by #14
Closed

Basic obstacle avoidance #13

axe007 opened this issue Apr 6, 2021 · 0 comments · Fixed by #14
Assignees
Labels
assignment Tasks and codes related to course assignments C++ C++ coding task

Comments

@axe007
Copy link
Contributor

axe007 commented Apr 6, 2021

Task

Create simple Arduino sketch that performs basic obstacle avoidance with a Smartcar. Specifically, you need to make the Smartcar move forward until it detects an obstacle at a distance of your choosing.

Acceptance criteria

  • Sketch file compiles without errors and runs on emulator
  • Logic detects objects and take automatic actions depending on whether object is a tree, wall or hillside.
  • Additional features to make map exploration more random and complete if possible

Submission

Create a pull request with the necessary code and provide the link to it. Optionally add @platisd to it as a reviewer. This sketch can become the basis of your future code-base but it is up to you if you are going to eventually use it or not.

@axe007 axe007 added C++ C++ coding task assignment Tasks and codes related to course assignments labels Apr 6, 2021
@axe007 axe007 self-assigned this Apr 6, 2021
axe007 added a commit that referenced this issue Apr 7, 2021
## Initial implementation for obstacle avoidance. Needs more work.

### Basic features:
* SmartCar start off with random speed, angle and distance to randomize each drive.
* Slows down when UltraSonic sensor detects anything within 3 meters in front.
* Slowly approach the object, start avoiding when within 1 meter.
* Reverse backwards until there is something detected in back IR sensor with 50 centimeters.
* "Tries" to avoid wall to the left or right depending on additional left or right sensors.
* If car is "drive" mode, but speed is too slow, the car tries to unstuck itself by reversing a bit and going forward slow again.

### Further improvements planned:
* Overall sketch structure, methods and calls need to be cleaned up. Bit messy due to initial starting approach.
* Need to research gyroscope capabilities and detect going uphill or downhill.
* Need to resolve tree avoidance as car starts going forward without completely clearing an obstacle.

Contributes to #13
axe007 added a commit that referenced this issue Apr 10, 2021
## Updated implementation for obstacle avoidance.

### Basic features:
* Uses enum for car's driving modes.
* SmartCar start off with random speed (40-60), angle (-45 to 0) and distance (100-150 meters) to randomize start of the each drive.
* Slows down when UltraSonic sensor detects anything within 2.5 meters in front.
* Slowly approach the object, start avoiding when within 2 meters.
* Car takes ultrasonic measurement and swerves to left for 1.5 seconds, then takes 2nd measurement.
* Car "tries" to guess the angle of approach based on those 2 measurements and will try either left or right move to "clear" the object. This logic still needs more testing and refinement.
* Reverse backwards until there is something detected in back IR sensor with 50 centimeters.
* "Tries" to avoid wall to the left or right depending on additional left or right sensors.
* If car is "drive" mode, but speed is too low, the car tries to unstuck itself by reversing a bit and going forward slow again.

### Further improvements planned:
* Need to research gyroscope capabilities. Drive to preset heading and "resume" same heading after obstacle avoiding maneuver.

Implements to #13
@axe007 axe007 linked a pull request Apr 10, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assignment Tasks and codes related to course assignments C++ C++ coding task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant