20121 Commits

Author SHA1 Message Date
Julian Oes
ef475fa9d8 mixer_module: fix poll error in SITL lockstep
This fixes the case where the mixer_module would subscribe and use its
own test_motor publication which was created only to make sure the
topic is advertised and subsequent updates will work properly.

This happened in SITL lockstep because the timestamp would be 0 at the
very beginning, and hence elapsed time would be 0 as well.
This lead to an actuator publication which would then get lockstep out
of sync causing poll errors on the Gazebo side.
2019-11-05 09:33:14 -05:00
Matthias Grob
b6de83117e PositionControl: fix attitude setpoint timestamp
The plot of the attitude setpoint in the log did not show any values
because the message timestamp that the position control module sets
was overwritten by the PositionControl attitude generation.
2019-11-05 13:05:16 +01:00
Matthias Grob
c6cc9f0902 mc_pos_control: fix cutting thrust when landed
by applying it directly to the attitude setpoint which is the output of
the position controller.

The problem was that before the input to the attitude setpoint generation
was adjusted to generate a level attitude with zero thrust keeping the
heading. I refactored the PositionControl class in #13262 to directly
generate the attitude setpoint output. So here I'm adjusting the attitude
setpoint to do the exact same thing as before but without interleaving
with the PositionControl logic.
2019-11-05 13:05:16 +01:00
Beat Küng
a203475489 BlockingList: fix unsafe getLockGuard() API
getLockGuard relies on copy elision to work correctly, which the compiler
is not required to do (only with C++17).
If no copy elision happens, the mutex ends up being unlocked twice, and the
CS is executed with the mutex unlocked.

The patch also ensures that the same pattern cannot be used again.
2019-11-05 12:14:20 +01:00
Julian Oes
4ff4f5c77f commander: fix capitalization of mavlink messages 2019-11-05 10:40:30 +01:00
Julian Oes
24c58db9e6 commander: fix battery failsafe without GPS
This fixes the battery failsafe for the following corner cases:
- Battery failsafe set to Return but we can't do RTL because we don't
  have a global position or home position. In this case we now switch to
  Land. Land might end up in Descend in the failsafe state machine
  later.
- Battery failsafe set to Land but we can't land because we don't have a
  local position. In this case we switch to land anyway and then fall
  back to descend in the failsafe state machine later.

The "fix" involves ignoring using the main_state_transition and
implementing the guards in place. This is a hack for now but should
cover the corner case until a more thorough refactor.

The different failsafe state machines have involved over time from
requirements and learnings based on developed solutions and products.
The implementations in various places will need to get consolidated in
the future.

Tested in SITL for Return and Land with and without GPS.
2019-11-05 10:40:30 +01:00
PX4 BuildBot
6e395fe885 Update submodule matrix to latest Tue Nov 5 00:38:36 UTC 2019
- matrix in PX4/Firmware (dca3f78e198f89510890fbb8b305d2fa1c3caa69): 92d1c8761e
    - matrix current upstream: 9f46483951
    - Changes: 92d1c8761e...9f46483951

    9f46483 2019-11-04 Julian Kent - Fix GCC-4.8 bug
