Commit Graph

626 Commits

Author SHA1 Message Date
Iampete1
d84a3ec26f Plane: allow Failsafe_Action_AUTOLAND_OR_RTL without MODE_AUTOLAND_ENABLED and defualt to RTL 2025-02-25 11:06:38 +11:00
Henry Wurzburg
9b7c88152b ArduPlane: add AUTOLAND as LOW volt batt failsafe 2025-02-25 11:06:38 +11:00
Peter Barker
b0c31d865e ArduPlane: mark many functions as __INITFUNC__
... implying they can go into external flash
2025-02-19 18:01:48 +11:00
abaghiyan
26cbdd9a4c Plane: Fixed formula for load factor
In general when there the pitch and roll exist the formula for the aerodynamic load factor should be as follows:
aerodynamic_load_factor = cosf(radians(_ahrs.pitch))/cosf(radians(demanded_roll));
which in case of turns (in the horizontal plane) becomes
aerodynamic_load_factor = 1.0f/cosf(radians(demanded_roll));
formulas can be obtained from equations of balanced spiral:
liftForce * cos(roll) = gravityForce * cos(pitch);
liftForce * sin(roll) = gravityForce * lateralAcceleration / gravityAcceleration; // as mass = gravityForce/gravityAcceleration
see issue #24320 [#24320].
To connect loadFactor to airspeed we can use formula of balancing between lift force and gravity force:
liftForce = loadFactor * gravityForce; on the other hand lift force can be expressed as
liftForce = 0.5 * lifCoefficient * airDensity * sq(airspeed) * referenceArea; minimum airseepd is at loadFactor = 1
and lift force only balances the gravit force, so gravity force (which is same as lift force at minimum airspeed) with minimum airspeed can be expressed as
gravityForce = 0.5 * lifCoefficient * airDensity * sq(airspeed_min) * referenceArea; substituting gravit force in previous formula gives us
0.5 * lifCoefficient * airDensity * sq(airspeed) * referenceArea = loadFactor * 0.5 * lifCoefficient * airDensity * sq(airspeed_min) * referenceArea;
from where we get:
loadFactor = sq(airspeed / airspeed_min);
These changes also require changes in ardupilot/libraries/AP_TECS/AP_TECS.cpp
Line 418 (according to the comments by Peter Hall): _TASmin *= _load_factor; should be changed to _TASmin *= safe_sqrt(_load_factor);

See details here: #24320
2025-02-18 10:53:06 +11:00
Henry Wurzburg
3093532d78 ArduPlane: add climb before turn to AUTOLAND
Co-authored-by: IamPete1 <iampete@hotmail.co.uk>
2025-02-11 11:16:33 +11:00
Iampete1
3e37b01e35 Plane: remove unused method set_target_altitude_current_adjusted 2025-02-03 10:14:00 +00:00
Iampete1
4ddd78e310 Plane: plane.h: remove unused definitions 2025-02-03 10:14:00 +00:00
Peter Barker
d322c33169 ArduPlane: rename SRV_Channel::Aux_servo_function_t to SRV_Channel::Function 2025-01-28 21:56:46 +11:00
Peter Barker
302040dcb0 ArduPlane: remove vestiges of LearnType::LEARN_INTERNAL
57a3bc1397 changed the code from "internal" to "in-flight

It seems the old value of "1" was no longer valid

