Commit Graph

8599 Commits

Author SHA1 Message Date
Randy Mackay 5032cf9fbc Copter: init multicopter flags
Resolves coverity warning

Also fixed indentation
2015-07-25 14:00:29 +09:00
Michael du Breuil 9d53aa77eb AP_GPS: Add reboot required docstring 2015-07-25 10:56:19 +09:00
Randy Mackay b13921a7aa Mount_SToRM32: find gimbal channel on startup 2015-07-25 10:53:05 +09:00
Randy Mackay e7df54ca75 GCS_MAVLink: static find_by_mavtype method 2015-07-25 10:53:03 +09:00
Randy Mackay e092902613 GCS_MAVLink: add find_by_mavtype 2015-07-25 10:52:59 +09:00
Peter Barker 1ee330ebb2 DataFlash: CLI log dumping - don't truncate lines that contain doubles
We currently print doubles out as if they were floats.  The ftoa_engine isn't something to replicate for doubles lightly!
2015-07-24 08:08:51 +10:00
Peter Barker 39b2cdcc3c AP_Menu: avoid segmentation fault
Insufficient input would cause a segfault
2015-07-24 08:05:13 +10:00
Randy Mackay 3dfb447fd7 BattMon: has_current true for Bebop
The bebop does not actually provide current but it does estimate the
percentage of battery remaining
2015-07-23 21:49:32 +09:00
Randy Mackay 8403b504d1 BattMon: add Bebop to monitor param description 2015-07-23 21:49:32 +09:00
Randy Mackay 9482578c60 BattMon: Bebop always uses bebop batt monitor 2015-07-23 21:49:31 +09:00
Randy Mackay 84b6ab0707 BattMon_Bebop: use ARRAY_SIZE
Also remove printf of failure message, instead we should add the battery
monitor health to the SYS_STATUS message sent to the ground station
2015-07-23 21:49:30 +09:00
Randy Mackay 3b36178a0b BattMon_Bebop: init members in constructor 2015-07-23 21:49:29 +09:00
Jean-Baptiste Dubois f6aba6c952 HAL_Linux: add read_obs_data to RCOutput_Bebop 2015-07-23 21:49:28 +09:00
Jean-Baptiste Dubois 35ae562dbe AP_BattMonitor: Add battery support for Bebop Hardware 2015-07-23 21:49:27 +09:00
Andrew Tridgell 54254c89d7 AP_Arming: control rudder arming with ARMING_RUDDER parameter
allow for 3 states:

 0: no rudder arming
 1: arm only
 2: arm and disarm
2015-07-23 21:48:50 +10:00
Lucas De Marchi 8240e5ae65 AP_Compass: AK8963: reduce bytes read
We are not using INFO and ST1 registers, so there's no need to read
extra 2 bytes for each transaction.
2015-07-23 17:44:36 +10:00
Lucas De Marchi 2b9c46e1ff AP_Compass: AK8963: don't oversample AK8963
Reduce the frequency with which MPU9250 reads AK8963 to reduce the
chance of errors.
2015-07-23 17:44:36 +10:00
Lucas De Marchi 6c2ceea165 AP_Compass: AK8963: remove author and connection comment
Authorship and how sensor is connected get outdated (as it already is).
Our code is on git so let it track who wrote each line.
2015-07-23 17:44:36 +10:00
Staroselskii Georgii 8ab33c46ce AP_Compass: revisited AK8963 code
Reduced duplication a bit and revisited the update method which is now
split into several logical hunks.
2015-07-23 17:44:36 +10:00
Lucas De Marchi fffedae3e0 AP_Compass: AK8963: reduce stack usage and zero out buffers
Since we are not using MPU9250's fifo to get samples from AK8963 we will
always read only 1 sample (+ control registers).
2015-07-23 17:44:35 +10:00
Lucas De Marchi 37734886a5 AP_Compass: AK8963: remove repeated comments
No need to repeat the same comments on 3 different places. Instead add a
single comment to explain how start_measurements() and read_raw() are
related.
2015-07-23 17:44:35 +10:00
Lucas De Marchi 27d95b67a8 AP_Compass: AK8963: remove state machine
Don't use a state machine in AK8963: the start_measurements() method
should be called only once.  Even if there's a magnetic sensor overflow
the only thing we should do is to discard the new data.

This also moves the _collect_samples() method to be inside _update()
since it's the only place it should be called from, the one running on
the timer thread.
2015-07-23 17:44:35 +10:00
Lucas De Marchi e232543fca AP_Compass: AK8963: change initialization and rename methods
We need to check the AK8963's id before anything else Here we are
reordering the calls to _calibrate() and _check_id(). After that we
don't need to read and write again the AK8963_CNTL1 register.

While at it do some renames as well:
	- _configure() -> _setup_mode(): since now there's a
 	  _bus->configure() it became confusing what actually it's
	  doing.
	- make error messages say what we were actually trying to do but
	  couldn't. Also remove PSTR since this is linux-only.
	- start_conversion() -> start_measurements():  We are instructing the
          bus to start to get the samples, not to tell the chip to start an
          analog->digital conversion like in other sensors.
2015-07-23 17:44:35 +10:00
Lucas De Marchi ae5d9baddb AP_Compass: AK8963: remove defines not used anymore
The MPUREG_PWR_MGMT_1 defines were used when we cared about the MPU9250
initialization code. Now all initialization is done by the MPU9250 class
itself, so remove these defines.

Also remove AK8983_SELFTEST_MAGNETIC_FIELD_ON that is never used and let
the defines always with 2 bytes to improve readability.
2015-07-23 17:44:34 +10:00
Lucas De Marchi cae895bfdf AP_Compass: AK8963: group members together
Besides being semantically related, this removes the hole due to
alignment. The size is the same since the hole is actually turned into
padding.
2015-07-23 17:44:34 +10:00
Lucas De Marchi 28d3d775a4 AP_Compass: AK8963: remove resolution member
We only use the highest one and there's no intention to support the
14bits one. Just use the define rather than saving it as a member.
2015-07-23 17:44:34 +10:00
Lucas De Marchi 86b3312112 AP_Compass: AK8963: factor out common code of read_raw()
Similar code was added in the read_raw() implementation for each bus.
Add a new POD struct read_raw to contain the registers from the AK8963
and use it instead as argument.
2015-07-23 17:44:33 +10:00
dgrat d941174978 AP_Compass: AK8963: enhance the readability
Reduce the deepness of indentation and fix coding style.
2015-07-23 17:44:33 +10:00
Randy Mackay 28c722c157 AC_Circle: rate change takes effect immediately 2015-07-23 16:21:20 +09:00
Tom Pittenger d51e6d466b AP_HAL_SITL: add support for airspeed failures 2015-07-23 14:38:06 +10:00
Tom Pittenger 250dcd31a2 SITL: Add ARSP_FAIL param
This will allow testing pitot tube hardware failures
2015-07-23 14:38:06 +10:00
Staroselskii Georgii d7ac725a64 AP_HAL_Linux: fixed signal handler in RCInput_Navio
DMA is getting stopped in the separate method now. This is the best we
can get at the current time. It does yield slightly better experience
and works in the majority of cases.

