auototest: fail test if pymavlink too old

This commit is contained in:
Peter Barker 2023-07-05 08:57:32 +10:00 committed by Peter Barker
parent 085a10a3a1
commit d182baa6b8
2 changed files with 7 additions and 1 deletions

View File

@ -20,6 +20,7 @@ from common import AutoTestTimeoutException
from common import NotAchievedException from common import NotAchievedException
from common import PreconditionFailedException from common import PreconditionFailedException
from common import WaitModeTimeout from common import WaitModeTimeout
from common import OldpymavlinkException
from pymavlink.rotmat import Vector3 from pymavlink.rotmat import Vector3
from pysim import vehicleinfo from pysim import vehicleinfo
@ -582,7 +583,7 @@ class AutoTestPlane(AutoTest):
def ExternalPositionEstimate(self): def ExternalPositionEstimate(self):
'''Test mavlink EXTERNAL_POSITION_ESTIMATE command''' '''Test mavlink EXTERNAL_POSITION_ESTIMATE command'''
if not hasattr(mavutil.mavlink, 'MAV_CMD_EXTERNAL_POSITION_ESTIMATE'): if not hasattr(mavutil.mavlink, 'MAV_CMD_EXTERNAL_POSITION_ESTIMATE'):
return raise OldpymavlinkException("pymavlink too old; upgrade pymavlink to get MAV_CMD_EXTERNAL_POSITION_ESTIMATE") # noqa
self.change_mode("TAKEOFF") self.change_mode("TAKEOFF")
self.wait_ready_to_arm() self.wait_ready_to_arm()
self.arm_vehicle() self.arm_vehicle()

View File

@ -168,6 +168,11 @@ class NotAchievedException(ErrorException):
pass pass
class OldpymavlinkException(ErrorException):
"""Thrown when a new feature is required from pymavlink"""
pass
class YawSpeedNotAchievedException(NotAchievedException): class YawSpeedNotAchievedException(NotAchievedException):
"""Thrown when fails to achieve given yaw speed.""" """Thrown when fails to achieve given yaw speed."""
pass pass