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

Rover: Allow fractional RTL_SPEEDs #27002

Merged
merged 2 commits into from
May 7, 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
2 changes: 1 addition & 1 deletion Rover/mode_rtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ bool ModeRTL::_enter()
}

// initialise waypoint navigation library
g2.wp_nav.init(MAX(0, g2.rtl_speed));
g2.wp_nav.init(MAX(0.0f, g2.rtl_speed));

// set target to the closest rally point or home
#if HAL_RALLY_ENABLED
Expand Down
22 changes: 22 additions & 0 deletions Tools/autotest/rover.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,27 @@ def DriveRTL(self, timeout=120):
self.disarm_vehicle()
self.progress("RTL Mission OK (%fm)" % home_distance)

def RTL_SPEED(self, timeout=120):
'''Test RTL_SPEED is honoured'''

self.upload_simple_relhome_mission([
(mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 300, 0, 0),
(mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 1000, 0, 0),
])

self.wait_ready_to_arm()
self.arm_vehicle()

self.change_mode('AUTO')
self.wait_current_waypoint(2, timeout=120)
for speed in 1, 5.5, 1.5, 7.5:
self.set_parameter("RTL_SPEED", speed)
self.change_mode('RTL')
self.wait_groundspeed(speed-0.1, speed+0.1, minimum_duration=10)
self.change_mode('HOLD')
self.do_RTL()
self.disarm_vehicle()

def AC_Avoidance(self):
'''Test AC Avoidance switch'''
self.context_push()
Expand Down Expand Up @@ -6814,6 +6835,7 @@ def tests(self):
self.MAV_CMD_BATTERY_RESET,
self.NetworkingWebServer,
self.NetworkingWebServerPPP,
self.RTL_SPEED,
])
return ret

Expand Down
Loading