Skip to content

raisim::GranularPoolSleepController ​

class · #include <raisim/object/granular/GranularPoolSleepController.hpp>

Opt-in approximation for a settled pool. Sleeping grains act as fixed grains. Call update before each world step, then release before changing the pool's size.

Nested classes ​

  • struct Options — Controller parameters. All distances and thresholds must be finite and nonnegative.
  • struct WakeSphere — A region that wakes grains, typically bounding an object entering the pool.

Public types ​

Policy ​

cpp
enum class Policy

When awake grains go to sleep. In every policy, grains within a wake sphere's reach (or above Options::keepAboveZ) are woken. RADIUS: every other grain sleeps immediately. QUIET: every other grain sleeps after Options::quietSteps consecutive quiet updates (below both speed thresholds). WAKE_ONCE: grains never go back to sleep after arm(); the wake reach is extended by Options::extraWakeDistance.

Enumerator
RADIUS
QUIET
WAKE_ONCE

Constructors & destructor ​

GranularPoolSleepController ​

cpp
GranularPoolSleepController()

Controller with default options.

cpp
explicit GranularPoolSleepController(Options options)

Parameters

ParameterDescription
options (in)controller options. Throws std::invalid_argument for negative or non-finite values.
cpp
GranularPoolSleepController(const GranularPoolSleepController &) = delete

Public member functions ​

operator= ​

cpp
GranularPoolSleepController &operator=(const GranularPoolSleepController &) = delete

arm ​

cpp
void arm(GranularSystem &grains)

Attach to a pool and put its currently quiet grains to sleep (grains that were already fixed are never touched). Throws std::logic_error if already armed.

Parameters

ParameterDescription
grains (in, out)the granular system

update ​

cpp
void update(GranularSystem &grains, std::span<const WakeSphere> wakeSources)

Wake grains near the wake sources and put grains to sleep according to the policy. Call before each world step. Throws std::logic_error if not armed with grains or if the particle count changed.

Parameters

ParameterDescription
grains (in, out)the armed granular system
wakeSources (in)regions that wake grains

release ​

cpp
void release(GranularSystem &grains)

Wake all sleeping grains and detach. Call before adding or removing particles. Throws std::logic_error if not armed with grains or if the particle count changed.

Parameters

ParameterDescription
grains (in, out)the armed granular system

sleepingCount ​

cpp
size_t sleepingCount() const

Returns the number of grains currently asleep.

wakeTransitions ​

cpp
size_t wakeTransitions() const

Returns the number of sleep-to-awake transitions since the last arm().

RaiSim — physics for robotics and AI.