PX4 Firmware
PX4 Autopilot Software http://px4.io
PX4FLOW Class Reference
Inheritance diagram for PX4FLOW:
Collaboration diagram for PX4FLOW:

Public Member Functions

 PX4FLOW (int bus, int address=I2C_FLOW_ADDRESS_DEFAULT, enum Rotation rotation=(enum Rotation) 0, int conversion_interval=PX4FLOW_CONVERSION_INTERVAL_DEFAULT, uint8_t sonar_rotation=distance_sensor_s::ROTATION_DOWNWARD_FACING)
 
virtual ~PX4FLOW ()
 
virtual int init ()
 
void print_info ()
 Diagnostics - print some basic information about the driver. More...
 

Protected Member Functions

virtual int probe ()
 

Private Member Functions

int probe_address (uint8_t address)
 Test whether the device supported by the driver is present at a specific address. More...
 
void start ()
 Initialise the automatic measurement state machine and start it. More...
 
void stop ()
 Stop the automatic measurement state machine. More...
 
void Run () override
 Perform a poll cycle; collect from the previous measurement and start a new one. More...
 
int measure ()
 
int collect ()
 

Private Attributes

uint8_t _sonar_rotation
 
bool _sensor_ok {false}
 
bool _collect_phase {false}
 
int _class_instance {-1}
 
int _orb_class_instance {-1}
 
orb_advert_t _px4flow_topic {nullptr}
 
orb_advert_t _distance_sensor_topic {nullptr}
 
perf_counter_t _sample_perf
 
perf_counter_t _comms_errors
 
enum Rotation _sensor_rotation
 
float _sensor_min_range {0.0f}
 
float _sensor_max_range {0.0f}
 
float _sensor_max_flow_rate {0.0f}
 
i2c_frame _frame
 
i2c_integral_frame _frame_integral
 

Detailed Description

Definition at line 77 of file px4flow.cpp.

Constructor & Destructor Documentation

◆ PX4FLOW()

PX4FLOW::PX4FLOW ( int  bus,
int  address = I2C_FLOW_ADDRESS_DEFAULT,
enum Rotation  rotation = (enum Rotation)0,
int  conversion_interval = PX4FLOW_CONVERSION_INTERVAL_DEFAULT,
uint8_t  sonar_rotation = distance_sensor_s::ROTATION_DOWNWARD_FACING 
)

Definition at line 154 of file px4flow.cpp.

Referenced by px4flow::start().

Here is the caller graph for this function:

◆ ~PX4FLOW()

PX4FLOW::~PX4FLOW ( )
virtual

Definition at line 164 of file px4flow.cpp.

References _comms_errors, _sample_perf, perf_free(), and stop().

Here is the call graph for this function:

Member Function Documentation

◆ collect()

◆ init()

int PX4FLOW::init ( )
virtual

Definition at line 174 of file px4flow.cpp.

References _class_instance, _distance_sensor_topic, _orb_class_instance, _sensor_max_flow_rate, _sensor_max_range, _sensor_min_range, _sensor_ok, _sensor_rotation, CLASS_DEVICE_PRIMARY, DEVICE_LOG, ToneAlarmInterface::init(), OK, orb_advertise_multi(), ORB_ID, ORB_PRIO_HIGH, param_find(), param_get(), PARAM_INVALID, RANGE_FINDER_BASE_DEVICE_PATH, and start().

Referenced by px4flow::start().

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

◆ measure()

int PX4FLOW::measure ( )
private

Definition at line 265 of file px4flow.cpp.

References _comms_errors, DEVICE_DEBUG, OK, perf_count(), and PX4FLOW_REG.

Referenced by probe(), and Run().

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

◆ print_info()

void PX4FLOW::print_info ( )

Diagnostics - print some basic information about the driver.

Definition at line 405 of file px4flow.cpp.

References _comms_errors, _sample_perf, and perf_print_counter().

Referenced by px4flow::info().

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

◆ probe()

