Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
uavcan::GlobalTimeSyncSlave Class Reference

#include <global_time_sync_slave.hpp>

Inheritance diagram for uavcan::GlobalTimeSyncSlave:
Inheritance graph
[legend]

Public Member Functions

MonotonicTime getLastAdjustmentTime () const
 
NodeID getMasterNodeID () const
 
 GlobalTimeSyncSlave (INode &node)
 
bool isActive () const
 
bool isSuppressed () const
 
int start ()
 
void suppress (bool suppressed)
 

Private Types

typedef MethodBinder< GlobalTimeSyncSlave *, void(GlobalTimeSyncSlave::*)(const ReceivedDataStructure< protocol::GlobalTimeSync > &)> GlobalTimeSyncCallback
 
enum  State { Update, Adjust }
 

Private Member Functions

void adjustFromMsg (const ReceivedDataStructure< protocol::GlobalTimeSync > &msg)
 
ISystemClockgetSystemClock () const
 
void handleGlobalTimeSync (const ReceivedDataStructure< protocol::GlobalTimeSync > &msg)
 
void processMsg (const ReceivedDataStructure< protocol::GlobalTimeSync > &msg)
 
void updateFromMsg (const ReceivedDataStructure< protocol::GlobalTimeSync > &msg)
 
- Private Member Functions inherited from uavcan::Noncopyable
 Noncopyable ()
 
 ~Noncopyable ()
 

Private Attributes

MonotonicTime last_adjustment_ts_
 
NodeID master_nid_
 
uint8_t prev_iface_index_
 
TransferID prev_tid_
 
MonotonicTime prev_ts_mono_
 
UtcTime prev_ts_utc_
 
enum uavcan::GlobalTimeSyncSlave::State state_
 
Subscriber< protocol::GlobalTimeSync, GlobalTimeSyncCallbacksub_
 
bool suppressed_
 

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 Typedef Documentation

◆ GlobalTimeSyncCallback

typedef MethodBinder<GlobalTimeSyncSlave*, void (GlobalTimeSyncSlave::*)(const ReceivedDataStructure<protocol::GlobalTimeSync>&)> uavcan::GlobalTimeSyncSlave::GlobalTimeSyncCallback
private

Definition at line 32 of file global_time_sync_slave.hpp.

Member Enumeration Documentation

◆ State

Enumerator
Update 
Adjust 

Definition at line 39 of file global_time_sync_slave.hpp.

Constructor & Destructor Documentation

◆ GlobalTimeSyncSlave()

uavcan::GlobalTimeSyncSlave::GlobalTimeSyncSlave ( INode node)
inlineexplicit

Definition at line 137 of file global_time_sync_slave.hpp.

Member Function Documentation

◆ adjustFromMsg()

void uavcan::GlobalTimeSyncSlave::adjustFromMsg ( const ReceivedDataStructure< protocol::GlobalTimeSync > &  msg)
inlineprivate

Definition at line 47 of file global_time_sync_slave.hpp.

◆ getLastAdjustmentTime()

MonotonicTime uavcan::GlobalTimeSyncSlave::getLastAdjustmentTime ( ) const
inline

Last time when the local clock adjustment was performed.

Definition at line 193 of file global_time_sync_slave.hpp.

◆ getMasterNodeID()

NodeID uavcan::GlobalTimeSyncSlave::getMasterNodeID ( ) const
inline

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.

◆ getSystemClock()

ISystemClock& uavcan::GlobalTimeSyncSlave::getSystemClock ( ) const
inlineprivate

Definition at line 45 of file global_time_sync_slave.hpp.

◆ handleGlobalTimeSync()

void uavcan::GlobalTimeSyncSlave::handleGlobalTimeSync ( const ReceivedDataStructure< protocol::GlobalTimeSync > &  msg)
inlineprivate

Definition at line 124 of file global_time_sync_slave.hpp.

◆ isActive()

bool uavcan::GlobalTimeSyncSlave::isActive ( ) const
inline

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.

◆ isSuppressed()

bool uavcan::GlobalTimeSyncSlave::isSuppressed ( ) const
inline

Definition at line 169 of file global_time_sync_slave.hpp.

◆ processMsg()

void uavcan::GlobalTimeSyncSlave::processMsg ( const ReceivedDataStructure< protocol::GlobalTimeSync > &  msg)
inlineprivate

Definition at line 77 of file global_time_sync_slave.hpp.

◆ start()

int uavcan::GlobalTimeSyncSlave::start ( )
inline

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.

◆ suppress()

void uavcan::GlobalTimeSyncSlave::suppress ( bool  suppressed)
inline

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.

◆ updateFromMsg()

void uavcan::GlobalTimeSyncSlave::updateFromMsg ( const ReceivedDataStructure< protocol::GlobalTimeSync > &  msg)
inlineprivate

Definition at line 64 of file global_time_sync_slave.hpp.

Member Data Documentation

◆ last_adjustment_ts_

MonotonicTime uavcan::GlobalTimeSyncSlave::last_adjustment_ts_
private

Definition at line 38 of file global_time_sync_slave.hpp.

◆ master_nid_

NodeID uavcan::GlobalTimeSyncSlave::master_nid_
private

Definition at line 40 of file global_time_sync_slave.hpp.

◆ prev_iface_index_

uint8_t uavcan::GlobalTimeSyncSlave::prev_iface_index_
private

Definition at line 42 of file global_time_sync_slave.hpp.

◆ prev_tid_

TransferID uavcan::GlobalTimeSyncSlave::prev_tid_
private

Definition at line 41 of file global_time_sync_slave.hpp.

◆ prev_ts_mono_

MonotonicTime uavcan::GlobalTimeSyncSlave::prev_ts_mono_
private

Definition at line 37 of file global_time_sync_slave.hpp.

◆ prev_ts_utc_

UtcTime uavcan::GlobalTimeSyncSlave::prev_ts_utc_
private

Definition at line 36 of file global_time_sync_slave.hpp.

◆ state_

enum uavcan::GlobalTimeSyncSlave::State uavcan::GlobalTimeSyncSlave::state_
private

◆ sub_

Subscriber<protocol::GlobalTimeSync, GlobalTimeSyncCallback> uavcan::GlobalTimeSyncSlave::sub_
private

Definition at line 34 of file global_time_sync_slave.hpp.

◆ suppressed_

bool uavcan::GlobalTimeSyncSlave::suppressed_
private

Definition at line 43 of file global_time_sync_slave.hpp.


The documentation for this class was generated from the following file:


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:04