OpenSim Moco  0.4.0
Public Member Functions | Static Public Member Functions | List of all members
OpenSim::PositionMotion Class Reference

Description

This class prescribes the value, speed, and acceleration of all coordinates in the model using SimTK::Motion.

SimTK::Motions remove degrees of freedom from the system rather than add constraints. This is an alternative to prescribing kinematics using Coordinate's prescribed_function, which uses a kinematic constraint. When prescribing motion, the system must compute constraint forces to apply to enforce the prescribed motion; such forces are available via SimbodyMatterSubsystem::findMotionForces().

Note
This class requires that all coordinates are prescribed.
Inheritance diagram for OpenSim::PositionMotion:

#include <Moco/Moco/Components/PositionMotion.h>

Public Member Functions

 OpenSim_DECLARE_PROPERTY (default_enabled, bool, "Whether or not this motion is enabled by default (default value: " "true).")
 
 OpenSim_DECLARE_PROPERTY (functions, FunctionSet, "Functions specifying the values of each coordinate.")
 
 PositionMotion (std::string name)
 
void setPositionForCoordinate (const Coordinate &coord, const Function &position)
 Set a function to calculate the position for a given coordinate. More...
 
void setDefaultEnabled (bool enabled)
 This determines if, after Model::initSystem(), these prescribed motions are enabled or disabled. More...
 
bool getDefaultEnabled () const
 
void setEnabled (SimTK::State &state, bool enabled) const
 Use this after Model::initSystem() to set if the prescribed motions are enforced. More...
 
bool getEnabled (const SimTK::State &state) const
 
TimeSeriesTable exportToTable (const std::vector< double > &time) const
 

Static Public Member Functions

static std::unique_ptr< PositionMotioncreateFromTable (const Model &model, const TimeSeriesTable &coords, bool allowExtraColumns=false)
 Create a PositionMotion that prescribes kinematics for all coordinates in a model, given a data table containing coordinate values for all coordinates using GCVSpline. More...
 
static std::unique_ptr< PositionMotioncreateFromStatesTrajectory (const Model &model, const StatesTrajectory &statesTraj)
 Create a PositionMotion that prescribes kinematics for all coordinates in a model, given a StatesTrajectory. More...
 

Member Function Documentation

◆ createFromStatesTrajectory()

static std::unique_ptr<PositionMotion> OpenSim::PositionMotion::createFromStatesTrajectory ( const Model &  model,
const StatesTrajectory &  statesTraj 
)
static

Create a PositionMotion that prescribes kinematics for all coordinates in a model, given a StatesTrajectory.

Note
If the states trajectory violates kinematic constraints in the model, the resulting PositionMotion will also violate the kinematic constraints.

◆ createFromTable()

static std::unique_ptr<PositionMotion> OpenSim::PositionMotion::createFromTable ( const Model &  model,
const TimeSeriesTable &  coords,
bool  allowExtraColumns = false 
)
static

Create a PositionMotion that prescribes kinematics for all coordinates in a model, given a data table containing coordinate values for all coordinates using GCVSpline.

If the table contains any columns that are not the names of coordinate value state variables, an exception is thrown (unless allowExtraColumns is true).

Note
If the data in the table violates kinematic constraints in the model, the resulting PositionMotion will also violate the kinematic constraints.
This fuction ignores the inDegrees header metadata.

◆ setDefaultEnabled()

void OpenSim::PositionMotion::setDefaultEnabled ( bool  enabled)
inline

This determines if, after Model::initSystem(), these prescribed motions are enabled or disabled.

◆ setEnabled()

void OpenSim::PositionMotion::setEnabled ( SimTK::State &  state,
bool  enabled 
) const

Use this after Model::initSystem() to set if the prescribed motions are enforced.

◆ setPositionForCoordinate()

void OpenSim::PositionMotion::setPositionForCoordinate ( const Coordinate &  coord,
const Function &  position 
)

Set a function to calculate the position for a given coordinate.

The speed and acceleration of the coordinate are obtained as derivatives of the provided function.


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