445f58d 2019-11-01 Julian Kent - Fix weird C preprocessor conflicts (#101)
215203f 2019-10-23 Julian Kent - Automatic Differentiation 'Dual' Type (#100)
2019-11-04 20:05:43 -05:00
Oleg Kalachev
7b83da708a mavlink_receiver: write STATUSTEXT messages from the same system to log 2019-11-04 15:33:22 -05:00
Matthias Grob
2416d0fc63 mc_pos_control: remove unused function declarations 2019-11-04 15:07:06 -05:00
Julian Kent
b8b7527d05 Fix off-track tracking in AutoLineSmoothVel (#13321)
* Use position instead of last setpoint

This calculates the target velocities better taking into account disturbances along
the flight route. Previously entry angles and more were calculated assuming the flight path
originates directly from the direction of the previous waypoint. This corrects this assumption
to instead make the direction come from the vehicle location.

* Allow to specify a final speed given a braking distance.

This is to allow planning to not stop at a waypoint, but instead
to reach the waypoint while maintaining a certain velocity

* Updated src/lib/matrix

* Account for speed at target when determining constraints

* Separate constraints into x/y components

* Use setpoint position, not vehicle position

* Fix whitespace, add documentation
2019-11-04 11:57:12 +01:00
Jacob Dahl
005f530eed Removed lidar lite reset after intialization 2019-11-03 20:07:27 +01:00
Daniel Agar
7bf9700426
NuttX: math.h drop extra math defines carried in PX4 defines.h 2019-11-03 10:30:00 -05:00
Jaeyoung-Lim
1951e416b1 Enable rover attitude setpoint 2019-11-03 09:54:22 -05:00
Julian Oes
a08abccdd5 mpu9250: fix mag spikes on fmu-v4pro
This should fix spikes in the mag data on MPU9250 found inside Drotek
Pixhawk 3Pro.

The problem turned out to be that we are not checking the DRDY bit
before reading the data. We presumably threw away most of the stale data
by doing a duplicate check, however, sometimes we might have run into a
race where the mag data was already being updated in the chip while
still being read.
2019-11-02 12:49:30 -04:00
Daniel Agar
3e189889ef FlightTasks: shift DEFINE_PARAMETERS to end of access modifiers
- DEFINE_PARAMETERS includes a private access modifier, so we need to
keep these at the end to prevent issues when extending a flight task
2019-11-02 12:41:45 -04:00
Daniel Agar
7a82df3872
UVify Core and Draco-R updates
* Draco-R sensor orientation correction
* LL40LS sensor is not stable during I2C probing. More trials have been implemented.
* px4flow execution has been removed as rc script already running it
* GPS LED script repaired
* Off ICM20608 due to some bug?
* Removed i2c speed adjustment due to SMBUS.
* ms5611 test2 does not exist
* Baud rate has changed.
* Draco-R airframe parameters are updated.
* IFO and Draco parameters are updated
* Draco-R sensor orientation corrected
* Draco-R DSHOT supports
2019-11-02 11:39:41 -04:00
Daniel Agar
a475d71ca9
astyle shift module documentation to bottom of files
- Astyle chokes on the module description strings, so for now we can keep them near the bottom of each file.
2019-11-02 10:58:47 -04:00
PX4 BuildBot
f0ac270174 Update submodule ecl to latest Sat Nov 2 13:49:23 UTC 2019
- ecl in PX4/Firmware (4658aaf8a0ff90662843558dbc8ea68adcc7284d): 9b4b24ee71
    - ecl current upstream: d76b704225
    - Changes: 9b4b24ee71...d76b704225

    d76b704 2019-11-01 kamilritz - Only inlcude gtest if standalone build
7c1e38d 2019-10-18 kamilritz - Make it build with Firmware
d79199c 2019-10-17 kamilritz - Remove swig and python test related things
d88e242 2019-10-17 kamilritz - pytest are replaced in gtests
71be26e 2019-10-17 kamilritz - Port RingBuffer Test to GTests
cac5f3f 2019-10-17 kamilritz - GTest and Coverage cleanup and Basic EKF GTest
fcea13e 2019-10-14 Martina Rivizzigno - add gtest, temp disable swig
2019-11-02 10:48:45 -04:00
Julian Oes
87415d36a2 commander: check center throttle for POSCTL/ALTCTL
When flying POSCTL and ALTCTL the throttle stick is usually spring
loaded and therefore centered. Therefore, it makes more sense to check
for above center instead of above low.
2019-11-01 10:36:30 +01:00
Julian Oes
283a57054a commander: add missing manual modes
We prevent arming when in a "manual" mode with throttle high. However,
POSCTL and ALTCTL were missing.
2019-11-01 10:36:30 +01:00
Julian Oes
300bc0a332 commander: fully support MAVLink force arming
When a magic number is added as param2 for the MAVLink ARM_DISARM
command not just disarming but also arming should be enforced.
2019-11-01 10:36:30 +01:00
Julian Oes
51ba80f33b commander: improve msg when trying to arm in air 2019-11-01 10:36:30 +01:00
CUAVcaijie
77a896a0dd UAVCAN: Fixed CAN battery status
* Set battery.voltage_filtered_v and battery.current_filtered_a value
* Fixed battery.remaining error when full_charge_capacity_wh is zero
2019-10-31 22:35:04 -04:00
Daniel Agar
129299e25d
Update submodule GPSDrivers to latest Fri Nov 1 00:38:09 UTC 2019 (#13338)
- GPSDrivers in PX4/Firmware (939b83ad492abe795f5eb9f0c4e4387aaee193a5): 69e38ecc84
    - GPSDrivers current upstream: 011959b4da
    - Changes: 69e38ecc84...011959b4da

    011959b 2019-10-27 Daniel Agar - clang-tidy: fix hicpp-member-init
2019-10-31 21:29:27 -04:00
xdwgood
854220dccd mc_pos_control.cpp:Fix forced update parameters 2019-10-31 10:15:25 -04:00
Julian Oes
a6a8877463 simulator: don't reset battery when disarmed
Before this change, the battery percentage is reset to 100% as soon as
the drone is disarmed again. In my opinion it is more realistic if the
batteries don't magically fill up again but stay low.
2019-10-30 15:45:44 -04:00
Beat Küng
3b7c1b4ff1 src/drivers/boards: move to platforms/nuttx/src/px4/common 2019-10-30 11:48:47 +01:00
Beat Küng
be7ed5e388 src/drivers/boards/common/{stm32,kinetis}: move under platforms/nuttx/src/px4 2019-10-30 11:48:47 +01:00
Beat Küng
58e161347b board_mcu_version: move to platforms/nuttx/src/px4 2019-10-30 11:48:47 +01:00
Beat Küng
e7519c9fa0 board_identity: move to platforms/nuttx/src
And fix a potential alignment issue in board_get_mfguid and
board_get_px4_guid.
2019-10-30 11:48:47 +01:00
Beat Küng
b30171ba8d board_common.h: move under platforms/common
Also move board_determine_hw_info and board_gpio_init under platforms/nuttx
2019-10-30 11:48:47 +01:00
Beat Küng
3198610f85 src/platforms: move all headers to platforms/common/include/px4_platform_common
and remove the px4_ prefix, except for px4_config.h.

command to update includes:
for k in app.h atomic.h cli.h console_buffer.h defines.h getopt.h i2c.h init.h log.h micro_hal.h module.h module_params.h param.h param_macros.h posix.h sem.h sem.hpp shmem.h shutdown.h tasks.h time.h workqueue.h; do for i in $(grep -rl 'include <px4_'$k src platforms boards); do sed -i 's/#include <px4_'$k'/#include <px4_platform_common\/'$k/ $i; done; done
for in $(grep -rl 'include <px4_config.h' src platforms boards); do sed -i 's/#include <px4_config.h/#include <px4_platform_common\/px4_config.h'/ $i; done

Transitional headers for submodules are added (px4_{defines,log,time}.h)
2019-10-30 11:48:47 +01:00
Julian Oes
fad0c31872 commander: battery failsafe action back to warning
This reverts a previous change because we're not entirely sure about all
implications on various airframes. It makes sense to change this default
after the failsafe state machines have been consolidated and the various
failsafe behaviours are more predictable for all airframes (not just
multicopter).
2019-10-29 15:42:43 +01:00
Hamish Willee
24e3dc6a76 RTL Params - relative to destination not home 2019-10-29 15:00:49 +01:00
Peter van der Perk
07eb3d301b Enabled UDP in NuttX microRTPS build
Added commandline argument to change microRTPS ip address
2019-10-29 09:08:21 +00:00
Daniel Agar
375fc4a75c
uavcan module cleanup
- move most orb to uORB::Publication and uORB::Subscription
 - update legacy message handling (warn to PX4_INFO, PX4_WARN, PX4_ERR)
 - add perf counters
 - sensors/mag support newer `uavcan::equipment::ahrs::MagneticFieldStrength2` message
 - sensors/gps support `uavcan::equipment::gnss::Auxiliary` for hdop and vdop
 - sensors delete obsolete ioctl and read methods
 - use PublicationMulti for actuator_outputs and esc_reports (to coexist with other output modules)
 - add GNSS parameter metadata (parameters_injected.xml)
2019-10-28 19:57:50 -04:00
Daniel Agar
47dd312b57
fw_att_control: move to px4::params 2019-10-28 18:08:47 -04:00
JaeyoungLim
71fbe58e20 fw_pos_ctrl_l1: enable loiter type offboard position setpoint for Fixedwing vehicles
* Use NAV_LOITER_RAD when provided offboard position setpoints
2019-10-28 17:42:27 -04:00
RomanBapst
216556e7f6 commander_params: mention definition of battery states in the description
of the battery failsafe mode parameter

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-10-28 16:18:42 -04:00
Daniel Agar
94de12ef19
sensors: own BAT_V_DIV and BAT_A_PER_V params (#13299)
- this is currently necessary for the QGC power setup gui, but should be reverted in the future
 - fixes #13292
2019-10-28 16:03:05 -04:00
Julian Oes
cb03612d99 mavlink: only ignore messages on UDP before init
We should still accept messages arriving over serial.
2019-10-28 11:13:16 -04:00
Julian Oes
08cce4f7f3 mavlink: accept msgs without source initialized
I don't understand why we should wait to parse incoming MAVLink traffic
just because we don't have the source address initialized. We still
check the source address before doing a sendto.

This should fix serial MAVLink communication on FMU5x where both serial
and UDP is available. There the serial connection previously did not
work because nothing was connected over UDP.
2019-10-28 11:13:16 -04:00
Daniel Agar
c284198bec clang-tidy: partially fix hicpp-use-override 2019-10-28 10:50:31 -04:00
Daniel Agar
6f1e132286 clang-tidy: enable readability-redundant-control-flow and fix 2019-10-28 10:50:31 -04:00
Daniel Agar
6f1f5e0325 clang-tidy: partially fix readability-redundant-declaration 2019-10-28 10:50:31 -04:00
Daniel Agar
9f4258f6ff clang-tidy: partially fix hicpp-explicit-conversions 2019-10-28 10:50:31 -04:00
Daniel Agar
a7f330075a clang-tidy: enable hicpp-braces-around-statements and fix 2019-10-28 10:50:31 -04:00
Daniel Agar
744f06cc8f clang-tidy: enable readability-delete-null-pointer and fix 2019-10-28 10:50:31 -04:00
Daniel Agar
4192414576 clang-tidy: partially fix cppcoreguidelines-pro-type-reinterpret-cast 2019-10-28 10:50:31 -04:00
Julian Oes
f5945d1185 commander: make battery failsafes sane by default
I propose two changes to the battery failsafes:
1. Remove the return only mode because it means the drone is likely
   to crash during RTL. I think this is not expected by users chosing
   the option and therefore better not exposed as an option.
2. Make Return/Land the default battery failsafe because it is expected
   that a drone does the right thing when battery is low.

Also, this changes the description of the Return/Land behaviour to make
the drop down menu less long and awkward in QGC.
2019-10-28 05:51:12 -07:00