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

#include <SubscriptionInterval.hpp>

Inheritance diagram for uORB::SubscriptionInterval:
Collaboration diagram for uORB::SubscriptionInterval:

Public Member Functions

 SubscriptionInterval (const orb_metadata *meta, uint32_t interval_us=0, uint8_t instance=0)
 Constructor. More...
 
 SubscriptionInterval ()
 
 ~SubscriptionInterval ()=default
 
bool subscribe ()
 
bool advertised ()
 
bool updated ()
 Check if there is a new update. More...
 
bool update (void *dst)
 Copy the struct if updated. More...
 
bool copy (void *dst)
 Copy the struct. More...
 
bool valid () const
 
uint8_t get_instance () const
 
orb_id_t get_topic () const
 
void set_interval_us (uint32_t interval)
 Set the interval in microseconds. More...
 
void set_interval_ms (uint32_t interval)
 Set the interval in milliseconds. More...
 

Protected Attributes

Subscription _subscription
 
uint64_t _last_update {0}
 
uint32_t _interval_us {0}
 

Detailed Description

Definition at line 54 of file SubscriptionInterval.hpp.

Constructor & Destructor Documentation

◆ SubscriptionInterval() [1/2]

uORB::SubscriptionInterval::SubscriptionInterval ( const orb_metadata meta,
uint32_t  interval_us = 0,
uint8_t  instance = 0 
)
inline

Constructor.

Parameters
metaThe uORB metadata (usually from the ORB_ID() macro) for the topic.
intervalThe requested maximum update interval in microseconds.
instanceThe instance for multi sub.

Definition at line 65 of file SubscriptionInterval.hpp.

References _interval_us, and ll40ls::instance.

◆ SubscriptionInterval() [2/2]

uORB::SubscriptionInterval::SubscriptionInterval ( )
inline

Definition at line 70 of file SubscriptionInterval.hpp.

References ~SubscriptionInterval().

Here is the call graph for this function:

◆ ~SubscriptionInterval()

uORB::SubscriptionInterval::~SubscriptionInterval ( )
default

Referenced by SubscriptionInterval().

Here is the caller graph for this function:

Member Function Documentation

◆ advertised()

bool uORB::SubscriptionInterval::advertised ( )
inline

Definition at line 76 of file SubscriptionInterval.hpp.

References _subscription, and uORB::Subscription::advertised().

Referenced by updated().

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

◆ copy()

bool uORB::SubscriptionInterval::copy ( void *  dst)
inline

Copy the struct.

Parameters
dstThe destination pointer where the struct will be copied.
Returns
true only if topic was copied successfully.

Definition at line 109 of file SubscriptionInterval.hpp.

References _last_update, _subscription, uORB::Subscription::copy(), and hrt_absolute_time().

Referenced by px4::logger::Logger::copy_if_updated(), VehicleAcceleration::Run(), VehicleAngularVelocity::Run(), VehicleAngularVelocity::SensorCorrectionsUpdate(), and update().

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

◆ get_instance()

uint8_t uORB::SubscriptionInterval::get_instance ( ) const
inline

Definition at line 121 of file SubscriptionInterval.hpp.

References _subscription, and uORB::Subscription::get_instance().

Referenced by px4::logger::Logger::write_add_logged_msg().

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

◆ get_topic()

orb_id_t uORB::SubscriptionInterval::get_topic ( ) const
inline

Definition at line 122 of file SubscriptionInterval.hpp.

References _subscription, and uORB::Subscription::get_topic().

Referenced by px4::logger::Logger::write_add_logged_msg(), and px4::logger::Logger::write_formats().

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

◆ set_interval_ms()

void uORB::SubscriptionInterval::set_interval_ms ( uint32_t  interval)
inline

Set the interval in milliseconds.

Parameters
intervalThe interval in milliseconds.

Definition at line 134 of file SubscriptionInterval.hpp.

References _interval_us.

Referenced by BlockLocalPositionEstimator::BlockLocalPositionEstimator(), and FixedwingPositionControl::FixedwingPositionControl().

Here is the caller graph for this function:

◆ set_interval_us()

void uORB::SubscriptionInterval::set_interval_us ( uint32_t  interval)
inline

Set the interval in microseconds.

Parameters
intervalThe interval in microseconds.

Definition at line 128 of file SubscriptionInterval.hpp.

References _interval_us.

Referenced by MulticopterPositionControl::init(), and MixingOutput::setMaxTopicUpdateRate().

Here is the caller graph for this function:

◆ subscribe()

bool uORB::SubscriptionInterval::subscribe ( )
inline

Definition at line 74 of file SubscriptionInterval.hpp.

References _subscription, and uORB::Subscription::subscribe().

Referenced by px4::logger::Logger::copy_if_updated().

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

◆ update()

bool uORB::SubscriptionInterval::update ( void *  dst)
inline

Copy the struct if updated.

Parameters
dstThe destination pointer where the struct will be copied.
Returns
true only if topic was updated and copied successfully.

Definition at line 95 of file SubscriptionInterval.hpp.

References copy(), and updated().

Referenced by px4::logger::Logger::copy_if_updated(), MulticopterRateControl::Run(), MulticopterAttitudeControl::Run(), AttitudeEstimatorQ::Run(), FixedwingAttitudeControl::Run(), MulticopterPositionControl::Run(), VtolAttitudeControl::Run(), Ekf2::Run(), px4::logger::Logger::run(), FixedwingPositionControl::Run(), and BlockLocalPositionEstimator::Run().

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

◆ updated()

bool uORB::SubscriptionInterval::updated ( )
inline

Check if there is a new update.

Definition at line 81 of file SubscriptionInterval.hpp.

References _interval_us, _last_update, _subscription, advertised(), hrt_elapsed_time(), and uORB::Subscription::updated().

Referenced by VehicleAngularVelocity::SensorCorrectionsUpdate(), and update().

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

◆ valid()

bool uORB::SubscriptionInterval::valid ( ) const
inline

Definition at line 119 of file SubscriptionInterval.hpp.

References _subscription, and uORB::Subscription::valid().

Referenced by px4::logger::Logger::copy_if_updated(), and px4::logger::Logger::write_all_add_logged_msg().

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

Member Data Documentation

◆ _interval_us

uint32_t uORB::SubscriptionInterval::_interval_us {0}
protected

◆ _last_update

uint64_t uORB::SubscriptionInterval::_last_update {0}
protected

◆ _subscription


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