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

< for UARTDriver More...

#include <AP_Proximity_RPLidarA2.h>

Inheritance diagram for AP_Proximity_RPLidarA2:
[legend]
Collaboration diagram for AP_Proximity_RPLidarA2:
[legend]

Classes

struct  _sensor_health
 
struct  _sensor_scan
 
union  PACKED
 

Public Member Functions

 AP_Proximity_RPLidarA2 (AP_Proximity &_frontend, AP_Proximity::Proximity_State &_state, AP_SerialManager &serial_manager)
 
void update (void)
 
float distance_max () const
 
float distance_min () const
 
- Public Member Functions inherited from AP_Proximity_Backend
 AP_Proximity_Backend (AP_Proximity &_frontend, AP_Proximity::Proximity_State &_state)
 
virtual ~AP_Proximity_Backend (void)
 
virtual bool get_upward_distance (float &distance) const
 
virtual void handle_msg (mavlink_message_t *msg)
 
bool get_horizontal_distance (float angle_deg, float &distance) const
 
const Vector2fget_boundary_points (uint16_t &num_points) const
 
bool get_closest_object (float &angle_deg, float &distance) const
 
uint8_t get_object_count () const
 
bool get_object_angle_and_distance (uint8_t object_number, float &angle_deg, float &distance) const
 
bool get_horizontal_distances (AP_Proximity::Proximity_Distance_Array &prx_dist_array) const
 

Static Public Member Functions

static bool detect (AP_SerialManager &serial_manager)
 

Private Types

enum  rp_state {
  rp_unknown = 0, rp_resetted, rp_responding, rp_measurements,
  rp_health
}
 
enum  ResponseType { ResponseType_Descriptor = 0, ResponseType_SCAN, ResponseType_EXPRESS, ResponseType_Health }
 

Private Member Functions

bool initialise ()
 
void init_sectors ()
 
void set_scan_mode ()
 
void send_request_for_health ()
 
void parse_response_data ()
 
void parse_response_descriptor ()
 
void get_readings ()
 
void reset_rplidar ()
 

Private Attributes

AP_HAL::UARTDriver_uart
 
uint8_t _descriptor [7]
 
char _rp_systeminfo [63]
 
bool _descriptor_data
 
bool _information_data
 
bool _resetted
 
bool _initialised
 
bool _sector_initialised
 
uint8_t _payload_length
 
uint8_t _cnt
 
uint8_t _sync_error
 
uint16_t _byte_count
 
enum ResponseType _response_type
 response from the lidar More...
 
enum rp_state _rp_state
 
uint8_t _last_sector
 last sector requested More...
 
uint32_t _last_request_ms
 system time of last request More...
 
uint32_t _last_distance_received_ms
 system time of last distance measurement received from sensor More...
 
uint32_t _last_reset_ms
 
float _angle_deg_last
 
float _distance_m_last
 
union AP_Proximity_RPLidarA2::PACKED payload
 

Additional Inherited Members

- Protected Member Functions inherited from AP_Proximity_Backend
void set_status (AP_Proximity::Proximity_Status status)
 
bool convert_angle_to_sector (float angle_degrees, uint8_t &sector) const
 
void init_boundary ()
 
void update_boundary_for_sector (uint8_t sector)
 
uint8_t get_ignore_area_count () const
 
bool get_ignore_area (uint8_t index, uint16_t &angle_deg, uint8_t &width_deg) const
 
bool get_next_ignore_start_or_end (uint8_t start_or_end, int16_t start_angle, int16_t &ignore_start) const
 
- Protected Attributes inherited from AP_Proximity_Backend
AP_Proximityfrontend
 
AP_Proximity::Proximity_Statestate
 
uint8_t _num_sectors = PROXIMITY_MAX_DIRECTION
 
uint16_t _sector_middle_deg [PROXIMITY_SECTORS_MAX] = {0, 45, 90, 135, 180, 225, 270, 315, 0, 0, 0, 0}
 
uint8_t _sector_width_deg [PROXIMITY_SECTORS_MAX] = {45, 45, 45, 45, 45, 45, 45, 45, 0, 0, 0, 0}
 
