Commit Graph

12236 Commits

Author SHA1 Message Date
Andrew Tridgell e0047d81a2 AP_RangeFinder: enable sonar on Disco 2016-07-20 13:38:18 +10:00
Andrew Tridgell 018d8f732a AP_Compass: work around poor magnetic setup on Disco
bring compass offsets into line with what the calibrator can handle
2016-07-20 13:38:17 +10:00
Andrew Tridgell 39dac57b56 AP_BattMonitor: support Disco battery monitoring 2016-07-20 13:38:17 +10:00
Andrew Tridgell d30e55fa44 AP_InertialSensor: initial support for Disco
setup right orientation
2016-07-20 13:38:17 +10:00
Andrew Tridgell 96095b0942 HAL_Linux: fixed comment typo for SBUS input 2016-07-20 13:38:17 +10:00
Andrew Tridgell b69170febd HAL_Linux: fixed build for Disco with I2C changes 2016-07-20 13:38:17 +10:00
Andrew Tridgell f5a20d28bc HAL_Linux: fixed comment in SBUS 2016-07-20 13:38:17 +10:00
Andrew Tridgell a78b875ec3 HAL_Linux: fixed ULTRASOUND GPIO for Disco 2016-07-20 13:38:17 +10:00
Andrew Tridgell 1d8e4cdea9 HAL_Linux: added debugging line for Heat_Pwm 2016-07-20 13:38:17 +10:00
Andrew Tridgell 55d692708b HAL_Linux: fixed set_esc_scaling on Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell 298f7bffb9 HAL_Linux: fixed motor output for Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell 9b057ee4f1 HAL_Linux: separate out the GPIO table for Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell 677a38a10a HAL_Linux: make SBUS input much more robust
use inter-frame gap to resync after byte loss
2016-07-20 13:38:16 +10:00
Andrew Tridgell 29135a0158 HAL_Linux: use termios2 for SBUS RCOUT on Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell a40d704126 HAL_Linux: added RCOutput_Disco
combines Sysfs and Bebop RCOutput code
2016-07-20 13:38:16 +10:00
Andrew Tridgell cf83a43b56 HAL_Linux: support SBUS input on Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell aaaa6d38c7 HAL_Linux: initial support for Disco 2016-07-20 13:35:51 +10:00
Andrew Tridgell e407caaa41 AP_HAL: added support for Parrot Disco 2016-07-20 13:35:51 +10:00
Peter Barker 78fa23440c AP_AHRS: remove use of uninitialised variable
clang told us:

../../libraries/AP_AHRS/AP_AHRS_NavEKF.cpp:695:35: fatal error: variable 'posD' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
2016-07-20 00:06:49 -03:00
Tom Pittenger 7be15be185 AP_TECS: slew the hgt_lag_filter when starting a land 2016-07-19 17:19:10 -07:00
Andrew Tridgell 2527859b59 AP_TECS: update comment on underspeed clearing 2016-07-20 08:21:08 +10:00
Lucas De Marchi 293f94b355 AP_HAL_PX4: Util: fix check for PX4_V4
When building for px4-v2 we have an warning because we are checking for
the value of this undefined macro. Just change both checks to use
"defined()".

../../libraries/AP_HAL_PX4/Util.cpp:115:7: warning: "CONFIG_ARCH_BOARD_PX4FMU_V4" is not defined [-Wundef]
 #elif CONFIG_ARCH_BOARD_PX4FMU_V4
       ^
2016-07-19 17:53:46 -03:00
khancyr c4b009f4b5 AP_HAL_PX4 : remove unused variable 2016-07-19 17:44:22 -03:00
Andrew Tridgell a1c759e491 SITL: added sensor smoothing
this adds smoothing of sensors for kinematic consistency when
interacting with the ground. It means when we land the EKF doesn't go
crazy
2016-07-19 21:38:16 +10:00
Andrew Tridgell 4faa57074a SITL: removed vehicle specific ground handling 2016-07-19 14:47:47 +10:00
Andrew Tridgell e7a54c83d1 SITL: allow SITL to use terrain data for ground height 2016-07-19 14:42:31 +10:00
Andrew Tridgell c471b635b3 AP_Notify: added NTF_LED_OVERRIDE parameter
when this is set the board RGB LED will be controlled by MAVLink
instead of internally. This is useful for cases where the LED patterns
and colours needed are specified by an external authority (such as the
OBC organisers)
2016-07-19 13:37:13 +10:00
Andrew Tridgell 567d5cdbe6 AP_NavEKF2: use mavlink messages not printf for state change notifications 2016-07-19 12:16:51 +10:00
priseborough bd7bf21475 AP_NavEKF2: Speed improve switch-over to backup magnetometer
When switching over to a back up magnetometer, ensure that the earth field estimate are reset. other wise mag earth field estimates due to the previous failed mag could cause data from the new mag to be rejected.
2016-07-19 12:16:50 +10:00
priseborough e34cdc6666 AP_NavEKF2: Fix bug preventing planes recovering from bad magnetometers
This bug created a race condition whereby if the EKF had to reset the yaw to the GPS ground course to recover from a bad magnetometer, the new heading could be over-written by the bad magnetic heading when the plane reached the height for the scheduled reset.
2016-07-19 12:16:50 +10:00
priseborough e2b8807260 AP_NavEKF2: Fix bug causing switching in and out of aiding
If the GPS receiver was disconnected and no data received, then then the gpsGoodToAlign check did not get a chance to run and becasue it was previously true the EKF would switch back into aiding.
This prevents this by ensuring that gpsGoodToAlign defaults to false when the check is not being performed.
An additional check has also been dded to ensure that there is GPS data to fuse before we declare ready to use GPS.
2016-07-19 12:16:50 +10:00
priseborough fcc07b5560 AP_NavEKF2: Prevent multiple aiding mode changes per update 2016-07-19 12:16:50 +10:00
priseborough f4f347fb75 AP_NavEKF2: add missing parenthesis and console message 2016-07-19 12:16:50 +10:00
priseborough 9a23152ee4 AP_NavEKF2: Fix bugs and consolidate aiding switch logic
Switching in and out of aiding modes was being performed in more than one place and was using two variables.
The reversion out of GPS mode due to prolonged loss of GPS was not working.
This consolidates the logic and ensures that PV_AidingMode is only changed by the setAidingMode function.
2016-07-19 12:16:50 +10:00
priseborough 230ba2700f AP_NavEKF2: fix documentation errors 2016-07-19 12:16:50 +10:00
priseborough b3bfb71431 AP_NavEKF: fix documentation errors 2016-07-19 12:16:50 +10:00
priseborough 01ce3e7f1e AP_AHRS: fix documentation errors 2016-07-19 12:16:49 +10:00
priseborough 7700b1417d AP_InertialNav: Use separated EKF horiz/vert position interfaces 2016-07-19 12:16:49 +10:00
priseborough 5454f76702 AP_AHRS: Add separate interfaces for local horizontal and vertical position 2016-07-19 12:16:49 +10:00
priseborough a8cd037f56 DataFlash: update to match revised EKF1 and EKF2 interface
Uses separate horz/vert position interfaces
2016-07-19 12:16:49 +10:00
priseborough 341d070db8 AP_NavEKF2: Separate filter status update and get functions
The filter status logic calculations were being repeated every time the get function was called.
The logic is now updated once per filter update step and a separate get function added
2016-07-19 12:16:49 +10:00
priseborough b1717649b1 AP_NavEKF2: remove combined NED local position interface 2016-07-19 12:16:49 +10:00
priseborough e374ec634d AP_NavEKF2: Add separate horizontal/vertical local position interfaces 2016-07-19 12:16:49 +10:00
priseborough 487bbc3ed2 AP_NavEKF: Fix reporting of position status
Split publishing of local position into horiz and vert components with separate validity checks
Split status reporting into separate update and get functions and only update once after each loop update. This removes unnecessary re-calculation of the status logic and ensures all consumers get the same data (avoid possible race conditions).
2016-07-19 12:16:48 +10:00
priseborough 04e8726d8a AP_NavEKF2: relax bias convergence check
Enables bias convergence check to pass within 30 seconds when vehicle is static.
2016-07-19 12:16:48 +10:00
priseborough 280395afa1 AP_NavEKF2: Don't declare ready to do aiding unless gyro bias is learned 2016-07-19 12:16:48 +10:00
priseborough 169cd6625d AP_NavEKF2: clean up output predictor 2016-07-19 12:16:48 +10:00
priseborough aaab250f13 AP_NavEKF2: Don't start GPS aiding until gyro calibration has stabilised
If we start GPS aiding before the gyro bias variances have reduced, glitches on the GPS can cause attitude disturbances that degrade flight accuracy during early flight.
2016-07-19 12:16:48 +10:00
Lucas De Marchi 4e2b30b413 Global: workaround toolchain problem on windows
The minimum version for gcc was supposed to be 4.9 for any platform.
However our build instructions are outdated. Remove the problematic
parts that use the sparse-endian.h header while we don't fix the setup
for windows.
2016-07-19 09:30:39 +09:00
Lucas De Marchi 913f88f2be AP_BoardConfig: fix check for PX4_V4
When building for px4-v2 we have an warning because we are checking for
the value of this undefined macro. Just change both checks to use
"defined()".

