Skip to content

Commit 230b971

Browse files
authored
Merge branch 'master' into AET-H743-Basic
2 parents 40ecf80 + be5c68d commit 230b971

File tree

134 files changed

+10585
-3073
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+10585
-3073
lines changed

.github/workflows/cygwin_build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ jobs:
188188
shell: C:\cygwin\bin\bash.exe -eo pipefail '{0}'
189189
run: >-
190190
ln -sf /usr/bin/python3.7 /usr/bin/python && ln -sf /usr/bin/pip3.7 /usr/bin/pip &&
191-
python -m pip install --progress-bar off empy==3.3.4 pexpect &&
192-
python -m pip install --progress-bar off dronecan --upgrade &&
191+
python3 -m pip install --progress-bar off empy==3.3.4 pexpect &&
192+
python3 -m pip install --progress-bar off dronecan --upgrade &&
193193
cp /usr/bin/ccache /usr/local/bin/ &&
194194
cd /usr/local/bin && ln -s ccache /usr/local/bin/gcc &&
195195
ln -s ccache /usr/local/bin/g++ &&

.github/workflows/esp32_build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ jobs:
178178
sudo apt-get install git wget libncurses-dev flex bison gperf python3 python3-pip python3-venv python3-setuptools python3-serial python3-gevent python3-cryptography python3-future python3-pyparsing python3-pyelftools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
179179
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
180180
update-alternatives --query python
181-
python --version
181+
python3 --version
182182
pip3 install gevent
183183
184184
# we actualy want 3.11 .. but the above only gave us 3.10, not ok with esp32 builds.
@@ -188,7 +188,7 @@ jobs:
188188
sudo apt-get install python3 python3-pip python3-venv python3-setuptools python3-serial python3-cryptography python3-future python3-pyparsing python3-pyelftools
189189
update-alternatives --query python
190190
pip3 install gevent
191-
python --version
191+
python3 --version
192192
python3.11 --version
193193
which python3.11
194194
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.11 11
@@ -229,7 +229,7 @@ jobs:
229229
./install.sh
230230
source ./export.sh
231231
cd ../..
232-
python -m pip install --progress-bar off future lxml pymavlink MAVProxy pexpect flake8 geocoder empy==3.3.4 dronecan
232+
python3 -m pip install --progress-bar off future lxml pymavlink MAVProxy pexpect flake8 geocoder empy==3.3.4 dronecan
233233
which cmake
234234
./waf configure --board ${{matrix.config}}
235235
echo './waf configure --board ${{matrix.config}}' >> $GITHUB_STEP_SUMMARY

