Classes

class  ArmarXTimeserver
 simple implementation of the TimeserverInterface More...
 
class  CallbackReceiver
 Used by CallbackWaitLock. More...
 
class  CallbackWaitLock
 CallbackWaitLock is used to block a thread and unblock it from another thread via callback. More...
 
class  LocalTimeServer
 A local time server that gets its time from the MasterTimeServer. More...
 
class  TimeKeeper
 The TimeKeeper class tracks the passing of time and allows to stop it, restart it, and adjust its speed (only used by ArmarXTimeServer). More...
 
class  Timer
 Timer implementation with TimeServer support. More...
 
class  TimeUtil
 provides utility functions for getting the current time More...
 

Macros

#define RT_TIMING_CEND(name, thresholdMs)   RT_TIMING_CEND_COMMENT(name, #name, thresholdMs)
 
#define RT_TIMING_CEND_COMMENT(name, comment, thresholdMs)
 
#define RT_TIMING_END(name)   RT_TIMING_END_COMMENT(name, #name)
 
#define RT_TIMING_END_COMMENT(name, comment)   printf("%s - duration: %.3f ms \n", comment, (armarx::rtNow() - name).toMilliSecondsDouble());
 
#define TIMING_CEND(name, thresholdMs)   TIMING_CEND_COMMENT(name, #name, thresholdMs)
 
#define TIMING_CEND_COMMENT(name, comment, thresholdMs)   if((IceUtil::Time::now()-name).toMilliSecondsDouble() >= thresholdMs) TIMING_END_COMMENT(name, comment)
 
#define TIMING_END(name)   TIMING_END_COMMENT(name, #name)
 
#define TIMING_END_COMMENT(name, comment)   TIMING_END_COMMENT_STREAM(name, comment, ARMARX_INFO)
 
#define TIMING_END_COMMENT_STREAM(name, comment, os)
 
#define TIMING_END_STREAM(name, os)   TIMING_END_COMMENT_STREAM(name, #name, os)
 
#define TIMING_START(name)   auto name = IceUtil::Time::now();
 

Enumerations

enum  TimeMode { SystemTime, VirtualTime }
 Time mode to be used. More...
 

Detailed Description

ArmarX provides the concept of a virtual time which allows components and statecharts to synchronize to time sources other than wall-time/system time. Time sources are defined via the TimeServerInterface wich is implemented by the ArmarXTimeServer application and the simulator from the ArmarXSimulation package. Time itself is represented as IceUtil::Time instances. The "Clock" gui plugin can be used to start, stop, speed up, or slow down the time offered by a TimeServer.

For example, the "Plotter" gui plugin uses virtual time to show all measurements in Simulator time and to pause when the simulation is stopped.

In order to use a TimeServer, one simply has to set the property

ArmarX.UseTimeServer = true

in the $HOME/.armarx.default.cfg or the global.cfg of a scenario. Setting UseTimeServer=false will provide each caller of the ArmarX VirtualTime commands with the system time.

To make your components and statecharts VirtualTime compatible, you have to use the following functions

armarx::PeriodicTask uses system time by default, but can be changed to use TimeServer time by setting the forceSystemTime constructor parameter to false.

Timeouts in statecharts registered with StateUtility::setTimeoutEvent(...) will automatically use TimeServer time when UseTimeServer=true.

Macro Definition Documentation

◆ RT_TIMING_CEND

#define RT_TIMING_CEND (   name,
  thresholdMs 
)    RT_TIMING_CEND_COMMENT(name, #name, thresholdMs)

#include <RobotAPI/components/units/RobotUnit/util/RtTiming.h>

Prints duration if it took longer than thresholdMs

Definition at line 65 of file RtTiming.h.

◆ RT_TIMING_CEND_COMMENT

#define RT_TIMING_CEND_COMMENT (   name,
  comment,
  thresholdMs 
)

#include <RobotAPI/components/units/RobotUnit/util/RtTiming.h>

Value:
if ((armarx::rtNow() - name).toMilliSecondsDouble() >= thresholdMs) \
RT_TIMING_END_COMMENT(name, comment)

