|
16 | 16 |
|
17 | 17 | import vehicle_test_suite |
18 | 18 |
|
| 19 | +from vehicle_test_suite import AutoTestTimeoutException |
19 | 20 | from vehicle_test_suite import NotAchievedException |
20 | 21 |
|
21 | 22 | # get location of scripts |
@@ -673,6 +674,63 @@ def GripperMission(self): |
673 | 674 | self.wait_waypoint(1, 6, max_dist=5) |
674 | 675 | self.disarm_vehicle() |
675 | 676 |
|
| 677 | + def MANUAL_CONTROL(self): |
| 678 | + '''Test mavlink MANUAL_CONTROL''' |
| 679 | + |
| 680 | + self.change_mode("MANUAL") |
| 681 | + self.wait_ready_to_arm() |
| 682 | + self.arm_vehicle() |
| 683 | + |
| 684 | + self.start_subsubtest("Manual control works by default") |
| 685 | + |
| 686 | + want_pitch = 0.003 |
| 687 | + want_speed = 2.0 |
| 688 | + tstart = self.get_sim_time_cached() |
| 689 | + while True: |
| 690 | + if self.get_sim_time_cached() - tstart > 10: |
| 691 | + raise AutoTestTimeoutException("Did not reach speed") |
| 692 | + self.set_rc(Joystick.Throttle, 1600) |
| 693 | + self.set_rc(Joystick.Forward, 1600) |
| 694 | + self.set_rc(Joystick.Lateral, 1550) |
| 695 | + self.mav.mav.manual_control_send( |
| 696 | + 1, # target system |
| 697 | + 500, # x forward |
| 698 | + 0, # y lateral |
| 699 | + 0, # z vertical |
| 700 | + 0, # r yaw |
| 701 | + 0, # buttons |
| 702 | + 0, # buttons2 |
| 703 | + 192, # roll and pitch enabled |
| 704 | + 0, # pitch |
| 705 | + 0) # roll |
| 706 | + m = self.assert_receive_message('VFR_HUD') |
| 707 | + if m.groundspeed < want_speed: |
| 708 | + break |
| 709 | + |
| 710 | + self.start_subsubtest("Manual control works for pitch axis") |
| 711 | + while True: |
| 712 | + if self.get_sim_time_cached() - tstart > 10: |
| 713 | + raise AutoTestTimeoutException("Did not reach pitch with control") |
| 714 | + self.set_rc(Joystick.Throttle, 1600) |
| 715 | + self.set_rc(Joystick.Forward, 1600) |
| 716 | + self.set_rc(Joystick.Lateral, 1550) |
| 717 | + self.mav.mav.manual_control_send( |
| 718 | + 1, # target system |
| 719 | + 0, # x forward |
| 720 | + 0, # y lateral |
| 721 | + 0, # z vertical |
| 722 | + 0, # r yaw |
| 723 | + 0, # buttons |
| 724 | + 0, # buttons2 |
| 725 | + 192, # roll and pitch enabled |
| 726 | + 500, # pitch |
| 727 | + 0) # roll |
| 728 | + m = self.assert_receive_message('ATTITUDE') |
| 729 | + if m.pitch < want_pitch: |
| 730 | + break |
| 731 | + |
| 732 | + self.disarm_vehicle() |
| 733 | + |
676 | 734 | def SET_POSITION_TARGET_GLOBAL_INT(self): |
677 | 735 | '''Move vehicle using SET_POSITION_TARGET_GLOBAL_INT''' |
678 | 736 | self.change_mode('GUIDED') |
@@ -1369,6 +1427,7 @@ def tests(self): |
1369 | 1427 | self.MAV_mgs, |
1370 | 1428 | self.DiveMission, |
1371 | 1429 | self.GripperMission, |
| 1430 | + self.MANUAL_CONTROL, |
1372 | 1431 | self.DoubleCircle, |
1373 | 1432 | self.MotorThrustHoverParameterIgnore, |
1374 | 1433 | self.SET_POSITION_TARGET_GLOBAL_INT, |
|
0 commit comments