Commit Graph

2165 Commits

Author SHA1 Message Date
Andrew Tridgell 5642922ca7 RC_Channel: simplify the example
use an array of channels
2012-10-16 15:50:54 +11:00
Andrew Tridgell 86b509a609 RC_Channel: ensure _reverse is not 0
this caused the example to fail
2012-10-16 15:50:29 +11:00
Pat Hickey f48568c9a6 MultiFastSerial example sketch: notes on fatal error in avr-gcc 4.5.x 2012-10-15 20:42:19 -07:00
Pat Hickey e84a467311 FastSerial example sketch: Depend on AP_Common for PSTR definitions 2012-10-15 20:42:18 -07:00
Pat Hickey 76e93e9fd7 AP_Common: PSTR def has specific version for avr-gcc 4.6 compatibility
* Also a small change in FastSerial/vprintf.cpp, which duplicates the
  PSTR definition
* Won't effect others using earlier versions of avr-gcc
2012-10-15 20:42:18 -07:00
Pat Hickey 2936dbb9de RC_Channel unit test: fixed build, functionality still wrong 2012-10-15 10:37:29 -07:00
Pat Hickey d75ca684cc MultiFastSerial test: make it easier to observe which serial port causes crash 2012-10-14 21:08:33 -07:00
Pat Hickey 930d387b8d FastSerial: add extra example sketch MultiFastSerial to test multiple ports 2012-10-14 18:58:12 -07:00
rmackay9 c0cf2d6f38 AP_Motors: added reached_limit method which returns bit mask indicating which control inputs could not be achieved 2012-10-11 17:19:54 +09:00
Andrew Tridgell 00bf548f87 AHRS: limit wind speed estimate changes
sudden yaw changes can cause bad wind estimates
2012-10-11 11:51:24 +11:00
Andrew Tridgell e8c4dedcd7 AP_OBC: fixed resume on GPS loss 2012-10-11 11:51:24 +11:00
Pat Hickey 8a6017ea48 AP_ADC_test: fix build of test regressions.
I'm not convinced I was able to make the timing test meaningful.
Someone should please lookinto this.
2012-10-09 15:23:40 -07:00
Pat Hickey aa210d7e99 AP_DataFlash_test wibble 2012-10-09 11:39:09 -07:00
Pat Hickey 605f89fa69 DataFlash_APM2: private AP_Semaphore* rather than use extern AP_Semaphore_spi3
The AP_Semaphore* argument to the constructor can be null (and is by
default for compatibility). Semaphore is only used when non-null.
2012-10-09 11:38:52 -07:00
Pat Hickey 5ac21b71ce AP_OpticalFlow_test: fix build with NULL semaphore. 2012-10-09 11:36:21 -07:00
Pat Hickey 26ba391cd4 AP_OpticalFlow_ADNS3080: has private AP_Semaphore* _semaphore
Semaphore can be null, handled correctly if it is. Rather than check for
which SPI bus the sensor is using, just check whether semaphore is not null
before using it. More general and flexible.
2012-10-09 11:35:59 -07:00
Pat Hickey 6fc0d22671 AP_Semaphore.h: proper h macros 2012-10-09 11:12:11 -07:00
Pat Hickey b2b0b70d03 AP_Semaphore_test: instantiate AP_Semaphore_spi3 locally. 2012-10-09 11:05:34 -07:00
Pat Hickey c20a401c6a AP_Semaphore: do not instantiate or export a global spi3 semaphore. 2012-10-09 11:02:35 -07:00
Pat Hickey dfcbb6d9e9 AP_Semaphore_test: bugfix to extern semaphore, add Makefile for builds. 2012-10-09 10:55:50 -07:00
Pat Hickey 5796ee91ca AP_Semaphore: make into separate library rather than part of AP_Common 2012-10-09 10:55:06 -07:00
rmackay9 c320938ff2 AP_MotorsMatrix: modified stability patch to sacrifice yaw first if necessary to ensure stability.
Resolves climb-on-yaw problem.
2012-10-09 15:48:15 +09:00
rmackay9 e33d314f1d AP_AHRS_MPU6000: resolve compiler warning re shadowing 2012-10-06 13:22:43 +09:00
rmackay9 b9963f5b5c DataFlash: modified to use AP_Semaphore for SPI3 bus when required.
Also fixed test sketch which seemed broken.
2012-10-06 12:41:50 +09:00
rmackay9 f9b16a9a50 AP_OpticalFlow: modified to use AP_Semaphore for SPI3 bus when required 2012-10-06 12:41:42 +09:00
rmackay9 23442f9caf AP_Semaphore: added new library to help remove conflicts over SPI bus 2012-10-06 12:41:35 +09:00
rmackay9 670fcbb634 AP_AHRS_MPU6000: fixed yaw correction and added _secondary_ahrs parameter
_secondary_ahrs parameter allows mpu6000 ahrs to runin parallel with DCM.
2012-09-30 00:21:18 +09:00
rmackay9 35cb7ff7e5 AP_PeriodicProcessStub: fixed build due to missing reference to _suspended 2012-09-29 14:41:25 +09:00
rmackay9 8c6fd340d7 AP_AHRS: added scheduler parameter to init
Required by the AP_AHRS_MPU6000 class which needs to disable timed processes that could interfere with it's communication with the mpu6000
2012-09-29 13:51:21 +09:00
rmackay9 c007a19200 AP_PeriodicProcess: added running() method which tells the caller whether the timer is suspended or not 2012-09-29 13:47:55 +09:00
rmackay9 00e79e7915 AP_TimerProcess: added simple example sketch 2012-09-29 13:23:51 +09:00
rmackay9 41fbb19cf5 AP_InertialSensor_MPU6000: replaced _cs_pin parameter with #define and saved 1 byte of memory
Updated ArduCopter, ArduPlane and example sketches in AP_InertialSensor, AP_IMU and AP_AHRS libraries because they no longer need to pass in cs_pin to the constructor
2012-09-28 19:21:59 +09:00
rmackay9 921ab3fe12 ArduCopter: bug fix to DMP initialisation (it was freezing due to SPI bus conflicts) 2012-09-28 18:34:23 +09:00
rmackay9 a7c2ea1891 AP_OpticalFlow: save and restore SPI bus speed to remove conflict with dataflash that runs at 8Mhz 2012-09-28 17:29:45 +09:00
rmackay9 6ed59fba91 AP_Motors: enable throttle curve by default 2012-09-25 23:36:35 +09:00
Andrew Tridgell 9f9d570597 MAVLink: comm_get_txspace should return 0 on error
it is used in expressions that add constants
2012-09-25 07:20:43 +10:00
Andrew Tridgell 14b1674c3e PeriodProcess: fixed build warning 2012-09-25 07:10:35 +10:00
Andrew Tridgell 81fd4b3a3c OpticalFlow: fixed SITL build 2012-09-25 07:10:22 +10:00
Andrew Tridgell 608cc60689 GPS: fixed SIRF auto detect code 2012-09-25 07:10:07 +10:00
Andrew Tridgell 89fa234233 SPI3: fixed the build 2012-09-25 07:03:23 +10:00
rmackay9 a75e93da06 AP_TimerProcess: add one additional slot for optical flow 2012-09-24 18:39:28 +09:00
rmackay9 163a7841f6 AP_OpticalFlow: small fixes to test sketch to make it work with modified lib 2012-09-24 18:39:22 +09:00
rmackay9 cb584f81fb AP_OpticalFlow: remove APM2 version of library now that AP_OpticalFlow_ADNS3080 class can autodetect which SPI bus the sensor is on 2012-09-24 18:39:17 +09:00
rmackay9 4d3d13582b AP_OpticalFlow_ADNS3080: detect if optical flow sensor is on standard or secondary SPI bus 2012-09-24 18:39:12 +09:00
rmackay9 ca383b393d AP_OpticalFlow: use AP_PeriodicProcess to read at 20hz 2012-09-24 18:39:07 +09:00
rmackay9 96bb6e9c70 SPI3: add new library to make use of secondary SPI bus 2012-09-24 18:39:01 +09:00
rmackay9 bc2aa84394 AP_Motors: remove stray debug message re set-up of throttle curve 2012-09-23 12:25:31 +09:00
rmackay9 e4c8eaa181 AP_Airspeed: fixed constructor compile error in example sketch 2012-09-23 11:44:28 +09:00
Andrew Tridgell e5846bd965 AP_Baro: removed _sync_access check
this isn't needed as the common variables are already protected by
cli()/sei()
2012-09-20 17:34:33 +10:00
Andrew Tridgell 7b4dc246f8 RC_Channel: don't force radio_out in enable_aux_servos()
this is called regularly, and causes the servo to twitch
2012-09-20 17:34:32 +10:00
Andrew Tridgell ccf8ba3ce9 DCM: limit the contribution of the baro to vertical acceleration
limit to a max of 0.5g
2012-09-20 17:34:32 +10:00
Andrew Tridgell 458a42654b DCM: disable use of baro for vertical accel by default
this has caused problems with too many users
2012-09-20 17:34:32 +10:00
rmackay9 50a97f3092 AP_GPS: added get_lag method to return expected lag from the GPS. 2012-09-20 15:48:22 +09:00
rmackay9 30aa104000 AP_LeadFilter: moved lag to be a parameter passed into the get_position function.
This saves 4 bytes of memory and will work better with the way we initialise the gps.
2012-09-20 15:27:27 +09:00
rmackay9 2110231ee3 AP_LeadFilter: bug fix so velocity * _lag is used (otherwise we are assuming a 1sec lag) 2012-09-20 13:17:42 +09:00
rmackay9 2c36693a50 AP_LeadFilter: added set_lag feature to allow us to adjust it for different GPSs 2012-09-20 13:10:24 +09:00
Robert Lefebvre 9e32d45d7b Change to the "Stability Patch" in Motors_Matrix in order to make it cover both the upper throttle range and lower, and also to cause it to raise/lower all motors when a single motor goes out of ranges. 2012-09-19 20:43:58 -04:00
Andrew Tridgell e761645e24 AP_Param: added find_by_index() 2012-09-20 07:42:35 +10:00
Andrew Tridgell 728b3a133e GPS: disable auto detection of NMEA and SiRF on a 1280 board
saves a bit more flash space
2012-09-19 19:36:48 +10:00
Andrew Tridgell 0c864fd4dc AP_Airspeed: a bit more filtering
this helps reduce noise at low speed
2012-09-19 16:23:25 +10:00
rmackay9 93ae29a3e9 ArduCopter: added throttle curve (although disabled by default) for all multicopters 2012-09-18 23:05:08 +09:00
Andrew Tridgell 7e544e8ead MPU6k: save 72 bytes of memory
the buffer can be on the stack
2012-09-18 13:58:50 +10:00
Andrew Tridgell 78a95290a3 SITL: prevent a fd leak in GPS code 2012-09-17 14:45:48 +10:00
Andrew Tridgell 59b44816ec GPS: replaced the GPS auto-detect mechanism
the old mechanism wasted most of the input bytes, and chewed a lot of
CPU, making it impractical to do GPS detection for a GPS attached
after startup

