PX4 Firmware
PX4 Autopilot Software http://px4.io
UavcanGnssBridge Class Reference

#include <gnss.hpp>

Inheritance diagram for UavcanGnssBridge:
Collaboration diagram for UavcanGnssBridge:

Public Member Functions

 UavcanGnssBridge (uavcan::INode &node)
 
 ~UavcanGnssBridge ()=default
 
const char * get_name () const override
 Returns ASCII name of the bridge. More...
 
int init () override
 Starts the bridge. More...
 
unsigned get_num_redundant_channels () const override
 Returns number of active redundancy channels. More...
 
void print_status () const override
 Prints current status in a human readable format to stdout. More...
 
- Public Member Functions inherited from IUavcanSensorBridge
virtual ~IUavcanSensorBridge ()=default
 
- Public Member Functions inherited from ListNode< IUavcanSensorBridge *>
void setSibling (IUavcanSensorBridge * sibling)
 
const IUavcanSensorBridgegetSibling () const
 

Static Public Attributes

static const char *const NAME = "gnss"
 
- Static Public Attributes inherited from IUavcanSensorBridge
static constexpr unsigned MAX_NAME_LEN = 20
 

Private Types

typedef uavcan::MethodBinder< UavcanGnssBridge *, void(UavcanGnssBridge::*)(const uavcan::ReceivedDataStructure< uavcan::equipment::gnss::Auxiliary > &) > AuxiliaryCbBinder
 
typedef uavcan::MethodBinder< UavcanGnssBridge *, void(UavcanGnssBridge::*)(const uavcan::ReceivedDataStructure< uavcan::equipment::gnss::Fix > &) > FixCbBinder
 
typedef uavcan::MethodBinder< UavcanGnssBridge *, void(UavcanGnssBridge::*)(const uavcan::ReceivedDataStructure< uavcan::equipment::gnss::Fix2 > &) > Fix2CbBinder
 
typedef uavcan::MethodBinder< UavcanGnssBridge *, void(UavcanGnssBridge::*)(const uavcan::TimerEvent &)> TimerCbBinder
 

Private Member Functions

void gnss_auxiliary_sub_cb (const uavcan::ReceivedDataStructure< uavcan::equipment::gnss::Auxiliary > &msg)
 GNSS fix message will be reported via this callback. More...
 
void gnss_fix_sub_cb (const uavcan::ReceivedDataStructure< uavcan::equipment::gnss::Fix > &msg)
 
void gnss_fix2_sub_cb (const uavcan::ReceivedDataStructure< uavcan::equipment::gnss::Fix2 > &msg)
 
template<typename FixType >
void process_fixx (const uavcan::ReceivedDataStructure< FixType > &msg, const float(&pos_cov)[9], const float(&vel_cov)[9], const bool valid_pos_cov, const bool valid_vel_cov)
 
void broadcast_from_orb (const uavcan::TimerEvent &)
 

Private Attributes

uavcan::INode & _node
 
uavcan::Subscriber< uavcan::equipment::gnss::Auxiliary, AuxiliaryCbBinder_sub_auxiliary
 
uavcan::Subscriber< uavcan::equipment::gnss::Fix, FixCbBinder_sub_fix
 
uavcan::Subscriber< uavcan::equipment::gnss::Fix2, Fix2CbBinder_sub_fix2
 
uavcan::Publisher< uavcan::equipment::gnss::Fix2 > _pub_fix2
 
uavcan::TimerEventForwarder< TimerCbBinder_orb_to_uavcan_pub_timer
 
uint64_t _last_gnss_auxiliary_timestamp {0}
 
float _last_gnss_auxiliary_hdop {0.0f}
 
float _last_gnss_auxiliary_vdop {0.0f}
 
uORB::PublicationMulti< vehicle_gps_position_s_gps_pub {ORB_ID(vehicle_gps_position), ORB_PRIO_DEFAULT}
 
uORB::Subscription _orb_sub_gnss {ORB_ID(vehicle_gps_position)}
 
int _receiver_node_id {-1}
 
bool _old_fix_subscriber_active {true}
 
bool _system_clock_set {false}
 Have we set the system clock at least once from GNSS data? More...
 

Static Private Attributes

static constexpr unsigned ORB_TO_UAVCAN_FREQUENCY_HZ = 10
 

Additional Inherited Members

- Static Public Member Functions inherited from IUavcanSensorBridge
static void make_all (uavcan::INode &node, List< IUavcanSensorBridge *> &list)
 Sensor bridge factory. More...
 
- Protected Attributes inherited from ListNode< IUavcanSensorBridge *>
IUavcanSensorBridge_list_node_sibling
 

Detailed Description

Definition at line 58 of file gnss.hpp.

Member Typedef Documentation

◆ AuxiliaryCbBinder

