Land detector: Fix code style

This commit is contained in:
Lorenz Meier 2015-10-19 13:47:57 +02:00
parent 948ff80b80
commit fc29fed260
5 changed files with 31 additions and 25 deletions

View File

@ -49,7 +49,7 @@ FixedwingLandDetector::FixedwingLandDetector() : LandDetector(),
_paramHandle(),
_params(),
_vehicleLocalPositionSub(-1),
_vehicleLocalPosition({}),
_vehicleLocalPosition( {}),
_airspeedSub(-1),
_vehicleStatusSub(-1),
_armingSub(-1),
@ -102,9 +102,11 @@ bool FixedwingLandDetector::update()
if (hrt_elapsed_time(&_vehicleLocalPosition.timestamp) < 500 * 1000) {
float val = 0.97f * _velocity_xy_filtered + 0.03f * sqrtf(_vehicleLocalPosition.vx *
_vehicleLocalPosition.vx + _vehicleLocalPosition.vy * _vehicleLocalPosition.vy);
if (PX4_ISFINITE(val)) {
_velocity_xy_filtered = val;
}
val = 0.99f * _velocity_z_filtered + 0.01f * fabsf(_vehicleLocalPosition.vz);
if (PX4_ISFINITE(val)) {

View File

@ -47,12 +47,11 @@
LandDetector::LandDetector() :
_landDetectedPub(0),
_landDetected({0, false}),
_landDetected( {0, false}),
_arming_time(0),
_taskShouldExit(false),
_taskIsRunning(false),
_work{}
{
_work{} {
// ctor
}
@ -111,7 +110,8 @@ void LandDetector::cycle()
}
if (!_taskShouldExit) {
work_queue(LPWORK, &_work, (worker_t)&LandDetector::cycle_trampoline, this, USEC2TICK(1000000 / LAND_DETECTOR_UPDATE_RATE));
work_queue(LPWORK, &_work, (worker_t)&LandDetector::cycle_trampoline, this,
USEC2TICK(1000000 / LAND_DETECTOR_UPDATE_RATE));
}
}

View File

@ -99,7 +99,8 @@ protected:
static constexpr uint64_t LAND_DETECTOR_TRIGGER_TIME = 2000000; /**< usec that landing conditions have to hold
before triggering a land */
static constexpr uint64_t LAND_DETECTOR_ARM_PHASE_TIME = 1000000; /**< time interval in which wider acceptance thresholds are used after arming */
static constexpr uint64_t LAND_DETECTOR_ARM_PHASE_TIME =
1000000; /**< time interval in which wider acceptance thresholds are used after arming */
protected:
orb_advert_t _landDetectedPub; /**< publisher for position in local frame */

View File

@ -99,6 +99,7 @@ bool MulticopterLandDetector::update()
if (!_arming.armed) {
_arming_time = 0;
return true;
} else if (_arming_time == 0) {
_arming_time = hrt_absolute_time();
}

View File

@ -152,6 +152,7 @@ static int land_detector_start(const char *mode)
return 1;
}
}
printf("\n");
}
@ -176,6 +177,7 @@ int land_detector_main(int argc, char *argv[])
warnx("land_detector start failed");
return 1;
}
return 0;
}