LRAUV  revA
ActuatorModel Class Reference

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...
 

Detailed Description

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

Constructor & Destructor Documentation

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.

ActuatorModel::~ActuatorModel ( )
inline

Destructor.

Member Function Documentation

float ActuatorModel::advance ( const float  dt,
bool  debug = false 
)

References prevPosition_, prevShaft_, and project().

Referenced by Simulator::motion().

float ActuatorModel::getCurrent ( void  )
inline
float ActuatorModel::hysteresis ( const float  shaft)
private
float ActuatorModel::next ( const float  dt,
bool  debug = false 
)
private

References command_, prevShaft_, and speed_.

Referenced by project().

float ActuatorModel::project ( const float  dt)

Referenced by advance(), and Simulator::calcForce().

void ActuatorModel::project ( const float  dt,
float &  shaft,
float &  position,
bool  debug = false 
)
private

References hysteresis(), and next().

void ActuatorModel::setCommand ( const float  command)

References command_.

Referenced by Simulator::run().

void ActuatorModel::setHyst ( const float  width,
const float  center 
)
inline
Parameters
widthThe width of the hysteresis
centerThe center of the hysteresis curve (normally 0)

References hystCenter_, and hystWidth_.

Referenced by Simulator::loadParams().

void ActuatorModel::setPrevious ( const float  previous)
void ActuatorModel::setSpeed ( const float  speed)
inline

References speed_.

Referenced by Simulator::loadParams().

Member Data Documentation

float ActuatorModel::command_
private

Referenced by next(), and setCommand().

float ActuatorModel::hystCenter_
private

The center of the hysteresis curve (normally 0)

Referenced by hysteresis(), and setHyst().

float ActuatorModel::hystWidth_
private

The width in of the hysteresis.

Referenced by hysteresis(), and setHyst().

bool ActuatorModel::movingToLeft_
private

Referenced by hysteresis().

bool ActuatorModel::movingToRight_
private

Referenced by hysteresis().

float ActuatorModel::prevPosition_
private
float ActuatorModel::prevShaft_
private

Referenced by advance(), hysteresis(), next(), and setPrevious().

float ActuatorModel::speed_
private

Speed of the acutator (units/sec)

Referenced by next(), and setSpeed().


The documentation for this class was generated from the following files: