With Aditi, I worked through Part 1 to 9 with Arduino.
PART 1. Making Functions.
created two functions, dot() and dash() in loop
commented on each line
// HIGH meaning LED turns on (voltage high)
//LOW meaning LED turns off (voltage low)
PART 2. Setting up the Sciborg
Downloaded the Bricktronics shield files and also used the NXT cables!!
PART 3. Working with the SciBorg
Single motor:
This code allows the Sciborg(we named it Bumblebee, reference from Transfomers…) to go slow(at 75) and then fast(255) and then go slow backwards(-75) and then go fast backwards(-255).
Each motion goes on for 1 second(delay(1000)).
So after 4seconds, the loop goes for one round and Bumblebee comes back to where it was.
This was when the serial monitor didn’t work at first because it was set to 9600 baud. From there, I learned to always check which COM# it is uploading too and to check the bottom right corner for the right units.
a) Both motors:
Now using both motors, Bumblebee isn’t going round and round anymore but actually moving forward!
With both motors with the same speed, Aditi and I thought it would go straight but it actually didn’t. It kept turning a little to the left. Even with the same speed computed, the SciBorg responds differently. Possibly because of friction? Or using one of the motors for too long?
c) Hard turn:
Next, we adjusted the speed for each motor, so the car turned nearly at a 90 degree angle.
IMG_0145-204gnlc
If the video doesn’t work, the same video is upload on google drive as IMG_9716.MOV under “Images and Videos” under “SciBorg Works (Aditi and Rinako)”
d) gentler turn:
Then we coded for a gentler turn so the SciBorg goes in a “S” shape.
e) Travel for 10 feet and then stop:
First we timed the Sciborg to go 10ft and got 18 seconds.
Then we coded the delay(18000) in.
Why doesn’t Sciborg stop on the line?
– Because Bumblebee is only told to run for 18 seconds which isn’t exactly the same as telling it to run 10 feet. It stops about 10cm far for the 10ft line.
PART 4. Feedback with sensors
MotorEncoder:
Why doesn’t the motor position go back to zero if it goes foward for 1sec and then back for 1sec?
Do they vary?
LightSensorNXT:
What range did we test?
Black = 0,
White = 93,
Brown(cardboard) = 60,
Red = 75,
Yellow = 95,
This was pretty interesting for me because when I draw value drawings with only a graphite pencil I draw other colors(red, yellow, blue, green) in the range that we saw.
What distance from the surface works best?
– We found out that closer to the surface was better. but not too close because that can damage the sensor and rarely no lighting causing the range to be lower(darker).
PART 5. Drive Straight
Using bang-bang control, we made bumblebee go straight with the same fixed speed (230).
I defined motor1e and motor2e to get the position of each motor which is not the speed so that the bang-bang control can work.
In this code motor one remains the same speed(230) and motor 2 works compared to motor1’s speed. (250= going right, 210=going left.)
IMG_0146-2ijgasb
In google Drive under “IMG_9718.MOV”
Bumblebee tries but it doesn’t go completely straight because of the bumpy surface at We-Lab. We figured friction comes imporatant especially when dealing with motors and tires.
PART 6. Drive Straighter
Using proportional control, we made bumblebee travel which made it go a little more straighter but not yet to completely straight!
For the gain coefficient(kp), we set it to 1 from adjusting the numbers and seeing what would work the best. Similar to Part 5, motor 1 is the fixed motor but how it works is different. We don’t need to set a speed for motor 2 but instead with the difference(error=motor1e-motor2e) the code tells motor2 to increase or decrease the speed by the gain coefficient.
PART 7. bang-bang line following
Using the NXT brightness sensor and with bang-bang control, we had bumblebee follow the white(=93) line at We-Lab.
It sort of works other than sometimes, it loses the white line and takes a while to find it again by turning left.
It sort of works other than sometimes, it loses the white line and takes a while to find it again by turning left.
It worked well on the second half of the line so we videoed it!
IMG_0149-1jhrqpu
Uploaded in Google Drive by the name “IMG_9978.MOV”
PART 9. Proportional line following
Using the NXT brightness sensor and with proportional control, we had bumblebee follow the white line at We-Lab.
Compared to Part 1, it followed the line better!! But we have no videos of it since it was done late at night and we both went to sleep right after we finished PART9…..
OVERALL EXPERIENCE.
Althought sometimes it was frustrating when it didn’t upload, I felt very very accomplished after finished up all the parts because this was my first experience using the code to activate a robot. Especially when the Sciborg acutally followed the line, I got excited thinking about the long way we came after missing all the semicolons.
Also because a lot of information on c++ was online, I was able to find helpful sources when we couldn’t get things to work out.