1 #ifndef SimTK_SIMBODY_SEMI_EXPLICIT_EULER_TIME_STEPPER_H_
2 #define SimTK_SIMBODY_SEMI_EXPLICIT_EULER_TIME_STEPPER_H_
69 NoPositionProjection=2};
84 void initialize(
const State& initState);
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;
279 static const char* getRestitutionModelName(RestitutionModel rm);
281 static const char* getInducedImpactModelName(InducedImpactModel iim);
283 static const char* getPositionProjectionMethodName
284 (PositionProjectionMethod ppm);
286 static const char* getImpulseSolverTypeName(ImpulseSolverType ist);
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,
395 RestitutionModel m_restitutionModel;
396 InducedImpactModel m_inducedImpactModel;
397 int m_maxInducedImpactsPerStep;
398 PositionProjectionMethod m_projectionMethod;
399 ImpulseSolverType m_solverType;
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;
459 #endif // SimTK_SIMBODY_SEMI_EXPLICIT_EULER_TIME_STEPPER_H_
Real getDefaultImpactCaptureVelocityInUse() const
Return the value actually being used as the default impact capture velocity.
Definition: SemiExplicitEulerTimeStepper.h:243
void setConstraintTolerance(Real consTol)
Set the tolerance to which constraints must be satisfied.
Definition: SemiExplicitEulerTimeStepper.h:110
const ImpulseSolver & getImpulseSolver() const
(Advanced) Get direct access to the ImpulseSolver.
Definition: SemiExplicitEulerTimeStepper.h:261
#define SimTK_APIARGCHECK1_ALWAYS(cond, className, methodName, fmt, a1)
Definition: ExceptionMacros.h:228
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 getConstraintToleranceInUse() const
Return the tolerance to which we require constraints to be satisfied.
Definition: SemiExplicitEulerTimeStepper.h:223
Real getAccuracyInUse() const
Return the integration accuracy setting.
Definition: SemiExplicitEulerTimeStepper.h:217
Real getDefaultFrictionTransitionVelocityInUse() const
Return the value actually being used as the default sliding-to-rolling friction transition velocity...
Definition: SemiExplicitEulerTimeStepper.h:252
#define SimTK_ERRCHK1_ALWAYS(cond, whereChecked, fmt, a1)
Definition: ExceptionMacros.h:285
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
Real getMinSignificantForce() const
Definition: SemiExplicitEulerTimeStepper.h:212
A low-accuracy, high performance, velocity-level time stepper for models containing unilateral rigid ...
Definition: SemiExplicitEulerTimeStepper.h:52
void setPositionProjectionMethod(PositionProjectionMethod projMethod)
Definition: SemiExplicitEulerTimeStepper.h:139
This is the abstract base class for impulse solvers, which solve an important subproblem of the conta...
Definition: ImpulseSolver.h:109
void setAccuracy(Real accuracy)
Set integration accuracy; requires variable length steps.
Definition: SemiExplicitEulerTimeStepper.h:108
Every Simbody header and source file should include this header before any other Simbody header...
void setImpulseSolver(ImpulseSolver *impulseSolver)
(Advanced) Set your own ImpulseSolver; the TimeStepper takes over ownership so don't delete afterward...
Definition: SemiExplicitEulerTimeStepper.h:269
void setImpulseSolverType(ImpulseSolverType solverType)
Definition: SemiExplicitEulerTimeStepper.h:144
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
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:577
Real getAdvancedTime() const
synonym for getTime.
Definition: SemiExplicitEulerTimeStepper.h:101
void clearImpulseSolver()
(Advanced) Delete the existing ImpulseSolver if any.
Definition: SemiExplicitEulerTimeStepper.h:274
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:276
void setMinSignificantForce(Real minSignificantForce)
Set the threshold below which we can ignore forces.
Definition: SemiExplicitEulerTimeStepper.h:205
void setRestitutionModel(RestitutionModel restModel)
Definition: SemiExplicitEulerTimeStepper.h:112
~SemiExplicitEulerTimeStepper()
The contained ImpulseSolver will be destructed here; don't reference it afterwards! ...
Definition: SemiExplicitEulerTimeStepper.h:77
RestitutionModel
If an impact occurs at a contact where the coefficient of restitution (COR) is non zero...
Definition: SemiExplicitEulerTimeStepper.h:66
void setInducedImpactModel(InducedImpactModel indModel)
Definition: SemiExplicitEulerTimeStepper.h:117
#define SimTK_ERRCHK_ALWAYS(cond, whereChecked, msg)
Definition: ExceptionMacros.h:281
ImpulseSolverType getImpulseSolverType() const
Definition: SemiExplicitEulerTimeStepper.h:151
InducedImpactModel getInducedImpactModel() const
Definition: SemiExplicitEulerTimeStepper.h:119
ELEM max(const VectorBase< ELEM > &v)
Definition: VectorMath.h:251
The job of the MultibodySystem class is to coordinate the activities of various subsystems which can ...
Definition: MultibodySystem.h:48
Real getDefaultImpactMinCORVelocityInUse() const
Return the value actually being used as the default impact minimum coefficient of restitution velocit...
Definition: SemiExplicitEulerTimeStepper.h:247
const State & getAdvancedState() const
synonym for getState.
Definition: SemiExplicitEulerTimeStepper.h:95
void setMaxInducedImpactsPerStep(int maxInduced)
Limit the number of induced impact rounds per time step.
Definition: SemiExplicitEulerTimeStepper.h:131
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
State & updState()
Get writable access to the TimeStepper's internally maintained State.
Definition: SemiExplicitEulerTimeStepper.h:89
InducedImpactModel
Definition: SemiExplicitEulerTimeStepper.h:67
SuccessfulStepStatus
When a step is successful, it will return an indication of what caused it to stop where it did...
Definition: Integrator.h:202
PositionProjectionMethod
Definition: SemiExplicitEulerTimeStepper.h:68
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:72
Real getTime() const
Shortcut to getting the current time from the TimeStepper's internally maintained State...
Definition: SemiExplicitEulerTimeStepper.h:92
ImpulseSolverType
Definition: SemiExplicitEulerTimeStepper.h:70
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
PositionProjectionMethod getPositionProjectionMethod() const
Definition: SemiExplicitEulerTimeStepper.h:141
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
const MultibodySystem & getMultibodySystem() const
Get access to the MultibodySystem for which this TimeStepper was constructed.
Definition: SemiExplicitEulerTimeStepper.h:257
const State & getState() const
Get access to the TimeStepper's internally maintained State.
Definition: SemiExplicitEulerTimeStepper.h:86
RestitutionModel getRestitutionModel() const
Definition: SemiExplicitEulerTimeStepper.h:114
int getMaxInducedImpactsPerStep() const
Definition: SemiExplicitEulerTimeStepper.h:136
State & updAdvancedState()
synonym for updState.
Definition: SemiExplicitEulerTimeStepper.h:98
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