Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes
RTT::extras::SimulationThread Class Reference

#include <SimulationThread.hpp>

Inheritance diagram for RTT::extras::SimulationThread:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual bool isRunning () const
virtual bool run (unsigned int maxsteps)
virtual os::ThreadInterfacesimthread ()
virtual bool start ()
virtual bool start (unsigned int maxsteps)
virtual ~SimulationThread ()

Static Public Member Functions

static SimulationThreadPtr Instance (double period=0.001)
static bool Release ()

Protected Member Functions

void finalize ()
bool initialize ()
 SimulationThread (double period)
void step ()

Private Attributes

os::TimeServicebeat
unsigned int cursteps
unsigned int maxsteps_
bool sim_running

Static Private Attributes

static SimulationThreadPtr _instance

Detailed Description

This thread is the simulated real-time periodic thread in the Orocos system.

All your activities in the same program must be a SimulationActivity for this to work, since the os::TimeService global time is updated when this thread runs.

By default, the update period is 0.001 seconds. If you want to run with a finer or coarser grained time step, use the Instance() method and supply another period before SimulationActivities are created.

Note:
This implementation has lost the capability to run SimulationActivity objects of different periods.

Definition at line 64 of file SimulationThread.hpp.


Constructor & Destructor Documentation

Destructor

Definition at line 98 of file SimulationThread.cpp.

RTT::SimulationThread::SimulationThread ( double  period) [protected]

Constructor

Definition at line 86 of file SimulationThread.cpp.


Member Function Documentation

void RTT::SimulationThread::finalize ( ) [protected, virtual]
See also:
base::RunnableInterface::finalize()

Reimplemented from RTT::extras::TimerThread.

Definition at line 155 of file SimulationThread.cpp.

bool RTT::SimulationThread::initialize ( ) [protected, virtual]
See also:
base::RunnableInterface::initialize()

Reimplemented from RTT::extras::TimerThread.

Definition at line 141 of file SimulationThread.cpp.

SimulationThreadPtr RTT::SimulationThread::Instance ( double  period = 0.001) [static]

Create the SimulationThread with a given period. Only one SimulationThread can be created.

Parameters:
periodThe period in seconds at which the simulation takes steps and updates the TimeService. Only the first invocation of Instance will consider this parameter. The others will ignore it.

Definition at line 69 of file SimulationThread.cpp.

bool RTT::SimulationThread::isRunning ( ) const [virtual]

Returns true if thread is running or run( unsigned int ) is being invoked.

Reimplemented from RTT::os::Thread.

Definition at line 103 of file SimulationThread.cpp.

bool RTT::SimulationThread::Release ( ) [static]

Releases the SimulationThread Reference counting might aid in making this call safe

Returns:
true on success, false on failure

Definition at line 79 of file SimulationThread.cpp.

bool RTT::SimulationThread::run ( unsigned int  maxsteps) [virtual]

Execute maxsteps steps immediately. This function will call the step() functions maxsteps times, without requiring start() or stop() to be called before or after. The thread is thus not used.

Returns:
false if maxsteps == 0
Postcondition:
When run() returns, step() has been called maxsteps times.

Definition at line 122 of file SimulationThread.cpp.

Always returns the MainThread.

Definition at line 137 of file SimulationThread.cpp.

bool RTT::SimulationThread::start ( ) [virtual]

Start the Thread.

Postcondition:
initialize() is called first
The Thread is running
Returns:
true if the function did succeed. false otherwise.

Reimplemented from RTT::os::Thread.

Definition at line 108 of file SimulationThread.cpp.

bool RTT::SimulationThread::start ( unsigned int  maxsteps) [virtual]

Only run the simulation maxsteps time steps, then stop the SimulationThread.

Returns:
false if maxsteps == 0 or if thread could not be started.

Definition at line 114 of file SimulationThread.cpp.

void RTT::SimulationThread::step ( ) [protected, virtual]
See also:
base::RunnableInterface::step()

Reimplemented from RTT::extras::TimerThread.

Definition at line 166 of file SimulationThread.cpp.


Member Data Documentation

Our only instance of the SimulationThread

Definition at line 135 of file SimulationThread.hpp.

The System clock.

Definition at line 140 of file SimulationThread.hpp.

Definition at line 142 of file SimulationThread.hpp.

Definition at line 142 of file SimulationThread.hpp.

Definition at line 144 of file SimulationThread.hpp.


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


rtt
Author(s): RTT Developers
autogenerated on Fri Sep 9 2016 04:02:19