RcsPySim
A robot control and simulation library
Rcs::ExperimentConfig Class Referenceabstract

#include <ExperimentConfig.h>

Inheritance diagram for Rcs::ExperimentConfig:
Collaboration diagram for Rcs::ExperimentConfig:

Public Types

typedef ExperimentConfig *(* ExperimentConfigCreateFunction) ()
 

Public Member Functions

 ExperimentConfig ()
 
virtual ~ExperimentConfig ()
 
virtual ActionModelcreateActionModel ()=0
 
virtual ObservationModelcreateObservationModel ()=0
 
virtual InitStateSettercreateInitStateSetter ()
 
virtual ForceDisturbercreateForceDisturber ()
 
PhysicsParameterManagercreatePhysicsParameterManager ()
 
virtual void populatePhysicsParameters (PhysicsParameterManager *manager)
 
virtual void getHUDText (std::vector< std::string > &linesOut, double currentTime, const MatNd *currentObservation, const MatNd *currentAction, PhysicsBase *simulator, PhysicsParameterManager *physicsManager, ForceDisturber *forceDisturber)
 
std::string getHUDText (double currentTime, const MatNd *currentObservation, const MatNd *currentAction, PhysicsBase *simulator, PhysicsParameterManager *physicsManager, ForceDisturber *forceDisturber)
 
virtual void initViewer (Rcs::Viewer *viewer)
 

Static Public Member Functions

static void registerType (const char *name, ExperimentConfigCreateFunction creator)
 
static ExperimentConfigcreate (PropertySource *properties)
 

Public Attributes

PropertySourceproperties
 
RcsGraph * graph
 
ActionModelactionModel
 
ObservationModelobservationModel
 
RcsCollisionMdl * collisionMdl
 
double dt
 
bool checkJointLimits
 

Protected Member Functions

virtual void load (PropertySource *properties)
 

Detailed Description

Defines the experiment setup. There should be one subclass per experiment type, IE BallOnPlate or QuanserQube.

Definition at line 72 of file ExperimentConfig.h.

Member Typedef Documentation

◆ ExperimentConfigCreateFunction

typedef ExperimentConfig*(* Rcs::ExperimentConfig::ExperimentConfigCreateFunction) ()

Definition at line 77 of file ExperimentConfig.h.

Constructor & Destructor Documentation

◆ ExperimentConfig()

Rcs::ExperimentConfig::ExperimentConfig ( )

Definition at line 191 of file ExperimentConfig.cpp.

◆ ~ExperimentConfig()

Rcs::ExperimentConfig::~ExperimentConfig ( )
virtual

Definition at line 199 of file ExperimentConfig.cpp.

Member Function Documentation

◆ create()

ExperimentConfig * Rcs::ExperimentConfig::create ( PropertySource properties)
static

Create the experiment configuration from the given property source. This will load the "type" property, use that to select a ExperimentConfig implementation, and then call init() to populate it.

Parameters
propertiesproperty source to read configuration from. Takes ownership, even on error.
Returns
a new experiment config object.

Definition at line 152 of file ExperimentConfig.cpp.

◆ createActionModel()

virtual ActionModel* Rcs::ExperimentConfig::createActionModel ( )
pure virtual

Create the action model. Read any configuration from this->properties.

Returns
the new action model

Implemented in Rcs::ECPlanar3Link, Rcs::ECPlanarInsert, Rcs::ECBoxLifting, Rcs::ECMiniGolf, Rcs::ECBallInTube, Rcs::ECBoxShelving, Rcs::ECBallOnPlate, Rcs::ECMPblending, and Rcs::ECQuanserQube.

◆ createForceDisturber()

ForceDisturber * Rcs::ExperimentConfig::createForceDisturber ( )
virtual

Create a model for artificial external disturbing forces. The default implementation returns NULL to ignore this.

Returns
the new force disturber

Reimplemented in Rcs::ECBallInTube, Rcs::ECBoxLifting, Rcs::ECPlanar3Link, Rcs::ECBoxShelving, Rcs::ECPlanarInsert, Rcs::ECMPblending, Rcs::ECBallOnPlate, and Rcs::ECQuanserQube.

Definition at line 301 of file ExperimentConfig.cpp.

◆ createInitStateSetter()

InitStateSetter * Rcs::ExperimentConfig::createInitStateSetter ( )
virtual

Create the init state setter. Read any configuration from this->properties. Since the init state setter is only needed for the simulation, it is not stored in the ExperimentConfig. Instead, the simulation calls this method and manages the object on it's own. The default implementation returns NULL to use the state from the graph file.

Returns
the new init state setter

Reimplemented in Rcs::ECBallInTube, Rcs::ECBoxLifting, Rcs::ECPlanar3Link, Rcs::ECBoxShelving, Rcs::ECPlanarInsert, Rcs::ECMiniGolf, Rcs::ECMPblending, Rcs::ECBallOnPlate, and Rcs::ECQuanserQube.

Definition at line 295 of file ExperimentConfig.cpp.

◆ createObservationModel()

ObservationModel * Rcs::ExperimentConfig::createObservationModel ( )
pure virtual

Create the observation model. Read any configuration from this->properties.

Returns
the new observation model

Implemented in Rcs::ECBallInTube, Rcs::ECBoxLifting, Rcs::ECPlanar3Link, Rcs::ECBoxShelving, Rcs::ECPlanarInsert, Rcs::ECMPblending, Rcs::ECMiniGolf, Rcs::ECBallOnPlate, and Rcs::ECQuanserQube.

Definition at line 289 of file ExperimentConfig.cpp.

