Fawkes API  Fawkes Development Version
fawkes::BlockedTimingAspect Class Reference

Thread aspect to use blocked timing. More...

#include <>>

Inherits fawkes::SyncPointAspect.

Inherited by AgentControlThread, AmclThread, BallPosLogThread, BBLogReplayBlockedTimingThread, Bumblebee2Thread, CedarThread, ClipsAgentThread, ClipsExecutiveThread, ColliActThread, DepthcamSimThread, DynamixelSensorThread, ExampleBlackBoardThread, ExampleThread, FvBaseThread, GazeboNodeThread, GazsimCommThread, GazsimTimesourceThread, GossipExampleReceiverThread, GossipExampleSenderThread, IMUSensorThread, JacoActThread, JacoBimanualActThread, JacoInfoThread, JoystickActThread, JoystickSensorThread, JoystickTeleOpThread, KatanaActThread, KatanaSensorThread, LaserClusterThread, LaserFilterThread, LaserLinesThread, LaserPointCloudThread, LaserSensorThread, LaserSimThread, LocalizationSimThread, LuaAgentContinuousExecutionThread, LuaAgentPeriodicExecutionThread, MapLaserGenThread, MetricsThread, NaoQiButtonThread, NaoQiDCMThread, NaoQiLedThread, NaoQiMotionThread, NaoQiSpeechSynthThread, NavGraphThread, NavGraphVisualizationThread, OpenNiContextThread, OpenNiDepthThread, OpenNiHandTrackerThread, OpenNiImageThread, OpenNiPclOnlyThread, OpenNiPointCloudThread, OpenNiUserTrackerThread, OpenPRSAgentThread, OpenPRSExampleThread, OpenPRSThread, OpenRaveMessageHandlerThread, OpenraveRobotMemoryThread, OpenRaveThread, PanTiltActThread, PanTiltSensorThread, PlayerClientThread, PlayerF2PThread, PlayerPostSyncThread, PlayerTimeSyncThread, PointCloudDBROSCommThread, Realsense2Thread, RealsenseThread, RefBoxCommThread, RobotinoActThread, RobotinoIrPclThread, RobotinoRosJointsThread, RobotinoSensorThread, RobotinoSimThread, RobotMemoryTestThread, RobotStatePublisherThread, Roomba500Thread, RoombaJoystickThread, RoombaSensorThread, RosDynamicReconfigureThread, RosImagesThread, RosLaserScanThread, RosMoveBaseThread, RosNavgraphBreakoutThread, RosNavigatorThread, ROSNodeThread, ROSOdometryThread, RosPointCloudThread, RosSkillerThread, ROSTalkerPubThread, RosTfThread, RRDExampleThread, SkillerExecutionThread, SkillerSimulatorExecutionThread, SyncPointTestThread, TfExampleThread, VisLocalizationThread, WebcamSimThread, and XabslEngineThread.

Public Types

enum  WakeupHook {
  WAKEUP_HOOK_PRE_LOOP, WAKEUP_HOOK_SENSOR_ACQUIRE, WAKEUP_HOOK_SENSOR_PREPARE, WAKEUP_HOOK_SENSOR_PROCESS,
  WAKEUP_HOOK_WORLDSTATE, WAKEUP_HOOK_THINK, WAKEUP_HOOK_SKILL, WAKEUP_HOOK_ACT,
  WAKEUP_HOOK_ACT_EXEC, WAKEUP_HOOK_POST_LOOP
}
 Type to define at which hook the thread is woken up. More...
 

Public Member Functions

 BlockedTimingAspect (WakeupHook wakeup_hook)
 Constructor. More...
 
virtual ~BlockedTimingAspect ()
 Virtual empty destructor. More...
 
void init_BlockedTimingAspect (Thread *thread)
 Init BlockedTiming aspect. More...
 
void finalize_BlockedTimingAspect (Thread *thread)
 Finalize BlockedTiming aspect. More...
 
WakeupHook blockedTimingAspectHook () const
 Get the wakeup hook. More...
 
- Public Member Functions inherited from fawkes::SyncPointAspect
 SyncPointAspect (SyncPoint::WakeupType type_in, std::string identifier_in, std::string identifier_out="")
 Constructor. More...
 
 SyncPointAspect (std::string out_identifier)
 Constructor. More...
 
virtual ~SyncPointAspect ()
 Destructor. More...
 
void init_SyncPointAspect (Thread *thread, SyncPointManager *syncpoint_manager)
 Init SyncPoint aspect. More...
 
void finalize_SyncPointAspect (Thread *thread, SyncPointManager *syncpoint_manager)
 Finalize SyncPoint aspect. More...
 
void pre_loop (Thread *thread)
 Wait for the input syncpoint before loop() More...
 
void post_loop (Thread *thread)
 Emit the output syncpoint after loop() More...
 
- Public Member Functions inherited from fawkes::Aspect
const std::list< const char * > & get_aspects () const
 Get list of aspect names attached to a aspected thread. More...
 
