Simbody
3.5
|
Constrain a single mobilizer coordinate q to have a particular value. More...
Public Member Functions | |
ConstantCoordinate (MobilizedBody &mobilizer, MobilizerQIndex whichQ, Real defaultPosition) | |
Construct a constant coordinate constraint on a particular generalized coordinate q of the given mobilizer. | |
ConstantCoordinate (MobilizedBody &mobilizer, Real defaultPosition) | |
Construct a constant coordinate constraint on the generalized coordinate q of the given mobilizer, assuming there is only one coordinate. | |
ConstantCoordinate () | |
Default constructor creates an empty handle you can use to reference any existing ConstantCoordinate Constraint. | |
MobilizedBodyIndex | getMobilizedBodyIndex () const |
Return the index of the mobilized body to which this constant coordinate constraint is being applied (to one of its coordinates). | |
MobilizerQIndex | getWhichQ () const |
Return the particular coordinate whose position is controlled by this ConstantCoordinate constraint. | |
Real | getDefaultPosition () const |
Return the default value for the position to be enforced. | |
ConstantCoordinate & | setDefaultPosition (Real position) |
Change the default value for the position to be enforced by this constraint. | |
void | setPosition (State &state, Real position) const |
Override the default position with this one whose value is stored in the given State. | |
Real | getPosition (const State &state) const |
Get the current value of the position set point from the indicated State. | |
Real | getPositionError (const State &state) const |
Return the amount by which the given State fails to satisfy this ConstantCoordinate constraint. | |
Real | getVelocityError (const State &state) const |
Return the amount by which the given State fails to satisfy the time derivative of this ConstantCoordinate constraint, which should be zero. | |
Real | getAccelerationError (const State &state) const |
Return the amount by which the accelerations in the given State fail to satify the second time derivative of this constraint, which should be zero. | |
Real | getMultiplier (const State &state) const |
Get the value of the Lagrange multiplier generated to satisfy this constraint. |
Constrain a single mobilizer coordinate q to have a particular value.
Generates one position-level (holonomic) constraint equation. Some generalized coordinate q is required to remain at a particular position value p. This may be an angle, a length, or some other unit depending on how the mobilizer is defined.
Consider using the lock() or lockAt() feature of mobilizers (see MobilizedBody description) instead of this constraint; if applicable, locking is more efficient since it does not require adding a constraint equation to the system.
The assembly condition is the same as the run-time constraint: q must be set to position p.
SimTK::Constraint::ConstantCoordinate::ConstantCoordinate | ( | MobilizedBody & | mobilizer, |
MobilizerQIndex | whichQ, | ||
Real | defaultPosition | ||
) |
Construct a constant coordinate constraint on a particular generalized coordinate q of the given mobilizer.
Provide a default position value to which the q should be locked; you can change it later via setPosition().
SimTK::Constraint::ConstantCoordinate::ConstantCoordinate | ( | MobilizedBody & | mobilizer, |
Real | defaultPosition | ||
) |
Construct a constant coordinate constraint on the generalized coordinate q of the given mobilizer, assuming there is only one coordinate.
(Constrains the first coordinate if there are several.) Provide a default position value to which the q should be locked; you can change it later via setPosition().
Default constructor creates an empty handle you can use to reference any existing ConstantCoordinate Constraint.
Return the index of the mobilized body to which this constant coordinate constraint is being applied (to one of its coordinates).
This is set on construction of the ConstantCoordinate constraint.
Return the particular coordinate whose position is controlled by this ConstantCoordinate constraint.
This is set on construction.
Return the default value for the position to be enforced.
This is set on construction or via setDefaultPosition(). This is used to initialize the position when a default State is created, but it can be overriden by changing the value in the State using setPosition().
Change the default value for the position to be enforced by this constraint.
This is a topological change, meaning you'll have to call realizeTopology() on the containing System and obtain a new State before you can use it. If you just want to make a runtime change in the State, see setPosition().
void SimTK::Constraint::ConstantCoordinate::setPosition | ( | State & | state, |
Real | position | ||
) | const |
Override the default position with this one whose value is stored in the given State.
This invalidates the Position stage in the state. Don't confuse this with setDefaultPosition() -- the value set here overrides that one.
Real SimTK::Constraint::ConstantCoordinate::getPosition | ( | const State & | state | ) | const |
Get the current value of the position set point from the indicated State.
This is the value currently in effect, either from the default or from a previous call to setPosition().
Real SimTK::Constraint::ConstantCoordinate::getPositionError | ( | const State & | state | ) | const |
Return the amount by which the given State fails to satisfy this ConstantCoordinate constraint.
This is a signed value, q-p where p is the currently effective desired position as returned by getPosition() on this same state. The state must already be realized through Stage::Position.
Real SimTK::Constraint::ConstantCoordinate::getVelocityError | ( | const State & | state | ) | const |
Return the amount by which the given State fails to satisfy the time derivative of this ConstantCoordinate constraint, which should be zero.
This is a signed value equal to the current value of qdot (=d/dt q). The state must already be realized through Stage::Velocity.
Real SimTK::Constraint::ConstantCoordinate::getAccelerationError | ( | const State & | state | ) | const |
Return the amount by which the accelerations in the given State fail to satify the second time derivative of this constraint, which should be zero.
This is a signed value equal to the current value of qdotdot (=d^2/dt^2 q). The state must already be realized through Stage::Acceleration.
Real SimTK::Constraint::ConstantCoordinate::getMultiplier | ( | const State & | state | ) | const |
Get the value of the Lagrange multiplier generated to satisfy this constraint.
For a ConstantCoordinate constraint, the multiplier has the same magnitude as the generalized force although by convention constraint multipliers have the opposite sign from applied forces. The state must already be realized through Stage::Acceleration.