../../libraries/AP_BoardConfig/AP_BoardConfig.cpp:36:7: warning: "CONFIG_ARCH_BOARD_PX4FMU_V4" is not defined [-Wundef]
 #elif CONFIG_ARCH_BOARD_PX4FMU_V4
       ^
2016-07-19 10:28:56 +10:00
Lucas De Marchi 6d1acc5813 AP_InertialSensor: BMI160: remove stray call to set speed
It's already supposed to be on high speed there.
2016-07-18 11:20:49 -03:00
Andrew Tridgell 6776f8ac76 DataFlash: fixed GPS2 log format 2016-07-18 09:19:05 +10:00
Grant Morphett 8d6b417adb AP_SteerController: Adding support for Rovers driving reverse
This change is mostly for handling the reverse yaw.
2016-07-17 08:15:33 +10:00
Grant Morphett b56799f444 AP_L1_Control: Adding support for rover's operating in reverse
Mostly invovles sorting out the reverse yaw when travelling backwards.
2016-07-17 08:15:33 +10:00
Grant Morphett 4e8666cee9 AP_Mission: Adding new MAV_CMD_DO_SET_REVERSE for Rovers.
Rover now supports reverse via this MAV_CMD.
2016-07-17 08:15:33 +10:00
Grant Morphett 647602ed4d AP_Navigation: Adding set_reverse to virtual parent class 2016-07-17 08:15:33 +10:00
Tom Pittenger acaf0c6a5d SITL: LPF the SIM_WIND_DIR and SIM_WIND_SPD values to eliminate step inputs 2016-07-15 18:37:40 -07:00
Andrew Tridgell 4e8b4f29d9 SITL: added -heavy option to fixed wing model 2016-07-16 08:14:29 +10:00
Andrew Tridgell d3d2ce3e0d AP_TECS: use full throttle in initial takeoff
during the first part of a takeoff when we have not yet reached the
target airspeed this forces the throttle to maximum. This fixes a case
where the throttle may drop too low during the first part of takeoff
and lead to a stall.
2016-07-16 08:14:29 +10:00
Gustavo Jose de Sousa ee7c40be61 AP_InertialSensor: BMI160: add backend
The reason of defining BMI160_MAX_FIFO_SAMPLES as 8 can be found on the
following histogram of the number of samples in the FIFO on each read while
performing the accelerometer calibration process:

Samples Count   Freq Acc. Freq
------------------------------
      1  3842 0.1201  0.120111
      2 13172 0.4118  0.531904
      3  9065 0.2834  0.815300
      4  2710 0.0847  0.900022
      5  2231 0.0697  0.969769
      6   816 0.0255  0.995279
      7   137 0.0043  0.999562
      8    13 0.0004  0.999969
     13     1 0.0000  1.000000
2016-07-15 16:46:06 -03:00
Staroselskii Georgii a1f151a79b AP_HAL_Linux: do not create unnecessary consoles in UARTDriver 2016-07-15 15:31:19 -03:00
Staroselskii Georgii 7b3a5e3158 AP_HAL_Linux: use factory method for creation of UARTDriver backends
Using factory method maked it easier to grasp the lifetime of all object
that get created and destroyed. Instead of spanning this thoughout whole
source file we have it nicely encapsulated in this a little horrendeous
_parseDevicePath that is of course to improve more.
2016-07-15 15:29:05 -03:00
Staroselskii Georgii 0ca635bfb8 AP_HAL_Linux: close() console in dtor 2016-07-15 15:28:10 -03:00
Staroselskii Georgii e7a5945056 AP_HAL_Linux: make flow_control a property of SerialDevice rather than UARTDriver's
Make it possible to change flow control settings for individual devices.
2016-07-15 15:26:49 -03:00
Staroselskii Georgii 897d2fb1fb AP_HAL_Linux: use OwnPtr for _device in UARTDriver
Otherwise we're going to leak memory without any need.
Before this fix we've created ConsoleDevice 4 times in case -A switch hadn't been supplied,
but we hadn't ever deleted those. Now there's no memory leak here.
2016-07-15 15:22:51 -03:00
Staroselskii Georgii 3f1e999fc8 AP_HAL_Linux: remove ConsoleDevice construction from UARTDriver constructor
Since we're going to create ConsoleDevice in UARTDriver either way,
there's no need to do anything except setting the console flag.
2016-07-15 14:56:00 -03:00
Andrew Tridgell 1b8da3bce2 HAL_PX4: implement I2CDevice driver for PX4 2016-07-15 12:24:03 -03:00
Luiz Ywata 1f0f36d603 AP_Notify: NavioLED_I2C: use I2CDevice interface 2016-07-14 17:32:33 -03:00
Lucas De Marchi 24cdef24b8 AP_HAL_Linux: remove wrong ifdef
This was added when the support for navio2 went in, but the same ifdef
is already on the lines above.
2016-07-14 17:32:33 -03:00
Luiz Ywata 3e765e23a9 AP_HAL_Linux: RCOutput_PCA9685: use I2CDevice interface 2016-07-14 17:32:33 -03:00
Luiz Ywata d5449a6f20 AP_HAL: Add read method
Provide a more intuitive api for reading an I2CDevice.
2016-07-14 17:32:33 -03:00
Lucas De Marchi 08ea1ea263 AP_HAL_Linux: RCOutput_Bebop: follow coding style
Minor changes to follow coding style and improve readability:

    - sort headers
    - move struct definition to compilation unit rather than header
    - Add braces to if, for, etc
2016-07-14 17:32:33 -03:00
Luiz Ywata 7fb5db8077 AP_HAL_Linux: RCOutput_Bebop: use I2CDevice interface 2016-07-14 17:32:33 -03:00
Lucas De Marchi a34a5c1aa3 AP_Notify: Display_SSD1306_I2C: Fix after conversion to I2CDevice
- Initialize device on hw_init() method, allowing it not to be
      present
    - Add missing lock
    - Add packed attribute to structs
    - Move defines to source file
2016-07-14 17:32:33 -03:00
Luiz Ywata f26692de92 AP_Notify: Display_SSD1306_I2C: use I2CDevice interface 2016-07-14 17:32:33 -03:00
Lucas De Marchi 213c38afaf AP_Notify: ToshibaLED_I2C: add part number comment
It's easier to find the datasheet for this driver with the part number
rather than a generic "toshiba led".
2016-07-14 17:32:33 -03:00
Lucas De Marchi 5618008935 AP_Notify: ToshibaLED_I2C: Fix driver after I2CDevice conversion
- Add missing semaphore take on bus
    - Initialize device on init function rather than constructor: the
      constructor may run before I2CDeviceManager is initialized since our
      AP_Notify objects are static so it can't be used.
2016-07-14 17:32:33 -03:00
Luiz Ywata 0b69e43464 AP_Notify: ToshibaLED_I2C: use I2CDevice interface 2016-07-14 17:32:32 -03:00
Lucas De Marchi e5d519edec AP_ADC: AP_ADC_ADS1115: release bus lock as soon as possible 2016-07-14 17:32:32 -03:00
Lucas De Marchi 85c0c98194 AP_ADC: ADS1115: fix driver after conversion to I2CDevice
In _start_conversion(), the check for return code of _dev->transfer() was
inverted. The structure also needs to be PACKED, otherwise there will be
a hole in the middle.  Fix these issues and use be16_t where it makes
sense.

In read() we need to check for the second byte of config register, so
either make it an array of uint8_t or convert from big endian to host
endianness.  It's simpler to leave it as it was, accessing just the
first byte. Also the conversion value is in be16 type an needs to be
converted to host endiannes, not the opposite.

