Commit Graph

54 Commits

Author SHA1 Message Date
Andrew Tridgell c2fd1512ff Copter: use voltage_average() so as to avoid INPUT_VOLTS 2013-03-03 16:16:01 +11:00
rmackay9 9c3b9907dd Copter: bug fix to set sonar_alt_health to zero when disabled 2013-01-31 17:00:28 +09:00
James Bielman 5631f865b2 Update floating point calculations to use floats instead of doubles.
- Allows use of hardware floating point on the Cortex-M4.
- Added "f" suffix to floating point literals.
- Call floating point versions of stdlib math functions.
2013-01-16 13:52:01 +11:00
rmackay9 21b6c78d12 ArduCopter: added get_throttle_althold_with_slew to allow slower altitude target changes
Improved surface tracking by using slewed althold controller
Reduced sonar mode filter to just 3 elements to reduce lag but at the possible consequence of allowing sonar noise to creep through for people with margin sonar set-ups.
2013-01-13 19:51:47 +11:00
Andrew Tridgell 17a63dc76a Copter: fixes for AP_HAL merge 2013-01-02 09:55:55 +11:00
rmackay9 672fdfbf71 ArduCopter: added ERR dataflash message
Failsafe events changed to errors so they are more obvious.
Errors recorded to dataflash for failure to init compass and optical flow sensor.
Errors recorded for pwm failure.
Resolved a compile error when dataflash logging is disabled.
2013-01-02 09:55:37 +11:00
rmackay9 677b38a48e ArduCopter: first implementation of surface tracking using sonar
Note: not yet enabled as part of any flight mode
2013-01-02 09:55:37 +11:00
rmackay9 466097b383 ArduCopter: use inertial nav for current altitude and climb rate 2013-01-02 09:22:51 +11:00
Pat Hickey 5bd7046a95 ArduCopter: sketch cpp builds! 2012-12-20 14:52:28 +11:00
Pat Hickey 8b49208771 ArduCopter: some fixes 2012-12-20 14:52:28 +11:00
Pat Hickey 70f4739522 ArduCopter: more fixes 2012-12-20 14:52:28 +11:00
rmackay9 52177c63f7 ArduCopter: only attempt to change settings of optical flow sensor if it has been successfully initialised 2012-12-11 00:14:29 +09:00
Andrew Tridgell cd07d965a7 Copter: ported RSSI_PIN option from ArduPlane
this is useful for OSD users
2012-11-22 20:59:33 +11:00
Andrew Tridgell bcae83c4f6 ACM: make it possible to run CLI on radio port in ArduCopter 2012-11-21 21:41:34 +11:00
rmackay9 07a7a1acd8 ArduCopter: replaced digitalRead and digitalWrite with faster calls
improved performance logging to dataflash
2012-11-19 01:16:07 +09:00
rmackay9 e92b560df5 ArduCopter: low baterry failsafe 2012-11-15 23:35:41 +09:00
rmackay9 78316adf75 ArduCopter: replace Serial.print with Serial.print_P to save memory.
Includes replacing flight_mode_strings with print_flight_mode function.
SendDebug macro replaced with direct Serial.print_P calls.
2012-10-22 16:45:24 +09:00
rmackay9 d2912e4e01 ArduCopter: added spi_semaphore to stop conflicts between dataflash and optical flow sensor on APM1 2012-10-18 17:04:44 +09:00
Andrew Tridgell f828956cb8 battery: use set_pin() to allow pins to be changed at runtime 2012-10-16 17:20:49 +11:00
rmackay9 240b0b43fd ArduCopter: small comment fixes related to battery monitoring 2012-10-13 20:52:14 +09:00
rmackay9 4a41a3d210 ArduCopter: added BATT_VOLT_PIN and BATT_CURR_PIN parameters to allow support for new 3DR IV battery voltage and current monitor 2012-10-13 18:40:46 +09:00
rmackay9 ea4f256f8e ArduCopter: BATT_PIN parameter added to allow you to select which pin is used for voltage and current measurements
To save a parameter, the current sensor pin is assumed to always be 1 higher than the voltage pin.
2012-10-02 22:16:19 +09:00
rmackay9 95763e610b ArduCopter: allow DMP to run in parallel with DCM
Parallel DMP can be enabled by #define SECONDARY_DMP_ENABLED in APM_Config.h
New DMP dataflash log type added to allow easy comparison with DCM
2012-09-30 00:25:40 +09:00
rmackay9 b2f12c4854 ArduCopter: optical flow initialisation changes now that optical flow library automatically works on APM1, APM2 and APM2.5 2012-09-24 18:39:33 +09:00
uncrustify 8dccd9d6b0 uncrustify ArduCopter/sensors.pde 2012-08-21 18:56:50 -07:00
Andrew Tridgell 82ede937e7 AnalogSource: convert analogRead() calls to the new API
this should give us much better analog values, plus save a bunch of
CPU time
2012-07-01 15:01:05 +10:00
Andrew Tridgell 33440567e6 ACM: ArduCopter updates for new compass interface 2012-06-27 16:01:50 +10:00
Andrew Tridgell dae1a57dc5 ACM: adapt the ArduCopter code for new barometer interface 2012-06-27 16:01:50 +10:00
Robert Lefebvre 4e4ff84cf1 Updates to CopterLEDS
Creation of Nav Blink Function.
2012-05-22 09:58:37 -04:00
Robert Lefebvre c5f7b2fff2 Fixed Syntax error. 2012-05-15 12:35:35 -04:00
Robert Lefebvre c8fb9a6635 More CopterLEDS changes.
Merged CopterLEDS and Piezo functions to eliminate pin conflict on APM2.  Created new Parameter bit to turn piezo function on and off from MP. Moved GPS and Aux pin assignments to allow commonality between APM1 and 2.  Set LED_Mode parameter default to 9 in order to make CopterLEDS completely backwards compatible with old Motor LEDS and Piezo code.  Legacy users should see no difference.
2012-05-15 12:00:21 -04:00
Andrew Tridgell 547b4ed55b AHRS: adapt ArduCopter for new AHRS framework 2012-03-19 17:29:02 +11:00
Andrew Tridgell d6cfc51ae4 ACM: no need to fetch offsets at startup
AP_Param handles this
2012-03-10 10:34:31 +11:00
Jason Short 486c56ce41 Consolidated Barometer pressure sensing to a single filter based on Randy's new filter class. 2012-03-08 23:13:04 -08:00
Andrew Tridgell 0248b48d30 allow MAG_ENABLE to be changed in flight
this disables the compass in DCM if MAG_ENABLE is changed in
flight. Without this we would use a fixed yaw once the compass is
disabled

