|
LRAUV
revA
|
Encapsulates the actuator model. More...
#include <ActuatorModel.h>
Public Member Functions | |
| ActuatorModel () | |
| Construct an model using the given params. More... | |
| ~ActuatorModel () | |
| Destructor. More... | |
| void | setCommand (const float command) |
| float | project (const float dt) |
| float | advance (const float dt, bool debug=false) |
| void | setHyst (const float width, const float center) |
| void | setSpeed (const float speed) |
| void | setPrevious (const float previous) |
| Override the model to set the "current" value. More... | |
| float | getCurrent (void) |
Private Member Functions | |
| void | project (const float dt, float &shaft, float &position, bool debug=false) |
| float | next (const float dt, bool debug=false) |
| float | hysteresis (const float shaft) |
Private Attributes | |
| float | command_ |
| float | prevPosition_ |
| float | prevShaft_ |
| bool | movingToLeft_ |
| bool | movingToRight_ |
| float | hystWidth_ |
| The width in of the hysteresis. More... | |
| float | hystCenter_ |
| The center of the hysteresis curve (normally 0) More... | |
| float | speed_ |
| Speed of the acutator (units/sec) More... | |
Encapsulates the actuator model.
The Ody/Altex simulator has a relatively complex actuator model. It models time delays/maximum rates for the Ody motors and includes a small hysteresis (to model slop and backlash?). This class encapsulates those calculations to make the main simulator code just a little more modular.
The code is complicated slightly by the fact the Runge-Kutta integration evaluates at three different time steps (t+0, t+smallDt/2, and t+smallDt) Since they're monotonically increasing we could advance the concept of 'current' each time we, but instead I've written it to take (0, smallDt/2, smallDt) as a parameter, each time just "projecting" into the future without updating its state. Then an "advance" function is called separately to cause it to update its state by smallDt.
May look goofy, but everything here is specified in centiseconds since we're using a 100-depth delay buffer but I want it to span 1 second. It doesn't make any sense to use a 1000-long buffer for this
| ActuatorModel::ActuatorModel | ( | ) |
Construct an model using the given params.
Initialize this actuator model.
Any sort of actuator-specific params could be passed in here. Right now its just info on the hysteresis/backlash in each actuator.
|
inline |
Destructor.
| float ActuatorModel::advance | ( | const float | dt, |
| bool | debug = false |
||
| ) |
References prevPosition_, prevShaft_, and project().
Referenced by Simulator::motion().
|
inline |
References prevPosition_.
Referenced by Simulator::calcForce(), Simulator::publishState(), and Simulator::run().
|
private |
References hystCenter_, hystWidth_, movingToLeft_, movingToRight_, prevPosition_, and prevShaft_.
Referenced by project().
|
private |
References command_, prevShaft_, and speed_.
Referenced by project().
| float ActuatorModel::project | ( | const float | dt | ) |
Referenced by advance(), and Simulator::calcForce().
|
private |
References hysteresis(), and next().
| void ActuatorModel::setCommand | ( | const float | command | ) |
References command_.
Referenced by Simulator::run().
|
inline |
| width | The width of the hysteresis |
| center | The center of the hysteresis curve (normally 0) |
References hystCenter_, and hystWidth_.
Referenced by Simulator::loadParams().
| void ActuatorModel::setPrevious | ( | const float | previous | ) |
Override the model to set the "current" value.
References prevPosition_, and prevShaft_.
Referenced by Simulator::loadParams(), Simulator::setBuoyancyPosition(), Simulator::setElevatorAngle(), Simulator::setMassPosition(), and Simulator::setRudderAngle().
|
inline |
References speed_.
Referenced by Simulator::loadParams().
|
private |
Referenced by next(), and setCommand().
|
private |
The center of the hysteresis curve (normally 0)
Referenced by hysteresis(), and setHyst().
|
private |
The width in of the hysteresis.
Referenced by hysteresis(), and setHyst().
|
private |
Referenced by hysteresis().
|
private |
Referenced by hysteresis().
|
private |
Referenced by advance(), getCurrent(), hysteresis(), and setPrevious().
|
private |
Referenced by advance(), hysteresis(), next(), and setPrevious().
|
private |
Speed of the acutator (units/sec)
Referenced by next(), and setSpeed().