It also changed things to that the learning system saved the offsets.
2025-01-28 12:23:53 +11:00
Peter Barker
1ed2e54269 ArduPlane: adjust for AP_Arming file rename 2025-01-28 10:56:26 +11:00
Henry Wurzburg
010e6ba0b0 ArduPlane: mode AUTOLAND enhancements
Co-authored-by: Andrew Tridgell <andrew@tridgell.net>
Co-authored-by: Pete Hall <iampete@hotmail.co.uk>
2025-01-21 11:30:23 +11:00
Henry Wurzburg
32f5afb22a ArduPlane: add AutoLand fixed-wing mode 2024-12-31 09:18:49 +11:00
Peter Barker
edc812d7f5 ArduPlane: adjust for renaming of RC_Channel and GCS_MAVLink headers 2024-12-26 11:01:22 +11:00
Peter Barker
94eaa71182 ArduPlane: correct comments for ArduPlane.cpp rename 2024-12-24 12:26:42 +11:00
George Zogopoulos
9a5f81aa95 Plane: Added check for takeoff level-off timeout
When an airspeed sensor is not used, during a takeoff, the pitch angle
is asymptotically driven to 0 as the takeoff altitude is approached.
Some airplanes will then stop climbing and fail to reach altitude.

To prevent an indefinite wait for the takeoff altitude to be reached, a
dedicated level-off timeout has been introduced.
2024-12-04 18:07:30 +11:00
Michelle Rossouw
43fdc9ce19 Plane: Added Quicktune
replaces QAUTOTUNE in default build
2024-11-27 14:07:38 +11:00
Iampete1
52efe952cd Plane: slew limit all throttles in one place 2024-11-19 11:04:37 +11:00
Peter Barker
f01abb9d5d ArduPlane: remove stray log_init declaration
this method went away
2024-10-15 10:42:36 +11:00
George Zogopoulos
6ce6ef8fff Plane: Takeoff improvements
- TAKEOFF and AUTO flight modes now should have identical takeoff
- Prevent behaviour switching past climb altitude in TAKEOFF mode.
- Refactor set_pitch_min/max methods.
  Max was already there, now renamed.
  Min is newly introduced.
  behaviour.
- Remove enforcement of min takeoff throttle logic from servos.cpp.
  It is now handled only by takeoff.cpp.
- Take TKOFF_LVL_ALT into consideration in AUTO as well.
- Fixed pitch setpoint when TKOFF_ROTATE_SPD>0.
- Roll navigation in mode TAKEOFF during climb should now work again.
- Now the TAKEOFF loiter waypoint is set by the bearing of the
aircraft while on TKOFF_LVL_ALT, as in the last stable release, instead
of TKOFF_ALT.
- Using TRIM_THROTTLE in takeoffs, when TKOFF_THR_MIN==0
2024-10-02 17:09:07 +10:00
timtuxworth
1133f82799 ArduPlane: use Location::AltFrame for guided_state.target_alt_frame 2024-09-24 22:51:02 +10:00
Andrew Tridgell
83cac93e85 Plane: allow for any orientation of rangefinder for landing
this is principally for tailsitters where rangefinders would be
orientation with RNGFND1_ORIENT=12 (PITCH_180), but also allows for
custom orientations which will be useful if the rangefinder is tilted
forward
2024-09-14 08:39:51 +10:00
Andrew Tridgell
2f19dfef8a Plane: added glider pullup support 2024-09-10 10:15:34 +10:00
timtuxworth
f63568b34b ArduPlane: Bindings for crosstrack in Lua 2024-08-20 09:10:42 +10:00
Peter Barker
2632e5b8a6 Plane: use enum class for VTOL approach stage
also namespace it with the state variable which uses this type
2024-08-07 17:52:25 +10:00
Peter Barker
c2f5c48fe5 Plane: rename OFFBOARD_GUIDED to AP_PLANE_OFFBOARD_GUIDED_SLEW_ENABLED
and remove comparison vs ENABLED
2024-08-05 10:20:14 +10:00
Peter Barker
da562369b5 Plane: remove replace PARACHUTE define with AP_PARACHUTE_ENABLED 2024-08-05 10:20:14 +10:00
Iampete1
55f51eabe8 Plane: move have_autoenabled_fences to be private in ModeTakeoff 2024-07-30 09:59:01 +10:00
George Zogopoulos
773c91cec1 ArduPlane: Added minimum throttle during TAKEOFF mode
This is a rework so that servos.cpp is responsible for setting the
throttle limits under more circumstances and always notifies TECS when
it does so.

