PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Public Member Functions | |
TERARANGER (const int bus=TERARANGER_BUS_DEFAULT, const uint8_t rotation=distance_sensor_s::ROTATION_DOWNWARD_FACING, const int address=TERARANGER_ONE_BASEADDR) | |
virtual | ~TERARANGER () |
virtual int | init () override |
void | print_info () |
Diagnostics - print some basic information about the driver. More... | |
void | start () |
Initialise the automatic measurement state machine and start it. More... | |
void | stop () |
Stop the automatic measurement state machine. More... | |
Protected Member Functions | |
virtual int | probe () override |
Private Member Functions | |
int | collect () |
Collects the most recent sensor measurement data from the i2c bus. More... | |
int | measure () |
Sends an i2c measure command to the sensors. More... | |
int | probe_address (const uint8_t address) |
Test whether the device supported by the driver is present at a specific address. More... | |
void | Run () override |
Perform a poll cycle; collect from the previous measurement and start a new one. More... | |
Private Attributes | |
bool | _collect_phase {false} |
int | _orb_class_instance {-1} |
uint8_t | _orientation {0} |
float | _max_distance {0} |
float | _min_distance {0} |
orb_advert_t | _distance_sensor_topic {nullptr} |
perf_counter_t | _comms_errors {perf_alloc(PC_COUNT, "tr1_comm_err")} |
perf_counter_t | _sample_perf {perf_alloc(PC_ELAPSED, "tr1_read")} |
Definition at line 80 of file teraranger.cpp.
TERARANGER::TERARANGER | ( | const int | bus = TERARANGER_BUS_DEFAULT , |
const uint8_t | rotation = distance_sensor_s::ROTATION_DOWNWARD_FACING , |
||
const int | address = TERARANGER_ONE_BASEADDR |
||
) |
Definition at line 194 of file teraranger.cpp.
Referenced by teraranger::start_bus().
|
virtual |
Definition at line 203 of file teraranger.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 219 of file teraranger.cpp.
References _collect_phase, _comms_errors, _distance_sensor_topic, _max_distance, _min_distance, _orientation, _sample_perf, crc8(), distance_sensor_s::current_distance, f(), hrt_absolute_time(), measure(), ORB_ID, ORB_PRIO_DEFAULT, orb_publish_auto(), perf_begin(), perf_count(), and perf_end().
Referenced by Run().
|
overridevirtual |
Definition at line 270 of file teraranger.cpp.
References _max_distance, _min_distance, ToneAlarmInterface::init(), OK, param_find(), param_get(), TERARANGER_EVO_3M_MAX_DISTANCE, TERARANGER_EVO_3M_MIN_DISTANCE, TERARANGER_EVO_600HZ_MAX_DISTANCE, TERARANGER_EVO_600HZ_MIN_DISTANCE, TERARANGER_EVO_60M_MAX_DISTANCE, TERARANGER_EVO_60M_MIN_DISTANCE, TERARANGER_EVO_BASEADDR, TERARANGER_ONE_BASEADDR, TERARANGER_ONE_MAX_DISTANCE, and TERARANGER_ONE_MIN_DISTANCE.
Referenced by teraranger::start_bus().
|
private |
Sends an i2c measure command to the sensors.
Definition at line 358 of file teraranger.cpp.
References _collect_phase, _comms_errors, perf_count(), and TERARANGER_MEASURE_REG.
Referenced by collect(), and probe().
void TERARANGER::print_info | ( | ) |
Diagnostics - print some basic information about the driver.
Definition at line 397 of file teraranger.cpp.
References _comms_errors, _sample_perf, perf_print_counter(), and TERARANGER_MEASUREMENT_INTERVAL.
Referenced by teraranger::status().
|
overrideprotectedvirtual |
Definition at line 375 of file teraranger.cpp.
References measure(), OK, TERARANGER_WHO_AM_I_REG, and TERARANGER_WHO_AM_I_REG_VAL.
|
private |
Test whether the device supported by the driver is present at a specific address.
address | The I2C bus address to probe. |
|
overrideprivate |
Perform a poll cycle; collect from the previous measurement and start a new one.
Definition at line 405 of file teraranger.cpp.
References collect().
void TERARANGER::start | ( | ) |
Initialise the automatic measurement state machine and start it.
Definition at line 412 of file teraranger.cpp.
References _collect_phase, and TERARANGER_MEASUREMENT_INTERVAL.
Referenced by teraranger::start_bus().
void TERARANGER::stop | ( | ) |
Stop the automatic measurement state machine.
Definition at line 421 of file teraranger.cpp.
Referenced by ~TERARANGER().
|
private |
Definition at line 140 of file teraranger.cpp.
|
private |
Definition at line 151 of file teraranger.cpp.
Referenced by collect(), measure(), print_info(), and ~TERARANGER().
|
private |
Definition at line 149 of file teraranger.cpp.
Referenced by collect(), and ~TERARANGER().
|
private |
Definition at line 146 of file teraranger.cpp.
|
private |
Definition at line 147 of file teraranger.cpp.
|
private |
Definition at line 142 of file teraranger.cpp.
|
private |
Definition at line 144 of file teraranger.cpp.
Referenced by collect().
|
private |
Definition at line 152 of file teraranger.cpp.
Referenced by collect(), print_info(), and ~TERARANGER().