The new code is async, and detects a GPS by looking for a fully formed
packet with the right checksum for each GPS type
2012-09-17 14:45:47 +10:00
Andrew Tridgell 8620a036de RC_Channel_aux: minor cleanups
remove unused enable_out_ch() and enable k_manual channels. This
ensures k_manual channels used for bottle drop are initialised
correctly to trim output
2012-09-16 15:50:13 +10:00
Andrew Tridgell bd31f340a7 RC_Channel: support channel reversal on range channels
this makes it possible to have a reverse throttle in ArduPlane
2012-09-16 15:06:26 +10:00
rmackay9 303ca11c4c HIL: changes to fix HIL for ArduCopter after recent timing changes.
Changes include using AP_PeriodicProcess and calling imu.init even in HIL mode
2012-09-15 18:42:56 +09:00
Michael Oborne 94f956a0ca fix AP attitude hil - with randys help 2012-09-15 16:47:18 +08:00
rmackay9 9e66b555cb ArduCopter: removed INSTANT_PWM from ArduCopter and AP_Motors library 2012-09-13 21:31:13 +09:00
rmackay9 1c9fe3b1b6 AP_AHRS: fix to allow example sketch to compile 2012-09-13 16:45:52 +09:00
Andrew Tridgell ba9543ee04 GPS: NMEA bug fix from Alexey Kozin
thanks Alexey!
2012-09-12 15:04:24 +10:00
Andrew Tridgell fba1692d69 AHRS: added AHRS_BARO_USE parameter
allow disabling of the use of the barometer for vertical acceleration
compensation
2012-09-12 14:42:04 +10:00
Andrew Tridgell b787dc8cce APM: added wdt.h for SITL build of APM 2012-09-10 15:52:53 +10:00
rmackay9 9f1033dc42 AP_InertialSensor_Stub: added num_samples_available method to fix HIL build 2012-09-10 11:38:13 +09:00
rmackay9 130f3b0030 AP_InertialSensor_MPU6000: move _last_sample_time_micros to capture time data_interrupt was called 2012-09-10 11:38:08 +09:00
rmackay9 7a265dbf61 AP_InertialSensor: use AP_TimerProcess's queue_process to run read from MPU6000 after any currently running processes complete 2012-09-10 11:38:03 +09:00
rmackay9 55ef1e0a29 AP_PeriodicProcess: queue_process changes to suspend other processes before running queued process
Also restored suspend_timer to void return type
2012-09-10 11:37:58 +09:00
rmackay9 6ea5c21f7c AP_ADC: added num_samples_available to allow main loop to be synced with arrival of new sensor data for Oilpan. 2012-09-10 11:37:43 +09:00
rmackay9 fc4ff007e6 AP_IMU: added num_samples_available to allow main loop timing to be synced with arrival of new data from IMU. 2012-09-10 11:37:38 +09:00
rmackay9 0a6219695b AP_InertialSensor: changed read of sensor from MPU6000 to happen immediately
This reduces the delay between when data arrives and when it is used
by up to 1ms.

