Commit Graph

13103 Commits

Author SHA1 Message Date
Lucas De Marchi c1647b13eb AP_HAL_Linux: fix leaking strings 2016-11-09 11:44:05 -03:00
Andrew Tridgell e25a391a8f AP_InertialSensor: fixed typo 2016-11-09 17:08:15 +11:00
Andrew Tridgell d2f6a514b9 AP_InertialSensor: catch FIFO alignment errors using temperature reading
Two cases of what seems to be FIFO alignment errors have been seen on
a Pixracer-beta board with a ICM-20608. At a cost of 2 extra bytes per
transfer we can catch these by looking for sudden temperature changes
caused by bad data in the temperature registers.
2016-11-09 17:08:15 +11:00
Andrew Tridgell 4602b4d679 AP_Compass: improve init and calibration of hmc5843 2016-11-09 17:08:15 +11:00
Andrew Tridgell d248b33104 AP_InertialSensor: simplify config of MPU6000
use zero sample rate divider on both MPU6000 and ICM20608
2016-11-09 17:08:14 +11:00
Andrew Tridgell 7137d5c6f2 AP_InertialSensor: switch pixracer to always use in-tree drivers 2016-11-09 17:08:14 +11:00
Andrew Tridgell 3d48a72f59 AP_C0mpass: switch pixracer to always use in-tree drivers 2016-11-09 17:08:14 +11:00
Andrew Tridgell b8c789cf35 AP_Baro: switch pixracer to always use in-tree drivers 2016-11-09 17:08:14 +11:00
Andrew Tridgell b0b93f8928 AP_BoardConfig: switch pixracer to always use in-tree drivers 2016-11-09 17:08:14 +11:00
Andrew Tridgell 84c3e29891 AP_InertialSensor: use AP_HAL rotations for MPU6000 2016-11-09 17:08:14 +11:00
Andrew Tridgell fd8955a737 AP_HAL: define default rotations for mpu6000 based boards 2016-11-09 17:08:14 +11:00
Andrew Tridgell 2f01dfe81c AP_InertialSensor: fixed from review by Lucas 2016-11-09 17:08:13 +11:00
Andrew Tridgell 81b933d9d0 AP_InertialSensor: use int32_t summation for fast sampling
very slightly faster
2016-11-09 17:08:13 +11:00
Andrew Tridgell b00fd95725 AP_Math: define Vector3l for += op 2016-11-09 17:08:13 +11:00
Andrew Tridgell 565f1986e0 AP_Baro: fixed FMUv1 baro and enable in-tree driver for PHMINI 2016-11-09 17:08:13 +11:00
Andrew Tridgell fcf0a4ea59 AP_BoardConfig: use in-tree drivers for PHMINI 2016-11-09 17:08:13 +11:00
Andrew Tridgell b363a65c2e AP_Compass: enable in-tree drivers for PHMINI 2016-11-09 17:08:13 +11:00
Andrew Tridgell 03b7bc9e65 AP_InertialSensor: use internal drivers for PHMINI
this gets us fast sampling
2016-11-09 17:08:12 +11:00
Andrew Tridgell af1c5fd6d3 AP_InertialSensor: always use FIFO on MPU6000
and enable fast sampling on ICM20608 if on SPI
2016-11-09 17:08:12 +11:00
Andrew Tridgell 96e42696b7 HAL_PX4: added icm20608-am SPI device 2016-11-09 17:08:12 +11:00
Andrew Tridgell d778ee2db0 AP_HAL: define device for icm20608 on ACCEL_MAG CS line on px4
for PHMINI
2016-11-09 17:08:12 +11:00
Andrew Tridgell b34ab2956b HAL_PX4: added access to external SPI connector on FMUv2 2016-11-09 17:08:12 +11:00
Andrew Tridgell fde80a9408 AP_InertialSensor: modify LSM303D settings to match PX4 driver
this allows existing accel calibration to be used
2016-11-09 17:08:12 +11:00
Andrew Tridgell 875fa60452 AP_Compass: fixed external I2C HMC5983 rotation on pixhawk 2016-11-09 17:08:11 +11:00
Andrew Tridgell 01fadb6e90 HAL_PX4: added per-device perf counter for I2C devices 2016-11-09 17:08:11 +11:00
Andrew Tridgell a9a5e50bd1 AP_InertialSensor: removed timer callback for MPU6000
Thanks to Lucas for pointing out this is not needed
2016-11-09 17:08:11 +11:00
Andrew Tridgell 42f242a07b HAL_PX4: fixed build on PX4-v1 2016-11-09 17:08:11 +11:00
Andrew Tridgell bd8867be38 AP_Compass: cope with NULL dev pointer in driver probe functions 2016-11-09 17:08:11 +11:00
Andrew Tridgell ba9b475782 AP_HAL: added MS5611 on I2C for px4-v1 2016-11-09 17:08:11 +11:00
Andrew Tridgell 4cf6dd1818 HAL_Linux: removed panic on bad SPI device 2016-11-09 17:08:11 +11:00
Andrew Tridgell 20cd165476 HAL_PX4: allow for missing SPIDevice table entries
removed panic
2016-11-09 17:08:10 +11:00
Andrew Tridgell bd84e592f8 AP_InertialSensor: check for NULL device pointer in probe()
handle missing devices
2016-11-09 17:08:10 +11:00
Andrew Tridgell 3b53caad87 AP_Compass: keep old hmc5843 ID
prevent re-use. thanks to Lucas
2016-11-09 17:08:10 +11:00
Andrew Tridgell 02c2ba1331 AP_Compass: fixed dup semaphore bug
thanks to Lucas for spotting this!
2016-11-09 17:08:10 +11:00
Andrew Tridgell f31a017ace AP_Compass: changes to HMC5843 driver
this makes the HMC5843 use single-shot mode, which makes it more
robust to bus resets. It also adds WHOAMI checking and enables
automatic temperature compensation.

Unfortunately this makes existing calibration values incompatible, so
a re-cal is required. The device ID has been changed to reflect the
driver change.
2016-11-09 17:08:10 +11:00
Andrew Tridgell f62851f780 GCS_MAVLink: added remote device operations
this makes debugging devices much easier. You can even write a
primitive SPI or I2C device driver over mavlink.

Support for this is in the devop MAVProxy module
2016-11-09 17:08:10 +11:00
Andrew Tridgell 922d5a74f7 HAL_PX4: print msg when I2C device is closed 2016-11-09 17:08:09 +11:00
Andrew Tridgell da7ed73051 GCS_MAVLlink: added handle_common_message()
this will make it easier to add common functions for mavlink messages
without having to do a commit for each vehicle
2016-11-09 17:08:09 +11:00
Andrew Tridgell e5a4dd4e56 HAL_PX4: added perf counter on SPI devices 2016-11-09 17:08:09 +11:00
Andrew Tridgell 8bca8545a2 HAL_PX4: removed unused devname field in SPIDevice 2016-11-09 17:08:08 +11:00
Andrew Tridgell 05769640d1 AP_Compass: support rotations on AK8963 2016-11-09 17:08:08 +11:00
Andrew Tridgell 2716ab8408 AP_Compass: added support for per-instance rotations 2016-11-09 17:08:08 +11:00
Andrew Tridgell fac895b0e6 AP_Compass: setup read flag for SPI transfers 2016-11-09 17:08:08 +11:00
Andrew Tridgell 18df213069 HAL_PX4: fixed initial SPI bus speed and report new SPI instances 2016-11-09 17:08:08 +11:00
Andrew Tridgell 3d7d773883 AP_InertialSensor: added support for ICM20608 on Pixracer 2016-11-09 17:08:08 +11:00
Andrew Tridgell 4dc5dc87b5 HAL_PX4: added ICM20608 to SPI table 2016-11-09 17:08:08 +11:00
Andrew Tridgell ea74f8c12c AP_HAL: added ICM20608 INS name 2016-11-09 17:08:07 +11:00
Andrew Tridgell 2c1e9024f1 AP_InertialSensor: detect missing accels or gyros 2016-11-09 17:08:07 +11:00
Andrew Tridgell 106a91c64c AP_InertialSensor: use init_gyro() on startup
this saves the calibration parameters which should be done on
calibration
2016-11-09 17:08:07 +11:00
Andrew Tridgell 408593465f AP_InertialSensor: fixed rotation for mpu9250 on pixracer 2016-11-09 17:08:07 +11:00
Andrew Tridgell 790dd4769b AP_InertialSensor: simplify rotations for MPU9250 2016-11-09 17:08:07 +11:00
Andrew Tridgell 38a1f51b53 AP_HAL: define rotations for the MPU9250 in board/linux.h 2016-11-09 17:08:07 +11:00
Andrew Tridgell 147b253e65 AP_Compass: make device IDs match PX4 drivers
match in-tree drivers to PX4Firmware drivers
2016-11-09 17:08:06 +11:00
Andrew Tridgell aa4025bdf9 AP_InertialSensor: make INS sensor IDs match for PX4
in-tree driver IDs now match PX4Firmware driver IDs on Pixhawk2
2016-11-09 17:08:06 +11:00
Andrew Tridgell 76b2759317 AP_OpticalFlow: fixed shadowed variable build warning 2016-11-09 17:08:06 +11:00
Andrew Tridgell 9e7e1b2f01 AP_InertialSensor: fixed merge conflicts with patches from Lucas 2016-11-09 17:08:06 +11:00
Andrew Tridgell 1990aa96e1 AP_HAL: added get_bus_id_devtype()
used to do versioning on device types
2016-11-09 17:08:06 +11:00
Lucas De Marchi 104e29acf2 AP_InertialSensor: MPU6000: change accel scale to 16G
Also change the ID of MPU6000 so previous calibration values are not
considered valid.
2016-11-09 17:08:06 +11:00
Lucas De Marchi dc09661b9e AP_InertialSensor: MPU6000: save driver version
When registering accel and gyro we use the upper 16bits of the id to
store the driver version. When changing the driver behavior in
non-compatible ways, changing this version will trigger a request for
calibration.
2016-11-09 17:08:06 +11:00
Lucas De Marchi 0d3adef8b2 AP_InertialSensor: MPU6000: remove TODO leftover
This will never be done as blindly changing speed is not the way to fix
communication issues.
2016-11-09 17:08:05 +11:00
Andrew Tridgell 0a1616cc71 AP_InertialSensor: use correct device IDs on PX4 driver 2016-11-09 17:08:05 +11:00
Lucas De Marchi 469efb00f6 AP_InertialSensor: save id for gyro and accel instances
This allows each sensor to be uniquely identified in the system by using
either the index inside the backend or for those that use the Device
interface, to use the bus type, location, and device id.

We leave 16-bit for each sensor to be able to change its own
identification in future, which allows them to be changed in an
incompatible manner forcing a re-calibration.
2016-11-09 17:08:05 +11:00
Lucas De Marchi bbb9bfa95e AP_InertialSensor: save only gyro calibration
When we are initializing the gyro and then saving the calibration we are
also saving the calibration values for the accelerometers. Right now
this is non-problematic, but we want to check that the ID of the
accelerometer corresponds to the ID of the sensor detected. If we also
save accel calibrations we would actually override the ID of the
accelerometer.

Rename the method to _save_gyro_calibration() and save only on gyro
values.
2016-11-09 17:08:05 +11:00
Lucas De Marchi f81dba2100 AP_InertialSensor: add doc to get_id() of backend
This is different from get_id() of Device and ultimately from each
sensor this this is identifying the backend, not the sensor.
2016-11-09 17:08:05 +11:00
Lucas De Marchi 6b88f3367b AP_Common: remove AP_PRODUCT_ID_* macros
These are not used anymore.
2016-11-09 17:08:05 +11:00
Lucas De Marchi ace61087a1 AP_InertialSensor: remove product_id
We only leave the parameter there for backward-compatibility. However
product id on the inertial sensor is not much useful since it's only
kept for the first instance.

