#include <SimulationThread.hpp>
Public Member Functions | |
virtual bool | isRunning () const |
virtual bool | run (unsigned int maxsteps) |
virtual os::ThreadInterface * | simthread () |
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::TimeService * | beat |
unsigned int | cursteps |
unsigned int | maxsteps_ |
bool | sim_running |
Static Private Attributes | |
static SimulationThreadPtr | _instance |
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.
Definition at line 64 of file SimulationThread.hpp.
RTT::SimulationThread::~SimulationThread | ( | ) | [virtual] |
Destructor
Definition at line 98 of file SimulationThread.cpp.
RTT::SimulationThread::SimulationThread | ( | double | period | ) | [protected] |
Constructor
Definition at line 86 of file SimulationThread.cpp.
void RTT::SimulationThread::finalize | ( | ) | [protected, virtual] |
Reimplemented from RTT::extras::TimerThread.
Definition at line 155 of file SimulationThread.cpp.
bool RTT::SimulationThread::initialize | ( | ) | [protected, virtual] |
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.
period | The 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
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.
Definition at line 122 of file SimulationThread.cpp.
os::ThreadInterface * RTT::SimulationThread::simthread | ( | ) | [virtual] |
Always returns the MainThread.
Definition at line 137 of file SimulationThread.cpp.
bool RTT::SimulationThread::start | ( | ) | [virtual] |
Start the Thread.
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.
Definition at line 114 of file SimulationThread.cpp.
void RTT::SimulationThread::step | ( | ) | [protected, virtual] |
Reimplemented from RTT::extras::TimerThread.
Definition at line 166 of file SimulationThread.cpp.
SimulationThreadPtr RTT::SimulationThread::_instance [static, private] |
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.
unsigned int RTT::extras::SimulationThread::cursteps [private] |
Definition at line 142 of file SimulationThread.hpp.
unsigned int RTT::extras::SimulationThread::maxsteps_ [private] |
Definition at line 142 of file SimulationThread.hpp.
bool RTT::extras::SimulationThread::sim_running [private] |
Definition at line 144 of file SimulationThread.hpp.