1 #ifndef SimTK_SIMBODY_IMPULSE_SOLVER_H_ 2 #define SimTK_SIMBODY_IMPULSE_SOLVER_H_ 119 enum ContactType {TypeNA=-1, Observing=0, Known=1, Participating=2};
123 enum UniCond {UniNA=-1, UniOff=0, UniActive=1, UniKnown=2};
124 enum FricCond {FricNA=-1, FricOff=0, Sliding=1, Impending=2, Rolling=3};
125 enum BndCond {BndNA=-1, SlipLow=0, ImpendLow=1, Engaged=2,
126 ImpendHigh=3, SlipHigh=4};
132 : m_maxRollingTangVel(roll2slipTransitionSpeed),
133 m_convergenceTol(convergenceTol),
142 assert(roll2slipTransitionSpeed >= 0);
143 m_maxRollingTangVel = roll2slipTransitionSpeed;
149 m_convergenceTol = tol;
161 static const int MaxNumPhases = 3;
164 for (
int i=0; i < MaxNumPhases; ++i)
166 m_nBilateralSolves = m_nBilateralIters = m_nBilateralFail = 0;
171 "ImpulseSolver::clearStats(phase)",
172 "Phase must be 0..%d but was %d\n", MaxNumPhases-1, phase);
173 m_nSolves[phase] = m_nIters[phase] = m_nFail[phase] = 0;
217 virtual bool solveBilateral
226 static const char* getContactTypeName(
ContactType ct);
227 static const char* getUniCondName(
UniCond uc);
228 static const char* getFricCondName(
FricCond fc);
229 static const char* getBndCondName(
BndCond bc);
232 static void dumpUniContacts(
const String& msg,
240 mutable long long m_nSolves[MaxNumPhases];
241 mutable long long m_nIters[MaxNumPhases];
242 mutable long long m_nFail[MaxNumPhases];
267 : m_sign(1), m_type(TypeNA), m_effCOR(
NaN), m_effMu(
NaN),
268 m_contactCond(UniNA), m_frictionCond(FricNA),
297 : m_ix(ix), m_sign(sign), m_speedCond(UniNA), m_impulse(
NaN)
298 { assert(sign==-1 || sign==1); }
312 : m_ix(ix), m_lb(lb), m_ub(ub), m_boundedCond(BndNA), m_impulse(
NaN)
313 { assert(m_lb<=m_ub); }
330 : m_Fk(frictionComponents), m_Nk(normalComponents),
331 m_effMu(effMu), m_frictionCond(FricNA),
332 m_Fimpulse(frictionComponents.
size(),
NaN)
333 { assert(m_Fk.size()<=3 && m_Nk.size()<=3);
334 assert(
isNaN(m_effMu) || m_effMu>=0); }
350 : m_Fk(frictionComponents), m_knownN(knownN), m_effMu(muEff),
351 m_frictionCond(FricNA), m_Fimpulse(frictionComponents.size(),
NaN)
352 { assert(m_Fk.size()<=3); assert(m_knownN >= 0);
353 assert(
isNaN(m_effMu) || m_effMu>=0); }
368 #endif // SimTK_SIMBODY_IMPULSE_SOLVER_H_
UniSpeedRT(MultiplierIndex ix, int sign)
Definition: ImpulseSolver.h:296
void setMaxIterations(int maxIts)
Definition: ImpulseSolver.h:153
BndCond
Definition: ImpulseSolver.h:125
virtual ~ImpulseSolver()
Definition: ImpulseSolver.h:139
ConstraintIndex m_constraint
Definition: ImpulseSolver.h:252
Definition: ImpulseSolver.h:248
size_type size() const
Return the current number of elements stored in this array.
Definition: Array.h:2075
StateLimitedFrictionIndex m_slfx
Definition: ImpulseSolver.h:356
Real getMaxRollingSpeed() const
Definition: ImpulseSolver.h:145
BndCond m_boundedCond
Definition: ImpulseSolver.h:320
Definition: ImpulseSolver.h:295
BoundedRT(MultiplierIndex ix, Real lb, Real ub)
Definition: ImpulseSolver.h:311
long long m_nBilateralSolves
Definition: ImpulseSolver.h:243
ConstraintLimitedFrictionIndex m_clfx
Definition: ImpulseSolver.h:337
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
Real getConvergenceTol() const
Definition: ImpulseSolver.h:151
UniCond
Definition: ImpulseSolver.h:123
Real m_knownN
Definition: ImpulseSolver.h:358
ImpulseSolver(Real roll2slipTransitionSpeed, Real convergenceTol, int maxIters)
Definition: ImpulseSolver.h:129
This is the abstract base class for impulse solvers, which solve an important subproblem of the conta...
Definition: ImpulseSolver.h:109
Array_< MultiplierIndex > m_Nk
Definition: ImpulseSolver.h:338
int m_maxIters
Definition: ImpulseSolver.h:238
Every Simbody header and source file should include this header before any other Simbody header...
Array_< Real > m_impulse
Definition: ImpulseSolver.h:256
int getMaxIterations() const
Definition: ImpulseSolver.h:157
Definition: ImpulseSolver.h:325
Definition: ImpulseSolver.h:347
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:606
Array_< MultiplierIndex > m_mults
Definition: ImpulseSolver.h:253
Vec3 m_impulse
Definition: ImpulseSolver.h:306
ContactType
Definition: ImpulseSolver.h:119
Real m_sign
Definition: ImpulseSolver.h:302
const Real NaN
This is the IEEE "not a number" constant for this implementation of the default-precision Real type; ...
This is for arrays indexed by constraint number within a subsystem (typically the SimbodyMatterSubsys...
Array_< Real > m_Fimpulse
Definition: ImpulseSolver.h:363
long long m_nBilateralIters
Definition: ImpulseSolver.h:244
MultiplierIndex m_ix
Definition: ImpulseSolver.h:301
The Array_<T> container class is a plug-compatible replacement for the C++ standard template library ...
Definition: Array.h:53
Array_< MultiplierIndex > m_Fk
Definition: ImpulseSolver.h:357
UncondRT()
Definition: ImpulseSolver.h:249
Real m_convergenceTol
Definition: ImpulseSolver.h:237
Real m_ub
Definition: ImpulseSolver.h:317
FricCond m_frictionCond
Definition: ImpulseSolver.h:342
FricCond m_frictionCond
Definition: ImpulseSolver.h:362
Definition: ImpulseSolver.h:310
bool isNaN(const negator< float > &x)
Definition: negator.h:272
UniCond m_speedCond
Definition: ImpulseSolver.h:305
#define SimTK_ERRCHK2(cond, whereChecked, fmt, a1, a2)
Definition: ExceptionMacros.h:328
Real m_impulse
Definition: ImpulseSolver.h:321
SimTK::String is a plug-compatible std::string replacement (plus some additional functionality) inten...
Definition: String.h:62
void setMaxRollingSpeed(Real roll2slipTransitionSpeed)
Definition: ImpulseSolver.h:141
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
unsigned int sign(unsigned char u)
Definition: Scalar.h:311
void clearStats(int phase) const
Definition: ImpulseSolver.h:169
MultiplierIndex m_ix
Definition: ImpulseSolver.h:316
Real m_effMu
Definition: ImpulseSolver.h:339
StateLtdFrictionRT(const Array_< MultiplierIndex > &frictionComponents, Real knownN, Real muEff)
Definition: ImpulseSolver.h:348
Real m_effMu
Definition: ImpulseSolver.h:359
long long m_nBilateralFail
Definition: ImpulseSolver.h:245
Array_< Real > m_Fimpulse
Definition: ImpulseSolver.h:343
Unique integer type for Subsystem-local multiplier indexing.
void setConvergenceTol(Real tol)
Definition: ImpulseSolver.h:147
Real m_maxRollingTangVel
Definition: ImpulseSolver.h:236
void clearStats() const
Definition: ImpulseSolver.h:163
FricCond
Definition: ImpulseSolver.h:124