Skip to content

Commit

Permalink
Updates to docs // renamed Coordinate::getQDot to Coordinate::getQDot…
Browse files Browse the repository at this point in the history
…Value
  • Loading branch information
nickbianco committed Sep 14, 2023
1 parent fa1f49c commit 2281778
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions OpenSim/Simulation/Model/FunctionBasedPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

using namespace OpenSim;

const std::string FunctionBasedPath::LENGTH_NAME("length_cache");
const std::string FunctionBasedPath::LENGTH_NAME("length");
const std::string FunctionBasedPath::LENGTHENING_SPEED_NAME("lengthening_speed");
const std::string FunctionBasedPath::MOMENT_ARMS_NAME("moment_arms");

Expand Down Expand Up @@ -179,7 +179,7 @@ SimTK::Vector FunctionBasedPath::computeCoordinateSpeeds(
{
SimTK::Vector coordinateSpeeds((int)_coordinates.size(), 0.0);
for (int i = 0; i < (int)_coordinates.size(); ++i) {
coordinateSpeeds[i] = _coordinates[i]->getQDot(s);
coordinateSpeeds[i] = _coordinates[i]->getQDotValue(s);
}

return coordinateSpeeds;
Expand Down
16 changes: 8 additions & 8 deletions OpenSim/Simulation/Model/FunctionBasedPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,27 @@ namespace OpenSim {
* path length, lengthening speed, and moment arms are a priority (e.g., a
* direct collocation problem).
*
* Each instance of this class requires a list of model coordinates that the
* path is dependent on and a function, \f$ l(q) \f$, that computes the length
* of the path as a function of the coordinate values, \f$ q \f$. Optionally,
* the user can provide functions that compute the moment arms of the path as a
* function of the coordinate values and a function that computes the speed of
* the path as a function of the coordinate values and speeds.
* Each instance of this class requires both a list of model coordinates that
* the path is dependent on and a function, \f$ l(q) \f$, that computes the
* length of the path as a function of the coordinate values, \f$ q \f$.
* Optionally, functions can be provided to compute the moment arms of the path
* as a function of the coordinate values and a function that computes the speed
* of the path as a function of the coordinate values and speeds.
*
* If the moment arm functions are not provided, the moment arms will be
* computed from the derivative of the length function with respect to the
* coordinate values:
*
* \f[
* r_i = \frac{\partial l}{\partial q_i}
* r_i = \frac{\partial l}{\partial q_i} \quad i = 1, \ldots, N_q
* \f]
*
* * Where,
* - \f$ l \f$: the length of the path.
* - \f$ q \f$: the set of coordinate values.
* - \f$ r_i \f$: the moment arm of the path with respect to the \f$ i^{th} \f$
* coordinate.
* - \f$ N_q \f$: the number of coordinates.
*
* If the speed function is not provided, the speed will be computed using the
* dot product of the moment arms and coordinate speeds based on the chain rule:
Expand All @@ -77,7 +78,6 @@ namespace OpenSim {
* Where,
* - \f$ dot{l} \f$: the lengthening speed of the path.
* - \f$ dot{q} \f$: the set of coordinate speeds.
* - \f$ N_q \f$: the number of coordinates.
*
* The length function and the moment arm functions (if provided) must have the
* same number of arguments as the number of coordinates, where the order of the
Expand Down
2 changes: 1 addition & 1 deletion OpenSim/Simulation/SimbodyEngine/Coordinate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ const std::string& Coordinate::getSpeedName() const
return _speedName;
}

double Coordinate::getQDot(const SimTK::State& s) const {
double Coordinate::getQDotValue(const SimTK::State& s) const {
return _model->getMatterSubsystem().getMobilizedBody(_bodyIndex).getOneQDot(s,_mobilizerQIndex);
}

Expand Down
4 changes: 3 additions & 1 deletion OpenSim/Simulation/SimbodyEngine/Coordinate.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ OpenSim_DECLARE_CONCRETE_OBJECT(Coordinate, ModelComponent);
state variable. Returns the string "<coordinate_name>/speed" */
const std::string& getSpeedName() const;

double getQDot(const SimTK::State& s) const;
/** get the derivative of Coordinate's value from the state. This value is
*not* necessarily equal to the value returned by getSpeedValue(). */
double getQDotValue(const SimTK::State& s) const;

/** get the default value for this coordinate. This is the value
used if no value has been set prior to a simulation. */
Expand Down

0 comments on commit 2281778

Please sign in to comment.