RobWorkProject  23.9.11-
Public Types | Public Member Functions | List of all members
FiniteStateSampler Class Reference

a state sampler that will sample a finite set of states. The nr of samples is not necesdarilly finite since states are allowed to be sampled multiple times. More...

#include <FiniteStateSampler.hpp>

Inherits StateSampler.

Public Types

enum  SamplerType { ORDERED_SAMPLING , RANDOM_SAMPLING }
 type of sampling More...
 
- Public Types inherited from StateSampler
typedef rw::core::Ptr< StateSamplerPtr
 

Public Member Functions

 FiniteStateSampler (const rw::kinematics::State &state, int n=1, SamplerType type=ORDERED_SAMPLING)
 constructor for sampling a single state More...
 
 FiniteStateSampler (const std::vector< rw::kinematics::State > &states, int n=1, SamplerType type=ORDERED_SAMPLING)
 constructor for sampling multiple states More...
 
virtual ~FiniteStateSampler ()
 destructor
 
void addState (const rw::kinematics::State &state)
 add a single state to sample More...
 
void addStates (const std::vector< rw::kinematics::State > &states)
 add states to be sampled More...
 
void setStates (const std::vector< rw::kinematics::State > &states)
 set the states that you want sampled More...
 
bool sample (rw::kinematics::State &state)
 Sample a state. More...
 
bool empty () const
 Sample a state. More...
 

Detailed Description

a state sampler that will sample a finite set of states. The nr of samples is not necesdarilly finite since states are allowed to be sampled multiple times.

Member Enumeration Documentation

◆ SamplerType

type of sampling

Enumerator
RANDOM_SAMPLING 

samples are choosen from front to back

samples are choosen randomly

Constructor & Destructor Documentation

◆ FiniteStateSampler() [1/2]

FiniteStateSampler ( const rw::kinematics::State state,
int  n = 1,
SamplerType  type = ORDERED_SAMPLING 
)

constructor for sampling a single state

Parameters
state[in] the state to sample
n[in] number of allowed samples, if n<0 then a infinite number of samples is allowed
typedocumentation missing !

◆ FiniteStateSampler() [2/2]

FiniteStateSampler ( const std::vector< rw::kinematics::State > &  states,
int  n = 1,
SamplerType  type = ORDERED_SAMPLING 
)

constructor for sampling multiple states

Parameters
states[in] states that are to be sampled
n[in] number of allowed samples, if n<0 then a infinite number of samples is allowed
typedocumentation missing !

Member Function Documentation

◆ addState()

void addState ( const rw::kinematics::State state)

add a single state to sample

Parameters
state[in] state to sample

◆ addStates()

void addStates ( const std::vector< rw::kinematics::State > &  states)

add states to be sampled

Parameters
states[in] states to sample

◆ empty()

bool empty ( ) const
virtual

Sample a state.

If sampling fails, the sampler may return the empty configuration. If empty() is true then the sampler has no more configurations. Otherwise sample() may (or may not) succeed if called a second time.

Implements StateSampler.

◆ sample()

bool sample ( rw::kinematics::State state)
virtual

Sample a state.

If sampling fails, the sampler may return the empty configuration. If empty() is true then the sampler has no more configurations. Otherwise sample() may (or may not) succeed if called a second time.

One of the states in the finite state list is choosen and returned

Implements StateSampler.

◆ setStates()

void setStates ( const std::vector< rw::kinematics::State > &  states)

set the states that you want sampled

Parameters
states[in] the states to sample

The documentation for this class was generated from the following file: