856 Commits

Author SHA1 Message Date
Lorenz Meier
798a7ed8cd Commander: Fall back to GPS enabled modes once GPS becomes available 2017-02-17 09:13:13 +01:00
Lorenz Meier
070a73ad63 Commander: Switch into right mode in various corner conditions
* If you move in LAND, AUTO or HOLD the sticks the system will give control back to the pilot
  * If you do not connect any RC the system will default to HOLD and will allow you tablet control
  * If you gain position lock for the first time the system will re-evaluate the mode switch (so if you dropped down to alt hold it will now go into position)
  * If the system breaches the Geofence it will now always drop back to POSCTRL if the sticks are moved
2017-02-17 09:13:13 +01:00
Lorenz Meier
081c40c6fa Commander: Fix level cal command 2017-02-15 22:16:20 +01:00
ChristophTobler
1f7fdb2386 allow local position for takeoff (e.g. flow) 2017-02-13 21:11:25 +01:00
Daniel Agar
feda5caac2 commander state machine helper fix style and remove unused 2017-02-12 10:29:59 +01:00
Simone Guscetti
b182a5eeca Added the vehicle_status_flags publisher with the conversion in a bit field in commander 2017-02-04 21:13:59 +01:00
Lorenz Meier
bf448fce71 Commander: Update call for new power management interface 2017-02-04 21:06:21 +01:00
Lorenz Meier
a92931fe84 Commander: Switch system off if in undervoltage condition and disarmed.
This is necessary to not have systems deep-discharge the battery while sitting idle. While at it we also deny arming in low battery conditions to ensure people who just landed with a low battery do not take off again and fail to get a successful RTL.
2017-02-04 21:06:21 +01:00
Simone Guscetti
fe53e3a0d5 commander: add status_changed when battery is low 2017-02-03 13:53:51 +01:00
Beat Küng
b6f3cf9425 events: refactor temperature_calibration command to take options and use a single vehicle_command
This makes it easier to start calibration for all sensors at once.
2017-02-02 23:54:06 +01:00
Daniel Agar
e927f3e040 clang-tidy modernize-use-nullptr 2017-02-01 22:15:50 -05:00
Beat Küng
c1e2aeff0b commander: ignore PREFLIGHT_CALIBRATION for temperature calibration param 2017-01-25 22:43:29 +01:00
Julian Oes
4ceba407f2 commander: raise stack size
A stack usage of 3000 bytes was observed, therefore it's safer to raise
the commander's stack size by 400 bytes.
2017-01-21 16:04:43 +01:00
Chris Lovett
33a307873a Enable rc mode change switch to override offboard mode. This is a safety feature, in case offboard control goes crazy, user can always regain control by switching modes to stabilize, or alt hold or position hold, however they have configured the mode change RC switch. 2017-01-18 18:15:58 +01:00
Beat Küng
48c5ec54bb commander: make sure all code paths return an (n)ack to MAV_CMD_PREFLIGHT_CALIBRATION 2017-01-11 16:25:04 +01:00
Lorenz Meier
8416505a67 Commander: Header cleanup 2016-12-27 21:00:51 +01:00
Anton Matosov
3a17c07b1e Implement RC and DL failsafe action handling for multirotors
Move RC and DL failsafe actions handling from navigator to commander (credits to @AndreasAntener)
Separate manual kill switch handling via manual_lockdown to prevent override and release of software lockdown by RC switch

Other changes:
Add failsafe tune
Fix LED blinking for Pixracer
Return back support for rc inputs in simulator but now it is configurable via cmake
2016-12-27 00:38:13 +01:00
Lorenz Meier
5d7d26531c Commander: Acknowledge pair commands 2016-12-23 17:40:11 +01:00
Beat Küng
db2efa79da fix commander: remove unused variable rtl_on 2016-12-21 14:09:41 +01:00
Lorenz Meier
9ae2376d1c Commander: Indicate overload on the ground only if not transient. Adjust max CPU load to 80%. Indicate overload in air immediatley 2016-12-21 11:44:47 +01:00
Matthias Grob
0dbdde3404 Arming: made flags more understandable, added error message for rejected disarm 2016-12-20 09:46:36 +01:00
Matthias Grob
f6282f5b3d Arm button fix: include the arm switch into the structure of all the checks for RC arming 2016-12-20 09:46:36 +01:00
Matthias Grob
94c8371ffe Arm button fix: toggle arming state only once per arm button press 2016-12-20 09:46:36 +01:00
Matthias Grob
8a75827d6a fixed all comments of arm button review 2016-12-20 09:46:36 +01:00
Matthias Grob
aa984edd90 added an rc switch for arming and disarming with the option to use it as a button 2016-12-20 09:46:36 +01:00
Lorenz Meier
4b0647d9c0 Condition the GPS check always on the commander GPS prearm check param (#6055) 2016-12-14 15:30:24 +01:00
Julian Oes
adc9ed61b8 commander: ignore arm/disarm in DO_SET_MODE cmd
According to https://github.com/mavlink/mavlink/pull/629 the mavlink
command DO_SET_MODE should only determine the mode but not the
armed/disarmed state, so the MAV_MODE_FLAG_SAFETY_ARMED bit should be
ignored.
Instead the mavlink command COMPONENT_ARM_DISARM should be used instead.

Therefore, the commander now ignores the arm/disarm bit.
2016-12-11 17:00:09 +01:00
Andreas Antener
e9737d6f7a Preflight checks: made sure pre-flight check results are always reported first thing on the console and always on new or re-established telemetry links AFTER waiting for the hotplug timeout
(leads to double publishing on the console when a new link is established, but this is the best compromise between fixing and completely restructuring)
2016-12-02 22:56:48 +01:00
Andreas Antener
c069264752 Preflight check: initialize VTOL flag before it is used 2016-12-02 22:56:48 +01:00
Andreas Antener
f772fc2d02 Airspeed: preflight check for bad offset, fixed calls to preflight checks (vtol & airspeed) 2016-12-02 22:56:48 +01:00
Daniel Agar
c17c8884d1 implement MAV_CMD_DO_LAND_START 2016-11-19 15:48:10 +01:00
Paul Riseborough
983cfb8fdd commander: Add preflight checking for EKF health and IMU sensor consistency 2016-11-19 15:12:08 +01:00
Daniel Agar
8ac4dd04ae implement MAV_CMD_MISSION_START 2016-11-06 15:24:34 +01:00
Daniel Agar
cdd317ba38 commander arm check throttle include rattitude 2016-11-01 22:51:51 +01:00
Daniel Agar
2908f1c16d commander allow disarm command with throttle 2016-10-31 09:15:06 +01:00
Daniel Agar
27a50275b6 commander NAV_RETURN_TO_LAUNCH change mode to RTL 2016-10-30 21:41:43 +01:00
Carlo Wood
baf89f4398 Clean up of px4_defines.h (remove math.h)
This patch reorders px4_defines.h to make it more readable (I think)
but more importantly, cleans up the #include <math.h>/<cmath>
and [std::]isfinite stuff.

My main goal was to completely get rid of including math.h/cmath,
because that doesn't really belong in a header that is supposed to
define macro's and is included in almost every source file (if not
all).