- Public Member Functions inherited from fawkes::ThreadLoopListener
virtual ~ThreadLoopListener ()
 Virtual empty destructor. More...
 

Static Public Member Functions

static const char * blocked_timing_hook_to_string (WakeupHook hook)
 Get string for wakeup hook. More...
 
static std::string blocked_timing_hook_to_start_syncpoint (WakeupHook hook)
 Get the syncpoint identifier corresponding to the start of a wakeup hook. More...
 
static std::string blocked_timing_hook_to_end_syncpoint (WakeupHook hook)
 Get the syncpoint identifier corresponding to the end of a wakeup hook. More...
 

Static Public Attributes

static const std::map< const WakeupHook, const std::string > hook_to_syncpoint
 Translation from WakeupHooks to SyncPoints. More...
 

Additional Inherited Members

- Protected Member Functions inherited from fawkes::Aspect
void add_aspect (const char *name)
 Add an aspect to a thread. More...
 

Detailed Description

Thread aspect to use blocked timing.

The Fawkes main application provides basic means to synchronize all running thread with respect to several given hooks (see WakeupHook). Threads of a woken up at a particular point in time. The hooks basically correspond to an extended sense - plan - act kind of loop. Your thread must run in Thread::OPMODE_WAITFORWAKEUP mode, otherwise it is not started. This is a requirement for having the BlockedTimingAspect.

See also
Thread::OpMode
Author
Tim Niemueller

Definition at line 50 of file blocked_timing.h.

Member Enumeration Documentation

◆ WakeupHook

Type to define at which hook the thread is woken up.

See FawkesMainThread for information when and in which order the hooks are called.

See also
FawkesMainThread::loop()
Enumerator
WAKEUP_HOOK_PRE_LOOP 

before each loop

WAKEUP_HOOK_SENSOR_ACQUIRE 

sensor acquisition thread, acquire data from sensor

WAKEUP_HOOK_SENSOR_PREPARE 

sensor data preparation thread, convert acquired data to usable format

WAKEUP_HOOK_SENSOR_PROCESS 

sensor data processing thread

WAKEUP_HOOK_WORLDSTATE 

world state thread

WAKEUP_HOOK_THINK 

think thread (agent)

WAKEUP_HOOK_SKILL 

skill thread (skill module)

WAKEUP_HOOK_ACT 

act thread (motor module etc.)

WAKEUP_HOOK_ACT_EXEC 

act execution thread

WAKEUP_HOOK_POST_LOOP 

run after loop

Definition at line 58 of file blocked_timing.h.

Constructor & Destructor Documentation

◆ BlockedTimingAspect()

fawkes::BlockedTimingAspect::BlockedTimingAspect ( WakeupHook  wakeup_hook)

Constructor.

This special constructor is needed to define the wakeup point.

Parameters
wakeup_hookhook when this thread should be woken up

Definition at line 53 of file blocked_timing.cpp.

References fawkes::Aspect::add_aspect().

◆ ~BlockedTimingAspect()

fawkes::BlockedTimingAspect::~BlockedTimingAspect ( )
virtual

Virtual empty destructor.

Definition at line 64 of file blocked_timing.cpp.

Member Function Documentation

◆ blocked_timing_hook_to_end_syncpoint()

std::string fawkes::BlockedTimingAspect::blocked_timing_hook_to_end_syncpoint ( WakeupHook  hook)
static

Get the syncpoint identifier corresponding to the end of a wakeup hook.

This is the syncpoint emitted at the end of a hook.

Parameters
hookwakeup hook to get the syncpoint identifier for
Returns
the identifier of the corresponding syncpoint

Definition at line 141 of file blocked_timing.cpp.

References hook_to_syncpoint.

Referenced by fawkes::FawkesMainThread::once().

◆ blocked_timing_hook_to_start_syncpoint()

std::string fawkes::BlockedTimingAspect::blocked_timing_hook_to_start_syncpoint ( WakeupHook  hook)
static

Get the syncpoint identifier corresponding to the start of a wakeup hook.

This is the syncpoint waited for at the start of a hook.

Parameters
hookwakeup hook to get the syncpoint identifier for
Returns
the identifier of the corresponding syncpoint

Definition at line 156 of file blocked_timing.cpp.

References hook_to_syncpoint.

Referenced by fawkes::FawkesMainThread::once().

◆ blocked_timing_hook_to_string()

const char * fawkes::BlockedTimingAspect::blocked_timing_hook_to_string ( WakeupHook  hook)
static

Get string for wakeup hook.

Parameters
hookwakeup hook to get string for
Returns
string representation of hook

Definition at line 106 of file blocked_timing.cpp.

References WAKEUP_HOOK_ACT, WAKEUP_HOOK_ACT_EXEC, WAKEUP_HOOK_POST_LOOP, WAKEUP_HOOK_PRE_LOOP, WAKEUP_HOOK_SENSOR_ACQUIRE, WAKEUP_HOOK_SENSOR_PREPARE, WAKEUP_HOOK_SENSOR_PROCESS, WAKEUP_HOOK_SKILL, WAKEUP_HOOK_THINK, and WAKEUP_HOOK_WORLDSTATE.

