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
structOptions — Controller parameters. All distances and thresholds must be finite and nonnegative.structWakeSphere — A region that wakes grains, typically bounding an object entering the pool.
Public types
Policy
enum class PolicyWhen 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
GranularPoolSleepController()Controller with default options.
explicit GranularPoolSleepController(Options options)Parameters
| Parameter | Description |
|---|---|
options (in) | controller options. Throws std::invalid_argument for negative or non-finite values. |
GranularPoolSleepController(const GranularPoolSleepController &) = deletePublic member functions
operator=
GranularPoolSleepController &operator=(const GranularPoolSleepController &) = deletearm
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
| Parameter | Description |
|---|---|
grains (in, out) | the granular system |
update
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
| Parameter | Description |
|---|---|
grains (in, out) | the armed granular system |
wakeSources (in) | regions that wake grains |
release
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
| Parameter | Description |
|---|---|
grains (in, out) | the armed granular system |
sleepingCount
size_t sleepingCount() constReturns the number of grains currently asleep.
wakeTransitions
size_t wakeTransitions() constReturns the number of sleep-to-awake transitions since the last arm().