PPL API Reference
Overview Core Algorithm Abstractions Utilities Parallel Methods
Modules Class Hierarchy Classes Functions
Todo List Bug List Dead Code
List of all members
Simulation Class Reference

Public Member Functions

Simulation Interface
void Initialize ()
 Set up the simulation.
 
void Uninitialize ()
 Tear down the simulation.
 
void SimulationStep ()
 Advance the simulation one timestep.
 
void EditStep ()
 Update the drawable transforms to match those in the MPProblem.
 
Rendering Interface
virtual void render () override
 
virtual void start () override
 
virtual void reset () override
 
void SetBacklog (const size_t _max)
 
Additional Visualization
size_t AddPath (const std::vector< Cfg > &_path, const glutils::color &_c)
 
void RemovePath (const size_t _id)
 
size_t AddRoadmap (RoadmapGraph< Cfg, DefaultWeight< Cfg > > *_graph, const glutils::color &_c)
 
void RemoveRoadmap (const size_t _id)
 
size_t AddBoundary (const Boundary *const _boundary, const glutils::color &_c, const bool _wired=true)
 
void RemoveBoundary (const size_t _id)
 
void TransformBoundary (const size_t _id, const glutils::transform &_t)
 
size_t AddWorkspaceSkeleton (WorkspaceSkeleton *const _skeleton, const glutils::color &_c)
 
Editing
void RebuildMultiBody (DrawableMultiBody *const _m)
 

Static Public Member Functions

Accessors
static SimulationGet () noexcept
 Get the singleton.
 
static size_t NearestNumSteps (const double _dt) noexcept
 
static size_t GetTimestamp () noexcept
 

Construction

static void Create (MPProblem *_problem, const bool _edit=false)
 
virtual ~Simulation ()
 

Performance Measurement

static StatClassGetStatClass () noexcept
 Get the simulator's stat class for time profiling.
 
void PrintStatFile (const std::string &_basename="")
 

Detailed Description

Simulate an MPProblem using the bullet physics engine. Rendering is performed by the base_visualization parent class.

Note
This is a singleton object; there can only be one instance.

Member Function Documentation

◆ Create()

void Simulation::Create ( MPProblem _problem,
const bool  _edit = false 
)
static

Create the singleton.

Parameters
_problemThe MPProblem to simulate.
_editStart in edit mode instead of the physical simulator?

◆ NearestNumSteps()

size_t Simulation::NearestNumSteps ( const double  _dt)
staticnoexcept

Get the nearest number of timesteps needed to represent a continuous time interval.

Parameters
_dtThe time interval.
Returns
The number of steps needed to represent _dt.

◆ GetTimestamp()

size_t Simulation::GetTimestamp ( )
staticnoexcept

Get the current timestamp.

Returns
The number of steps taken so far.

◆ SetBacklog()

void Simulation::SetBacklog ( const size_t  _max)

Set the maximum number of frames that the simulator can pre-compute.

Parameters
_maxThe maximum number of backlogged frames to compute.

◆ AddPath()

size_t Simulation::AddPath ( const std::vector< Cfg > &  _path,
const glutils::color &  _c 
)

Add a path graphic to the scene as a sequence of connected line segments.

Parameters
_pathThe path to render.
_cThe line color.
Returns
The ID of the path.

◆ RemovePath()

void Simulation::RemovePath ( const size_t  _id)

Remove a path graphic from the scene.

Parameters
_idThe path ID.

◆ AddRoadmap()

size_t Simulation::AddRoadmap ( RoadmapGraph< Cfg, DefaultWeight< Cfg > > *  _graph,
const glutils::color &  _c 
)

Add a roadmap graphic to the scene.

Parameters
_graphthe graph to rendered
_cThe line color.
Returns
The ID of the path.

◆ RemoveRoadmap()

void Simulation::RemoveRoadmap ( const size_t  _id)

Remove a roadmap graphic from the scene.

Parameters
_idThe path ID.

◆ AddBoundary()

size_t Simulation::AddBoundary ( const Boundary *const  _boundary,
const glutils::color &  _c,
const bool  _wired = true 
)

Add a boundary graphic to the scene.

Parameters
_boundaryThe boundary to be rendered
_cThe rendering color.
_wiredRender in wireframe if true, solid if false.
Returns
The ID of the boundary

◆ RemoveBoundary()

void Simulation::RemoveBoundary ( const size_t  _id)

Remove a boundary graphic from the scene.

Parameters
_idThe boundary ID.

◆ TransformBoundary()

void Simulation::TransformBoundary ( const size_t  _id,
const glutils::transform &  _t 
)

Update a boundary graphic.

Parameters
_idThe boundary ID.
_tThe transformation to apply.

◆ AddWorkspaceSkeleton()

size_t Simulation::AddWorkspaceSkeleton ( WorkspaceSkeleton *const  _skeleton,
const glutils::color &  _c 
)

Add a workspace skeleton rendering to to the scene.

Parameters
_skeletonThe workspace skeleton.
_cThe rendering color.
Returns
The skeleton rendering's ID.

◆ RebuildMultiBody()

void Simulation::RebuildMultiBody ( DrawableMultiBody *const  _m)

Rebuild the physics engine's model for a given multibody.

Parameters
_mThe drawable multibody to rebuild. @WARNING The simulation will lock while you do this!

◆ PrintStatFile()

void Simulation::PrintStatFile ( const std::string &  _basename = "")

Print the simulator's stats to an output file.

Parameters
_basenameThe base name for the output file, or empty to use the MPProblem base name.

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