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

#include <AP_Proximity_LightWareSF40C.h>

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

Public Member Functions

 AP_Proximity_LightWareSF40C (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  RequestType {
  RequestType_None = 0, RequestType_Health, RequestType_MotorSpeed, RequestType_MotorDirection,
  RequestType_ForwardDirection, RequestType_DistanceMeasurement
}
 

Private Member Functions

bool initialise ()
 
void init_sectors ()
 
void set_motor_speed (bool on_off)
 
void set_motor_direction ()
 
void set_forward_direction ()
 
void request_new_data ()
 
void send_request_for_health ()
 
bool send_request_for_distance ()
 
bool check_for_reply ()
 
bool process_reply ()
 
void clear_buffers ()
 

Private Attributes

AP_HAL::UARTDriveruart = nullptr
 
char element_buf [2][10]
 
uint8_t element_len [2]
 
uint8_t element_num
 
bool ignore_reply
 
bool wait_for_space
 
enum RequestType _last_request_type
 
uint8_t _last_sector
 
uint32_t _last_request_ms
 
uint32_t _last_distance_received_ms
 
uint8_t _request_count
 
union {
   struct PACKED {
      uint16_t   motor_stopped: 1
 
      uint16_t   motor_dir: 1
 
      uint16_t   motor_fault: 1
 
      uint16_t   torque_control: 1
 
      uint16_t   laser_fault: 1
 
      uint16_t   low_battery: 1
 
      uint16_t   flat_battery: 1
 
      uint16_t   system_restarting: 1
 
      uint16_t   no_results_available: 1
 
      uint16_t   power_saving: 1
 
      uint16_t   user_flag1: 1
 
      uint16_t   user_flag2: 1
 
      uint16_t   unused1: 1
 
      uint16_t   unused2: 1
 
      uint16_t   spare_input: 1
 
      uint16_t   major_system_abnormal: 1
 
   }   _flags
 
   uint16_t   value
 
_sensor_status
 
uint8_t _motor_speed
 
uint8_t _motor_direction = 99
 
int16_t _forward_direction = 999
 
bool _sector_initialised = false
 

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

Definition at line 8 of file AP_Proximity_LightWareSF40C.h.

Member Enumeration Documentation

◆ RequestType

Enumerator
RequestType_None 
RequestType_Health 
RequestType_MotorSpeed 
RequestType_MotorDirection 
RequestType_ForwardDirection 
RequestType_DistanceMeasurement 

Definition at line 27 of file AP_Proximity_LightWareSF40C.h.

Constructor & Destructor Documentation

◆ AP_Proximity_LightWareSF40C()

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

Definition at line 29 of file AP_Proximity_LightWareSF40C.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ check_for_reply()

bool AP_Proximity_LightWareSF40C::check_for_reply ( )
private

Definition at line 304 of file AP_Proximity_LightWareSF40C.cpp.

Referenced by update().

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

◆ clear_buffers()

void AP_Proximity_LightWareSF40C::clear_buffers ( )
private

Definition at line 439 of file AP_Proximity_LightWareSF40C.cpp.

Referenced by check_for_reply().

Here is the caller graph for this function:

◆ detect()

bool AP_Proximity_LightWareSF40C::detect ( AP_SerialManager serial_manager)
static

Definition at line 41 of file AP_Proximity_LightWareSF40C.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_LightWareSF40C::distance_max ( ) const
virtual

Implements AP_Proximity_Backend.

Definition at line 73 of file AP_Proximity_LightWareSF40C.cpp.

◆ distance_min()

float AP_Proximity_LightWareSF40C::distance_min ( ) const
virtual

Implements AP_Proximity_Backend.

Definition at line 77 of file AP_Proximity_LightWareSF40C.cpp.

◆ init_sectors()

void AP_Proximity_LightWareSF40C::init_sectors ( )
private

Definition at line 113 of file AP_Proximity_LightWareSF40C.cpp.

Referenced by initialise().

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

◆ initialise()

bool AP_Proximity_LightWareSF40C::initialise ( )
private

Definition at line 83 of file AP_Proximity_LightWareSF40C.cpp.

Referenced by update().

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

◆ process_reply()

bool AP_Proximity_LightWareSF40C::process_reply ( )
private

Definition at line 371 of file AP_Proximity_LightWareSF40C.cpp.

Referenced by check_for_reply().

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

◆ request_new_data()

void AP_Proximity_LightWareSF40C::request_new_data ( )
private

Definition at line 236 of file AP_Proximity_LightWareSF40C.cpp.

Referenced by update().

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

◆ send_request_for_distance()

bool AP_Proximity_LightWareSF40C::send_request_for_distance ( )
private

Definition at line 276 of file AP_Proximity_LightWareSF40C.cpp.

Referenced by request_new_data().

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

◆ send_request_for_health()

void AP_Proximity_LightWareSF40C::send_request_for_health ( )
private

Definition at line 264 of file AP_Proximity_LightWareSF40C.cpp.

Referenced by request_new_data().

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

◆ set_forward_direction()

void AP_Proximity_LightWareSF40C::set_forward_direction ( )
private

Definition at line 215 of file AP_Proximity_LightWareSF40C.cpp.

Referenced by initialise().

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

◆ set_motor_direction()

void AP_Proximity_LightWareSF40C::set_motor_direction ( )
private

Definition at line 194 of file AP_Proximity_LightWareSF40C.cpp.

Referenced by initialise().

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

◆ set_motor_speed()

void AP_Proximity_LightWareSF40C::set_motor_speed ( bool  on_off)
private

Definition at line 173 of file AP_Proximity_LightWareSF40C.cpp.

Referenced by initialise().

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

◆ update()

void AP_Proximity_LightWareSF40C::update ( void  )
virtual

Implements AP_Proximity_Backend.

Definition at line 47 of file AP_Proximity_LightWareSF40C.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _flags

struct { ... } ::PACKED AP_Proximity_LightWareSF40C::_flags

◆ _forward_direction

int16_t AP_Proximity_LightWareSF40C::_forward_direction = 999
private

Definition at line 94 of file AP_Proximity_LightWareSF40C.h.

Referenced by initialise(), and process_reply().

◆ _last_distance_received_ms

uint32_t AP_Proximity_LightWareSF40C::_last_distance_received_ms
private

Definition at line 65 of file AP_Proximity_LightWareSF40C.h.

Referenced by process_reply(), and update().

◆ _last_request_ms

uint32_t AP_Proximity_LightWareSF40C::_last_request_ms
private

◆ _last_request_type

enum RequestType AP_Proximity_LightWareSF40C::_last_request_type
private

◆ _last_sector

uint8_t AP_Proximity_LightWareSF40C::_last_sector
private

Definition at line 63 of file AP_Proximity_LightWareSF40C.h.

Referenced by send_request_for_distance().

◆ _motor_direction

uint8_t AP_Proximity_LightWareSF40C::_motor_direction = 99
private

Definition at line 93 of file AP_Proximity_LightWareSF40C.h.

Referenced by initialise(), and process_reply().

◆ _motor_speed

uint8_t AP_Proximity_LightWareSF40C::_motor_speed
private

Definition at line 92 of file AP_Proximity_LightWareSF40C.h.

Referenced by initialise(), and process_reply().

◆ _request_count

uint8_t AP_Proximity_LightWareSF40C::_request_count
private

Definition at line 66 of file AP_Proximity_LightWareSF40C.h.

Referenced by request_new_data().

◆ _sector_initialised

bool AP_Proximity_LightWareSF40C::_sector_initialised = false
private

Definition at line 95 of file AP_Proximity_LightWareSF40C.h.

Referenced by init_sectors(), and initialise().

◆ _sensor_status

union { ... } AP_Proximity_LightWareSF40C::_sensor_status

Referenced by process_reply().

◆ element_buf

char AP_Proximity_LightWareSF40C::element_buf[2][10]
private

Definition at line 55 of file AP_Proximity_LightWareSF40C.h.

Referenced by check_for_reply(), clear_buffers(), and process_reply().

◆ element_len

uint8_t AP_Proximity_LightWareSF40C::element_len[2]
private

Definition at line 56 of file AP_Proximity_LightWareSF40C.h.

Referenced by check_for_reply(), clear_buffers(), and process_reply().

◆ element_num

uint8_t AP_Proximity_LightWareSF40C::element_num
private

Definition at line 57 of file AP_Proximity_LightWareSF40C.h.

Referenced by check_for_reply(), and clear_buffers().

◆ flat_battery

uint16_t AP_Proximity_LightWareSF40C::flat_battery

Definition at line 77 of file AP_Proximity_LightWareSF40C.h.

◆ ignore_reply

bool AP_Proximity_LightWareSF40C::ignore_reply
private

Definition at line 58 of file AP_Proximity_LightWareSF40C.h.

Referenced by check_for_reply().

◆ laser_fault

uint16_t AP_Proximity_LightWareSF40C::laser_fault

Definition at line 75 of file AP_Proximity_LightWareSF40C.h.

◆ low_battery

uint16_t AP_Proximity_LightWareSF40C::low_battery

Definition at line 76 of file AP_Proximity_LightWareSF40C.h.

◆ major_system_abnormal

uint16_t AP_Proximity_LightWareSF40C::major_system_abnormal

Definition at line 86 of file AP_Proximity_LightWareSF40C.h.

◆ motor_dir

uint16_t AP_Proximity_LightWareSF40C::motor_dir

Definition at line 72 of file AP_Proximity_LightWareSF40C.h.

◆ motor_fault

uint16_t AP_Proximity_LightWareSF40C::motor_fault

Definition at line 73 of file AP_Proximity_LightWareSF40C.h.

◆ motor_stopped

uint16_t AP_Proximity_LightWareSF40C::motor_stopped

Definition at line 71 of file AP_Proximity_LightWareSF40C.h.

◆ no_results_available

uint16_t AP_Proximity_LightWareSF40C::no_results_available

Definition at line 79 of file AP_Proximity_LightWareSF40C.h.

◆ power_saving

uint16_t AP_Proximity_LightWareSF40C::power_saving

Definition at line 80 of file AP_Proximity_LightWareSF40C.h.

◆ spare_input

uint16_t AP_Proximity_LightWareSF40C::spare_input

Definition at line 85 of file AP_Proximity_LightWareSF40C.h.

◆ system_restarting

uint16_t AP_Proximity_LightWareSF40C::system_restarting

Definition at line 78 of file AP_Proximity_LightWareSF40C.h.

◆ torque_control

uint16_t AP_Proximity_LightWareSF40C::torque_control

Definition at line 74 of file AP_Proximity_LightWareSF40C.h.

◆ uart

AP_HAL::UARTDriver* AP_Proximity_LightWareSF40C::uart = nullptr
private

◆ unused1

uint16_t AP_Proximity_LightWareSF40C::unused1

Definition at line 83 of file AP_Proximity_LightWareSF40C.h.

◆ unused2

uint16_t AP_Proximity_LightWareSF40C::unused2

Definition at line 84 of file AP_Proximity_LightWareSF40C.h.

◆ user_flag1

uint16_t AP_Proximity_LightWareSF40C::user_flag1

Definition at line 81 of file AP_Proximity_LightWareSF40C.h.

◆ user_flag2

uint16_t AP_Proximity_LightWareSF40C::user_flag2

Definition at line 82 of file AP_Proximity_LightWareSF40C.h.

◆ value

uint16_t AP_Proximity_LightWareSF40C::value

Definition at line 88 of file AP_Proximity_LightWareSF40C.h.

◆ wait_for_space

bool AP_Proximity_LightWareSF40C::wait_for_space
private

Definition at line 59 of file AP_Proximity_LightWareSF40C.h.

Referenced by check_for_reply().


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