The patch is a no bulletproof solution, though.

There's a possibility of corruption in case of e.g. a SIGKILL. There's
no signal framework at the time and the commit doesn't add one. That's
why all signals are handled in the same erroneous way. This is not a
good nor a final solution to the issue.

For the issue at hand a better fix might be porting the code to kernel
space but it's a rather tediuos task that we cannot undertake in the
couple of weeks.
2015-07-23 08:51:38 +10:00
Staroselskii Georgii 8528a7d159 AP_HAL_Linux: added deinit logic for RCInput_Navio
DMA needs to be stopped if a panic occurs.
2015-07-23 08:51:37 +10:00
Staroselskii Georgii f4d14f73ba AP_HAL_Linux: extended panic handling with RCInput deinitialization
The issue has already come up. There's no deinitialization mechanisms at the moment. As APM is rather software than firmware on Linux, there're some clean-up work that needs to be done. This commit triggers deinitialization of RCInput on a panic.
2015-07-23 08:51:37 +10:00
Vladislav Zakharov 97b51a4bcb AP_HAL: Added deinit() method to RCInput
Add a deinit() counterpart. This is needed for some ports that require some deinitializtion logic. The default implementation is empty. I'm not sure whether we need to inforce it for all.
2015-07-23 08:51:37 +10:00
Tom Pittenger 9737c426eb SITL: Gazebo index out of bound
- imu_orientation_quat[size=3] is fed to Quaternion[size=4] which causes an index-out-of-range problem
2015-07-22 21:33:46 +10:00
Michael du Breuil 59dda49cce AP_GPS: Fix missing reserved fields in the UBX-RXM-RAWX message 2015-07-22 21:31:10 +10:00
Michael du Breuil 09fef505e0 AP_GPS: With a ublox driver, accept a packet if it will fit in the buffer 2015-07-22 21:31:10 +10:00
Michael du Breuil 22b16b4532 AP_GPS: Enable selecting what GNSS system to use if the reciever supports it
Ublox 7 and 8 seires use a UBX-CFG-GNSS message to enable satellite constellations. The default value does not enable any additional ones, and any constellations the reciever doesn't report knowing about are not configured.
2015-07-22 21:31:10 +10:00
Michael du Breuil 47592a1953 AP_GPS: Raise the baud rate on a ublox GPS if using RAW logging
the implementation leaves an easy path forward for providing a different startup blob for all the GPS's if raw logging is enabled
2015-07-22 21:31:09 +10:00
Michael du Breuil 19bb96b9cb AP_GPS: Improve startup logic for detecting what gps is connected
Remove race condition on sending intial blob to the GPS, it was possible to send a blob that got the GPS configured enough to allow the autodetect to take over (and then some drivers like ublox would not finish sending the blob, which has potential details that the driver might have needed to send)

Limit the delay to checking for NMEA gps to only checking after all the available baud rates have been checked