int PX4FLOW::probe ( )
protectedvirtual

Definition at line 248 of file px4flow.cpp.

References I2C_FRAME_SIZE, measure(), and OK.

Here is the call graph for this function:

◆ probe_address()

int PX4FLOW::probe_address ( uint8_t  address)
private

Test whether the device supported by the driver is present at a specific address.

Parameters
addressThe I2C bus address to probe.
Returns
True if the device is present.

◆ Run()

void PX4FLOW::Run ( )
overrideprivate

Perform a poll cycle; collect from the previous measurement and start a new one.

Definition at line 387 of file px4flow.cpp.

References collect(), DEVICE_DEBUG, measure(), OK, PX4FLOW_CONVERSION_INTERVAL_DEFAULT, and start().

Here is the call graph for this function:

◆ start()

void PX4FLOW::start ( )
private

Initialise the automatic measurement state machine and start it.

Note
This function is called at open and error time. It might make sense to make it more aggressive about resetting the bus in case of errors.

Definition at line 371 of file px4flow.cpp.

References _collect_phase.

Referenced by init(), and Run().

Here is the caller graph for this function:

◆ stop()

void PX4FLOW::stop ( )
private

Stop the automatic measurement state machine.

Definition at line 381 of file px4flow.cpp.

Referenced by ~PX4FLOW().

Here is the caller graph for this function:

Member Data Documentation

◆ _class_instance

int PX4FLOW::_class_instance {-1}
private

Definition at line 100 of file px4flow.cpp.

Referenced by init().

◆ _collect_phase

bool PX4FLOW::_collect_phase {false}
private

Definition at line 99 of file px4flow.cpp.

Referenced by start().

◆ _comms_errors

perf_counter_t PX4FLOW::_comms_errors
private

Definition at line 106 of file px4flow.cpp.

Referenced by collect(), measure(), print_info(), and ~PX4FLOW().

◆ _distance_sensor_topic

orb_advert_t PX4FLOW::_distance_sensor_topic {nullptr}
private

Definition at line 103 of file px4flow.cpp.

Referenced by collect(), and init().

◆ _frame

i2c_frame PX4FLOW::_frame
private

Definition at line 113 of file px4flow.cpp.

Referenced by collect().

◆ _frame_integral

i2c_integral_frame PX4FLOW::_frame_integral
private

Definition at line 114 of file px4flow.cpp.

Referenced by collect().

◆ _orb_class_instance

int PX4FLOW::_orb_class_instance {-1}
private

Definition at line 101 of file px4flow.cpp.

Referenced by init().

◆ _px4flow_topic

orb_advert_t PX4FLOW::_px4flow_topic {nullptr}
private

Definition at line 102 of file px4flow.cpp.

Referenced by collect().

◆ _sample_perf

perf_counter_t PX4FLOW::_sample_perf
private

Definition at line 105 of file px4flow.cpp.

Referenced by collect(), print_info(), and ~PX4FLOW().

◆ _sensor_max_flow_rate

float PX4FLOW::_sensor_max_flow_rate {0.0f}
private

Definition at line 111 of file px4flow.cpp.

Referenced by collect(), and init().

◆ _sensor_max_range

float PX4FLOW::_sensor_max_range {0.0f}
private

Definition at line 110 of file px4flow.cpp.

Referenced by collect(), and init().

◆ _sensor_min_range

float PX4FLOW::_sensor_min_range {0.0f}
private

Definition at line 109 of file px4flow.cpp.

Referenced by collect(), and init().

◆ _sensor_ok

bool PX4FLOW::_sensor_ok {false}
private

Definition at line 98 of file px4flow.cpp.

Referenced by init().

◆ _sensor_rotation

enum Rotation PX4FLOW::_sensor_rotation
private

Definition at line 108 of file px4flow.cpp.

Referenced by collect(), and init().

◆ _sonar_rotation

uint8_t PX4FLOW::_sonar_rotation
private

Definition at line 97 of file px4flow.cpp.

Referenced by collect().


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