Simbody  3.8
ExponentialSpringForce.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMBODY_EXPONENTIAL_SPRING_FORCE_H_
2 #define SimTK_SIMBODY_EXPONENTIAL_SPRING_FORCE_H_
3 
4 /*-----------------------------------------------------------------------------
5  Simbody(tm)
6 -------------------------------------------------------------------------------
7  Copyright (c) 2021-22 Authors.
8  Authors: Frank C. Anderson
9  Contributors:
10 
11  Licensed under the Apache License, Version 2.0 (the "License"); you may
12  not use this file except in compliance with the License. You may obtain a
13  copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
14 
15  Unless required by applicable law or agreed to in writing, software
16  distributed under the License is distributed on an "AS IS" BASIS,
17  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  See the License for the specific language governing permissions and
19  limitations under the License.
20  ----------------------------------------------------------------------------*/
21 
22 #include "SimTKmath.h"
24 #include "simbody/internal/Force.h"
25 
26 namespace SimTK {
27 
28 class MultibodySystem;
29 class MultibodySubsystem;
30 class MobilizedBody;
31 class ExponentialSpringForceImpl;
32 
33 //=============================================================================
343 public:
365  const Transform& X_GP,
366  const MobilizedBody& body_B, const Vec3& station_B,
368 
374 
377  const MobilizedBody& getBody() const;
378 
383  const Vec3& getStation() const;
384 
394 
407 
416  void setMuStatic(State& state, Real mus);
417 
421  Real getMuStatic(const State& state) const;
422 
431  void setMuKinetic(State& state, Real muk);
432 
436  Real getMuKinetic(const State& state) const;
437 
443  Real getSliding(const State& state) const;
444 
455  bool inGround = true) const;
456 
464  void resetAnchorPoint(State& state) const;
465 
474  bool inGround = true) const;
475 
484  bool inGround = true) const;
485 
493  Vec3 getNormalForce(const State& state,
494  bool inGround = true) const;
495 
504  Real getMu(const State& state) const;
505 
509  Real getFrictionForceLimit(const State& state) const;
510 
519  const State& state, bool inGround = true) const;
520 
529  const State& state, bool inGround = true) const;
530 
541  Vec3 getFrictionForce(const State& state, bool inGround = true) const;
542 
553  Vec3 getForce(const State& state, bool inGround = true) const;
554 
567  Vec3 getStationPosition(const State& state, bool inGround = true) const;
568 
577  Vec3 getStationVelocity(const State& state, bool inGround = true) const;
578 
579 
580  // ADVANCED METHODS BELOW HERE
581 
592 
597 
602 
607 
612 
614 
615 private:
617  ExponentialSpringForce, ExponentialSpringForceImpl, Force);
618  Stage getStage(const State& state) const {
619  return getForceSubsystem().getStage(state);
620  }
621 };
622 
623 
624 } // namespace SimTK
625 #endif // SimTK_SIMBODY_EXPONENTIAL_SPRING_FORCE_H_
626 
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT)
Definition: PrivateImplementation.h:343
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
This unique integer type is for selecting discrete variables.
Class ExponentialSpringForce uses an "exponential spring" as a means of modeling contact of a specifi...
Definition: ExponentialSpringForce.h:342
const MobilizedBody & getBody() const
Get the body (i.e., the MobilizedBody) to which the resultant contact force is applied and for which ...
void setMuStatic(State &state, Real mus)
Set the static coefficient of friction (μₛ) for this exponential spring.
Real getMuStatic(const State &state) const
Get the static coefficient of friction (μₛ) held by the specified state for this exponential spring.
Vec3 getFrictionForceElasticPart(const State &state, bool inGround=true) const
Get the elastic part of the friction force.
const ExponentialSpringParameters & getParameters() const
Get a const reference to the parameters object owned by this exponential spring.
Vec3 getNormalForce(const State &state, bool inGround=true) const
Get the normal force.
void resetAnchorPoint(State &state) const
Reset the elastic anchor point (friction spring zero) so that it coincides with the projection of the...
DiscreteVariableIndex getMuKineticStateIndex() const
Get the State index of the kinetic coefficient of friction (μₖ) for this exponential spring.
Vec3 getFrictionForce(const State &state, bool inGround=true) const
Get the total friction force.
DiscreteVariableIndex getSlidingStateIndex() const
Get the State index of the sliding state (K) for this exponential spring.
const Transform & getContactPlaneTransform() const
Get the Transform specifying the location and orientation of the Contact Plane with respect to the Gr...
Vec3 getForce(const State &state, bool inGround=true) const
Get the total force applied to the body by this ExponentialSpringForce instance.
const Vec3 & getStation() const
Get the point (body station) that interacts with the contact plane and at which the resulting contact...
Vec3 getNormalForceElasticPart(const State &state, bool inGround=true) const
Get the elastic part of the normal force.
Vec3 getAnchorPointPosition(const State &state, bool inGround=true) const
Get the position of the elastic anchor point (p₀), which will always lie in the Contact Plane.
void setMuKinetic(State &state, Real muk)
Set the kinetic coefficient of friction (μₖ) for this exponential spring.
ExponentialSpringForce(GeneralForceSubsystem &forces, const Transform &X_GP, const MobilizedBody &body_B, const Vec3 &station_B, ExponentialSpringParameters params=ExponentialSpringParameters())
Construct an exponential spring force object with customized parameters.
Vec3 getNormalForceDampingPart(const State &state, bool inGround=true) const
Get the damping part of the normal force.
Vec3 getFrictionForceDampingPart(const State &state, bool inGround=true) const
Get the damping part of the friction force.
Real getFrictionForceLimit(const State &state) const
Get the friction limit.
Real getMu(const State &state) const
Get the instantaneous coefficient of friction (μ).
Real getSliding(const State &state) const
Get the Sliding state of this exponential spring after it has been updated to be consistent with the ...
DiscreteVariableIndex getAnchorPointStateIndex() const
Get the State index of the elastic anchor point (p₀) for this exponential spring.
DiscreteVariableIndex getMuStaticStateIndex() const
Get the State index of the static coefficient of friction (μₛ) for this exponential spring.
Vec3 getStationVelocity(const State &state, bool inGround=true) const
Get the velocity of the body station (i.e., the point on the body at which the force generated by thi...
Vec3 getStationPosition(const State &state, bool inGround=true) const
Get the position of the body station (i.e., the point on the body at which the force generated by thi...
void setParameters(const ExponentialSpringParameters &params)
Set the customizable Topology-stage parameters on this exponential spring instance.
Real getMuKinetic(const State &state) const
Get the kinetic coefficient of friction (μₖ) held by the specified state for this exponential spring.
ExponentialSpringParameters is a helper class used to customize the force-producing characteristics o...
Definition: ExponentialSpringParameters.h:118
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
A MobilizedBody is Simbody's fundamental body-and-joint object used to parameterize a system's motion...
Definition: MobilizedBody.h:169
This class is basically a glorified enumerated type, type-safe and range checked but permitting conve...
Definition: Stage.h:66
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