Friday, March 11, 2016

Sensors & Bang Bang Control

We continue where we left off: moving our SciBorgs around, but this time with sensors and bang bang control so we can maneuver the SciBorg more precisely.

Motor Encoder: This sketch enables us to see the exact position of the wheel with the serial print code. We observed that the motor position does not go back to zero despite the motor going forward for 1 second and backwards for 1 second. We concluded that this is because the forward and backwards motions are added up in separate lines of code and they are not equal because they are taking the real life position, we tested they out by forcibly making the motor stop with our hands. In real life there are many variables that cause the motors to behave differently, including the degradation of motors over time, friction and much more which accounts for the non-zero differences between the forward and backwards total readings.

When we tested moving 10 feet with the motor encoder we found out that is it not every consistent due to the wonky path of the SciBorg, it would vary from ending 6 inches away from the 10 ft mark to right on top.
















Touch Switch using this was very straightforward, although a good note to self is to always check what the code is printing in because we thought our circuit was somehow wrong because we were not using the right baud to read the print. We played with the delay a little because the 10 millisecond delay was printing out the input really fast, but concluded that 10 millisecond delay is probably the most effective.
When we tried the touch sensor on the car, it was very effective but not particularly useful because it had to be touching the surface.






Light Sensor: Using the light sensor was more tricky because there are a lot of shadows which are all dependent on the light source so it is challenging to get a perfect precise distance to put it at. We tested out the optimum reading for a white surface is around 90, for black surface 0, for brown surface around 30-40. The highest we have seen it read is 97, which we got by shining our phone light on the light sensor. When we put the sensor really close to a surface the numbers near 0.  We also tried putting on the LED which did not help at all, it instead made the range of inputs way smaller, almost reading the tan desk as 0. Finally after much trial and error we measured the ideal distance to be 1.5 cm


















Ultrasonic Sensor: As Amy said in class, sonic sensors are not very precise forms of input when we tested it out we found that: 150= white noise, 11= 6 in, 17 ~10 in
Surprisingly when we tested out the sensor worked pretty well, although it was definitely not very precise because it did not stop at exactly where we wrote it to in the code.









 





























Drive Straight: While driving straight seems like a very simple task this actually was one of the harder tasks for our group. Our SciBorg was very erratic, as things in real life often are, while we got a code in the end that runs pretty well on the lab floor it wouldn't work on the carpet because of the high friction. We were able top get the car down the wood ramp, but it had difficulty getting up due to the force of gravity. We tried our SciBorg on the ground by the Leaky Beaker too because it was difficult to find a high friction low friction floor that wouldn't interfere with the ball, the carpeted area by leaky beaker with a sticker on it was the most effective. This high friction and low friction combo made the car drive off the high friction surface.




































Bang Bang follow the Line: This task was by far the most difficult, we first made a code that was supposed to simply follow the line, but this clearly would not work on this bending track we have, so instead we made a code that would move side to side sensing the white line. We eventually figured out that it would be easier to sense the sides between the line and the brown board than to sense just the pure white line. But then we couldn't get the car to move correctly so we tried ajusting the delay to no avail, then tried to write a code using no delay, but instead using the "if millis()" function, those all did not work. Finally we found out that our SciBorg was not only moving too fast but with turns too big. We found out that the magnitude of the "set fixed drive" controls speed and the difference of the two fixed drives control the angle and eventually we figured out the right speed and angle combination to make our SciBorg successfully followed the line!

No comments:

Post a Comment