Fix bus number: all boards that use it expect it to be on bus 1, not 0.
2016-07-14 17:32:32 -03:00
Luiz Ywata 038389f583 AP_ADC_ADS1115: use I2CDevice interface 2016-07-14 17:32:32 -03:00
Lucas De Marchi de5025a46f AP_Airspeed: I2C: fix after conversion to I2CDevice
- Allow to fail init
2016-07-14 17:32:32 -03:00
Luiz Ywata 6c87b2aa7c AP_Airspeed: AP_Airspeed_I2C: use I2CDevice interface 2016-07-14 17:32:32 -03:00
Lucas De Marchi 5ef1568137 AP_HAL_Empty: fix sitl
Sitl or anyone using AP_HAL_Empty implementation doesn't have any
I2CDevice, so it's pointless to return an empty one.
2016-07-14 17:32:32 -03:00
Andrew Tridgell 7d48b25207 AP_Module: use ifdef in function, not caller
suggestion by Lucas
2016-07-14 13:39:48 +10:00
Andrew Tridgell eee9fc88a1 AP_InertialSensor: avoid ifdef for AP_MODULE_SUPPORTED 2016-07-14 13:39:47 +10:00
Andrew Tridgell e82468a529 AP_AHRS: avoid ifdef for AP_MODULE_SUPPORTED 2016-07-14 13:39:47 +10:00
Andrew Tridgell 5ce472ab8a AP_Module: changed hook prefix to ap_hook_ 2016-07-14 13:39:47 +10:00
Andrew Tridgell e8d8ca5eef AP_Module: updated example module 2016-07-14 13:39:47 +10:00
Andrew Tridgell 847bfda48a HAL_Linux: adjust include ordering 2016-07-14 13:39:47 +10:00
Andrew Tridgell dd5d0ffbad HAL_Linux: use default module directory 2016-07-14 13:39:47 +10:00
Andrew Tridgell f29323871f AP_Module: added default module directory 2016-07-14 13:39:47 +10:00
Andrew Tridgell 33ce1213a2 AP_InertialSensor: call gyro_sample and accel_sample AP_Module hooks 2016-07-14 13:39:47 +10:00
Andrew Tridgell 6b6a02e67e AP_Module: also allow export of raw gyro and accel samples
allows for oversampling in image correction
2016-07-14 13:39:46 +10:00
Andrew Tridgell 36181b78de AP_AHRS: fixed build for px4 2016-07-14 13:39:46 +10:00
Andrew Tridgell 7a2d67bde9 AP_Module: added AP_MODULE_SUPPORTED define 2016-07-14 13:39:46 +10:00
Andrew Tridgell 107f76828d HAL_Linux: added AP_Module support 2016-07-14 13:39:46 +10:00
Andrew Tridgell 15a01eefb1 AP_AHRS: added AHRS_update hook 2016-07-14 13:39:46 +10:00
Andrew Tridgell bd00beaf99 AP_Module: added external module hook library
this allows for external modules to be called at defined hook
locations in ArduPilot. The initial example is a module that consumes
the AHRS state, but this can be generalised to a wide variety of hooks
2016-07-14 13:39:46 +10:00
Andrew Tridgell f3f34be9c4 SITL: added comment on heli interlock 2016-07-12 20:50:22 +10:00
Jonathan Challinger 630e5378da AC_PosControl: add get_horizontal_error 2016-07-12 18:40:25 +09:00
Jonathan Challinger 8fe0c1b05b AC_PrecLand: don't run if not enabled 2016-07-12 18:40:25 +09:00
Jonathan Challinger e84d1581ab AC_PrecLand: use new irlock interface, refactor backend interface 2016-07-12 18:40:25 +09:00
Jonathan Challinger 6254608c45 AP_IRLock: refactor interface 2016-07-12 18:40:25 +09:00
Andrew Tridgell 4f17093add SITL: give a bit more pitch on tail in XPlane heli 2016-07-12 19:08:50 +10:00
Andrew Tridgell fdd20830d6 SITL: use flaps for collective on helis in X-Plane 10
works for more helis
2016-07-12 19:08:50 +10:00
Randy Mackay 6e224158f1 AP_GPS_MAV: use GPS_INPUT_IGNORE_FLAGS 2016-07-12 15:44:46 +09:00
Randy Mackay e34aa0bc72 AP_GPS_MAV: minor formatting fixes
No functional change
2016-07-12 15:44:19 +09:00
Allan Matthew 4249f7dbe6 AP_GPS: Add GPS_MAV type and accept GPS_INPUT message 2016-07-12 15:34:27 +09:00
Tom Pittenger 84ce499a0d AP_Baro: remove zero-init in constructor 2016-07-11 22:11:34 -07:00
Tom Pittenger 1d81df8144 Revert "AP_Baro: coverity scan - variables not initialized in constructor"
This reverts commit 8d2872d3ab.
2016-07-11 22:02:41 -07:00
Tom Pittenger 9fb4a928e5 Revert "AP_Airspeed: coverity scan - variables not initialized in constructor"
This reverts commit 93462d0fe3.
2016-07-11 22:02:22 -07:00
Tom Pittenger fc02908c0d Revert "GCS_MAVLink: coverity scan - variables not initialized in constructor"
This reverts commit bd8debdf8b.
2016-07-11 22:01:50 -07:00
Tom Pittenger 773372d2f3 Revert "AP_TECS: coverity scan - variables not initialized in constructor"
This reverts commit 753c0d47f0.
2016-07-11 22:01:26 -07:00
Tom Pittenger c38c3ae7fe Revert "AP_TECS: coverity scan: init variable struct"
This reverts commit 19713200e5.
2016-07-11 22:01:02 -07:00
Tom Pittenger be752164f4 Revert "AP_L1_Control: coverity scan - variables not initialized in constructor"
This reverts commit d558f32142.
2016-07-11 21:59:12 -07:00
Andrew Tridgell 871219d199 SITL: support helicopters with X-Plane 10
we get collective from "throttle2" and get interlock from generator1 on/off
2016-07-12 14:40:08 +10:00
priseborough 8793c75da0 AP_NavEKF2: clean up mag field learned logic 2016-07-11 00:44:33 +10:00
priseborough e6592186fc AP_NavEKF2: Tuning update
Slow down magnetic field learning
2016-07-10 08:21:18 +10:00
priseborough 10470b2dc1 AP_NavEKF2: fix bug in initialisation of declination co-variances
Co-variances were being re-zeroed after being set. This meant that the initial declination learning was sensitive to measurement errors which could result in poor initial yaw accuracy.
2016-07-10 08:21:18 +10:00
priseborough 6b04a81b8d AP_NavEKF2: Fix plane in-flight yaw reset bug
Fixes bugs that prevented planes being able to reset yaw to GPS to recovery from takeoff with a bad magnetoemter.

