[Thread Prev] [Thread Next]
Hi again,
(Warning: English is not my mother language... so expect the unexpected... errors)
(Second warning: robotics projects are partly about programming, partly about
"physical engineering" (and both have tremendous pedagogical values). This
post addresses the theoretical aspect only, The other half is... all yours.)
These instructions are not explicit "to the last detail"... The "missing info"
will be your joy when it's not missing any more. The other reason why I'm not
providing every detail is that robotics projects tend to require "a lot of
fine tuning" before they finally work. Too many factors besides the
programming:
the construction of your car
the wiring
the proximity and placement of the reflect sensor
the light environment in the room
the size of all things (tape, wheels...)
Assumptions: 1. The line is black. If it isn't, replace the "reflect" instructions with "not reflect". 2. The car will start its course with the sensor "on the line". That's important, because the first thing that the program will look for is a "getting out of line" event. 3. The car will get off the line "on the left side" first. That's important for the same reason. So when you place your car at the starting position, make sure it follows these two rules.
Approach: Given the assumptions above,
start the car movement
Loop the following logic sequence:
waituntil the sensor says "out of line" (on the left, based on the assumptions
above)
change the direction of the car, slightly to the right. The reflect sensor
will soon read a "back on line", but you can ignore that
waituntil the sensor says "out of line" (that would be on the right normally)
change the direction of the car, slightly to the left. The reflect sensor will
soon read a "back on line", but you can ignore that
Repeat that loop forever
The car will go zig-zag... if you turn left and right just slightly, the
zig-zag will be elongated and the overall speed will be "not bad". If you turn
a lot, the zig-zag will be tight and that overall displacement will be low. I
use "asetpower" and "csetpower" to turn slightly, instead of aoff and coff.
This approach DOES NOT mimic someone walking in a corridor blindfolded. Such
person could just glide a hand on ONE wall and find his way. This approach
mimics someone walking on a board, above the ground, using only his feet to
detect the "out of board" on each side.
Warning: Start the experiment with a straight line. Then try it with a line that is not straight, but don't exaggerate the curves.
Coding:
Something like (comments are just comments, naturally)
to start
athisway
cthatway
asetpower 7
csetpower 7
;resetting normal full power, in case it isn't because of my experiments
aon con
loop [zigzag]
end
to zigzag
waituntil [reflect1]
; out of line on the left
csetpower7
asetpower 3
;slowing down right wheel, in order to turn right
waituntil [reflect1]
; out of line on the right
asetpower 7 ; back to normal
csetpower 3
; slowing down left wheel, turning left
end
Again, almost every line in these procedures can be the opposite of what I
say:
a, c, and 1 can be different
thisway and thatway could be the opposite
[reflect1] can be [not reflect1]
setpower 3 can be too much or too little
-----Original Message-----
From: mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx [mailto:mwforum-admin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Jayme Johnson
Sent: December 14, 2006 1:23 PM
To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Subject: RE: Vehicle Programs
Thank you for all of this information, Alain. I am particularly interested in
the "follow that line" project directions. I look forward to reading them!
~Jayme
Jayme Johnson
Director of Academic Technology
Village School
jjohnson@xxxxxxxxxxxxxxxxxx <mailto:jjohnson@xxxxxxxxxxxxxxxxxx>
780 Swarthmore Avenue
Pacific Palisades, California 90272
310-459-8411 x120
http://www.village-school.org
-----Original Message-----
From: Alain Tougas [mailto:alain@xxxxxxx]
Sent: Tuesday, December 12, 2006 12:54 PM
To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Subject: RE: Vehicle Programs
...I will write something about "follow that line" tomorrow.
Ciao,
Alain
-------------------
We recently installed the spam filter from Abaca. It's over 99% accurate.
Check it out - http://www.abaca.com/success/story.cgi?domain=village-school.com
-------------------
Previous by thread:
RE: Vehicle Programs
Next by thread:
RE: Vehicle Programs
To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.
|