Commit Graph

56 Commits

Author SHA1 Message Date
Andrew Tridgell 95e4316c72 APM: updated for new RC_Channel_aux API 2012-09-08 15:14:41 +10:00
Andrew Tridgell 4219cb55ce APM: use ahrs.airspeed_estimate() in two more places
this applies the wind constraint
2012-09-08 11:37:11 +10:00
Andrew Tridgell 7ab7770c3d 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 3f54b83238 APM: added ALT_CTRL_ALG parameter
this allows you to select different altitude control algorithms. The
current choices are for the default (automatic based on if airspeed is
available), or to force a non-airspeed algorithm

The idea is to make it possible to use airspeed for some things (like
wind speed, speed scaling) but not for alt control
2012-08-28 20:18:24 +10:00
Andrew Tridgell fc942b2ff9 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 ac2ad44c3c APM: cleanup throttle suppression code and don't use airspeed to unsupress
this removes the throttle suppression when any of the conditions are
met once, as otherwise flying slow below 10m could zero the throttle.

It also removes the use of airspeed for disabling throttle
supression. Otherwise a strong gust of wind can cause ArduPlane to
try to takeoff!
2012-08-28 20:18:23 +10:00
Andrew Tridgell 2b30561171 APM: use airspeed estimate for speed scaling if available 2012-08-25 17:49:26 +10:00
Andrew Tridgell fbbd94118f APM: fixed wheeled takeoff with Jons new controllers 2012-08-22 17:34:01 +10:00
Andrew Tridgell 703ca469fe APM: added optional use of new APM_Control library
thanks to Jon Challinger for the new controllers!
2012-08-22 12:45:14 +10:00
uncrustify e5ac3bdc65 uncrustify ArduPlane/Attitude.pde 2012-08-21 19:19:50 -07:00
Andrew Tridgell 9fbdcdcf84 APM: reset steering PID integrator in reset_I() 2012-08-21 15:01:01 +10:00
rmackay9 e5d8efdb7e ArduPlane: replaced many "int" with "int16_t", "long" with "int32_t" 2012-08-18 18:26:13 +09:00
Andrew Tridgell 50e2458df0 math: more abs() fixes
abs() is 16 bit
2012-08-16 15:17:42 +10:00
Andrew Tridgell 455e088c9f APM: rename RDRSTEER to WHEELSTEER
thanks to Jon for the suggestion
2012-08-15 16:28:59 +10:00
Andrew Tridgell 4b5d98e65b APM: added RDRSTEER_ PID for steering on ground
this allows for rolling takeoff with steering, and use of rudder in
landing
2012-08-15 12:39:35 +10:00
Andrew Tridgell 54f97bb9e7 APM: removed THROTTLE_REVERSE option
Better to use RC3_REV
2012-08-09 10:04:44 +10:00
Andrew Tridgell 6e46db39a1 APM: Added STICK_MIXING option
this replaces the compile time option. Disabling during long distance
flights when the transmitter may be out of range is useful.
2012-08-09 08:53:29 +10:00
Andrew Tridgell 7d9e4a7559 APM: fixed default flap speed
the default of 255 translates to -1 as a AP_Int8, so use zero to mean
no flaps
2012-08-08 13:04:21 +10:00
Andrew Tridgell 67f076a9db APM: change variables to use _cm, _cd and _ms suffix for units
this makes it less likely that we mix up units
2012-08-08 12:12:30 +10:00
Amilcar Lucas f3f89004e9 More work on ch9, 10 and 11 2012-08-04 19:44:41 +02:00
Andrew Tridgell 6243cf77a8 APM: added a SCALING_SPEED parameter
this allows users to adjust the base speed used for scaling roll/pitch
PIDs. This can be used to make PIDs work for both airspeed and
non-airspeed control
2012-07-26 11:30:23 +10:00
Andrew Tridgell d4599aa4f0 APM: switch back to old nav_roll calculation
the old nav_roll will be used for the 2.50 release to prevent the need
for re-tuning. For the release after that we will use the new
calculation
2012-07-26 10:03:36 +10:00
Andrew Tridgell 2121491197 APM: rename airspeed_cruise to airspeed_cruise_cm to make the units clearer
it is in cm/s, not m/s
2012-07-19 11:50:41 +10:00
Andrew Tridgell 2673179075 APM: Use g.airspeed_cruise for turn rate calculation if the airspeed sensor is disabled.
This gives our best approximation for auto flight
2012-07-19 11:50:41 +10:00
Jonathan Challinger 3c4f971618 APM: Removed unused YAW_DAMPENER code.
YAW_DAMPENER was defined as zero
2012-07-19 11:50:21 +10:00
Jonathan Challinger 87c78cff5e APM: Removed incorrect nav_gain_scaler from nav_roll calculation.
nav_gain_scaler was originally added due to a perceived improvement in
loiter performance, but is incorrect for navigation. Turn rate is a
function of airspeed and bank angle, ground speed has no effect on
that.
2012-07-19 11:50:06 +10:00
Andrew Tridgell ead41670c4 Airspeed: change APM to use new AP_Airspeed library
the next step is AHRS dead reckoning
2012-07-16 11:21:50 +10:00
Andrew Tridgell 7bc724d118 APM: changed PID library to do automatic deltat calculation
this fixes a problem with the HDNG2RLL PID, which was using the wrong
time base and prevents similar bugs from happening in the future
2012-07-06 19:59:18 +10:00
Pat Hickey cb9459afed ArduPlane: Fix effect of ELEVON_REVERSE
* Previously, the ELEVON_REVERSE parameter was equivelant in function to the
  ELEVON_CH1_REVERSE parameter. These parameter values are found in
  g.reverse_elevons and g.reverse_ch1_elevon, and used to map to the radio_out
  channels in ArduPlane/Attitude.pde