Added num_samples_available method to all InertialSensors to allow
main loop timing to be synced with sensors.
2012-09-10 11:37:33 +09:00
Craig Elder 90b74f5bab APM_RC: fixed noisy PWM output on startup for APM2
This reduces the number of rubbish pulses on the APM2 PWM output pins
on startup, which should help with booting some cheaper ESCs.

Thanks to Randy for the idea!
2012-09-10 08:09:28 +10:00
Andrew Tridgell 4c07add542 AP_Camera: updated for new RC_Channel_aux API 2012-09-08 15:13:06 +10:00
Andrew Tridgell f41270a3ce AP_Mount: updated for new RC_Channel_aux API 2012-09-08 15:12:52 +10:00
Andrew Tridgell 3b97339104 RC_Channel: simplified RC_Channel_aux and fixed issue 725
it is perfectly valid to configure two RC channels with the same
function, especially when that function is manual output (ie. copy
input to output)

This removes the g_rc_function[] indirection array
2012-09-08 15:12:28 +10:00
Andrew Tridgell de28cc8b28 AHRS: added AHRS_WIND_MAX option
this allows APM to cope better with airspeed sensor failure, but
ensuring airspeed stays within AHRS_WIND_MAX of ground speed
2012-09-08 11:37:07 +10:00
Andrew Tridgell 8458607928 APM_OBC: changed termination servo values, and added loop counter 2012-09-08 11:37:00 +10:00
Andrew Tridgell fa84ba451a APM_OBM: Failsafe board sketch
this combines with the OBC failsafe module
2012-09-08 10:07:17 +10:00
Andrew Tridgell cca04d195a APM_OBC: handle separate terminate pin correctly 2012-09-08 10:07:14 +10:00
Andrew Tridgell 13145e4c01 OBC: added FS_TERM_PIN option
this sets a pin for flight termination
2012-09-08 10:07:08 +10:00
Andrew Tridgell 3a1ff7bdd9 Mavlink: enable MAVLINK_SEPARATE_HELPERS
this fixes a seq number problem with SIMSTATE packets
2012-09-08 10:06:19 +10:00
Andrew Tridgell 6922dcdea2 Compass: added compass.accumulate() API
this allows us to accumulate mag readings using spare CPU cycles
2012-09-08 10:05:54 +10:00
rmackay9 5994117f6f RC_Channel_aux: bug fix which could cause channel to be assigned to the wrong function and miss others 2012-09-02 12:46:04 +09:00
Andrew Tridgell d5b218c80b SITL: use AP_Declination code to get right compass dec for autotest 2012-08-29 13:33:01 +10:00
Pat Hickey 7b3009a238 APM_RC_APM1.cpp: Bugfix on mapping of SetFastOutputChannels to ICR reg
* Previously had the ICR register for ch1/2/9 (on timer5) swapped with
  ch3/4/10 (on timer1).
