APM:Libraries
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
RangeFinder Class Reference

#include <RangeFinder.h>

Collaboration diagram for RangeFinder:
[legend]

Classes

struct  RangeFinder_State
 

Public Types

enum  RangeFinder_Type {
  RangeFinder_TYPE_NONE = 0, RangeFinder_TYPE_ANALOG = 1, RangeFinder_TYPE_MBI2C = 2, RangeFinder_TYPE_PLI2C = 3,
  RangeFinder_TYPE_PX4 = 4, RangeFinder_TYPE_PX4_PWM = 5, RangeFinder_TYPE_BBB_PRU = 6, RangeFinder_TYPE_LWI2C = 7,
  RangeFinder_TYPE_LWSER = 8, RangeFinder_TYPE_BEBOP = 9, RangeFinder_TYPE_MAVLink = 10, RangeFinder_TYPE_ULANDING = 11,
  RangeFinder_TYPE_LEDDARONE = 12, RangeFinder_TYPE_MBSER = 13, RangeFinder_TYPE_TRI2C = 14, RangeFinder_TYPE_PLI2CV3 = 15,
  RangeFinder_TYPE_VL53L0X = 16, RangeFinder_TYPE_NMEA = 17, RangeFinder_TYPE_WASP = 18, RangeFinder_TYPE_BenewakeTF02 = 19,
  RangeFinder_TYPE_BenewakeTFmini = 20
}
 
enum  RangeFinder_Function { FUNCTION_LINEAR = 0, FUNCTION_INVERTED = 1, FUNCTION_HYPERBOLA = 2 }
 
enum  RangeFinder_Status {
  RangeFinder_NotConnected = 0, RangeFinder_NoData, RangeFinder_OutOfRangeLow, RangeFinder_OutOfRangeHigh,
  RangeFinder_Good
}
 

Public Member Functions

 RangeFinder (AP_SerialManager &_serial_manager, enum Rotation orientation_default)
 
 RangeFinder (const RangeFinder &other)=delete
 
RangeFinderoperator= (const RangeFinder &)=delete
 
uint8_t num_sensors (void) const
 
void init (void)
 
void update (void)
 
void handle_msg (mavlink_message_t *msg)
 
bool has_orientation (enum Rotation orientation) const
 
AP_RangeFinder_Backendfind_instance (enum Rotation orientation) const
 
AP_RangeFinder_Backendget_backend (uint8_t id) const
 
uint16_t distance_cm_orient (enum Rotation orientation) const
 
uint16_t voltage_mv_orient (enum Rotation orientation) const
 
int16_t max_distance_cm_orient (enum Rotation orientation) const
 
int16_t min_distance_cm_orient (enum Rotation orientation) const
 
int16_t ground_clearance_cm_orient (enum Rotation orientation) const
 
MAV_DISTANCE_SENSOR get_mav_distance_sensor_type_orient (enum Rotation orientation) const
 
RangeFinder_Status status_orient (enum Rotation orientation) const
 
bool has_data_orient (enum Rotation orientation) const
 
uint8_t range_valid_count_orient (enum Rotation orientation) const
 
const Vector3fget_pos_offset_orient (enum Rotation orientation) const
 
void set_estimated_terrain_height (float height)
 
bool pre_arm_check () const
 

Static Public Member Functions

static RangeFinderget_singleton (void)
 

Public Attributes

AP_Int16 _powersave_range
 

Static Public Attributes

static const struct AP_Param::GroupInfobackend_var_info [RANGEFINDER_MAX_INSTANCES]
 
static const struct AP_Param::GroupInfo var_info []
 

Private Member Functions

void detect_instance (uint8_t instance, uint8_t &serial_instance)
 
void update_instance (uint8_t instance)
 
bool _add_backend (AP_RangeFinder_Backend *driver)
 

Private Attributes

RangeFinder_State state [RANGEFINDER_MAX_INSTANCES]
 
AP_RangeFinder_Backenddrivers [RANGEFINDER_MAX_INSTANCES]
 
uint8_t num_instances:3
 
float estimated_terrain_height
 
AP_SerialManagerserial_manager
 
Vector3f pos_offset_zero
 

Static Private Attributes

static RangeFinder_singleton
 

Friends

class AP_RangeFinder_Backend
 

Detailed Description

Definition at line 31 of file RangeFinder.h.

Member Enumeration Documentation

◆ RangeFinder_Function

Enumerator
FUNCTION_LINEAR 
FUNCTION_INVERTED 
FUNCTION_HYPERBOLA 

Definition at line 67 of file RangeFinder.h.

◆ RangeFinder_Status

Enumerator
RangeFinder_NotConnected 
RangeFinder_NoData 
RangeFinder_OutOfRangeLow 
RangeFinder_OutOfRangeHigh 
RangeFinder_Good 

