OpenSim::InverseKinematicsSolver Class Reference

Solve for the coordinates (degrees-of-freedom) of the model that satisfy the set of constraints imposed on the model as well as set of desired coordinate values. More...

#include <InverseKinematicsSolver.h>

Inheritance diagram for OpenSim::InverseKinematicsSolver:
OpenSim::AssemblySolver OpenSim::Solver OpenSim::Object

List of all members.

Public Member Functions

virtual ~InverseKinematicsSolver ()
 InverseKinematicsSolver (const Model &model, MarkersReference &markersReference, SimTK::Array_< CoordinateReference > &coordinateReferences, double constraintWeight=SimTK::Infinity)
 An implementation of the InverseKinematicsSolver.
void updateMarkerWeight (const std::string &markerName, double value)
 Assemble a model configuration that meets the InverseKinematics conditions (desired values and constraints) starting from an initial state that does not have to satisfy the constraints.
void updateMarkerWeight (int markerIndex, double value)
 Update a marker's weight by its index.
void updateMarkerWeights (const SimTK::Array_< double > &weights)
 Update all markers weights by order in the markersRerence passed in to construct the solver.
SimTK::Vec3 computeCurrentMarkerLocation (const std::string &markerName)
 Compute and return the spatial location of a marker in ground.
SimTK::Vec3 computeCurrentMarkerLocation (int markerIndex)
void computeCurrentMarkerLocations (SimTK::Array_< SimTK::Vec3 > &markerLocations)
 Compute and return the spatial locations of all markers in ground.
double computeCurrentMarkerError (const std::string &markerName)
 Compute and return the distance error between model marker and observation.
double computeCurrentMarkerError (int markerIndex)
void computeCurrentMarkerErrors (SimTK::Array_< double > &markerErrors)
 Compute and return the distance errors between all model markers and their observations.
double computeCurrentSquaredMarkerError (const std::string &markerName)
 Compute and return the squared-distance error between model marker and observation.
double computeCurrentSquaredMarkerError (int markerIndex)
void computeCurrentSquaredMarkerErrors (SimTK::Array_< double > &markerErrors)
 Compute and return the distance errors between all model marker and observations.

Protected Member Functions

virtual void setupGoals (SimTK::State &s)
 Internal method to convert the CoordinateReferences into goals of the assembly solver.
virtual void updateGoals (const SimTK::State &s)
 Internal method to update the time, reference values and/or their weights that define the goals, based on the passed in state.

Protected Attributes

MarkersReference_markersReference
SimTK::Markers * _markerAssemblyCondition

Detailed Description

Solve for the coordinates (degrees-of-freedom) of the model that satisfy the set of constraints imposed on the model as well as set of desired coordinate values.

The InverseKinematics provides the option to convert the problem to an approximate one where the constraint violations are treated as penalties to be minimized rather than strictly enforced. This can speed up the time solution and can be used to seed the constrained problem near to a solution.

The InverseKinematics objective: min J = sum(Wm*(m_i-md_i)^T*(m_i-md_i)) + sum(Wq_i*(q_i-qd_i)^2)) + [Wc*sum(c_err)^2] where m_i and md_i are the model and desired marker coordinates (Vec3) iff Wc == Infinity, second term is not included, but A is subject to the constraint equations: G(q)-Go = 0

