Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

rdActuatorSet Class Reference

An class for holding and managing a set of actuators for a model. More...

#include <rdActuatorSet.h>

Inheritance diagram for rdActuatorSet:

rdPtrArray rdObject List of all members.

Public Member Functions

 rdActuatorSet ()
 Default constructor.

 rdActuatorSet (const char *aFileName)
 Construct an actuator set from file.

virtual ~rdActuatorSet ()
 Destructor.

void setModel (rdModel *aModel)
 Set the model for which actuation is provided.

rdModelgetModel ()
 Get a pointer to the model which is actuated.

rdActuatorsetActuator (rdActuator *aActuator)
 Set the actuator at the first empty index.

rdActuatorsetActuator (int aIndex, rdActuator *aActuator)
 Set the actuator at an index.

rdActuatorgetActuator (int aIndex) const
 Get the actuator at an index.

int getNX ()
 Get the total number of actuator controls.

int getControlsIndex (int aWhich)
 Get the index for the controls array for a particular actuator.

void setControls (const double aX[])
 Set the controls for all actuators in the model.

void getControls (double rX[])
 Get the controls for all actuators in the model.

int getNY ()
 Get the total number of actuator states.

int getStatesIndex (int aWhich)
 Get the index for the states array for a particular actuator.

void setStates (const double aY[])
 Set the states for all actuators in the model.

void getStates (double rY[])
 Get the states for all actuators in the model.

int getNYP ()
 Get the total number of actuator pseudostates.

int getPseudoStatesIndex (int aWhich)
 Get the index for the pseudostates array for a particular actuator.

void setPseudoStates (const double aY[])
 Set the pseudostates for all actuators in the model.

void getPseudoStates (double rY[])
 Get the pseudostates for all actuators in the model.

void promoteControlsToStates (const double aX[], double aDT)
 Promote a set of controls to state variables.

void computeActuation ()
 For each actuator, compute all quantities necessary for actuating the model.

void computeStateDerivatives (double rDY[])
 Compute the time derivatives of the states that characterize the actuators.

void updatePseudoStates ()
 Update the pseudostates of all actuators.

void apply ()
 For each actuator, apply the force(s) (or torque(s)) to the model.

bool check () const
 Check that all actuators are valid.

void updateObject (bool aDeep=true)
 Update this object based on its XML node.

void updateNode (bool aDeep=true)
 Update the XML node representing this object.

void generateNode (IDOM_Element *aParent)
 Generate an XML node representing this object.


Static Public Member Functions

void RegisterType (const rdActuator &aActuator)
 Register a supported actuator type.


Protected Attributes

rdPtrArray _defaultActuators
 Expandable array of default actuators.

rdModel_model
 Model that is actuated.

int _nx
 Number of controls.

int * _controlsIndex
 Controls index.

int _ny
 Number of states.

int * _statesIndex
 States index.

int _nyp
 Number of pseudostates.

int * _pseudoIndex
 Pseudostates index.


Private Member Functions

void setNull ()
 Set the data members of this actuator to their null values.

void constructControlsIndex ()
 Construct the controls index.

void constructStatesIndex ()
 Construct the states index.

void constructPseudoStatesIndex ()
 Construct the pseudostates index.

void constructDefaultActuators ()
 Construct the default actuators.


Static Private Attributes

rdPtrArray _ActuatorTypes
 Expandable array of supported actuator types.


Detailed Description

An class for holding and managing a set of actuators for a model.

Author:
Frank C. Anderson
Version:
1.0


Constructor & Destructor Documentation

rdActuatorSet::rdActuatorSet const char *  aFileName  ) 
 

Construct an actuator set from file.

Parameters:
aFileName Name of the file.


Member Function Documentation

void rdActuatorSet::computeStateDerivatives double  rDY[]  ) 
 

Compute the time derivatives of the states that characterize the actuators.

Parameters:
rDY Array of state derivatives.

void rdActuatorSet::generateNode IDOM_Element *  aParent  )  [virtual]
 

Generate an XML node representing this object.

Parameters:
aParent Intended parent of the node to be generated. If aParent is NULL, the intent is for this object to serve as the root element of a new document.

Reimplemented from rdObject.

rdActuator * rdActuatorSet::getActuator int  aIndex  )  const
 

Get the actuator at an index.

Parameters:
aIndex Array index of the actuator to be returned.
Returns:
Actutor at index aIndex.

void rdActuatorSet::getControls double  rX[]  ) 
 

Get the controls for all actuators in the model.

See getControlsIndex() for a description of the assumed layout of the controls array.

Parameters:
rX Array of controls for all actuators.
See also:
getControlsIndex()

int rdActuatorSet::getControlsIndex int  aWhich  ) 
 