This also makes sure we don't pass the compass to DCM till we have
done a read. This ensures we have a good compass fix for the initial
DCM heading
2012-02-25 14:51:09 +11:00
Andrew Tridgell 864ed1a87f ACM: check the return of compass.init()
if the compass fails to initialise then don't pass it to DCM, or we
will get no yaw control. Report the init failure to the user.
2012-02-25 14:51:08 +11:00
Jason Short 295631139a formatting 2012-01-28 21:19:46 -08:00
Randy Mackay 4434ddf389 Optical flow - updated standard frame rate to 2000hz and increased resolution to 1600cpi 2012-01-25 21:53:20 +09:00
Michael Oborne 95f58b0432 fix scale error 2012-01-21 06:33:18 +08:00
Michael Oborne 1bebb9452b AC sync battery code with arduplane 2012-01-21 06:29:09 +08:00
Doug Weibel ed9f7cb1b6 Update battery monitoring code for ArduCopter
Fixes compatibility for APM2.  Also a significant update to the battery monitoring code:  We previously had monitoring modes for individual cell voltages for 3 and 4 cell lipos.  These have been removed as they were never really supported (the cell voltages were computed but were not reported or recorded anywhere).  Also, some clean-up/prep work was done for supporting monitoring 2 separate battery packs.  The CLI battery and current monitoring tests were consolidated into 1 test.
changed
2012-01-15 17:10:02 -07:00
Doug Weibel 9846822748 Bug fix for compass.
This is a fix for an interesting bug when a DCM matrix reset was added to the ground start.  This bug only showed up if (A) a ground start were performed after an air start or due to use of the "Calibrate Gryo" action, (B) if the current orientation were sufficiently different from 0/0/0, and (C.) if the particular magnetometer had sufficiently large offsets.  Why did resetting the DCM matrix to 0/0/0 pitch/roll/yaw at ground start cause a bug?  The magnetometer offset nulling determines the proper offsets for the magnetometer by comparing the observed change in the magnetic field vector with the expected change due to rotation as calculated from the rotation in the DCM matrix.  This comparison is made at 10Hz, and then filtered with a weight based on the amount of rotation to estimate the offsets. Normally it would take considerable time at normal in-flight rotation rates for the offset estimate to converge. 

If a DCM matrix reset occurs when the offset nulling algorithm is up and running, the algorithm sees the DCM reset as a instantaneous rotation, however the magnetic field vector did not change at all.  Under certain conditions the algorithm would interpret this as indicating that the offset(s) should be very large.  Since the "rotation" could also have been large the filter weighting would be large and it was possible for a large erroneous estimate of the offset(s) to be made based on this single (bad) data point.

To fix this bug methods were added to the compass object to start and stop the offset nulling algorithm.  Further, when the algorithm is started, it is set up to get fresh samples.  The DCM matrix reset method now calls these new methods to stop the offset nulling before resetting the matrix, and resume after the matrix has been reset.
2012-01-12 14:44:24 -07:00
Jason Short 92eece79a4 cleanup - removed unused functions, made pressure reading Float to avoid extra cast 2012-01-04 09:28:36 -08:00
Randy Mackay 3cb74cb459 ArduCopter - init_compass - fixed HIL build issue 2011-12-31 12:29:54 +09:00
Jason Short fbb35928fe removed unused function
Simplified the baro init filter
2011-12-29 23:02:01 -08:00
Randy Mackay bbe6dea980 OptFlow - initial support for APM2 (there are still problems) including adding ability to set Chip Select pin.
Other unrelated changes are:
a) fixed typo in 'esitmate_velocity' to 'estimate_velocity'.
b) moved init_compass from system.pde to sensors.pde which seemed consistent with other sensors.
2011-12-30 12:06:31 +09:00
Pat Hickey 6dbd6b4181 ArduCopter: Get barometer data in terms of AP_Baro interface
* Major change: Log.pde Log_Write_Control_Tuning has changed significantly
* MS5611 has no concept of RawPres and _offset_press
* Log the get_pressure() instead. (If we don't trust the barometer, what's the point?)
2011-12-11 15:21:10 -08:00
Randy Mackay 67855b207d Arducopter, RangeFinder - added SONAR_TYPE parameter and properly support the XL (default), LV and long distance XL (aka XLL) sonar types 2011-12-11 16:40:59 +09:00
Andrew Tridgell 28634f51b7 ArduCopter: use specific sized data types in a lot of places
this will make the Desktop build more consistent with the real AVR
build, and also with a future ARM build
2011-11-08 11:05:36 +11:00
Andrew Tridgell d89ae696ef merged the GCS updates from ArduPlane to ArduCopter
this removes all the non-MAVLink GCS options, and simplifies the HIL
and GCS code a lot. It also adds async sending of low priority GCS
text messages.
2011-10-11 20:53:43 +11:00