mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
PX4Rangerfinder: delete unused CDev
This commit is contained in:
parent
5739cf27e5
commit
cc62a52553
@ -33,6 +33,8 @@
|
||||
|
||||
#include "CM8JL65.hpp"
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
static constexpr unsigned char crc_msb_vector[] = {
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
|
||||
#include "LeddarOne.hpp"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
|
||||
#include "SF0X.hpp"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
|
||||
/* Configuration Constants */
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
|
||||
#include "TFMINI.hpp"
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
TFMINI::TFMINI(const char *port, uint8_t rotation) :
|
||||
ScheduledWorkItem(MODULE_NAME, px4::serial_port_to_wq(port)),
|
||||
_px4_rangefinder(0 /* TODO: device id */, ORB_PRIO_DEFAULT, rotation)
|
||||
|
||||
@ -36,24 +36,13 @@
|
||||
#include <lib/drivers/device/Device.hpp>
|
||||
|
||||
PX4Rangefinder::PX4Rangefinder(const uint32_t device_id, const uint8_t priority, const uint8_t device_orientation) :
|
||||
CDev(nullptr),
|
||||
_distance_sensor_pub{ORB_ID(distance_sensor), priority}
|
||||
{
|
||||
_class_device_instance = register_class_devname(RANGE_FINDER_BASE_DEVICE_PATH);
|
||||
|
||||
set_device_id(device_id);
|
||||
set_orientation(device_orientation);
|
||||
}
|
||||
|
||||
PX4Rangefinder::~PX4Rangefinder()
|
||||
{
|
||||
if (_class_device_instance != -1) {
|
||||
unregister_class_devname(RANGE_FINDER_BASE_DEVICE_PATH, _class_device_instance);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PX4Rangefinder::set_device_type(uint8_t device_type)
|
||||
void PX4Rangefinder::set_device_type(uint8_t device_type)
|
||||
{
|
||||
// TODO: range finders should have device ids
|
||||
|
||||
@ -68,18 +57,16 @@ PX4Rangefinder::set_device_type(uint8_t device_type)
|
||||
// _distance_sensor_pub.get().device_id = device_id.devid;
|
||||
}
|
||||
|
||||
void
|
||||
PX4Rangefinder::set_orientation(const uint8_t device_orientation)
|
||||
void PX4Rangefinder::set_orientation(const uint8_t device_orientation)
|
||||
{
|
||||
_distance_sensor_pub.get().orientation = device_orientation;
|
||||
}
|
||||
|
||||
void
|
||||
PX4Rangefinder::update(const hrt_abstime timestamp, const float distance, const int8_t quality)
|
||||
void PX4Rangefinder::update(const hrt_abstime ×tamp_sample, const float distance, const int8_t quality)
|
||||
{
|
||||
distance_sensor_s &report = _distance_sensor_pub.get();
|
||||
|
||||
report.timestamp = timestamp;
|
||||
report.timestamp = timestamp_sample;
|
||||
report.current_distance = distance;
|
||||
report.signal_quality = quality;
|
||||
|
||||
@ -93,10 +80,6 @@ PX4Rangefinder::update(const hrt_abstime timestamp, const float distance, const
|
||||
_distance_sensor_pub.update();
|
||||
}
|
||||
|
||||
void
|
||||
PX4Rangefinder::print_status()
|
||||
void PX4Rangefinder::print_status()
|
||||
{
|
||||
PX4_INFO(RANGE_FINDER_BASE_DEVICE_PATH " device instance: %d", _class_device_instance);
|
||||
|
||||
print_message(_distance_sensor_pub.get());
|
||||
}
|
||||
|
||||
@ -35,20 +35,18 @@
|
||||
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <drivers/drv_range_finder.h>
|
||||
#include <lib/cdev/CDev.hpp>
|
||||
#include <lib/conversion/rotation.h>
|
||||
#include <uORB/uORB.h>
|
||||
#include <uORB/PublicationMulti.hpp>
|
||||
#include <uORB/topics/distance_sensor.h>
|
||||
|
||||
class PX4Rangefinder : public cdev::CDev
|
||||
class PX4Rangefinder
|
||||
{
|
||||
|
||||
public:
|
||||
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;
|
||||
~PX4Rangefinder() = default;
|
||||
|
||||
void print_status();
|
||||
|
||||
@ -66,12 +64,10 @@ public:
|
||||
|
||||
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);
|
||||
void update(const hrt_abstime ×tamp_sample, const float distance, const int8_t quality = -1);
|
||||
|
||||
private:
|
||||
|
||||
uORB::PublicationMultiData<distance_sensor_s> _distance_sensor_pub;
|
||||
|
||||
int _class_device_instance{-1};
|
||||
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user