mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 01:13:34 +08:00
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:
@@ -137,8 +137,6 @@ private:
|
||||
bool _scale_estimation_previously_on{false}; /**< scale_estimation was on in the last cycle */
|
||||
|
||||
perf_counter_t _perf_elapsed{};
|
||||
perf_counter_t _perf_interval{};
|
||||
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
(ParamFloat<px4::params::ARSP_W_P_NOISE>) _param_west_w_p_noise,
|
||||
@@ -170,13 +168,12 @@ private:
|
||||
|
||||
AirspeedModule::AirspeedModule():
|
||||
ModuleParams(nullptr),
|
||||
ScheduledWorkItem(px4::wq_configurations::lp_default)
|
||||
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::lp_default)
|
||||
{
|
||||
// initialise parameters
|
||||
update_params();
|
||||
|
||||
_perf_elapsed = perf_alloc_once(PC_ELAPSED, "airspeed_selector elapsed");
|
||||
_perf_interval = perf_alloc_once(PC_INTERVAL, "airspeed_selector interval");
|
||||
}
|
||||
|
||||
AirspeedModule::~AirspeedModule()
|
||||
@@ -184,7 +181,6 @@ AirspeedModule::~AirspeedModule()
|
||||
ScheduleClear();
|
||||
|
||||
perf_free(_perf_elapsed);
|
||||
perf_free(_perf_interval);
|
||||
|
||||
if (_airspeed_validator != nullptr) {
|
||||
delete[] _airspeed_validator;
|
||||
@@ -216,7 +212,6 @@ AirspeedModule::task_spawn(int argc, char *argv[])
|
||||
void
|
||||
AirspeedModule::Run()
|
||||
{
|
||||
perf_count(_perf_interval);
|
||||
perf_begin(_perf_elapsed);
|
||||
|
||||
/* the first time we run through here, initialize N airspeedValidator
|
||||
@@ -572,7 +567,6 @@ and also publishes those.
|
||||
int AirspeedModule::print_status()
|
||||
{
|
||||
perf_print_counter(_perf_elapsed);
|
||||
perf_print_counter(_perf_interval);
|
||||
|
||||
int instance = 0;
|
||||
uORB::SubscriptionData<airspeed_validated_s> est{ORB_ID(airspeed_validated), (uint8_t)instance};
|
||||
|
||||
@@ -45,9 +45,8 @@ using namespace time_literals;
|
||||
extern "C" __EXPORT int fw_att_control_main(int argc, char *argv[]);
|
||||
|
||||
FixedwingAttitudeControl::FixedwingAttitudeControl() :
|
||||
WorkItem(px4::wq_configurations::att_pos_ctrl),
|
||||
_loop_perf(perf_alloc(PC_ELAPSED, "fw_att_control: cycle")),
|
||||
_loop_interval_perf(perf_alloc(PC_INTERVAL, "fw_att_control: interval"))
|
||||
WorkItem(MODULE_NAME, px4::wq_configurations::att_pos_ctrl),
|
||||
_loop_perf(perf_alloc(PC_ELAPSED, "fw_att_control: cycle"))
|
||||
{
|
||||
// check if VTOL first
|
||||
vehicle_status_poll();
|
||||
@@ -132,7 +131,6 @@ FixedwingAttitudeControl::FixedwingAttitudeControl() :
|
||||
FixedwingAttitudeControl::~FixedwingAttitudeControl()
|
||||
{
|
||||
perf_free(_loop_perf);
|
||||
perf_free(_loop_interval_perf);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -450,7 +448,6 @@ void FixedwingAttitudeControl::Run()
|
||||
}
|
||||
|
||||
perf_begin(_loop_perf);
|
||||
perf_count(_loop_interval_perf);
|
||||
|
||||
if (_att_sub.update(&_att)) {
|
||||
|
||||
@@ -922,7 +919,6 @@ int FixedwingAttitudeControl::print_status()
|
||||
PX4_INFO("Running");
|
||||
|
||||
perf_print_counter(_loop_perf);
|
||||
perf_print_counter(_loop_interval_perf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,6 @@ private:
|
||||
vehicle_status_s _vehicle_status {}; /**< vehicle status */
|
||||
|
||||
perf_counter_t _loop_perf; /**< loop performance counter */
|
||||
perf_counter_t _loop_interval_perf; /**< loop interval performance counter */
|
||||
|
||||
float _flaps_applied{0.0f};
|
||||
float _flaperons_applied{0.0f};
|
||||
|
||||
@@ -37,9 +37,8 @@ extern "C" __EXPORT int fw_pos_control_l1_main(int argc, char *argv[]);
|
||||
|
||||
FixedwingPositionControl::FixedwingPositionControl() :
|
||||
ModuleParams(nullptr),
|
||||
WorkItem(px4::wq_configurations::att_pos_ctrl),
|
||||
WorkItem(MODULE_NAME, px4::wq_configurations::att_pos_ctrl),
|
||||
_loop_perf(perf_alloc(PC_ELAPSED, "fw_pos_control_l1: cycle")),
|
||||
_loop_interval_perf(perf_alloc(PC_INTERVAL, "fw_pos_control_l1: interval")),
|
||||
_launchDetector(this),
|
||||
_runway_takeoff(this)
|
||||
{
|
||||
@@ -114,7 +113,6 @@ FixedwingPositionControl::FixedwingPositionControl() :
|
||||
FixedwingPositionControl::~FixedwingPositionControl()
|
||||
{
|
||||
perf_free(_loop_perf);
|
||||
perf_free(_loop_interval_perf);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -1657,7 +1655,6 @@ FixedwingPositionControl::Run()
|
||||
}
|
||||
|
||||
perf_begin(_loop_perf);
|
||||
perf_count(_loop_interval_perf);
|
||||
|
||||
/* only run controller if position changed */
|
||||
if (_global_pos_sub.update(&_global_pos)) {
|
||||
@@ -1990,7 +1987,6 @@ int FixedwingPositionControl::print_status()
|
||||
PX4_INFO("Running");
|
||||
|
||||
perf_print_counter(_loop_perf);
|
||||
perf_print_counter(_loop_interval_perf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,6 @@ private:
|
||||
SubscriptionData<vehicle_acceleration_s> _vehicle_acceleration_sub{ORB_ID(vehicle_acceleration)};
|
||||
|
||||
perf_counter_t _loop_perf; ///< loop performance counter */
|
||||
perf_counter_t _loop_interval_perf; ///< loop interval performance counter */
|
||||
|
||||
float _hold_alt{0.0f}; ///< hold altitude for altitude mode */
|
||||
float _takeoff_ground_alt{0.0f}; ///< ground altitude at which plane was launched */
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace land_detector
|
||||
|
||||
LandDetector::LandDetector() :
|
||||
ModuleParams(nullptr),
|
||||
ScheduledWorkItem(px4::wq_configurations::hp_default)
|
||||
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default)
|
||||
{
|
||||
_land_detected.timestamp = hrt_absolute_time();
|
||||
_land_detected.freefall = false;
|
||||
|
||||
@@ -123,7 +123,7 @@ private:
|
||||
|
||||
LoadMon::LoadMon() :
|
||||
ModuleParams(nullptr),
|
||||
ScheduledWorkItem(px4::wq_configurations::lp_default),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::lp_default),
|
||||
_stack_perf(perf_alloc(PC_ELAPSED, "stack_check"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ using namespace matrix;
|
||||
|
||||
MulticopterAttitudeControl::MulticopterAttitudeControl() :
|
||||
ModuleParams(nullptr),
|
||||
WorkItem(px4::wq_configurations::rate_ctrl),
|
||||
WorkItem(MODULE_NAME, px4::wq_configurations::rate_ctrl),
|
||||
_loop_perf(perf_alloc(PC_ELAPSED, "mc_att_control"))
|
||||
{
|
||||
_vehicle_status.vehicle_type = vehicle_status_s::VEHICLE_TYPE_ROTARY_WING;
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -54,9 +54,8 @@
|
||||
using namespace matrix;
|
||||
|
||||
VtolAttitudeControl::VtolAttitudeControl() :
|
||||
WorkItem(px4::wq_configurations::rate_ctrl),
|
||||
_loop_perf(perf_alloc(PC_ELAPSED, "vtol_att_control: cycle")),
|
||||
_loop_interval_perf(perf_alloc(PC_INTERVAL, "vtol_att_control: interval"))
|
||||
WorkItem(MODULE_NAME, px4::wq_configurations::rate_ctrl),
|
||||
_loop_perf(perf_alloc(PC_ELAPSED, "vtol_att_control: cycle"))
|
||||
{
|
||||
_vtol_vehicle_status.vtol_in_rw_mode = true; /* start vtol in rotary wing mode*/
|
||||
|
||||
@@ -108,7 +107,6 @@ VtolAttitudeControl::VtolAttitudeControl() :
|
||||
VtolAttitudeControl::~VtolAttitudeControl()
|
||||
{
|
||||
perf_free(_loop_perf);
|
||||
perf_free(_loop_interval_perf);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -309,7 +307,6 @@ VtolAttitudeControl::Run()
|
||||
}
|
||||
|
||||
perf_begin(_loop_perf);
|
||||
perf_count(_loop_interval_perf);
|
||||
|
||||
const bool updated_fw_in = _actuator_inputs_fw.update(&_actuators_fw_in);
|
||||
const bool updated_mc_in = _actuator_inputs_mc.update(&_actuators_mc_in);
|
||||
@@ -513,7 +510,6 @@ VtolAttitudeControl::print_status()
|
||||
PX4_INFO("Running");
|
||||
|
||||
perf_print_counter(_loop_perf);
|
||||
perf_print_counter(_loop_interval_perf);
|
||||
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
@@ -217,7 +217,6 @@ private:
|
||||
bool _initialized{false};
|
||||
|
||||
perf_counter_t _loop_perf; /**< loop performance counter */
|
||||
perf_counter_t _loop_interval_perf; /**< loop interval performance counter */
|
||||
|
||||
void vehicle_cmd_poll();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user