Removes the comment claiming save_trim is a method on RC_Channels, moves
the auto-trim description from auto_cancel to auto_run which it
describes, and drops the extra indentation level auto_start and auto_run
carried over from their previous nesting.
Whitespace and comments only.
d56e91bbe2 converted mode_poshold to metres and radians, changing
vel_right_cms/vel_fw_cms to vel_right_ms/vel_fw_ms at both sites which
compare them against POSHOLD_SPEED_0, but left the constant at 10. The
threshold silently went from 10cm/s to 10m/s.
That constant guards a shortcut which truncates the remaining braking
time to 0.5s once the vehicle has essentially stopped. At 10m/s it is
true at any speed a copter reaches in PosHold, so braking is always cut
short and PosHold hands over to loiter while still travelling.
AC_Loiter::init_target_m() sets the loiter target to the position at
handover, so the vehicle overshoots that target and then flies backwards
to reach it.
Rename to POSHOLD_SPEED_0_MS to match POSHOLD_WIND_COMP_ESTIMATE_SPEED_MAX_MS,
which the same commit did rescale and rename.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Replaces Copter's built-in ground-effect detection with the
AP_GroundEffect library and wires its AC_PosControl and per-cycle
vehicle state.
A stored GND_EFFECT_COMP=0 is migrated to GNDEFF_ALT=-1; the enabled
default needs no migration.
With the default GNDEFF_ALT of 0.5m touchdown_expected now also
requires the vehicle to be near the ground (within 0.5m of the takeoff
height, and within 20m horizontally of the launch point when no
rangefinder is available), where the old code asserted it for any slow
descent at any height. GNDEFF_ALT=0 restores the old behaviour.
Rewrote a stored RCn_OPTION of ARMDISARM_UNUSED (41) to
ARMDISARM_AIRMODE (154). Added Sep-2021 and present in Copter-4.2.0, so
anybody moving from 4.3.0 or later has already had it applied.
A stored 41 which survives becomes an unhandled auxiliary function and
does nothing, which is the same outcome as any other option number this
firmware does not know.
All of these conversions are present in the Copter-4.3.0 tag, so anybody
running 4.3.0 or later has already had them applied:
- PSC_NE_VEL_FLTE (Aug-2021)
- ACRO_RP_RATE/ACRO_Y_RATE replacing ACRO_RP_P/ACRO_Y_P (Sep-2021)
- INS_HNTC2 from the old fixed notch (Apr-2022)
- FENCE_ parameters into the AC_Fence object (Mar-2022)
- the rate and expo command model parameters (Jun-2022)
- PRX to PRX1_ (Aug-2022)
Past this a user moving from a version of ArduCopter earlier than 4.3.0
will not have these parameters converted.
These are all "PARAMETER_CONVERSION - Added: <Mon>-<Year> for <Release>"
now, so that a grep for conversion vintages finds them and can parse the
date.
Also annotates the ARMDISARM_UNUSED to ARMDISARM_AIRMODE rewrite of
stored RCn_OPTION values, which had no annotation at all: it calls
set_and_save() directly rather than going through an AP_Param::convert_*
helper, so an audit anchored on those helpers did not see it.
Established by content rather than by date: absent from Copter-4.1.0 and
present in Copter-4.2.0. No functional change.
Co-authored-by: Iampete1 <iampete@hotmail.co.uk>
Replaces update_simple_mode with apply_simple_mode function that takes roll and pitch input arguments. The rotation is now done within the various get-pilot-desired-xxx methods removing the need for each flight mode to call update_simple_mode and also removing the slightly ugly call to overwrite RC_Channels' control inputs from the flight code (e.g. no more calls to set_control_in)
Arming with the ARMDISARM_AIRMODE switch sets ap.armed_with_airmode_switch,
but only Copter::set_throttle_zero_flag() consulted it. The throttle mix and
the land detector tested air_mode == AIRMODE_ENABLED instead, so a vehicle
armed with the air-mode arming switch fell back to ATC_THR_MIX_MIN at zero
throttle (little attitude authority) and used the 1s land-detector trigger
rather than the air-mode 3s trigger.
Add Copter::air_mode_active() and use it in all three places.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copter's one and only AP_Mission object is a member of ModeAuto, so
compiling ModeAuto out leaves AP::mission() with nothing to return while
the rest of the codebase still believes mission support is present.
Default MODE_AUTO_ENABLED to AP_MISSION_ENABLED so that disabling
mission support removes AUTO mode too, and reject the two inconsistent
combinations at compile time.
class ModeAuto was declared unconditionally even though only its
instantiation was guarded, so its AP_Mission and
AP_Mission_ChangeDetector members failed to compile with mission support
disabled. Guard the class, and the two aux-function switch entries
whose RC_Channel::AUX_FUNC enumerators are themselves gated on
AP_MISSION_ENABLED.
GCS_MAVLINK_Copter::mission_state() exists only to report the paused
state of AUTO mode, and dereferences copter.mode_auto - but that member
is compiled out when MODE_AUTO_ENABLED is 0, so the build failed.
Guard the override so we fall back to the GCS_MAVLINK base
implementation when AUTO mode is not compiled in.
Moves off the Vector3f-returning wind_estimate() method. Copter uses
the success of airspeed_vector_TAS() to decide whether it has a usable
wind estimate; that is left alone here, so no functional change.
... by accumulating height weights into float rather than uint8_t
these weights are all likely to be very low, so the "ends up at zero" case is likely to always be taken.
- min_flow_change is 0.04
- the value is in radians/second
I have an inkling this might originally have been "i" - i.e. accumulate across the three axes and then divide by the number of axes included in delta_height_m - but the code was subsequently changed to be include the abs_weight instead but the type was missed.
The beacon object now lives in AP_Vehicle; remove it from g2 and convert the stored BCN parameters across from the old g2 location.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>