OpenSim::CustomForce Class Reference

This is an abstract subclass of Force which allows you to define new Force types by overriding methods, rather than having to create a new SimTK::Force subclass. More...

#include <CustomForce.h>

Inheritance diagram for OpenSim::CustomForce:
OpenSim::Force OpenSim::ModelComponent OpenSim::Object OpenSim::CoordinateLimitForce OpenSim::Ligament OpenSim::LinearSpring OpenSim::PrescribedForce OpenSim::SpringGeneralizedForce OpenSim::TorsionalSpring

List of all members.

Public Member Functions

 CustomForce ()
 CustomForce (const CustomForce &aForce)
 Copy constructor.
 CustomForce (DOMElement *aNode)

Protected Member Functions

virtual void createSystem (SimTK::MultibodySystem &system) const
 Create a SimTK::Force which implements this CustomForce.
virtual void computeForce (const SimTK::State &state, SimTK::Vector_< SimTK::SpatialVec > &bodyForces, SimTK::Vector &generalizedForces) const =0
 Subclasses must implement this method to compute the forces that should be applied to bodies and generalized speeds.
virtual double computePotentialEnergy (const SimTK::State &state) const
 Subclasses may optionally override this method to compute a contribution to the potential energy of the system.
void applyForce (const SimTK::State &s, const OpenSim::Body &aBody, const SimTK::Vec3 &aForce, SimTK::Vector_< SimTK::SpatialVec > &bodyForces) const
 Apply a force to a particular body.
void applyForceToPoint (const SimTK::State &s, const OpenSim::Body &aBody, const SimTK::Vec3 &aPoint, const SimTK::Vec3 &aForce, SimTK::Vector_< SimTK::SpatialVec > &bodyForces) const
 Apply a force to a particular body.
void applyTorque (const SimTK::State &s, const OpenSim::Body &aBody, const SimTK::Vec3 &aTorque, SimTK::Vector_< SimTK::SpatialVec > &bodyForces) const
 Apply a torque to a particular body.
void applyGeneralizedForce (const SimTK::State &s, const Coordinate &aCoord, double aForce, SimTK::Vector &generalizedForces) const
 Apply a generalized force.

Friends

class ForceAdapter

Detailed Description

This is an abstract subclass of Force which allows you to define new Force types by overriding methods, rather than having to create a new SimTK::Force subclass.


Constructor & Destructor Documentation

CustomForce::CustomForce (  ) 
CustomForce::CustomForce ( const CustomForce aForce  ) 

Copy constructor.

Parameters:
aActuator Actuator to copy.
OpenSim::CustomForce::CustomForce ( DOMElement *  aNode  )  [inline]

Member Function Documentation

void OpenSim::CustomForce::applyForce ( const SimTK::State &  s,
const OpenSim::Body aBody,
const SimTK::Vec3 &  aForce,
SimTK::Vector_< SimTK::SpatialVec > &  bodyForces 
) const [protected]

Apply a force to a particular body.

This method applies only a force, not a torque, which is equivalent to applying the force at the body's center of mass.

This method may only be called from inside computeForce(). Invoking it at any other time will produce an exception.

Parameters:
aBody the body to apply the force to
aForce the force to apply, specified in the inertial frame Apply a force to a particular body. This method applies only a force, not a torque, which is equivalent to applying the force at the body's center of mass.

This method may only be called from inside computeForce(). Invoking it at any other time will produce an exception.

Parameters:
aBody the body to apply the force to
aForce the force to apply, specified in the inertial frame
bodyForces the current set of system bodyForces this force is added to
void OpenSim::CustomForce::applyForceToPoint ( const SimTK::State &  s,
const OpenSim::Body aBody,
const SimTK::Vec3 &  aPoint,
const SimTK::Vec3 &  aForce,
SimTK::Vector_< SimTK::SpatialVec > &  bodyForces 
) const [protected]

Apply a force to a particular body.

Based on what point the force is applied at, this method automatically determines the torque produced by the force and applies that as well.

This method may only be called from inside computeForce(). Invoking it at any other time will produce an exception.

Parameters:
aBody the body to apply the force to
aPoint the point at which to apply the force, specifieid in the inertial frame
aForce the force to apply, specified in the body's frame
bodyForces the current set of system bodyForces this force is added to
void OpenSim::CustomForce::applyGeneralizedForce ( const SimTK::State &  s,
const Coordinate aCoord,
double  aForce,
SimTK::Vector &  generalizedForces 
) const [protected]

Apply a generalized force.

This method may only be called from inside computeForce(). Invoking it at any other time will produce an exception.

Parameters:
aCoord the generalized coordinate to apply the force to
aForce the force to apply
generalizedForces the current set of system generalizedForces this force is added to
void OpenSim::CustomForce::applyTorque ( const SimTK::State &  s,
const OpenSim::Body aBody,
const SimTK::Vec3 &  aTorque,
SimTK::Vector_< SimTK::SpatialVec > &  bodyForces 
) const [protected]

Apply a torque to a particular body.

This method may only be called from inside computeForce(). Invoking it at any other time will produce an exception.

Parameters:
aBody the body to apply the force to
aTorque the torque to apply, specified in the inertial frame
bodyForces the current set of system bodyForces this force is added to
virtual void OpenSim::CustomForce::computeForce ( const SimTK::State &  state,
SimTK::Vector_< SimTK::SpatialVec > &  bodyForces,
SimTK::Vector &  generalizedForces 
) const [protected, pure virtual]

Subclasses must implement this method to compute the forces that should be applied to bodies and generalized speeds.

This is invoked by ForceAdapter to perform the force computation.

Implemented in OpenSim::CoordinateLimitForce, OpenSim::SpringGeneralizedForce, OpenSim::Ligament, OpenSim::LinearSpring, OpenSim::PrescribedForce, and OpenSim::TorsionalSpring.

double CustomForce::computePotentialEnergy ( const SimTK::State &  state  )  const [protected, virtual]

Subclasses may optionally override this method to compute a contribution to the potential energy of the system.

The default implementation returns 0, which is appropriate for forces that do not contribute to potential energy.

void CustomForce::createSystem ( SimTK::MultibodySystem &  system  )  const [protected, virtual]

Create a SimTK::Force which implements this CustomForce.

Implements OpenSim::ModelComponent.

Reimplemented in OpenSim::SpringGeneralizedForce.


Friends And Related Function Documentation

friend class ForceAdapter [friend]

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

Generated on Mon Nov 8 15:37:09 2010 for OpenSim by  doxygen 1.6.1