A better implementation per-gyro and per-accel is needed in order to
avoid problems with sensors taking the offsets configured for another
sensor.
2016-11-09 17:08:05 +11:00
Andrew Tridgell a6ac02b61f HAL_Linux: implement device IDs for I2C and SPI 2016-11-09 17:08:04 +11:00
Andrew Tridgell de7913e8e9 AP_Compass: implement device IDs for compass drivers 2016-11-09 17:08:04 +11:00
Andrew Tridgell 64a5d3938c AP_InertialSensor: implement device IDs for MPU6000 and MPU9250 AuxilaryBus 2016-11-09 17:08:04 +11:00
Andrew Tridgell ac2c25539b AP_InertialSensor: implement device IDs for AuxilaryBus 2016-11-09 17:08:04 +11:00
Andrew Tridgell 16489d2a13 HAL_PX4: implement device IDs for I2C and SPI 2016-11-09 17:08:04 +11:00
Andrew Tridgell 3d48b6bb3a AP_HAL: added device id tuples to Device class
this allows a bus connection and device type tuple to be identifed as
a 24 bit number for use in user visible device IDs. Every bus
connection has a unique device ID.
2016-11-09 17:08:04 +11:00
Andrew Tridgell 4ef92b5e39 AP_InertialSensor: enable all 3 IMUs on PH2 2016-11-09 17:08:04 +11:00
Andrew Tridgell e08babb7df HAL_PX4: added new SPI devices for PH2 2016-11-09 17:08:03 +11:00
Andrew Tridgell 26ca2dd392 AP_HAL: added more px4 SPI device names 2016-11-09 17:08:03 +11:00
Andrew Tridgell ac0ea12b42 AP_Compass: enable HMC5843 on SPI for PH2 2016-11-09 17:08:03 +11:00
Andrew Tridgell 88e24dd8bd AP_BoardConfig: added board type 103
for PH2 in-tree drivers
2016-11-09 17:08:03 +11:00
Andrew Tridgell 66026100c3 AP_Baro: enable dual baro on PH2 2016-11-09 17:08:03 +11:00
Andrew Tridgell 4df9b093c3 AP_Baro: fixed missed samples in ms5611 driver 2016-11-09 17:08:03 +11:00
Andrew Tridgell 7c36e14524 AP_ADC: fixed thread usage in AP_ADC_ADS1115 2016-11-09 17:08:03 +11:00
Andrew Tridgell dbd192971f AP_Notify: fixed threading on toshibaled i2c 2016-11-09 17:08:02 +11:00
Andrew Tridgell a9cb03ad74 AP_Notify: fixed threading in two notify backends 2016-11-09 17:08:02 +11:00
Andrew Tridgell 6e2fbf1988 AP_OpticalFlow: fixed threading in opticalflow for linux 2016-11-09 17:08:02 +11:00
Andrew Tridgell 5cf768ced2 AP_InertialSensor: fixed missing return 2016-11-09 17:08:02 +11:00
Andrew Tridgell 4f231f9355 AP_BattMonitor: fixed thread usage for SMBus_I2C 2016-11-09 17:08:02 +11:00
Andrew Tridgell e88519364f AP_RangeFinder: fixed maxbotix I2C semaphore and bus usage 2016-11-09 17:08:02 +11:00
Andrew Tridgell bedee31f61 AP_Baro: fixed semaphore and thread usage in baro drivers 2016-11-09 17:08:02 +11:00
Andrew Tridgell 38ff8b3536 AP_InertialSensor: removed unused product_id function in L3G4200D 2016-11-09 17:08:01 +11:00
Andrew Tridgell 1c631ea037 AP_Compass: cleanup use of backend semaphores
fixed drivers that didn't protect accumulation counters
2016-11-09 17:08:01 +11:00
Andrew Tridgell 9afd51350e AP_Compass: use thread per bus in more drivers
and removed use of timer suspend
2016-11-09 17:08:01 +11:00
Andrew Tridgell 974827aa82 AP_Compass: enabled AK8963 on PX4 2016-11-09 17:08:01 +11:00
Andrew Tridgell a06137bb68 AP_HAL: define 9250 devices 2016-11-09 17:08:01 +11:00
Andrew Tridgell 4bc5b715bf HAL_PX4: define 9250 and fix SPI bus speeds 2016-11-09 17:08:01 +11:00
Andrew Tridgell a5c5e033d2 AP_InertialSensor: fixed threading and locking in remaining backends
use a backend semaphore for shared data and use thread per bus where
available
2016-11-09 17:08:01 +11:00
Andrew Tridgell 2e4151d14e AP_Compass: enable lsm303d mag on FMUv2 2016-11-09 17:08:00 +11:00
Andrew Tridgell 36190ba545 AP_Compass: use thread per bus for lsm303d mag 2016-11-09 17:08:00 +11:00
Andrew Tridgell b92c48548a AP_InertialSensor: added per-instance rotation for LSM9DS0 2016-11-09 17:08:00 +11:00
Andrew Tridgell 2df6ed08c2 AP_InertialSensor: added optional per-instance orientation
this is needed for multi-sensor boards to get orientation right for
each sensor
2016-11-09 17:08:00 +11:00
Andrew Tridgell ac2572384d AP_InertialSensor: added start() method for LSM9DS0
needed to get sensor ordering right on multi-sensor boards
2016-11-09 17:08:00 +11:00
Andrew Tridgell b9e1490740 AP_BoardConfig: added px4io auto-update to AP_BoardConfig 2016-11-09 17:08:00 +11:00
Andrew Tridgell 7e803df221 AP_BoardConfig: startup core peripherals for PX4 2016-11-09 17:07:59 +11:00
Andrew Tridgell 84f93439ca HAL_PX4: delay peripheral starup
moved to AP_BoardConfig
2016-11-09 17:07:59 +11:00
Andrew Tridgell 497b87fa65 AP_Airspeed: switched to in-tree I2C driver for all boards 2016-11-09 17:07:59 +11:00
Andrew Tridgell 0c13c73aa0 AP_BoardConfig: removed PX4 airspeed drivers 2016-11-09 17:07:59 +11:00
Andrew Tridgell 7832f1a1b6 AP_InertialSensor: allow for in-tree drivers for PX4 2016-11-09 17:07:58 +11:00
Andrew Tridgell 7bd52eb112 AP_Compass: allow for in-tree drivers for PX4 2016-11-09 17:07:58 +11:00
Andrew Tridgell 72c2e3a4d5 AP_Baro: select in-tree vs PX4 drivers at runtime 2016-11-09 17:07:58 +11:00
Andrew Tridgell ce174489c3 AP_BoardConfig: added get_board_type() for PX4
used to decide what drivers to start
2016-11-09 17:07:58 +11:00
Andrew Tridgell e91b1318fb HAL_PX4: reformat 2016-11-09 17:07:58 +11:00
Andrew Tridgell 1bb450c722 HAL_PX4: moved to common DeviceBus class for thread management in I2C and SPI 2016-11-09 17:07:58 +11:00
Andrew Tridgell 972f85c490 HAL_PX4: go direct to NuttX for SPI transfers 2016-11-09 17:07:58 +11:00
Andrew Tridgell bf0b0c1773 AP_HAL: fixed HAL_SEMAPHORE_BLOCK_FOREVER to be zero
all implementations assume this
2016-11-09 17:07:57 +11:00
Andrew Tridgell c7bef33ab7 HAL_PX4: fixed lsm303d SPI name 2016-11-09 17:07:57 +11:00
Andrew Tridgell b697c978e6 AP_HAL: fixed lsm303d SPI name 2016-11-09 17:07:57 +11:00
Andrew Tridgell 919aa61918 AP_InertialSensor: support AuxiliaryBus without register_periodic_callback() 2016-11-09 17:07:57 +11:00
Andrew Tridgell e79b4f1c11 AP_HAL: added defines for ms5611 on other SPI buses 2016-11-09 17:07:57 +11:00
Andrew Tridgell 5db65cdb6d AP_HAL: added subtype for PX4 FMUv4 2016-11-09 17:07:57 +11:00
Andrew Tridgell 254b71468c HAL_PX4: added ms5611_int SPI descriptor 2016-11-09 17:07:57 +11:00
Andrew Tridgell 0a28a3a83a HAL_PX4: run SPI priority above boost prioriity
otherwise ins sample wait can end up waiting on blocked SPI
2016-11-09 17:07:56 +11:00
Andrew Tridgell 3aa36185e4 HAL_PX4: drop mpu6000 speed to 11MHz
match previous driver
2016-11-09 17:07:56 +11:00
Andrew Tridgell 2b66df68a1 AP_InertialSensor: use thread-per-bus for lsm303d and mpu6000 2016-11-09 17:07:56 +11:00
Andrew Tridgell ed6df09d12 HAL_PX4: added lsm9ds0 entries to SPI table 2016-11-09 17:07:56 +11:00
Andrew Tridgell 3927994905 AP_HAL: added SPI device names to px4 2016-11-09 17:07:56 +11:00
Andrew Tridgell c2c7284a94 HAL_PX4: implement SPIDevice code for PX4
with thread per bus
2016-11-09 17:07:56 +11:00
Andrew Tridgell 90dc9e3327 AP_InertialSensor: dummy implementation of register_periodic_callback()
for AuxiliaryBus
2016-11-09 17:07:55 +11:00
Andrew Tridgell 96adfccae3 AP_Compass: switch hmc5983 driver to use periodic callback on the bus
this does not yet work with the mpu6000 auxiliary bus
2016-11-09 17:07:55 +11:00
Andrew Tridgell 4d5562764a AP_HAL: provide default hmc5983 i2c bus address 2016-11-09 17:07:55 +11:00
Andrew Tridgell 0b27478d7b AP_RangeFinder: use thread per bus for LightWareI2C driver 2016-11-09 17:07:55 +11:00
Andrew Tridgell 88df9c7029 HAL_PX4: added thread-per-bus implementation for I2C 2016-11-09 17:07:55 +11:00
Mathieu OTHACEHE 60ba91aead Disco: add buzzer support
Use ToneAlarm class to handle Disco buzzer.
2016-11-07 18:02:21 -03:00
floaledm 60c59bea4d AP_Frsky_Telem: make frsky_telemetry available to GCS_MAVLINK 2016-11-08 07:42:39 +11:00
floaledm 9f8d2f0506 GCS_MAVLink: send status_text messages to Frsky lib queue 2016-11-08 07:42:39 +11:00
Mathieu OTHACEHE 37237a5735 Disco_LED: Do not alloc PWM_Sysfs_Bebop objects
Using PWM_Sysfs_Base::init method, we don't need anymore to alloc memory
for PWM_Sysfs_Bebop objects.
2016-11-07 14:59:31 -02:00
Mathieu OTHACEHE 0fa441a8a5 PWM_Sysfs: add an init method to do hal dependent stuff.
When PWM_Sysfs_Base constructor is called, global variable hal may not
have been initialized resulting in NULL dereferencing error.

Move hal dependent stuff from contructor to init method.
2016-11-07 14:59:31 -02:00
Lucas De Marchi 91c4bf470f AP_InertialSensor: add O_CLOEXEC in places missing it
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03:00
Lucas De Marchi b7e5f56bd7 AP_Gripper: add O_CLOEXEC in places missing it
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03:00
Lucas De Marchi 4936fd8623 AP_Terrain: add O_CLOEXEC in places missing it
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03:00
Lucas De Marchi f6d475c1e6 AP_HAL_SITL: add O_CLOEXEC in places missing it
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03:00
Lucas De Marchi c9eff28c44 DataFlash: add O_CLOEXEC in places missing it
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03:00
Lucas De Marchi 932d1ae244 AP_RangeFinder: add O_CLOEXEC in places missing it
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03:00
Lucas De Marchi 7968736b1c AP_HAL: add O_CLOEXEC in places missing it
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03:00
Lucas De Marchi 490841a814 AP_HAL_Linux: add O_CLOEXEC in places missing it
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03:00
Lucas De Marchi 2e4c1818a3 AP_Common: add missing O_CLOEXEC definition
O_CLOEXEC is not available on Nuttx, nor it makes sense there. Define it
as 0, so we can use it in code.
2016-11-07 12:37:30 -03:00
Holger Steinhaus 5b66062f85 AP_GPS_PX4: unsubscribe on driver destruction. 2016-11-07 08:00:57 -03:00
Shingo Matsuura ceaa9474ed AP_RangeFinder: change enum name, add "state" word 2016-11-06 05:22:30 -08:00
Shingo Matsuura 4329cdbf2c AP_RangeFinder: change comment about fall through LEDDARONE_MODBUS_INIT case 2016-11-06 05:22:30 -08:00
Shingo Matsuura 3b8d36314c AP_RangeFinder: add comment about no break at LEDDARONE_MODBUS_INIT case 2016-11-06 05:22:30 -08:00
Shingo Matsuura 0eeca3ee0b AP_RangeFinder: remove case indent 2016-11-06 05:22:30 -08:00
Shingo Matsuura 4ca1eefd50 AP_RangeFinder: change magic numbers to define 2016-11-06 05:22:30 -08:00
Shingo Matsuura 6254787186 AP_RangeFinder: remove break in LEDDARONE_MODOBUS_INIT case and and use () around (read_len == 0) for clarity 2016-11-06 05:22:30 -08:00
Shingo Matsuura 5e5a806979 AP_RangeFinder: modified regarding to advices from @magicrub - san. 2016-11-06 05:22:30 -08:00
Shingo Matsuura 4b127edd5e AP_RangeFinder: fixed LeddarOne busy wait 2016-11-06 05:22:30 -08:00
Florent Martel 530955c15f AP_Frsky_Telem: remove arming check for transmitting params
Otherwise, on Plane, if ARMING REQUIRED is set to 0 (automatically
armed), no parameters are transmitted.
2016-11-04 23:11:00 -07:00
Randy Mackay 039d12bd55 AP_Gripper: add parameter unit and remove print on grab or release 2016-11-05 10:36:06 +09:00
Peter Barker d9cbcd9487 SITL: a simulator for the EPM grabber 2016-11-05 10:20:43 +09:00
Peter Barker 7200692137 RC_Channel: make EPM a subclass of AP_Gripper_Backend 2016-11-05 10:20:41 +09:00
Peter Barker 48cd35609c AP_Gripper: make EPM a subclass of AP_Gripper_Backend 2016-11-05 10:20:38 +09:00
Peter Barker 15b271ec13 AP_EPM: rename in preparation of becoming a AP_Gripper backend 2016-11-05 10:20:35 +09:00
Peter Barker d2e798d549 RC_Channel: alias k_epm to k_kgripper 2016-11-05 10:20:31 +09:00
Peter Barker d439bbe5bf SITL: SIM_Gripper_Servo, a simulated servo gripper 2016-11-05 10:20:29 +09:00
Peter Barker a8435de65a AP_Gripper: a general gripper frontend 2016-11-05 10:20:27 +09:00
Florent Martel 5a96db5a44 AP_Frsky_Telem: replaced timer cond > with >= 2016-11-04 12:17:40 -07:00
Florent Martel e43b2a73da AP_Frsky_Telem: increase sending params priority
If there's a lot of messages in the queue, params would not be
transmitted for a while, until the queue is empty, which can take a bit
of time during init.
2016-11-04 12:17:40 -07:00
Florent Martel 75905be376 AP_Frsky_Telem: simplified set_is_flying and moved to header file 2016-11-04 12:00:02 -07:00
Florent Martel bc4ab70c1c AP_Frsky_Telem: added const to some declarations 2016-11-04 11:18:28 -07:00
floaledm 68b10979c3 AP_Frsky_Telem: added extra parentheses around pointed to values for readability
As suggested by tridge
2016-11-04 11:18:28 -07:00
Florent Martel 328e6d6886 AP_Frsky_Telem: removed sending redundant VSpd, Alt, and VFAS sensor values, which can now be handled by OpenTX 2016-11-04 11:10:09 -07:00
Ralf Ramsauer 530d3230df Linux: Scheduler: don't ignore return values
Several return values in the constructor of the scheduler were ignored
before, while they should be respected.

I found that bug while strac'ing ardupilot as it failed at some later
point.

Signed-off-by: Ralf Ramsauer <ralf.ramsauer@othr.de>
2016-11-03 17:27:37 -03:00
Lucas De Marchi 3ff965a0c0 DataFlash: remove infinite loop from loop() method
Remove the while() loop inside loop() method so the new signal handlers
correctly notify the mainloop to exit.

This makes SIGTERM/SIGINT work again.
2016-11-02 16:28:20 -02:00
Lucas De Marchi 2b5f9fdd6b AP_HAL_Linux: teardown scheduler threads 2016-11-02 16:28:20 -02:00
Lucas De Marchi 89420e4b2d AP_HAL_Linux: add signal handler for normal termination
This allows to terminate the flight stack nicely, ensuring it returns 0
so init system can check by return code if it terminated nicely or if it
was due to a crash.
2016-11-02 16:28:20 -02:00
Lucas De Marchi fa540429f9 AP_HAL_Linux: allow to teardown bus threads
Add code to teardown all bus threads. This can be called while exiting
to wait for threads to finalize.
2016-11-02 16:28:20 -02:00
Lucas De Marchi 312a27dd20 AP_HAL: RCInput: rename deinit() to teardown() 2016-11-02 16:28:20 -02:00
Lucas De Marchi 89599f7bea AP_HAL_Linux: add unit tests for Thread implementations 2016-11-02 16:28:20 -02:00
Lucas De Marchi 992abd170d AP_HAL_Linux: allow to join threads 2016-11-02 16:28:20 -02:00
Lucas De Marchi 3b2de6de46 AP_HAL_Linux: allow PeriodicThread to stop
This takes the simplest approach of just waiting for the next time we
will process events.
2016-11-02 16:28:20 -02:00
Lucas De Marchi 20650e14b7 AP_HAL_Linux: allow PollerThread to stop 2016-11-02 16:28:20 -02:00
Lucas De Marchi da65a5c349 AP_HAL_Linux: allow to wakeup pollable
This allows to wakeup the thread that is sleeping on Poller::poll()
[ which in our case is an epoll_wait() call ]. This is usually achieved
by using a special signal and using the pwait() variant of the sleeping
function (or using signalfd). However integrating the signal in the
Thread class is more complex than simply use the eventfd syscall which
can serve our needs.
2016-11-02 16:28:20 -02:00
Lucas De Marchi efe819e21e AP_HAL_Linux: Poller: allow to fail constructor 2016-11-02 16:28:20 -02:00
Lucas De Marchi e5003c3116 AP_HAL_Linux: Poller: add some documentation 2016-11-02 16:28:20 -02:00
Lucas De Marchi da821e69eb AP_HAL_Linux: Thread: allow to use Thread from stack
Up until now we rely on Thread objects and variants thereof to be allocated
on heap or embedded in another object that's zero'ed on initialization.
However sometimes it's convenient to be able to use them on stack as
will be the case when writting unit tests.

Initialize all relevant fields to allow them to be used on stack. While
at it, prefer C++11 initialization on Poller since it's only setting the
default (invalid) value.
2016-11-02 16:28:20 -02:00
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
floaledm 5386edb791 AP_Frsky_Telem: fix setting of land_complete flag
When is_flying is true, land_complete should be set to 0, and
conversely.
2016-11-02 10:26:50 +11:00
floaledm 1aab5eec38 AP_Frsky_Telem: send ap_status only once initialized
Same as what is found in GCS_MAVLink.cpp for copter
2016-11-02 08:31:35 +11:00
murata e15c234a4f AP_ADSB: Set in the sprintf method. 2016-11-01 08:36:52 -07:00
murata 0028bd7b3c AP_ADSB: Set in the sprintf method. 2016-11-01 08:36:52 -07:00
Peter Barker b9dcf1108d AP_ADSB: do not transmit by default
In various countries transmitting on the ADSB frequencies is a
federal offence.

Let's not have our users do that be default.
2016-11-01 14:21:07 +09:00
Michael Oborne c5f8d8a695 AP_GPS_SBF: change reported altitude from geoid to MSL 2016-11-01 13:06:59 +09:00
Andrew Tridgell df23c4857e AP_RangeFinder: disabled LeddarOne driver
this driver is broken and could cause a vehicle to crash. It does busy
waits on a UART from the main thread.

It will be re-enabled when fixed
2016-10-31 13:40:49 +11:00
Randy Mackay aeb1de08f5 AP_GPS: fix MAV compile error 2016-10-29 16:45:00 +09:00
Peter Barker 1997a4e044 SITL: include mass of sprayer payload in vehicle mass 2016-10-29 15:02:56 +09:00
Peter Barker 0cea47ae54 AC_Sprayer: disentangle ENABLED from permission-to-run 2016-10-29 15:02:52 +09:00
Peter Barker bae89d43fa AC_Sprayer: correct HOWTO, minor cleanups (NFC) 2016-10-29 15:02:50 +09:00
Peter Barker a7867603a0 SITL: SIM_Sprayer: a simulated sprayer 2016-10-29 15:02:48 +09:00
Peter Barker 1bd96ae558 AP_Stats: ability to reset statistics 2016-10-29 14:53:25 +09:00
Peter Barker e6adbceb3e AP_Stats: runtime 2016-10-29 14:53:25 +09:00
Peter Barker 77064852c4 AP_Stats: AP_Stats flighttime 2016-10-29 14:53:25 +09:00
Peter Barker be13de79a4 AP_Stats: a periodic update function, flttime and runtime 2016-10-29 14:53:25 +09:00
Peter Barker 7eff99b053 AP_Stats: keeps track of vehicle usage statistics 2016-10-29 14:53:25 +09:00
Randy Mackay 9290ee65cc AP_GPS: MAV driver uses existing baud rates
GPS_INPUT messages can arrive through any mavlink serial port so we shouldn't be modifying any port's baud rates.
2016-10-29 14:33:44 +09:00
Peter Barker 066d066048 AP_BoardConfig: correct parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker dee3bdbae9 AP_SerialManager: correct parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker 58a03b83ca AP_Terrain: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker daf9a45efd AP_TECS: correct parameter metadata
Correct incomplete Description of LAND_PDAMP

