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

#include <PX4Rangefinder.hpp>

Inheritance diagram for PX4Rangefinder:
Collaboration diagram for PX4Rangefinder:

Public Member Functions

 PX4Rangefinder (const uint32_t device_id, const uint8_t priority=ORB_PRIO_DEFAULT, const uint8_t device_orientation=distance_sensor_s::ROTATION_DOWNWARD_FACING)
 
 ~PX4Rangefinder () override
 
void print_status ()
 
void set_device_type (uint8_t device_type)
 
void set_device_id (const uint8_t device_id)
 
void set_fov (const float fov)
 
void set_hfov (const float fov)
 
void set_vfov (const float fov)
 
void set_max_distance (const float distance)
 
void set_min_distance (const float distance)
 
void set_orientation (const uint8_t device_orientation=distance_sensor_s::ROTATION_DOWNWARD_FACING)
 
void update (const hrt_abstime timestamp, const float distance, const int8_t quality=-1)
 
- Public Member Functions inherited from cdev::CDev
 CDev (const char *devname)
 Constructor. More...
 
 CDev (const CDev &)=delete
 
CDevoperator= (const CDev &)=delete
 
 CDev (CDev &&)=delete
 
CDevoperator= (CDev &&)=delete
 
virtual ~CDev ()
 
virtual int init ()
 
virtual int open (file_t *filep)
 Handle an open of the device. More...
 
virtual int close (file_t *filep)
 Handle a close of the device. More...
 
virtual ssize_t read (file_t *filep, char *buffer, size_t buflen)
 Perform a read from the device. More...
 
virtual ssize_t write (file_t *filep, const char *buffer, size_t buflen)
 Perform a write to the device. More...
 
virtual off_t seek (file_t *filep, off_t offset, int whence)
 Perform a logical seek operation on the device. More...
 
virtual int ioctl (file_t *filep, int cmd, unsigned long arg)
 Perform an ioctl operation on the device. More...
 
virtual int poll (file_t *filep, px4_pollfd_struct_t *fds, bool setup)
 Perform a poll setup/teardown operation. More...
 
const char * get_devname () const
 Get the device name. More...
 

Private Attributes

uORB::PublicationMultiData< distance_sensor_s_distance_sensor_pub
 
int _class_device_instance {-1}
 

Additional Inherited Members

- Protected Member Functions inherited from cdev::CDev
virtual pollevent_t poll_state (file_t *filep)
 Check the current state of the device for poll events from the perspective of the file. More...
 
virtual void poll_notify (pollevent_t events)
 Report new poll events. More...
 
virtual void poll_notify_one (px4_pollfd_struct_t *fds, pollevent_t events)
 Internal implementation of poll_notify. More...
 
virtual int open_first (file_t *filep)
 Notification of the first open. More...
 
virtual int close_last (file_t *filep)
 Notification of the last close. More...
 
virtual int register_class_devname (const char *class_devname)
 Register a class device name, automatically adding device class instance suffix if need be. More...
 
virtual int unregister_class_devname (const char *class_devname, unsigned class_instance)
 Register a class device name, automatically adding device class instance suffix if need be. More...
 
void lock ()
 Take the driver lock. More...
 
void unlock ()
 Release the driver lock. More...
 
int unregister_driver_and_memory ()
 First, unregisters the driver. More...
 
- Protected Attributes inherited from cdev::CDev
px4_sem_t _lock
 lock to protect access to all class members (also for derived classes) More...
 
- Static Protected Attributes inherited from cdev::CDev
static const px4_file_operations_t fops = {}
 Pointer to the default cdev file operations table; useful for registering clone devices etc. More...
 

Detailed Description

Definition at line 44 of file PX4Rangefinder.hpp.

Constructor & Destructor Documentation

◆ PX4Rangefinder()

PX4Rangefinder::PX4Rangefinder ( const uint32_t  device_id,
const uint8_t  priority = ORB_PRIO_DEFAULT,
const uint8_t  device_orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING 
)

Definition at line 38 of file PX4Rangefinder.cpp.

References _class_device_instance, device_id, ORB_ID, RANGE_FINDER_BASE_DEVICE_PATH, cdev::CDev::register_class_devname(), set_device_id(), and set_orientation().

Here is the call graph for this function:

◆ ~PX4Rangefinder()

PX4Rangefinder::~PX4Rangefinder ( )
override

Definition at line 48 of file PX4Rangefinder.cpp.

