48 Commits

Author SHA1 Message Date
Daniel Agar
f67ac8ba00 land detector clang-tidy trivial changes 2017-08-31 22:49:44 -04:00
Daniel Agar
6e402bd6f4 land detector uniform initialization cleanup 2017-08-31 22:49:44 -04:00
Daniel Agar
cb8cc9a795 land detector add cycle perf 2017-08-31 22:49:44 -04:00
Daniel Agar
90819b2852 land detector move hysteresis constants into FW and MC 2017-08-31 22:49:44 -04:00
Daniel Agar
b70b8288b9 px4_includes cleanup incomplete list 2017-08-20 20:42:42 +02:00
Dennis Mannhart
f75dd37326 landdetector: delete or for ground_contact detection 2017-08-01 19:31:34 +02:00
Dennis Mannhart
f8e9f380d0 landdetector: add additional landdetection state 2017-08-01 19:31:34 +02:00
Beat Küng
8a83fb7dc2 land_detector: use ModuleBase & add module documentation 2017-07-14 11:57:11 +02:00
Beat Küng
1e2ce51c6d LandDetector: fix vehicle flight time
The problem was signed vs unsigned mixing together with 64bit conversion:
int32_t flight_time = ...;
uint64_t _total_flight_time = ...;
_total_flight_time |= flight_time;
When flight_time is negative, the last line would first extend the sign
bit to the upper 32bits of the 64bit uint and then apply the bitwise OR.
The fix is to use an unsigned 32 bit value.
2017-07-04 14:13:18 +02:00
Matthias Grob
d1b270d5b2 land_detector: fix sanity condition that we have ground contact when we are landed to include the hysteresis flag
because the condition was looking for the instantaneous flag and during the hysteresis time the state did not change anymore
2017-04-20 13:20:01 +02:00
Beat Küng
4b18f8ea46 LandDetector: remove param_notify_changes()
not needed anymore because of autosave
2017-04-06 11:49:03 +02:00
Beat Küng
948635c989 LandDetector: call param_notify_changes() instead of param_save_default()
param_save_default() could take something like 0.5s, and because the
LandDetector is running on the HP work queue, this would block other
tasks, like RC handling or drivers.
2017-03-14 21:43:44 +01:00
Beat Küng
c715228b8f LandDetector: save & initialize total flight time 2017-03-08 04:19:22 +08:00
Dennis Mannhart
7f54f891c1 land_detector: set max height to 100 2017-02-27 22:54:19 +01:00
Dennis Mannhart
3d4e7819a0 landdetector: delete function update_alt_max 2017-02-27 22:54:19 +01:00
Dennis Mannhart
a1982e0392 land_detector: battery level status to adjust maximum altitude possible 2017-02-27 22:54:19 +01:00
Beat Küng
3dc6e7b574 LandDetector: use a 64bit counter for total system flight time
The previous 32bit counter wrapped in ~1.19h, this switches to 2 32bit
counters, wrapping in 584942 years.
2017-02-02 09:22:25 +01:00
Beat Küng
05b649cc86 LandDetector: fix total system flight time (landed & takeoff logic) 2017-02-02 09:22:25 +01:00
Lorenz Meier
1c131f2523 Land detector: Accumulate total flight time between flights 2017-01-29 15:48:34 +01:00
Lorenz Meier
75132a50e6 Land detector: Measure total system flight time
This implementation is a baseline implementation and makes no attempt to be tamper-proof. A monotonic counter like the W25R64FV or a similar HW facility would be required to achieve this.
2017-01-29 15:48:34 +01:00
Matthias Grob
480dd0922b Land detector: revision of the 2 stage landing mechanism
Ground detect: pilot want down or we are on minimum thrust by auto land but no vertical movement
-> Controller should relax x,y corrections and even ramp down desired thrust
Landed: All other conditions are eventually met
2017-01-28 16:23:04 +01:00
Lorenz Meier
58983e4c52 Land detector: Fix code style 2017-01-28 16:23:04 +01:00
Dennis Mannhart
2f164602b4 LandDetector:
- constructor initalization fix
- set trigger time for ground contact hysteresis
- updated ground_contact_state logic
MulticopterLandDetector:
- added hysteresis for ground_contact
VtolLandDetector:
- get_ground_contact_state function that return the one form MultcopterLandDetector
FixedWingLandDetector:
- get_ground_contact_state with a return false: requires implementation
2017-01-28 16:23:04 +01:00
Julian Oes
21bc5d1716 land_detector: remove leftover printf (#5178) 2016-07-31 07:49:11 -07:00
Julian Oes
50cac88e5b land_detector: big refactor, share update function
This is a big refactor and general cleanup of the land detector. The
main functional change is to share the hysteresis lib across all land
detectors.
2016-07-30 12:26:56 +02:00
tumbili
8026273cb0 land_detector: do not publish if landing or freefall state has not changed
Signed-off-by: tumbili <roman@px4.io> and bkueng <beat-kueng@gmx.net>
2016-06-23 15:56:51 +02:00
Julian Oes
b2719cf439 land_detector: publish when there is proper data
Instead of publishing before even having done update(), let's wait for a
result and then advertise.
2016-06-07 12:34:54 +02:00
Julian Oes
49ae3e17d5 land_detector: fix wrong astyle formatting (#4399) 2016-04-29 15:36:18 +02:00
Lorenz Meier
1b11049e42 Land detector: fix code style 2016-04-29 15:01:39 +02:00
Lorenz Meier
5c1d2c1cee Land-detector: Better granularity for manual and auto flight modes 2016-04-29 14:50:45 +02:00
Lorenz Meier
3ccd9988d3 Multicopter land detector: Enforce sync between system and detector 2016-04-29 12:34:58 +02:00
Emmanuel Roussel
e6b3cf3ac9 Fix code style
(Ran AStyle)
2016-04-18 22:27:11 +02:00
Emmanuel Roussel
35110a52f9 Added room in land_detector code for free-fall detection 2016-04-18 22:27:11 +02:00
Lorenz Meier
f02dc3c95f Fixed wing land detector: Use control state, use horizontal acceleration for takeoff detect 2015-11-17 14:15:41 +01:00
Lorenz Meier
fc29fed260 Land detector: Fix code style 2015-10-19 13:47:57 +02:00
Lorenz Meier
0318c1b330 Land detector: Run in work queue 2015-10-10 22:23:34 +02:00
Lorenz Meier
88bb98379e Land detector: Add required POSIX header 2015-09-20 10:58:18 +02:00
Lorenz Meier
ea7ae7d019 Merged beta into master 2015-08-01 16:58:02 +02:00
Lorenz Meier
9f322a395e Make land detector more robust during initial spool-up 2015-07-19 18:30:52 +02:00
Mark Charlebois
1ca05aaa64 orb_advert_t changed to void * and checks changed to nullptr
The existing orb_advert_t use thoughout the code sometimes tries
to treat it as a file descriptor and there are checks for < 0
and ::close calls on orb_advert_t types which is an invalid use
of an object pointer, which is what orb_advert_t really is.

Initially I had changed the -1 initializations to 0 but it was
suggested that this should be nullptr. That was a good recommendation
but the definition of orb_advert_t had to change to void * because
you cannot initialize a uintptr_t as nullptr.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-27 14:42:49 -07:00
Mark Charlebois
a734fc96d1 extensive orb_advert_t fixes
The calls to orb_advertise were being mishandled throughout the code.
There were ::close() calls on memory pointers, there were checks
against < 0 when it is a pointer to a object and values larger than
0x7ffffffff are valid. Some places orb_advert_t variables were
being initialized as 0 other places as -1.

The orb_advert_t type was changed to uintptr_t so the pointer value
would not be wrapped as a negative number. This was causing a failure
on ARM.

Tests for < 0 were changed to == 0 since a null pointer is the valid
representation for error, or uninitialized.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-27 14:41:33 -07:00
Daniel Agar
8aae66b893 trivial code style cleanup round 2 2015-03-27 23:38:58 -04:00
Lorenz Meier
378dcc53d6 Code style: minor comment styling 2015-01-17 23:32:00 +01:00
Lorenz Meier
b1127315b4 Fixed land detector param names 2015-01-17 23:26:43 +01:00
Johan Jansen
e40d207311 AStyle: Fixed file formatting 2015-01-15 14:37:51 +01:00
Johan Jansen
1356c44f0e LandDetector: Fix land detection algorithm not being initialized 2015-01-15 14:37:51 +01:00
Johan Jansen
9ea086bf2d Astyle: Run astyle to fix code formatting 2015-01-15 14:37:51 +01:00
Johan Jansen
10a2dd8a34 LandDetector: Merged fixedwing and multicopter into one module handling both algorithms 2015-01-15 14:37:51 +01:00