Add DisplayName for LAND_PDAMP
2016-10-27 09:15:03 -07:00
Peter Barker c1f455f904 AP_RangeFinder: correct parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker ecd061dad5 AP_RPM: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker 06b616f761 AP_Motors: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker 9d0d451c48 AP_Mission: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker 755e76ced9 AP_L1_Control: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker 7b75a4ec09 AP_GPS: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker e4001e67e2 AP_Compass: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker a660ffa3fc AP_BoardConfig: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker dbecb1bc25 AP_Baro: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker 42f3f7195b AP_Airspeed: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker 9a8d3d6e7c AP_AHRS: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker 71e42a4eac APM_Control: add missing parameter metadata 2016-10-27 09:15:03 -07:00
Peter Barker 2e2d39e628 AC_AttitudeControl: add missing parameter metadata 2016-10-27 09:15:03 -07:00
floaledm 7045013933 AP_Frsky_Telem: use airspeed value w/o constraints of ground speed and AHRS_WIND_MAX 2016-10-27 11:11:38 -03:00
hiro2233 cdfd057690 AP_HAL_LINUX: Added urus macro RCInput_RPI 2016-10-27 11:51:53 -02:00
hiro2233 cae0c11720 AP_HAL_Linux: Added URUS Macro to Util_RPI 2016-10-27 11:51:32 -02:00
hiro2233 37877f1530 AP_HAL_Linux: Added URUS macro to Scheduler 2016-10-27 11:51:32 -02:00
hiro2233 7000124f6a AP_HAL_Linux: Added URUS Macro for GPIO_RPI and UtilRPI 2016-10-27 11:51:32 -02:00
hiro2233 a7b79dc0e2 AP_HAL_Linux: GPIO_RPI: Added URUS Macro. 2016-10-27 11:51:32 -02:00
hiro2233 3742c3b243 AP_HAL: Added subtype board URUS.
This is a linux system based with Raspberry Pi B+, it's a automated
domotic system using APM framework.
2016-10-27 11:51:31 -02:00
Lucas De Marchi 473add51f7 AP_HAL_Linux: RPIOUARTDriver: remove dma mention
There's no dma going on here, it's just a normal SPI transfer.
2016-10-27 10:35:01 -03:00
Lucas De Marchi d3b5089a12 AP_HAL_VRBRAIN: UARTDriver: remove commented out code
This is not working and there's no reason to keep it around.
2016-10-27 10:35:01 -03:00
Lucas De Marchi a3140df24a AP_HAL_PX4: UARTDriver: remove commented out code
This is not working and there's no reason to keep it around.
2016-10-27 10:35:01 -03:00
Lucas De Marchi ec4d1eefca AP_HAL_PX4: UARTDriver: fix trailing whitespaces 2016-10-27 10:35:01 -03:00
Lucas De Marchi d60b4842b6 AP_HAL_Linux: reduce scope of dummy buffer 2016-10-27 10:35:01 -03:00
Lucas De Marchi 76f1e4243a AP_HAL_Linux: remove double assignment
_dma_packet_tx.crc is already assigned below, we don't neet to set it to
0 before. While at it move the assignment to .crc up and fix coding
style.
2016-10-27 10:35:01 -03:00
Lucas De Marchi c898b28962 AP_HAL_Linux: use MIN where possible 2016-10-27 10:35:01 -03:00
Lucas De Marchi 05a7eef1a2 RingBuffer: use explict "if" and return early
Remove confusing use of ternary operator together with assign + load.
No change in behavior.
2016-10-27 10:35:01 -03:00
Andrew Tridgell 82365f8670 AP_NavEKF2: save some memory in the position offsets in EKF2
we don't need to copy that vector3f for every sample. A uint8_t does
the job
2016-10-27 17:09:06 +11:00
Andrew Tridgell a05d216ce4 AP_NavEKF: make posOffset const ref for optflow 2016-10-27 15:45:40 +11:00
Andrew Tridgell 772209b3f3 AP_AHRS: make posOffset a const reference 2016-10-27 15:45:24 +11:00
Andrew Tridgell 703ef0ca0e AP_RangeFinder: added get_primary() API 2016-10-27 15:45:07 +11:00
Andrew Tridgell afe2c31ae7 AP_Inertial_Sensor: use const reference 2016-10-27 15:06:11 +11:00
Andrew Tridgell af332cb336 AP_GPS: use const reference 2016-10-27 15:05:58 +11:00
Andrew Tridgell 27cdf220de AP_RangeFinder: use const reference 2016-10-27 14:59:10 +11:00
Andrew Tridgell 047a09c391 AP_OpticalFlow: use const reference
saves stack space and cpu
2016-10-27 14:58:59 +11:00
priseborough f722ddf615 AP_RangeFinder: Update parameter documentation
Add brief description of body frame conventions.
2016-10-27 14:54:45 +11:00
priseborough 1bde180f98 AP_OpticalFlow: Update parameter documentation
Add brief description of body frame conventions.
2016-10-27 14:54:45 +11:00
priseborough 1dec6dd9b0 AP_GPS: Update parameter documentation
Add brief description of body frame conventions.
2016-10-27 14:54:45 +11:00
priseborough 7460d97c9a AP_InertialSensor: Update parameter documentation
Add brief description of body frame conventions.
2016-10-27 14:54:45 +11:00
priseborough 470f5c4562 AP_InertialSensor: Correct SITL IMU1 accel for position in body frame 2016-10-27 14:54:45 +11:00
priseborough d830f68901 SITL: Add angular acceleration to simulator states
The calculation used is an approximation to work around the lack of angular acceleration in the interface with the flight dynamics model.
2016-10-27 14:54:44 +11:00
priseborough 747f3a8cfd AP_HAL_SITL: Simulate range finder position offset 2016-10-27 14:54:44 +11:00
priseborough a9f63abc6f AP_HAL_SITL: simulate effect of GPS antenna offset 2016-10-27 14:54:44 +11:00
priseborough 3afe2b1694 AP_HAL_SITL: simulate optical flow sensor body frame position offset 2016-10-27 14:54:44 +11:00
priseborough 27dab27565 SITL: Add parameters for sensor position offsets in body frame 2016-10-27 14:54:44 +11:00
priseborough 4499ed437c AP_RangeFinder: remove space before preprocessor directive 2016-10-27 14:54:44 +11:00
priseborough 3ca6c12344 AP_RangeFinder: Improve consistency of parameter naming 2016-10-27 14:54:44 +11:00
priseborough c93c3d54f3 AP_NavEKF2: Don't correct for zero IMU position offset
The IMU offset correction involves a significant number of floating point operations and most users will leave the offset parameter at zero.
2016-10-27 14:54:44 +11:00
priseborough 1890bbdafa AP_NavEKF2: Don't correct GPS for zero position offset 2016-10-27 14:54:44 +11:00
priseborough f025c96e63 AP_NavEKF2: Don't correct range finder for zero position offset 2016-10-27 14:54:43 +11:00
priseborough 9a0ce1d5eb AP_NavEKF2: Don't correct flow sensor for zero position offset 2016-10-27 14:54:43 +11:00
priseborough b40016db62 AP_NavEKF2: Fix documentation errors 2016-10-27 14:54:43 +11:00
priseborough 54a431a51d AP_InertialSensor: Update position offset parameter documentation
Notify users of the potential for velocity noise when using larger offset values..
Specific advice in terms of values has not been provided because it is highly dependent on Gyro noise levels.
2016-10-27 14:54:43 +11:00
priseborough 13ca62b1c7 AP_NavEKF2: Correct velocity and position outputs for IMU offset
This can improve position hold performance where it is not practical to have the IMU located at the centroid.
Although this enables the effect of IMU position offsets to be corrected, users will still need to be instructed to place the IMU as close to the vehicle c.g. as practical as correcting for large offsets makes the velocity estimates noisy.
2016-10-27 14:54:43 +11:00
priseborough 21dcf42c27 AP_NavEKF2: Add missing documentation 2016-10-27 14:54:43 +11:00
priseborough 8922861359 AP_NavEKF2: Correct optical flow data for sensor position offset
Correction requires the body rates averaged across the flow sensor sampling interval. This data has been added to the sensor buffer.
The body rate data from the flow sensor driver does not contain the Z component, so an equivalent value sampled from the navigation IMU has been used instead.
The variable omegaAcrossFlowTime has been moved out of the class and into the only function that uses it.
2016-10-27 14:54:43 +11:00
priseborough 16f021c466 AP_NavEKF2: Correct range finder data for body frame position offset 2016-10-27 14:54:43 +11:00
priseborough e884e9cc6e AP_NavEKF2: Correct GPS data for antenna body frame offset 2016-10-27 14:54:43 +11:00
priseborough 064a106808 AP_NavEKF2: Get IMU accelerometer body position offset data 2016-10-27 14:54:42 +11:00
priseborough 397033b7c3 AP_NavEKF2: Add flow sensor body position offset to data buffer 2016-10-27 14:54:42 +11:00
priseborough 92c086b40e AP_NavEKF2: Add rangefinder body position offset to data buffer 2016-10-27 14:54:42 +11:00
priseborough 3148ad4623 AP_NavEKF2: Add GPS antenna position offset data to data buffer 2016-10-27 14:54:42 +11:00
priseborough fd905c23e1 AP_NavEKF2: Add body position offset to optical flow interface 2016-10-27 14:54:42 +11:00
priseborough 8160eca47e AP_NavEKF: update flow sensor interface
Adds a position offset which is not used by the backend
2016-10-27 14:54:42 +11:00
priseborough 6069c37b19 AP_AHRS: add position offset to optical flow interface 2016-10-27 14:54:42 +11:00
priseborough 9c7ab639a1 AP_OpticalFlow: Add parameters for flow sensor position offset 2016-10-27 14:54:41 +11:00
priseborough 24f9e7365d AP_RangeFinder: Add parameters defining sensor position offset 2016-10-27 14:54:41 +11:00
priseborough 6db93d8a21 AP_InertialSensor: Add parameters defining accelerometer position offset 2016-10-27 14:54:41 +11:00
priseborough b51c9dea6c AP_GPS: Add parameters defining antenna offset in body frame 2016-10-27 14:54:41 +11:00
Murilo Belluzzo a91da2e803 DataFlash: Change ::bufferspace_available return type
from 'uint16_t' to 'uint32_t' to avoid overflow (possible in at least
two implementations: Block and File).
2016-10-27 14:24:11 +11:00
Murilo Belluzzo 3f1896b9b7 RingBuffer: Remove 'old style' version 2016-10-27 14:24:10 +11:00
Murilo Belluzzo c112e1c889 DataFlash: Make use of ByteBuffer class
This patch replaces the 'old style' ringbuffer by the ByteBuffer class.
An effort was made to keep the exchange as close as possible from a
drop-in replacement to minimize the risk of introducing bugs.

