Friday, March 11, 2016

SciBorgs Day II

For our second day of SciBorgs, we first had to examine how accurate was each sensor and then use Bang-Bang control to make the SciBorg drive straight, follow a white line, and follow other SciBorgs in a conga line.

Motor Encoder

The motor encoder reads the position that the motor is at per delay that it is coded. The sketch that was given to us made the wheels move forward for 1 second and backward for 1 second. We noticed that even though the the wheels moved forward and backward in the same amount of time, its position did not return to 0. This is because the motor does not accelerate to full speed at the same rate each time and because of the time it takes for the program to run and get the position of the motor.

We used the motorencoder sketch given to us in order to create a new sketch that will make both motors go at full speed until motor 2 reaches a position of 12500. We chose motor 2 instead of both motors because motor 2 went faster than motor 1 and so would get a higher position value first. When deciding what position to use to tell the SciBorg to stop at, we first tried running the program for 16 seconds (the time that we previously got as the time it took the SciBorg to travel 10 feet) and then getting the position of the SciBorg. It first said that at a position of 20500 the SciBorg would have traveled 10 feet but when we ran the program and let the SciBorg travel on the floor, 20500 actually went about 20 feet. So we then just kept trying lower and lower numbers until we got to 12500.





Touch Switch

The touch switch is a sensor that senses when it is being pressed.  The initial sketch allowed us to see on the serial monitor that when the button was pressed it would say that the button was pressed. The delay was pretty short so the program was pretty accurate. We used the sketch provided for us to make the SciBorg travel straight at full speed until it touched the Delrin Sheet and then it would stop and then continue moving again if it were not being touched.





Light Sensor

The light sensor of course senses light. We are able to read raw values and scaled values of the light readings. The scaled values ranged from 0 (dark) to 97 (light). We chose to use the scaled values since they showed a larger difference of numbers between light and dark. The values were not very accurate because depending on whether or not there was a shadow or not and how far away the sensor was really mattered. We found the the light sensor worked best at a distance of 15 mm.

In our sketch, we made the SciBorg go straight until it sensed white and then it would stop. In this travelling and stopping exactly where we want it to challenge, the light sensor was amazing at helping the SciBorg because for once, the SciBorg stopped exactly on the line like we wanted it to.



Ultrasonic Sensor

The ultrasonic sensor works by sending out ultrasonic waves to calculate how far away the object in front of it is. This sensor was not very accurate. The closest the sensor could sense is 6 inches. The lowest value we read from the sensor was 11.

We used the ultrasonic sketch provided for us to make the SciBorg go straight until it sensed something was at a minimum of 6 inches in front of it. We held a Delrin sheet at the 10 feet mark and let the SciBorg go to it at full speed and then it was actually pretty accurate and stopped a little under 6 inches in front of the sheet.





Straight Bang-Bang

In straight bang bang, we used bang bang controls to make the SciBorg drive in a straight line on different surfaces. We made it so that when the motors had the same positions, the SciBorg would continue on straight but if motor 1 was bigger, the SciBorg would make a very gentle right turn so that motor 2 could catch up and if motor 2 was bigger the SciBorg would make a slight left turn so that motor 1 could catch up.



On a surface with low friction, straight bang bang would work about 75% of the time. It really depended on how straight we set the SciBorg down. The SciBorg still tended to veer to the right.
Bang Bang straight line on surface with low friction.

On a surface with high friction, the SciBorg drove really straight. It still tended a little more to the right but it was still the straightest we had seen it. 

Bang bang straight line on surface with high friction.

On a surface with one wheel on high friction surface and the other wheel on low friction surface, the SciBorg went straight for half of the distance and then started to veer towards the carpet. 

Bang bang straight line with low friction on one wheel and high friction on the other wheel.

Going down the ramp, the SciBorg was able to go straight most of the time. 

Bang bang straight line going down the ramp.

Going up the ramp, the SciBorg had a really hard time and would always go to the right. 

Bang bang straight line going up the ramp.


Follow the Line

Follow the Line was the toughest challenge that my partners and I had faced. It took us hours to get this sketch right. We tried many many sketches. Some were way more complicated than they had to be and most did not even show that the SciBorg sensed the white line. After hours of frustrations and getting angry at our little lego robot that seemed to do what ever it wanted, we finally whipped it into shape and it followed the white line.

We made the SciBorg sense either if the sensor is on the white line or on the cardboard. If it sensed the white line, we made it move to the right towards the cardboard and when it sensed the cardboard, it would move the left towards the white line. The program would run every 5 milliseconds and so the SciBorg would sense where it was every 5 milliseconds.

We learned from Xi Xi that the magnitude of the difference between the speeds of the motors corresponded with the angle that it would turn at. Hours before we finally got the right code, we had initially wrote a sketch similar to this but the speed differences between the two motors during the turns were very small and so the SciBorg would not even turn. So once Xi Xi helped us out, we were able to play around with different speeds and angles until we found the best one.





Conga Line

In the Conga Line challenge we were supposed to use a sensor and create a sketch that would make our SciBorg follow the SciBorg in front of it. We used the ultrasonic sensor since it was able to sense objects at least 6 inches in front of it. We wrote a sketch that made our SciBorg go forward at full speed until it sensed something was a little more than 6 inches in front of it. It would then move at a slow speed and if it sensed that the SciBorg in front of it was less than 6 inches away, it would stop moving until it sensed that the SciBorg in front was no longer 6 inches away and then continue moving.




No comments:

Post a Comment