Since a UBlox will actually report having DGPS (due to SBAS or RTCM data) actually report this as the highest supported mode
2015-07-22 21:31:09 +10:00
Arthur Benemann e3398648d7 GCS_MAVLink: fix debug formatting 2015-07-21 21:41:34 +09:00
Randy Mackay 521f3dc4b9 GCS_MAVLink: only forward msg once per channel
Issue found and alternative fix provided by Arthur Benemann
2015-07-21 21:41:32 +09:00
Randy Mackay 6f72d202fe GPS: fix parameter descriptions 2015-07-21 19:50:12 +09:00
Randy Mackay e31f2d26c4 MotorsMulticopter: move get_hover_throttle_as_pwm to protected
No functional change
2015-07-21 16:27:04 +09:00
Randy Mackay c7c6228b5d MotorsMulticopter: remove virtual from set_yaw_headroom 2015-07-21 16:27:01 +09:00
Randy Mackay 157c97447d AC_AttControlHeli: init passthrough_yaw 2015-07-21 16:26:27 +09:00
Randy Mackay 8b4805bfcb AC_AttControl_heli: add MotorsHeli include 2015-07-21 16:25:56 +09:00
Randy Mackay bf2bf2e3fa AC_AttControl_Multi: new multirotor specific attitude control class 2015-07-21 16:25:53 +09:00
Randy Mackay 93dd7dd970 AC_AttControl: get_boosted_throttle purely virtual 2015-07-21 16:25:50 +09:00
Randy Mackay 4843be49de AP_MotorsTri: remove call to empty parent Init
Also rename uses of Multirotor to Multicopter
2015-07-21 16:25:48 +09:00
Randy Mackay f906934dfa AP_MotorsSingle: remove call to empty parent Init
Also rename uses of Multirotor to Multicopter
2015-07-21 16:25:45 +09:00
Randy Mackay 112e934072 AP_MotorsMatrix: remove call to empty parent Init
Also rename uses of Multirotor to Multicopter
2015-07-21 16:25:43 +09:00
Randy Mackay b1a4a6bf0a AP_Motors_Coax: remove call to empty parent Init
Also rename uses of Multirotor to Multicopter
2015-07-21 16:25:40 +09:00
Randy Mackay 4d1dfd94f5 AP_MotorsMulticopter: multicopter features moved in from parent
Also rename from multirotor to multicopter
2015-07-21 16:25:37 +09:00
Randy Mackay 7355ac9cb8 AP_MotorsHeli: implement empty slow start method 2015-07-21 16:25:34 +09:00
Randy Mackay a3fab10ef4 AP_MotorsHeli: init roll_radio_passthrough 2015-07-21 16:25:31 +09:00
Randy Mackay c9dedbd3b2 AP_Motors: remove multicopter only features
Also rename uses of Multirotor to Multicopter
2015-07-21 16:25:28 +09:00
Robert Lefebvre abb6eba291 AP_MotorsHeli: Change allow_arming check to use _rotor_speed_estimate
In future, this will be used to check actual rotor speed (measured) if available, to prevent trying to arm with the rotor spinning.
2015-07-21 16:25:21 +09:00
Robert Lefebvre 9fcbc77ce0 AP_MotorsHeli: Create rotor_speed_above_critical accessor 2015-07-21 16:25:11 +09:00
Robert Lefebvre 992c9c75bb AP_MotorsHeli: Create parameter_check method. 2015-07-21 16:25:04 +09:00
Robert Lefebvre e2fe640e6c Copter: Clean up helicopter allow_arming() function 2015-07-21 16:24:58 +09:00
Robert Lefebvre 61d6c5aa1d AP_Motors: Creation of AP_Motors_Multirotor class 2015-07-21 16:24:38 +09:00
Lucas De Marchi 5c9bf90d94 SITL: use ARRAY_SIZE macro 2015-07-21 14:25:19 +09:00
Lucas De Marchi fd5d25b1d5 AP_Compass: use ARRAY_SIZE macro 2015-07-21 14:25:17 +09:00
Lucas De Marchi 3136b8916c DataFlash: use ARRAY_SIZE macro 2015-07-21 14:25:15 +09:00
Lucas De Marchi d8b70dc0c5 AP_Scheduler: use ARRAY_SIZE macro 2015-07-21 14:25:13 +09:00
Lucas De Marchi fdc6a75124 AP_Menu: use ARRAY_SIZE macro 2015-07-21 14:25:10 +09:00
Lucas De Marchi 0471de2342 AP_Math: use ARRAY_SIZE macro 2015-07-21 14:25:09 +09:00
Lucas De Marchi eda4879f3f AP_InertialSensor: use ARRAY_SIZE macro 2015-07-21 14:25:07 +09:00
Lucas De Marchi 3f472fb9e1 AP_HAL_VRBRAIN: use ARRAY_SIZE macro 2015-07-21 14:25:05 +09:00
Lucas De Marchi 473415a3c2 AP_HAL_SITL: use ARRAY_SIZE macro 2015-07-21 14:25:03 +09:00
Lucas De Marchi d4d56aef1a AP_HAL_PX4: use ARRAY_SIZE macro 2015-07-21 14:25:01 +09:00
Lucas De Marchi cfc2972e51 AP_HAL_Linux: use ARRAY_SIZE macro 2015-07-21 14:24:58 +09:00
Lucas De Marchi b83708f77f AP_HAL: use ARRAY_SIZE macro 2015-07-21 14:24:56 +09:00
Lucas De Marchi 9d59b43920 AP_GPS: use ARRAY_SIZE macro 2015-07-21 14:24:54 +09:00
Lucas De Marchi 4a595bd797 APM_Control: use ARRAY_SIZE 2015-07-21 14:24:52 +09:00
Lucas De Marchi fb2eb262e7 AP_Math: use ARRAY_SIZE instead of defining another one 2015-07-21 14:24:49 +09:00
Randy Mackay 73ff01dc68 AP_Notify: replace unsigned int with uint8_t 2015-07-21 13:52:03 +09:00
Lucas De Marchi 1bba105be4 AP_Notify: don't manually define number of notify devices
Like b211b86 (AP_HAL_Linux: don't manually define number of spi devices)
did for spi.
2015-07-21 13:52:00 +09:00
Peter Barker 65813f308e DataFlash: fix incorrect comment 2015-07-21 13:11:00 +09:00
Randy Mackay 8225e58454 AP_Motors: throttle_min method in 0 to 1000 range
Previously the pwm range value was returned.  This value is only used by
the multicopter attitude controller's angle boost function.
2015-07-20 20:44:46 +09:00
Randy Mackay 6bf6442396 MotorsMatrix; protect against divide by zero
This should never happen but just to be safe
2015-07-20 20:44:43 +09:00
Randy Mackay fa60c3dce8 MotorsCoax: fix output_armed_stabilized min thr limit 2015-07-20 20:44:36 +09:00
Randy Mackay 8a308205ce MotorsSingle: fix output_armed_stabilized min thr limit 2015-07-20 20:44:32 +09:00
Randy Mackay bd9a605086 MotorsTri: fix output_armed_stabilized min thr limit
_min_throttle is in the pwm range but was being used as if in the 0 to
1000 range
2015-07-20 20:44:23 +09:00
Randy Mackay e53c46bd8f MotorsMatrix: fix output_armed_stabilized min thr limit
_min_throttle was being used as if it were in the 0 to 1000 range when
in fact it is in the pwm range.  This meant the lower limit was too low.
2015-07-20 20:44:14 +09:00
Jean-Baptiste Dubois 7dcfe1c667 RCOutput_Bebop: group channels write 2015-07-20 09:23:13 +10:00
Andrew Tridgell 3b1b7ea029 AP_GPS: fixed time handling with NMEA driver 2015-07-20 09:15:32 +10:00
Julien BERAUD a852e48f37 AP_GPS_NMEA: fix gps startup
when no valid gps data, gps would restart in a loop. Take the frame without
gps fix into account for frame counting
2015-07-20 09:14:15 +10:00
John Hsu 14e462706d SITL: added gazebo SITL shim 2015-07-20 09:10:48 +10:00
John Hsu c34ddb7fb8 HAL_SITL: added gazebo SITL model support 2015-07-20 09:10:48 +10:00
Randy Mackay a61129f7f8 GCS_MAVLink: add support for send_mission_item_reached 2015-07-19 12:14:09 +09:00
Randy Mackay 766ccea3be Mission: fix bug causing first do-cmd to be run many times
The symptom was that if the very first command in the mission was a
do-command, it would be run after every nav-command that didn't have
another do-command before it.
2015-07-17 12:15:08 +09:00
Randy Mackay 429346f4bc AP_Mission: add missing breaks to case statement 2015-07-17 12:15:06 +09:00
Randy Mackay 0acfcbfa81 NavEKF: use primary compass instead of first instance
Thanks very much to staroselskii for finding this bug
2015-07-17 10:02:42 +09:00
Randy Mackay cedc9a8670 Compass: add last_update_usec per instance 2015-07-17 10:02:41 +09:00
Andrew Tridgell 69cfe11455 AP_Arming: raise accel arming threshold to 0.75
arming issues due to accel inconsistency are too common
2015-07-17 09:50:19 +10:00
Andrew Tridgell 18de1c2c47 GCS_MAVLink: send AHRS2 even if we don't have a secondary position 2015-07-17 08:24:49 +10:00
Andrew Tridgell 6009ae55b1 AP_Math: fixed build of eulers example sketch 2015-07-17 08:24:49 +10:00
Randy Mackay cc0ab26f5d Mount: fix init of mode
Mode was being set from MNT_DEFTL_MODE parameter before that parameter's
value had been initialised from eeprom
2015-07-16 14:14:01 +09:00
Jean-Baptiste Dubois 9e5d13c1de RCOutput_Bebop: use CLOCK_MONOTONIC instead of CLOCK_REALTIME
CLOCK_MONOTONIC is not affected by discontinuous jumps in the system time.
2015-07-15 12:08:44 +02:00
Robert Lefebvre 14882bc6a8 AC_AttitudeControl: Remove unused takeoff jump #define 2015-07-14 20:16:58 +09:00
Robert Lefebvre e1902e2289 AP_MotorsHeli: Remove unused _dt variable. 2015-07-14 20:13:43 +09:00
Randy Mackay 7d2fe3cc2b AP_GPS_UBlox: remove unused member 2015-07-14 15:02:15 +09:00
Randy Mackay 2c33250bee AP_GPS_UBlox: send_next_rate_update always runs all steps
Moving the if, endif checks within the case statement ensures the state
machine goes through all 10 states
2015-07-14 15:02:13 +09:00
Randy Mackay 4b015d2091 AP_GPS: remove compiler warnings 2015-07-14 15:02:10 +09:00
Randy Mackay df3a04e284 AP_GPS: reduce fake Ublox hdop to 130 2015-07-14 15:02:08 +09:00
Andy Piper 5ccc58ffb4 AP_GPS: Read actual hDOP value from UBLOX messages
Before we were reading the position DOP and calling it hDOP. Since the
other drivers actualy read hDOP it seem best to do the same.
Fixes issue 462.
2015-07-14 15:02:03 +09:00
Paul Riseborough 610595bfb9 AP_NavEKF: Prevent position drift between arming and takeoff when using OF 2015-07-13 10:54:36 +09:00
Randy Mackay 2b4aaf2368 SITL: add vibe monitor and SIM_ACC2_RND to sitl 2015-07-12 16:50:30 +09:00
Paul Riseborough 8b4b0b9576 AP_NavEKF: Add accelerometer clip monitoring and isolation
Isolates an accelerometer that is clipping  and attempts to use the one that is clipping less.
2015-07-12 16:49:19 +09:00
Staroselskii Georgii 72820303d4 AP_HAL_Linux: set higher SPI speed for Navio
We can set a higher speed on newer Linux kernels since
52469b2a38.
The older ones will just floor the value.
2015-07-10 18:59:18 +10:00
Peter Barker 0028910428 AP_InertialNav: take reference to variable we are trying to update
There are no callers to this function.  Perhaps it should be removed?
2015-07-10 18:56:20 +10:00
Andrew Tridgell 4e0c2c5a9b AP_HAL: defined default log and terrain directories for bebop
the /var filesystem is wiped on boot on Bebop. Use these as a
temporary workaround
2015-07-10 16:46:31 +10:00
Andrew Tridgell 6df33dd3f4 AP_InertialSensor: fixed MPU6000_SPI bus initialisation
we need _spi for get_semaphore()
2015-07-10 16:46:30 +10:00
Julien BERAUD 954ec71630 HAL_Linux: added rcout implementation for bebop 2015-07-10 16:46:30 +10:00
Julien BERAUD 51c3c499e2 AP_Compass: support AK8963 on I2C 2015-07-10 16:46:30 +10:00
Julien BERAUD 0b41da0dea AP_Compass: rework to make the bus generic for AK8963
Supporting only MPU9250, prepare to implement another bus, i.e i2c on the
bebop
2015-07-10 16:46:29 +10:00
Julien BERAUD 0cd584c293 AP_Compass: fix rotation for bebop AK8963
Set the correct rotation for bebop
2015-07-10 16:46:29 +10:00
Julien BERAUD 7dd0b5fae6 AP_Compass: removed _spi_sem and _spi 2015-07-10 16:46:29 +10:00
Julien BERAUD d407737434 AP_Baro: added MS5607 support 2015-07-10 16:46:29 +10:00
Julien BERAUD 3cf952d1f8 AP_InertialSensor: add fifo support for MPU6000
And remove the use of data rdy in this case
2015-07-10 14:24:09 +10:00
Julien BERAUD 8a76ff53bd AP_InertialSensor: add i2c bus driver for MPU6050 2015-07-10 14:24:09 +10:00
Julien BERAUD 1679728730 AP_InertialSensor: Configure SPI as a generic bus for MPU6000
Add the possibility to implement an i2c bus communication for the
MPU6050 on parrot bebop
2015-07-10 14:24:09 +10:00
Julien BERAUD f0bed711cf AP_HAL: added AK8963 I2C defines 2015-07-10 14:23:18 +10:00
Julien BERAUD e0b59942b0 AP_HAL: changed log directories for bebop 2015-07-10 14:23:18 +10:00
Julien BERAUD 5c414b4ca2 AP_HAL: Fix Compass I2C address for Bebop 2015-07-10 14:23:18 +10:00
Julien BERAUD 8d6123928f AP_HAL: Add i2c bus numbers and addresses 2015-07-10 14:23:18 +10:00
Julien BERAUD bef8001a09 AP_HAL: added MS5607 baro define 2015-07-10 14:23:17 +10:00
Julien BERAUD eea7ea8488 AP_HAL: split MPU6000 INS defines for I2C and SPI 2015-07-10 14:23:17 +10:00
Julien BERAUD 7275e33e79 AP_HAL: add the possibility to have more than 1 i2c
Bebop drone has 3 i2c
2015-07-10 14:23:17 +10:00
Andrew Tridgell a6f62c208e AP_HAL: added bebop Linux board type 2015-07-10 10:22:59 +10:00
Julien BERAUD b32259307d AP_GPS: Add baudrate 230400 for GPS
Needed by bebop gps by default
2015-07-10 10:12:52 +10:00
Andrew Tridgell 282efe2d57 AP_Baro: fixed example to run accumulate at 50Hz 2015-07-10 09:59:35 +10:00
Andrew Tridgell c83d5b1f08 AP_Compass: only build AK8963 driver on Linux
must match MPU9250 build
2015-07-09 11:57:27 +10:00
Andrew Tridgell f4a9f9876f HAL_PX4: make usb_connected() more robust
thanks to a suggestion from Phillip Kocmoud, this should fix issues
with the XUAV-X2
2015-07-08 11:19:07 +10:00
Randy Mackay 2f8a7f316f Notify: enable toshibaLED for NAVIO 2015-07-07 20:08:19 +09:00
Staroselskii Georgii 402f46c56f AP_Airspeed: fixed a typo in the ARSPD_DEFAULT_PIN define
There was a redundant elif for Linux builds.
2015-07-07 21:02:21 +10:00
Randy Mackay 1d732ddf62 Mount: param desc rename from MAVLink to 3DR Solo 2015-07-07 13:29:24 +09:00
mirkix 1b0f482d37 AP_RangeFinder: Add support for HC-SR04 Range Finder connected to BBB 2015-07-07 08:00:33 +10:00
Randy Mackay d192b3ccea Compass: set device id for ak8963 and hmc5843 2015-07-06 21:04:46 +09:00
Randy Mackay ad1f9c4829 DataFlash: add ORGN message 2015-07-06 12:11:49 +09:00
Randy Mackay 03356a8d3a OptFlow: fix parameter descriptions 2015-07-06 11:37:38 +09:00
dgrat f56f584233 Compass: Improved field rounding in learning
Signed-off-by: Daniel Frenzel <dgdanielf@gmail.com>
2015-07-06 11:31:58 +10:00
Daniel Frenzel c49e44d02c HAL_LInux: RCInput for Navio
Cleaned the code a bit

Signed-off-by: Daniel Frenzel <dgdanielf@gmail.com>
2015-07-06 11:19:33 +10:00
kozinalexey 20a04bad77 AP_GPS: request RMC message in NMEA driver 2015-07-06 11:16:12 +10:00
dzollo 5d5d9dc137 AP_GPS: Fix max/min bug on SBP buffering. Log messages whether SBP driver recognizes the msg_type or not. 2015-07-06 10:53:35 +10:00
Lucas De Marchi efec7723ff AP_InertialSensor: reset the MPU9250 chip on startup
Now that the initialization of MPU9250 is shared between the
AP_InertialSensor and other drivers using it as a backend, we can reset
the MPU9250 in order to put it in a known state.
2015-07-06 10:48:07 +10:00
Lucas De Marchi 1deb837e70 AP_Compass: Use common function in MPU9250 for initialization 2015-07-06 10:48:07 +10:00
Lucas De Marchi eb4e2ac2e5 AP_InertialSensor: factor out MPU9250 initialization
Now we have the initialization code split in 2 parts:

1) Making sure the MPU9250 chip is alive and working: this is now in a
static function that may be called by other drivers that use MPU9250 as
backend.