◆ createPhysicsParameterManager()

PhysicsParameterManager * Rcs::ExperimentConfig::createPhysicsParameterManager ( )

Create the physics parameter manager. Read any configuration from this->properties. Since the physics parameter manager is only needed for the simulation, it is not stored in the ExperimentConfig. Instead, the simulation calls this method and manages the object on it's own. This method calls populatePhysicsParameters to populate the parameter descriptors.

Returns
the new physics parameter manager

Definition at line 307 of file ExperimentConfig.cpp.

◆ getHUDText() [1/2]

void Rcs::ExperimentConfig::getHUDText ( std::vector< std::string > &  linesOut,
double  currentTime,
const MatNd *  currentObservation,
const MatNd *  currentAction,
PhysicsBase *  simulator,
PhysicsParameterManager physicsManager,
ForceDisturber forceDisturber 
)
virtual

Called to update the HUD text for the viewer. The default implementation will show the physics engine name, the current time.

Parameters
[out]linesOutvector of HUD lines. initially empty.
[in]currentTimesimulation time
[in]currentObservationlatest observation
[in]currentActionlatest action
[in]simulatorphysics simulator or NULL if none
[in]physicsManagerphysics parameter manager or NULL if none
[in]forceDisturberdistruber which applies the forces to a given body
Returns
concatenated HUD lines

Reimplemented in Rcs::ECBallInTube, Rcs::ECBoxLifting, Rcs::ECPlanar3Link, Rcs::ECBoxShelving, Rcs::ECPlanarInsert, Rcs::ECMiniGolf, Rcs::ECBallOnPlate, Rcs::ECMPblending, and Rcs::ECQuanserQube.

Definition at line 347 of file ExperimentConfig.cpp.

◆ getHUDText() [2/2]

std::string Rcs::ExperimentConfig::getHUDText ( double  currentTime,
const MatNd *  currentObservation,
const MatNd *  currentAction,
PhysicsBase *  simulator,
PhysicsParameterManager physicsManager,
ForceDisturber forceDisturber 
)

Returns the concatenated HUD lines.

Parameters
[in]currentTimesimulation time
[in]currentObservationlatest observation
[in]currentActionlatest action
[in]simulatorphysics simulator or NULL if none
[in]physicsManagerphysics parameter manager or NULL if none
[in]forceDisturberdistruber which applies the forces to a given body
Returns
concatenated HUD lines

Definition at line 370 of file ExperimentConfig.cpp.

◆ initViewer()

void Rcs::ExperimentConfig::initViewer ( Rcs::Viewer *  viewer)
virtual

Perform additional initialization on the viewer. This could, for example, change the camera position or add additional visualization. The default implementation does nothing.

Reimplemented in Rcs::ECBallInTube, Rcs::ECBoxLifting, Rcs::ECPlanar3Link, Rcs::ECBoxShelving, Rcs::ECPlanarInsert, Rcs::ECMiniGolf, Rcs::ECMPblending, Rcs::ECBallOnPlate, and Rcs::ECQuanserQube.

Definition at line 337 of file ExperimentConfig.cpp.

◆ load()

void Rcs::ExperimentConfig::load ( PropertySource properties)
protectedvirtual

Called to load data from the given properties. You can override this to load additional data, but be sure to call the parent implementation.

Parameters
propertiesproperty source to read configuration from. Takes ownership.

Definition at line 213 of file ExperimentConfig.cpp.

◆ populatePhysicsParameters()

void Rcs::ExperimentConfig::populatePhysicsParameters ( PhysicsParameterManager manager)
virtual

Add the physics parameter descriptors to the given physics parameter manager.

Parameters
managerparameter manager to populate.

Reimplemented in Rcs::ECBallInTube, Rcs::ECBoxLifting, Rcs::ECPlanar3Link, Rcs::ECBoxShelving, Rcs::ECPlanarInsert, Rcs::ECMiniGolf, Rcs::ECMPblending, Rcs::ECBallOnPlate, and Rcs::ECQuanserQube.

Definition at line 342 of file ExperimentConfig.cpp.

◆ registerType()

void Rcs::ExperimentConfig::registerType ( const char *  name,
ExperimentConfig::ExperimentConfigCreateFunction  creator 
)
static

Register a named experiment.

Parameters
nameexperiment name
creatorExperimentConfig factory function

Definition at line 146 of file ExperimentConfig.cpp.

Member Data Documentation

◆ actionModel

ActionModel* Rcs::ExperimentConfig::actionModel

Action model (pluggable)

Definition at line 203 of file ExperimentConfig.h.

◆ checkJointLimits

bool Rcs::ExperimentConfig::checkJointLimits

Flag to enable joint limit checking.

Definition at line 215 of file ExperimentConfig.h.

◆ collisionMdl

RcsCollisionMdl* Rcs::ExperimentConfig::collisionMdl

Collision model to use. Is based on the graph, so take care when using with IK etc.

Definition at line 209 of file ExperimentConfig.h.

◆ dt

double Rcs::ExperimentConfig::dt

The time step [s].

Definition at line 212 of file ExperimentConfig.h.

◆ graph

RcsGraph* Rcs::ExperimentConfig::graph

Graph description.

Definition at line 200 of file ExperimentConfig.h.

◆ observationModel

ObservationModel* Rcs::ExperimentConfig::observationModel

Observation model (pluggable) used to create the observation which will be returned from step()

Definition at line 206 of file ExperimentConfig.h.

◆ properties

PropertySource* Rcs::ExperimentConfig::properties

Property source (owned)

Definition at line 197 of file ExperimentConfig.h.


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