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

rdForce Class Reference

A class that supports the application of a force between two bodies, BodyA and BodyB. More...

#include <rdForce.h>

Inheritance diagram for rdForce:

rdActuator rdObject rdContactForce rdMuscleZajac rdSetPoint rdLinearSetPoint rdPolynomialSetPoint List of all members.

Public Member Functions

 rdForce (int aBodyA=0, int aBodyB=0, int aNX=1, int aNY=0, int aNYP=0)
 Default constructor.

 rdForce (IDOM_Element *aElement, int aNX=1, int aNY=0, int aNYP=0)
 Construct an actuator from file.

 rdForce (const rdForce &aForce)
 Copy constructor.

virtual ~rdForce ()
 Destructor.

virtual rdActuatorcopy () const
 Copy this actuator.

virtual rdActuatorcopy (IDOM_Element *aElement) const
 Copy this actuator and modify the copy so that it is consistent with a specified XML element node.

rdForce & operator= (const rdForce &aForce)
 Assignment operator.

virtual void setControls (const double aX[])
 Set the current values of the controls.

virtual void getControls (double rX[]) const
 Get the current values of the controls.

void setBodyA (int aID)
 Set the id of the first body to which the force is applied.

int getBodyA () const
 Get the id of the first body to which the force is applied.

void setPointA (const double aPoint[3])
 Set the value of the point on BodyA at which the force is applied.

void getPointA (double rPoint[3]) const
 Get the value of the point on BodyA at which the force is applied.

void setForceDirectionA (const double aDirection[3])
 Set the direction in which a positive actuator force is applied to BodyA.

void getForceDirectionA (double rDirection[3]) const
 Set the direction in which a positive actuator force is applied to BodyA.

void setBodyB (int aID)
 Set the id of the second body to which the force is applied.

int getBodyB () const
 Get the id of the second body to which the force is applied.

void setPointB (const double aPoint[3])
 Set the value of the point on BodyB at which the force is applied.

void getPointB (double rPoint[3]) const
 Get the value of the point on BodyB at which the force is applied.

void getForceDirectionB (double rDirection[3]) const
 Get the direction in which a positive actuator force is applied to BodyB.

virtual void apply ()
 Apply the actuator force to BodyA and BodyB.

virtual void computeActuation ()
 Compute all quantities necessary for applying the actuator force to the model.

void computeForceDirectionForBodyB ()
 Compute the force direction for BodyB based on the force direction set for BodyA.

void computeSpeed ()
 Compute the speed of the actuator.

virtual bool check () const
 Check that this force actuator has a valid set of states.

void computeLineOfAction (double aLineOfAction[3]) const
 Compute the vector directed from the point of force application on BodyA to the point of force application on BodyB expressed in the local frame of BodyA.

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

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

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

void updateData ()
 Update the member data of this object based on its XML node.


Static Public Attributes

const char PROP_BODYA [] = "body_A"
const char PROP_POINTA [] = "point_A"
const char PROP_DIRECTIONA [] = "direction_A"
const char PROP_BODYB [] = "body_B"
const char PROP_POINTB [] = "point_B"

Protected Attributes

int _bA
 BodyA.

double _pA [3]
 Point on BodyA expressed in the body-local frame at which the force is applied.

double _uA [3]
 Unit vector expressed in the local frame of BodyA that specifies the direction a positive actuator force is applied to BodyA.

int _bB
 BodyB.

double _pB [3]
 Point on BodyB expressed in the body-local frame at which the force is applied.

double _uB [3]
 Unit vector expressed in the local frame of BodyB that specifies the direction a positive actuator force is applied to BodyB.


Private Member Functions

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


Detailed Description

A class that supports the application of a force between two bodies, BodyA and BodyB.

This actuator has no states; the control is simply the force to be applied to the model.

Author:
Frank C. Anderson
Version:
1.0


Constructor & Destructor Documentation

rdForce::rdForce IDOM_Element *  aElement,
int  aNX = 1,
int  aNY = 0,
int  aNYP = 0
 

Construct an actuator from file.

Parameters:
aFileName Name of the file.

rdForce::rdForce const rdForce &  aForce  ) 
 

Copy constructor.

Parameters:
aForce Force to be copied.


Member Function Documentation

void rdForce::computeLineOfAction double  aLineOfAction[3]  )  const
 

Compute the vector directed from the point of force application on BodyA to the point of force application on BodyB expressed in the local frame of BodyA.

Parameters:
rLineOfAction Line of action expressed in the local frame of BodyA.
Todo:
Check that the line of action is expressed in the proper frame.

rdActuator * rdForce::copy IDOM_Element *  aElement  )  const [virtual]
 

Copy this actuator and modify the copy so that it is consistent with a specified XML element node.

