YANE-Framework 1.1.0
Public Member Functions | Protected Member Functions | Protected Attributes

yane::NetworkedControl::ControllerThreadInput Class Reference

Class for simulating the plant and sensor in a distributed plant - sensor - controller - actuator setting.

Inheritance diagram for yane::NetworkedControl::ControllerThreadInput:
[legend]
Collaboration diagram for yane::NetworkedControl::ControllerThreadInput:
[legend]

List of all members.

Public Member Functions

 ControllerThreadInput (IOInterface *iface, yane::Model::Model *model, yane::Utils::DebugMaster *dm=0, yane::Utils::StatisticsMaster *sm=0)
 Constructor.
virtual void detach ()
 Blocks until thread is finished, no return information.
virtual bool isLocked ()
 Returns if thread is locked.
virtual bool isRunning ()
 Returns if thread is running.
virtual void lock ()
 Locks the thread, if already locked blocks.
void setMPCThread (ControllerThreadMPC *thread)
 Function to set the MPC computing thread.
virtual void start ()
 Creates the thread.
virtual void stop ()
 Stops the thread.
virtual void trigger ()
 Signal / Trigger the thread.
virtual bool trylock ()
 Locks the thread but returns immediately.
virtual void unlock ()
 Unlock the thread.
virtual void wait ()
 Blocks until thread is finished, possible return information.
virtual ~ControllerThreadInput ()
 Destructor.

Protected Member Functions

virtual void debugMessage (const std::string &message, int debuglevel)
 Submit a debugmessage.
virtual void debugMessageDouble (const std::string &message, const std::string &varname, int length, double *data, int debuglevel)
 Submit a debugmessage with doublevalued data.
virtual void debugMessageInt (const std::string &message, const std::string &varname, int length, int *data, int debuglevel)
 Submit a debugmessage with integervalued data.
virtual void debugMessageString (const std::string &message, const std::string &varname, const char *data, int debuglevel)
 Submit a debugmessage with textstring data.
virtual void run ()
 Function to start the sensor thread.
virtual bool waitForTrigger (unsigned int wait_msec=0, int debuglevel=0)
 Block until triggered.

Protected Attributes

bool _abort
ControlClipboard_cb
 Pointer of the control clipboard of class yane::NetworkedControl::ControlClipboard.
DebugClient * _debugclient
yane::Model::StateEstimator_estimator
 Pointer of the state estimator of class yane::Model::StateEstimator.
IOInterface_interface
 Pointer of the network interface of class yane::NetworkedInterface::IOInterface.
int _lastaddedcontrolcycle
 Sampling instant of the latest added control.
yane::Model::Model_model
 Pointer of the model of class yane::Model::Model.
ControllerThreadMPC_mpcthread
 Pointer of the MPC computation thread of class yane::NetworkedControl::ControllerThreadMPC.
yane::Model::Simulator_simulator
 Pointer of the simulator of class yane::Model::Simulator.
yane::Utils::StatisticsClientIntCounter_stat_read
 Statistics collector for received sensor values.

Constructor & Destructor Documentation

yane::NetworkedControl::ControllerThreadInput::ControllerThreadInput ( IOInterface iface,
yane::Model::Model model,
yane::Utils::DebugMaster dm = 0,
yane::Utils::StatisticsMaster sm = 0 
)

Constructor

Parameters:
ifacePointer of the input/output interface of class yane::MPC::IOInterface
modelPointer of the class yane::Model::Model object used for optimization
dmPointer of the debugmanager of class yane::Utils::DebugMaster
smPointer of the statistics manager of class yane::Utils::StatisticsMaster

Member Function Documentation

LIB_EXPORT void yane::Utils::Thread::debugMessage ( const std::string &  message,
int  debuglevel 
) [protected, virtual, inherited]

Added for convenient handling

Parameters:
messageMessage which is debugged
debuglevelLevel with which the message is debugged.
LIB_EXPORT void yane::Utils::Thread::debugMessageDouble ( const std::string &  message,
const std::string &  varname,
int  length,
double *  data,
int  debuglevel 
) [protected, virtual, inherited]

Added for convenient handling

Parameters:
messageMessage which is debugged
varnameData name
lengthLength of data array
dataData which is added.
debuglevelLevel with which the message is debugged.
LIB_EXPORT void yane::Utils::Thread::debugMessageInt ( const std::string &  message,
const std::string &  varname,
int  length,
int *  data,
int  debuglevel 
) [protected, virtual, inherited]

Added for convenient handling

Parameters:
messageMessage which is debugged
varnameData name
lengthLength of data array
dataData which is added.
debuglevelLevel with which the message is debugged.
LIB_EXPORT void yane::Utils::Thread::debugMessageString ( const std::string &  message,
const std::string &  varname,
const char *  data,
int  debuglevel 
) [protected, virtual, inherited]

Added for convenient handling

Parameters:
messageMessage which is debugged
varnameData name
dataPointer to an additional nullterminated character array, that has to be stored as data
debuglevelLevel with which the message is debugged.
LIB_EXPORT void yane::Utils::Thread::detach ( ) [virtual, inherited]

The calling thread is blocked until the thread is finished, no return information

LIB_EXPORT bool yane::Utils::Thread::isLocked ( ) [virtual, inherited]

Returns wether the thread is locked or not.

Returns:
true if thread is locked.
LIB_EXPORT bool yane::Utils::Thread::isRunning ( ) [virtual, inherited]

Returns wether the thread is running (_abort = false) or not.

Returns:
true if thread is running.
LIB_EXPORT void yane::Utils::Thread::lock ( ) [virtual, inherited]

Locks the thread. If already locked the calling thread is blocked until the thread is unlocked.

void yane::NetworkedControl::ControllerThreadInput::setMPCThread ( ControllerThreadMPC thread)

Function to set the MPC computing thread

Parameters:
threadMPC computing thread
LIB_EXPORT void yane::Utils::Thread::start ( ) [virtual, inherited]

This function creates the thread and should be called after creating the object.

LIB_EXPORT void yane::Utils::Thread::stop ( ) [virtual, inherited]

This function sets _abort to false, your thread should stop now.

LIB_EXPORT void yane::Utils::Thread::trigger ( ) [virtual, inherited]

Signal a thread to resume, if it's blocked due to a call to waitForTrigger()

See also:
waitForTrigger()
LIB_EXPORT bool yane::Utils::Thread::trylock ( ) [virtual, inherited]

Locks the thread. If already locked returns immediately.

Returns:
true if successful
LIB_EXPORT void yane::Utils::Thread::unlock ( ) [virtual, inherited]

Unlocks the thread.

LIB_EXPORT void yane::Utils::Thread::wait ( ) [virtual, inherited]

The calling thread is blocked until the thread is finished, possible return information

LIB_EXPORT bool yane::Utils::Thread::waitForTrigger ( unsigned int  wait_msec = 0,
int  debuglevel = 0 
) [protected, virtual, inherited]

The calling function (usually the thread) is blocked until the function is triggered.

Parameters:
wait_msecTime until waiting is aborted.
debuglevelDebuglevel with which the abort message is stored.
Returns:
true if successful

Member Data Documentation

bool yane::Utils::Thread::_abort [protected, inherited]

If true thread should be stopped. Value is changed by stop().

DebugClient* yane::Utils::Thread::_debugclient [protected, inherited]

Debugclient the debug messages are stored into.