float _angle [PROXIMITY_SECTORS_MAX]
 
float _distance [PROXIMITY_SECTORS_MAX]
 
bool _distance_valid [PROXIMITY_SECTORS_MAX]
 
Vector2f _sector_edge_vector [PROXIMITY_SECTORS_MAX]
 
Vector2f _boundary_point [PROXIMITY_SECTORS_MAX]
 

Detailed Description

< for UARTDriver

Definition at line 37 of file AP_Proximity_RPLidarA2.h.

Member Enumeration Documentation

◆ ResponseType

Enumerator
ResponseType_Descriptor 
ResponseType_SCAN 
ResponseType_EXPRESS 
ResponseType_Health 

Definition at line 63 of file AP_Proximity_RPLidarA2.h.

◆ rp_state

Enumerator
rp_unknown 
rp_resetted 
rp_responding 
rp_measurements 
rp_health 

Definition at line 55 of file AP_Proximity_RPLidarA2.h.

Constructor & Destructor Documentation

◆ AP_Proximity_RPLidarA2()

AP_Proximity_RPLidarA2::AP_Proximity_RPLidarA2 ( AP_Proximity _frontend,
AP_Proximity::Proximity_State _state,
AP_SerialManager serial_manager 
)

Definition at line 72 of file AP_Proximity_RPLidarA2.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ detect()

bool AP_Proximity_RPLidarA2::detect ( AP_SerialManager serial_manager)
static

Definition at line 87 of file AP_Proximity_RPLidarA2.cpp.

Referenced by AP_Proximity::detect_instance().

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

◆ distance_max()

float AP_Proximity_RPLidarA2::distance_max ( ) const
virtual

Implements AP_Proximity_Backend.

Definition at line 119 of file AP_Proximity_RPLidarA2.cpp.

◆ distance_min()

float AP_Proximity_RPLidarA2::distance_min ( ) const
virtual

Implements AP_Proximity_Backend.

Definition at line 125 of file AP_Proximity_RPLidarA2.cpp.

Referenced by parse_response_data().

Here is the caller graph for this function:

◆ get_readings()

void AP_Proximity_RPLidarA2::get_readings ( )
private

Definition at line 245 of file AP_Proximity_RPLidarA2.cpp.

Referenced by update().

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

◆ init_sectors()

void AP_Proximity_RPLidarA2::init_sectors ( )
private

Definition at line 162 of file AP_Proximity_RPLidarA2.cpp.

Referenced by initialise().

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

◆ initialise()

bool AP_Proximity_RPLidarA2::initialise ( )
private

Definition at line 130 of file AP_Proximity_RPLidarA2.cpp.

Referenced by update().

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

◆ parse_response_data()

void AP_Proximity_RPLidarA2::parse_response_data ( )
private

Definition at line 390 of file AP_Proximity_RPLidarA2.cpp.

Referenced by get_readings().

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

◆ parse_response_descriptor()

void AP_Proximity_RPLidarA2::parse_response_descriptor ( )
private

Definition at line 362 of file AP_Proximity_RPLidarA2.cpp.

Referenced by get_readings().

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

◆ reset_rplidar()

void AP_Proximity_RPLidarA2::reset_rplidar ( )
private

< be aware of extra 63 bytes coming after reset containing FW information

Definition at line 146 of file AP_Proximity_RPLidarA2.cpp.

Referenced by get_readings(), and initialise().

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

◆ send_request_for_health()

void AP_Proximity_RPLidarA2::send_request_for_health ( )
private

Definition at line 234 of file AP_Proximity_RPLidarA2.cpp.

Here is the call graph for this function:

◆ set_scan_mode()

void AP_Proximity_RPLidarA2::set_scan_mode ( )
private

Definition at line 221 of file AP_Proximity_RPLidarA2.cpp.

Referenced by get_readings().

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

◆ update()

void AP_Proximity_RPLidarA2::update ( void  )
virtual

Implements AP_Proximity_Backend.

Definition at line 93 of file AP_Proximity_RPLidarA2.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _angle_deg_last

float AP_Proximity_RPLidarA2::_angle_deg_last
private