Definition at line 73 of file RangeFinder.h.

◆ RangeFinder_Type

Enumerator
RangeFinder_TYPE_NONE 
RangeFinder_TYPE_ANALOG 
RangeFinder_TYPE_MBI2C 
RangeFinder_TYPE_PLI2C 
RangeFinder_TYPE_PX4 
RangeFinder_TYPE_PX4_PWM 
RangeFinder_TYPE_BBB_PRU 
RangeFinder_TYPE_LWI2C 
RangeFinder_TYPE_LWSER 
RangeFinder_TYPE_BEBOP 
RangeFinder_TYPE_MAVLink 
RangeFinder_TYPE_ULANDING 
RangeFinder_TYPE_LEDDARONE 
RangeFinder_TYPE_MBSER 
RangeFinder_TYPE_TRI2C 
RangeFinder_TYPE_PLI2CV3 
RangeFinder_TYPE_VL53L0X 
RangeFinder_TYPE_NMEA 
RangeFinder_TYPE_WASP 
RangeFinder_TYPE_BenewakeTF02 
RangeFinder_TYPE_BenewakeTFmini 

Definition at line 43 of file RangeFinder.h.

Constructor & Destructor Documentation

◆ RangeFinder() [1/2]

RangeFinder::RangeFinder ( AP_SerialManager _serial_manager,
enum Rotation  orientation_default 
)

Definition at line 553 of file RangeFinder.cpp.

Here is the call graph for this function:

◆ RangeFinder() [2/2]

RangeFinder::RangeFinder ( const RangeFinder other)
delete

Member Function Documentation

◆ _add_backend()

bool RangeFinder::_add_backend ( AP_RangeFinder_Backend driver)
private

Definition at line 624 of file RangeFinder.cpp.

Referenced by detect_instance().

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

◆ detect_instance()

void RangeFinder::detect_instance ( uint8_t  instance,
uint8_t &  serial_instance 
)
private

Definition at line 640 of file RangeFinder.cpp.

Referenced by init().

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

◆ distance_cm_orient()

uint16_t RangeFinder::distance_cm_orient ( enum Rotation  orientation) const

Definition at line 825 of file RangeFinder.cpp.

Referenced by AP_Frsky_Telem::calc_attiandrng(), and num_sensors().

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

◆ find_instance()

AP_RangeFinder_Backend * RangeFinder::find_instance ( enum Rotation  orientation) const

Definition at line 810 of file RangeFinder.cpp.

Referenced by distance_cm_orient(), get_mav_distance_sensor_type_orient(), get_pos_offset_orient(), ground_clearance_cm_orient(), has_data_orient(), has_orientation(), max_distance_cm_orient(), min_distance_cm_orient(), num_sensors(), range_valid_count_orient(), GCS_MAVLINK::send_rangefinder_downward(), status_orient(), and voltage_mv_orient().

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

◆ get_backend()

AP_RangeFinder_Backend * RangeFinder::get_backend ( uint8_t  id) const

Definition at line 771 of file RangeFinder.cpp.

Referenced by find_instance(), DataFlash_Class::Log_Write_RFND(), loop(), num_sensors(), NavEKF2_core::readRangeFinder(), NavEKF3_core::readRangeFinder(), NavEKF2_core::selectHeightForFusion(), NavEKF3_core::selectHeightForFusion(), GCS_MAVLINK::send_distance_sensor(), and AP_Proximity_RangeFinder::update().

Here is the caller graph for this function:

◆ get_mav_distance_sensor_type_orient()

MAV_DISTANCE_SENSOR RangeFinder::get_mav_distance_sensor_type_orient ( enum Rotation  orientation) const

Definition at line 913 of file RangeFinder.cpp.

Referenced by num_sensors().

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

◆ get_pos_offset_orient()

const Vector3f & RangeFinder::get_pos_offset_orient ( enum Rotation  orientation) const

Definition at line 904 of file RangeFinder.cpp.

Referenced by num_sensors().

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

◆ get_singleton()

static RangeFinder* RangeFinder::get_singleton ( void  )
inlinestatic

Definition at line 167 of file RangeFinder.h.

Referenced by GCS_MAVLINK::send_distance_sensor(), and GCS_MAVLINK::send_rangefinder_downward().

Here is the caller graph for this function:

◆ ground_clearance_cm_orient()

int16_t RangeFinder::ground_clearance_cm_orient ( enum Rotation  orientation) const

Definition at line 861 of file RangeFinder.cpp.

Referenced by num_sensors(), NavEKF2_core::readRangeFinder(), and NavEKF3_core::readRangeFinder().

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

◆ handle_msg()

void RangeFinder::handle_msg ( mavlink_message_t *  msg)

Definition at line 793 of file RangeFinder.cpp.

