1 #ifndef SimTK_SIMBODY_FORCE_GRAVITY_H_
2 #define SimTK_SIMBODY_FORCE_GRAVITY_H_
129 Real zeroHeight = 0);
160 const Vec3& gravity);
237 {
return setDefaultDownDirection(
UnitVec3(down)); }
324 bool isExcluded)
const;
362 const Vec3& down)
const
363 {
return setDownDirection(state,
UnitVec3(down)); }
507 {
return getBodyForces(state)[mobod]; }
#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,...
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
This force element represents a uniform gravitational field applied to a set of bodies.
Definition: Force_Gravity.h:70
const Gravity & setDownDirection(State &state, const Vec3 &down) const
Convenience overload that takes the down direction as a Vec3 and normalizes it (throwing away the mag...
Definition: Force_Gravity.h:361
Vec3 getDefaultGravityVector() const
Return the default gravity vector being used for this Gravity force element, calculated from the defa...
const Gravity & setBodyIsExcluded(State &state, MobilizedBodyIndex mobod, bool isExcluded) const
Within a given State, selectively exclude (or include) a body from the effects of this Gravity force.
const Gravity & setDownDirection(State &state, const UnitVec3 &down) const
Set the "down" direction d (a unit vector), that is, the direction along which gravitational forces w...
Real getDefaultMagnitude() const
Return the default gravity magnitude g (a nonnegative scalar).
const UnitVec3 & getDownDirection(const State &state) const
Get the gravity "down" direction d (a unit vector) that is currently set in this state.
Real getMagnitude(const State &state) const
Get the gravity magnitude g (a nonnegative scalar) that is currently set in this state.
Gravity(GeneralForceSubsystem &forces, const SimbodyMatterSubsystem &matter, Real g)
Convenience constructor to create a Gravity force element by specifying only gravity's magnitude,...
bool getDefaultBodyIsExcluded(MobilizedBodyIndex mobod) const
Return the current setting of the "is excluded by default" flag for the given body.
Gravity & setDefaultDownDirection(const UnitVec3 &down)
Set the default "down" direction d, that is, the direction along which gravity will act.
long long getNumEvaluations() const
Return a count of the number of times the set of gravitational forces or potential energy was calcula...
const UnitVec3 & getDefaultDownDirection() const
Return the default down direction (a unit vector) for this Gravity force element.
Gravity & setDefaultMagnitude(Real g)
Set the default magnitude of gravity (a nonegative scalar).
bool getBodyIsExcluded(const State &state, MobilizedBodyIndex mobod) const
Return the current setting of the "is excluded" flag for a given body in a given State.
const Gravity & setMagnitude(State &state, Real g) const
Set the gravity magnitude g (a nonnegative scalar) in this state, overriding the default gravity magn...
Gravity & setDefaultBodyIsExcluded(MobilizedBodyIndex mobod, bool isExcluded)
Set how the indicated body is to be treated by default.
Gravity & setDefaultDownDirection(const Vec3 &down)
Convenience overload that takes the down direction as a Vec3 and normalizes it (throwing away the mag...
Definition: Force_Gravity.h:236
Gravity & setDefaultGravityVector(const Vec3 &gravity)
Set the default value for the gravity vector, that is, the direction and magnitude with which gravity...
const Vector_< SpatialVec > & getBodyForces(const State &state) const
Obtain a reference to the set of gravitational forces currently being applied by this Gravity force e...
Vec3 getGravityVector(const State &state) const
Get the gravity vector v that will be used for computations done with this state.
Real getZeroHeight(const State &state) const
Get the zero height hz that is currently set in this state for use in calculating gravitational poten...
Real getDefaultZeroHeight() const
Return the default zero height used in the calculation of graviational potential energy.
Gravity()
Default constructor creates an empty handle.
Definition: Force_Gravity.h:191
void invalidateForceCache(const State &state) const
Invalidate the stored gravitational forces if they have already been calculated at this configuration...
Gravity & setDefaultZeroHeight(Real zeroHeight)
Set the default zero height (a signed scalar), for use in potential energy calculation.
bool isForceCacheValid(const State &state) const
Return true if the gravitational forces for this configuration have already been calculated and are u...
const SpatialVec & getBodyForce(const State &state, MobilizedBodyIndex mobod) const
Convenience method to extract the gravitational force on just one body; see getBodyForces() to get th...
Definition: Force_Gravity.h:506
Real getPotentialEnergy(const State &state) const
Obtain the gravitational potential energy contained in this Gravity force element in the given config...
Gravity(GeneralForceSubsystem &forces, const SimbodyMatterSubsystem &matter, const Vec3 &gravity)
Convenience constructor to create a Gravity force element by specifying only a gravity vector,...
Gravity(GeneralForceSubsystem &forces, const SimbodyMatterSubsystem &matter, const UnitVec3 &down, Real g, Real zeroHeight=0)
This is the most general constructor for creating a Gravity force element within a particular force s...
const Gravity & setGravityVector(State &state, const Vec3 &gravity) const
Set the gravity vector v, that is, the magnitude and direction with which gravitational forces will a...
const Gravity & setZeroHeight(State &state, Real hz) const
Set the potential energy zero height hz (a scalar) in this state, overriding the default zero height ...
This is the base class from which all Force element handle classes derive.
Definition: Force.h:50
This is a concrete subsystem which can apply arbitrary forces to a MultibodySystem.
Definition: GeneralForceSubsystem.h:47
This is for arrays indexed by mobilized body number within a subsystem (typically the SimbodyMatterSu...
This subsystem contains the bodies ("matter") in the multibody system, the mobilizers (joints) that d...
Definition: SimbodyMatterSubsystem.h:133
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
This is the vector class intended to appear in user code for large, variable size column vectors.
Definition: Vector_.h:50
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
UnitVec< Real, 1 > UnitVec3
Definition: UnitVec.h:41
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