.github/workflows/qurt_build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ jobs:
157157
cp -a build/QURT/bin/arducopter build/QURT/ArduPilot_Copter.so
158158
cp -a build/QURT/bin/arduplane build/QURT/ArduPilot_Plane.so
159159
cp -a build/QURT/bin/ardurover build/QURT/ArduPilot_Rover.so
160+
libraries/AP_HAL_QURT/packaging/make_package.sh ArduCopter arducopter
161+
libraries/AP_HAL_QURT/packaging/make_package.sh ArduPlane arduplane
162+
libraries/AP_HAL_QURT/packaging/make_package.sh Rover ardurover
160163
161164
- name: Archive build
162165
uses: actions/upload-artifact@v4
@@ -168,4 +171,5 @@ jobs:
168171
build/QURT/ArduPilot_Plane.so
169172
build/QURT/ArduPilot_Rover.so
170173
build/QURT/ArduPilot.so
174+
libraries/AP_HAL_QURT/packaging/*.deb
171175
retention-days: 7

AntennaTracker/ReleaseNotes.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
Antenna Tracker Release Notes:
22
------------------------------------------------------------------
3+
Release 4.5.7 08 Oct 2024
4+
5+
Changes from 4.5.7-beta1
6+
7+
1) Reverted Septentrio GPS sat count correctly drops to zero when 255 received
8+
------------------------------------------------------------------
39
Release 4.5.7-beta1 26 Sep 2024
410

511
Changes from 4.5.6

ArduCopter/Copter.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ class Copter : public AP_Vehicle {
390390
// This is the state of the flight control system
391391
// There are multiple states defined such as STABILIZE, ACRO,
392392
Mode *flightmode;
393-
Mode::Number prev_control_mode;
394393

395394
RCMapper rcmap;
396395

ArduCopter/ReleaseNotes.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
ArduPilot Copter Release Notes:
22
------------------------------------------------------------------
3+
Release 4.5.7 08 Oct 2024
4+
5+
Changes from 4.5.7-beta1
6+
7+
1) Reverted Septentrio GPS sat count correctly drops to zero when 255 received
8+
------------------------------------------------------------------
39
Release 4.5.7-beta1 26 Sep 2024
410

511
Changes from 4.5.6

ArduCopter/heli.cpp

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -189,29 +189,25 @@ void Copter::heli_update_rotor_speed_targets()
189189
// to autorotation flight mode if manual collective is not being used.
190190
void Copter::heli_update_autorotation()
191191
{
192-
// check if flying and interlock disengaged
193-
if (!ap.land_complete && !motors->get_interlock()) {
192+
bool in_autorotation_mode = false;
194193
#if MODE_AUTOROTATE_ENABLED
195-
if (g2.arot.is_enable()) {
196-
if (!flightmode->has_manual_throttle()) {
197-
// set autonomous autorotation flight mode
198-
set_mode(Mode::Number::AUTOROTATE, ModeReason::AUTOROTATION_START);
199-
}
200-
// set flag to facilitate both auto and manual autorotations
201-
motors->set_in_autorotation(true);
202-
motors->set_enable_bailout(true);
203-
}
194+
in_autorotation_mode = flightmode == &mode_autorotate;
204195
#endif
205-
if (flightmode->has_manual_throttle() && motors->arot_man_enabled()) {
206-
// set flag to facilitate both auto and manual autorotations
207-
motors->set_in_autorotation(true);
208-
motors->set_enable_bailout(true);
209-
}
210-
} else {
211-
motors->set_in_autorotation(false);
212-
motors->set_enable_bailout(false);
196+
197+
// If we have landed then we do not want to be in autorotation and we do not want to via the bailout state
198+
if (ap.land_complete || ap.land_complete_maybe) {
199+
motors->force_deactivate_autorotation();
200+
return;
213201
}
214202

203+
// if we got this far we are flying, check for conditions to set autorotation state
204+
if (!motors->get_interlock() && (flightmode->has_manual_throttle() || in_autorotation_mode)) {
205+
// set state in motors to facilitate manual and assisted autorotations
206+
motors->set_autorotation_active(true);
207+
} else {
208+
// deactivate the autorotation state via the bailout case
209+
motors->set_autorotation_active(false);
210+
}
215211
}
216212

217213
// update collective low flag. Use a debounce time of 400 milliseconds.

ArduCopter/mode.cpp

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -292,20 +292,9 @@ bool Copter::set_mode(Mode::Number mode, ModeReason reason)
292292
#if FRAME_CONFIG == HELI_FRAME
293293
// do not allow helis to enter a non-manual throttle mode if the
294294
// rotor runup is not complete
295-
if (!ignore_checks && !new_flightmode->has_manual_throttle() &&
296-
(motors->get_spool_state() == AP_Motors::SpoolState::SPOOLING_UP || motors->get_spool_state() == AP_Motors::SpoolState::SPOOLING_DOWN)) {
297-
#if MODE_AUTOROTATE_ENABLED
298-
//if the mode being exited is the autorotation mode allow mode change despite rotor not being at
299-
//full speed. This will reduce altitude loss on bail-outs back to non-manual throttle modes
300-
bool in_autorotation_check = (flightmode != &mode_autorotate || new_flightmode != &mode_autorotate);
301-
#else
302-
bool in_autorotation_check = false;
303-
#endif
304-
305-
if (!in_autorotation_check) {
306-
mode_change_failed(new_flightmode, "runup not complete");
307-
return false;
308-
}
295+
if (!ignore_checks && !new_flightmode->has_manual_throttle() && !motors->rotor_runup_complete()) {
296+
mode_change_failed(new_flightmode, "runup not complete");
297+
return false;
309298
}
310299
#endif
311300

@@ -369,9 +358,6 @@ bool Copter::set_mode(Mode::Number mode, ModeReason reason)
369358
// perform any cleanup required by previous flight mode
370359
exit_mode(flightmode, new_flightmode);
371360

372-
// store previous flight mode (only used by tradeheli's autorotation)
373-
prev_control_mode = flightmode->mode_number();
374-
375361
// update flight mode
376362
flightmode = new_flightmode;
377363
control_mode_reason = reason;

ArduCopter/mode.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,18 +2015,14 @@ class ModeAutorotate : public Mode {
20152015
int32_t _pitch_target; // Target pitch attitude to pass to attitude controller
20162016
uint32_t _entry_time_start_ms; // Time remaining until entry phase moves on to glide phase
20172017
float _hs_decay; // The head accerleration during the entry phase
2018-
float _bail_time; // Timer for exiting the bail out phase (s)
2019-
uint32_t _bail_time_start_ms; // Time at start of bail out
2020-
float _target_climb_rate_adjust;// Target vertical acceleration used during bail out phase
2021-
float _target_pitch_adjust; // Target pitch rate used during bail out phase
20222018

20232019
enum class Autorotation_Phase {
20242020
ENTRY,
20252021
SS_GLIDE,
20262022
FLARE,
20272023
TOUCH_DOWN,
2028-
BAIL_OUT } phase_switch;
2029-
2024+
LANDED } phase_switch;
2025+
20302026
enum class Navigation_Decision {
20312027
USER_CONTROL_STABILISED,
20322028
STRAIGHT_AHEAD,
@@ -2039,10 +2035,10 @@ class ModeAutorotate : public Mode {
20392035
bool ss_glide_initial : 1;
20402036
bool flare_initial : 1;
20412037
bool touch_down_initial : 1;
2038+
bool landed_initial : 1;
20422039
bool straight_ahead_initial : 1;
20432040
bool level_initial : 1;
20442041
bool break_initial : 1;
2045-
bool bail_out_initial : 1;
20462042
bool bad_rpm : 1;
20472043
} _flags;
20482044

ArduCopter/mode_autorotate.cpp

Lines changed: 27 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#if MODE_AUTOROTATE_ENABLED
1515

1616
#define AUTOROTATE_ENTRY_TIME 2.0f // (s) number of seconds that the entry phase operates for
17-
#define BAILOUT_MOTOR_RAMP_TIME 1.0f // (s) time set on bailout ramp up timer for motors - See AC_MotorsHeli_Single
1817
#define HEAD_SPEED_TARGET_RATIO 1.0f // Normalised target main rotor head speed (unit: -)
18+
#define AUTOROTATION_MIN_MOVING_SPEED 100.0 // (cm/s) minimum speed used for "is moving" check
1919

2020
bool ModeAutorotate::init(bool ignore_checks)
2121
{
@@ -24,15 +24,16 @@ bool ModeAutorotate::init(bool ignore_checks)
2424
return false;
2525
#endif
2626

27-
// Check that mode is enabled
27+
// Check that mode is enabled, make sure this is the first check as this is the most
28+
// important thing for users to fix if they are planning to use autorotation mode
2829
if (!g2.arot.is_enable()) {
29-
gcs().send_text(MAV_SEVERITY_INFO, "Autorot Mode Not Enabled");
30+
gcs().send_text(MAV_SEVERITY_WARNING, "Autorot Mode Not Enabled");
3031
return false;
3132
}
3233

33-
// Check that interlock is disengaged
34-
if (motors->get_interlock()) {
35-
gcs().send_text(MAV_SEVERITY_INFO, "Autorot Mode Change Fail: Interlock Engaged");
34+
// Must be armed to use mode, prevent triggering state machine on the ground
35+
if (!motors->armed() || copter.ap.land_complete || copter.ap.land_complete_maybe) {
36+
gcs().send_text(MAV_SEVERITY_WARNING, "Autorot: Must be Armed and Flying");
3637
return false;
3738
}
3839

@@ -52,10 +53,10 @@ bool ModeAutorotate::init(bool ignore_checks)
5253
_flags.ss_glide_initial = true;
5354
_flags.flare_initial = true;
5455
_flags.touch_down_initial = true;
56+
_flags.landed_initial = true;
5557
_flags.level_initial = true;
5658
_flags.break_initial = true;
5759
_flags.straight_ahead_initial = true;
58-
_flags.bail_out_initial = true;
5960
_msg_flags.bad_rpm = true;
6061

6162
// Setting default starting switches
@@ -74,20 +75,9 @@ bool ModeAutorotate::init(bool ignore_checks)
7475

7576
void ModeAutorotate::run()
7677
{
77-
// Check if interlock becomes engaged
78-
if (motors->get_interlock() && !copter.ap.land_complete) {
79-
phase_switch = Autorotation_Phase::BAIL_OUT;
80-
} else if (motors->get_interlock() && copter.ap.land_complete) {
81-
// Aircraft is landed and no need to bail out
82-
set_mode(copter.prev_control_mode, ModeReason::AUTOROTATION_BAILOUT);
83-
}
84-
8578
// Current time
8679
uint32_t now = millis(); //milliseconds
8780

88-
// Initialise internal variables
89-
float curr_vel_z = inertial_nav.get_velocity_z_up_cms(); // Current vertical descent
90-
9181
//----------------------------------------------------------------
9282
// State machine logic
9383
//----------------------------------------------------------------
@@ -97,12 +87,22 @@ void ModeAutorotate::run()
9787

9888
// Timer from entry phase to progress to glide phase
9989
if (phase_switch == Autorotation_Phase::ENTRY){
100-
10190
if ((now - _entry_time_start_ms)/1000.0f > AUTOROTATE_ENTRY_TIME) {
10291
// Flight phase can be progressed to steady state glide
10392
phase_switch = Autorotation_Phase::SS_GLIDE;
10493
}
94+
}
95+
96+
// Check if we believe we have landed. We need the landed state to zero all controls and make sure that the copter landing detector will trip
97+
bool speed_check = inertial_nav.get_velocity_z_up_cms() < AUTOROTATION_MIN_MOVING_SPEED &&
98+
inertial_nav.get_speed_xy_cms() < AUTOROTATION_MIN_MOVING_SPEED;
99+
if (motors->get_below_land_min_coll() && AP::ins().is_still() && speed_check) {
100+
phase_switch = Autorotation_Phase::LANDED;
101+
}
105102

103+
// Check if we are bailing out and need to re-set the spool state
104+
if (motors->autorotation_bailout()) {
105+
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);
106106
}
107107

108108

@@ -199,79 +199,22 @@ void ModeAutorotate::run()
199199
{
200200
break;
201201
}
202-
203-
case Autorotation_Phase::BAIL_OUT:
202+
case Autorotation_Phase::LANDED:
204203
{
205-
if (_flags.bail_out_initial == true) {
206-
// Functions and settings to be done once are done here.
204+
// Entry phase functions to be run only once
205+
if (_flags.landed_initial == true) {
207206

208207
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
209-
gcs().send_text(MAV_SEVERITY_INFO, "Bailing Out of Autorotation");
208+
gcs().send_text(MAV_SEVERITY_INFO, "Landed");
210209
#endif
211-
212-
// Set bail out timer remaining equal to the parameter value, bailout time
213-
// cannot be less than the motor spool-up time: BAILOUT_MOTOR_RAMP_TIME.
214-
_bail_time = MAX(g2.arot.get_bail_time(),BAILOUT_MOTOR_RAMP_TIME+0.1f);
215-
216-
// Set bail out start time
217-
_bail_time_start_ms = now;
218-
219-
// Set initial target vertical speed
220-
_desired_v_z = curr_vel_z;
221-
222-
// Initialise position and desired velocity
223-
if (!pos_control->is_active_z()) {
224-
pos_control->relax_z_controller(g2.arot.get_last_collective());
225-
}
226-
227-
// Get pilot parameter limits
228-
const float pilot_spd_dn = -get_pilot_speed_dn();
229-
const float pilot_spd_up = g.pilot_speed_up;
230-
231-
float pilot_des_v_z = get_pilot_desired_climb_rate(channel_throttle->get_control_in());
232-
pilot_des_v_z = constrain_float(pilot_des_v_z, pilot_spd_dn, pilot_spd_up);
233-
234-
// Calculate target climb rate adjustment to transition from bail out descent speed to requested climb rate on stick.
235-
_target_climb_rate_adjust = (curr_vel_z - pilot_des_v_z)/(_bail_time - BAILOUT_MOTOR_RAMP_TIME); //accounting for 0.5s motor spool time
236-
237-
// Calculate pitch target adjustment rate to return to level
238-
_target_pitch_adjust = _pitch_target/_bail_time;
239-
240-
// set vertical speed and acceleration limits
241-
pos_control->set_max_speed_accel_z(curr_vel_z, pilot_spd_up, fabsf(_target_climb_rate_adjust));
242-
pos_control->set_correction_speed_accel_z(curr_vel_z, pilot_spd_up, fabsf(_target_climb_rate_adjust));
243-
244-
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);
245-
246-
_flags.bail_out_initial = false;
210+
_flags.landed_initial = false;
247211
}
248-
249-
if ((now - _bail_time_start_ms)/1000.0f >= BAILOUT_MOTOR_RAMP_TIME) {
250-
// Update desired vertical speed and pitch target after the bailout motor ramp timer has completed
251-
_desired_v_z -= _target_climb_rate_adjust*G_Dt;
252-
_pitch_target -= _target_pitch_adjust*G_Dt;
253-
}
254-
// Set position controller
255-
pos_control->set_pos_target_z_from_climb_rate_cm(_desired_v_z);
256-
257-
// Update controllers
258-
pos_control->update_z_controller();
259-
260-
if ((now - _bail_time_start_ms)/1000.0f >= _bail_time) {
261-
// Bail out timer complete. Change flight mode. Do not revert back to auto. Prevent aircraft
262-
// from continuing mission and potentially flying further away after a power failure.
263-
if (copter.prev_control_mode == Mode::Number::AUTO) {
264-
set_mode(Mode::Number::ALT_HOLD, ModeReason::AUTOROTATION_BAILOUT);
265-
} else {
266-
set_mode(copter.prev_control_mode, ModeReason::AUTOROTATION_BAILOUT);
267-
}
268-
}
269-
270-
break;
212+
// don't allow controller to continually ask for more pitch to build speed when we are on the ground, decay to zero smoothly
213+
_pitch_target *= 0.95;
214+
break;
271215
}
272216
}
273217

274-
275218
switch (nav_pos_switch) {
276219

277220
case Navigation_Decision::USER_CONTROL_STABILISED:

0 commit comments

Comments
 (0)