PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
abdrive.h
Go to the documentation of this file.
1 //#define _monitor_
2 
83 //#ifndef DOXYGEN_SHOULD_SKIP_THIS
84 #ifndef ABDRIVE_H
85 #define ABDRIVE_H
86 //#endif
87 
88 #if defined(__cplusplus)
89 extern "C" {
90 #endif
91 
92 #include "simpletools.h"
93 #include "simpletext.h"
94 #include "fdserial.h"
95 #ifndef ABD_RAMP_STEP
96 
101 #define ABD_RAMP_STEP 12
102 #endif
103 
104 
105 #ifndef ABD_SPEED_LIMIT
106 
112 #define ABD_SPEED_LIMIT 128
113 #endif
114 
115 
116 #ifndef ABD_GOTO_SPEED_LIMIT
117 
122 #define ABD_GOTO_SPEED_LIMIT 64
123 #endif
124 
125 
126 #ifndef ABD_GOTO_RAMP_STEP
127 
132 #define ABD_GOTO_RAMP_STEP 4
133 #endif
134 
135 
136 #ifndef ABD_NUDGE_SPEED
137 
142 #define ABD_NUDGE_SPEED 4
143 #endif
144 
145 
146 #ifndef ABD_STOP_50ths
147 
153 #define ABD_STOP_50ths 5
154 #endif
155 
156 
157 
158 
159 #ifndef _ActivityBot_EE_Start_
160 
164 #define _ActivityBot_EE_Start_ 63418
165 #endif
166 
167 
168 #ifndef _ActivityBot_EE_End_
169 
173 #define _ActivityBot_EE_End_ 63418 + 2052
174 #endif
175 
176 
177 #ifndef FOR_GOTO
178 
184 #define FOR_GOTO 1
185 #endif
186 
187 
188 #ifndef FOR_SPEED
189 
195 #define FOR_SPEED 0
196 #endif
197 
198 
199 #ifndef OFF
200 
204 #define OFF 0
205 #endif
206 
207 #ifndef ON
208 
212 #define ON 1
213 #endif
214 
215 
216 #ifndef SIDE_LEFT
217 
221 #define SIDE_LEFT 0
222 #endif
223 
224 
225 #ifndef SIDE_RIGHT
226 
230 #define SIDE_RIGHT 1
231 #endif
232 
233 
234 #ifndef SIDE_BOTH
235 
239 #define SIDE_BOTH 2
240 #endif
241 
242 
243 
263 void drive_goto(int distLeft, int distRight);
264 
265 
266 
275 void drive_speed(int left, int right);
276 
277 
287 void drive_getTicks(int *left, int *right);
288 
289 
303 void drive_calibrationResults(void);
304 
305 
306 
320 void drive_displayInterpolation(void);
321 
322 
332 void drive_getTicksCalc(int *left, int *right);
333 
334 
343 int drive_gotoStatus(int side);
344 
345 
367 void drive_encoderPins(int encPinLeft, int encPinRight);
368 
369 
375 void drive_feedback(int enabled);
376 
377 
387 void drive_gotoMode(int mode);
388 
389 
403 void drive_servoPins(int servoPinLeft, int servoPinRight);
404 
405 
415 void drive_setAcceleration(int forGotoOrSpeed, int ticksPerSecSq);
416 
417 
426 void drive_setErrorLimit(int maxDistDiffTicks);
427 
428 
438 void drive_setMaxSpeed(int speed);
439 
440 
450 void drive_setMaxVelocity(int forGotoOrSpeed, int ticksPerSec);
451 
452 
453 
469 void drive_setRampStep(int stepsize);
470 
471 
483 void drive_rampStep(int left, int right);
484 
496 void drive_ramp(int left, int right);
497 
503 /*
504  void drive_getSpeedCalc(int *left, int *right);
505  void drive_getSpeedActual(int *left, int *right);
506 */
507 
508 #ifndef DOXYGEN_SHOULD_SKIP_THIS
509 
510 /* =========================================================================== */
511 // PRIVATE FUNCTIONS/MACROS
512 /* =========================================================================== */
513 
519 #ifndef _ActivityBot_EE_Pins_
520 #define _ActivityBot_EE_Pins_ 12
521 #endif
522 
523 #ifndef _ActivityBot_EE_Trims_
524 #define _ActivityBot_EE_Trims_ 28
525 #endif
526 
527 #ifndef _ActivityBot_EE_Left_
528 #define _ActivityBot_EE_Left_ 52
529 #endif
530 
531 #ifndef _ActivityBot_EE_Right_
532 #define _ActivityBot_EE_Right_ 1052
533 #endif
534 
535 #ifndef ABD_L
536 #define ABD_L 0
537 #endif
538 
539 #ifndef ABD_R
540 #define ABD_R 1
541 #endif
542 
543 #ifndef ABD_B
544 #define ABD_B 2
545 #endif
546 
547 #ifndef ABD_T
548 #define ABD_T 3
549 #endif
550 
551 
552 #ifndef ABD_FOR_BOTH
553 #define ABD_FOR_BOTH 2
554 #endif
555 
556 #ifndef AB_RIGHT
557 #define AB_RIGHT 1
558 #endif
559 
560 #ifndef AB_LEFT
561 #define AB_LEFT -1
562 #endif
563 
564 /*
565  #ifndef interactive_development_mode
566  #define interactive_development_mode
567  void display_control_sys(int start, int end);
568  #endif
569 */
570 
571 #ifdef _monitor_
572 void monitor_start(int monitorReps);
573 void monitor_stop();
574 int *encoderLeds_start(int pinLeft, int pinRight);
575 #endif
576 
577 #ifndef AB_RIGHT
578 #define AB_RIGHT 1
579 #endif
580 
581 #ifndef AB_LEFT
582 #define AB_LEFT -1
583 #endif
584 
585 #ifndef AB_FORWARD
586 
590 #define AB_FORWARD 1
591 #endif
592 
593 #ifndef AB_BACKWARD
594 
598 #define AB_BACKWARD -1
599 #endif
600 
601 void monitor_start(int monitorReps);
602 void monitor_stop(void);
603 
604 
609 #endif // DOXYGEN_SHOULD_SKIP_THIS
610 
611 
612 
613 
614 
615 #if defined(__cplusplus)
616 }
617 #endif
618 /* __cplusplus */
619 #endif
620 /* ABDRIVE_H */
621 
drive_encoderPins
void drive_encoderPins(int encPinLeft, int encPinRight)
Set encoder pins to values other than the default P14 for left encoder and P15 for right encoder....
Definition: servoPins.c:208
drive_feedback
void drive_feedback(int enabled)
Enables or disables encoder feedback for speed control.
Definition: feedback.c:5
drive_getTicks
void drive_getTicks(int *left, int *right)
Get the measured number of ticks the have traveled.
Definition: getticks.c:9
drive_rampStep
void drive_rampStep(int left, int right)
This function allows your code to ask for a speed repeatedly in a loop, but each time your code asks ...
Definition: rampStep.c:5
drive_speed
void drive_speed(int left, int right)
Set wheel speeds in encoder ticks per second. An encoder tick is 1/64th of a revolution,...
Definition: speed.c:138
drive_getTicksCalc
void drive_getTicksCalc(int *left, int *right)
Get the calculated number of ticks the encoders should have traveled.
Definition: getticks.c:15
drive_ramp
void drive_ramp(int left, int right)
This function ramps up to a given speed and blocks execution until the speed is reached....
Definition: ramp.c:7
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
drive_setMaxVelocity
void drive_setMaxVelocity(int forGotoOrSpeed, int ticksPerSec)
Set the maximum velocity used by either drive_goto or drive_speed.
Definition: setMaxSpeed.c:13
drive_goto
void drive_goto(int distLeft, int distRight)
Make each wheel go a particular distance. Recommended for straight forward, backward,...
Definition: goto.c:38
drive_setRampStep
void drive_setRampStep(int stepsize)
Overrides the default 12 ticks/second per 50th of a second for ramping.
Definition: setRampStep.c:5
drive_displayInterpolation
void drive_displayInterpolation(void)
Displays the interpolation table stored in EEPROM by the calibration step. For more info,...
Definition: Display.c:189
drive_calibrationResults
void drive_calibrationResults(void)
Uses the calibration settings to find common circuit mistakes that prevent the ActivityBot from opera...
Definition: calibrationResults.c:370
simpletext.h
This library provides a collection of functions for communicating with text devices such as SimpleIDE...
drive_setAcceleration
void drive_setAcceleration(int forGotoOrSpeed, int ticksPerSecSq)
Set the acceleration used by either drive_goto or drive_speed.
Definition: setAcceleration.c:15
drive_setMaxSpeed
void drive_setMaxSpeed(int speed)
Modifies the default maximum top speed for use with encoders. The default is 128 ticks/second = 2 rev...
Definition: setMaxSpeed.c:5
drive_gotoMode
void drive_gotoMode(int mode)
Set the mode (blocking or interruptible) of the drive_goto call. For calls in interruptible mode,...
Definition: gotoMode.c:5
drive_servoPins
void drive_servoPins(int servoPinLeft, int servoPinRight)
Set servo pins to values other than the default P12 for left servo and P13 for right servo....
Definition: servoPins.c:188
drive_gotoStatus
int drive_gotoStatus(int side)
Can be used after drive_gotoMode(OFF) to check if a maneuver has been completed.
Definition: gotoStatus.c:5
drive_setErrorLimit
void drive_setErrorLimit(int maxDistDiffTicks)
Sets the maximum accumulated error between target and actual distance traveled.
Definition: setErrorLimit.c:5
fdserial.h
This library supports creating and managing one or more full duplex serial connections with periphera...