typedef uavcan::MethodBinder< UavcanGnssBridge *, void (UavcanGnssBridge::*)(const uavcan::ReceivedDataStructure<uavcan::equipment::gnss::Auxiliary> &) > UavcanGnssBridge::AuxiliaryCbBinder
private

Definition at line 93 of file gnss.hpp.

◆ Fix2CbBinder

typedef uavcan::MethodBinder< UavcanGnssBridge *, void (UavcanGnssBridge::*)(const uavcan::ReceivedDataStructure<uavcan::equipment::gnss::Fix2> &) > UavcanGnssBridge::Fix2CbBinder
private

Definition at line 101 of file gnss.hpp.

◆ FixCbBinder

typedef uavcan::MethodBinder< UavcanGnssBridge *, void (UavcanGnssBridge::*)(const uavcan::ReceivedDataStructure<uavcan::equipment::gnss::Fix> &) > UavcanGnssBridge::FixCbBinder
private

Definition at line 97 of file gnss.hpp.

◆ TimerCbBinder

typedef uavcan::MethodBinder<UavcanGnssBridge *, void (UavcanGnssBridge::*)(const uavcan::TimerEvent &)> UavcanGnssBridge::TimerCbBinder
private

Definition at line 105 of file gnss.hpp.

Constructor & Destructor Documentation

◆ UavcanGnssBridge()

UavcanGnssBridge::UavcanGnssBridge ( uavcan::INode &  node)

Definition at line 54 of file gnss.cpp.

◆ ~UavcanGnssBridge()

UavcanGnssBridge::~UavcanGnssBridge ( )
default

Member Function Documentation

◆ broadcast_from_orb()

void UavcanGnssBridge::broadcast_from_orb ( const uavcan::TimerEvent &  )
private

Definition at line 414 of file gnss.cpp.

References _orb_sub_gnss, _pub_fix2, msg, and uORB::Subscription::update().

Referenced by get_name().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_name()

const char* UavcanGnssBridge::get_name ( ) const
inlineoverridevirtual

Returns ASCII name of the bridge.

Implements IUavcanSensorBridge.

Definition at line 68 of file gnss.hpp.

References broadcast_from_orb(), get_num_redundant_channels(), gnss_auxiliary_sub_cb(), gnss_fix2_sub_cb(), gnss_fix_sub_cb(), init(), msg, NAME, print_status(), and process_fixx().

Here is the call graph for this function:

◆ get_num_redundant_channels()

unsigned UavcanGnssBridge::get_num_redundant_channels ( ) const
overridevirtual

Returns number of active redundancy channels.

Implements IUavcanSensorBridge.

Definition at line 101 of file gnss.cpp.

References _receiver_node_id.

Referenced by get_name().

Here is the caller graph for this function:

◆ gnss_auxiliary_sub_cb()

void UavcanGnssBridge::gnss_auxiliary_sub_cb ( const uavcan::ReceivedDataStructure< uavcan::equipment::gnss::Auxiliary > &  msg)
private

GNSS fix message will be reported via this callback.

Definition at line 121 of file gnss.cpp.

References _last_gnss_auxiliary_hdop, _last_gnss_auxiliary_timestamp, _last_gnss_auxiliary_vdop, and hrt_absolute_time().

Referenced by get_name(), and init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gnss_fix2_sub_cb()

void UavcanGnssBridge::gnss_fix2_sub_cb ( const uavcan::ReceivedDataStructure< uavcan::equipment::gnss::Fix2 > &  msg)
private

Definition at line 145 of file gnss.cpp.

References _old_fix_subscriber_active, _receiver_node_id, _sub_fix, and process_fixx().

Referenced by get_name(), and init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gnss_fix_sub_cb()

void UavcanGnssBridge::gnss_fix_sub_cb ( const uavcan::ReceivedDataStructure< uavcan::equipment::gnss::Fix > &  msg)
private

Definition at line 130 of file gnss.cpp.

References process_fixx().

Referenced by get_name(), and init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

int UavcanGnssBridge::init ( )
overridevirtual

Starts the bridge.

Returns
Non-negative value on success, negative on error.

Implements IUavcanSensorBridge.

Definition at line 65 of file gnss.cpp.

References _orb_to_uavcan_pub_timer, _pub_fix2, _sub_auxiliary, _sub_fix, _sub_fix2, gnss_auxiliary_sub_cb(), gnss_fix2_sub_cb(), gnss_fix_sub_cb(), and ORB_TO_UAVCAN_FREQUENCY_HZ.

Referenced by get_name().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_status()

void UavcanGnssBridge::print_status ( ) const
overridevirtual

Prints current status in a human readable format to stdout.

Implements IUavcanSensorBridge.

Definition at line 107 of file gnss.cpp.

References _old_fix_subscriber_active, _receiver_node_id, and _sub_fix.

Referenced by get_name().

Here is the caller graph for this function:

