Simbody
Public Member Functions

SimTK::QValue Class Reference

This AssemblyCondition requests that a particular generalized coordinate end up with a specified value. More...

#include <Assembler.h>

Inheritance diagram for SimTK::QValue:

List of all members.

Public Member Functions

 QValue (MobilizedBodyIndex mbx, MobilizerQIndex qx, Real value)
 Construct an assembly condition that requests that the specified generalized coordinate be brought to the indicated value.
Real getValue () const
 Return the currently set value to be used for this generalized coordinate.
void setValue (Real newValue)
 Change the value to be used for this generalized coordinate; this can be done repeatedly during tracking to follow changing requirements.
int getNumEquations (const State &) const
int calcErrors (const State &state, Vector &error) const
 Calculate the amount by which this assembly condition is violated by the q values in the given state, with one scalar error per assembly equation returned in err.
int calcErrorJacobian (const State &state, Matrix &J) const
 Override to supply an analytic Jacobian for the assembly errors returned by calcErrors().
int calcGoal (const State &state, Real &goal) const
 Calculate the current contribution (>= 0) of this assembly condition to the goal value that is being minimized.
int calcGoalGradient (const State &state, Vector &grad) const
 Override to supply an analytic gradient for this assembly condition's goal.

Detailed Description

This AssemblyCondition requests that a particular generalized coordinate end up with a specified value.

You can use this as a goal or a constraint, depending on how serious you are about this requirement.


Constructor & Destructor Documentation

SimTK::QValue::QValue ( MobilizedBodyIndex  mbx,
MobilizerQIndex  qx,
Real  value 
) [inline]

Construct an assembly condition that requests that the specified generalized coordinate be brought to the indicated value.

The value can be changed subsequently using setValue().


Member Function Documentation

Real SimTK::QValue::getValue ( ) const [inline]

Return the currently set value to be used for this generalized coordinate.

void SimTK::QValue::setValue ( Real  newValue) [inline]

Change the value to be used for this generalized coordinate; this can be done repeatedly during tracking to follow changing requirements.

int SimTK::QValue::getNumEquations ( const State ) const [inline]
int SimTK::QValue::calcErrors ( const State state,
Vector err 
) const [inline, virtual]

Calculate the amount by which this assembly condition is violated by the q values in the given state, with one scalar error per assembly equation returned in err.

The functional return should be zero if successful; negative values are reserved with -1 meaning "not implemented"; return a positive value if your implementation is unable to evaluate the error at the current state. If this method is not implemented then you must implement calcGoal() and this assembly condition may only be used as a goal, not a requirement.

Reimplemented from SimTK::AssemblyCondition.

int SimTK::QValue::calcErrorJacobian ( const State state,
Matrix jacobian 
) const [inline, virtual]

Override to supply an analytic Jacobian for the assembly errors returned by calcErrors().

The returned Jacobian must be nErr X nFreeQs; that is, if there is only one assembly error equation the returned matrix is a single row (that's the transpose of the gradient). The functional return should be zero if this succeeds; negative values are reserved with the default implementation returning -1 which indicates that the Jacobian must be calculated numerically using the calcErrors() method. Return a positive value if your implementation is unable to evaluate the Jacobian at the current state.

Reimplemented from SimTK::AssemblyCondition.

int SimTK::QValue::calcGoal ( const State state,
Real &  goal 
) const [inline, virtual]

Calculate the current contribution (>= 0) of this assembly condition to the goal value that is being minimized.

If this isn't overridden we'll generate it by combining the m errors returned by calcErrors() in a mean sum of squares: goal = err^2/m.

Reimplemented from SimTK::AssemblyCondition.

int SimTK::QValue::calcGoalGradient ( const State state,
Vector gradient 
) const [inline, virtual]

Override to supply an analytic gradient for this assembly condition's goal.

The returned gradient must be nFreeQ X 1; that is, it is a column vector giving the partial derivative of the goal with respect to each of the free q's in order. The functional return should be zero if this succeeds. The default implementation return -1 which indicates that the gradient must be calculated numerically using the calcGoal() method.

Reimplemented from SimTK::AssemblyCondition.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines