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

Public Member Functions

 MappyDot (const int bus=MAPPYDOT_BUS_DEFAULT)
 
virtual ~MappyDot ()
 
virtual int init () override
 Initializes the sensors, advertises uORB topic, sets device addresses. More...
 
void print_info ()
 Prints basic diagnostic information about the driver. More...
 
void start ()
 Initializes the automatic measurement state machine and starts the driver. More...
 
void stop ()
 Stop the automatic measurement state machine. More...
 

Private Member Functions

int probe ()
 Sends an i2c measure command to check for presence of a sensor. More...
 
int collect ()
 Collects the most recent sensor measurement data from the i2c bus. More...
 
void Run () override
 Performs a poll cycle; collect from the previous measurement and start a new one. More...
 
int get_sensor_rotation (const size_t index)
 Gets the current sensor rotation value. More...
 
 DEFINE_PARAMETERS ((ParamInt< px4::params::SENS_EN_MPDT >) _p_sensor_enabled,(ParamInt< px4::params::SENS_MPDT0_ROT >) _p_sensor0_rot,(ParamInt< px4::params::SENS_MPDT1_ROT >) _p_sensor1_rot,(ParamInt< px4::params::SENS_MPDT2_ROT >) _p_sensor2_rot,(ParamInt< px4::params::SENS_MPDT3_ROT >) _p_sensor3_rot,(ParamInt< px4::params::SENS_MPDT4_ROT >) _p_sensor4_rot,(ParamInt< px4::params::SENS_MPDT5_ROT >) _p_sensor5_rot,(ParamInt< px4::params::SENS_MPDT6_ROT >) _p_sensor6_rot,(ParamInt< px4::params::SENS_MPDT7_ROT >) _p_sensor7_rot,(ParamInt< px4::params::SENS_MPDT8_ROT >) _p_sensor8_rot,(ParamInt< px4::params::SENS_MPDT9_ROT >) _p_sensor9_rot,(ParamInt< px4::params::SENS_MPDT10_ROT >) _p_sensor10_rot,(ParamInt< px4::params::SENS_MPDT11_ROT >) _p_sensor11_rot)
 

Private Attributes

px4::Array< uint8_t, RANGE_FINDER_MAX_SENSORS_sensor_addresses {}
 
px4::Array< uint8_t, RANGE_FINDER_MAX_SENSORS_sensor_rotations {}
 
size_t _sensor_count {0}
 
orb_advert_t _distance_sensor_topic {nullptr}
 
perf_counter_t _comms_errors {perf_alloc(PC_COUNT, "mappydot_comms_err")}
 
perf_counter_t _sample_perf {perf_alloc(PC_ELAPSED, "mappydot_sample_perf")}
 

Detailed Description

Definition at line 146 of file MappyDot.cpp.

Constructor & Destructor Documentation

◆ MappyDot()

MappyDot::MappyDot ( const int  bus = MAPPYDOT_BUS_DEFAULT)

Definition at line 225 of file MappyDot.cpp.

Referenced by mappydot::start_bus().

Here is the caller graph for this function:

◆ ~MappyDot()

MappyDot::~MappyDot ( )
virtual

Definition at line 231 of file MappyDot.cpp.

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

Here is the call graph for this function:

Member Function Documentation

◆ collect()

int MappyDot::collect ( )
private

Collects the most recent sensor measurement data from the i2c bus.

Definition at line 247 of file MappyDot.cpp.

References _comms_errors, _distance_sensor_topic, _sample_perf, _sensor_addresses, _sensor_count, _sensor_rotations, distance_sensor_s::current_distance, f(), hrt_absolute_time(), MAPPYDOT_MAX_DISTANCE, MAPPYDOT_MIN_DISTANCE, ORB_ID, ORB_PRIO_DEFAULT, orb_publish_auto(), perf_begin(), perf_count(), and perf_end().

Referenced by Run().

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

◆ DEFINE_PARAMETERS()