* This bug probably didn't make a difference in operation since
  SetFastOutputChannels is typically only used for copters, where at
  least CH1,2,3,4 would be set to fast all at once.
2012-08-28 17:12:41 -07:00
Andrew Tridgell e2b8817a89 APM: added the ability to forcibly crash the plane on OBC failsafe breach
this allows a user to setup the OBC failsafe system to forcibly crash
the plane (surfaces at limits, zero throttle) when the failsafe system
triggers. This is to allow APM to be used in the Outback Challenge. In
the OBC an external failsafe board also does this using the heartbeat
control pin, so this is an extra safety mechanism.

To prevent users accidentially triggering a crash, this code only
activates if FS_TERM_ACTION is set to to the magic value 42.
2012-08-28 20:18:24 +10:00
Andrew Tridgell 71500347ec APM_OBC: don't use _saved_wp when zero 2012-08-28 20:18:23 +10:00
Andrew Tridgell d13d117e61 APM: removed reset_I() and instead auto-reset integrator in PID library
this prevents us resetting key integrators on waypoint change, while
still preventing old integrators being used when a PID starts to be
used again
2012-08-28 20:18:23 +10:00
Andrew Tridgell dd7c815c5f SITL: zero wind for first 15s
this allows for airspeed calibration on startup
2012-08-28 20:18:23 +10:00
rmackay9 c965963d7b AP_InertialSensor_MPU6000: bug fix. DMP was being enabled by default so although the results were not being used, this caused a delay in the main loop 2012-08-28 17:02:07 +09:00
Craig Elder 2da75b3c3c Revert "APM1: Delay serial3 init to not brick Xbee radios"
This reverts commit 25d14a9d6a4a1ea60eb78485296298c98c1595d0.
2012-08-27 15:00:23 -07:00