Michael Shimniok / Mbed 2 deprecated DataBus

Dependencies:   mbed Watchdog SDFileSystem DigoleSerialDisp

Embed: (wiki syntax)

« Back to documentation index

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:
thetarelative 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:
thetarelative bearing of the new course
limitis 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:
interceptdistance 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:
scaleis 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:
steerAngleis 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:
trackis 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:
wheelbaseis the vehicle wheelbase

Definition at line 32 of file Steering.cpp.

static float toDegrees ( float  rad ) [static]

Convert radians to degrees.

Parameters:
radradians to convert
Returns:
degrees

Definition at line 118 of file Steering.h.

static float toRadians ( float  deg ) [static]

Convert degrees to radians.

Parameters:
degdegrees to convert
Returns:
radians

Definition at line 111 of file Steering.h.