Although the exchange opens opportunities for improvement and
simplification of this class.
2016-10-27 14:24:10 +11:00
Lucas De Marchi 80cf1207b7 AP_HAL_VRBRAIN: UARTDriver: fix writting with failures
When the buffer wraps and we do it in 2 steps, we can't actually do the
second part if it fails or if we wrote less bytes than we intended,
otherwise we will corrupt the data being sent.
2016-10-27 14:23:43 +11:00
Lucas De Marchi 68fc08fe52 AP_HAL_VRBRAIN: fix resetting TX buffer
We can't give the TX buffer 16 bytes more since next time begin() is
called it will compare the buffer size to the value the caller is trying
to set.  In this case we would free and alloc the buffer again each time
begin was called.
2016-10-27 14:23:43 +11:00
Murilo Belluzzo e8bfcf02a0 VRBRAIN UARTDriver: Make use of ByteBuffer class
This patch replaces the 'old style' ringbuffer by the ByteBuffer class.
An effort was made to keep the exchange as close as possible from a
drop-in replacement to minimize the risk of introducing bugs.

Although the exchange opens opportunities for improvement and
simplification of this class.

While at it, just like in the write case, explain why we are stopping.
2016-10-27 14:23:43 +11:00
Lucas De Marchi 4df627693d AP_HAL_PX4: UARTDriver: fix writting with failures
When the buffer wraps and we do it in 2 steps, we can't actually do the
second part if it fails or if we wrote less bytes than we intended,
otherwise we will corrupt the data being sent.

While at it, just like in the write case, explain why we are stopping.
2016-10-27 14:23:43 +11:00
Lucas De Marchi 4346f1dd83 AP_HAL_PX4: fix resetting TX buffer
We can't give the TX buffer 16 bytes more since next time begin() is
called it will compare the buffer size to the value the caller is trying
to set.  In this case we would free and alloc the buffer again each time
begin was called.
2016-10-27 14:23:43 +11:00
Murilo Belluzzo c7a65a026c AP_HAL_PX4: UARTDriver: Make use of ByteBuffer class
This patch replaces the 'old style' ringbuffer by the ByteBuffer class.
An effort was made to keep the exchange as close as possible from a
drop-in replacement to minimize the risk of introducing bugs.

Although the exchange opens opportunities for improvement and
simplification of this class.
2016-10-27 14:23:43 +11:00
Lucas De Marchi 26650049c0 AP_HAL_Linux: UARTDriver: fix writting/reading with failures
When the buffer wraps and we do it in 2 steps, we can't actually do the
second part if it fails or if we wrote less bytes than we intended,
otherwise we will corrupt the data being sent.
2016-10-27 14:23:42 +11:00
Murilo Belluzzo ce81c45f80 AP_HAL_Linux: UARTDriver: Make use of ByteBuffer class
This patch replaces the 'old style' ringbuffer by the ByteBuffer class.
An effort was made to keep the exchange as close as possible from a
drop-in replacement to minimize the risk of introducing bugs.

Although the exchange opens opportunities for improvement and
simplification of this class.
2016-10-27 14:23:42 +11:00
Murilo Belluzzo 8526b25654 RingBuffer: Add a faster method to read a single byte 2016-10-27 14:23:42 +11:00
Michael du Breuil deec4ec6af Compass: Rework compass calibrator
Summary of significant changes:
  -Autsave doesn't depend on STREAM_EXTRA3
  -Don't risk only saving one compass on copter if CAL_ALWAYS_REBOOT is set
  -Only calibrate compasses that are both health and marked for use (there was a inconsistency in handling the mask)
  -Fix incorrect failure reporting on DO_ACCEPT_MAG_CAL with a mask of 0 if a channel was specifically not started
  -Fix not starting the buzzer if the delay is set to 0 seconds
  -Always send MAG_CAL_REPORT until its acknowledged
  -Correct the field in MAG_CAL_REPORT for autosave to indicate if the compass had actually been saved, rather then being scheduled to be saved
  -Remmove unused public interfaces