2) The configuration of gyro and accel. Once the first part is completed
successfully the AP_InertialSensor_MPU9250 finishes the configuration of
the sensors it uses.

The only change in behavior here is that before we would try 25 time (5x
inside _hardware_init time 5x inside _init_sensor() that calls the first
function) to "boot the chip" and now we are doing "only" 5.
2015-07-06 10:48:07 +10:00
Lucas De Marchi 953bfbd3fe AP_InertialSensor: provide static methods for spi transactions
Add static methods to do the SPI transactions and provide the wrapper
methods when we have an instance of the object. This is useful so these
methods can be called from other contexts when the AP_InertialSensor
hasn't been initialized yet.
2015-07-06 10:48:07 +10:00
Lucas De Marchi fde43a77b3 AP_HAL_Linux: allow to change spi device state
Allowing to change the SPI device state allows us to save the
information whether the device was already initialized and avoid 2
separate drivers to initialize it.
2015-07-06 10:48:06 +10:00
Lucas De Marchi 384d650a23 AP_HAL: allow to have spi device state 2015-07-06 10:48:06 +10:00
Staroselskii Georgii 26c8007c96 AP_Compass: updated backend detect method
Uses reimplemented AK8963 driver. There's also no need trying to detect this
compass twice. Actually, it might even be bad, because the current code can
allocate an AK8963 object twice.
2015-07-06 10:48:06 +10:00
Staroselskii Georgii 7a417d1151 AP_Compass: AK8963 rework
Got rid of extra abstraction layer. There is no need for that now.
2015-07-06 10:48:06 +10:00
mirkix f82344358f AP_InertialSensor: Change BBBMINI standard orientation 2015-07-06 10:12:39 +10:00
mirkix e6363ea95d AP_HAL_Linux: BBBMINI uses /dev/i2c-2 2015-07-06 10:09:21 +10:00
Lucas De Marchi b211b86204 AP_HAL_Linux: don't manually define number of spi devices
It's error-prone, let's make the compiler define it for us.
2015-07-06 10:07:22 +10:00
Lucas De Marchi 82314ee4a3 AP_Common: add helper macro ARRAY_SIZE 2015-07-06 10:07:21 +10:00
Andrew Tridgell 1f58e0080a SITL: fixed some build warnings 2015-07-06 09:21:49 +10:00
Andrew Tridgell 8f41d97548 AP_Math: fixed build error on PX4
variable set but not used with recent longitude_scale change
2015-07-06 08:19:57 +10:00
Andrew Tridgell 099392d3ca AP_Math: don't optimise longitude_scale on faster CPUs
it causes problems with replay
2015-07-05 17:27:53 +10:00
Andrew Tridgell 88a90495b2 HAL_SITL: allow for more data before GPS pipe flush 2015-07-04 15:14:39 +10:00
Andrew Tridgell 21c895f6f3 AP_GPS: prevent extra NMEA messages causing rapid fix rates
unexpected messages could cause the GPS driver to report a very high
fix rate, which can confuse the EKF
2015-07-03 22:08:05 +10:00
Paul Riseborough 4fb7beba4b AP_NAvEKF: Prevent failure due to magnetometer fusion numerical errors
If a badly conditioned covariance matrix causes negative innovation variances, then the filter will diverge. The previous approach of increasing process noise was not effective in some cases, so a hard reset of the covariance matrix has been adopted to guarantee recovery.
This fixes a numerical error observed using the replay on flight log which had significant periods of compass rejection.
2015-07-02 18:07:22 +10:00
Randy Mackay 43b1694c76 Compass: add third compass to PRIMARY param description 2015-07-02 14:19:30 +09:00
Peter Barker 844f050cf3 DataFlash: correct zero-byte-file handling in CLI
-rw-rw-r-- 1 pbarker pbarker   2105344 Jul  1 16:10 1.BIN
-rw-rw-r-- 1 pbarker pbarker         0 Jul  1 19:35 2.BIN
-rw-rw-r-- 1 pbarker pbarker   2494464 Jul  1 16:58 3.BIN
-rw-rw-r-- 1 pbarker pbarker 128503808 Jul  1 20:22 4.BIN
-rw-rw-r-- 1 pbarker pbarker         3 Jul  1 19:46 LASTLOG.TXT