1) If the velocity innovation check had not failed by the time the in-air transition occurred, then the yaw reset would not be performed
2) The velocity states were not being reset
3) The non fly-forward vehicle (copter) reset could occur first and effectively lock out the fly-forward vehicle (plane) yaw check.
2016-07-10 08:21:18 +10:00
priseborough 51dbed2338 AP_NavEKF2: remember mag field states between flight on same power cycle
Remember the mag bias and earth field states learned during flight when the vehicle  lands.
This improves performance for vehicles that do multiple flight on one power cycle
2016-07-10 08:21:18 +10:00
priseborough 136df7cb5c AP_NavEKF2: reduce declination errors on start of 3-axis fusion
Reset co-variances for NE field states.
2016-07-10 08:21:18 +10:00
priseborough 744f19cd2d AP_NavEKF2: Improve scaling of output predictor I gain
Provide consistent overshoot of 5% across a wider range of time constants and prevent selection of larger time constants causing 'ringing' in the position and velocity outputs.
2016-07-09 15:57:36 +10:00
priseborough a49c16d63c AP_NavEKF2: Update output filter tuning
Updated tuning to take advantage of corrected time delta dtEkfAvg
2016-07-09 15:57:36 +10:00
priseborough 55dee347e0 AP_NavEKF2: Fix bug in averaged filter delta time
Average EKF time delta was not being updated.
2016-07-09 15:57:36 +10:00
priseborough cc7caa27bc DataFlash: Use a unique struct for EKF2 logging 2016-07-09 15:57:35 +10:00
priseborough 772c719df3 DataFlash: log tracking error for active instance of EKF2 2016-07-09 15:57:35 +10:00
priseborough 927186339c AP_NavEKF2: Improved output predictor tracking
Implement a PI feedback controller for velocity and position state tracking
2016-07-09 15:57:35 +10:00
priseborough 00b66ddc07 DataFlash: Log EKF2 output predictor tracking data 2016-07-09 15:57:35 +10:00
priseborough 253f744824 AP_NavEKF2: Collect output predictor tracking data 2016-07-09 15:57:35 +10:00
priseborough 14bb4f4574 AP_NavEKF2: Publish output observer tracking errors 2016-07-09 15:57:35 +10:00
priseborough fa435d0323 AP_NavEKF2: Allow for faster accel bias change in-flight
Fixes a problem observed in a flight log where rapid temperature change caused the accel bias to change faster than the EKF could keep up.
This allows the bias to be learned faster but with acceptable level of noise in the estimate
2016-07-09 15:57:35 +10:00
priseborough 191c34612d AP_NavEKF2: Fix bug in use of corrected IMU data
IMU data was being corrected before being used by the co-variance prediction, whereas the delta angles and velocities in the derivation were supposed to be uncorrected.
This patch creates separate variable for the corrected data
2016-07-09 15:57:35 +10:00
priseborough 118d5b88b2 AP_NavEKF2: Clean up output observer and reduce pos vel time constant
Previous Time constant was too large leading to poor tracking of EKF states in the presence of bad quality IMU data.
2016-07-09 15:57:35 +10:00
Lucas De Marchi b9f65996bc AP_HAL: sparse-endian: unconditionally use byteswap.h
This is either provided by a system header or a minimal header from
'missing' directory.
2016-07-08 19:49:32 -03:00
Lucas De Marchi 471de28967 AP_Common: provide minimal byteswap.h and endian.h 2016-07-08 19:49:32 -03:00
Lucas De Marchi 40338c3272 AP_HAL: sparse-endian: use pragma once 2016-07-08 19:49:32 -03:00
Lucas De Marchi 6a80c3d70d AP_HAL: RingBuffer: remove trailing whitespaces 2016-07-08 16:44:26 -03:00
Lucas De Marchi 24c7f76034 AP_HAL: RingBuffer: remove C++11 initialization
They are already initialized in the constructor.
2016-07-08 16:44:09 -03:00
Murilo Belluzzo 3e1acdcbbf AP_HAL: Use atomic instead volatile on RingBuffer head/tail
Volatile will provide protection to sequence re-ordering and guarantee
the variable is fetched from memory, but it won't provide the memory
barrier needed to ensure that no re-ordering (by either the compiler or
the CPU) will happen among other threads of execution
accessing the same variables.

For more info about this effect can be found on articles about
std::memory_order.
2016-07-08 16:12:53 -03:00
Murilo Belluzzo b7dd4dad64 AP_HAL: Fix ByteBuffer::reserve() breaking buffer state
When using reserved(), the reserved memory cannot be read before it's
written, therefore we cannot update 'tail' until the caller of
reserved() is done writing.

To solve that, a method called 'commit()' was added so the caller can
inform that is done with the memory usage and is safe to update 'tail'.
The caller also has to inform the length that was actually written.

This solution was developed to work considering the usage context of
this class: 1 reader and 1 writer **only**.
2016-07-08 13:10:16 -03:00
Murilo Belluzzo 43d4012884 AP_HAL: Fix TOCTOU in ByteBuffer::peekiovec() 2016-07-08 13:10:16 -03:00
Murilo Belluzzo 9951b94d40 AP_HAL: Change the return type of 'peekiovec'
Possible values are '0', '1' and '2' so uint8_t is a better fit. Also,
invert 'if' condition so it's clear that is returning 0, 1 or 2.
2016-07-08 13:10:16 -03:00
Murilo Belluzzo 625f47def7 AP_HAL: Improve ByteBuffer::set_size
So it doesn't delete and re-create the buffer if the size
happens to be the same. Still resets the buffer content.
2016-07-08 13:10:16 -03:00
Murilo Belluzzo e9e31172c0 AP_HAL: Simplify ByteBuffer::readptr logic 2016-07-08 13:10:16 -03:00
Leandro Pereira fbefe32017 AP_HAL: Add method to reserve space in the ring buffer
Adds a method called `reserve()`, that will take a ByteBuffer::IoVec
array of at least two elements, and return the number of elements
filled out.  0 will be returned if `len` is over the total space of
the buffer; 1 will be returned if there's enough contiguous bytes in
the buffer; 2 will be returned if there are two non-contiguous blocks
of memory.

This method is suitable to be used with POSIX system calls such as
readv(), and is an optimization to not require temporary memory copies
while reading from a file descriptor.

Also modify the write() method to use reserve(), so that similar checks
are performed only in one place.
2016-07-08 13:10:16 -03:00
Leandro Pereira e3b676ba89 AP_HAL: Add method to peek non-contiguous parts of a ByteBuffer
Modify ByteBuffer class to have a `peekiovec()` method, that takes in a
`struct IoVec` array (similar to `struct iovec` from POSIX), and a
number of bytes, and returns the number of elements from this array
that have been filled out.  It is either 0 (buffer is empty), 1
(there's enough contiguous bytes to read that amount) or 2 (ring buffer
is wrapping around).

This enables using scatter-gather I/O (i.e. writev()), removing calls
to memcpy().  That's one call when no wrap-around is happening, and
two calls if it is.

Also, rewrite `ByteBuffer::peekbytes()` to use `peekiovec()`, so that
some of the checks performed by the former are not replicated in the
latter.
2016-07-08 13:10:16 -03:00
Lucas De Marchi efb6b4c57e DataFlash: ifdef both __APPLE__ and __MACH__
This is how we do in other places and should mean that we are targetting
MacOS, not other apple products or other OSes using a mach kernel.
2016-07-07 12:41:51 -03:00
Siddharth Bharat Purohit d65f453da1 AP_HAL_SITL:use common fenv function 2016-07-07 11:35:18 -03:00
Lucas De Marchi c728b6c164 AP_Common: missing/fenv: fix coding style 2016-07-07 11:35:18 -03:00
Siddharth Bharat Purohit 484db9ff82 AP_Common: add replacements for fe control functions systems without them 2016-07-07 11:35:18 -03:00
Siddharth Bharat Purohit 8903bc9eab AP_HAL: add support for get realtime on Darwin systems 2016-07-07 11:35:17 -03:00
Andrew Tridgell f090e9b27c HAL_Linux: fixed makefile build with PRIu64 2016-07-07 15:10:59 +10:00
Lucas De Marchi 3ba27df405 AP_Compass: BMM150: minor refactors
- Correctly sort includes and add missing AP_Math.h
  - Use anonymous struct for trim_registers in _load_trim_values,
    renaming its members so they don't start with underscore
  - Don't change _dig* values when we failed to read from sensor
  - Add some blank lines
  - Make _dig_* members be inside a _dig struct
  - Use constrain_int32 instead of if/else chain
  - s/time_us/time_usec/
  - Construct raw_field with a single constructor in _update()
  - Add missing copyright notice
  - Group methods together in declaration
