raisim::contact::BisectionContactSolver
class · #include <raisim/contact/BisectionContactSolver.hpp>
RaiSim's iterative contact solver: a Gauss-Seidel-style sweep over the constraint rows in which each frictional contact is solved with a bisection method. It is owned by the World (World::getContactSolver()); users typically only tune its SolverConfiguration.
Nested classes
structSolverConfiguration — Tuning parameters of the solver.
Constructors & destructor
BisectionContactSolver
explicit BisectionContactSolver() = defaultPublic member functions
solve
void solve(ContactProblems &contact)Solve the constraint rows in place: writes Single3DContactProblem::imp_i and applies the impulses to the objects' velocities.
Parameters
| Parameter | Description |
|---|---|
contact (in, out) | Constraint rows built by the World. |
solveWithTendons
void solveWithTendons(ContactProblems &contact, TendonSystem &tendons)Same as solve() but also solves the rows of a tendon system together with the contacts.
Parameters
| Parameter | Description |
|---|---|
contact (in, out) | Constraint rows built by the World. |
tendons (in, out) | Tendon system whose rows are solved jointly. |
updateConfig
void updateConfig(SolverConfiguration config)Replace the solver configuration.
Parameters
| Parameter | Description |
|---|---|
config (in) | New configuration. |
setTimestep
void setTimestep(double dt)Set the simulation time step used by the solver.
Parameters
| Parameter | Description |
|---|---|
dt (in) | Time step in seconds. |
setOrder
void setOrder(bool order)Set the sweep direction of the next solve. Each solve flips the direction afterwards; scenes with pin constraints always sweep forward.
Parameters
| Parameter | Description |
|---|---|
order (in) | true: first-to-last row, false: last-to-first. |
getOrder
bool getOrder() constReturns The sweep direction of the next solve (true: forward). See setOrder().
getPinCorrectionRate
double getPinCorrectionRate() constReturns The rate (1/s) at which pin position errors are corrected: clamp(0.2 * erp, 0, 0.3) / dt.
getLoopCounter
int getLoopCounter() constReturns The number of iterations performed by the last solve.
isStalled
bool isStalled() constReturns Whether the last solve ended because its error stopped improving (a plateau or a limit cycle) rather than by converging or reaching SolverConfiguration::maxIteration. Such a solve keeps the warm-start cache of the last converged solve and zeroes the pin warm starts.
getWarmStartComparisons
uint64_t getWarmStartComparisons() constReturns The number of cached contacts the last warm start compared with current contacts.
resetWarmStart
void resetWarmStart()Discard everything the solver carries from one solve to the next, so that the next solve starts as the first solve of a new solver does: the cached contact impulses that warm start it and the sweep direction (the next solve sweeps forward). Solves never do this themselves. The cache is matched by object pair and contact position, so it still seeds contacts after objects are teleported (World::setState(), an episode reset), and an object created at the address of a removed one inherits the removed object's entries. Call this then to make the following steps independent of the earlier ones.
void resetWarmStart(const ContactProblems &contact)resetWarmStart(), and also zero the pin warm-start impulses (Single3DContactProblem::pinWarmStart) that the given rows point to.
Parameters
| Parameter | Description |
|---|---|
contact (in) | Rows of the last solve, e.g. *World::getContactProblem(). |
getConfig
SolverConfiguration &getConfig()Returns Mutable reference to the solver configuration.
const SolverConfiguration &getConfig() constReturns The solver configuration.
Static member functions
refreshContactRow static
static void refreshContactRow(Single3DContactProblem &row)Internal: after the inverse inertia of a contact row changed between solves, recomputes what a solve derives from it (rank, inverse, friction ratios)