1 #ifndef SimTK_SIMBODY_MOTION_H_
2 #define SimTK_SIMBODY_MOTION_H_
36 class SimbodyMatterSubsystem;
44 #ifndef SimTK_SIMBODY_DEFINING_MOTION
45 extern template class PIMPLHandle<Motion, MotionImpl, true>;
213 Method& udotMethod)
const;
225 class PolynomialImpl;
401 "Motion::Custom::Implementation::clone()",
402 "Concrete Implementation did not supply a clone() method, "
403 "but a copy operation was attempted.");
449 (
const State& s,
int nq,
Real* qdot)
const;
464 (
const State& s,
int nq,
Real* qdotdot)
const;
494 (
const State& s,
int nu,
Real* udot)
const;
511 (
const State& s,
int nu,
Real* udot)
const;
#define SimTK_ERRCHK_ALWAYS(cond, whereChecked, msg)
Definition: ExceptionMacros.h:281
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT)
Definition: PrivateImplementation.h:343
Includes internal headers providing declarations for the basic SimTK Core classes,...
Every Simbody header and source file should include this header before any other Simbody header.
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
A MobilizedBody is Simbody's fundamental body-and-joint object used to parameterize a system's motion...
Definition: MobilizedBody.h:169
The Mobilizer associated with each MobilizedBody, once modeled, has a specific number of generalized ...
This is the abstract base class for Custom Motion implementations.
Definition: Motion.h:392
virtual Motion::Level getLevel(const State &) const =0
A Motion prescribes either position, velocity, or acceleration.
virtual void realizeDynamics(const State &state) const
Definition: Motion.h:526
virtual void realizeModel(State &state) const
Definition: Motion.h:521
virtual void realizeInstance(const State &state) const
Definition: Motion.h:522
virtual void realizeVelocity(const State &state) const
Definition: Motion.h:525
virtual void realizeReport(const State &state) const
Definition: Motion.h:528
virtual Motion::Method getLevelMethod(const State &) const
Override this if the method is not Motion::Prescribed.
Definition: Motion.h:419
virtual void calcPrescribedPositionDot(const State &s, int nq, Real *qdot) const
Calculate the time derivative of the prescribed positions.
virtual void calcPrescribedAcceleration(const State &s, int nu, Real *udot) const
This operator is called during the MatterSubsystem's realize(Dynamics) computation.
virtual void realizeTopology(State &state) const
Definition: Motion.h:520
virtual void calcPrescribedVelocityDot(const State &s, int nu, Real *udot) const
Calculate the time derivative of the prescribed velocity.
virtual void realizeTime(const State &state) const
Definition: Motion.h:523
virtual void calcPrescribedPosition(const State &s, int nq, Real *q) const
This operator is called during the MatterSubsystem's realize(Time) computation.
virtual ~Implementation()
Destructor is virtual; be sure to provide one in you concrete class if there is anything to destruct.
Definition: Motion.h:396
virtual void calcPrescribedVelocity(const State &s, int nu, Real *u) const
This operator is called during the MatterSubsystem's realize(Position) computation.
virtual Implementation * clone() const
Override this if you want your Motion objects to be copyable.
Definition: Motion.h:399
virtual void realizePosition(const State &state) const
Definition: Motion.h:524
virtual void realizeAcceleration(const State &state) const
Definition: Motion.h:527
virtual void calcPrescribedPositionDotDot(const State &s, int nq, Real *qdotdot) const
Calculate the 2nd time derivative of the prescribed positions.
This class can be used to define new motions.
Definition: Motion.h:362
Implementation & updImplementation()
Custom()
Default constructor creates an empty handle that can be assigned to reference any Motion::Custom obje...
Definition: Motion.h:376
const Implementation & getImplementation() const
Custom(MobilizedBody &mobod, Implementation *implementation)
Create a Custom Motion.
Prescribe position, velocity, or acceleration motion as a sinusoidal function of time,...
Definition: Motion.h:240
Sinusoid()
Default constructor creates an empty handle that can be assigned to reference any Motion::Sinusoid ob...
Definition: Motion.h:264
Sinusoid(MobilizedBody &mobod, Motion::Level level, Real amplitude, Real rate, Real phase)
Create a sinusoidal prescribed motion applied at position, velocity, or acceleration level.
This non-holonomic Motion object imposes a constant rate on all mobilities.
Definition: Motion.h:277
Real getOneRate(const State &state, MobilizerUIndex ux) const
Get the rate setting for one mobility.
Real getOneDefaultRate(MobilizerUIndex ux) const
Get the default rate setting for one mobility.
Steady & setDefaultRate(Real u)
Change the default rate this Motion will prescribe unless overridden in a particular State.
void setOneRate(State &state, MobilizerUIndex ux, Real u) const
Change the rate this Motion will prescribe for one mobility when used with the given State.
Steady(MobilizedBody &mobod, const Vec< N > &u)
Create a Motion::Steady with different velocities for each mobility specified.
void setRate(State &state, Real u) const
Change the rate to be prescribed by this Motion when used with the given State.
Steady(MobilizedBody &mobod, Real u)
Create a Motion::Steady where all mobilities have the same velocity.
Steady & setDefaultRates(const Vec< N > &u)
Change the default rates this Motion will prescribe, supplying separate rates for each mobility as a ...
Steady()
Default constructor creates an empty handle than can be assigned to reference any Motion::Steady obje...
Definition: Motion.h:294
Steady & setOneDefaultRate(MobilizerUIndex, Real u)
Change the default rate this Motion will prescribe for one mobility, unless overridden in a particula...
A Motion object belongs to a particular MobilizedBody and prescribes how the associated motion is to ...
Definition: Motion.h:107
static const char * nameOfMethod(Method)
Returns a human-readable name corresponding to the given Method; useful for debugging.
bool isDisabled(const State &state) const
Test whether this Motion is currently disabled in the supplied State.
void disable(State &state) const
Disable this Motion, effectively removing it from the mobilizer to which it belongs and allowing the ...
Method
There are several ways to specify the motion at this Level, and the selected method also determines l...
Definition: Motion.h:126
@ Prescribed
motion is function of time and state; <level is derivative
Definition: Motion.h:130
static const char * nameOfLevel(Level)
Returns a human-readable name corresponding to the given Level; useful for debugging.
void calcAllMethods(const State &s, Method &qMethod, Method &uMethod, Method &udotMethod) const
(Advanced) This implements the above table.
Level
What is the highest level of motion that is driven? Lower levels are also driven; higher levels are d...
Definition: Motion.h:112
const MobilizedBody & getMobilizedBody() const
Get the MobilizedBody to which this Motion belongs.
void enable(State &state) const
Enable this Motion, without necessarily satisfying it.
Method getLevelMethod(const State &) const
Get the method being used to control the indicated Level.
Motion(MotionImpl *r)
For internal use: construct a new Motion handle referencing a particular implementation object.
Definition: Motion.h:231
void setDisabledByDefault(bool shouldBeDisabled)
Specify that a Motion is to be inactive by default.
bool isDisabledByDefault() const
Test whether this Motion is disabled by default in which case it must be explicitly enabled before it...
Level getLevel(const State &) const
Get the highest level being driven by this Motion.
Motion()
Default constructor creates an empty Motion handle that can be assigned to reference any kind of Moti...
Definition: Motion.h:141
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:607