Skip to content

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 ​

Constructors & destructor ​

BisectionContactSolver ​

cpp
explicit BisectionContactSolver() = default

Public member functions ​

solve ​

cpp
void solve(ContactProblems &contact)

Solve the constraint rows in place: writes Single3DContactProblem::imp_i and applies the impulses to the objects' velocities.

Parameters

ParameterDescription
contact (in, out)Constraint rows built by the World.

solveWithTendons ​

cpp
void solveWithTendons(ContactProblems &contact, TendonSystem &tendons)

Same as solve() but also solves the rows of a tendon system together with the contacts.

Parameters

ParameterDescription
contact (in, out)Constraint rows built by the World.
tendons (in, out)Tendon system whose rows are solved jointly.

updateConfig ​

cpp
void updateConfig(SolverConfiguration config)

Replace the solver configuration.

Parameters

ParameterDescription
config (in)New configuration.

setTimestep ​

cpp
void setTimestep(double dt)

Set the simulation time step used by the solver.

Parameters

ParameterDescription
dt (in)Time step in seconds.

setOrder ​

cpp
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

ParameterDescription
order (in)true: first-to-last row, false: last-to-first.

getOrder ​

cpp
bool getOrder() const

Returns The sweep direction of the next solve (true: forward). See setOrder().

getPinCorrectionRate ​

cpp
double getPinCorrectionRate() const

Returns The rate (1/s) at which pin position errors are corrected: clamp(0.2 * erp, 0, 0.3) / dt.

getLoopCounter ​

cpp
int getLoopCounter() const

Returns The number of iterations performed by the last solve.

isStalled ​

cpp
bool isStalled() const

Returns 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 ​

cpp
uint64_t getWarmStartComparisons() const

Returns The number of cached contacts the last warm start compared with current contacts.

resetWarmStart ​

cpp
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.

cpp
void resetWarmStart(const ContactProblems &contact)

resetWarmStart(), and also zero the pin warm-start impulses (Single3DContactProblem::pinWarmStart) that the given rows point to.

Parameters

ParameterDescription
contact (in)Rows of the last solve, e.g. *World::getContactProblem().

getConfig ​

cpp
SolverConfiguration &getConfig()

Returns Mutable reference to the solver configuration.

cpp
const SolverConfiguration &getConfig() const

Returns The solver configuration.

Static member functions ​

refreshContactRow static ​

cpp
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)

RaiSim — physics for robotics and AI.