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

autotest: Add catapult test #27125

Closed
wants to merge 1 commit into from
Closed
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
13 changes: 13 additions & 0 deletions Tools/autotest/ArduPlane_Tests/CatapultTakeoff/catapult.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
QGC WPL 110
0 0 0 16 0.000000 0.000000 0.000000 0.000000 -35.363262 149.165237 584.390015 1
1 0 3 22 15.000000 0.000000 0.000000 0.000000 -35.361279 149.164230 100.000000 1
2 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.361229 149.163025 100.000000 1
3 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.364563 149.163773 100.000000 1
4 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.364384 149.164795 80.000000 1
5 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.361027 149.164093 80.000000 1
6 0 0 177 2.000000 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1
7 0 3 189 0.000000 0.000000 0.000000 0.000000 -35.362915 149.162613 60.000000 1
8 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.363136 149.162750 60.000000 1
9 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.365467 149.164215 55.000000 1
10 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.365009 149.165482 39.889999 1
11 0 3 21 0.000000 0.000000 0.000000 1.000000 -35.363041 149.165222 0.000000 1
41 changes: 41 additions & 0 deletions Tools/autotest/arduplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -4160,6 +4160,45 @@ def LandingDrift(self):

self.wait_disarmed(timeout=180)

def CatapultTakeoff(self):
'''Test that a catapult takeoff works correctly'''

self.customise_SITL_commandline(
[],
model='plane-catapult',
defaults_filepath=self.model_defaults_filepath("plane")
)
self.set_parameters({
peterbarker marked this conversation as resolved.
Show resolved Hide resolved
"TKOFF_THR_MINACC": 3.0,
"TECS_PITCH_MAX": 35.0,
"PTCH_LIM_MAX_DEG": 35.0,
"RTL_AUTOLAND": 2, # The mission contains a DO_LAND_START item.
})

# Record desired target speed.
speed_cruise = self.get_parameter("AIRSPEED_CRUISE")

# Load and start mission.
self.load_mission("catapult.txt", strict=True)
self.change_mode('AUTO')

self.wait_ready_to_arm()
self.arm_vehicle()

# Throw the catapult.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Throw the catapult.
self.progress("Throw the catapult")

Many times when I've put a comment like this in I've found it useful to put it in as a progress text instead. Just a suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! For now it's pretty evident (perhaps even more useful) by plotting RCOU[7]. But I'll keep that in mind.

self.set_servo(7, 2000)

# Wait until we're midway through the climb.
test_alt = 50
self.wait_altitude(test_alt, test_alt+2, relative=True)

# Ensure that by then the aircraft does not overspeed.
self.wait_airspeed(speed_cruise-2, speed_cruise+2, minimum_duration=2, timeout=4)

# Wait for landing waypoint.
self.wait_current_waypoint(11, timeout=1200)
self.wait_disarmed(120)

def DCMFallback(self):
'''Really annoy the EKF and force fallback'''
self.reboot_sitl()
Expand Down Expand Up @@ -5426,6 +5465,7 @@ def tests(self):
self.AHRS_ORIENTATION,
self.AHRSTrim,
self.LandingDrift,
self.CatapultTakeoff,
self.ForcedDCM,
self.DCMFallback,
self.MAVFTP,
Expand Down Expand Up @@ -5474,4 +5514,5 @@ def disabled_tests(self):
"LandingDrift": "Flapping test. See https://github.com/ArduPilot/ardupilot/issues/20054",
"InteractTest": "requires user interaction",
"ClimbThrottleSaturation": "requires https://github.com/ArduPilot/ardupilot/pull/27106 to pass",
"CatapultTakeoff": "Known bug. See https://github.com/ArduPilot/ardupilot/issues/27147",
}
4 changes: 4 additions & 0 deletions Tools/autotest/vehicle_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -5406,6 +5406,10 @@ def set_rc(self, chan, pwm, timeout=20):
"""Setup a simulated RC control to a PWM value"""
self.set_rc_from_map({chan: pwm}, timeout=timeout)

def set_servo(self, chan, pwm):
"""Replicate the functionality of MAVProxy: servo set <ch> <pwm>"""
self.run_cmd(mavutil.mavlink.MAV_CMD_DO_SET_SERVO, p1=chan, p2=pwm)

def location_offset_ne(self, location, north, east):
'''move location in metres'''
print("old: %f %f" % (location.lat, location.lng))
Expand Down
Loading