Public Member Functions | |
BeobotControl (nub::soft_ref< BeoChip > beoChip, OptionManager &mgr, const std::string &descrName="Beobot Controller", const std::string &tagName="BeobotControl") | |
General constructor. | |
~BeobotControl () | |
Constructor. | |
void | calibrateSpeed (const byte neutralval, const byte minval, const byte maxval) |
Move Beobot. | |
void | calibrateSteer (const byte neutralval, const byte minval, const byte maxval) |
calibrate the steering SSC to new values | |
float | getSpeed () const |
get speed value [-1.0 .. 1.0] | |
float | getGear () const |
get gear value [-1.0 .. 1.0] | |
float | getSteer () const |
get steer value [-1.0 .. 1.0] | |
bool | setSpeed (const float newspeed) |
set speed value: [-1.0 (full reverse) to 1.0 (full forward)] | |
bool | setGear (const float newgear) |
set gear: -1.0 (neutral) 0.0 (first gear, slow), 1.0 (second gear, fast) | |
bool | setSteer (const float newsteer) |
set steer angle: [-1.0 (full left) to 1.0 (full right)] | |
bool | toSpeedLinear (const float newspeed, const int t) |
linear ramp of speed from current speed to new speed | |
bool | toSpeedSigmoid (const float newspeed, const int t) |
sigmoid ramp of speed from current speed to new speed | |
void | rampSpeed (const float newspeed, const int t, SpeedRampType behavior) |
speed ramping function | |
void | abortRamp (void) |
aborts speed ramping | |
Friends | |
void * | speedRampFunc (void *ptr) |
routine for speed ramp thread |
Definition at line 69 of file BeobotControl.H.
BeobotControl::BeobotControl | ( | nub::soft_ref< BeoChip > | beoChip, | |
OptionManager & | mgr, | |||
const std::string & | descrName = "Beobot Controller" , |
|||
const std::string & | tagName = "BeobotControl" | |||
) |
General constructor.
Definition at line 132 of file BeobotControl.C.
References BeobotConfig::gearMinVal, BeobotConfig::gearServoNum, BeobotConfig::speedNeutralVal, BeobotConfig::speedServoNum, BeobotConfig::steerNeutralVal, and BeobotConfig::steerServoNum.
BeobotControl::~BeobotControl | ( | ) |
Constructor.
Definition at line 155 of file BeobotControl.C.
void BeobotControl::abortRamp | ( | void | ) |
aborts speed ramping
Used to stop speed ramping thread so that main program has priority for setting speed.
Definition at line 327 of file BeobotControl.C.
float BeobotControl::getGear | ( | ) | const |
get gear value [-1.0 .. 1.0]
Definition at line 166 of file BeobotControl.C.
References BeobotConfig::gearServoNum.
Referenced by setGear().
float BeobotControl::getSpeed | ( | ) | const |
get speed value [-1.0 .. 1.0]
Definition at line 158 of file BeobotControl.C.
References BeobotConfig::speedServoNum.
Referenced by rampSpeed(), setSpeed(), toSpeedLinear(), and toSpeedSigmoid().
float BeobotControl::getSteer | ( | ) | const |
get steer value [-1.0 .. 1.0]
Definition at line 162 of file BeobotControl.C.
References BeobotConfig::steerServoNum.
Referenced by setSteer().
void BeobotControl::rampSpeed | ( | const float | newspeed, | |
const int | t, | |||
SpeedRampType | behavior | |||
) |
speed ramping function
This function is used for gradually increasing the speed with a certain behavior over a certain period of time. The ramping will be done in a separate thread so this function will return immediately. It is not necessary to wait until the new speed has been reached before calling this function to modify the ramping parameters again. The ramping function will be stopped if abortRamp() is called, or else if the thread continues other calls to setSpeed() may seem to have no effect.
newspeed | new speed to be reached after ramping | |
t | time in which new speed will be reached (milliseconds) | |
behavior | specifies behavior of ramping function |
Definition at line 302 of file BeobotControl.C.
References getSpeed(), Timer::reset(), and speedRampFunc.
bool BeobotControl::setGear | ( | const float | newgear | ) |
set gear: -1.0 (neutral) 0.0 (first gear, slow), 1.0 (second gear, fast)
Definition at line 211 of file BeobotControl.C.
References BeobotConfig::gearServoNum, and getGear().
bool BeobotControl::setSpeed | ( | const float | newspeed | ) |
set speed value: [-1.0 (full reverse) to 1.0 (full forward)]
Definition at line 170 of file BeobotControl.C.
References getSpeed(), and BeobotConfig::speedServoNum.
Referenced by toSpeedLinear(), and toSpeedSigmoid().
bool BeobotControl::setSteer | ( | const float | newsteer | ) |
set steer angle: [-1.0 (full left) to 1.0 (full right)]
Definition at line 193 of file BeobotControl.C.
References getSteer(), and BeobotConfig::steerServoNum.
bool BeobotControl::toSpeedLinear | ( | const float | newspeed, | |
const int | t | |||
) |
linear ramp of speed from current speed to new speed
Speed will reach newspeed after t milliseconds
Definition at line 241 of file BeobotControl.C.
References Timer::get(), getSpeed(), and setSpeed().
bool BeobotControl::toSpeedSigmoid | ( | const float | newspeed, | |
const int | t | |||
) |
sigmoid ramp of speed from current speed to new speed
Speed will reach newspeed after t milliseconds
Definition at line 270 of file BeobotControl.C.
References exp(), Timer::get(), getSpeed(), and setSpeed().
void* speedRampFunc | ( | void * | ptr | ) | [friend] |
routine for speed ramp thread
Definition at line 46 of file BeobotControl.C.
Referenced by rampSpeed().