mirror of https://github.com/ArduPilot/ardupilot
autotest: Add Copter test for AutoYaw with Mount without yaw control
This commit is contained in:
parent
21fc964159
commit
2c80c702bc
|
@ -5825,6 +5825,49 @@ class AutoTestCopter(vehicle_test_suite.TestSuite):
|
||||||
self.context_pop()
|
self.context_pop()
|
||||||
self.reboot_sitl()
|
self.reboot_sitl()
|
||||||
|
|
||||||
|
def AutoYawDO_MOUNT_CONTROL(self):
|
||||||
|
'''test AutoYaw behaviour when MAV_CMD_DO_MOUNT_CONTROL sent to Mount without Yaw control'''
|
||||||
|
|
||||||
|
# setup mount parameters
|
||||||
|
self.context_push()
|
||||||
|
|
||||||
|
yaw_servo = 7
|
||||||
|
self.setup_servo_mount(roll_servo=5, pitch_servo=6, yaw_servo=yaw_servo)
|
||||||
|
# Disable Mount Yaw servo
|
||||||
|
self.set_parameters({
|
||||||
|
"SERVO%u_FUNCTION" % yaw_servo: 0,
|
||||||
|
})
|
||||||
|
self.reboot_sitl() # to handle MNT_TYPE changing
|
||||||
|
|
||||||
|
self.takeoff(20, mode='GUIDED')
|
||||||
|
|
||||||
|
for mount_yaw in [-45, 0, 45]:
|
||||||
|
heading = 330
|
||||||
|
self.guided_achieve_heading(heading)
|
||||||
|
self.assert_heading(heading)
|
||||||
|
|
||||||
|
self.neutralise_gimbal()
|
||||||
|
|
||||||
|
r = 15
|
||||||
|
p = 20
|
||||||
|
self.run_cmd_int(
|
||||||
|
mavutil.mavlink.MAV_CMD_DO_MOUNT_CONTROL,
|
||||||
|
p1=p,
|
||||||
|
p2=r,
|
||||||
|
p3=mount_yaw,
|
||||||
|
p7=mavutil.mavlink.MAV_MOUNT_MODE_MAVLINK_TARGETING,
|
||||||
|
)
|
||||||
|
self.delay_sim_time(5)
|
||||||
|
# We have disabled yaw servo, so expect mount yaw to be zero
|
||||||
|
self.assert_mount_rpy(r, p, 0)
|
||||||
|
# But we expect the copter to yaw instead
|
||||||
|
self.assert_heading(heading + mount_yaw)
|
||||||
|
|
||||||
|
self.do_RTL()
|
||||||
|
|
||||||
|
self.context_pop()
|
||||||
|
self.reboot_sitl()
|
||||||
|
|
||||||
def MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE(self):
|
def MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE(self):
|
||||||
'''test MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE mavlink command'''
|
'''test MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE mavlink command'''
|
||||||
# setup mount parameters
|
# setup mount parameters
|
||||||
|
@ -10695,6 +10738,7 @@ class AutoTestCopter(vehicle_test_suite.TestSuite):
|
||||||
self.MountYawVehicleForMountROI,
|
self.MountYawVehicleForMountROI,
|
||||||
self.MAV_CMD_DO_MOUNT_CONTROL,
|
self.MAV_CMD_DO_MOUNT_CONTROL,
|
||||||
self.MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE,
|
self.MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE,
|
||||||
|
self.AutoYawDO_MOUNT_CONTROL,
|
||||||
self.Button,
|
self.Button,
|
||||||
self.ShipTakeoff,
|
self.ShipTakeoff,
|
||||||
self.RangeFinder,
|
self.RangeFinder,
|
||||||
|
|
Loading…
Reference in New Issue