This library takes care of encoder monitoring and servo signaling, and provides a simple set of functions for making the ActivityBot go certain distances and speeds.
For more information, go here:
http://learn.parallax.com/activitybot/navigation-basics
More...
Macros |
#define | ABD_RAMP_STEP 12 |
| This default corresponds 600 ticks/second^2 acceleration and can be adjusted with the drive_setAcceleration function.
|
#define | ABD_SPEED_LIMIT 128 |
| The default drive_speed limit is +/-128 ticks/second. This can be adjusted at runtime with the drive_setSpeed and drive_setMaxVelocity functions.
|
#define | ABD_GOTO_SPEED_LIMIT 64 |
| This default defines the speed limit when the drive_goto function is called and can be adjusted with the drive_setMaxVelocity function.
|
#define | ABD_GOTO_RAMP_STEP 4 |
| This default corresponds 200 ticks/second^2 acceleration and can be adjusted with the drive_setAcceleration function.
|
#define | ABD_NUDGE_SPEED 4 |
| Ticks per second to nudge to the final position do complete a drive_goto call.
|
#define | ABD_STOP_50ths 5 |
| This is the number of 50ths of a second that the ActivityBot delays when it crosses the zero speed threshold when executing drive_goto calls.
|
#define | _ActivityBot_EE_Start_ 63418 |
| ActivityBot EEPROM calibration data start address.
|
#define | _ActivityBot_EE_End_ 63418 + 2052 |
| ActivityBot EEPROM calibration data end address.
|
#define | FOR_GOTO 1 |
| This constant can be used in place of 0 to tell drive_setAcceleration and drive_setMaxVelocity to set maximum velocity/acceleration for calls to drive_goto.
|
#define | FOR_SPEED 0 |
| This constant can be used in place of 0 to tell drive_setAcceleration and drive_setMaxVelocity to set maximum velocity/acceleration for calls to drive_speed.
|
#define | OFF 0 |
| OFF can be used in place of zero to enabled parameters in functions like drive_feedback and drive_trim.
|
#define | ON 1 |
| ON can be used in place of a nonzero value to enabled parameters in functions like drive_feedback and drive_trim.
|
#define | SIDE_LEFT 0 |
| Parameter option for drive_gotoStatus(int side).
|
#define | SIDE_RIGHT 1 |
| Parameter option for drive_gotoStatus(int side).
|
#define | SIDE_BOTH 2 |
| Parameter option for drive_gotoStatus(int side).
|
Functions |
void | drive_goto (int distLeft, int distRight) |
| Make each wheel go a particular distance. Recommended for straight forward, backward, turns, pivots, and curves/arcs. 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. By default, this function does not return until the maneuver has completed.
|
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_getTicks (int *left, int *right) |
| Get the measured number of ticks the have traveled.
|
void | drive_calibrationResults (void) |
| Uses the calibration settings to find common circuit mistakes that prevent the ActivityBot from operating normally. This function will either display a success message or information about one or more problems. Make sure to re-run the ActivityBot calibration after fixing each problem. Do not try to continue with any of the ActivityBot tutorials until you have run the calibration, and then run a program with this function call and it displays a message that the ActivitiyBot has been successfully calibrated.
Instructions: (BlocklyProp)
http://learn.parallax.com/blockly/calibrate-your-activitybot
Instructions: (Propeller C)
http://learn.parallax.com/activitybot/test-and-tune-your-activitybot.
|
|
void | drive_displayInterpolation (void) |
| Displays the interpolation table stored in EEPROM by the calibration step. For more info, see:
http://learn.parallax.com/activitybot/test-and-tune-your-activitybot.
|
void | drive_getTicksCalc (int *left, int *right) |
| Get the calculated number of ticks the encoders should have traveled.
|
int | drive_gotoStatus (int side) |
| Can be used after drive_gotoMode(OFF) to check if a maneuver has been completed.
|
|
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_feedback (int enabled) |
| Enables or disables encoder feedback for speed control.
|
void | drive_gotoMode (int mode) |
| Set the mode (blocking or interruptible) of the drive_goto call. For calls in interruptible mode, sufficient time must be allowed for the maneuver to complete. The drive_gotoStatus function can be polled to find when a maneuver is done.
|
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_setAcceleration (int forGotoOrSpeed, int ticksPerSecSq) |
| Set the acceleration used by either drive_goto or drive_speed.
|
void | drive_setMaxSpeed (int speed) |
| Modifies the default maximum 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_setMaxVelocity (int forGotoOrSpeed, int ticksPerSec) |
| Set the maximum velocity used by either drive_goto or drive_speed.
|
|
void | drive_setRampStep (int stepsize) |
| Overrides the default 12 ticks/second per 50th of a second for ramping.
|
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 for that speed, it takes a step toward the speed. This helps cushion sudden maneuvers in sensor navigation, where the conditions might change more rapidly than you would want your ActivityBot's speed to change. (Note: This is now built into drive_speed.)
|
void | drive_ramp (int left, int right) |
| This function ramps up to a given speed and blocks execution until the speed is reached. In practice, a call to drive_speed followed by a pause to reach the desired speed will have the same affect but does not have practical applications.
|
This library takes care of encoder monitoring and servo signaling, and provides a simple set of functions for making the ActivityBot go certain distances and speeds.
For more information, go here:
http://learn.parallax.com/activitybot/navigation-basics
- Author
- Andy Lindsay
- Copyright
- Copyright (C) Parallax, Inc. 2017. All Rights MIT Licensed.
- Core Usage
- A single additional core takes care of ActivityBot encoder monitoring, control system algorithm execution and servo control.
- EEPROM Usage
- Reads from addresses 63418..65470.
- Memory Models
- Use with CMM.
- Version
- 0.9.82
- Move most control logic into the control system cog.
- Arc support with drive_goto(left, right), where left != right.
- Background target calculation for better acceleration/deceleration.
- drive_acceleration(forGotoOrSpeed, ticksPerSecondSquared).
- drive_ramp can be interrupted with a new direction.
- drive_goto can be interrupted after calling drive_gotoMode(0).
- drive_gotoStatus added for monitoring when a maneuver is finished.
- All acceleration (a.k.a. ramping) is done in the background.
- Sampling rate increased from 400 to 800 Hz.
- Default speed for drive_goto set to 64 ticks per second with a default acceleration of 200 ticks per second.
- Default speed limit for drive_speed is 128 ticks per second, with a default acceleration of 600 ticks/second squared.
- Trim support was removed.
-
0.5.6
- Adjust drive_servoPins and drive_encoderPins documentation.
-
0.5.4
- 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
-
0.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)
- Help Improve this Library
- 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.