2016-10-27 14:04:33 +11:00
floaledm 6869dace08 AP_Frsky_Telem: moved msg queueing of fw string 2016-10-26 09:49:30 -07:00
floaledm 56432f04d3 AP_Frsky_Telem: fixed airspeed; now same as VFR_HUD 2016-10-26 09:36:22 -07:00
Mathieu OTHACEHE 5e42800b5e Disco: add LED support
Use RGBLed generic implementation to support Disco LED.
2016-10-26 11:56:11 -03:00
Leonard Hall 42672de606 AC_PosControl: set Alt_Hold filter for PID not just D
We normally don't use the D term here so setting the filter for PID not
just D lets us smooth the throttle response.
2016-10-26 21:00:43 +09:00
Francisco Ferreira 5a7f9a38fe DataFlash: fix RCIN and RCOU structure types 2016-10-26 10:10:19 +09:00
murata 762a66c9e5 AP_GPS_SBF: Adjust the initial value of HDOP 2016-10-26 09:54:59 +11:00
Peter Barker 2bd13af43d AP_Param: unhide groups when generating parameters in autotest 2016-10-26 09:53:14 +11:00
Peter Barker dd7d41b1f3 SITL: unhide groups when generating parameters in autotest 2016-10-26 09:53:14 +11:00
Andrew Tridgell d2287caf1c HAL_SITL: removed old servo slew rate code 2016-10-25 20:39:38 +11:00
Andrew Tridgell 5e03358b0b SITL: added servo filtering
SIM_SERVO_SPEED is servo time constant in seconds
2016-10-25 20:39:38 +11:00
Lucas De Marchi 539b727e5e AP_HAL_Linux: Remove misleading constant
The constant passed to cflag is BOTHER, meaning the actual baud is set
in the other specific members.  Don't define B* constants as they are
misleading here and this is why it doesn't work with e.g.
cfset[io]speed()... that function expect a B* constant which in Linux
is not the speed, but an index to an array with speeds.
2016-10-25 16:55:33 +11:00
Francisco Ferreira 3a89421c70 AP_BattMonitor: remove Bebop fixed capacity
Bebop, Bebop2 and Disco all use this class but it was always setting the capacity to the Bebop one, overriding the parameter
2016-10-24 09:24:11 -03:00
Martin Evans 0e19b8c9a0 AP_HAL_Linux: Set initial rotation on Dark to None 2016-10-24 10:00:24 -02:00
Martin Evans 6f6112d7c2 AP_HAL_Linux: Add setting for GPIO for Dark board
Just like other RPI-based boards.
2016-10-24 10:00:24 -02:00
Martin Evans d2d3119b66 AP_HAL_Linux: PCA9685: Add quinary address 2016-10-24 10:00:06 -02:00
Martin Evans 37b85fd3cd AP_HAL: Add Dark Linux board 2016-10-24 09:59:02 -02:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Peter Barker d188504b8b AC_Fence: remove unused variable _boundary_revalidate 2016-10-24 08:57:56 -02:00
Peter Barker 6e72c899d1 AP_GPS: AP_GPS_GSOF: remove unused variable 2016-10-24 08:57:56 -02:00
Peter Barker 216a6493c9 AP_Compass: AP_Compass_LSM9DS1: remove unused variable 2016-10-24 08:57:56 -02:00
Peter Barker 64154feaef DataFlash: remove unused semaphore variables 2016-10-24 08:57:56 -02:00
Peter Barker c664eec93b AC_WPNav: remove unused variable _last_update 2016-10-24 08:57:56 -02:00
Peter Barker 6f200cdc3d SITL: SIM_Rover: remove unused variables 2016-10-24 08:57:55 -02:00
Peter Barker e17a71c6cc AP_GPS: AP_GPS_NOVA: remove unused variables 2016-10-24 08:57:55 -02:00
Peter Barker d3422d1653 SITL: SIM_Tracker: remove unused variable 2016-10-24 08:57:55 -02:00
Peter Barker 5dad8745d5 DataFlash: remove bogus function declaration 2016-10-24 08:57:55 -02:00
Andrew Tridgell 9d6a5c6f04 HAL_PX4: make ready_to_arm state latching
this fixes a race condition in the handling of the px4io safety switch
2016-10-24 13:36:04 +11:00
Peter Barker 17883f6683 AP_InertialSensor: fix INS_generic example (call BoardConfig.init()) 2016-10-24 11:00:22 +09:00
Andrew Tridgell 2a44e6a7d7 HAL_PX4: cope with no px4io on FMUv2
don't open px4fmu twice
2016-10-23 17:15:32 +11:00
Andrew Tridgell 68f0777dac AP_Param: fixed bug with deeply nested parameter trees
enumeration could loop forever if the IDs overlapped due to 8 bit
masking
2016-10-23 15:27:42 +11:00
Andrew Tridgell 7bf81c44b0 AP_BoardConfig: allow programmatic setting of default safety mask 2016-10-21 11:53:34 +11:00
Andrew Tridgell 0bd3b8ecbd AP_BoardConfig: fixed bug in fmu safety mask set 2016-10-21 09:10:55 +11:00
Andrew Tridgell c825c7b4cc HAL_PX4: disable FMU outputs again on re-engaging of safety switch 2016-10-21 09:10:55 +11:00
Andrew Tridgell 8cb93ae7c3 AP_BoardConfig: call PWM_SERVO_IGNORE_SAFETY on fmu as well 2016-10-21 09:10:55 +11:00
Andrew Tridgell 07c09ad6dc AP_BoardConfig: expanded bitmask to 14 channels for safety mask 2016-10-21 09:10:55 +11:00
Andrew Tridgell d2e4b73eda Revert "GCS_MAVLink: default to MAVLink2 enabled"
Reverting change to MAVLink2 by default until SiK radio firmware issue
with ECC is sorted out
2016-10-21 07:55:02 +11:00
Andrew Tridgell 1171b33419 AP_TECS: added TECS_SYNAIRSPEED parameter
this allows for the synthetic airspeed estimate to be used in TECS
2016-10-20 13:22:39 +11:00
Andrew Tridgell 7ee42d3a7e AP_TECS: fixed missing doc comment 2016-10-20 13:22:22 +11:00
priseborough 9779511425 AP_NavEKF2: Fix bug in median filter code 2016-10-19 19:45:00 +09:00
priseborough d0ba259d0d AP_NavEKF: Fix bug in median filter code 2016-10-19 19:44:58 +09:00
Peter Barker 6ccf36439d AP_Frsky_Telem: actually set _ap.value flags based in is_flying
Closes #5017
2016-10-18 22:17:07 -07:00
Randy Mackay e6e6e36da7 AP_GPS_MAV: fix hdop conversion 2016-10-18 20:24:55 +09:00
Andrew Tridgell a847520da8 GCS_MAVLink: send RC_CHANNELS_RAW if using MAVLink1
this fixes issue #5010
2016-10-18 18:16:16 +11:00
Julien Beraud 20dcd6e082 RCOutput_Bebop: fix motor order
Accidentally pushed in commit 298f7bffb9
The order of the motors shouldn't have been changed on version 5 because
it is specific to older versions of the ESC controller firmware
2016-10-17 20:55:49 +11:00
Georacer 54c1efe5e1 Connection to last_letter once again successful 2016-10-17 09:37:23 +11:00
Andrew Tridgell 24d3399fd5 AP_Module: report loaded hooks on startup
useful for debugging
2016-10-17 09:31:51 +11:00
Andrew Tridgell 33bff3c79c HAL_Linux: fixed transmitter failsafe with SBUS RCInput 2016-10-17 06:53:33 +11:00
Andrew Tridgell 8f88d7c784 AP_HAL: fixed comment on XPlus channels
thanks for Francisco for noticing
2016-10-17 06:49:40 +11:00
Andrew Tridgell 110355f14e HAL_Linux: fixed SRXL and DSM
fixed default decoder state and fixed mic-recognition of SRXL as DSM
2016-10-16 21:31:37 +11:00
Andrew Tridgell 4d44591e62 AP_HAL: fixed decoding of XPlus channels 2016-10-16 19:05:19 +11:00
Andrew Tridgell e9633553fb HAL_Linux: update for changed SRXL API 2016-10-16 19:05:19 +11:00
Andrew Tridgell ec8c22f26e AP_HAL: support up to 20 channels on SRXL
tested with 18 channels on a DSM18 transmitter with a AR7700 receiver
with SRXL port
2016-10-16 19:05:19 +11:00
Andrew Tridgell ece0a8721f AP_HAL: added standalone test program for dsm
useful for debugging
2016-10-16 19:05:19 +11:00
Andrew Tridgell 03f9496549 HAL_Linux: lock onto a single decoder on the 115200 port 2016-10-16 19:05:19 +11:00
Andrew Tridgell 513156a4cc HAL_Linux: make 115200 R/C decoders return a bool 2016-10-16 19:05:19 +11:00
Andrew Tridgell 710d08da6d HAL_Linux: support SRXL R/C input 2016-10-16 19:05:19 +11:00
Andrew Tridgell 7b3d0234d1 AP_HAL: added an SRXL protocol decoder
SRXL ports are commonly found on newer spektrum receivers like the AR7700
2016-10-16 19:05:18 +11:00
murata bb1a787852 AP_Scheduler: To add a comment to _loop_rate_hz variable. 2016-10-16 00:02:40 -07:00
Andrew Tridgell f9dd31b6e5 RC_Channel: support automatic servo trimming 2016-10-16 15:20:47 +11:00
Lucas De Marchi e6d5bac527 AP_Param: don't used reserved word in macros
`class` is a reserved word and should not be used as macro arguments.
It's very common in C++ to use "clazz" instead in these cases.
2016-10-15 15:19:17 -03:00
Andrew Tridgell 792f3b8a15 GCS_MAVLink: added handle_rc_bind() 2016-10-15 21:42:38 +11:00
murata ba60cce0c1 AP_HAL: simplify the processing of milliseconds from the time 2016-10-15 18:33:54 +09:00
Andrew Tridgell f01f711ff6 GCS_MAVLink: added accept_packet() hook
this will allow vehicles to control whether packets are accepted by
GCS sysid or not
2016-10-15 17:11:01 +11:00
Andrew Tridgell 992bf2368e RC_Channel: cope with SERVO_RNG_ENABLE changing while booted
this prevents a one second throttle up on scaled ESCs when
enabling/disabling the servo output mapping
2016-10-15 16:59:37 +11:00
Andrew Tridgell 4a9ddf52e0 RC_Channel: constrain output to servo range
don't allow servos past configured range in any mode
2016-10-15 16:59:36 +11:00
Andrew Tridgell 2ceddddd3b RC_Channel: don't call output() in SRV_Channel
we may need to run another mixer
2016-10-15 16:59:36 +11:00
Andrew Tridgell 78ef3b77c6 RC_Channel: added disable_passthrough() method 2016-10-15 16:59:36 +11:00
Andrew Tridgell 2ec439d7e3 RC_Channel: added set_esc_scaling() to SRV_Channels 2016-10-15 16:59:36 +11:00
Andrew Tridgell 73b9123495 RC_Channel: added set_trim() API to SRV_Channels object 2016-10-15 16:59:35 +11:00
Andrew Tridgell c7f8b255e7 RC_Channel: added SRV_Channels object for remapping output channels
this allows for decoupling RC input ranges from servo output ranges
2016-10-15 16:59:35 +11:00
Andrew Tridgell fea7903aa8 RC_Channel: added get_radio_out_normalised() 2016-10-15 16:59:35 +11:00
Andrew Tridgell 96c7d9dde8 RC_Channel: make output_trim() go via _radio_out
this ensures that _radio_out always contains the value that would be
output to the channel. This will be used by the SRV_Channels object
2016-10-15 16:59:35 +11:00
Leonard Hall bead957a78 AP_MotorsMulticopter: limit hover throttle 2016-10-15 11:27:53 +09:00
Peter Barker e71c71fcac AP_HAL: correct casting of get_system_clock_ms 2016-10-14 18:41:56 +11:00
Jonathan Challinger 8df4add729 AC_PrecLand: trust initial velocity less 2016-10-14 10:46:22 +09:00
Jonathan Challinger ec73f563ad AC_PrecLand: do not fuse EKF velocity 2016-10-14 10:46:16 +09:00
Jonathan Challinger 7405f82d61 AC_PrecLand: add ekf to estimate vehicle-relative target velocity 2016-10-14 10:46:05 +09:00
Jonathan Challinger 5a8db4f271 AC_PosControl: add interface to override horizontal velocity process variable 2016-10-14 10:46:01 +09:00
Jonathan Challinger 25a14fe0dc AP_AHRS: add interface to retrieve corrected delta velocities in NED frame 2016-10-14 10:45:58 +09:00
Andrew Tridgell c1bf23e090 GCS_MAVLink: fixed comment 2016-10-14 11:40:36 +11:00
Randy Mackay 4808664fb6 AC_Avoidance: allow use of AP_Proximity 2016-10-13 20:21:07 +09:00
Randy Mackay c3087edbe8 AP_Proximity: add library and SF40C driver 2016-10-13 20:21:07 +09:00
Randy Mackay cc0bfcddcb AP_SerialManager: add Lidar360 to protocol list
This is used for the proximity sensor
2016-10-13 20:21:07 +09:00
Andrew Tridgell 53260969bb GCS_MAVLink: removed deprecated RC_CHANNELS_RAW and use RC_CHANNELS only 2016-10-13 21:23:39 +11:00
Andrew Tridgell e78651e8f2 HAL_PX4: fixed DSM bind on Pixracer 2016-10-13 19:58:00 +11:00
Andrew Tridgell 5e829e7720 GCS_MAVLink: most users don't have signing keys
prevent noise on startup
2016-10-13 19:58:00 +11:00
Randy Mackay 9722c3a1c3 DataFlash: fix logging of ekf core 2016-10-13 15:22:59 +09:00
John Hsu fc13efa673 SITL: update SIM_Gazebo SITL interface servo packet to have 16 floats, matching sitl_input struct. 2016-10-13 12:03:20 +11:00
John Hsu a8cf38b366 SITL: implement Gazebo SITL for IRLock tracking. 2016-10-13 12:03:20 +11:00
Jonathan Challinger e20687fbce AP_AHRS: cache trim rotation 2016-10-13 10:02:14 +11:00
Jonathan Challinger 80d9092993 AP_Math: remove rotateXY and rotateXYinv 2016-10-13 10:02:14 +11:00
Jonathan Challinger dac59cb5da AP_NavEKF2: use exact matrix for trim rotation 2016-10-13 10:02:14 +11:00
Jonathan Challinger 3eba985afd AP_NavEKF: use exact matrix for trim rotation 2016-10-13 10:02:13 +11:00
Jonathan Challinger 5ff78b8e47 AP_AHRS: fix rotation of acceleration into earth frame 2016-10-13 10:02:13 +11:00
Jonathan Challinger a03fa2d3cf AP_AHRS: use exact matrix for trim rotations 2016-10-13 10:02:13 +11:00
Andrew Tridgell 7f09d20e3b HAL_Linux: implement cork and push for remaining RCOutput backends 2016-10-13 10:00:04 +11:00
Andrew Tridgell c8179a0887 HAL_Linux: implement cork/push for RCOutput_AioPRU 2016-10-13 10:00:04 +11:00
Andrew Tridgell e356797888 AP_HAL: make cork() mandatory in RCOutput 2016-10-13 10:00:04 +11:00
Andrew Tridgell 0640b6539c HAL_Linux: implement cork()/push() for Raspilot 2016-10-13 10:00:04 +11:00
Andrew Tridgell 1d6e4673da HAL_Empty: add cork() and push() for RCOutput 2016-10-13 10:00:04 +11:00
Andrew Tridgell 7ea75aaf95 HAL_QURT: implement cork() and push() for RCOutput 2016-10-13 10:00:04 +11:00
Andrew Tridgell 5530e3782d HAL_VRBrain: fixed cork() for RCOutput 2016-10-13 10:00:04 +11:00
Andrew Tridgell c493ba81e4 HAL_PX4: fixed cork() for RCOutput 2016-10-13 10:00:04 +11:00
Andrew Tridgell a80eea5de4 HAL_Linux: implement cork()/push() for HAL_Linux RCOutput_Sysfs 2016-10-13 10:00:04 +11:00
Andrew Tridgell 97d0553938 HAL_SITL: implement cork() on RCOutput 2016-10-13 10:00:04 +11:00
Andrew Tridgell 7cd7f03d56 AP_Motors: fixed use of trim on heli servos
this was broken by the servo range 0 to 1 changes
2016-10-13 09:34:48 +11:00
Andrew Tridgell 0cd3054a4c HAL_Linux: document the Disco PWM pinout 2016-10-12 21:41:49 +11:00
Andrew Tridgell c64a020384 GCS_MAVLink: default to MAVLink2 enabled
this changes the default to enable MAVLink2 on USB and the primary
telemetry port. Note that unless signing is enabled it won't send a
MAVLink2 packet until the GCS sends a MAVLink2 packet
2016-10-12 11:35:50 +11:00
ShingoMatsuura 8432c5fb4a AP_RangeFinder: remove number_detections member variable and add number_detections reference argument to parse_response 2016-10-11 07:56:37 -03:00
ShingoMatsuura 43f2482abd AP_RangeFinder: modify spelling and change C type cast to static_cast 2016-10-11 07:56:37 -03:00
ShingoMatsuura 6123fad124 AP_RangeFinder: change error and ok status defines to LeddarOne_Status enum 2016-10-11 07:56:37 -03:00
Jonathan Challinger 77dbf99cee AC_PosControl: fix bug related to ekfNavVelGainScaler 2016-10-11 15:25:59 +09:00
Lucas De Marchi ae53920e5b build: don't build examples with old build system
We currently check examples are buildable with waf which doesn't need
the libraries to be specified in a make.inc file.  Having the makefiles
there is misleading since people try to build and realize the build is
broken.
2016-10-11 13:03:08 +11:00