Get the index for the controls array for a particular actuator.

The controls for all the actuators of a model are held in an array of values. The convention used by rdActuatorSet is that the controls for an actuator are held sequentially in the controls array:

ControlsArray Act Act State x[iact+0] 0 0 x[iact+1] 0 1 x[iact+2] 0 2 x[iact+3] 1 0 x[iact+4] 3 0 x[iact+5] 3 1 ... ... ...

Notice that not all actuators need have the same number of controls. In the above example, actuator 0 has 3 controls, actuator 1 has 1 controls, actuator 2 has 0 controls, and actuator 3 has 2 controls.

Note also that it is assumed that the indeces are computed as though the actuator controls start at the beginning of the controls array. In actuality the actuator states may start in the middle of some larger controls array. The index iAct above indexes where in the controls array x, the actuator states begin. The caller should account for this as necessary.

This method returns the array index that marks the beginning of the controls for a particular actuator. In the event the actuator has no controls, -1 is returned. For the above example, the following values of aWhichActuator would produce the following return values:

aWhichActuator Return 0 0 1 3 2 -1 3 4

Parameters:
aWhichActuator The number (or index) of the actuator whose controls index is desired.
Returns:
Array index that marks the beginning of the controls for the specified actuator. In the event the actuator has no controls, -1 is returned.

rdModel * rdActuatorSet::getModel  ) 
 

Get a pointer to the model which is actuated.

Returns:
Pointer to the model.

int rdActuatorSet::getNX  ) 
 

Get the total number of actuator controls.

Returns:
Total number of actuator controls.

int rdActuatorSet::getNY  ) 
 

Get the total number of actuator states.

Returns:
Total number of actuator states.

int rdActuatorSet::getNYP  ) 
 

Get the total number of actuator pseudostates.

Returns:
Total number of actuator pseudostates.

void rdActuatorSet::getPseudoStates double  rY[]  ) 
 

Get the pseudostates for all actuators in the model.

See getPseudoStatesIndex() for a description of the assumed layout of the pseudostates array.

Parameters:
rY Array of pseudostates for all actuators. The first element of aYP is assumed to be the beginning of the pseudo states for the actuators.
See also:
getPseudoStatesIndex()

int rdActuatorSet::getPseudoStatesIndex int  aWhich  ) 
 

Get the index for the pseudostates array for a particular actuator.

The pseudostates that characterize all the actuators of a model are held by the model in an array of values. The convention used by rdActuatorSet is that the pseudostates for an actuator are held in this array sequentially:

PseudoStatesArray Act Act State yp[iact+0] 0 0 yp[iact+1] 0 1 yp[iact+2] 0 2 yp[iact+3] 1 0 yp[iact+4] 3 0 yp[iact+5] 3 1 ... ... ...

Notice that not all actuators need have the same number of pseudostates. In the above example, actuator 0 has 3 pseudostates, actuator 1 has 1 pseudostate, actuator 2 has 0 pseudostates, and actuator 3 has 2 pseudostates.

Note also that it is assumed that the indeces are computed as though the actuator pseudostates start at the beginning of the pseudostates array. In actuality the actuator pseudostates may start in the middle of some larger array. The index iAct above indexes where in the pseudostate array yp the actuator pseudostates begin. It should be apparent to the caller what this number is and should account for as necessary.

This method returns the array index that marks the beginning of the pseudostates for a particular actuator. In the event the actuator has no pseudostates, -1 is returned. For the above example, the following values of aWhichActuator would produce the following return values:

aWhichActuator Return 0 0 1 3 2 -1 3 4

Parameters:
aWhichActuator The number (or index) of the actuator whose pseudostate index is desired.
Returns:
Array index that marks the beginning of the pseudostates for the specified actuator. In the event the actuator has no pseudostates, -1 is returned.

void rdActuatorSet::getStates double  rY[]  ) 
 

Get the states for all actuators in the model.

See getStatesIndex() for a description of the assumed layout of the states array.

Parameters:
rY Array of states for all actuators.
See also:
getStatesIndex()

int rdActuatorSet::getStatesIndex int  aWhich  ) 
 

Get the index for the states array for a particular actuator.

The states that characterize all the actuators of a model are held by the model in an array of values. The convention used by rdActuatorSet is that the states for an actuator are held in this array sequentially:

StatesArray Act Act State y[iact+0] 0 0 y[iact+1] 0 1 y[iact+2] 0 2 y[iact+3] 1 0 y[iact+4] 3 0 y[iact+5] 3 1 ... ... ...

Notice that not all actuators need have the same number of states. In the above example, actuator 0 has 3 states, actuator 1 has 1 state, actuator 2 has 0 states, and actuator 3 has 2 states.

