Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
uavcan::GlobalTimeSyncMaster Class Reference

#include <global_time_sync_master.hpp>

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

Classes

class  IfaceMaster
 

Public Member Functions

 GlobalTimeSyncMaster (INode &node)
 
int init (const TransferPriority priority=TransferPriority::OneLowerThanHighest)
 
bool isInitialized () const
 
int publish ()
 

Private Member Functions

int getNextTransferID (TransferID &tid)
 
virtual void handleLoopbackFrame (const RxFrame &frame)
 

Private Attributes

DataTypeID dtid_
 
LazyConstructor< IfaceMasteriface_masters_ [MaxCanIfaces]
 
bool initialized_
 
INodenode_
 
MonotonicTime prev_pub_mono_
 

Additional Inherited Members

- Protected Member Functions inherited from uavcan::LoopbackFrameListenerBase
DispatchergetDispatcher ()
 
bool isListening () const
 
 LoopbackFrameListenerBase (Dispatcher &dispatcher)
 
void startListening ()
 
void stopListening ()
 
virtual ~LoopbackFrameListenerBase ()
 
- Protected Member Functions inherited from uavcan::LinkedListNode< LoopbackFrameListenerBase >
 LinkedListNode ()
 
 ~LinkedListNode ()
 
LoopbackFrameListenerBasegetNextListNode () const
 
void setNextListNode (LoopbackFrameListenerBase *node)
 

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 CAN bus TX loopback with both UTC and monotonic timestamping.

Ref. M. Gergeleit, H. Streich - "Implementing a Distributed High-Resolution Real-Time Clock using the CAN-Bus"

TODO: Enforce max one master per node

Definition at line 32 of file global_time_sync_master.hpp.

Constructor & Destructor Documentation

◆ GlobalTimeSyncMaster()

uavcan::GlobalTimeSyncMaster::GlobalTimeSyncMaster ( INode node)
inlineexplicit

Definition at line 143 of file global_time_sync_master.hpp.

Member Function Documentation

◆ getNextTransferID()

int uavcan::GlobalTimeSyncMaster::getNextTransferID ( TransferID tid)
inlineprivate

Definition at line 123 of file global_time_sync_master.hpp.

◆ handleLoopbackFrame()

virtual void uavcan::GlobalTimeSyncMaster::handleLoopbackFrame ( const RxFrame frame)
inlineprivatevirtual

Implements uavcan::LoopbackFrameListenerBase.

Definition at line 104 of file global_time_sync_master.hpp.

◆ init()

int uavcan::GlobalTimeSyncMaster::init ( const TransferPriority  priority = TransferPriority::OneLowerThanHighest)
inline

Merely prepares the class to work, doesn't do anything else. Must be called before the master can be used. Returns negative error code.

Definition at line 154 of file global_time_sync_master.hpp.

◆ isInitialized()

bool uavcan::GlobalTimeSyncMaster::isInitialized ( ) const
inline

Whether the master instance has been initialized.

Definition at line 197 of file global_time_sync_master.hpp.

◆ publish()

int uavcan::GlobalTimeSyncMaster::publish ( )
inline

Publishes one sync message.

Every call to this method hints the master to publish the next sync message once. Exact time will be obtained from the TX loopback timestamp field.

This method shall be called with a proper interval - refer to the time sync message definition for min/max interval values.

Returns negative error code.

Definition at line 210 of file global_time_sync_master.hpp.

Member Data Documentation

◆ dtid_

DataTypeID uavcan::GlobalTimeSyncMaster::dtid_
private

Definition at line 101 of file global_time_sync_master.hpp.

◆ iface_masters_

LazyConstructor<IfaceMaster> uavcan::GlobalTimeSyncMaster::iface_masters_[MaxCanIfaces]
private

Definition at line 99 of file global_time_sync_master.hpp.

◆ initialized_

bool uavcan::GlobalTimeSyncMaster::initialized_
private

Definition at line 102 of file global_time_sync_master.hpp.

◆ node_

INode& uavcan::GlobalTimeSyncMaster::node_
private

Definition at line 98 of file global_time_sync_master.hpp.

◆ prev_pub_mono_

MonotonicTime uavcan::GlobalTimeSyncMaster::prev_pub_mono_
private

Definition at line 100 of file global_time_sync_master.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