#include <rdActuatorSet.h>
Inheritance diagram for rdActuatorSet:

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. | |
| rdModel * | getModel () |
| Get a pointer to the model which is actuated. | |
| rdActuator * | setActuator (rdActuator *aActuator) |
| Set the actuator at the first empty index. | |
| rdActuator * | setActuator (int aIndex, rdActuator *aActuator) |
| Set the actuator at an index. | |
| rdActuator * | getActuator (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. | |
|
|
Construct an actuator set from file.
|
|
|
Compute the time derivatives of the states that characterize the actuators.
|
|
|
Generate an XML node representing this object.
Reimplemented from rdObject. |
|
|
Get the actuator at an index.
|
|
|
Get the controls for all actuators in the model. See getControlsIndex() for a description of the assumed layout of the controls array.
|
|
|
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
|
|
|
Get a pointer to the model which is actuated.
|
|
|
Get the total number of actuator controls.
|
|
|
Get the total number of actuator states.
|
|
|
Get the total number of actuator pseudostates.
|
|
|
Get the pseudostates for all actuators in the model. See getPseudoStatesIndex() for a description of the assumed layout of the pseudostates array.
|
|
|
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
|
|
|
Get the states for all actuators in the model. See getStatesIndex() for a description of the assumed layout of the states array.
|
|
|
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
|
|
||||||||||||
|
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. |
|
|
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.
|
|
||||||||||||
|
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.
|
|
|
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.
|
|
|
Set the controls for all actuators in the model. See getControlsIndex() for a description of the layout of the controls array.
|
|
|
Set the model for which actuation is provided.
|
|
|
Set the pseudostates for all actuators in the model. See getPseudoStatesIndex() for a description of the assumed layout of the pseudostates array.
|
|
|
Set the states for all actuators in the model. See getStatesIndex() for a description of the assumed layout of the states array.
|
|
|
Update this object based on its XML node.
Reimplemented from rdPtrArray. |
|
|
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). |
1.3