When the model (and the number of goals) is guaranteed not to change and the the initial state is close to the InverseKinematics solution (from initial assemble(), then track() is a efficient method for updating the configuration to track the small change to the desired coorindate value.

See SimTK::Assembler for more algorithmic details of the underlying solver.

Author:
Ajay Seth
Version:
1.0

Constructor & Destructor Documentation

virtual OpenSim::InverseKinematicsSolver::~InverseKinematicsSolver (  )  [inline, virtual]
OpenSim::InverseKinematicsSolver::InverseKinematicsSolver ( const Model model,
MarkersReference markersReference,
SimTK::Array_< CoordinateReference > &  coordinateReferences,
double  constraintWeight = SimTK::Infinity 
)

An implementation of the InverseKinematicsSolver.

Parameters:
model to assemble

Member Function Documentation

double OpenSim::InverseKinematicsSolver::computeCurrentMarkerError ( int  markerIndex  ) 
double OpenSim::InverseKinematicsSolver::computeCurrentMarkerError ( const std::string &  markerName  ) 

Compute and return the distance error between model marker and observation.

void OpenSim::InverseKinematicsSolver::computeCurrentMarkerErrors ( SimTK::Array_< double > &  markerErrors  ) 

Compute and return the distance errors between all model markers and their observations.

SimTK::Vec3 OpenSim::InverseKinematicsSolver::computeCurrentMarkerLocation ( int  markerIndex  ) 
SimTK::Vec3 OpenSim::InverseKinematicsSolver::computeCurrentMarkerLocation ( const std::string &  markerName  ) 

Compute and return the spatial location of a marker in ground.

void OpenSim::InverseKinematicsSolver::computeCurrentMarkerLocations ( SimTK::Array_< SimTK::Vec3 > &  markerLocations  ) 

Compute and return the spatial locations of all markers in ground.

double OpenSim::InverseKinematicsSolver::computeCurrentSquaredMarkerError ( int  markerIndex  ) 
double OpenSim::InverseKinematicsSolver::computeCurrentSquaredMarkerError ( const std::string &  markerName  ) 

Compute and return the squared-distance error between model marker and observation.

This is cheaper than calling the error and squaring it, since distance from norm-2

void OpenSim::InverseKinematicsSolver::computeCurrentSquaredMarkerErrors ( SimTK::Array_< double > &  markerErrors  ) 

Compute and return the distance errors between all model marker and observations.

void OpenSim::InverseKinematicsSolver::setupGoals ( SimTK::State &  s  )  [protected, virtual]

Internal method to convert the CoordinateReferences into goals of the assembly solver.

Internal method to convert the MarkerReferences into additional goals of the of the base assembly solver, that is going to do the assembly.

Subclasses, can add oveeride to include other goals such as point of interest matching (Marker tracking). This method is automatically called by assemble.

Reimplemented from OpenSim::AssemblySolver.

void OpenSim::InverseKinematicsSolver::updateGoals ( const SimTK::State &  s  )  [protected, virtual]

Internal method to update the time, reference values and/or their weights that define the goals, based on the passed in state.

Internal method to update the time, reference values and/or their weights based on the state.

Reimplemented from OpenSim::AssemblySolver.

void OpenSim::InverseKinematicsSolver::updateMarkerWeight ( int  markerIndex,
double  value 
)

Update a marker's weight by its index.

void OpenSim::InverseKinematicsSolver::updateMarkerWeight ( const std::string &  markerName,
double  value 
)

Assemble a model configuration that meets the InverseKinematics conditions (desired values and constraints) starting from an initial state that does not have to satisfy the constraints.

Change the weighting of a marker to take affect when assemble or track is called next.

Obtain a model configuration that meets the InverseKinematics conditions (desired values and constraints) given a state that satisfies or is close to satisfying the constraints. Note there can be no change in the number of constrainst or desired coordinates. Desired coordinate values can and should be updated between repeated calls to track a desired trajectory of coordinate values. Change the weighting of a marker to take affect when assemble or track is called next. Update a marker's weight by name.

Update a marker's weight by name.

void OpenSim::InverseKinematicsSolver::updateMarkerWeights ( const SimTK::Array_< double > &  weights  ) 

Update all markers weights by order in the markersRerence passed in to construct the solver.

Update all markers weights by order in the markersReference passed in to construct the solver.


Member Data Documentation


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

Generated on Sun Sep 25 00:19:55 2011 for OpenSim by  doxygen 1.6.1