2016-07-06 10:04:05 -03:00
José Roberto de Souza 6e53854122 AP_Compass: Add BMM150 backend 2016-07-06 10:03:30 -03:00
Fernandes Pinheiro, Daker 51bf638ad3 PID: Remove unused method get_pid_4500 2016-07-06 08:45:01 +09:00
Tom Pittenger 19713200e5 AP_TECS: coverity scan: init variable struct 2016-07-05 14:09:40 -07:00
Tom Pittenger 6d0cf22358 AP_TECS: spelling 2016-07-05 14:09:39 -07:00
Tom Pittenger 753c0d47f0 AP_TECS: coverity scan - variables not initialized in constructor 2016-07-05 13:53:26 -07:00
Tom Pittenger 5f16d873b8 AP_L1_Control: coverity scan - ignoring get_position() result
- if no GPS location is available, do not continue computing navigation values. Hold old nav/target bearings and allow GPS failsafe to switch modes
2016-07-05 13:32:34 -07:00
Tom Pittenger a74e86c234 GCS_MAVLink: coverity scan - computed value overwritten without use for SITL
- when building for SITL we should just skip the num_sends work instead of overwriting the value
2016-07-05 13:32:29 -07:00
Tom Pittenger bd8debdf8b GCS_MAVLink: coverity scan - variables not initialized in constructor 2016-07-05 13:32:24 -07:00
Tom Pittenger 8d2872d3ab AP_Baro: coverity scan - variables not initialized in constructor 2016-07-05 13:32:06 -07:00
Tom Pittenger 93462d0fe3 AP_Airspeed: coverity scan - variables not initialized in constructor 2016-07-05 13:32:00 -07:00
Tom Pittenger d558f32142 AP_L1_Control: coverity scan - variables not initialized in constructor 2016-07-05 13:28:52 -07:00
Andrew Tridgell 0be442d34b SITL: improved throttle input in XPlane
reduce chance that throttle output will be interpreted as input
2016-07-05 09:48:40 +10:00
Andrew Tridgell f387f248d3 SITL: added support for servo slew rates and retract servos
this is for tiltrotors with retract servos
2016-07-05 09:40:37 +10:00
Luis Vale Gonçalves 334233d48f AP_BoardConfig: fix spelling in parameter description
witch ->no
switch->yes
2016-07-04 21:59:30 +09:00
Randy Mackay e820506c5a AC_Fence: add polygon fence check to check_destination_within_fence 2016-07-04 18:25:03 +09:00
Randy Mackay a9d1dcd6ac AC_Fence: trigger reloading of polygon fence if update from GCS
The GCS can either modify a point with a mavlink message or directly change the FENCE_TOTAL parameter value
2016-07-04 18:25:03 +09:00
Jonathan Challinger 0eac5a5c8f AC_PrecLand: remove zero terms from math 2016-07-04 16:57:06 +09:00
Jonathan Challinger b5e80148c6 AC_WPNav: remove shift_loiter_target 2016-07-04 16:57:06 +09:00
Jonathan Challinger f74e162451 AC_PrecLand: redo math, simplify interface 2016-07-04 16:57:06 +09:00
Randy Mackay 4bedc57cbe DataFlash: rename SBFE's Long field to Lng
This naming is consistent with the other GPS messages
2016-07-04 11:17:14 +09:00
Randy Mackay 032e834849 Dataflash: log rally points 2016-07-04 11:17:09 +09:00
Andrew Tridgell 11975223dd AP_Motors: added H_RSC_POWER_NEGC and H_RSC_SLEWRATE
this gives more control over throttle for petrol
helis. H_RSC_POWER_NEGC allows for a asymmetric V-curve, which allows
for less power being put into the head when landing or when sitting on
the ground. That can lead to significantly less vibration and chance
of ground oscillation. A heli not being flown with aerobatics does not
need to use high throttle at negative collective pitch.

The H_RSC_SLEWRATE allows for a maximum throttle slew rate to be
set. Some petrol motors can cut if the throttle is moved too
quickly. We had this happen at a height of 6m when switching from
ALT_HOLD to STABILIZE mode. It also lowers the chance of the blades
skewing in their holders with the sudden change of power when the heli
is disarmed. In general it is a bad idea to do instantaneous large
movements of a IC engine throttle.
2016-07-03 18:29:05 +10:00
Andrew Tridgell 918c41b1e4 AP_BoardConfig: fixed IMU_TARGTEMP index 2016-07-03 12:54:27 +10:00
Andrew Tridgell 3377714300 RC_Channel: fixed typo 2016-07-01 15:35:55 +10:00
Andrew Tridgell a331542958 GCS_MAVLink: fixed typo 2016-07-01 15:35:49 +10:00
Andrew Tridgell 4dcff15603 DataFlash: fixed typo 2016-07-01 15:35:45 +10:00
Andrew Tridgell 50958bc026 AP_RangeFinder: fixed typo 2016-07-01 15:35:39 +10:00
Andrew Tridgell 1f2216982d AP_Mount: fixed typo 2016-07-01 15:35:34 +10:00
Andrew Tridgell bc7488e2f2 AP_Motors: fixed typos 2016-07-01 15:35:29 +10:00
Andrew Tridgell cb858d2c99 AP_InertialSensor: fixed typo 2016-07-01 15:35:22 +10:00
Andrew Tridgell 081df44d92 HAL_QURT: fixed typo 2016-07-01 15:35:15 +10:00
Andrew Tridgell 6e065b3fe2 AP_HAL: fixed typo 2016-07-01 15:35:07 +10:00
Andrew Tridgell 86ceee4a53 AC_WPNav: fixed typo 2016-07-01 15:34:56 +10:00
Andrew Tridgell 45c72eb442 AP_BoardConfig: added BRD_IMU_TARGTEMP
set target temperature for IMU
2016-07-01 15:29:52 +10:00
Andrew Tridgell 834acaffee AP_InertialSensor: provide IMU temperature to HAL for all boards 2016-07-01 15:29:52 +10:00
Andrew Tridgell 7c2e4d0419 HAL_PX4: implement IMU heater in hal.util for Pixhawk2 2016-07-01 15:29:52 +10:00
Andrew Tridgell 461c159b22 HAL_Linux: use set_imu_target_temp() API 2016-07-01 15:29:52 +10:00
Andrew Tridgell 8617db89dc AP_HAL: added hal.util->set_imu_target_temp() API 2016-07-01 15:29:52 +10:00
Leonard Hall fe68fe65e2 AP_Motors: Single and Coax fix flap gains 2016-07-01 12:45:14 +09:00
Andrew Tridgell fc9283964a HAL_SITL: fixed segv on cygwin 2016-06-30 20:45:03 +10:00
Andrew Tridgell 82f131667d SITL: added flaps control in XPlane 2016-06-30 20:26:00 +10:00
Andrew Tridgell 934d2b6ae4 RC_Channel: added setup_failsafe_trim_mask() 2016-06-30 16:46:57 +10:00
Andrew Tridgell a071fa3921 AP_Param: display defaults path on startup 2016-06-30 14:16:52 +10:00
Andrew Tridgell beb3591f67 HAL_Linux: improved help output and errors for udp and bcast 2016-06-28 21:01:45 +10:00
Andrew Tridgell 72b5cecdb2 HAL_Linux: added udpin support to HAL_Linux
useful for setting up ardupilot as a mavlink UDP listener
2016-06-28 21:01:43 +10:00
Paul Riseborough 4a8689aa97 AP_NavEKF2: remove duplicate if statements from mag fusion 2016-06-28 14:20:13 +10:00
Paul Riseborough e117bedf6a AP_NavEKF2: Adjust output observer tuning
Use more accurate method by default.
Reduce overshoot on quaternion tracking
2016-06-28 14:20:13 +10:00
Paul Riseborough 5c59922574 AP_NavEKF2: Fix bug that could publish bad compass offsets
Magnetometer bias states will subject to larger errors early in flight before flight motion makes the offsets observable and the state variances reduce.
Adds a check on state variances.
Replaces the parameter check with a check of the actual filter fusion method being used.
2016-06-28 14:20:13 +10:00
Paul Riseborough 165335b9e3 AP_NavEKF2: Improve ability to tune magnetic field learning
Allow different process noise to be set for body (sensor bias) and earth field states.
This allows a stable magnetometer bias estimate to be available at end of flight whilst still allowing for external magnetic anomalies during landing.
Adjust default values to give stable mag bias learning and fast learning of external anomalies.
2016-06-28 14:20:12 +10:00
Paul Riseborough 6523481c76 AP_NavEKF2: Improve tracking accuracy of output predictor
Automatically use the highest gain consistent with a 5% overshoot to minimise RMS tracking errors.
Provide an alternative correction method for the position and velocity states that allows the user to specify the time-constant. This can be used to fine tune the output observer for for platform specific sensor errors and control loop sensitivity estimation noise.
2016-06-28 14:20:12 +10:00
Paul Riseborough fe06606193 AP_NavEKF2: Ensure corrected IMU data used by EKF
Don't try to pop new IMU data from the buffer unless we have written data.
Correct IMU data as soon as it is popped from the buffer
2016-06-28 14:20:12 +10:00
Paul Riseborough 1400dc9d02 AP_NavEKF2: Add tuning parameters for magentic yaw fusion
Enable simple magnetic yaw fusion observation noise and innovation consistency check gate width to be tuned independantly.
2016-06-28 14:20:12 +10:00
Paul Riseborough dc6836988c AP_NavEKF2: Improve ground based magnetic anomaly protection for copter
The toilet bowling check during early flight has been removed. This check caused problems where bad compass calibration was the cause of the toilet bowling and resetting to the compass was a bad option. The handling of simultaneous failed mag and velocity innovations is already handled outside the EKF by the failsafe.
A check for yaw errors due to a ground based magnetic anomaly has been introduced.
The logic for in-flight yaw and magnetic field resets has been cleaned up and variable names improved.
2016-06-28 14:20:12 +10:00
Paul Riseborough 703f56908f AP_NavEKF2: Correct comment 2016-06-28 14:20:12 +10:00
Paul Riseborough 26815ace7a AP_NavEKF2: Remove redundant logic check 2016-06-28 14:20:12 +10:00
Jonathan Challinger bd8c804ab5 AP_NavEKF2: correct comments 2016-06-28 14:20:12 +10:00
Jonathan Challinger ebae95d7f6 AP_NavEKF2: apply corrections to new inertial data when using for output prediction 2016-06-28 14:20:11 +10:00
Jonathan Challinger 2f709dfe86 AP_NavEKF2: improve inertial prediction 2016-06-28 14:20:11 +10:00
Paul Riseborough 262c5fe56d AP_NavEKF2: Make setter loop through all instances
For setters where a success boolean is returned, return false if any instance fails.
2016-06-28 14:20:11 +10:00
Jonathan Challinger 8baf064317 AP_NavEKF2: setTakeoffExpected and setTouchdownExpected loop through instances 2016-06-28 14:20:11 +10:00
Paul Riseborough ec5c460584 AP_NavEKF2: Fix predicted nav reporting
Predicted nav should never be false if current nav is true
2016-06-28 14:20:11 +10:00
Jonathan Challinger 99f481e098 AP_NavEKF2: always calcGpsGoodForFlight 2016-06-28 14:20:11 +10:00
Jonathan Challinger 3382e09580 AP_NavEKF2: add height constraint during takeoff 2016-06-28 14:20:11 +10:00
Paul Riseborough 4bb46af861 AP_NavEKF2: Increase allowable gyro bias offset 2016-06-28 14:20:10 +10:00
Andrew Tridgell af23a681e0 AP_BoardConfig: improved docs for BRD_SAFETYENABLE 2016-06-28 09:58:55 +10:00
Lucas De Marchi 1f96336f7c Global: rename bus type enum entries 2016-06-27 17:51:41 -03:00
Gustavo Jose de Sousa f6bebc96c0 AP_InertialSensor: INS_generic: remove unused includes 2016-06-27 17:22:43 -03:00
Gustavo Jose de Sousa e85ac8b2c5 AP_InertialSensor: inform maximum gyro average difference
While at it, define GYRO_INIT_MAX_DIFF_DPS.
2016-06-27 17:22:43 -03:00
Gustavo Jose de Sousa e6f62080f5 AP_InertialSensor: fix best_diff on gyro initialization
Without this patch, if accel_diff.length() > 0.2f and j == 0, then
best_diff[k] would be zero forever since diff_norm[k] >= 0 for any j.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa de94392759 AP_InertialSensor: MPU9250: remove _bus_type field
Use _dev->bus_type instead.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa 83feb2e2ae AP_InertialSensor: MPU9250: let Device handle read flag
There's no need to handle that in MPU9250 anymore.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa 1e99a7125c AP_InertialSensor: MPU9250: remove _register_write_check()
That function isn't used in the code base and there should be a better way to
debug writes on registers.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa a6e5eb9e14 AP_InertialSensor: MPU6000: remove _bus_type field
Use _dev->bus_type instead.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa 0718649c8b AP_InertialSensor: MPU6000: let Device handle read flag
There's no need to handle that in MPU6000 anymore.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa 309fe4a88c AP_InertialSensor: MPU6000: remove _register_write_check()
That function isn't used in the code base and there should be a better way to
debug writes on registers.
2016-06-27 17:20:51 -03:00
Gustavo Jose de Sousa d35cf60ce1 AP_HAL_Linux: I2CDevice: use read flag in read_registers_multiple
Use the generic support in Device interface for read flag when we are
using read_registers_multiple() method.
2016-06-27 17:20:46 -03:00
Gustavo Jose de Sousa 66f1ad9ed0 AP_HAL: Device: add support for read flag
Many of our SPI and I2C sensors define the protocol of setting the most
significant bit of the register address in order to perform a read operation.
Thus, enable the use of a "read flag" that is ORed with the register's address.
Since this is an abstraction for general devices, it's a good idea to have zero
as the default value for that flag.