Additionally, the TAKEOFF mode has been improved with a new parameters
TKOFF_MODE and TKOFF_THR_MIN that extend the throttle behaviour.
2024-07-29 15:50:32 +10:00
Henry Wurzburg
a6300e35d0 Plane: prevent Mode Takeoff calling fence autoenable more than once 2024-07-24 08:24:06 +10:00
Andrew Tridgell
d4f9843e55 Plane: support MAV_CMD_SET_HAGL
allow for external height above ground estimate
2024-07-17 08:03:18 +10:00
Peter Barker
c14c2d67d4 ArduPlane: make AP_RANGEFINDER_ENABLED remove more code 2024-07-02 09:17:26 +10:00
Bob Long
5824a12b2e Plane: remove altitude_error_cm variable
This variable updated unpredictably, and it was easy to introduce bugs.
It was not used in many places and is clearer to calculate the error
directly when needed.
2024-05-07 10:52:43 +10:00
Tom Pittenger
1fe7f6b099 Plane: refactor NAV_ALTITUDE_WAIT to AutoMode:: to match nav_delay() 2024-05-02 10:16:00 -07:00
Iampete1
2ee5cdd792 Plane: Quadplane: move Q Assist check into new VTOL assist files. 2024-04-23 09:11:34 +10:00
Peter Barker
c6d5bf5706 ArduPlane: fold startup_ground back into caller
remove stale comments around same.

rename method to avoid confusion
2024-04-17 22:18:22 +10:00
Peter Barker
42ce0867ae ArduPlane: move handling of DO_SET_HOME up to GCS_MAVLink base class 2024-04-09 09:35:16 +10:00
Andrew Tridgell
a4109c6cf2 Plane: compile in AC_PrecLand for scripting 2024-03-06 09:39:51 +11:00
Peter Barker
fcd7c5beb9 ArduPlane: move logger object up to AP_Vehicle 2024-02-13 10:54:29 +11:00
Peter Barker
0bc2c15485 Plane: move AP_Stats to AP_vehicle 2024-01-30 11:12:21 +11:00
Henry Wurzburg
3973c28f15 Plane:add TKOFF_TIMEOUT to MODE TAKEOFF 2024-01-30 11:02:53 +11:00
Andrew Tridgell
17d6192e22 ArduPlane: convert LIM_PITCH_MIN/MAX -> PTCH_LIM_MIN/MAX_DEG 2024-01-23 15:00:30 +11:00
Peter Barker
6ee5ab41fd ArduPlane: allow compilation with HAL_LOGGING_ENABLED false 2024-01-17 18:25:55 +11:00
Iampete1
01c8717308 Plane: ask flight mode if min/max throttle limits should be applied 2024-01-16 11:07:53 +11:00
Iampete1
ab0755d0d8 Plane: rework forward throttle votlage compensation into sub class and split min/max from throttle 2023-12-20 19:28:47 +11:00
Ryan Friedman
2e393bbbc6 ArduPlane: Make set position tgt depend on ext ctrl
* Set position target used to just be used in scripting, now it's used
  by DDS in external control

Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
2023-12-20 02:37:01 +00:00
Ryan Friedman
003c50a13c ArduPlane: add REP-147 Global Position Control
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
2023-12-20 02:37:01 +00:00
Iampete1
21a9f8e3a2 Plane: move landing servo override out of throttle control function 2023-12-12 11:51:33 +11:00
Tom Pittenger
b468af81ac Plane: wrap Watt Limiiter in #if AP_BATTERY_WATT_MAX_ENABLED 2023-11-26 11:57:14 +11:00
Iampete1
8061b1b4c2 Plane: move set_servos_idle functionality to ModeAuto 2023-10-31 14:06:22 +11:00
Iampete1
7e4b5b0c97 Plane: rework set_servos_controlled function 2023-10-31 11:18:19 +11:00