The copy is constructed by first using rdForce::rdForce(IDOM_Element*,int,int) in order to establish the relationship of the rdForce object with the XML node. Then, the assignment operator is used to set all data members of the copy to the values of this rdForce object. Finally, the data members of the copy are updated using rdForce::updateObject().

Parameters:
aElement XML element.
Returns:
Pointer to a copy of this actuator.

Implements rdActuator.

Reimplemented in rdLinearSetPoint, rdMuscleZajac, and rdPolynomialSetPoint.

rdActuator * rdForce::copy  )  const [virtual]
 

Copy this actuator.

The copy constructor for this class is used.

Returns:
Pointer to a copy of this actuator.

Implements rdActuator.

Reimplemented in rdLinearSetPoint, rdMuscleZajac, and rdPolynomialSetPoint.

void rdForce::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.
See also:
rdObject::generateNode()

Reimplemented from rdActuator.

Reimplemented in rdLinearSetPoint, rdMuscleZajac, rdPolynomialSetPoint, rdSetPoint, and rdContactForce.

int rdForce::getBodyA  )  const
 

Get the id of the first body to which the force is applied.

Parameters:
aID Body ID.

int rdForce::getBodyB  )  const
 

Get the id of the second body to which the force is applied.

Parameters:
aID Body ID.

void rdForce::getControls double  rX[]  )  const [virtual]
 

Get the current values of the controls.

Parameters:
aX Array of control values.

Reimplemented from rdActuator.

Reimplemented in rdMuscleZajac.

void rdForce::getForceDirectionA double  rDirection[3]  )  const
 

Set the direction in which a positive actuator force is applied to BodyA.

Parameters:
rPoint Point x, y, and z values.

void rdForce::getForceDirectionB double  rDirection[3]  )  const
 

Get the direction in which a positive actuator force is applied to BodyB.

Note that the direction of force application on BodyB cannot be set; it is always computed based on the force direction set for BodyA.

Parameters:
rPoint Point x, y, and z values.

void rdForce::getPointA double  rPoint[3]  )  const
 

Get the value of the point on BodyA at which the force is applied.

Parameters:
rPoint Point x, y, and z values.

void rdForce::getPointB double  rPoint[3]  )  const
 

Get the value of the point on BodyB at which the force is applied.

Parameters:
rPoint Point x, y, and z values.

rdForce & rdForce::operator= const rdForce &  aForce  ) 
 

Assignment operator.

Returns:
Reference to this object.

void rdForce::setBodyA int  aID  ) 
 

Set the id of the first body to which the force is applied.

Parameters:
aID Body ID.

void rdForce::setBodyB int  aID  ) 
 

Set the id of the second body to which the force is applied.

Parameters:
aID Body ID.

void rdForce::setControls const double  aX[]  )  [virtual]
 

Set the current values of the controls.

Parameters:
aX Array of control values.

Reimplemented from rdActuator.

Reimplemented in rdMuscleZajac.

void rdForce::setForceDirectionA const double  aDirection[3]  ) 
 

Set the direction in which a positive actuator force is applied to BodyA.

Newton's second law states that the force between two bodies is equal and opposite in direction, so when the direction of force on one body is known, the direction on the other body can be calculated. Therefore, the direction of force on BodyB is always computed.

Parameters:
aDirection Direction. The direction is normalized. If the magnitude of aDirection is less than rdMath::ZERO, the force direction is set to the zero vector, the effect of which is to prevent any force from being applied.

void rdForce::setPointA const double  aPoint[3]  ) 
 

Set the value of the point on BodyA at which the force is applied.

Parameters:
aPoint Point x, y, and z values.

void rdForce::setPointB const double  aPoint[3]  ) 
 

Set the value of the point on BodyB at which the force is applied.

Parameters:
aPoint Point x, y, and z values.

void rdForce::updateData  ) 
 

Update the member data of this object based on its XML node.

Member objects (children) are not updated.

Reimplemented from rdActuator.

Reimplemented in rdLinearSetPoint, rdMuscleZajac, rdPolynomialSetPoint, rdSetPoint, and rdContactForce.

void rdForce::updateNode bool  aDeep = true  )  [virtual]
 

Update the XML node representing this object.

Parameters:
aDeep If true, update the XML node of this object AND the XML nodes of all class members that are rdObjects (child nodes); if false, update only the XML node of this object without updating the XML nodes of its children.

Reimplemented from rdActuator.

Reimplemented in rdLinearSetPoint, rdMuscleZajac, rdPolynomialSetPoint, rdSetPoint, and rdContactForce.

void rdForce::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 rdActuator.

Reimplemented in rdLinearSetPoint, rdMuscleZajac, rdPolynomialSetPoint, rdSetPoint, and rdContactForce.


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