OpenSim Moco
0.4.0
|
This path constraint enforces that the distance between the origins of pairs of model frames is kept between minimum and maximum bounds.
Frame pairs and their bounds are specified via a MocoFrameDistancConstraintPair. Any model component derived from Frame is valid to be included in a frame pair, and any number of frame pairs may be append to this constraint via addFramePair().
This constraint can be used as a simple method for preventing bodies in your model from intersecting during an optimization. For example, the following prevents feet from intersecting during a walking optimization:
To project the frame distance onto a vector or plane before ensuring its within the provided bounds, use setProjection() and setProjectionVector().
#include <Moco/Moco/MocoFrameDistanceConstraint.h>
Public Member Functions | |
void | addFramePair (MocoFrameDistanceConstraintPair pair) |
void | addFramePair (const std::string &frame1_path, const std::string &frame2_path, double minimum_distance, double maximum_distance) |
void | setProjection (std::string projection) |
Set if each distance should be projected onto either a vector or plane. More... | |
std::string | getProjection () const |
void | setProjectionVector (SimTK::Vec3 normal) |
Set the vector to use for projecting each distance. More... | |
void | clearProjectionVector () |
Unset the projection vector. | |
SimTK::Vec3 | getProjectionVector () const |
Public Member Functions inherited from OpenSim::MocoPathConstraint | |
const MocoConstraintInfo & | getConstraintInfo () const |
MocoConstraintInfo & | updConstraintInfo () |
void | setConstraintInfo (const MocoConstraintInfo &cInfo) |
int | getPathConstraintIndex () const |
For use by solvers. More... | |
void | calcPathConstraintErrors (const SimTK::State &state, SimTK::Vector &errors) const |
Calculate errors in the path constraint equations. More... | |
void | initializeOnModel (const Model &model, const MocoProblemInfo &, const int &pathConstraintIndex) const |
For use by solvers. This also performs error checks on the Problem. | |
Protected Member Functions | |
void | initializeOnModelImpl (const Model &model, const MocoProblemInfo &) const override |
Perform any caching. More... | |
void | calcPathConstraintErrorsImpl (const SimTK::State &state, SimTK::Vector &errors) const override |
Protected Member Functions inherited from OpenSim::MocoPathConstraint | |
OpenSim_DECLARE_UNNAMED_PROPERTY (MocoConstraintInfo, "The bounds and " "labels for this MocoPathConstraint.") | |
void | setNumEquations (int numEqs) const |
Set the number of scalar equations for this MocoPathConstraint. More... | |
const Model & | getModel () const |
For use within virtual function implementations. | |
|
overrideprotectedvirtual |
Implements OpenSim::MocoPathConstraint.
|
overrideprotectedvirtual |
Perform any caching.
The number of scalar constraint equations this MocoPathConstraint implements must be defined here (see setNumEquations() below).
Implements OpenSim::MocoPathConstraint.
|
inline |
Set if each distance should be projected onto either a vector or plane.
Possible values: "none" (default), "vector", and "plane".
|
inline |
Set the vector to use for projecting each distance.
If the projection type is "vector", the distance is projected onto the vector provided here. If the projection type is "plane", the distance is projected onto the plane perpendicular to this vector.