Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AC_WPNav: correct calculation of predict-accel when zeroing pilot desired accel #27450

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Tools/autotest/arducopter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11552,6 +11552,35 @@ def REQUIRE_POSITION_FOR_ARMING(self):
self.context_pop()
self.reboot_sitl()

def AutoContinueOnRCFailsafe(self):
'''check LOITER when entered after RC failsafe is ignored in auto'''
self.set_parameters({
"FS_OPTIONS": 1, # 1 is "RC continue if in auto"
})

self.upload_simple_relhome_mission([
# N E U
(mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0, 10),
(mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 20, 0, 10),
(mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 40, 0, 10),
(mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 60, 0, 10),
])

self.takeoff(mode='LOITER')
self.set_rc(1, 1200)
self.delay_sim_time(1) # build up some pilot desired stuff
self.change_mode('AUTO')
self.wait_waypoint(2, 2)
self.set_parameters({
'SIM_RC_FAIL': 1,
})
# self.set_rc(1, 1500) # note we are still in RC fail!
self.wait_waypoint(3, 3)
self.assert_mode_is('AUTO')
self.change_mode('LOITER')
self.wait_groundspeed(0, 0.1, minimum_duration=30, timeout=450)
self.do_RTL()

def tests2b(self): # this block currently around 9.5mins here
'''return list of all tests'''
ret = ([
Expand Down Expand Up @@ -11605,6 +11634,7 @@ def tests2b(self): # this block currently around 9.5mins here
self.WatchAlts,
self.GuidedEKFLaneChange,
self.Sprayer,
self.AutoContinueOnRCFailsafe,
self.EK3_RNG_USE_HGT,
self.TerrainDBPreArm,
self.ThrottleGainBoost,
Expand Down
4 changes: 3 additions & 1 deletion libraries/AC_WPNav/AC_Loiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ class AC_Loiter
Vector2f get_pilot_desired_acceleration() const { return Vector2f{_desired_accel.x, _desired_accel.y}; }

/// clear pilot desired acceleration
void clear_pilot_desired_acceleration() { _desired_accel.zero(); }
void clear_pilot_desired_acceleration() {
set_pilot_desired_acceleration(0, 0);
}

/// get vector to stopping point based on a horizontal position and velocity
void get_stopping_point_xy(Vector2f& stopping_point) const;
Expand Down
Loading