top of page

Challenge 10: Stay Away From The Edge

  • rainbowsandalex
  • Apr 28, 2016
  • 2 min read

In today's challenge we were asked to program a robot to drive around on a table, but never fall off.

It has to drive forwards until it reaches the edge, then turn around and go in a different direction.

it then has to repeat this process until manually stopped

Program requirements:

- Must be able to sense the edge of the table

- Must be able to back up fast enough after sensing the edge that it doesn't fall off

- Must go slow enough that it has time to register the edge before falling

Assumptions:

- Will check for change of colour as opposed to detecting a certain colour like usual

Restrictions:

- Detecting the edge in time

- Detecting the edge at all

- At certain angles the wheel may fall before the sensor goes over the edge

Pseudocode:

Begin Loop

- Drive in straight line

- Constantly check for change of colour

- Drive until colour changes

- Stop when colour change is detected

- After stopping back up and turn around

End loop

In this challenge I learned how to use the reflected light intensity setting of the colour sensor, which is something I had never used before.

I would say that everything went pretty well. The program does exactly what it is supposed to and 99% of the time it works perfectly.

The only issue I encountered was that at certain angles, the right wheel of the robot would fall off the table before the sensor went over the edge.

This did happen so rarely that there was no way to really optimize it, and I barely have to worry about it considering how rarely the robot will happen to go at that exact angle.

This is how the code looked

My goals for the next challenge would be to make sure my code is completely bug free, and every possible way for it to mess up has been solved and dealt with.

This is how the robot looked


 
 
 

Comments


© 2023 by BI World. Proudly created with Wix.com

  • Facebook Basic Black
  • Twitter Basic Black
  • YouTube Basic Black
bottom of page