Actin®  Version 5.2.0
Software for Robotics Simulation and Control
EcIODataBroker Class Reference

Manages flow of input and output data between plugins and simulation. More...

#include <ecIODataBroker.h>

Inheritance diagram for EcIODataBroker:
EcSimulationCore

Public Types

enum  TimeMode {
  AsFastAsPossible,
  Locked
}
 time modes More...
 
enum  StateRequested {
  InitRecieved,
  ResetReceived,
  DataReceived,
  NothingReceived
}
 state requested modes More...
 

Public Member Functions

 EcIODataBroker ()
 Constructor.
 
virtual ~EcIODataBroker ()
 Destructor.
 
virtual EcBoolean loadSystemSimulation (const EcSystemSimulation &sysSim)
 Load system simulation. More...
 
virtual void registerPlugins ()
 prepare itself for the plugins. This includes manage priority of the plugins.
 
virtual void registerPlugin (Ec::Plugin *plugin)
 register a new plugin More...
 
virtual void resetPlugins ()
 Calls reset() on all currently loaded plugins. Used when [re-]loading a file.
 
virtual void runSimulationCycle ()
 set input data to simulation, run one simulation cycle, and set the output data to output plugins
 
virtual void startSimulation ()
 start the loop that manages the data flow
 
virtual void stopSimulation ()
 stop the loop that manages the data flow
 
virtual void pauseSimulation ()
 pause the simulation timer
 
virtual void waitUntilSimulationStep ()
 Allows other threads to wait on the simulation to finish its timestep.
 
EcU32 simulationPeriodInMs () const
 Get the rate at which the simulation is updating.
 
virtual EcReal simulationThreadUpdateRate () const
 gets the rate at which the simulation thread is running in Hz
 
virtual void setSimulationThreadUpdateRate (const EcReal value)
 sets the rate at which to run the simulation in Hz More...
 
virtual EcReal elapsedSimulationTime () const
 returns the time elapsed in seconds since the simulation started
 
EcReal calculationTime () const
 Returns the amount of time taken to calculate last state.
 
EcReal timeDifference () const
 Difference in time.
 
Ec::AsyncThreadsimulationThread ()
 
Ec::AsyncThreadpluginThread (Ec::Plugin *plugin)
 
EcBoolean loadPlugins () const
 
void setLoadPlugins (const EcBoolean loadPlugins)
 

Protected Types

typedef boost::scoped_ptr< Ec::SimulationThreadSimulationPtrType
 boost scoped pointer for simulation thread
 
typedef boost::ptr_vector< Ec::PluginThreadPluginThreadVectorPtr
 boost pointer vector for plugin thread
 
typedef boost::scoped_ptr< Ec::IOBufferIOBufferPtrType
 boost scoped pointer for io buffer
 

Protected Member Functions

virtual EcBoolean initState ()
 
EcBoolean initPlugin (Ec::Plugin *plugin)
 
EcBoolean unloadPlugin (Ec::Plugin *plugin)
 
void shutdownPlugins ()
 

Protected Attributes

EcCONNECTION_PTRS m_ConnectionPtrs
 Connection manager.
 
EcMutex m_OutputDataMutex
 Mutex to protect output data.
 
EcCondition m_OutputDataCondition
 Plugin thread wait condition.
 
SimulationPtrType m_pAsyncSimThread
 Simulation thread.
 
PluginThreadVectorPtr m_vPluginThreadPtr
 Plugin threads.
 
EcElapsedTime m_SimulationTimer
 Simulation timer.
 
EcMicroTimer m_CalculationTime
 Time taken to compute.
 
EcMicroTimer m_PeriodTime
 Time between calls to runSimulationCycle.
 
EcReal m_Time
 Current time value.
 
IOBufferPtrType m_BufferPtr
 Location for all simulation data.
 
Ec::SimulationRunState m_SimRunState
 Local copy of simulation state.
 
EcMutex m_TimerMutex
 Mutex to protect timers.
 
EcMicroTimer m_ThreadTimer
 Timer used to compute time difference.
 
EcBoolean m_LoadPlugins
 Flag to load plugin config saved in simulation filed.
 

Detailed Description

Manages flow of input and output data between plugins and simulation.

Definition at line 34 of file ecIODataBroker.h.

Member Enumeration Documentation

state requested modes

Enumerator
InitRecieved 

Input requests initialization of simulation.

ResetReceived 

Input requests reset of simulation.

DataReceived 

Input received data.

NothingReceived 

No update from input.

Definition at line 46 of file ecIODataBroker.h.

time modes

Enumerator
AsFastAsPossible 

Open loop running.

Locked 

Lock to input data.

Definition at line 39 of file ecIODataBroker.h.

Member Function Documentation

EcBoolean EcIODataBroker::initPlugin ( Ec::Plugin plugin)
protected

Intialize a newly-loaded plugin.

Returns
EcBoolean Success or failure of command
Parameters
[in]pluginPlugin pointer to operate on
virtual EcBoolean EcIODataBroker::initState ( )
protectedvirtual

Initialize internal state based upon simulation file loaded.

Returns
EcBoolean Success or failure of command

Reimplemented in EcSimulationCore.

EcBoolean EcIODataBroker::loadPlugins ( ) const

Get the loadPlugins flag. If true, then plugins stored in the simulation file will be loaded on initState

virtual EcBoolean EcIODataBroker::loadSystemSimulation ( const EcSystemSimulation sysSim)
virtual

Load system simulation.

Parameters
[in]sysSimSimulation to load
Ec::AsyncThread* EcIODataBroker::pluginThread ( Ec::Plugin plugin)

Get the pointer to the simulation thread, allows realtime access control of the thread.

Parameters
pluginPlugin to find the thread of.
virtual void EcIODataBroker::registerPlugin ( Ec::Plugin plugin)
virtual

register a new plugin

Parameters
[in]pluginPlugin pointer to operate on
void EcIODataBroker::setLoadPlugins ( const EcBoolean  loadPlugins)

Set the loadPlugins flag. If true, then plugins stored in the simulation file will be loaded on initState

virtual void EcIODataBroker::setSimulationThreadUpdateRate ( const EcReal  value)
virtual

sets the rate at which to run the simulation in Hz

Parameters
[in]valueSimulation rate in Hz
void EcIODataBroker::shutdownPlugins ( )
protected

Calls the shutdown() method on all plugins. This happens right before stopping and deleting the simulation. Plugins are unloaded after that.

Ec::AsyncThread* EcIODataBroker::simulationThread ( )

Get the pointer to the simulation thread, allows realtime access control of the thread.

EcBoolean EcIODataBroker::unloadPlugin ( Ec::Plugin plugin)
protected

Remove memory associated with a plugin.

Returns
EcBoolean Success or failure of command
Parameters
[in]pluginPlugin pointer to operate on

The documentation for this class was generated from the following file:
Created by Energid Technologies www.energid.com
Copyright © 2016 Energid. All trademarks mentioned in this document are property of their respective owners.