While at it, add documentation to read_registers().
2016-06-27 17:18:35 -03:00
Gustavo Jose de Sousa b6a1d598e3 AP_HAL: Device: document write_register() 2016-06-27 17:18:35 -03:00
Gustavo Jose de Sousa 4693501d9d AP_HAL: Device: add bus_type field
Sometimes it's necessary to know the type of bus to make some decisions where
AP_HAL::Device abstraction is used.
2016-06-27 17:18:35 -03:00
Michael du Breuil c2da36d505 GCS_MAVLink: fix race condition when recieving last waypoint
only shows up when the waypoint is about to time out
2016-06-27 10:57:14 +10:00
Andrew Tridgell 689595080a AP_Airspeed: ensure we have at least 10 samples for airspeed cal
thanks to Michael for pointing out this issue
2016-06-27 10:52:59 +10:00
Tom Pittenger 37f990bfad AP_ADSB: allow param based VEHICLE list sizes, 1 to 100. 2016-06-26 11:03:33 -07:00
Lucas De Marchi b70b9ed8d1 AP_HAL_Linux: fix warning on 64b printf
../../libraries/AP_HAL_Linux/Perf.cpp: In member function ‘void Linux::Perf::_debug_counters()’:
../../libraries/AP_HAL_Linux/Perf.cpp:85:36: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=]
                     c.name, c.count);
                                    ^
2016-06-25 12:05:55 -03:00
Daniel Ricketts 865aad7598 AC_Avoid: add support for stopping at polygon fence 2016-06-25 15:55:55 +09:00
Randy Mackay 26a6234a29 AC_Avoid: do not attempt to stop at circular fence if already breached 2016-06-25 15:55:55 +09:00
Randy Mackay c6f9889a25 AC_Avoid: constify get_max_speed
Also get_stopping_distance and get_margin
2016-06-25 15:55:55 +09:00
Randy Mackay 5153c3d195 AC_Fence: merge with add polygon support 2016-06-25 15:55:55 +09:00
Randy Mackay d91805edbf AC_Fence: add support for polygon fences 2016-06-25 15:55:55 +09:00
Randy Mackay f0bb1ac1d2 AC_Fence: AC_Polygon_loader loads points from eeprom
Thanks to Peter Barker for his work to library-ify Plane's geofence which was the basis for this work.
2016-06-25 15:55:55 +09:00
Daniel Ricketts 249d95b413 AP_Math: add Polygon_outside and Polygon_complete functions 2016-06-25 15:55:55 +09:00
Leonard Hall 80bda572ba AC_AttutudeControl: Yaw shift fix 2016-06-24 18:15:48 +09:00
Leonard Hall a5bb3c206e Dataflash: Log rate to degrees 2016-06-24 17:17:16 +09:00
Leonard Hall 8737f6b62d AC_AttitudeControl: enhanced quaternion attitude controller 2016-06-24 17:17:11 +09:00
Leonard Hall 117ae89505 AC_AttitudeControl: increase SLEW_YAW default to 60deg/sec 2016-06-24 16:24:17 +09:00
Leonard Hall e0eecd56b2 AP_Math: use is_zero and float constants 2016-06-24 16:16:34 +09:00
Leonard Hall 7f933140c7 AP_Math: small formatting fix to quaternion rotation_matrix
No functional change
2016-06-24 16:16:33 +09:00
Leonard Hall 8afd29cc85 AP_Math: add quaternion::rotation_matrix_norm 2016-06-24 16:16:28 +09:00
Randy Mackay a1548405c1 AC_AttitudeControlHeli: fix althold lean angle max 2016-06-24 15:03:59 +09:00
Andrew Tridgell 1f29b51dd6 AP_Vehicle: moved roll_limit_cd into AP_Vehicle
will be used by APM_Control
2016-06-24 11:39:21 +10:00
Andrew Tridgell 8a03b3ba22 APM_Control: reduce elevator when past LIM_ROLL_CD
this reduces elevator control when rolled over hard in fixed
wing. Using the elevator when on the side just caused earth frame yaw
and is counter productive. It can also prevent some aircraft from
recovering from inverted flight.
2016-06-24 11:28:18 +10:00
Andrew Tridgell a6e927d434 SITL: default gyro cal off in XPlane and FlightAxis
pointless doing cal on these backends
2016-06-24 10:32:52 +10:00
Gustavo Jose de Sousa f9cb760691 AP_Mount: use ARRAY_SUBSCRIPT instead of bytes field
That fixed compilation issues and seems more semantically correct. Using array
of length 0 fails compilation because of -Werror=array-bounds in GCC 6.1.
2016-06-23 21:02:05 -03:00
Gustavo Jose de Sousa 174cefa8a5 AP_GPS: use ARRAY_SUBSCRIPT instead of bytes field
That fixed compilation issues and seems more semantically correct. Using array
of length 0 fails compilation because of -Werror=array-bounds in GCC 6.1.
2016-06-23 21:02:05 -03:00
Lucas De Marchi 1962acad49 AP_Common: simplify ARRAY_SUBSCRIPT macro
Add DEFINE prefix, since this macro is defining these operators and
remove the parameter since we will always use it to access a
union/struct as a byte array.
2016-06-23 21:02:05 -03:00
Gustavo Jose de Sousa 5154369e9d AP_Common: define the ARRAY_SUBSCRIPT macro 2016-06-23 21:02:05 -03:00
Lucas De Marchi 4a18108600 AP_HAL_Linux: rename min, max and avg fields
These were probably named otherwise in order not to conflict with
min/max macros from math.h. We don't have this problem anymore.
2016-06-23 19:08:14 -03:00
Lucas De Marchi b8e3e549c7 AP_HAL_Linux: Perf: add debug method
Test code for integration with another thread to pull data from internal
perf counters.  Since we are using the timer thread here, there's no
retry mechanism and we only print that data can be corrupted.
2016-06-23 19:08:14 -03:00
Lucas De Marchi 1727418dc9 AP_HAL_Linux: Perf: make lttng use internal fields
Instead of creating a new object Perf_Lttng copying the necessaries
fields, just make a tighter integration with the internal perf counters
and re-use the same fields.
2016-06-23 19:06:30 -03:00
Lucas De Marchi 619ce23799 AP_HAL_Linux: Perf: rework integration with other tools
The idea is to leave the internal perf enabled all the time, like it is
in PX4, and then allow the integration with lttng on top. Next step
would be to runtime enable/disable only the perf counters we are
interested in.