Prints duration with comment in front of it if it took longer than threshold

Definition at line 60 of file RtTiming.h.

◆ RT_TIMING_END

#define RT_TIMING_END (   name)    RT_TIMING_END_COMMENT(name, #name)

#include <RobotAPI/components/units/RobotUnit/util/RtTiming.h>

Prints duration

Definition at line 57 of file RtTiming.h.

◆ RT_TIMING_END_COMMENT

#define RT_TIMING_END_COMMENT (   name,
  comment 
)    printf("%s - duration: %.3f ms \n", comment, (armarx::rtNow() - name).toMilliSecondsDouble());

#include <RobotAPI/components/units/RobotUnit/util/RtTiming.h>

Prints duration with comment in front of it, yet only once per second.

Definition at line 53 of file RtTiming.h.

◆ TIMING_CEND

#define TIMING_CEND (   name,
  thresholdMs 
)    TIMING_CEND_COMMENT(name, #name, thresholdMs)

#include <ArmarXCore/core/time/TimeUtil.h>

Prints duration if it took longer than thresholdMs

Definition at line 309 of file TimeUtil.h.

◆ TIMING_CEND_COMMENT

#define TIMING_CEND_COMMENT (   name,
  comment,
  thresholdMs 
)    if((IceUtil::Time::now()-name).toMilliSecondsDouble() >= thresholdMs) TIMING_END_COMMENT(name, comment)

#include <ArmarXCore/core/time/TimeUtil.h>

Prints duration with comment in front of it if it took longer than threshold

Definition at line 305 of file TimeUtil.h.

◆ TIMING_END

#define TIMING_END (   name)    TIMING_END_COMMENT(name, #name)

#include <ArmarXCore/core/time/TimeUtil.h>

Prints duration

Definition at line 296 of file TimeUtil.h.

◆ TIMING_END_COMMENT

#define TIMING_END_COMMENT (   name,
  comment 
)    TIMING_END_COMMENT_STREAM(name, comment, ARMARX_INFO)

#include <ArmarXCore/core/time/TimeUtil.h>

Prints duration with comment in front of it, yet only once per second.

Definition at line 292 of file TimeUtil.h.

◆ TIMING_END_COMMENT_STREAM

#define TIMING_END_COMMENT_STREAM (   name,
  comment,
  os 
)

#include <ArmarXCore/core/time/TimeUtil.h>

Value:
{ \
name = (IceUtil::Time::now() - name); \
os << deactivateSpam(1, comment) << comment << " - duration: " << name.toMilliSecondsDouble() << " ms"; \
}

Prints duration with comment in front of it, yet only once per second.

Definition at line 284 of file TimeUtil.h.

◆ TIMING_END_STREAM

#define TIMING_END_STREAM (   name,
  os 
)    TIMING_END_COMMENT_STREAM(name, #name, os)

#include <ArmarXCore/core/time/TimeUtil.h>

Prints duration

Definition at line 300 of file TimeUtil.h.

◆ TIMING_START

#define TIMING_START (   name)    auto name = IceUtil::Time::now();

#include <ArmarXCore/core/time/TimeUtil.h>

Helper macro to do timing tests. Usage:

TIMING_START(descriptiveName) // create variables with name descriptiveName for later reference
// do your stuff
TIMING_END(descriptiveName) // prints duration with descriptiveName as prefix
TIMING_CEND(descriptiveName, 10) // only printed if takes longer than 10ms

Definition at line 280 of file TimeUtil.h.

Enumeration Type Documentation

◆ TimeMode

enum TimeMode
strong

#include <ArmarXCore/core/time/TimeUtil.h>

Time mode to be used.

SystemTime enforces the local system time, while VirtualTime uses the virtual time provided by the time server.

Enumerator
SystemTime 
VirtualTime 

Definition at line 119 of file TimeUtil.h.

deactivateSpam
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
Definition: Logging.cpp:72
armarx::rtNow
IceUtil::Time rtNow()
Definition: RtTiming.h:40