Before fix:

2 logs
Log 3 in logs/3.BIN of size 2494464 2015/7/1 6:58
Log 4 in logs/4.BIN of size 128503808 2015/7/1 10:22

After Fix:

4 logs
Log 1 in logs/1.BIN of size 2105344 2015/7/1 6:10
Log 2 in logs/2.BIN of size 0 2015/7/1 9:35
Log 3 in logs/3.BIN of size 2494464 2015/7/1 6:58
Log 4 in logs/4.BIN of size 128503808 2015/7/1 10:22

If the last file was zero bytes, no files would be shown.
2015-07-02 08:53:18 +10:00
Andrew Tridgell 5b0394eb05 AP_Compass: start MPU9250 driver at low speed
this raises the chances of successful init of the MPU9250
2015-07-02 08:48:06 +10:00
Staroselskii Georgii d40b45c9ae AP_InertialSensor: disable reset on MPU9250
The Compass library is initialized before the InertialSensor. AK8963 with
MPU9250 as backend already takes care of resetting MPU9250. The problem with
also resetting it in the MPU9250 initialization code is that if the reset
happens during an internal I2C transaction, the AK8963 may hang. So here we
remove the reset inside MPU9250. There still a possibility that the first
MPU9250 initialization is not successful and it resets the chip, but it's not
happening in tests.
2015-07-01 20:44:09 +03:00
Andrew Tridgell 5f0302ed9f HAL_Linux: fixed chaining of getopt calls 2015-07-01 20:44:07 +10:00
Andrew Tridgell 355575f793 HAL_Linux: fixed chaining of getopt instances 2015-07-01 15:42:07 +10:00
Andrew Tridgell c8a6a02be1 HAL_Linux: don't do chardev test on subtype NONE
otherwise replay is broken
2015-07-01 15:36:34 +10:00
Andrew Tridgell 0679552cf7 GCS_MAVLink: regenerate headers 2015-07-01 12:02:44 +10:00
Andrew Tridgell 44b7c75a4c GCS_MAVLink: merged upstream mag cal messages for APM 2015-07-01 12:00:23 +10:00
tcr3dr 41e4c2720d AP_Param: Explicitly casts AP_CLASSTYPE parameter. 2015-07-01 11:32:11 +10:00
tcr3dr 9d26bc6958 HAL_SITL: Adds polyfill for feenableexcept on OS X. 2015-07-01 11:32:01 +10:00
tcr3dr 523acc1c54 AP_Menu: Corrects string null comparison in AP_Menu. 2015-07-01 11:31:54 +10:00
Tom Pittenger 457d3be4d7 AP_BoardConfig: add user-defined serial number
new param: BRD_SERIAL_NUM
// @Description: User-defined serial number of this vehicle, it can be any arbitrary number you want and has no effect on the autopilot
// @Range: -32767 to 32768 (any 16bit signed number)
2015-06-30 17:20:15 +10:00
Andrew Tridgell 281f6d9caa HAL_Linux: cope with expansion of storage from 4096 to 16k 2015-06-30 16:45:49 +10:00
Gustavo Jose de Sousa 87776d8a4b Storage: define LINUX_STORAGE_SIZE correctly
The value for LINUX_STORAGE_SIZE was defined inconsistently against the one
defined for Linux boards in HAL_STORAGE_SIZE. That led to some values not
being written to the storage when running the test binary built at
libraries/StorageManager/examples/StorageTest.
2015-06-30 16:37:08 +10:00
Peter Barker cabea266e7 DataFlash: pull out common mission logging code 2015-06-30 16:23:35 +10:00
Peter Barker d85b247706 DataFlash: Log_Write_SysInfo - pull out common logging startup messages 2015-06-30 16:23:34 +10:00
Peter Barker c5c39a77a3 DataFlash: method to flush ringbuffer to fd 2015-06-30 16:19:22 +10:00
Andrew Tridgell 686b1137fa AP_NavEKF: added vehicle specific initial gyro bias uncertainty 2015-06-30 16:16:26 +10:00
Andrew Tridgell 761b39be03 HAL_Linux: removed extra include 2015-06-30 15:09:52 +10:00
Andrew Tridgell 1296da56bb AP_Terrain: fixed terrain path handling 2015-06-30 15:08:10 +10:00
Andrew Tridgell a3c7297d8e HAL_Linux: fixed setting of custom directories 2015-06-30 15:08:10 +10:00
Víctor Mayoral Vilches f592981a60 TerrainIO: Support custom_terrain_directory 2015-06-30 14:36:43 +10:00
Víctor Mayoral Vilches c06abeb02e DataFlash_File: Support custom_log_directory 2015-06-30 14:36:42 +10:00
Víctor Mayoral Vilches 2e7a4aa1e6 HAL_Linux: Implement custom dir. methods 2015-06-30 14:36:42 +10:00
Víctor Mayoral Vilches e5a90c7a34 AP_HAL: Util, add custom terrain and log methods 2015-06-30 14:36:00 +10:00
Víctor Mayoral Vilches 5c4ae15deb HAL_Linux: Make use of GetOptLong
Use GetOptLong to process long args, support
custom terrain and log directories and update
_usage().
2015-06-30 14:36:00 +10:00
Víctor Mayoral Vilches 309511dc08 HAL_Linux: UARTDriver, const device_path
Class member set to const and set_device_path
accepts a const char* now.
2015-06-30 14:36:00 +10:00
Víctor Mayoral Vilches 790f4ec56c HAL_Linux: Util fix indentation 2015-06-30 14:35:59 +10:00
Andrew Tridgell ac3200fd32 AP_InertialSensor: make max_abs_offsets a single float, not a vector 2015-06-30 10:51:43 +10:00
Gustavo Jose de Sousa 0fcd98c804 AP_InertialSensor: disable debug on LSM9DS0 2015-06-30 10:28:05 +10:00
Gustavo Jose de Sousa c168e19e73 AP_InertialSensor: fix coding style with uncrustify on LSM9DS0
This commit makes backend source code for LSM9DS0 comply with the configuration
files "uncrustify_cpp.cfg" and "uncrustify_headers.cfg".
2015-06-30 10:28:02 +10:00
Gustavo Jose de Sousa 2f2a627002 AP_InertialSensor: use runtime GPIO drdy pins numbers instead C constant macros
As we intend to eventually get board related parameters from a configuration
file, this commit makes the GPIO numbers for data-ready pins be instance
variables instead of from C constant macros.

