Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Watchdog SDFileSystem DigoleSerialDisp
Steering Class Reference
A class for managing steering angle calculations based on current and desired heading and specified intercept distance along the new path. More...
#include <Steering.h>
Public Member Functions | |
| Steering (PinName pin) | |
| create a new steering calculator | |
| void | initSteering (void) |
| Initalize steering actuator (servo) | |
| void | setTrack (float track) |
| Set the track width (left to right contact patch distance) | |
| void | setWheelbase (float wheelbase) |
| Set the wheelbase (front to rear axle distance) | |
| void | setIntercept (float intercept) |
| set intercept distance | |
| void | setScale (float scale) |
| set steering scale factor to convert between steering angle and servo output | |
| void | setSteering (float steerAngle) |
| Convert steerAngle to servo value. | |
| float | operator= (float steerAngle) |
| Shorthand for the write function. | |
| float | calcSA (float theta) |
| convert course change to average steering angle assumes Ackerman steering, with track and wheelbase and course intercept distance specified. | |
| float | calcSA (float theta, float limit) |
| convert course change to average steering angle assumes Ackerman steering, with track and wheelbase and course intercept distance specified. | |
| float | purePursuitSA (float hdg, float Bx, float By, float Ax, float Ay, float Cx, float Cy) |
| compute steering angle based on pure pursuit algorithm | |
| float | pathPursuitSA (float hdg, float Bx, float By, float Ax, float Ay, float Cx, float Cy) |
| compute steering angle based on a simpler path pursuit variant of pure pursuit | |
| float | crossTrack (float Bx, float By, float Ax, float Ay, float Cx, float Cy) |
| Compute cross track error given last waypoint, next waypoint, and robot coordinates. | |
Static Public Member Functions | |
| static float | toRadians (float deg) |
| Convert degrees to radians. | |
| static float | toDegrees (float rad) |
| Convert radians to degrees. | |
Detailed Description
A class for managing steering angle calculations based on current and desired heading and specified intercept distance along the new path.
See Notebook entry: http://mbed.org/users/shimniok/notebook/smooth-steering-for-rc-car/
Definition at line 14 of file Steering.h.
Constructor & Destructor Documentation
| Steering | ( | PinName | pin ) |
create a new steering calculator
Definition at line 7 of file Steering.cpp.
Member Function Documentation
| float calcSA | ( | float | theta ) |
convert course change to average steering angle assumes Ackerman steering, with track and wheelbase and course intercept distance specified.
Calculate a steering angle based on relative bearing.
See notebook: http://mbed.org/users/shimniok/notebook/smooth-steering-for-rc-car/
- Parameters:
-
theta relative bearing of the new course
- Returns:
- steering angle in degrees
Definition at line 66 of file Steering.cpp.
| float calcSA | ( | float | theta, |
| float | limit | ||
| ) |
convert course change to average steering angle assumes Ackerman steering, with track and wheelbase and course intercept distance specified.
calcSA minRadius -- radius limit (minRadius < 0 disables limiting)
Also, |radius| of turn is limited to limit
See notebook: http://mbed.org/users/shimniok/notebook/smooth-steering-for-rc-car/
- Parameters:
-
theta relative bearing of the new course limit is the limit of the turn circle radius (absolute value)
- Returns:
- steering angle in degrees
Definition at line 74 of file Steering.cpp.
| float crossTrack | ( | float | Bx, |
| float | By, | ||
| float | Ax, | ||
| float | Ay, | ||
| float | Cx, | ||
| float | Cy | ||
| ) |
Compute cross track error given last waypoint, next waypoint, and robot coordinates.
Bxy - robot coordinates Axy - previous waypoint coords Cxy - next waypoint coords.
- Returns:
- cross track error
Definition at line 116 of file Steering.cpp.
| void initSteering | ( | void | ) |
Initalize steering actuator (servo)
Definition at line 17 of file Steering.cpp.
| float operator= | ( | float | steerAngle ) |
Shorthand for the write function.
Definition at line 56 of file Steering.cpp.
| float pathPursuitSA | ( | float | hdg, |
| float | Bx, | ||
| float | By, | ||
| float | Ax, | ||
| float | Ay, | ||
| float | Cx, | ||
| float | Cy | ||
| ) |
compute steering angle based on a simpler path pursuit variant of pure pursuit
Definition at line 148 of file Steering.cpp.
| float purePursuitSA | ( | float | hdg, |
| float | Bx, | ||
| float | By, | ||
| float | Ax, | ||
| float | Ay, | ||
| float | Cx, | ||
| float | Cy | ||
| ) |
compute steering angle based on pure pursuit algorithm
Definition at line 191 of file Steering.cpp.
| void setIntercept | ( | float | intercept ) |
set intercept distance
- Parameters:
-
intercept distance along new course at which turn arc will intercept
Definition at line 28 of file Steering.cpp.
| void setScale | ( | float | scale ) |
set steering scale factor to convert between steering angle and servo output
- Parameters:
-
scale is the scale factor
Definition at line 24 of file Steering.cpp.
| void setSteering | ( | float | steerAngle ) |
Convert steerAngle to servo value.
Testing determined near linear conversion between servo ms setting and steering angle up to ~20*.
- Parameters:
-
steerAngle is the steering angle, measured at front wheels, averaged
Definition at line 41 of file Steering.cpp.
| void setTrack | ( | float | track ) |
Set the track width (left to right contact patch distance)
- Parameters:
-
track is the vehicle track width
Definition at line 36 of file Steering.cpp.
| void setWheelbase | ( | float | wheelbase ) |
Set the wheelbase (front to rear axle distance)
- Parameters:
-
wheelbase is the vehicle wheelbase
Definition at line 32 of file Steering.cpp.
| static float toDegrees | ( | float | rad ) | [static] |
Convert radians to degrees.
- Parameters:
-
rad radians to convert
- Returns:
- degrees
Definition at line 118 of file Steering.h.
| static float toRadians | ( | float | deg ) | [static] |
Convert degrees to radians.
- Parameters:
-
deg degrees to convert
- Returns:
- radians
Definition at line 111 of file Steering.h.
Generated on Tue Jul 12 2022 21:36:20 by
1.7.2