px4_work_queue: directly support SITL lockstep

- the purpose is to ensure that every WorkItem (and WorkItems scheduled
by WorkItems) is allowed to run to completion every step
 - per workqueue register a lockstep component whenever a work item is
added (if not already registered)
 - once the work queue is empty unregister component
This commit is contained in:
Daniel Agar
2021-01-04 09:38:05 +01:00
committed by Lorenz Meier
parent 8c71ecd97e
commit 98cff94702
10 changed files with 24 additions and 61 deletions
-12
View File
@@ -194,10 +194,6 @@ EKF2::EKF2(int instance, const px4::wq_config_t &config, int imu, int mag, bool
EKF2::~EKF2()
{
if (!_multi_mode) {
px4_lockstep_unregister_component(_lockstep_component);
}
perf_free(_ecl_ekf_update_perf);
perf_free(_ecl_ekf_update_full_perf);
}
@@ -468,14 +464,6 @@ void EKF2::Run()
// publish ekf2_timestamps
_ekf2_timestamps_pub.publish(ekf2_timestamps);
if (!_multi_mode) {
if (_lockstep_component == -1) {
_lockstep_component = px4_lockstep_register_component();
}
px4_lockstep_progress(_lockstep_component);
}
}
}
-1
View File
@@ -224,7 +224,6 @@ private:
uORB::SubscriptionCallbackWorkItem _vehicle_imu_sub{this, ORB_ID(vehicle_imu)};
bool _callback_registered{false};
int _lockstep_component{-1};
bool _distance_sensor_selected{false}; // because we can have several distance sensor instances with different orientations
bool _armed{false};
-9
View File
@@ -49,8 +49,6 @@ EKF2Selector::EKF2Selector() :
EKF2Selector::~EKF2Selector()
{
Stop();
px4_lockstep_unregister_component(_lockstep_component);
}
bool EKF2Selector::Start()
@@ -326,11 +324,6 @@ void EKF2Selector::PublishVehicleAttitude(bool reset)
attitude.timestamp = hrt_absolute_time();
_vehicle_attitude_pub.publish(attitude);
// register lockstep component on first attitude publish
if (_lockstep_component == -1) {
_lockstep_component = px4_lockstep_register_component();
}
}
}
@@ -618,8 +611,6 @@ void EKF2Selector::Run()
}
}
}
px4_lockstep_progress(_lockstep_component);
}
void EKF2Selector::PrintStatus()
-2
View File
@@ -173,8 +173,6 @@ private:
uint8_t _lat_lon_reset_counter{0};
uint8_t _alt_reset_counter{0};
int _lockstep_component{-1};
uORB::Subscription _parameter_update_sub{ORB_ID(parameter_update)};
uORB::Subscription _sensors_status_imu{ORB_ID(sensors_status_imu)};