This also changes the structure so it's easy to allow another thread to
pull data from the Perf object. A rw lock protects from addition of new
counters and an atomic unsigned int allows other threads to do a
lockless copy of the data.

In order for this to work the allocation was changed to use a single
memory pool instead of returning a calloc'ed data for each perf counter.
Since most of our counters are of ' elapsed' type, don't bother using a
smaller struct for the 'count' type
2016-06-23 19:06:30 -03:00
Lucas De Marchi b687473174 AP_HAL_Linux: ignore unused result on panic
There's not much we can do if the write() call inside a panic function
failed. Just ignore the failure.
2016-06-23 18:34:01 -03:00
Lucas De Marchi 8a58c06adb AP_Common: add macro to ignore unused result
In some cases we want to call functions annotated with
warn_unused_result but we know it's safe to ignore the return value.
Prefixing with (void) used to work, but it doesn't do anymore on all
versions of gcc and clang.
See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425

This solution is a mix of the solutions provided in the above bug report
and the one provided by Gustavo Sousa at
https://github.com/ArduPilot/ardupilot/pull/4277#issuecomment-224957375
2016-06-23 18:34:01 -03:00
Francisco Ferreira ac90527da5 AP_Common: change check from GCC version to glibc version (and Cygwin) 2016-06-23 18:19:54 +10:00
Patrick J.P eb44d75ed8 AP_HAL: Remove trailing spaces from AP_HAL_Namespace.h 2016-06-22 16:03:30 -03:00
Randy Mackay a427768087 AC_Avoidance: reduce maximum acceleration to 1m/s/s
This makes the vehicle slow very gently as it approaches the edge of the fence
2016-06-22 11:38:15 +09:00
Daniel Ricketts 8a6aa24525 AC_WPNav: use AC_Avoidance to stop at fence during Loiter 2016-06-22 11:38:15 +09:00
Daniel Ricketts ff7bc7c0cb AC_Avoidance: add library to stop at circular fence 2016-06-22 11:38:15 +09:00
Daniel Ricketts e60710332b AC_Fence: add accessors to return radius and safety margin 2016-06-22 11:38:15 +09:00
Andrew Tridgell d1b28aaed9 AC_AttitudeControl: fixed factor of 1000 error in init_takeoff 2016-06-22 11:48:43 +10:00
Lucas De Marchi 39d4fa2cf8 Revert changes to cmath according to gcc version
Revert these commits:
	"AP_Common: gcc 4.9.2 behaves differently from 4.9.3"
	"AP_Common: this workaround for missing/cmath is also needed for gcc 4.9.3"

This breaks the build for PX4. The change is related to the libc, not
the compiler version. We have an workaround there based on compiler
version just because it's usual to have a more recent libc version when
you have a recent compiler.
2016-06-21 13:54:41 -03:00
Lucas De Marchi 9738be0ed6 AP_HAL: remove tabs and trailing whitespaces 2016-06-21 13:09:00 -03:00
Lucas De Marchi ab66e3a69a AP_HAL_Linux: Perf: simplify function to get current time 2016-06-21 13:09:00 -03:00
Pierre Kancir a8e5ff93b5 AP_Math: Correct missing declaration warning 2016-06-21 12:17:46 -03:00
Lucas De Marchi 1d9d0a40db AP_HAL_Linux: GPIO: reduce macro and variable scopes
Also change the coding style in a few places.
2016-06-21 12:16:32 -03:00
Lucas De Marchi 4f14b9b7e2 AP_HAL_Linux: ToneAlarm_Raspilot: add fixme comment 2016-06-21 12:16:32 -03:00
Lucas De Marchi e122b2b651 AP_HAL: GPIO: remove unused functions
These functions are not used by any HAL, so remove them.
2016-06-21 12:16:32 -03:00
Lucas De Marchi 0bb86ae498 AP_HAL_Linux: GPIO_RPI: remove unused functions
These functions to use pins as pwm are never used in the codebase, so
remove them.
2016-06-21 12:16:32 -03:00
Andrew Tridgell 2108127712 AP_Common: gcc 4.9.2 behaves differently from 4.9.3
tested 4.9.3 on cygwin, 4.9.2 on ubuntu

