This library takes care of encoder monitoring and servo signalling, and provides a simple set of functions for making the Arlo go certain distances and speeds.
For more information, go here:
Please submit bug reports, suggestions, and improvements to this code to edito.nosp@m.r@pa.nosp@m.ralla.nosp@m.x.co.nosp@m.m.
More...
Functions |
void | drive_feedback (int enabled) |
| Enables or disables encoder feedback for speed control.
|
void | drive_trim (int enabled) |
| Enables or disables drive trim which can be used to compensate for mechanical wheel alignment errors.
|
void | drive_trimSet (int direction, int side, int value) |
| Stores trim values to EEPROM.
|
void | drive_trimDisplay (void) |
| Display the trim settings.
|
void | drive_displayInterpolation (void) |
| Displays the interopolation table stored in EEPROM by the calibration step. For more info, see:
|
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. Stores values in EEPROM, so you only need to call this function at the start of one program. Programs that are after that will get the values from EEPROM.
|
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. Stores values in EEPROM, so you only need to call this function at the start of one program. Programs that are after that will get the values from EEPROM.
|
void | drive_speed (int left, int right) |
| Set wheel speeds in encoder ticks per second. An encoder tick is 1/64th of a revolution, and makes causes the wheel to roll 3.25 mm.
|
void | drive_ramp (int left, int right) |
| Ramp up to the specified wheel speeds. It works almost the same as drive_speed, except that it steps up the speed every 50th of a second. The default ramping rate is 4 ticks per 50th of a second. This function will make your program wait while it ramps.
|
void | drive_rampStep (int left, int right) |
| This funciton allows your code to ask for a speed repeatedly in a loop, but each time your code asks for that speed, it takes a step toward the speed. This helps cushon sudden maneuvers in sensor navigation, where the conditions might change more rapidly than you would want your Arlo's speed to change.
|
void | drive_setRampStep (int stepsize) |
| Overrides the default 4 ticks/second per 50th of a second for ramping.
|
void | drive_distance (int left, int right) |
| Make the Arlo wheels roll certain encoder tick distances. An encoder tick is 1/64th of a wheel turn and makes the wheel roll 3.25 mm. NOT YET IMPLEMENTED, use drive_goto instead.
|
void | drive_close (void) |
| Stop the servo/encoder system. This is useful for reclaiming a processor for other tasks.
|
int | drive_open () |
| Start or restart the servo/encoder system.
|
void | drive_setMaxSpeed (int speed) |
| Modifies the default maxiumum top speed for use with encoders. The default is 128 ticks/second = 2 revolutions per second (RPS). This is the full speed that drive_distance and drive_goto use. This value can currently be reduced, but not increased. Speeds faster than 128 ticks per second are "open loop" meaning the control system does not use the encoders to correct distance/speed.
|
void | drive_goto (int distLeft, int distRight) |
| Make each wheel go a particular distance. Recommended for straight forward, backward, turns and pivots. Not recommended for curves. This function ramps up to full speed if the distance is long enough. It holds that speed until it needs to ramp down. After ramping down it applies compensation. This function is primarily a convenience for dead reckoning, and does not return until the maneuver has completed.
|
void | drive_getTicks (int *left, int *right) |
| Get the measured number of ticks the have traveled.
|
void | drive_getTicksCalc (int *left, int *right) |
| Get the calculated number of ticks the encoders should have traveled.
|
This library takes care of encoder monitoring and servo signalling, and provides a simple set of functions for making the Arlo go certain distances and speeds.
For more information, go here:
Please submit bug reports, suggestions, and improvements to this code to edito.nosp@m.r@pa.nosp@m.ralla.nosp@m.x.co.nosp@m.m.
- Author
- Andy Lindsay
- Copyright
- Copyright (C) Parallax, Inc. 2013. See end of file for terms of use (MIT License).
- Version
- 0.5.5
v0.5.5
- drive_getTicksCalc
- drive_getTicks
- drive_open
- drive_encoderPins
- drive_servoPins
- Values outside interpolation table ranges do not result in rotation halt.
- Turning off feedback now allows full servo speed operation
v0.5.1
- Trim enabled by default.
- Clear trim settings during calibration. (v0.5.1)
- Make trim for a direction mutually exclusive to one side. (v0.5.1)
To-Do
- Make ramp go to percentage of full speed
- Corrrect error in start string verification
- Make sure that control system's compensation cannot cause the servo signal to cross its direction boundary
- drive_distance
- drive_getSpeedCalc
- drive_getSpeedActual
- Code comments
- Reduce calibration array elements to 16-bit
- Condense left/right duplicate code
- Remove other variables
void drive_getTicksCalc |
( |
int * |
left, |
|
|
int * |
right |
|
) |
| |
Get the calculated number of ticks the encoders should have traveled.
Get the calculate number of ticks the encoders should have traveled. Distance is in ticks. The wheel has 64 encoder ticks, each accounting for 3.25 mm of distance.
The system samples the encoders at 400 times per second.
- Parameters
-
*left | Pointer to variable to receive the calculated left distance. |
*right | Pointer to variable to receive the calculated right distance. |
The system updates the predicted distance 400 times per second, based on the speed the wheels should be going.
- Parameters
-
*left | Pointer to variable to receive the calcualted left distance. |
*right | Pointer to variable to receive the calcualted right distance. |