mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 20:03:34 +08:00
fw_pos_control_l1: pass time through from run
This commit is contained in:
@@ -49,14 +49,10 @@ namespace launchdetection
|
||||
CatapultLaunchMethod::CatapultLaunchMethod(ModuleParams *parent) :
|
||||
ModuleParams(parent)
|
||||
{
|
||||
_last_timestamp = hrt_absolute_time();
|
||||
}
|
||||
|
||||
void CatapultLaunchMethod::update(float accel_x)
|
||||
void CatapultLaunchMethod::update(const float dt, float accel_x)
|
||||
{
|
||||
float dt = hrt_elapsed_time(&_last_timestamp) * 1e-6f;
|
||||
_last_timestamp = hrt_absolute_time();
|
||||
|
||||
switch (state) {
|
||||
case LAUNCHDETECTION_RES_NONE:
|
||||
|
||||
|
||||
@@ -55,13 +55,12 @@ public:
|
||||
CatapultLaunchMethod(ModuleParams *parent);
|
||||
~CatapultLaunchMethod() override = default;
|
||||
|
||||
void update(float accel_x) override;
|
||||
void update(const float dt, float accel_x) override;
|
||||
LaunchDetectionResult getLaunchDetected() const override;
|
||||
void reset() override;
|
||||
float getPitchMax(float pitchMaxDefault) override;
|
||||
|
||||
private:
|
||||
hrt_abstime _last_timestamp{0};
|
||||
float _integrator{0.0f};
|
||||
float _motorDelayCounter{0.0f};
|
||||
|
||||
|
||||
@@ -68,11 +68,11 @@ void LaunchDetector::reset()
|
||||
_activeLaunchDetectionMethodIndex = -1;
|
||||
}
|
||||
|
||||
void LaunchDetector::update(float accel_x)
|
||||
void LaunchDetector::update(const float dt, float accel_x)
|
||||
{
|
||||
if (launchDetectionEnabled()) {
|
||||
for (const auto launchMethod : _launchMethods) {
|
||||
launchMethod->update(accel_x);
|
||||
launchMethod->update(dt, accel_x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
|
||||
void reset();
|
||||
|
||||
void update(float accel_x);
|
||||
void update(const float dt, float accel_x);
|
||||
LaunchDetectionResult getLaunchDetected();
|
||||
bool launchDetectionEnabled() { return _param_laun_all_on.get(); }
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class LaunchMethod
|
||||
public:
|
||||
virtual ~LaunchMethod() = default;
|
||||
|
||||
virtual void update(float accel_x) = 0;
|
||||
virtual void update(const float dt, float accel_x) = 0;
|
||||
virtual LaunchDetectionResult getLaunchDetected() const = 0;
|
||||
virtual void reset() = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user