Definition at line 106 of file AP_Proximity_RPLidarA2.h.

Referenced by parse_response_data().

◆ _byte_count

uint16_t AP_Proximity_RPLidarA2::_byte_count
private

Definition at line 95 of file AP_Proximity_RPLidarA2.h.

Referenced by AP_Proximity_RPLidarA2(), and get_readings().

◆ _cnt

uint8_t AP_Proximity_RPLidarA2::_cnt
private

Definition at line 93 of file AP_Proximity_RPLidarA2.h.

Referenced by AP_Proximity_RPLidarA2(), and get_readings().

◆ _descriptor

uint8_t AP_Proximity_RPLidarA2::_descriptor[7]
private

Definition at line 84 of file AP_Proximity_RPLidarA2.h.

Referenced by get_readings(), and parse_response_descriptor().

◆ _descriptor_data

bool AP_Proximity_RPLidarA2::_descriptor_data
private

Definition at line 86 of file AP_Proximity_RPLidarA2.h.

Referenced by get_readings().

◆ _distance_m_last

float AP_Proximity_RPLidarA2::_distance_m_last
private

Definition at line 107 of file AP_Proximity_RPLidarA2.h.

Referenced by parse_response_data().

◆ _information_data

bool AP_Proximity_RPLidarA2::_information_data
private

Definition at line 87 of file AP_Proximity_RPLidarA2.h.

Referenced by get_readings().

◆ _initialised

bool AP_Proximity_RPLidarA2::_initialised
private

Definition at line 89 of file AP_Proximity_RPLidarA2.h.

Referenced by initialise(), and update().

◆ _last_distance_received_ms

uint32_t AP_Proximity_RPLidarA2::_last_distance_received_ms
private

system time of last distance measurement received from sensor

Definition at line 102 of file AP_Proximity_RPLidarA2.h.

Referenced by get_readings(), parse_response_data(), parse_response_descriptor(), and update().

◆ _last_request_ms

uint32_t AP_Proximity_RPLidarA2::_last_request_ms
private

system time of last request

Definition at line 101 of file AP_Proximity_RPLidarA2.h.

Referenced by send_request_for_health(), and set_scan_mode().

◆ _last_reset_ms

uint32_t AP_Proximity_RPLidarA2::_last_reset_ms
private

Definition at line 103 of file AP_Proximity_RPLidarA2.h.

Referenced by reset_rplidar().

◆ _last_sector

uint8_t AP_Proximity_RPLidarA2::_last_sector
private

last sector requested

Definition at line 100 of file AP_Proximity_RPLidarA2.h.

Referenced by parse_response_data().

◆ _payload_length

uint8_t AP_Proximity_RPLidarA2::_payload_length
private

Definition at line 92 of file AP_Proximity_RPLidarA2.h.

Referenced by get_readings(), and parse_response_descriptor().

◆ _resetted

bool AP_Proximity_RPLidarA2::_resetted
private

Definition at line 88 of file AP_Proximity_RPLidarA2.h.

Referenced by reset_rplidar().

◆ _response_type

enum ResponseType AP_Proximity_RPLidarA2::_response_type
private

response from the lidar

Definition at line 98 of file AP_Proximity_RPLidarA2.h.

Referenced by get_readings(), parse_response_data(), and parse_response_descriptor().

◆ _rp_state

enum rp_state AP_Proximity_RPLidarA2::_rp_state
private

◆ _rp_systeminfo

char AP_Proximity_RPLidarA2::_rp_systeminfo[63]
private

Definition at line 85 of file AP_Proximity_RPLidarA2.h.

Referenced by get_readings().

◆ _sector_initialised

bool AP_Proximity_RPLidarA2::_sector_initialised
private

Definition at line 90 of file AP_Proximity_RPLidarA2.h.

Referenced by init_sectors(), and initialise().

◆ _sync_error

uint8_t AP_Proximity_RPLidarA2::_sync_error
private

◆ _uart

AP_HAL::UARTDriver* AP_Proximity_RPLidarA2::_uart
private

◆ payload

union AP_Proximity_RPLidarA2::PACKED AP_Proximity_RPLidarA2::payload
private

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