abdrive library  v0.9.84
Differential servo and encoder drive library for the Parallax ActivityBot
abdrive.h
Go to the documentation of this file.
1 //#define _monitor_
2 
72 //#ifndef DOXYGEN_SHOULD_SKIP_THIS
73 #ifndef ABDRIVE_H
74 #define ABDRIVE_H
75 //#endif
76 
77 #if defined(__cplusplus)
78 extern "C" {
79 #endif
80 
81 #include "simpletools.h"
82 #include "simpletext.h"
83 #include "fdserial.h"
84 #ifndef ABD_RAMP_STEP
85 
90 #define ABD_RAMP_STEP 12
91 #endif
92 
93 
94 #ifndef ABD_SPEED_LIMIT
95 
101 #define ABD_SPEED_LIMIT 128
102 #endif
103 
104 
105 #ifndef ABD_GOTO_SPEED_LIMIT
106 
111 #define ABD_GOTO_SPEED_LIMIT 64
112 #endif
113 
114 
115 #ifndef ABD_GOTO_RAMP_STEP
116 
121 #define ABD_GOTO_RAMP_STEP 4
122 #endif
123 
124 
125 #ifndef ABD_NUDGE_SPEED
126 
131 #define ABD_NUDGE_SPEED 4
132 #endif
133 
134 
135 #ifndef ABD_STOP_50ths
136 
142 #define ABD_STOP_50ths 5
143 #endif
144 
145 
146 
147 
148 #ifndef _ActivityBot_EE_Start_
149 
153 #define _ActivityBot_EE_Start_ 63418
154 #endif
155 
156 
157 #ifndef _ActivityBot_EE_End_
158 
162 #define _ActivityBot_EE_End_ 63418 + 2052
163 #endif
164 
165 
166 #ifndef FOR_GOTO
167 
173 #define FOR_GOTO 1
174 #endif
175 
176 
177 #ifndef FOR_SPEED
178 
184 #define FOR_SPEED 0
185 #endif
186 
187 
188 #ifndef OFF
189 
193 #define OFF 0
194 #endif
195 
196 #ifndef ON
197 
201 #define ON 1
202 #endif
203 
204 
205 #ifndef SIDE_LEFT
206 
210 #define SIDE_LEFT 0
211 #endif
212 
213 
214 #ifndef SIDE_RIGHT
215 
219 #define SIDE_RIGHT 1
220 #endif
221 
222 
223 #ifndef SIDE_BOTH
224 
228 #define SIDE_BOTH 2
229 #endif
230 
231 
232 
252 void drive_goto(int distLeft, int distRight);
253 
254 
255 
264 void drive_speed(int left, int right);
265 
266 
276 void drive_getTicks(int *left, int *right);
277 
278 
292 void drive_calibrationResults(void);
293 
294 
295 
309 void drive_displayInterpolation(void);
310 
311 
321 void drive_getTicksCalc(int *left, int *right);
322 
323 
332 int drive_gotoStatus(int side);
333 
334 
356 void drive_encoderPins(int encPinLeft, int encPinRight);
357 
358 
364 void drive_feedback(int enabled);
365 
366 
376 void drive_gotoMode(int mode);
377 
378 
392 void drive_servoPins(int servoPinLeft, int servoPinRight);
393 
394 
404 void drive_setAcceleration(int forGotoOrSpeed, int ticksPerSecSq);
405 
406 
416 void drive_setMaxSpeed(int speed);
417 
418 
428 void drive_setMaxVelocity(int forGotoOrSpeed, int ticksPerSec);
429 
430 
431 
447 void drive_setRampStep(int stepsize);
448 
449 
461 void drive_rampStep(int left, int right);
462 
474 void drive_ramp(int left, int right);
475 
481 /*
482  void drive_getSpeedCalc(int *left, int *right);
483  void drive_getSpeedActual(int *left, int *right);
484 */
485 
486 #ifndef DOXYGEN_SHOULD_SKIP_THIS
487 
488 /* =========================================================================== */
489 // PRIVATE FUNCTIONS/MACROS
490 /* =========================================================================== */
491 
497 #ifndef _ActivityBot_EE_Pins_
498 #define _ActivityBot_EE_Pins_ 12
499 #endif
500 
501 #ifndef _ActivityBot_EE_Trims_
502 #define _ActivityBot_EE_Trims_ 28
503 #endif
504 
505 #ifndef _ActivityBot_EE_Left_
506 #define _ActivityBot_EE_Left_ 52
507 #endif
508 
509 #ifndef _ActivityBot_EE_Right_
510 #define _ActivityBot_EE_Right_ 1052
511 #endif
512 
513 #ifndef ABD_L
514 #define ABD_L 0
515 #endif
516 
517 #ifndef ABD_R
518 #define ABD_R 1
519 #endif
520 
521 #ifndef ABD_B
522 #define ABD_B 2
523 #endif
524 
525 #ifndef ABD_T
526 #define ABD_T 3
527 #endif
528 
529 
530 #ifndef ABD_FOR_BOTH
531 #define ABD_FOR_BOTH 2
532 #endif
533 
534 #ifndef AB_RIGHT
535 #define AB_RIGHT 1
536 #endif
537 
538 #ifndef AB_LEFT
539 #define AB_LEFT -1
540 #endif
541 
542 /*
543  #ifndef interactive_development_mode
544  #define interactive_development_mode
545  void display_control_sys(int start, int end);
546  #endif
547 */
548 
549 #ifdef _monitor_
550 void monitor_start(int monitorReps);
551 void monitor_stop();
552 #endif
553 
554 #ifndef AB_RIGHT
555 #define AB_RIGHT 1
556 #endif
557 
558 #ifndef AB_LEFT
559 #define AB_LEFT -1
560 #endif
561 
562 #ifndef AB_FORWARD
563 
567 #define AB_FORWARD 1
568 #endif
569 
570 #ifndef AB_BACKWARD
571 
575 #define AB_BACKWARD -1
576 #endif
577 
578 void monitor_start(int monitorReps);
579 void monitor_stop(void);
580 
581 
586 #endif // DOXYGEN_SHOULD_SKIP_THIS
587 
588 
589 
590 
591 
592 #if defined(__cplusplus)
593 }
594 #endif
595 /* __cplusplus */
596 #endif
597 /* ABDRIVE_H */
598