I'm not sure what it did before ;) (pun intended), but now it does
the following:

PX4_ISFINITE is only used in C++ code (that was already the case,
but hereby is official; for C code just use 'isfinite()') and is
defined to be std::isfinite, except on __PX4_QURT because that uses
the HEXAGON toolset which (erroneously) defines isfinite as macro.

I would have liked to remove PX4_ISFINITE completely from the code
and just use std::isfinite whereever that is needed, but that would
have required changing the libecl submodule, and at the moment I'm
getting tired of changing submodules... so maybe something for the
future.

Also, all includes of <math.h> or <cmath> have been removed except
for __PX4_NUTTX. Like the HEXAGON toolset NuttX currently defines
isfinite as macro for C++. So, we could have solved this in the
same was as __P4_QURT; but since we can fix NuttX ourselves I chose
to add a kludge to px4_defines.h instead that fixes this problem,
until the time that NuttX can be fixed (again postponing changing
a submodule). The kludge still demands including <cmath>, thus.

After removal of the math header file, it needed to be included
in source files that actually need it, of course.

Finally, I had a look at the math macro's (like M_PI, M_PI_F,
M_DEG_TO_RAD etc). These are sometimes (erroneously) defined in
certain math.h header files (like both, hexagon and nuttx).
This is incorrect: neither the C nor the C++ standard defines
math constants (neither as macro nor otherwise). The "problem"
here was that px4_defines.h defined some of the M_*_F float
constants in terms of the M_* double constant, which are
sometimes not defined either thus. So, I cleaned this up by
defining the M_*_F math constants as float literals in px4_defines.h,
except when they are defined in math.h for that platform.
This means that math.h has to be always included when using those
constants, but well; not much difference there as those files
usually also need/use the macro NAN (which *is* a standard macro
defined by math.h).

Finally finally, DEFAULT_PARAM_FILE was removed as it isn't
used anymore.

All in all I think the resulting px4_defines.h is nice, giving me
much less the feeling of a nearly unmaintainable and over time
slowly growing collection of kludges and hacks.
2016-10-28 08:41:30 +02:00
Beat Küng
f29a50df31 logger: add support for mavlink backend in Logger class, handle start/stop 2016-10-19 13:13:47 +02:00
Roman
3faaeb06d1 attitude setpoint topic: cleanup of matrix class usage
Signed-off-by: Roman <bapstroman@gmail.com>
2016-10-18 20:46:08 +02:00
tumbili
5e0e522903 adapted to new vehicle attitude message 2016-10-18 20:46:08 +02:00
James Goppert
43b665ae01 Fix gps circuit breaker logic in state machine. 2016-10-12 23:07:26 -05:00
Lorenz Meier
710a8e8f56 Commander: ensure hysteresis init 2016-10-10 22:47:07 +02:00
Julian Oes
0f763768b1 commander: don't auto-disarm as fast if not flown
It was found inconvenient that auto-disarm triggers too quickly right
after arming when the vehicle has not actually taken off yet.

Therefore, the auto-disarm takes now by a factor of 5 longer if the
vehicle has not taken off yet.
2016-10-10 22:47:07 +02:00
Beat Küng
50b8ed0a89 commander: initialize gps & baro as failure state
This avoids error messages on startup.
2016-09-30 13:50:51 +02:00
Beat Küng
ce0d31b7d9 mavlink log: ensure all critical & emergency msgs are also logged to console & ulog
Critical messages that the user sees should also go to the log file, so
that the exact error (with time) can later be analyzed from the log file.
2016-09-30 13:50:51 +02:00
Beat Küng
241fd629ce ERROR macro: get rid of the many 'oddly, ERROR is not defined for c++', use PX4_ERROR 2016-09-30 13:50:51 +02:00
Julian Oes
158a0be6c4 commander: whitespace fix 2016-09-30 08:02:55 +02:00
Sander Smeets
c4eabbd083 VTOL transition switch parameter checking (#5545)
* VTOL transition switch parameter checking

* Code style
2016-09-26 10:18:23 +02:00
Andreas Antener
5825b8c3e7 Geofence: renamed action on flag, reset only if none of the possible warning actions is set 2016-09-18 21:14:18 +02:00
Andreas Antener
6c7e5651ce Geofence: moved rtl_on reset up so it always happens when falling out of RTL 2016-09-13 14:32:01 +02:00