* It seems the author's intent was for ELEVON_REVERSE to change the sign for
  the combination of pitch & roll into ch1 & ch2, as there are already
  parameters which change just the sign of ch1 and just the sign of ch2.
* Discovered this bug because I happened to build an elevon airframe which was
  not possible to setup with the existing ELEVON_ and RCn_REV parameters.
* This will break existing elevon setups if the user used ELEVON_REVERSE
  instead of ELEVON_CH1_REVERSE, since they were previously interchangable.
2012-05-27 22:15:08 -07:00
Andrew Tridgell 557834f9a9 AirSpeed: added parameter ARSPD_USE
setting ARSPD_ENABLE to 1 and ARSPD_USE to 0 allows the airspeed
sensor to be initialised and logged without it being used for flight
control. This is very useful when initially testing an airspeed sensor
in a new plane. It also makes it possible to enable/disable the use of
the airspeed sensor during a flight at any time.
2012-05-22 20:02:23 +10:00
Andrew Tridgell c1e4f63907 APM: adapt ArduPlane for AHRS framework 2012-03-19 17:29:02 +11:00
Phil f8ed9f0e8d APM: Fix rudder in elevon mode.
elevon planes can have rudders too
2012-02-16 14:43:24 +11:00
Doug Weibel c40093a1a7 Remove old debug print 2011-12-24 14:26:35 -07:00
Doug Weibel 4009018167 Fix scaling on "turn coordination" yaw PID so that P gain values fall in "usual" range 0.1 to 10. 2011-12-24 14:26:35 -07:00
Andrew Tridgell 1b64185b18 geofence: main geo-fence code
this implements the primary logic of geo-fencing
2011-12-16 20:11:51 +11:00
Andrew Tridgell 4319d1ceb0 throttle: only use throttle slew in auto throttle modes
we don't want STABILISE and FBWA to have throttle change limits
2011-12-12 15:14:55 +11:00
Doug Weibel f34333d42b Minimum ground speed patch from Claudio Natoli. Thanks Claudio!
This patch will boost the target airspeed as necessary to keep the ground speed above a parameter value - param_min_groundspeed.  Airspeed is still limited to FBW-max.  Setting min_groundspeed to zero (default) disables the feature.
2011-12-09 16:43:25 -07:00
Amilcar Lucas ea27d1604a More optimizations
I forgot these ones.
2011-10-09 15:34:47 +02:00
Amilcar Lucas 282722eae6 Optimize the code a bit more, only perform calculations if they are necessary 2011-10-09 15:27:17 +02:00
Amilcar Lucas 02f023a9ec Use a single if instead of four 2011-10-09 15:27:17 +02:00
Amilcar Lucas 758ae5a78e Use the shorter macro call instead 2011-10-09 13:57:35 +02:00
Andrew Tridgell 2cb93f5a16 fixed a crash in HIL
The g_rc_function[RC_Channel_aux::k_flap_auto] ptr came out as NULL
during one HIL run on a desktop CPU, which led to ArduPlane
crashing. I am not yet sure if this can happen in real flight, but I
think the NULL check is worthwhile to be sure.
2011-10-09 22:09:00 +11:00
Andrew Tridgell 1195c4750e fixed some ambiguous if/else combinations
gcc was complaining about the logic
2011-10-09 22:09:00 +11:00
Amilcar Lucas 6a5d6889b7 Only use radio_in values if the channel is not used as flight_mode_channel 2011-10-08 22:15:54 +02:00
Doug Weibel dd8367eae4 Add auto flap functionality to FBW-B 2011-09-30 07:25:36 -06:00
Doug Weibel 8f2ae139a4 Fix missing capitalization 2011-09-30 07:25:35 -06:00
Doug Weibel b6cd0ad9b8 Rework prev commit a bit cleaner as suggested by Janne Mäntyharju 2011-09-30 07:25:35 -06:00
Doug Weibel aac8eac0cb Add code to disable throttle if we are on the ground and in FBW_B or higher
Add code to disable throttle if we are on the ground and in FBW_B or higher.  We believe we are on the ground if speed < 5 and alt < 5.  Also check that we are not trying to perform a takeoff.
2011-09-30 07:25:35 -06:00
Doug Weibel 5767575a73 Correct bug in auto flap handling 2011-09-22 20:50:15 -06:00
Andrew Tridgell de18df06b5 GCS: make the two GCS links gcs0 and gcs3
the artifical separation between 'gcs' and 'hil' just leads to
confusion. This also simplifies the code a bit more, and saves us a
bit more text
2011-09-19 11:04:02 +10:00