◆ process_fixx()

template<typename FixType >
void UavcanGnssBridge::process_fixx ( const uavcan::ReceivedDataStructure< FixType > &  msg,
const float(&)  pos_cov[9],
const float(&)  vel_cov[9],
const bool  valid_pos_cov,
const bool  valid_vel_cov 
)
private

Definition at line 262 of file gnss.cpp.

References _gps_pub, _last_gnss_auxiliary_hdop, _last_gnss_auxiliary_timestamp, _last_gnss_auxiliary_vdop, _orb_to_uavcan_pub_timer, _receiver_node_id, _system_clock_set, hrt_absolute_time(), hrt_elapsed_time(), math::max(), uORB::PublicationMulti< T >::publish(), and vehicle_gps_position_s::timestamp.

Referenced by get_name(), gnss_fix2_sub_cb(), and gnss_fix_sub_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _gps_pub

uORB::PublicationMulti<vehicle_gps_position_s> UavcanGnssBridge::_gps_pub {ORB_ID(vehicle_gps_position), ORB_PRIO_DEFAULT}
private

Definition at line 121 of file gnss.hpp.

Referenced by process_fixx().

◆ _last_gnss_auxiliary_hdop

float UavcanGnssBridge::_last_gnss_auxiliary_hdop {0.0f}
private

Definition at line 118 of file gnss.hpp.

Referenced by gnss_auxiliary_sub_cb(), and process_fixx().

◆ _last_gnss_auxiliary_timestamp

uint64_t UavcanGnssBridge::_last_gnss_auxiliary_timestamp {0}
private

Definition at line 117 of file gnss.hpp.

Referenced by gnss_auxiliary_sub_cb(), and process_fixx().

◆ _last_gnss_auxiliary_vdop

float UavcanGnssBridge::_last_gnss_auxiliary_vdop {0.0f}
private

Definition at line 119 of file gnss.hpp.

Referenced by gnss_auxiliary_sub_cb(), and process_fixx().

◆ _node

uavcan::INode& UavcanGnssBridge::_node
private

Definition at line 107 of file gnss.hpp.

◆ _old_fix_subscriber_active

bool UavcanGnssBridge::_old_fix_subscriber_active {true}
private

Definition at line 125 of file gnss.hpp.

Referenced by gnss_fix2_sub_cb(), and print_status().

◆ _orb_sub_gnss

uORB::Subscription UavcanGnssBridge::_orb_sub_gnss {ORB_ID(vehicle_gps_position)}
private

Definition at line 122 of file gnss.hpp.

Referenced by broadcast_from_orb().

◆ _orb_to_uavcan_pub_timer

uavcan::TimerEventForwarder<TimerCbBinder> UavcanGnssBridge::_orb_to_uavcan_pub_timer
private

Definition at line 115 of file gnss.hpp.

Referenced by init(), and process_fixx().

◆ _pub_fix2

uavcan::Publisher<uavcan::equipment::gnss::Fix2> UavcanGnssBridge::_pub_fix2
private

Definition at line 113 of file gnss.hpp.

Referenced by broadcast_from_orb(), and init().

◆ _receiver_node_id

int UavcanGnssBridge::_receiver_node_id {-1}
private

Definition at line 124 of file gnss.hpp.

Referenced by get_num_redundant_channels(), gnss_fix2_sub_cb(), print_status(), and process_fixx().

◆ _sub_auxiliary

uavcan::Subscriber<uavcan::equipment::gnss::Auxiliary, AuxiliaryCbBinder> UavcanGnssBridge::_sub_auxiliary
private

Definition at line 109 of file gnss.hpp.

Referenced by init().

◆ _sub_fix

uavcan::Subscriber<uavcan::equipment::gnss::Fix, FixCbBinder> UavcanGnssBridge::_sub_fix
private

Definition at line 110 of file gnss.hpp.

Referenced by gnss_fix2_sub_cb(), init(), and print_status().

◆ _sub_fix2

uavcan::Subscriber<uavcan::equipment::gnss::Fix2, Fix2CbBinder> UavcanGnssBridge::_sub_fix2
private

Definition at line 111 of file gnss.hpp.

Referenced by init().

◆ _system_clock_set

bool UavcanGnssBridge::_system_clock_set {false}
private

Have we set the system clock at least once from GNSS data?

Definition at line 126 of file gnss.hpp.

Referenced by process_fixx().

◆ NAME

const char *const UavcanGnssBridge::NAME = "gnss"
static

Definition at line 63 of file gnss.hpp.

Referenced by get_name().

◆ ORB_TO_UAVCAN_FREQUENCY_HZ

constexpr unsigned UavcanGnssBridge::ORB_TO_UAVCAN_FREQUENCY_HZ = 10
staticprivate

Definition at line 60 of file gnss.hpp.

Referenced by init().


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