1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-13 19:40:27 +03:00

Automatically load waypoints

This commit is contained in:
Tony Yeung 2021-02-16 15:15:54 +00:00
parent 02b3cc907d
commit 6da3858d5b
5 changed files with 20 additions and 1 deletions

View file

@ -34,7 +34,7 @@ The stick positions are combined to activate different functions:
| Trim Acc Forwards | HIGH | CENTER | HIGH | CENTER | | Trim Acc Forwards | HIGH | CENTER | HIGH | CENTER |
| Trim Acc Backwards | HIGH | CENTER | LOW | CENTER | | Trim Acc Backwards | HIGH | CENTER | LOW | CENTER |
| Save current waypoint mission | LOW | CENTER | HIGH | LOW | | Save current waypoint mission | LOW | CENTER | HIGH | LOW |
| Load current waypoint mission | LOW | CENTER | HIGH | HIGH | | Load/unload current waypoint mission | LOW | CENTER | HIGH | HIGH |
| Save setting | LOW | LOW | LOW | HIGH | | Save setting | LOW | LOW | LOW | HIGH |
| Enter OSD Menu (CMS) | CENTER | LOW | HIGH | CENTER | | Enter OSD Menu (CMS) | CENTER | LOW | HIGH | CENTER |

View file

@ -342,6 +342,7 @@
| nav_use_fw_yaw_control | OFF | Enables or Disables the use of the heading PID controller on fixed wing. Heading PID controller is always enabled for rovers and boats | | nav_use_fw_yaw_control | OFF | Enables or Disables the use of the heading PID controller on fixed wing. Heading PID controller is always enabled for rovers and boats |
| nav_use_midthr_for_althold | OFF | If set to OFF, the FC remembers your throttle stick position when enabling ALTHOLD and treats it as a neutral midpoint for holding altitude | | nav_use_midthr_for_althold | OFF | If set to OFF, the FC remembers your throttle stick position when enabling ALTHOLD and treats it as a neutral midpoint for holding altitude |
| nav_user_control_mode | ATTI | Defines how Pitch/Roll input from RC receiver affects flight in POSHOLD mode: ATTI - pitch/roll controls attitude like in ANGLE mode; CRUISE - pitch/roll controls velocity in forward and right direction. | | nav_user_control_mode | ATTI | Defines how Pitch/Roll input from RC receiver affects flight in POSHOLD mode: ATTI - pitch/roll controls attitude like in ANGLE mode; CRUISE - pitch/roll controls velocity in forward and right direction. |
| nav_wp_load_on_boot | OFF | If set to ON, waypoints will be automatically loaded from EEPROM to the FC during startup. |
| nav_wp_radius | 100 | Waypoint radius [cm]. Waypoint would be considered reached if machine is within this radius | | nav_wp_radius | 100 | Waypoint radius [cm]. Waypoint would be considered reached if machine is within this radius |
| nav_wp_safe_distance | 10000 | First waypoint in the mission should be closer than this value [cm]. A value of 0 disables this check. | | nav_wp_safe_distance | 10000 | First waypoint in the mission should be closer than this value [cm]. A value of 0 disables this check. |
| opflow_hardware | | Selection of OPFLOW hardware. | | opflow_hardware | | Selection of OPFLOW hardware. |

View file

@ -2072,6 +2072,11 @@ groups:
field: general.pos_failure_timeout field: general.pos_failure_timeout
min: 0 min: 0
max: 10 max: 10
- name: nav_wp_load_on_boot
description: "If set to ON, waypoints will be automatically loaded from EEPROM to the FC during startup."
default_value: "OFF"
field: general.waypoint_load_on_boot
type: bool
- name: nav_wp_radius - name: nav_wp_radius
description: "Waypoint radius [cm]. Waypoint would be considered reached if machine is within this radius" description: "Waypoint radius [cm]. Waypoint would be considered reached if machine is within this radius"
default_value: "100" default_value: "100"

View file

@ -113,6 +113,7 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig,
.pos_failure_timeout = 5, // 5 sec .pos_failure_timeout = 5, // 5 sec
.waypoint_radius = 100, // 2m diameter .waypoint_radius = 100, // 2m diameter
.waypoint_safe_distance = 10000, // centimeters - first waypoint should be closer than this .waypoint_safe_distance = 10000, // centimeters - first waypoint should be closer than this
.waypoint_load_on_boot = false, // load waypoints automatically during boot
.max_auto_speed = 300, // 3 m/s = 10.8 km/h .max_auto_speed = 300, // 3 m/s = 10.8 km/h
.max_auto_climb_rate = 500, // 5 m/s .max_auto_climb_rate = 500, // 5 m/s
.max_manual_speed = 500, .max_manual_speed = 500,
@ -2828,6 +2829,12 @@ bool loadNonVolatileWaypointList(void)
if (ARMING_FLAG(ARMED)) if (ARMING_FLAG(ARMED))
return false; return false;
// if waypoints are already loaded, just unload them.
if (posControl.waypointCount > 0) {
resetWaypointList();
return false;
}
resetWaypointList(); resetWaypointList();
for (int i = 0; i < NAV_MAX_WAYPOINTS; i++) { for (int i = 0; i < NAV_MAX_WAYPOINTS; i++) {
@ -3520,6 +3527,11 @@ void navigationInit(void)
} else { } else {
DISABLE_STATE(FW_HEADING_USE_YAW); DISABLE_STATE(FW_HEADING_USE_YAW);
} }
#if defined(NAV_NON_VOLATILE_WAYPOINT_STORAGE)
if (navConfig()->general.waypoint_load_on_boot)
loadNonVolatileWaypointList();
#endif
} }
/*----------------------------------------------------------- /*-----------------------------------------------------------

View file

@ -189,6 +189,7 @@ typedef struct navConfig_s {
uint8_t pos_failure_timeout; // Time to wait before switching to emergency landing (0 - disable) uint8_t pos_failure_timeout; // Time to wait before switching to emergency landing (0 - disable)
uint16_t waypoint_radius; // if we are within this distance to a waypoint then we consider it reached (distance is in cm) uint16_t waypoint_radius; // if we are within this distance to a waypoint then we consider it reached (distance is in cm)
uint16_t waypoint_safe_distance; // Waypoint mission sanity check distance uint16_t waypoint_safe_distance; // Waypoint mission sanity check distance
bool waypoint_load_on_boot; // load waypoints automatically during boot
uint16_t max_auto_speed; // autonomous navigation speed cm/sec uint16_t max_auto_speed; // autonomous navigation speed cm/sec
uint16_t max_auto_climb_rate; // max vertical speed limitation cm/sec uint16_t max_auto_climb_rate; // max vertical speed limitation cm/sec
uint16_t max_manual_speed; // manual velocity control max horizontal speed uint16_t max_manual_speed; // manual velocity control max horizontal speed