1 #ifndef SimTK_SIMBODY_SEMI_EXPLICIT_EULER_TIME_STEPPER_H_
2 #define SimTK_SIMBODY_SEMI_EXPLICIT_EULER_TIME_STEPPER_H_
69 NoPositionProjection=2};
113 { m_restitutionModel = restModel; }
115 {
return m_restitutionModel; }
118 { m_inducedImpactModel = indModel; }
120 {
return m_inducedImpactModel; }
133 "setMaxInducedImpactsPerStep",
"Illegal argument %d", maxInduced);
134 m_maxInducedImpactsPerStep = maxInduced;
137 {
return m_maxInducedImpactsPerStep; }
140 { m_projectionMethod = projMethod; }
142 {
return m_projectionMethod; }
145 if (m_solverType != solverType) {
147 clearImpulseSolver();
148 m_solverType = solverType;
152 {
return m_solverType; }
164 "SemiExplicitEulerTimeStepper::setDefaultImpactCaptureVelocity()",
165 "The impact capture velocity must be nonnegative but was %g.",
167 m_defaultCaptureVelocity = vCapture;
179 "SemiExplicitEulerTimeStepper::setDefaultImpactMinCORVelocity()",
180 "The velocity at which the minimum coefficient of restitution "
181 " is reached must be nonnegative but was %g.", vMinCOR);
182 m_defaultMinCORVelocity = vMinCOR;
195 "SemiExplicitEulerTimeStepper::setDefaultFrictionTransitionVelocity()",
196 "The friction transition velocity must be nonnegative but was %g.",
198 m_defaultTransitionVelocity = vTransition;
207 "SemiExplicitEulerTimeStepper::setMinSignificantForce()",
208 "The minimum significant force magnitude must be greater than zero "
209 "but was %g.", minSignificantForce);
210 m_minSignificantForce = minSignificantForce;
213 {
return m_minSignificantForce; }
229 {
return m_defaultCaptureVelocity; }
234 {
return m_defaultMinCORVelocity; }
239 {
return m_defaultTransitionVelocity; }
244 {
return std::max(m_defaultCaptureVelocity, 2*m_consTol); }
248 {
return std::max(m_defaultMinCORVelocity,
249 getDefaultImpactCaptureVelocityInUse()); }
253 {
return std::max(m_defaultTransitionVelocity, 2*m_consTol); }
263 "SemiExplicitEulerTimeStepper::getImpulseSolver()",
264 "No solver is currently allocated.");
270 clearImpulseSolver();
271 m_solver = impulseSolver;
275 delete m_solver; m_solver=0;
290 void findProximalConstraints(
const State&);
293 bool enableProximalConstraints(
State&);
295 void collectConstraintInfo(
const State& s);
298 void calcCoefficientsOfFriction(
const State&,
const Vector& verr);
299 void calcCoefficientsOfRestitution(
const State&,
const Vector& verr,
300 bool disableRestitution);
303 void takeUnconstrainedStep(
State& s,
Real h);
308 bool calcNewtonRestitutionIfAny(
const State&,
const Vector& verr,
309 Vector& newtonVerr)
const;
313 bool applyPoissonRestitutionIfAny(
const State&,
Vector& impulse,
316 bool calcExpansionImpulseIfAny(
const State& s,
const Array_<int>& impacters,
317 const Vector& compressionImpulse,
328 int performSimultaneousImpact(
const State& state,
338 bool performInducedImpactRound(
const Vector& verr,
339 const Vector& expansionImpulse);
341 void classifyUnilateralContactsForSequentialImpact
343 const Vector& expansionImpulse,
344 bool includeAllProximals,
354 void classifyUnilateralContactsForSimultaneousImpact
356 const Vector& expansionImpulse,
366 bool doCompressionPhase(
const State& state,
369 Vector& compressionImpulse);
372 bool doExpansionPhase(
const State& state,
377 bool doInducedImpactRound(
const State& state,
382 bool anyPositionErrorsViolated(
const State&,
const Vector& perr)
const;
386 bool doPositionCorrectionPhase(
const State& state,
397 int m_maxInducedImpactsPerStep;
402 Real m_defaultCaptureVelocity;
403 Real m_defaultMinCORVelocity;
404 Real m_defaultTransitionVelocity;
405 Real m_minSignificantForce;
425 m_distalStateLtdFriction;
433 Vector m_expansionImpulse;
434 Vector m_newtonRestitutionVerr;
#define SimTK_ERRCHK_ALWAYS(cond, whereChecked, msg)
Definition: ExceptionMacros.h:281
#define SimTK_ERRCHK1_ALWAYS(cond, whereChecked, fmt, a1)
Definition: ExceptionMacros.h:285
#define SimTK_APIARGCHECK1_ALWAYS(cond, className, methodName, fmt, a1)
Definition: ExceptionMacros.h:228
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
This is the abstract base class for impulse solvers, which solve an important subproblem of the conta...
Definition: ImpulseSolver.h:109
SuccessfulStepStatus
When a step is successful, it will return an indication of what caused it to stop where it did.
Definition: Integrator.h:202
The job of the MultibodySystem class is to coordinate the activities of various subsystems which can ...
Definition: MultibodySystem.h:48
A low-accuracy, high performance, velocity-level time stepper for models containing unilateral rigid ...
Definition: SemiExplicitEulerTimeStepper.h:52
PositionProjectionMethod
Definition: SemiExplicitEulerTimeStepper.h:68
InducedImpactModel
Definition: SemiExplicitEulerTimeStepper.h:67
void setAccuracy(Real accuracy)
Set integration accuracy; requires variable length steps.
Definition: SemiExplicitEulerTimeStepper.h:108
void initialize(const State &initState)
Initialize the TimeStepper's internally maintained state to a copy of the given state; allocate and i...
Real getAdvancedTime() const
synonym for getTime.
Definition: SemiExplicitEulerTimeStepper.h:101
void setDefaultImpactCaptureVelocity(Real vCapture)
Set the impact capture velocity to be used by default when a contact does not provide its own.
Definition: SemiExplicitEulerTimeStepper.h:162
Real getDefaultImpactCaptureVelocityInUse() const
Return the value actually being used as the default impact capture velocity.
Definition: SemiExplicitEulerTimeStepper.h:243
const State & getAdvancedState() const
synonym for getState.
Definition: SemiExplicitEulerTimeStepper.h:95
State & updState()
Get writable access to the TimeStepper's internally maintained State.
Definition: SemiExplicitEulerTimeStepper.h:89
SemiExplicitEulerTimeStepper(const MultibodySystem &mbs)
void setInducedImpactModel(InducedImpactModel indModel)
Definition: SemiExplicitEulerTimeStepper.h:117
Real getDefaultFrictionTransitionVelocityInUse() const
Return the value actually being used as the default sliding-to-rolling friction transition velocity.
Definition: SemiExplicitEulerTimeStepper.h:252
void setImpulseSolver(ImpulseSolver *impulseSolver)
(Advanced) Set your own ImpulseSolver; the TimeStepper takes over ownership so don't delete afterward...
Definition: SemiExplicitEulerTimeStepper.h:269
Integrator::SuccessfulStepStatus stepTo(Real time)
Advance to the indicated time in one or more steps, using repeated induced impacts.
Real getDefaultImpactCaptureVelocity() const
Return the value set for this parameter, but the actual value used during execution will be no smalle...
Definition: SemiExplicitEulerTimeStepper.h:228
~SemiExplicitEulerTimeStepper()
The contained ImpulseSolver will be destructed here; don't reference it afterwards!
Definition: SemiExplicitEulerTimeStepper.h:77
static const char * getInducedImpactModelName(InducedImpactModel iim)
Get human-readable string representing the given enum value.
Real getTime() const
Shortcut to getting the current time from the TimeStepper's internally maintained State.
Definition: SemiExplicitEulerTimeStepper.h:92
void setRestitutionModel(RestitutionModel restModel)
Definition: SemiExplicitEulerTimeStepper.h:112
void setDefaultFrictionTransitionVelocity(Real vTransition)
Set the friction sliding-to-rolling transition velocity to be used by default when a frictional conta...
Definition: SemiExplicitEulerTimeStepper.h:193
RestitutionModel
If an impact occurs at a contact where the coefficient of restitution (COR) is non zero,...
Definition: SemiExplicitEulerTimeStepper.h:66
Real getConstraintToleranceInUse() const
Return the tolerance to which we require constraints to be satisfied.
Definition: SemiExplicitEulerTimeStepper.h:223
Real getMinSignificantForce() const
Definition: SemiExplicitEulerTimeStepper.h:212
void setMaxInducedImpactsPerStep(int maxInduced)
Limit the number of induced impact rounds per time step.
Definition: SemiExplicitEulerTimeStepper.h:131
void setConstraintTolerance(Real consTol)
Set the tolerance to which constraints must be satisfied.
Definition: SemiExplicitEulerTimeStepper.h:110
ImpulseSolverType
Definition: SemiExplicitEulerTimeStepper.h:70
void setMinSignificantForce(Real minSignificantForce)
Set the threshold below which we can ignore forces.
Definition: SemiExplicitEulerTimeStepper.h:205
void setImpulseSolverType(ImpulseSolverType solverType)
Definition: SemiExplicitEulerTimeStepper.h:144
int getMaxInducedImpactsPerStep() const
Definition: SemiExplicitEulerTimeStepper.h:136
const MultibodySystem & getMultibodySystem() const
Get access to the MultibodySystem for which this TimeStepper was constructed.
Definition: SemiExplicitEulerTimeStepper.h:257
void setDefaultImpactMinCORVelocity(Real vMinCOR)
Set the minimum coefficient of restitution (COR) velocity to be used by default when a unilateral con...
Definition: SemiExplicitEulerTimeStepper.h:177
Real getDefaultImpactMinCORVelocityInUse() const
Return the value actually being used as the default impact minimum coefficient of restitution velocit...
Definition: SemiExplicitEulerTimeStepper.h:247
static const char * getRestitutionModelName(RestitutionModel rm)
Get human-readable string representing the given enum value.
const State & getState() const
Get access to the TimeStepper's internally maintained State.
Definition: SemiExplicitEulerTimeStepper.h:86
void clearImpulseSolver()
(Advanced) Delete the existing ImpulseSolver if any.
Definition: SemiExplicitEulerTimeStepper.h:274
Real getDefaultFrictionTransitionVelocity() const
Return the value set for this parameter, but the actual value used during execution will be no smalle...
Definition: SemiExplicitEulerTimeStepper.h:238
State & updAdvancedState()
synonym for updState.
Definition: SemiExplicitEulerTimeStepper.h:98
PositionProjectionMethod getPositionProjectionMethod() const
Definition: SemiExplicitEulerTimeStepper.h:141
Real getDefaultImpactMinCORVelocity() const
Return the value set for this parameter, but the actual value used during execution will be no smalle...
Definition: SemiExplicitEulerTimeStepper.h:233
InducedImpactModel getInducedImpactModel() const
Definition: SemiExplicitEulerTimeStepper.h:119
static const char * getPositionProjectionMethodName(PositionProjectionMethod ppm)
Get human-readable string representing the given enum value.
RestitutionModel getRestitutionModel() const
Definition: SemiExplicitEulerTimeStepper.h:114
static const char * getImpulseSolverTypeName(ImpulseSolverType ist)
Get human-readable string representing the given enum value.
void setPositionProjectionMethod(PositionProjectionMethod projMethod)
Definition: SemiExplicitEulerTimeStepper.h:139
ImpulseSolverType getImpulseSolverType() const
Definition: SemiExplicitEulerTimeStepper.h:151
const ImpulseSolver & getImpulseSolver() const
(Advanced) Get direct access to the ImpulseSolver.
Definition: SemiExplicitEulerTimeStepper.h:261
Real getAccuracyInUse() const
Return the integration accuracy setting.
Definition: SemiExplicitEulerTimeStepper.h:217
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
ELEM max(const VectorBase< ELEM > &v)
Definition: VectorMath.h:251
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