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
+2 -2
View File
@@ -53,6 +53,6 @@ px4_add_module(
git_ecl
ecl_validation
mathlib
sensors__vehicle_acceleration
sensors__vehicle_angular_velocity
vehicle_acceleration
vehicle_angular_velocity
)
@@ -31,7 +31,7 @@
#
############################################################################
px4_add_library(sensors__vehicle_acceleration
px4_add_library(vehicle_acceleration
VehicleAcceleration.cpp
)
target_link_libraries(sensors__vehicle_acceleration PRIVATE px4_work_queue)
target_link_libraries(vehicle_acceleration PRIVATE px4_work_queue)
@@ -40,9 +40,8 @@ using namespace time_literals;
VehicleAcceleration::VehicleAcceleration() :
ModuleParams(nullptr),
WorkItem(px4::wq_configurations::att_pos_ctrl),
WorkItem(MODULE_NAME, px4::wq_configurations::att_pos_ctrl),
_cycle_perf(perf_alloc(PC_ELAPSED, "vehicle_acceleration: cycle time")),
_interval_perf(perf_alloc(PC_INTERVAL, "vehicle_acceleration: interval")),
_sensor_latency_perf(perf_alloc(PC_ELAPSED, "vehicle_acceleration: sensor latency"))
{
}
@@ -52,7 +51,6 @@ VehicleAcceleration::~VehicleAcceleration()
Stop();
perf_free(_cycle_perf);
perf_free(_interval_perf);
perf_free(_sensor_latency_perf);
}
@@ -178,7 +176,6 @@ void
VehicleAcceleration::Run()
{
perf_begin(_cycle_perf);
perf_count(_interval_perf);
// update corrections first to set _selected_sensor
SensorCorrectionsUpdate();
@@ -220,6 +217,5 @@ VehicleAcceleration::PrintStatus()
PX4_INFO("selected sensor: %d", _selected_sensor);
perf_print_counter(_cycle_perf);
perf_print_counter(_interval_perf);
perf_print_counter(_sensor_latency_perf);
}
@@ -102,7 +102,6 @@ private:
matrix::Vector3f _bias;
perf_counter_t _cycle_perf;
perf_counter_t _interval_perf;
perf_counter_t _sensor_latency_perf;
uint8_t _selected_sensor{0};
@@ -31,7 +31,7 @@
#
############################################################################
px4_add_library(sensors__vehicle_angular_velocity
px4_add_library(vehicle_angular_velocity
VehicleAngularVelocity.cpp
)
target_link_libraries(sensors__vehicle_angular_velocity PRIVATE px4_work_queue)
target_link_libraries(vehicle_angular_velocity PRIVATE px4_work_queue)
@@ -40,9 +40,8 @@ using namespace time_literals;
VehicleAngularVelocity::VehicleAngularVelocity() :
ModuleParams(nullptr),
WorkItem(px4::wq_configurations::rate_ctrl),
WorkItem(MODULE_NAME, px4::wq_configurations::rate_ctrl),
_cycle_perf(perf_alloc(PC_ELAPSED, "vehicle_angular_velocity: cycle time")),
_interval_perf(perf_alloc(PC_INTERVAL, "vehicle_angular_velocity: interval")),
_sensor_latency_perf(perf_alloc(PC_ELAPSED, "vehicle_angular_velocity: sensor latency"))
{
}
@@ -52,7 +51,6 @@ VehicleAngularVelocity::~VehicleAngularVelocity()
Stop();
perf_free(_cycle_perf);
perf_free(_interval_perf);
perf_free(_sensor_latency_perf);
}
@@ -217,7 +215,6 @@ void
VehicleAngularVelocity::Run()
{
perf_begin(_cycle_perf);
perf_count(_interval_perf);
// update corrections first to set _selected_sensor
SensorCorrectionsUpdate();
@@ -296,6 +293,5 @@ VehicleAngularVelocity::PrintStatus()
}
perf_print_counter(_cycle_perf);
perf_print_counter(_interval_perf);
perf_print_counter(_sensor_latency_perf);
}
@@ -110,7 +110,6 @@ private:
matrix::Vector3f _bias;
perf_counter_t _cycle_perf;
perf_counter_t _interval_perf;
perf_counter_t _sensor_latency_perf;
uint32_t _selected_sensor_device_id{0};