![]() |
MSPM0_ValvanoWare
1.0
ECE445L starter code
|
Count wheel rotations and maintain robot position and angle. More...
#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | N 360 |
| counts/rotation, just one edge of one tach | |
| #define | D 70000 |
| wheel diameter 0.0001cm | |
| #define | W 140000 |
| wheel base 0.0001 cm | |
| #define | C 219910 |
| wheel circumference 0.0001cm | |
| #define | PI 8192 |
| representation of pi radians | |
| #define | TWOPI (2*PI) |
| 6.28... | |
| #define | NORTH 4096 |
| direction that is north | |
| #define | EAST 0 |
| direction that is east | |
| #define | SOUTH -4096 |
| direction that is south | |
| #define | WEST -8192 |
| direction that is west | |
| #define | XYTOLERANCE 10000 |
| tolerance in x,y goal seeking, 1 cm | |
| #define | THETATOLERANCE (4096/90) |
| tolerance in angle goal seeking, 1 deg | |
Enumerations | |
| enum | RobotState { ISSTOPPED , GOFORWARD , HARDRIGHT , HARDLEFT , SOFTRIGHT , SOFTLEFT } |
| robot state More... | |
| enum | OdometryCommand { STOP , FORWARDTOX , FORWARDTOY , LEFTTOTH , RIGHTTOTH } |
| Odometry Commands. More... | |
Functions | |
| void | Odometry_Init (int32_t initx, int32_t inity, int32_t initTheta) |
| Initialize odometry module. More... | |
| void | Odometry_Update (int32_t LCount, int32_t RCount) |
| Compute new position/angle of the robot. More... | |
| void | Odometry_SetPower (uint32_t fast, uint32_t slow) |
| Set power levels. More... | |
| int32_t | Odometry_GetX (void) |
| Get X position. More... | |
| int32_t | Odometry_GetY (void) |
| Get y position. More... | |
| int32_t | Odometry_GetAngle (void) |
| Get theta angle. More... | |
| void | Odometry_Get (int32_t *x, int32_t *y, int32_t *theta) |
| Get the current robot position. More... | |
| void | UpdatePosition (void) |
| update position More... | |
| void | Display (void) |
| OLED output. More... | |
| void | WaitUntilBumperTouched (void) |
| Wait until bumper touched. More... | |
| void | StopUntilBumperTouched (void) |
| Stop and wait until bumper touched. More... | |
| uint32_t | ForwardUntilCrash (void) |
| Go until bumper touched. More... | |
| uint32_t | ForwardUntilX (int32_t desiredX) |
| Forward Until X goal. More... | |
| uint32_t | ForwardUntilY (int32_t desiredY) |
| Forward Until Y goal. More... | |
| uint32_t | SoftLeftUntilTh (int32_t desiredTh) |
| Soft Left Until Theta. More... | |
| void | ForwardUntilXStart (int32_t thedesiredX) |
| start going Forward Until X More... | |
| uint32_t | ForwardUntilXStatus (void) |
| check status of Forward Until X command More... | |
| void | ForwardUntilYStart (int32_t thedesiredY) |
| start going Forward Until Y More... | |
| uint32_t | ForwardUntilYStatus (void) |
| check status of Forward Until Y command More... | |
| void | SoftLeftUntilThStart (int32_t thedesiredTh) |
| start going Forward Until Y More... | |
| uint32_t | ForwardUntilThStatus (void) |
| check status of soft left until theta command More... | |
| uint32_t | CheckGoal (void) |
| check status of odometry command More... | |
Count wheel rotations and maintain robot position and angle.
Inputs to the system are left and right tachometer counts. System is called periodically, e.g., every 20 to 40 ms. Private global variables from the system are position (x,y) and orientation theta.
Although tested with the Pololu #3542 Romi Encoder connected to Pololu RSLK 1.1 interface board, the module should operate with any 2 wheel differential drive robot.