PX4 Firmware
PX4 Autopilot Software http://px4.io
|
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")} |
Definition at line 146 of file MappyDot.cpp.
MappyDot::MappyDot | ( | const int | bus = MAPPYDOT_BUS_DEFAULT | ) |
Definition at line 225 of file MappyDot.cpp.
Referenced by mappydot::start_bus().
|
virtual |
Definition at line 231 of file MappyDot.cpp.
References _comms_errors, _distance_sensor_topic, _sample_perf, orb_unadvertise(), perf_free(), and stop().
|
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().
|
private |
|
private |
Gets the current sensor rotation value.
Definition at line 292 of file MappyDot.cpp.
Referenced by 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().
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().
|
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().
|
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().
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().
void MappyDot::stop | ( | ) |
Stop the automatic measurement state machine.
Definition at line 430 of file MappyDot.cpp.
Referenced by ~MappyDot().
|
private |
Definition at line 204 of file MappyDot.cpp.
Referenced by collect(), print_info(), and ~MappyDot().
|
private |
Definition at line 202 of file MappyDot.cpp.
Referenced by collect(), and ~MappyDot().
|
private |
Definition at line 205 of file MappyDot.cpp.
Referenced by collect(), print_info(), and ~MappyDot().
|
private |
Definition at line 197 of file MappyDot.cpp.
|
private |
Definition at line 200 of file MappyDot.cpp.
|
private |
Definition at line 198 of file MappyDot.cpp.