Referenced by num_sensors().

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

◆ has_data_orient()

bool RangeFinder::has_data_orient ( enum Rotation  orientation) const

Definition at line 870 of file RangeFinder.cpp.

Referenced by num_sensors().

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

◆ has_orientation()

bool RangeFinder::has_orientation ( enum Rotation  orientation) const

Definition at line 804 of file RangeFinder.cpp.

Referenced by num_sensors().

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

◆ init()

void RangeFinder::init ( void  )

Definition at line 578 of file RangeFinder.cpp.

Referenced by num_sensors(), and setup().

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

◆ max_distance_cm_orient()

int16_t RangeFinder::max_distance_cm_orient ( enum Rotation  orientation) const

Definition at line 843 of file RangeFinder.cpp.

Referenced by NavEKF2_core::getHeightControlLimit(), NavEKF3_core::getHeightControlLimit(), num_sensors(), NavEKF2_core::selectHeightForFusion(), and NavEKF3_core::selectHeightForFusion().

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

◆ min_distance_cm_orient()

int16_t RangeFinder::min_distance_cm_orient ( enum Rotation  orientation) const

Definition at line 852 of file RangeFinder.cpp.

Referenced by num_sensors().

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

◆ num_sensors()

uint8_t RangeFinder::num_sensors ( void  ) const
inline

Definition at line 117 of file RangeFinder.h.

Referenced by loop(), setup(), and AP_Proximity_RangeFinder::update().

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

◆ operator=()

RangeFinder& RangeFinder::operator= ( const RangeFinder )
delete

◆ pre_arm_check()

bool RangeFinder::pre_arm_check ( ) const

Definition at line 893 of file RangeFinder.cpp.

◆ range_valid_count_orient()

uint8_t RangeFinder::range_valid_count_orient ( enum Rotation  orientation) const

Definition at line 879 of file RangeFinder.cpp.

Referenced by num_sensors().

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

◆ set_estimated_terrain_height()

void RangeFinder::set_estimated_terrain_height ( float  height)
inline

Definition at line 156 of file RangeFinder.h.

◆ status_orient()

RangeFinder::RangeFinder_Status RangeFinder::status_orient ( enum Rotation  orientation) const

Definition at line 784 of file RangeFinder.cpp.

Referenced by num_sensors().

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

◆ update()

void RangeFinder::update ( void  )

Definition at line 608 of file RangeFinder.cpp.

Referenced by loop(), and num_sensors().

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

◆ update_instance()

void RangeFinder::update_instance ( uint8_t  instance)
private

◆ voltage_mv_orient()

uint16_t RangeFinder::voltage_mv_orient ( enum Rotation  orientation) const

Definition at line 834 of file RangeFinder.cpp.

Referenced by num_sensors().

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

Friends And Related Function Documentation

◆ AP_RangeFinder_Backend

friend class AP_RangeFinder_Backend
friend

Definition at line 33 of file RangeFinder.h.

Member Data Documentation

◆ _powersave_range

AP_Int16 RangeFinder::_powersave_range

Definition at line 111 of file RangeFinder.h.

Referenced by detect_instance().

◆ _singleton

RangeFinder * RangeFinder::_singleton
staticprivate

Definition at line 171 of file RangeFinder.h.

Referenced by get_mav_distance_sensor_type_orient(), get_singleton(), and RangeFinder().

◆ backend_var_info

const AP_Param::GroupInfo * RangeFinder::backend_var_info
static

Definition at line 109 of file RangeFinder.h.

Referenced by detect_instance().

◆ drivers

AP_RangeFinder_Backend* RangeFinder::drivers[RANGEFINDER_MAX_INSTANCES]
private

◆ estimated_terrain_height

float RangeFinder::estimated_terrain_height
private

Definition at line 176 of file RangeFinder.h.

Referenced by detect_instance(), and set_estimated_terrain_height().

◆ num_instances

uint8_t RangeFinder::num_instances
private

◆ pos_offset_zero

Vector3f RangeFinder::pos_offset_zero
private

Definition at line 178 of file RangeFinder.h.

Referenced by get_pos_offset_orient().

◆ serial_manager

AP_SerialManager& RangeFinder::serial_manager
private

Definition at line 177 of file RangeFinder.h.

Referenced by detect_instance().

◆ state

RangeFinder_State RangeFinder::state[RANGEFINDER_MAX_INSTANCES]
private

Definition at line 173 of file RangeFinder.h.

Referenced by detect_instance(), handle_msg(), init(), pre_arm_check(), RangeFinder(), and update().

◆ var_info

const AP_Param::GroupInfo RangeFinder::var_info
static

Definition at line 114 of file RangeFinder.h.

Referenced by detect_instance(), RangeFinder(), and setup().


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