MappyDot::DEFINE_PARAMETERS ( (ParamInt< px4::params::SENS_EN_MPDT >)  _p_sensor_enabled,
(ParamInt< px4::params::SENS_MPDT0_ROT >)  _p_sensor0_rot,
(ParamInt< px4::params::SENS_MPDT1_ROT >)  _p_sensor1_rot,
(ParamInt< px4::params::SENS_MPDT2_ROT >)  _p_sensor2_rot,
(ParamInt< px4::params::SENS_MPDT3_ROT >)  _p_sensor3_rot,
(ParamInt< px4::params::SENS_MPDT4_ROT >)  _p_sensor4_rot,
(ParamInt< px4::params::SENS_MPDT5_ROT >)  _p_sensor5_rot,
(ParamInt< px4::params::SENS_MPDT6_ROT >)  _p_sensor6_rot,
(ParamInt< px4::params::SENS_MPDT7_ROT >)  _p_sensor7_rot,
(ParamInt< px4::params::SENS_MPDT8_ROT >)  _p_sensor8_rot,
(ParamInt< px4::params::SENS_MPDT9_ROT >)  _p_sensor9_rot,
(ParamInt< px4::params::SENS_MPDT10_ROT >)  _p_sensor10_rot,
(ParamInt< px4::params::SENS_MPDT11_ROT >)  _p_sensor11_rot 
)
private

◆ get_sensor_rotation()

int MappyDot::get_sensor_rotation ( const size_t  index)
private

Gets the current sensor rotation value.

Definition at line 292 of file MappyDot.cpp.

Referenced by init().

Here is the caller graph for this function:

◆ init()

int MappyDot::init ( )
overridevirtual

Initializes the sensors, advertises uORB topic, sets device addresses.

Definition at line 324 of file MappyDot.cpp.

References _sensor_addresses, _sensor_count, _sensor_rotations, get_sensor_rotation(), ToneAlarmInterface::init(), MAPPYDOT_BASE_ADDR, MAPPYDOT_LONG_RANGE, MAPPYDOT_MEASUREMENT_BUDGET, MAPPYDOT_MEASUREMENT_INTERVAL_USEC, MAPPYDOT_RANGING_MEASUREMENT_MODE, MAPPYDOT_SET_LED_THRESHOLD_DISTANCE_IN_MM, probe(), and RANGE_FINDER_MAX_SENSORS.

Referenced by mappydot::start_bus().

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

◆ print_info()

void MappyDot::print_info ( )

Prints basic diagnostic information about the driver.

Definition at line 401 of file MappyDot.cpp.

References _comms_errors, _sample_perf, and perf_print_counter().

Referenced by mappydot::status().

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

◆ probe()

int MappyDot::probe ( )
private

Sends an i2c measure command to check for presence of a sensor.

Definition at line 392 of file MappyDot.cpp.

References MAPPYDOT_PERFORM_SINGLE_RANGE.

Referenced by init().

Here is the caller graph for this function:

◆ Run()

void MappyDot::Run ( )
overrideprivate

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

Definition at line 408 of file MappyDot.cpp.

References collect(), and start().

Here is the call graph for this function:

◆ start()

void MappyDot::start ( )

Initializes the automatic measurement state machine and starts the driver.

Definition at line 420 of file MappyDot.cpp.

References MAPPYDOT_MEASUREMENT_INTERVAL_USEC.

Referenced by Run(), and mappydot::start_bus().

Here is the caller graph for this function:

◆ stop()

void MappyDot::stop ( )

Stop the automatic measurement state machine.

Definition at line 430 of file MappyDot.cpp.

Referenced by ~MappyDot().

Here is the caller graph for this function:

Member Data Documentation

◆ _comms_errors

perf_counter_t MappyDot::_comms_errors {perf_alloc(PC_COUNT, "mappydot_comms_err")}
private

Definition at line 204 of file MappyDot.cpp.

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

◆ _distance_sensor_topic

orb_advert_t MappyDot::_distance_sensor_topic {nullptr}
private

Definition at line 202 of file MappyDot.cpp.

Referenced by collect(), and ~MappyDot().

◆ _sample_perf

perf_counter_t MappyDot::_sample_perf {perf_alloc(PC_ELAPSED, "mappydot_sample_perf")}
private

Definition at line 205 of file MappyDot.cpp.

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

◆ _sensor_addresses

px4::Array<uint8_t, RANGE_FINDER_MAX_SENSORS> MappyDot::_sensor_addresses {}
private

Definition at line 197 of file MappyDot.cpp.

Referenced by collect(), and init().

◆ _sensor_count

size_t MappyDot::_sensor_count {0}
private

Definition at line 200 of file MappyDot.cpp.

Referenced by collect(), and init().

◆ _sensor_rotations

px4::Array<uint8_t, RANGE_FINDER_MAX_SENSORS> MappyDot::_sensor_rotations {}
private

Definition at line 198 of file MappyDot.cpp.

Referenced by collect(), and init().


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