References _class_device_instance, RANGE_FINDER_BASE_DEVICE_PATH, and cdev::CDev::unregister_class_devname().

Here is the call graph for this function:

Member Function Documentation

◆ print_status()

void PX4Rangefinder::print_status ( )

Definition at line 97 of file PX4Rangefinder.cpp.

References _class_device_instance, _distance_sensor_pub, uORB::PublicationMultiData< T >::get(), and RANGE_FINDER_BASE_DEVICE_PATH.

Referenced by TFMINI::print_info(), and CM8JL65::print_info().

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

◆ set_device_id()

void PX4Rangefinder::set_device_id ( const uint8_t  device_id)
inline

Definition at line 58 of file PX4Rangefinder.hpp.

References _distance_sensor_pub, device_id, uORB::PublicationMultiData< T >::get(), and distance_sensor_s::id.

Referenced by PX4Rangefinder().

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

◆ set_device_type()

void PX4Rangefinder::set_device_type ( uint8_t  device_type)

Definition at line 56 of file PX4Rangefinder.cpp.

Referenced by LeddarOne::LeddarOne().

Here is the caller graph for this function:

◆ set_fov()

void PX4Rangefinder::set_fov ( const float  fov)
inline

Definition at line 60 of file PX4Rangefinder.hpp.

References set_hfov(), and set_vfov().

Referenced by CM8JL65::CM8JL65(), TFMINI::init(), LeddarOne::LeddarOne(), and LidarLite::LidarLite().

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

◆ set_hfov()

void PX4Rangefinder::set_hfov ( const float  fov)
inline

Definition at line 61 of file PX4Rangefinder.hpp.

References _distance_sensor_pub, uORB::PublicationMultiData< T >::get(), and distance_sensor_s::h_fov.

Referenced by set_fov().

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

◆ set_max_distance()

void PX4Rangefinder::set_max_distance ( const float  distance)
inline

Definition at line 64 of file PX4Rangefinder.hpp.

References _distance_sensor_pub, uORB::PublicationMultiData< T >::get(), and distance_sensor_s::max_distance.

Referenced by CM8JL65::CM8JL65(), TFMINI::init(), LeddarOne::LeddarOne(), LidarLite::LidarLite(), and LidarLiteI2C::probe().

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

◆ set_min_distance()

void PX4Rangefinder::set_min_distance ( const float  distance)
inline

Definition at line 65 of file PX4Rangefinder.hpp.

References _distance_sensor_pub, uORB::PublicationMultiData< T >::get(), hrt_abstime, distance_sensor_s::min_distance, set_orientation(), and update().

Referenced by CM8JL65::CM8JL65(), TFMINI::init(), LeddarOne::LeddarOne(), and LidarLite::LidarLite().

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

◆ set_orientation()

void PX4Rangefinder::set_orientation ( const uint8_t  device_orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING)

Definition at line 72 of file PX4Rangefinder.cpp.

References _distance_sensor_pub, uORB::PublicationMultiData< T >::get(), and distance_sensor_s::orientation.

Referenced by LeddarOne::LeddarOne(), PX4Rangefinder(), and set_min_distance().

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

◆ set_vfov()

void PX4Rangefinder::set_vfov ( const float  fov)
inline

Definition at line 62 of file PX4Rangefinder.hpp.

References _distance_sensor_pub, uORB::PublicationMultiData< T >::get(), and distance_sensor_s::v_fov.

Referenced by set_fov().

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

◆ update()

void PX4Rangefinder::update ( const hrt_abstime  timestamp,
const float  distance,
const int8_t  quality = -1 
)

Definition at line 78 of file PX4Rangefinder.cpp.

References _distance_sensor_pub, distance_sensor_s::current_distance, uORB::PublicationMultiData< T >::get(), distance_sensor_s::max_distance, distance_sensor_s::min_distance, distance_sensor_s::signal_quality, distance_sensor_s::timestamp, and uORB::PublicationMultiData< T >::update().

Referenced by TFMINI::collect(), CM8JL65::collect(), LidarLiteI2C::collect(), LeddarOne::collect(), LidarLitePWM::measure(), and set_min_distance().

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

Member Data Documentation

◆ _class_device_instance

int PX4Rangefinder::_class_device_instance {-1}
private

Definition at line 75 of file PX4Rangefinder.hpp.

Referenced by print_status(), PX4Rangefinder(), and ~PX4Rangefinder().

◆ _distance_sensor_pub


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