Another advantage of using instance variables in this context is the
possibility of using more than one LSM9DS0.
2015-06-30 10:27:59 +10:00
Gustavo Jose de Sousa 0ef914adac AP_InertialSensor: don't take SPI semaphore if not necessary on LSM9DS0
If the data-ready polling is done entirely on GPIO pins, it isn't necessary to
hold the semaphore before we now we have data to consume. In that case, only
take the SPI semaphore if there's new data available.

On the other hand, if at least one SPI transaction is done in order to check
for new data, then it makes sense to take the semaphore beforehand.
2015-06-30 10:27:57 +10:00
Gustavo Jose de Sousa a82ab25ed3 AP_InertialSensor: use bitfield macros instead of literal values on LSM9DS0
This commit makes accel and gyro initialization routines use bitfield macros
instead of hardcoding the literal value when wrinting on registers. That is
less prone to typos and a lot of times self-explanatory. Also, due to the
latter, the long comments explaining each register field were removed (any
detail can be checked on the datasheet).
2015-06-30 10:27:54 +10:00
Gustavo Jose de Sousa 1572324315 AP_InertialSensor: add macros for LSM9DS0 registers' bitfields 2015-06-30 10:27:51 +10:00
Gustavo Jose de Sousa 033409c629 AP_InertialSensor: set max abs calibration offset for LSM9DS0 2015-06-30 10:27:48 +10:00
Gustavo Jose de Sousa 42eb73a1d1 AP_InertialSensor: add LSM9DS0 backend
This adds the backend driver for LSM9DS0. This implementation is based on the
legacy driver coded by Víctor Mayoral Vilches (under folder LSM9DS0) and makes
some necessary adaptations and fixes in order to work properly. The legacy
driver folder was removed.
2015-06-30 10:27:46 +10:00
Gustavo Jose de Sousa c340e072f2 AP_InertialSensor: use accel instance max abs offset instead of a constant value
The calibration on LSM9DS0 was giving offsets between 4.0 and 4.2 on x-axis and
around 3.6 on y-axis. It turned out that those offsets were actually right.

