Skip to content

Commit b233eb6

Browse files
Merge pull request #5988 from dragnea/dragnea_autolaunch_refactor
Autolaunch - Added a smooth end launch feature and code refactor
2 parents 7fd3f18 + 6d1a7f0 commit b233eb6

File tree

8 files changed

+355
-148
lines changed

8 files changed

+355
-148
lines changed

docs/Cli.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,4 @@ For targets that have a flash data chip, typically used for blackbox logs, the f
145145
| `flash_write <address> <data>` | Writes `data` to `address` |
146146

147147
## CLI Variable Reference
148-
149148
See [Settings.md](Settings.md).

docs/Settings.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@
264264
| nav_fw_launch_min_time | 0 | Allow launch mode to execute at least this time (ms) and ignore stick movements [0-60000]. |
265265
| nav_fw_launch_motor_delay | 500 | Delay between detected launch and launch sequence start and throttling up (ms) |
266266
| nav_fw_launch_spinup_time | 100 | Time to bring power from minimum throttle to nav_fw_launch_thr - to avoid big stress on ESC and large torque from propeller |
267+
| nav_fw_launch_end_time | 3000 | Time for the transition of throttle and pitch angle, between the launch state and the subsequent flight mode [ms] |
267268
| nav_fw_launch_thr | 1700 | Launch throttle - throttle to be set during launch sequence (pwm units) |
268269
| nav_fw_launch_timeout | 5000 | Maximum time for launch sequence to be executed. After this time LAUNCH mode will be turned off and regular flight mode will take over (ms) |
269270
| nav_fw_launch_velocity | 300 | Forward velocity threshold for swing-launch detection [cm/s] |

src/main/cms/cms_menu_navigation.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ static const OSD_Entry cmsx_menuFWLaunchEntries[] =
132132
OSD_SETTING_ENTRY("IDLE THROTTLE", SETTING_NAV_FW_LAUNCH_IDLE_THR),
133133
OSD_SETTING_ENTRY("MOTOR SPINUP TIME", SETTING_NAV_FW_LAUNCH_SPINUP_TIME),
134134
OSD_SETTING_ENTRY("TIMEOUT", SETTING_NAV_FW_LAUNCH_TIMEOUT),
135+
OSD_SETTING_ENTRY("END TRANSITION TIME", SETTING_NAV_FW_LAUNCH_END_TIME),
135136
OSD_SETTING_ENTRY("MAX ALTITUDE", SETTING_NAV_FW_LAUNCH_MAX_ALTITUDE),
136137
OSD_SETTING_ENTRY("CLIMB ANGLE", SETTING_NAV_FW_LAUNCH_CLIMB_ANGLE),
137138
OSD_SETTING_ENTRY("MAX BANK ANGLE", SETTING_NAV_FW_LAUNCH_MAX_ANGLE),

src/main/fc/settings.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,6 +2359,12 @@ groups:
23592359
field: fw.launch_motor_spinup_time
23602360
min: 0
23612361
max: 1000
2362+
- name: nav_fw_launch_end_time
2363+
description: "Time for the transition of throttle and pitch angle, between the launch state and the subsequent flight mode [ms]"
2364+
default_value: "2000"
2365+
field: fw.launch_end_time
2366+
min: 0
2367+
max: 5000
23622368
- name: nav_fw_launch_min_time
23632369
description: "Allow launch mode to execute at least this time (ms) and ignore stick movements [0-60000]."
23642370
default_value: "0"

src/main/io/osd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3328,6 +3328,10 @@ textAttributes_t osdGetSystemMessage(char *buff, size_t buff_size, bool isCenter
33283328
}
33293329
} else if (STATE(FIXED_WING_LEGACY) && (navGetCurrentStateFlags() & NAV_CTL_LAUNCH)) {
33303330
messages[messageCount++] = OSD_MESSAGE_STR(OSD_MSG_AUTOLAUNCH);
3331+
const char *launchStateMessage = fixedWingLaunchStateMessage();
3332+
if (launchStateMessage) {
3333+
messages[messageCount++] = launchStateMessage;
3334+
}
33313335
} else {
33323336
if (FLIGHT_MODE(NAV_ALTHOLD_MODE) && !navigationRequiresAngleMode()) {
33333337
// ALTHOLD might be enabled alongside ANGLE/HORIZON/ACRO

src/main/navigation/navigation.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig,
169169
.launch_idle_throttle = 1000, // Motor idle or MOTOR_STOP
170170
.launch_motor_timer = 500, // ms
171171
.launch_motor_spinup_time = 100, // ms, time to gredually increase throttle from idle to launch
172+
.launch_end_time = 3000, // ms, time to gradually decrease/increase throttle and decrease pitch angle from launch to the current flight mode
172173
.launch_min_time = 0, // ms, min time in launch mode
173174
.launch_timeout = 5000, // ms, timeout for launch procedure
174175
.launch_max_altitude = 0, // cm, altitude where to consider launch ended

src/main/navigation/navigation.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ typedef struct navConfig_s {
237237
uint16_t launch_throttle; // Launch throttle
238238
uint16_t launch_motor_timer; // Time to wait before setting launch_throttle (ms)
239239
uint16_t launch_motor_spinup_time; // Time to speed-up motors from idle to launch_throttle (ESC desync prevention)
240-
uint16_t launch_min_time; // Minimum time in launch mode to prevent possible bump of the sticks from leaving launch mode early
240+
uint16_t launch_end_time; // Time to make the transition from launch angle to leveled and throttle transition from launch throttle to the stick position
241+
uint16_t launch_min_time; // Minimum time in launch mode to prevent possible bump of the sticks from leaving launch mode early
241242
uint16_t launch_timeout; // Launch timeout to disable launch mode and swith to normal flight (ms)
242243
uint16_t launch_max_altitude; // cm, altitude where to consider launch ended
243244
uint8_t launch_climb_angle; // Target climb angle for launch (deg)
@@ -522,6 +523,7 @@ bool navigationRTHAllowsLanding(void);
522523
bool isNavLaunchEnabled(void);
523524
bool isFixedWingLaunchDetected(void);
524525
bool isFixedWingLaunchFinishedOrAborted(void);
526+
const char * fixedWingLaunchStateMessage(void);
525527

526528
float calculateAverageSpeed(void);
527529

0 commit comments

Comments
 (0)