Quote:
|
Originally Posted by TubaMorg
Notes: This hasn't really been tested yet so there is no guarantee. It is very simplified, so accuracy probably isn't that great. However, as you wanted, notice the PresetGTSensor line, which resets your GTS back to zero. Just drag the Gear Tooth Sensor over and use the preset option. The input is distance that you want to travel (in inches) it drives an arbitrary speed (I chose 175) until the distance left is < 12 inches then slows down proportional to the distance left. drivePID is a function we have that aids in control by keeping the robot driving straight. So this function stays locked up in the while loop until the distance traveled (d) is equal to or greater than the desired distance (distance). The Drive (127,0) call is an EasyC function to stop the robot when the distance is achieved. (Again not tested, so if you use this, feedback would be appreciated!
|
I understood the idea of the whole thing and it is very helpful. ammm in addition, 127,0 in drive doesn' stop the robot.
You are forggeting that the drive doesn't use values of pwm.
to stop the robot I wiil write 0,0 (speed, direction)
but that one was great.
I will test it tomorrow.
Can you or anyone else give another varient?
TNX ahead.
edit:
d = GetGTSensor ( GTS_DIG_IO ) ;
d = d/ GEAR_COUNT_PER_INCH ;
d equales both of those lines?