Руслан Урядинский / libuavcan

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

GlobalTimeSyncSlave Class Reference

GlobalTimeSyncSlave Class Reference

Please read the specs to learn how the time synchronization works. More...

#include <global_time_sync_slave.hpp>

Inherits uavcan::Noncopyable.

Public Member Functions

int start ()
 Starts the time sync slave.
void suppress (bool suppressed)
 Enable or disable the suppressed mode.
bool isActive () const
 If the clock sync slave sees any clock sync masters in the network, it is ACTIVE.
NodeID getMasterNodeID () const
 Node ID of the master the slave is currently locked on.
MonotonicTime getLastAdjustmentTime () const
 Last time when the local clock adjustment was performed.

Detailed Description

Please read the specs to learn how the time synchronization works.

No more than one object of this class is allowed per node; otherwise a disaster is bound to happen.

NOTE: In order for this class to work, the platform driver must implement:

Ref. M. Gergeleit, H. Streich - "Implementing a Distributed High-Resolution Real-Time Clock using the CAN-Bus" http://modecs.cs.uni-salzburg.at/results/related_documents/CAN_clock.pdf

Definition at line 28 of file global_time_sync_slave.hpp.


Member Function Documentation

MonotonicTime getLastAdjustmentTime (  ) const

Last time when the local clock adjustment was performed.

Definition at line 193 of file global_time_sync_slave.hpp.

NodeID getMasterNodeID (  ) const

Node ID of the master the slave is currently locked on.

Returns an invalid Node ID if there's no active master.

Definition at line 188 of file global_time_sync_slave.hpp.

bool isActive (  ) const

If the clock sync slave sees any clock sync masters in the network, it is ACTIVE.

When the last master times out (PUBLISHER_TIMEOUT), the slave will be INACTIVE. Note that immediately after start up the slave will be INACTIVE until it finds a master. Please read the specs to learn more.

Definition at line 177 of file global_time_sync_slave.hpp.

int start (  )

Starts the time sync slave.

Once started, it works on its own and does not require any attention from the application, other than to handle a clock adjustment request occasionally. Returns negative error code.

Definition at line 149 of file global_time_sync_slave.hpp.

void suppress ( bool  suppressed )

Enable or disable the suppressed mode.

In suppressed mode the slave will continue tracking time sync masters in the network, but will not perform local clock adjustments. So it's kind of a dry run - all the time sync logic works except the local clock will not receive adjustments.

Suppressed mode is useful for nodes that can act as a back-up clock sync masters - as long as the node sees a higher priority time sync master in the network, its slave will be NOT suppressed in order to sync the local clock with the global master. As soon as all other higher priority masters go down, the local node will suppress its time sync slave instance and become a new master.

Suppressed mode is disabled by default.

Definition at line 168 of file global_time_sync_slave.hpp.