Skip to content

Commit

Permalink
Merge branch 'ArduPilot:master' into NarinFC-H7
Browse files Browse the repository at this point in the history
  • Loading branch information
vololand authored Jan 22, 2025
2 parents c21aa80 + d64cf3e commit 2399291
Show file tree
Hide file tree
Showing 29 changed files with 1,843 additions and 582 deletions.
49 changes: 49 additions & 0 deletions .vscode/launch.default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "AP_ST",
"cwd": "${workspaceFolder}",
"executable": "${config:wscript.elf_file_path}",
"liveWatch": {
"enabled": true,
"samplesPerSecond": 4
},
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"configFiles": [
"${workspaceFolder}/build/${config:wscript.board}/openocd.cfg"
]
},
{
"name": "AP_SITL",
"type": "cppdbg",
"request": "launch",
"program": "${config:wscript.elf_file_path}",
"args": [
"-S",
"--model",
"+",
"--speedup",
"1",
"--slave",
"0",
"--sim-address=127.0.0.1",
"-IO"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "${config:wscript.MIMode}",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
}
]
}
]
}
8 changes: 8 additions & 0 deletions ArduCopter/AP_Arming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ bool AP_Arming_Copter::run_pre_arm_checks(bool display_failure)
passed = false;
}

#if FRAME_CONFIG == HELI_FRAME && MODE_AUTOROTATE_ENABLED
// check on autorotation config
if (!copter.g2.arot.arming_checks(ARRAY_SIZE(failure_msg), failure_msg)) {
check_failed(display_failure, "AROT: %s", failure_msg);
passed = false;
}
#endif

// If not passed all checks return false
if (!passed) {
return false;
Expand Down
6 changes: 0 additions & 6 deletions ArduCopter/Copter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,12 +716,6 @@ void Copter::twentyfive_hz_logging()
AP::ins().Write_IMU();
}

#if MODE_AUTOROTATE_ENABLED
if (should_log(MASK_LOG_ATTITUDE_MED) || should_log(MASK_LOG_ATTITUDE_FAST)) {
//update autorotation log
g2.arot.Log_Write_Autorotation();
}
#endif
#if HAL_GYROFFT_ENABLED
if (should_log(MASK_LOG_FTN_FAST)) {
gyro_fft.write_log_messages();
Expand Down
4 changes: 4 additions & 0 deletions ArduCopter/Copter.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@
#error AP_OAPathPlanner relies on AP_FENCE_ENABLED which is disabled
#endif

#if MODE_AUTOROTATE_ENABLED && !AP_RPM_ENABLED
#error AC_Autorotation relies on AP_RPM_ENABLED which is disabled
#endif

#if HAL_ADSB_ENABLED
#include "avoidance_adsb.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion ArduCopter/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ ParametersG2::ParametersG2(void) :
,mode_systemid_ptr(&copter.mode_systemid)
#endif
#if MODE_AUTOROTATE_ENABLED
,arot()
,arot(copter.motors, copter.attitude_control)
#endif
#if MODE_ZIGZAG_ENABLED
,mode_zigzag_ptr(&copter.mode_zigzag)
Expand Down
49 changes: 12 additions & 37 deletions ArduCopter/mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -2033,46 +2033,21 @@ class ModeAutorotate : public Mode {

private:

// --- Internal variables ---
float _initial_rpm; // Head speed recorded at initiation of flight mode (RPM)
float _target_head_speed; // The terget head main rotor head speed. Normalised by main rotor set point
float _desired_v_z; // Desired vertical
int32_t _pitch_target; // Target pitch attitude to pass to attitude controller
uint32_t _entry_time_start_ms; // Time remaining until entry phase moves on to glide phase
float _hs_decay; // The head accerleration during the entry phase

enum class Autorotation_Phase {
uint32_t _entry_time_start_ms; // time remaining until entry phase moves on to glide phase
uint32_t _last_logged_ms; // used for timing slow rate autorotation log

enum class Phase {
ENTRY_INIT,
ENTRY,
SS_GLIDE,
GLIDE_INIT,
GLIDE,
FLARE_INIT,
FLARE,
TOUCH_DOWN_INIT,
TOUCH_DOWN,
LANDED } phase_switch;

enum class Navigation_Decision {
USER_CONTROL_STABILISED,
STRAIGHT_AHEAD,
INTO_WIND,
NEAREST_RALLY} nav_pos_switch;

// --- Internal flags ---
struct controller_flags {
bool entry_initial : 1;
bool ss_glide_initial : 1;
bool flare_initial : 1;
bool touch_down_initial : 1;
bool landed_initial : 1;
bool straight_ahead_initial : 1;
bool level_initial : 1;
bool break_initial : 1;
bool bad_rpm : 1;
} _flags;

struct message_flags {
bool bad_rpm : 1;
} _msg_flags;

//--- Internal functions ---
void warning_message(uint8_t message_n); //Handles output messages to the terminal
LANDED_INIT,
LANDED,
} current_phase;

};
#endif
Loading

0 comments on commit 2399291

Please sign in to comment.