Note also that it is assumed that the indeces are computed as though the actuator states start at the beginning of the states array. In actuality the actuator states may start in the middle of some larger states array. The index iAct above indexes where in the state array y, the actuator states begin. The caller should account for this as necessary.

This method returns the array index that marks the beginning of the states for a particular actuator. In the event the actuator has no states, -1 is returned. For the above example, the following values of aWhichActuator would produce the following return values:

aWhichActuator Return 0 0 1 3 2 -1 3 4

Parameters:
aWhichActuator The number (or index) of the actuator whose state index is desired.
Returns:
Array index that marks the beginning of the states for the specified actuator. In the event the actuator has no states, -1 is returned.

void rdActuatorSet::promoteControlsToStates const double  aX[],
double  aDT
 

Promote a set of controls to state variables.

This method is normally useful when solving for controls that will optimize some aspect of a model performance. For example, in models in which the controls are neural excitations, but muscle forces are determined by activation level, this method might set the muscle activations equal to the excitations. Each actuator is responsible for knowing how to promote its own controls to states.

void rdActuatorSet::RegisterType const rdActuator aActuator  )  [static]
 

Register a supported actuator type.

Any actuator type that is supported can be written to and read from an XML file. The actuator must have implemented the following methods to be supported: 1) copy constructor (e.g., rdForce::rdForce(const rdForce &aForce)) 2) virtual rdActuator* copy() const, 3) virtual rdActuator* copy(IDOM_Element*) const, 4) rdActuator& operator=() (!! with the appropriate return type), 5) virtual void updateObject(bool aDeep=true), 6) virtual void updateNode(bool aDeep=true), and 7) virtual void generateNode(IDOM_Element *aParent).

Because this method is static, registration of actuator types needs to be done only once per process and an rdActuatorSet does not need to be instantiated to do so.

This method makes a copy of the specified actuator, so the caller may continue to use the spacified actuator (aActuator) for whatever purpose.

Parameters:
aActuator Actuator of the type to be added.

rdActuator * rdActuatorSet::setActuator int  aIndex,
rdActuator aActuator
 

Set the actuator at an index.

Sending in NULL for the rdActuator pointer essentially removes the actuator at aIndex from the array of actuators. Note however that the caller is responsible for deleting any actuators that are removed from this list in this way. For this reason, the actuator pointer previously held at aIndex is returned by this method.

It is also permissible to send in any positive value for aIndex, and there can be gaps in the array of actuators. However, it is advisible to use setActuators(rdActuator*) when adding an actutor so the array of actuators remains contiguous.

Parameters:
aIndex Array index where the actuator is to be stored.
aActuator Actuator pointer.
Returns:
Pointer to the actuator previously held at aIndex.

rdActuator * rdActuatorSet::setActuator rdActuator aActuator  ) 
 

Set the actuator at the first empty index.

This method should always return NULL. If it does not return NULL, it means that an actuator was already stored at what was thought to be the first empty location.

Parameters:
aIndex Array index where the actuator is to be stored.
aActuator Actuator.
Returns:
Pointer to the actuator previously held.

void rdActuatorSet::setControls const double  aX[]  ) 
 

Set the controls for all actuators in the model.

See getControlsIndex() for a description of the layout of the controls array.

Parameters:
aX Array of controls for all actuators.
See also:
getControlsIndex()

void rdActuatorSet::setModel rdModel aModel  ) 
 

Set the model for which actuation is provided.

Returns:
Pointer to the model.

void rdActuatorSet::setPseudoStates const double  aY[]  ) 
 

Set the pseudostates for all actuators in the model.

See getPseudoStatesIndex() for a description of the assumed layout of the pseudostates array.

Parameters:
aYP Array of pseudostates for all actuators. The first element of aYP is assumed to be the beginning of the pseudo states for the actuators.
See also:
getPseudoStatesIndex()

void rdActuatorSet::setStates const double  aY[]  ) 
 

Set the states for all actuators in the model.

See getStatesIndex() for a description of the assumed layout of the states array.

Parameters:
aY Array of states for all actuators.
See also:
getStatesIndex()

void rdActuatorSet::updateObject bool  aDeep = true  )  [virtual]
 

Update this object based on its XML node.

Parameters:
aDeep If true, update this object and all its child objects (that is, member variables that are rdObject's); if false, update only the member variables that are not rdObject's.

Reimplemented from rdPtrArray.

void rdActuatorSet::updatePseudoStates  ) 
 

Update the pseudostates of all actuators.

Pseudostates are quantities that are not integrated but that depend on the time history of a simulation (e.g., spring set points).


The documentation for this class was generated from the following files:
Generated on Wed Aug 20 02:17:09 2003 for Simulation Software by doxygen1.3