Commit Graph

312 Commits

Author SHA1 Message Date
Randy Mackay
2696e160e6 Copter: surface tracking improvement
Separate correction speeds for pilot input vs altitude-above-ground
errors to allow slower correction to sonar signals.
Change SONAR_GAIN parameter to be altitude error -> desired speed.  This
means it should be set 10x larger than before.
Replace hard-coded sonar cut-off percentage of 70% with
SONAR_RELIABLE_DISTANCE_PCT.
Reduce sonar cut-off percentage to 60%.
Add desired sonar altitude to dataflash log's CTUN message.
2013-08-19 09:52:59 +09:00
Randy Mackay
ac620e2140 Copter: Loiter and AltHold won't breach alt fence 2013-08-15 16:06:27 +09:00
Randy Mackay
8b79798e8d Copter: Leonard's sport fix re slow roll 2013-08-11 22:15:27 +09:00
Randy Mackay
34b11f7be0 Copter: angle limiter fix for max lean angle 2013-08-11 14:55:49 +09:00
Randy Mackay
6969ab573d Copter: configurable max lean angle
ANGLE_MAX parameter allows limiting the roll and pitch angles during
manual and auto flight modes to anywhere from 10 to 80 degrees
2013-08-11 12:53:22 +09:00
Randy Mackay
49dbdce89c Copter: split ACRO_P into ACRO_RP_P and ACRO_YAW_P 2013-08-05 21:05:00 +09:00
Randy Mackay
21e523b9ac Copter: Acro trainer separated into limited and leveled 2013-08-05 21:04:53 +09:00
Randy Mackay
e32342163d Copter: rename ACRO variables 2013-08-05 21:04:50 +09:00
Leonard Hall
d2deaaa686 Copter: Acro add rate constrain and combine limit calc 2013-08-05 21:04:47 +09:00
Randy Mackay
39ab4f62ef Copter: add SPORT mode 2013-08-05 21:04:41 +09:00
Randy Mackay
9672742b42 Copter: bug fix to look_ahead_yaw
Fix received from David Dewey
Was incorrectly using the direction instead of heading when deciding
whether to point forward or not.  Reduced YAW_LOOK_AHEAD_MIN_SPEED to
1m/s because bug meant it was nearly always pointing forward and 10m/s
(the old value) seemed too high
2013-08-01 14:12:55 +09:00
Randy Mackay
9a1a999fba Copter: landing check changes 2013-07-28 18:18:50 +09:00
Randy Mackay
24d15517ff Copter: clear thr accel I term on take-off 2013-07-28 18:18:45 +09:00
Randy Mackay
c3daf78340 Copter: reset loiter target when landed 2013-07-28 18:18:41 +09:00
Randy Mackay
fe412437c2 Copter: add flags for upper and lower throttle limits
Freeze desired altitude when motors hit a limit
2013-07-28 18:18:39 +09:00
Randy Mackay
c5851d2ddf Copter: remove throttle rate's I and D calcs 2013-07-23 11:02:04 +09:00
Randy Mackay
740970efa6 Copter: remove stabilize's call to calc I terms
I terms all moved to rate controllers so this will be a small
performance improvement
2013-07-23 10:37:10 +09:00
Randy Mackay
c9a875da52 Copter: remove unused earth frame rate controllers 2013-07-21 14:08:39 +09:00
Randy Mackay
43379f20c3 Copter Motors: replace limit bitmask with structure 2013-07-21 13:58:24 +09:00
Robert Lefebvre
2a9f4bbbad TradHeli: Creating new unified roll/pitch rate controller. 2013-07-19 16:16:12 +09:00
Robert Lefebvre
23ea151ca5 TradHeli: Fix Heli rate controller filter rates. 2013-07-19 16:16:10 +09:00
Robert Lefebvre
c812d07993 TradHeli: Creating motor_runup_complete bool which is to confirm that the heli motor is running. This will be used for advanced features in the future. 2013-07-19 16:16:08 +09:00
Robert Lefebvre
cea0812b82 TradHeli: Rate PID Improvement. Limit Integrator wind-up when PID output is saturated. Also a little bit of general clean-up for readability. 2013-07-19 16:16:01 +09:00
Randy Mackay
aefb38e486 Copter: remove param to disable accel based throttle controller 2013-07-12 22:57:30 +09:00
Randy Mackay
1685ff274d TradHeli: compile error fix related to new ACRO
The motors_runup_complete must be a feature that Rob has implemented in
his clone which has not yet reached master.  We will need to restore
these lost few trad-heli specific lines once Rob's changes make it to
master.
2013-07-11 22:33:55 +09:00
Leonard Hall
64ce9b017d Copter: Body frame ACRO upgrade 2013-07-11 17:53:25 +09:00
Randy Mackay
f459d35e3e Copter: roll-pitch fix to allow I to reduce
Contributed by Leonard Hall
2013-07-10 15:52:15 +09:00
Andrew Tridgell
da4137b731 Copter: changes for GPS field changes 2013-07-10 14:04:22 +10:00
Randy Mackay
227185fd0f Copter: remove constraint on rate yaw controller 2013-07-05 14:18:58 -10:00
Randy Mackay
40612ed551 Copter: yaw limit fix to allow I to reduce
We now allow the I term even if we've hit the yaw limits as long as
updating the I term will reduce it
2013-07-05 13:52:03 -10:00
Randy Mackay
404cd5f3da Copter: rename g.pid_throttle to g.pid_throttle_rate
Small code clean-up to make throttle rate controller's pid more obvious
2013-06-30 00:04:21 -10:00
Randy Mackay
b3da8a462f Copter: CH6 tuning definition clean-up
Renamed and reorganised the CH6 #defines and parameter definitions
2013-06-29 23:51:43 -10:00
Randy Mackay
fcf2429e39 Copter: remove throttle controller's ability to limit lean angle 2013-06-04 15:25:59 +09:00
Randy Mackay
40f5226518 Copter: reset yaw angle only when motors not spinning 2013-06-03 22:12:52 +09:00
Randy Mackay
5203ba9fe3 Copter: alt hold feed forward filter 2013-06-01 21:13:47 +09:00
Andrew Tridgell
25c576cad7 Copter: replaced constrain() with constrain_float() 2013-05-02 10:26:49 +10:00
Randy Mackay
0b29754920 Copter: simplify roll-pitch stabilize controller
remove check of whether to freeze i term when attitude is less than 5
degrees from horizontal.  I terms have been moved to the rate
controllers.
2013-04-22 18:47:56 +09:00
Andrew Tridgell
c2c037ec0d Copter: use the right constrain() type in Attitude code
Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-04-22 13:26:49 +10:00
Randy Mackay
a9da3c9d3d Copter: remove unused throttle functions
removed get_pilot_desired_acceleration vand get_pilot_desired_direct_alt
were used for initial testing of the inertial alt-hold controller but
are no longer required.
2013-04-21 23:43:04 +09:00
Randy Mackay
745df9b13c Copter: add SONAR_GAIN to tune reaction to sonar
Some users report the response to sonar is too violent, this allows that
reaction to be reduced
2013-04-20 15:58:36 +09:00
Randy Mackay
50515e28e1 Copter: replace fabs with fabsf 2013-04-20 15:40:56 +09:00
Randy Mackay
f5955d8915 Copter: auto climb and descent params removed
These params now reside in the AC_WPNav library
2013-04-18 14:52:21 +09:00
Randy Mackay
1ee825ee9a Copter: move alt and wp checking to AC_WPNAV
RTL fix so that if it starts rtl-ing from above 80m it returns home
while descending instead of descending at initial position.
add get and set_target_alt_for_reporting
2013-04-14 10:39:23 +09:00
Randy Mackay
7c559333f5 Copter: get_throttle_rate's target_speed a float 2013-04-14 10:38:51 +09:00
Randy Mackay
ee7f40cfe9 Copter: Leonard's alt-hold feed forward 2013-04-14 10:38:37 +09:00
Randy Mackay
f82ce449d7 AC_WPNav: add angle limits and set from AC's throttle controller 2013-04-14 10:38:34 +09:00
Randy Mackay
1516972eaa Copter: add panorama to CIRCLE mode
Yaw will slowly rotate if CIRCLE_RADIUS is set to zero
Circle center is projected forward CIRCLE_RADIUS from current position
and heading
2013-04-14 10:38:01 +09:00
Randy Mackay
49828eba7d Copter: integrate AC_WPNav 2013-04-14 10:37:48 +09:00
Randy Mackay
24dd167607 Copter: ACRO bug fix from Jason 2013-04-01 11:44:28 +09:00
Andrew Tridgell
b280857025 Copter: use common angle wrap code 2013-03-29 13:14:31 +11:00
Randy Mackay
fdcb78ccf7 Copter: leonard's smoother alt-hold transition
Target altitude when entering alt-hold is based on a projection from
current alt and climb rate
2013-03-17 13:24:49 +09:00
Randy Mackay
37040adfaa Copter: bug fix for auto missions over 320m
get_throttle_althold_with_slew's target_alt parameter defined as int16_t
(instead of int32_t) meaning missions with altitudes >320m could wrap
around and become negative.
2013-03-17 11:14:35 +09:00
Randy Mackay
f9539384a1 Copter: rename failsafe to failsafe_radio
Makes way for separation of failsafes for throttle, gps and gcs
2013-03-16 17:14:21 +09:00
Randy Mackay
476a6d0164 Copter: fix for acro throttle bug 2013-03-02 10:28:44 +09:00
Randy Mackay
d8515ff85e Compass: basic compensation for motor interference 2013-03-02 00:03:16 +09:00
Randy Mackay
df1c0d92bd Copter: manual throttle scaling fix
Scaling of bottom half of throttle was changed from THR_MIN ~ 500.
Previously it was from 0 ~ 500.
2013-02-01 22:37:33 +09:00
Randy Mackay
a0b65a262b Copter: use scaled throttle for accel-throttle's I term
Accel throttle's I term is taken from scaled manual throttle
2013-02-01 22:37:25 +09:00
Randy Mackay
06a71af12f Copter: THR_MID used to scale manual throttle 2013-02-01 22:37:16 +09:00
Randy Mackay
aaecc25ac7 Copter: leonard's inav2
Moved loiter controller to navigation.pde
2013-01-25 15:16:35 +09:00
Randy Mackay
deafbf1f56 Copter: inav loiter comment changes
removed unused get_loiter_vel function
2013-01-24 11:14:38 +09:00
Randy Mackay
68fc9ac1d8 Copter: add "f" to end of float constants
This is a small performance improvement for the px4
2013-01-23 14:51:37 +09:00
Randy Mackay
9a09f086d2 Copter: Leonard Hall's inertial nav ver 2 2013-01-23 12:34:49 +09:00
rmackay9
ab1978ad50 Copter: Leonard Hall's inertial nav based loiter 2013-01-22 18:38:00 +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
Randy Mackay
175f69a64f ArduCopter: smooth throttle when switching from manual throttle to alt hold
new set_accel_throttle_I_from_pilot_throttle function copies the
difference between the pilot's throttle and hover throttle to the
accelerometer based throttle controller's I term.
2013-01-13 20:00:59 +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
860f4b2605 Copter: merge the latest 2.9 changes into master 2013-01-08 14:37:40 -08:00
Andrew Tridgell
ead38f917f Copter: use GRAVITY_MSS 2013-01-02 14:45:08 +11:00
Andrew Tridgell
51d987a890 Copter: removed unusued variable 2013-01-02 09:55:55 +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
daac540e08 ArduCopter: get_throttle_althold - add check to avoid divide by zero 2013-01-02 09:55:37 +11:00
rmackay9
576af6d487 ArduCopter: bug fix to althold desired rate calculation. Fix from Jonathan. 2013-01-02 09:55:37 +11:00
rmackay9
ff40fa6aab ArduCopter: alt hold bug fix - should use 2x linear distance when calculating the desired rate
Bug fix from Leonard.
2013-01-02 09:55:37 +11:00
rmackay9
393c893cdb ArduCopter: bug fix (attempt #2) for accel based throttle controller
Thanks to Jonathan for this.
2013-01-02 09:25:58 +11:00
rmackay9
e583ade62d ArduCopter: bug fix to accel based throttle controller (was using m/s instead of cm/s) 2013-01-02 09:24:31 +11:00
rmackay9
e850ab7ccd ArduCopter: add AUTO_VELZ_MIN, AUTO_VELZ_MAX and PILOT_VELZ_MAX to allow better control of climb/descent rate in auto and manual throttle modes 2013-01-02 09:24:31 +11:00
rmackay9
466097b383 ArduCopter: use inertial nav for current altitude and climb rate 2013-01-02 09:22:51 +11:00
rmackay9
7a5e4b8549 ArduCopter: stop unnecessary updates of target altitude and knock-on effect of too many EV message in dataflash log 2013-01-02 09:19:17 +11:00
rmackay9
ac8af9a53f ArduCopter: Leonard Hall's changes to alt hold including adding low pass filter to climb rate
get_throttle_rate_stabilized changed to simply update the target altitude instead of talking directly to the rate controller.
get_throttle_althold changed to use sqrt of distance when calculating the desired rate towards the target altitude.
added reset of accel based throttle PID's I term.
unrelated small bug fix from Randy to allow CH6 tuning of throttle rate D term.
2013-01-02 09:19:17 +11:00
rmackay9
f4c50353b9 ArduCopter: allow tuning of the Throttle Rate D term 2013-01-02 09:16:48 +11:00
rmackay9
7ea34d4fb7 ArduCopter: updated accel based throttle to use ahrs's get_accel_ef method
Also removed slow low pass filter meant to correct for accelerometer calibration.  This is no longer required now that we have the improved calibration method.
2013-01-02 09:11:25 +11:00
Pat Hickey
7af03127f6 ArduCopter: more work 2012-12-20 14:52:28 +11:00
rmackay9
af77425636 ArduCopter: fix Failed to Init Optflow message at startup 2012-12-11 00:09:45 +09:00
rmackay9
2f1b2b70e6 ArduCopter: added ACRO_TRAINER parameter to allow enabling/disabling the acro training function which will bring the roll back to within +- 45 degrees 2012-12-10 22:27:46 +09:00
rmackay9
154e3c33f7 ArduCopter, AP_InertialNav: consolidated ThirdOrderComplementaryFilter into AP_InertialNav to save about 200bytes of RAM 2012-12-10 00:43:11 +09:00
Robert Lefebvre
0eb57bf93d ACM: TradHeli
Fix to make update_throttle_cruise work with stab_throttle scaling.
2012-12-08 15:12:39 -05:00
Robert Lefebvre
1b97a92098 ACM: Code Cleanup 2012-12-08 14:49:38 -05:00
rmackay9
9dd978576b ArduCopter: auto yaw changes to allow pilot override of yaw during missions
Added set_yaw_mode to better control of yaw controller changes and variable initialisation.
Replaced AUTO_YAW mode with separate yaw controllers YAW_LOOK_AT_NEXT_WP, YAW_LOOK_AT_LOCATION, YAW_LOOK_AT_HEADING.
Pilot manual override of yaw causes yaw to change to YAW_HOLD (i.e. manual yaw) until next waypoint is reached.
Added get_yaw_slew function to control how quickly autopilot turns copter
Changed YAW_LOOK_AHEAD to use GPS heading and moved to new get_look_ahead_yaw function in Attitude.pde
Renamed variables: target_bearing->wp_bearing, original_target_bearing->original_wp_bearing.
Removed auto_yaw_tracking and auto_yaw variables and update_auto_yaw function as they are no longer needed.
Simplified MAV_CMD_CONDITION_YAW handling (do_yaw).  We lose ability to control direction of turn and ability to do long panorama shots but it now works between waypoints and save 20bytes.
2012-12-08 14:23:32 +09:00
rmackay9
2dd4694eef ArduCopter: adjusted pid_throttle_accel dt to 0.01 (100hz) 2012-12-06 10:32:12 +09:00
rmackay9
39d524212f ArduCopter: allow accel based throttle controller to be enabled/disabled with the new THR_ACC_ENABLE parameter.
When disabled the original velocity based throttle controller is used.
2012-12-06 10:31:57 +09:00
rmackay9
a5bb54e36e ArduCopter: RTL clean-up and slightly improved landing sensor
Consolidated RTL state to be captured by rtl_state variable.
Combined update_RTL_Nav and verify_RTL functions which performed the same function but one was for missions, the other for the RTL flight mode.
Renamed some RTL parameters and global variables to have RTL at the front.
Landing detector now checks accel-throttle's I term and/or a very low throttle value
2012-12-06 10:31:52 +09:00
rmackay9
072ffec493 ArduCopter: allow INERTIAL_NAV to be enabled separately for horizontal and vertical position 2012-12-06 10:31:41 +09:00
rmackay9
bdb47c449a ArduCopter: pass linear altitude error to throttle rate controllers.
Previously the requested rate used the square root of the altitude error.

Scale pilot's desired vertical rate and acceleration based on ACCELERATION_MAX_Z and VELOCITY_MAX_Z #defines
2012-12-06 10:31:31 +09:00
rmackay9
7b4ed2d227 ArduCopter: restored landing detector to landing throttle mode.
Added LAND_SPEED parameter to control the rate of descent for the last 10m of a landing.
Added CH6 tuning for accel based throttle controller.
2012-12-06 10:31:20 +09:00
rmackay9
a94826f182 ArduCopter: add set_throttle_mode to better control initialisation of variables 2012-12-06 10:31:04 +09:00
rmackay9
1036b35128 ArduCopter: added back in angle boost and recombined for heli and multicopter 2012-12-06 10:30:55 +09:00
rmackay9
3cbef57c64 ArduCopter: first merge of leonard's accel based altitude controller plus other changes from Randy
Changes include:
New low-level get_throttle_accel function takes target acceleration and compares vs earth-frame Z accelerometer values to produce output to motors.
Higher level throttle controllers modified to call new get_throttle_accel controller
Throttle_rate_stabilized controller added which maintains a desired climb/descent rate
Throttle_land controller added - descends using normal auto throttle controller to 10m then descends at 50cm/s
Multiple throttle modes added including landing mode
Land flight mode no longer needs GPS
Throttle cruise maintenance moved to update_throttle_cruise function
2012-12-06 10:30:49 +09:00
Robert Lefebvre
1d589c0b7d ACM: TradHeli
Fixes for Attitude rate controllers.
2012-12-04 14:42:04 -05:00
Robert Lefebvre
07d7d90882 ACM: TradHeli
Bringing in Low Pass Filter for Rate Controllers
2012-11-26 21:51:23 -05:00
Robert Lefebvre
3f0e8dd358 ACM: TradHeli
Bringing in Low Pas Filter
Commented out because it does not build.
Needs updates to Low Pass Filter Lib
2012-11-26 21:21:12 -05:00