|
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
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
IceUtile::Time::now()
with armarx::TimeUtil::GetTime()
to get the current time. sleep()
and usleep()
with armarx::TimeUtil::Sleep()
and armarx::TimeUtil::MSSleep()
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
.