The maximum absolute values of calibration offset should be a sensor
characteristic rather than a constant value for all sensors.

The constant value previously used (3.5 m/s/s for all axes) is set here as a
default maximum absolute calibration offset for every instance to keep it
working.
2015-06-30 10:27:44 +10:00
Lucas De Marchi 623c5f0713 AP_HAL_Linux: check if I2C device is chardev 2015-06-30 09:10:54 +10:00
Lucas De Marchi acc571c2c5 AP_HAL_Linux: add function to check if path is chardev
Utility function to allow checking if a certain path is a character
device.
2015-06-30 09:10:54 +10:00
Lucas De Marchi a4c1b0d75f AP_HAL_Linux: add constructor to find I2C bus reliably
The device number in /dev may not be reliable from one boot to another
due to the initialization order of each bus.

For example, in Minnow Board Max, the exposed I2C buses may be i2c-7 and
i2c-8 or i2c-8 and i2c-9 depending if the platform driver in the kernel
is initialized before or after the PCI.

It also may change with different version and configuration of the DT or
UEFI used making another kernel driver to bind to the device. This means that
for Minnow Board Max we need to use something like below to pass to the
constructor:

	static const char * const i2c_devpaths[] = {
	    /* UEFI with lpss set to ACPI */
	    "/devices/platform/80860F41:05",
	    /* UEFI with lpss set to PCI */
	    "/devices/pci0000:00/0000:00:18.6",
	     NULL
	};

The devpath here is the one returned by udev with the following command:

	udevadm info -q path /dev/<i2c-device>

In contrary to the device number in /dev/i2c-N, this path in sysfs is
stable across reboots and can only change if there's a change in the
UEFI firmware or the board's device tree.

