Bang-Bang:
Our first thought was to make the sciborg follow a straight line when it detected the brightest part of the tape. When it detected darkness, it would rotate to find the bright path again and continue on it.
Several frustrating iterations for this method proved fruitless and Professor Banzaert advised us to allow the sciborg to follow the edge of the tape rather than the center. We found the brightness sensor to read the edge as 535. The following code moves the sciborg forward when it it detects the edge and turns left to search for the edge when it no longer detects it.
Proportional:
This was the most difficult part of the most difficult project! Our goal was now to implement proportional control. This meant that our sciborg will be constantly moving instead of stopping and searching for the edge.
We first calculated our error = current brightness detected - desired brightness = 475
Then we calulated our gain = largest error/total brightness = 1.1
We coded our sciborg so that when it detects a brightness greater than 475 it would search left and search right when it detected the white tape.
The numbers in this code are the result of over 30 iterations and changes in our gains, error, speed, parameters etc, to reach this final stage. Although it isn't perfect, it was close! Allowed more time and patience, we would continue to play with the numbers to make it perfect.
Notes:
- And interesting observation we made was that when we used a code that worked on a another groups sciborg, it would not work for our sciborg. Till this day we are not sure why.
- This was hard.
- I will forever be afraid of the combination of motors and brightness sensors.




No comments:
Post a Comment