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];
298 { assert(sign==-1 || sign==1); }
330 :
m_Fk(frictionComponents),
m_Nk(normalComponents),
333 { assert(
m_Fk.size()<=3 &&
m_Nk.size()<=3);
368 #endif // SimTK_SIMBODY_IMPULSE_SOLVER_H_
UniSpeedRT(MultiplierIndex ix, int sign)
Definition: ImpulseSolver.h:296
Real getMaxRollingSpeed() const
Definition: ImpulseSolver.h:145
Definition: ImpulseSolver.h:119
void setMaxIterations(int maxIts)
Definition: ImpulseSolver.h:153
BndCond
Definition: ImpulseSolver.h:125
virtual ~ImpulseSolver()
Definition: ImpulseSolver.h:139
void clearStats() const
Definition: ImpulseSolver.h:163
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:2037
StateLimitedFrictionIndex m_slfx
Definition: ImpulseSolver.h:356
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
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
Definition: ImpulseSolver.h:325
The SimTK::Array_ container class is a plug-compatible replacement for the C++ standard template l...
Definition: Array.h:50
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:577
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...
int getMaxIterations() const
Definition: ImpulseSolver.h:157
Array_< Real > m_Fimpulse
Definition: ImpulseSolver.h:363
long long m_nBilateralIters
Definition: ImpulseSolver.h:244
ConstraintLtdFrictionRT(const Array_< MultiplierIndex > &frictionComponents, const Array_< MultiplierIndex > &normalComponents, Real effMu)
Definition: ImpulseSolver.h:327
MultiplierIndex m_ix
Definition: ImpulseSolver.h:301
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
Definition: ImpulseSolver.h:123
Real m_lb
Definition: ImpulseSolver.h:317
bool isNaN(const negator< float > &x)
Definition: negator.h:273
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
void clearStats(int phase) const
Definition: ImpulseSolver.h:169
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:72
unsigned int sign(unsigned char u)
Definition: Scalar.h:311
MultiplierIndex m_ix
Definition: ImpulseSolver.h:316
Real m_effMu
Definition: ImpulseSolver.h:339
Definition: ImpulseSolver.h:124
Real getConvergenceTol() const
Definition: ImpulseSolver.h:151
StateLtdFrictionRT(const Array_< MultiplierIndex > &frictionComponents, Real knownN, Real muEff)
Definition: ImpulseSolver.h:348
Real m_effMu
Definition: ImpulseSolver.h:359
Definition: ImpulseSolver.h:125
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
Array_< MultiplierIndex > m_Fk
Definition: ImpulseSolver.h:338
FricCond
Definition: ImpulseSolver.h:124