This patch assumes the currently supported boards don't have this
problem so it's not touching them.
2015-06-30 09:10:54 +10:00
Lucas De Marchi ec5d0b6c08 AP_HAL_Linux: reorder members and methods and use C++ initializer 2015-06-30 09:10:53 +10:00
Michael du Breuil a382ce2b0c AP_GPS: Add support for logging ublox RXM-RAWX messages
Can only record 32 satellites raw info before memory corruption occurs. (And raised the limit on normal RXM-RAW messages to 22)
2015-06-30 09:05:49 +10:00
Michael du Breuil d665c85c20 DataFlash: Add RXM-RAWX logging messages 2015-06-30 09:05:48 +10:00
mirkix 38a8a772f8 AP_GPS: Add fix status 3D+DGPS 2015-06-30 09:00:31 +10:00
Andrew Tridgell 15efae5a48 HAL_SITL: use SITL_NUM_CHANNELS 2015-06-30 08:55:02 +10:00
Andrew Tridgell f8944ab6be SITL: define number of RC out channels 2015-06-30 08:54:46 +10:00
Vladislav Zakharov be4b6033e4 AP_HAL_Linux: Navio RCInput reimplemented. 2015-06-29 16:45:43 +10:00
Vladislav Zakharov e505eb2cd8 AP_HAL_Linux: Changes in Scheduler: Added defines for delays, RCIN_RERIOD changed 2015-06-29 16:45:42 +10:00
Przemek Lekston 90378b21da AP_BattMonitor: Fix battery monitor Floating Point Exception in SITL
Adds a sanity check to avoid division by zero when BATT_CAPACITY is set to 0.
2015-06-29 16:42:52 +10:00
Andrew Tridgell ff88932091 SITL: setup turbulence in JSBSim 2015-06-29 11:25:59 +10:00
Andrew Tridgell 92c9779d18 HAL_SITL: pass turbulence to simulators 2015-06-29 11:25:44 +10:00
Randy Mackay ef20676c67 GPS: fix INJECT_TO param desc and add definition
No functional change
2015-06-27 16:31:03 +09:00
Randy Mackay 0264b1aa84 AC_Circle: set only xy position targets 2015-06-27 15:43:49 +09:00
Randy Mackay 0b9c7c2a3b SerialManager: add SToRM32 to protocol param description 2015-06-27 11:18:17 +09:00
Víctor Mayoral Vilches ab5f1b3a24 BusTest: Fix compilation error with AP_ADC 2015-06-26 21:59:22 +10:00
Peter Barker 723c37bcf7 DataFlash: backend/frontend split 2015-06-26 16:02:50 +10:00
Andrew Tridgell 21c8a2d94a AP_Common: override new and delete on all platforms to zero memory
this guarantees that all classes get zero initial members when
they are dynamically allocated.
2015-06-26 15:55:19 +10:00
Andrew Tridgell eeb97800ae AC_AttitudeControl: allow for tail pass-thru in ACRO mode
this allows for all channels to be passed through
2015-06-26 12:45:38 +09:00
Michael du Breuil e45f3537cf APM_Control: Remove duplicate include statements 2015-06-25 10:23:47 +10:00
Michael du Breuil aa04c81e3c APM_Control: Fix a typo in the docstring for YAW2SRV_SLIP 2015-06-25 10:22:36 +10:00
Tom Pittenger e6122d1a4e AP_Mission: ensure cache coherence on mission resume
- when resuming a mission we should read the value from storage of the same index to ensure we're not continuing an old cached version of the mission item.
- inherent problem: DO commands will continue and will be unaffected unless the new mission has a different DO_ command structure. If so, a set_current_cmd() or reset() should be issued by the GCS.
2015-06-25 10:21:06 +10:00
Andrew Tridgell a81590f7ac HAL_SITL: prevent FPE on zero range with optflow 2015-06-25 10:08:53 +10:00
Randy Mackay 9f17fc17ab NavEKF: update parameter descriptions 2015-06-24 16:25:14 +09:00
Paul Riseborough 87e6a24154 AP_NavEKF: Add public method to reset EKF height datum and baro alt 2015-06-24 16:25:11 +09:00
Randy Mackay 1e3e65e443 AC_AttControl: add shift_ef_yaw_target
This allows shifting the target heading in case the EKF shifts it's
heading estimate
2015-06-24 11:49:32 +09:00
Paul Riseborough e3ccb74e12 AP_NavEKF: Publish amount of in-flight yaw angle reset 2015-06-24 11:49:29 +09:00
Gustavo Jose de Sousa c72dc9bd45 AP_InertialSensor: make single rotation on MPU9250
The previous implementation made some boards apply two rotations to suit
their default orientation. That was happening because there was an
unconditional rotation being done (commented as "rotate for bbone
default").

This commit makes that unconditional rotation as a default rotation
instead and adjusts the former additional rotations to be single
rotations.
2015-06-22 17:45:20 +10:00
Gustavo Jose de Sousa 3dad768e8b AP_InertialSensor: log failure to initialize after max attempts on MPU9250
This happens for example when you are trying to use an SPI speed that's
above the one supported by the sensor or the controller.
2015-06-22 17:45:20 +10:00
Gustavo Jose de Sousa 587471ab54 AP_InertialSensor: disable I2C on MPU9250
As the datasheet says: "To prevent switching into I2C mode when using
SPI, the I2C interface should be disabled by setting the I2C_IF_DIS
configuration bit."

We also reset the sensor like PX4Firmware does for initializing the
MPU6000.  See: ee1d8cd770/src/drivers/mpu6000/mpu6000.cpp (L695)
2015-06-22 17:45:20 +10:00
Michael du Breuil 6cd81ae1fb APM_Control: Add PID logging to yaw controller 2015-06-22 15:41:44 +10:00
Michael du Breuil 225c946af0 DataFlash: Add PIDS for steering logging 2015-06-22 15:41:44 +10:00
Robert Lefebvre 11214b3414 AP_Motors: move constraints to set_throttle 2015-06-22 13:52:59 +09:00
Grant Morphett 84ac8abc42 AP_Mount: Fixed a bug with wrapping of panning angles. 2015-06-22 09:32:26 +09:00
Andrew Tridgell a424686d2f DataFlash: reduce future merge conflicts
an enum makes it easier to merge new messages
2015-06-20 16:18:50 +10:00
Andrew Tridgell 81e6d88560 StorageManager: fixed hang in erase()
found by coverity
2015-06-20 15:00:57 +10:00
Andrew Tridgell 4eab27abe9 AP_InertialSensor: fixed logic bug in MPU6000 init
thanks to coverity
2015-06-20 14:53:04 +10:00
Andrew Tridgell 131b345ccc APM_Control: cleanup some coverity warnings 2015-06-20 13:30:32 +10:00
Andrew Tridgell 322a61635f SITL: allow extra arguments to be passed to last_letter 2015-06-19 16:39:46 +10:00
Robert Lefebvre 0c92565d23 AP_MotorsHeli: add Critical Rotor Speed param, use to switch off runup_complete 2015-06-19 15:10:53 +09:00
Robert Lefebvre 3ad6700c5d AP_MotorsHeli: add getters for rotor speed 2015-06-19 15:10:51 +09:00
Robert Lefebvre 8b917b82ee AP_MotorsHeli: Simplify set_desired_rotor_speed function definition 2015-06-19 15:10:50 +09:00
Robert Lefebvre 79e8c8f7f7 AP_MotorsHeli: whitespace fixes 2015-06-19 15:10:47 +09:00