px4_work_queue: command line status output and shutdown empty queues

* adds a work_queue systemcmd that will bring a tree view of all active work queues and work items
 * WorkQueues now track attached WorkItems and will shutdown when the last WorkItem is detached
This commit is contained in:
Daniel Agar
2019-10-02 12:23:17 -04:00
committed by GitHub
parent cc1d86bc0b
commit 26364d44c9
167 changed files with 582 additions and 274 deletions
@@ -84,7 +84,7 @@ static constexpr unsigned char crc_lsb_vector[] = {
};
CM8JL65::CM8JL65(const char *port, uint8_t rotation) :
ScheduledWorkItem(px4::wq_configurations::hp_default),
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default),
_px4_rangefinder(0 /* TODO: device ids */, ORB_PRIO_DEFAULT, rotation)
{
// Store the port name.
@@ -174,7 +174,7 @@ private:
LeddarOne::LeddarOne(const char *device_path, const char *serial_port, uint8_t device_orientation):
CDev(device_path),
ScheduledWorkItem(px4::wq_configurations::hp_default),
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default),
_px4_rangefinder(0 /* device id not yet used */, ORB_PRIO_DEFAULT, device_orientation)
{
_serial_port = strdup(serial_port);
@@ -52,7 +52,6 @@ LidarLite::LidarLite(const uint8_t rotation) :
LidarLite::~LidarLite()
{
perf_free(_sample_perf);
perf_free(_sample_interval_perf);
perf_free(_comms_errors);
perf_free(_sensor_resets);
perf_free(_sensor_zero_resets);
@@ -62,7 +61,6 @@ void
LidarLite::print_info()
{
perf_print_counter(_sample_perf);
perf_print_counter(_sample_interval_perf);
perf_print_counter(_comms_errors);
perf_print_counter(_sensor_resets);
perf_print_counter(_sensor_zero_resets);
@@ -90,7 +90,6 @@ protected:
PX4Rangefinder _px4_rangefinder;
perf_counter_t _comms_errors{perf_alloc(PC_COUNT, "ll40ls: comms errors")};
perf_counter_t _sample_interval_perf{perf_alloc(PC_ELAPSED, "ll40ls: interval")};
perf_counter_t _sample_perf{perf_alloc(PC_ELAPSED, "ll40ls: read")};
perf_counter_t _sensor_resets{perf_alloc(PC_COUNT, "ll40ls: resets")};
perf_counter_t _sensor_zero_resets{perf_alloc(PC_COUNT, "ll40ls: zero resets")};
@@ -44,7 +44,7 @@
LidarLiteI2C::LidarLiteI2C(const int bus, const uint8_t rotation, const int address) :
LidarLite(rotation),
I2C("LL40LS", nullptr, bus, address, 100000),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id()))
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id()))
{
// up the retries since the device misses the first measure attempts
_retries = 3;
@@ -46,7 +46,7 @@
LidarLitePWM::LidarLitePWM(const uint8_t rotation) :
LidarLite(rotation),
ScheduledWorkItem(px4::wq_configurations::hp_default)
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default)
{
}
@@ -225,7 +225,7 @@ private:
MappyDot::MappyDot(const int bus) :
I2C("MappyDot", MAPPYDOT_DEVICE_PATH, bus, MAPPYDOT_BASE_ADDR, MAPPYDOT_BUS_CLOCK),
ModuleParams(nullptr),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id()))
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id()))
{}
MappyDot::~MappyDot()
@@ -181,7 +181,7 @@ private:
MB12XX::MB12XX(const int bus) :
I2C("MB12xx", MB12XX_DEVICE_PATH, bus, MB12XX_BASE_ADDR, MB12XX_BUS_SPEED),
ModuleParams(nullptr),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id()))
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id()))
{
}
+1 -1
View File
@@ -157,7 +157,7 @@ extern "C" __EXPORT int sf0x_main(int argc, char *argv[]);
SF0X::SF0X(const char *port, uint8_t rotation) :
CDev(RANGE_FINDER0_DEVICE_PATH),
ScheduledWorkItem(px4::wq_configurations::hp_default),
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default),
_rotation(rotation),
_min_distance(0.30f),
_max_distance(40.0f),
+1 -1
View File
@@ -167,7 +167,7 @@ extern "C" __EXPORT int sf1xx_main(int argc, char *argv[]);
SF1XX::SF1XX(uint8_t rotation, int bus, int address) :
I2C("SF1XX", SF1XX_DEVICE_PATH, bus, address, 400000),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_rotation(rotation)
{
}
+1 -1
View File
@@ -172,7 +172,7 @@ extern "C" __EXPORT int srf02_main(int argc, char *argv[]);
SRF02::SRF02(uint8_t rotation, int bus, int address) :
I2C("SRF02", SRF02_DEVICE_PATH, bus, address, 100000),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_rotation(rotation)
{
}
@@ -192,7 +192,7 @@ static uint8_t crc8(uint8_t *p, uint8_t len)
TERARANGER::TERARANGER(const int bus, const uint8_t orientation, const int address) :
I2C("TERARANGER", TERARANGER_DEVICE_PATH, bus, address, 100000),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_orientation(orientation)
{
// up the retries since the device misses the first measure attempts
@@ -34,7 +34,7 @@
#include "TFMINI.hpp"
TFMINI::TFMINI(const char *port, uint8_t rotation) :
ScheduledWorkItem(px4::wq_configurations::hp_default),
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default),
_px4_rangefinder(0 /* TODO: device id */, ORB_PRIO_DEFAULT, rotation)
{
// store port name
@@ -172,7 +172,7 @@ private:
Radar::Radar(const char *port, uint8_t rotation) :
CDev(RANGE_FINDER0_DEVICE_PATH),
ScheduledWorkItem(px4::wq_configurations::hp_default),
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default),
_rotation(rotation)
{
/* store port name */
@@ -167,7 +167,7 @@ private:
VL53LXX::VL53LXX(uint8_t rotation, int bus, int address) :
I2C("VL53LXX", VL53LXX_DEVICE_PATH, bus, address, 400000),
ScheduledWorkItem(px4::device_bus_to_wq(get_device_id())),
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(get_device_id())),
_rotation(rotation)
{
// Allow 3 retries as the device typically misses the first measure attempts.