I do hope that it doesn't depend on the OS
2016-06-21 21:34:54 +10:00
Andrew Tridgell 224c714c83 AP_Common: this workaround for missing/cmath is also needed for gcc 4.9.3
tested on cygwin with 4.9.3
2016-06-21 19:19:09 +10:00
Peter Barker 309ac53806 SITL: correct adsb initialisation
Parameters have not yet been initialised in _sitl_setup, so move
should-run checks into update
2016-06-20 18:16:34 -07:00
Andrew Tridgell 569443231a SITL: improved altitude data in XPlane 2016-06-20 12:52:13 +10:00
Andrew Tridgell 51fff00871 SITL: report data and frame rates in XPlane
and avoid time going backwards if possible
2016-06-20 12:52:13 +10:00
Andrew Tridgell b7395ee74b SITL: fixed sign of magnetic inclination 2016-06-20 11:17:36 +10:00
Andrew Tridgell 5b7b799046 SITL: fixed mag field in JSBSim and last_letter 2016-06-20 11:07:51 +10:00
Leonard Hall ba2382c409 AP_MotorsCoax: Fix servo 3 and 4 feed through sign 2016-06-20 09:45:17 +09:00
Andrew Tridgell 16595d2f3b SITL: auto-set AHRS_EKF_TYPE to 10 for XPlane and FlightAxis 2016-06-20 08:38:53 +10:00
Tom Pittenger 746e2211e9 AP_ADSB: remove extra include 2016-06-19 11:24:31 -07:00
Tom Pittenger 4fe94bdea3 GCS_MAVLink: add ADSB_streamrate 2016-06-19 11:24:30 -07:00
Tom Pittenger 4cd1721bf9 AP_ADSB: add ADSB_streamrate 2016-06-19 11:24:29 -07:00
Tom Pittenger 3a38e29b39 GCS_MAVLink: do not auto-forward ADSB_VEHICLE packets 2016-06-19 11:24:29 -07:00
Andrew Tridgell 2db2486b3a AP_AHRS: send zero EKF_STATUS_REPORT with EKF type 10 2016-06-19 22:02:25 +10:00
Andrew Tridgell 2f88c24f49 SITL: added debug showing UDP ports for XPlane 2016-06-19 21:18:19 +10:00
Andrew Tridgell ec5534bd6a SITL: explain the throttle_magic code for XPlane 2016-06-19 21:10:49 +10:00
Andrew Tridgell f76a7e64ca SITL: auto-select correct data fields from X-Plane10 2016-06-19 20:57:34 +10:00
Andrew Tridgell acc76f80b0 HAL_SITL: added xplane support 2016-06-19 13:59:15 +10:00
Andrew Tridgell 4f99c17aae SITL: added X-Plane 10 SITL backend 2016-06-19 13:59:15 +10:00
Andrew Tridgell 7a9b4c7572 AP_Motors: fixed motor load calculation
scale to 1.0 for max collective
2016-06-19 13:50:04 +10:00
Paul Riseborough 55b0bbd3f1 SITL: Add simulation of 3D earth magnetic field
Use an independant method to the flight code using tables that that can updated.
Data taken from NOAA online calculator using WMM data at 2016-6-16 date
2016-06-19 12:51:34 +10:00
Paul Riseborough 2cf5493b40 AP_HAL_SITL: Ensure simulated magnetic field is always used 2016-06-19 12:51:34 +10:00
Paul Riseborough 078284e2e2 SITL: Add magnetic field environment to simulation
Includes parameters enabling a ground level magnetic anomaly to be modelled.
TODO - add automatic setting of declination, inclination and field strength using WGS-84 position.
2016-06-19 12:51:34 +10:00
Randy Mackay ec7c1ab0b0 AC_PosControl: comment fix to set_alt_max method
No functional change
2016-06-18 11:55:49 +09:00
Randy Mackay e185bab775 AP_MotorsMulticopter: add HOVER_LEARN option to learn but not save 2016-06-18 11:55:49 +09:00
Randy Mackay 23f8227e36 AP_Motors: bug fix to save params on disarm
Previously was saving during arming  as well as disarming.
Thanks to OXINARF for finding this!
2016-06-18 11:55:49 +09:00
Randy Mackay a2ffd9ec7d AP_MotorsMulticopter: fix comment for get_throttle_limit function 2016-06-18 11:55:49 +09:00
Leonard Hall dcbb071c07 AC_PosControl: Move hover throttle calculation to AP_Motors 2016-06-18 11:55:49 +09:00
Randy Mackay b27da7699e AC_AttitudeControlMulti: get_throttle_avg_max made private
Also fixed up method's description
2016-06-18 11:55:49 +09:00
Randy Mackay da946288a2 AC_AttitudeControl: rename throttle_ave_max to throttle_avg_max 2016-06-18 11:55:49 +09:00
Randy Mackay 570920c7d7 AC_AttitudeControlMulti: run control_monitor_update in rate_controller_run 2016-06-18 11:55:49 +09:00
Leonard Hall 1639e22b74 AC_AttitudeControl: set desired_vel for reporting purposes even when not used 2016-06-18 11:55:49 +09:00
Randy Mackay 558f29b95c AC_AttitudeControl: control mixing made protected 2016-06-18 11:55:49 +09:00
Leonard Hall 9bd8878c8b AC_AttitudeControlHeli: fix update_althold_lean_angle_max 2016-06-18 11:55:49 +09:00
Leonard Hall 096bdd67f8 AC_AttitudeControl: add ATC_ANG_LIM_TC parameter
This allow adjusting the reponse to limit lean angles to reduce altitude loss
2016-06-18 11:55:49 +09:00
Randy Mackay dafc45eb26 AC_AttitudeControl: move get_althold_lean_angle_max to parent class 2016-06-18 11:55:49 +09:00
Leonard Hall 3d27ecca92 AC_AttitudeControl: add TC for Alt_Hold angle limit 2016-06-18 11:55:49 +09:00
Randy Mackay 7ff0fcb25d AC_AttitudeControl: multicopter specific rate_controller_run 2016-06-18 11:55:49 +09:00
Randy Mackay b7431b7d0c AC_AttitudeControl: update throttle rpy mix on every iteration 2016-06-18 11:55:49 +09:00
Leonard Hall ca2977decf AC_AttitudeControl: set throttle vs attitude priority for flipped state
When performing a flip we want to allow throttle to go high to provide
maximum attitude control
2016-06-18 11:55:49 +09:00
Leonard Hall 1fb4c12cd0 AC_AttitudeControl: move in throttle vs attitude prioritisation
Previously this prioritisation of throttle vs attitude was done in the
AP_Motors library
2016-06-18 11:55:49 +09:00
Randy Mackay 0870ce9fc1 AC_AttitudeControl: remove get_throttle_boosted from parent class
This is only called from multicopters
2016-06-18 11:55:49 +09:00
Leonard Hall 25c77c154f AC_AttitudeControl: rename get_boosted_throttle to get_throttle_boosted 2016-06-18 11:55:49 +09:00
Leonard Hall 35ef761deb AC_AttitudeControl: Move set_throttle_out to _Multi and _Heli 2016-06-18 11:55:49 +09:00
Randy Mackay a1b573ed0a AP_Motors: rename throttle_ave_max to throttle_avg_max 2016-06-18 11:55:49 +09:00
Randy Mackay ef106e4b0f AP_Motors: spool_mode moved out of flags struction
No functional change
2016-06-18 11:55:49 +09:00
Leonard Hall 8fff32bde3 AP_MotorsSingle: fix stability patch use of throttle_hover 2016-06-18 11:55:49 +09:00
Leonard Hall e0f9fc8e40 AP_MotorsSingle: rename rpy_scale, thrust_min_rpy variables
No functional change
2016-06-18 11:55:49 +09:00
Leonard Hall da05902805 AP_MotorsCoax: fix stability patch use of throttle_hover 2016-06-18 11:55:49 +09:00
Leonard Hall 9bc866e771 AP_MotorsCoax: rename rpy_scale internal variable
No functional change
2016-06-18 11:55:49 +09:00
Leonard Hall 8bdb906b2b AP_MotorsCoax: fixes negative thrust 2016-06-18 11:55:49 +09:00
Randy Mackay 71d1818103 AP_MotorsMulticopter: minor comment update 2016-06-18 11:55:49 +09:00
Randy Mackay 818965fa57 AP_MotorsMulticopter: output_to_motors and output_logic become protected 2016-06-18 11:55:49 +09:00
Leonard Hall 02881b59ff AP_MotorsMulti: float constants 2016-06-18 11:55:49 +09:00
Randy Mackay 79a73a5c2f AP_Motors: fix example sketch
No need to set throttle_mix nor throttle_min
2016-06-18 11:55:49 +09:00
Leonard Hall bee6c29b89 AP_MotorsMulticopter: current limit keeps battery from sagging below BAT_VOLT_MIN 2016-06-18 11:55:49 +09:00
Leonard Hall be25ac4acf AP_MotorsMulticopter: Add current limit time constant variable 2016-06-18 11:55:49 +09:00
Leonard Hall 7e0e0ca874 AP_MotorsMulticopter: battery voltage compensation improvements 2016-06-18 11:55:49 +09:00
Leonard Hall 0ee7b00b0b AP_MotorsMulticopter: rename _thrust_curve_min to spin_min 2016-06-18 11:55:49 +09:00
Leonard Hall 142a67bb6d AP_MotorsMulticopter: minor comment change 2016-06-18 11:55:49 +09:00
Leonard Hall 5cace33ca5 AP_MotorsMulticopter: SPIN_MIN replaces min_throttle 2016-06-18 11:55:49 +09:00
Leonard Hall 2c811364d3 AP_MotorsMulticopter: SPIN_ARM param replaces SPIN_ARMED 2016-06-18 11:55:49 +09:00
Leonard Hall 488f90b39d AP_Motors: add calc_spin_up_to_pwm to reduce repeated code 2016-06-18 11:55:49 +09:00
Randy Mackay 25778a24e2 AP_MotorsMulticopter: add HOVER_LEARN param 2016-06-18 11:55:49 +09:00
Leonard Hall 4f0db2bc36 AP_Motors: learned THST_HOVER replace THR_MID
This holds the estimated thrust required for the vehicle to hover
expressed as a number from 0 to 1.  0 will be equivalent to outputting
SPIN_MIN (which is a number from 0~1 but in the full output range) and 1 is equivalent to SPIN_MAX (also 0~1 but in the full output range)
2016-06-18 11:55:49 +09:00
Leonard Hall 5a8fc6283e AP_Motors: replace throttle_rpy_mix with throttle_avg
AC_AttitudeControl now calculates throttle vs attitude control
prioritisation and simply provides overall maximum throttle (aka
throttle_avg) to the motors library
2016-06-18 11:55:49 +09:00
Michael du Breuil 4d964fbf2f AP_BoardConfig: allow channels to be moved regardless of safety switch 2016-06-17 15:20:22 +10:00
Andrew Tridgell 63d0c040e4 AP_Scheduler: expose loop rate on all builds
as discussed with Randy
2016-06-17 15:02:28 +10:00
Andrew Tridgell 255bda9f9c AP_Motors: allow setting of loop rate
this allows for SCHED_LOOP_RATE in copter
2016-06-17 15:01:18 +10:00