PX4 Firmware
PX4 Autopilot Software http://px4.io
TFMINI Class Reference

#include <TFMINI.hpp>

Inheritance diagram for TFMINI:
Collaboration diagram for TFMINI:

Public Member Functions

 TFMINI (const char *port, uint8_t rotation=distance_sensor_s::ROTATION_DOWNWARD_FACING)
 
virtual ~TFMINI ()
 
int init ()
 
void print_info ()
 

Private Member Functions

int collect ()
 
void Run () override
 
void start ()
 
void stop ()
 

Private Attributes

PX4Rangefinder _px4_rangefinder
 
TFMINI_PARSE_STATE _parse_state {TFMINI_PARSE_STATE::STATE0_UNSYNC}
 
char _linebuf [10] {}
 
char _port [20] {}
 
int _fd {-1}
 
unsigned int _linebuf_index {0}
 
hrt_abstime _last_read {0}
 
perf_counter_t _comms_errors {perf_alloc(PC_COUNT, MODULE_NAME": com_err")}
 
perf_counter_t _sample_perf {perf_alloc(PC_ELAPSED, MODULE_NAME": read")}
 

Static Private Attributes

static constexpr int kCONVERSIONINTERVAL {9_ms}
 

Detailed Description

Definition at line 63 of file TFMINI.hpp.

Constructor & Destructor Documentation

◆ TFMINI()

TFMINI::TFMINI ( const char *  port,
uint8_t  rotation = distance_sensor_s::ROTATION_DOWNWARD_FACING 
)

Definition at line 36 of file TFMINI.cpp.

References _port.

◆ ~TFMINI()

TFMINI::~TFMINI ( )
virtual

Definition at line 47 of file TFMINI.cpp.

References _comms_errors, _sample_perf, perf_free(), and stop().

Here is the call graph for this function:

Member Function Documentation

◆ collect()

int TFMINI::collect ( )
private

Definition at line 151 of file TFMINI.cpp.

References _comms_errors, _fd, _last_read, _linebuf, _linebuf_index, _parse_state, _px4_rangefinder, _sample_perf, f(), hrt_absolute_time(), hrt_abstime, hrt_elapsed_time(), kCONVERSIONINTERVAL, perf_begin(), perf_count(), perf_end(), read(), tfmini_parse(), and PX4Rangefinder::update().

Referenced by Run().

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

◆ init()

int TFMINI::init ( )

Definition at line 57 of file TFMINI.cpp.

References _fd, _port, _px4_rangefinder, f(), math::radians(), PX4Rangefinder::set_fov(), PX4Rangefinder::set_max_distance(), PX4Rangefinder::set_min_distance(), and start().

Referenced by tfmini::start().

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

◆ print_info()

void TFMINI::print_info ( )

Definition at line 255 of file TFMINI.cpp.

References _comms_errors, _port, _px4_rangefinder, _sample_perf, perf_print_counter(), and PX4Rangefinder::print_status().

Referenced by tfmini::status().

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

◆ Run()

void TFMINI::Run ( )
overrideprivate

Definition at line 237 of file TFMINI.cpp.

References _fd, _port, and collect().

Here is the call graph for this function:

◆ start()

void TFMINI::start ( )
private

Definition at line 224 of file TFMINI.cpp.

Referenced by init().

Here is the caller graph for this function:

◆ stop()

void TFMINI::stop ( )
private

Definition at line 231 of file TFMINI.cpp.

Referenced by ~TFMINI().

Here is the caller graph for this function:

Member Data Documentation

◆ _comms_errors

perf_counter_t TFMINI::_comms_errors {perf_alloc(PC_COUNT, MODULE_NAME": com_err")}
private

Definition at line 97 of file TFMINI.hpp.

Referenced by collect(), print_info(), and ~TFMINI().

◆ _fd

int TFMINI::_fd {-1}
private

Definition at line 91 of file TFMINI.hpp.

Referenced by collect(), init(), and Run().

◆ _last_read

hrt_abstime TFMINI::_last_read {0}
private

Definition at line 95 of file TFMINI.hpp.

Referenced by collect().

◆ _linebuf

char TFMINI::_linebuf[10] {}
private

Definition at line 86 of file TFMINI.hpp.

Referenced by collect().

◆ _linebuf_index

unsigned int TFMINI::_linebuf_index {0}
private

Definition at line 93 of file TFMINI.hpp.

Referenced by collect().

◆ _parse_state

TFMINI_PARSE_STATE TFMINI::_parse_state {TFMINI_PARSE_STATE::STATE0_UNSYNC}
private

Definition at line 84 of file TFMINI.hpp.

Referenced by collect().

◆ _port

char TFMINI::_port[20] {}
private

Definition at line 87 of file TFMINI.hpp.

Referenced by init(), print_info(), Run(), and TFMINI().

◆ _px4_rangefinder

PX4Rangefinder TFMINI::_px4_rangefinder
private

Definition at line 82 of file TFMINI.hpp.

Referenced by collect(), init(), and print_info().

◆ _sample_perf

perf_counter_t TFMINI::_sample_perf {perf_alloc(PC_ELAPSED, MODULE_NAME": read")}
private

Definition at line 98 of file TFMINI.hpp.

Referenced by collect(), print_info(), and ~TFMINI().

◆ kCONVERSIONINTERVAL

constexpr int TFMINI::kCONVERSIONINTERVAL {9_ms}
staticprivate

Definition at line 89 of file TFMINI.hpp.

Referenced by collect().


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