Referenced by SyncPointTestPlugin::SyncPointTestPlugin().

◆ blockedTimingAspectHook()

BlockedTimingAspect::WakeupHook fawkes::BlockedTimingAspect::blockedTimingAspectHook ( ) const

Get the wakeup hook.

The wakeup hook defines when this thread should be woken up. This heavily depends on the used main thread.

Returns
wakeup hook

Definition at line 96 of file blocked_timing.cpp.

◆ finalize_BlockedTimingAspect()

void fawkes::BlockedTimingAspect::finalize_BlockedTimingAspect ( Thread thread)

Finalize BlockedTiming aspect.

This finalizes the aspect and removes the loop listener from the thread.

Parameters
threadthread which uses this aspect

Definition at line 85 of file blocked_timing.cpp.

References fawkes::Thread::remove_loop_listener().

Referenced by fawkes::BlockedTimingAspectIniFin::finalize().

◆ init_BlockedTimingAspect()

void fawkes::BlockedTimingAspect::init_BlockedTimingAspect ( Thread thread)

Init BlockedTiming aspect.

This intializes the aspect and adds the loop listener to the thread.

Parameters
threadthread which uses this aspect

Definition at line 74 of file blocked_timing.cpp.

References fawkes::Thread::add_loop_listener(), and fawkes::Thread::wakeup().

Referenced by fawkes::BlockedTimingAspectIniFin::init().

Member Data Documentation

◆ hook_to_syncpoint

const std::map< const BlockedTimingAspect::WakeupHook, const std::string > fawkes::BlockedTimingAspect::hook_to_syncpoint
static
Initial value:
= {{WAKEUP_HOOK_PRE_LOOP, "/preloop"},
{WAKEUP_HOOK_SENSOR_ACQUIRE, "/sensors/acquire"},
{WAKEUP_HOOK_SENSOR_PREPARE, "/sensors/prepare"},
{WAKEUP_HOOK_SENSOR_PROCESS, "/sensors/process"},
{WAKEUP_HOOK_WORLDSTATE, "/worldstate"},
{WAKEUP_HOOK_THINK, "/agent"},
{WAKEUP_HOOK_SKILL, "/skill"},
{WAKEUP_HOOK_ACT, "/act/main"},
{WAKEUP_HOOK_ACT_EXEC, "/act/exec"},
{WAKEUP_HOOK_POST_LOOP, "/postloop"}}

Translation from WakeupHooks to SyncPoints.

Each WakeupHook corresponds to exactly one SyncPoint, e.g., WAKEUP_HOOK_PRE_LOOP becomes /preloop.

Definition at line 89 of file blocked_timing.h.

Referenced by blocked_timing_hook_to_end_syncpoint(), and blocked_timing_hook_to_start_syncpoint().


The documentation for this class was generated from the following files:
fawkes::BlockedTimingAspect::WAKEUP_HOOK_WORLDSTATE
@ WAKEUP_HOOK_WORLDSTATE
world state thread
Definition: blocked_timing.h:65
fawkes::BlockedTimingAspect::WAKEUP_HOOK_SENSOR_PREPARE
@ WAKEUP_HOOK_SENSOR_PREPARE
sensor data preparation thread, convert acquired data to usable format
Definition: blocked_timing.h:62
fawkes::BlockedTimingAspect::WAKEUP_HOOK_THINK
@ WAKEUP_HOOK_THINK
think thread (agent)
Definition: blocked_timing.h:66
fawkes::BlockedTimingAspect::WAKEUP_HOOK_SENSOR_PROCESS
@ WAKEUP_HOOK_SENSOR_PROCESS
sensor data processing thread
Definition: blocked_timing.h:64
fawkes::BlockedTimingAspect::WAKEUP_HOOK_ACT_EXEC
@ WAKEUP_HOOK_ACT_EXEC
act execution thread
Definition: blocked_timing.h:69
fawkes::BlockedTimingAspect::WAKEUP_HOOK_PRE_LOOP
@ WAKEUP_HOOK_PRE_LOOP
before each loop
Definition: blocked_timing.h:59
fawkes::BlockedTimingAspect::WAKEUP_HOOK_ACT
@ WAKEUP_HOOK_ACT
act thread (motor module etc.)
Definition: blocked_timing.h:68
fawkes::BlockedTimingAspect::WAKEUP_HOOK_POST_LOOP
@ WAKEUP_HOOK_POST_LOOP
run after loop
Definition: blocked_timing.h:70
fawkes::BlockedTimingAspect::WAKEUP_HOOK_SKILL
@ WAKEUP_HOOK_SKILL
skill thread (skill module)
Definition: blocked_timing.h:67
fawkes::BlockedTimingAspect::WAKEUP_HOOK_SENSOR_ACQUIRE
@ WAKEUP_HOOK_SENSOR_ACQUIRE
sensor acquisition thread, acquire data from sensor
Definition: blocked_timing.h:60