mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 03:03:34 +08:00
cleaned up direct tests, fixed various lint warnings and removed unused code
This commit is contained in:
@@ -37,7 +37,6 @@
|
||||
#
|
||||
PKG = 'px4'
|
||||
|
||||
import sys
|
||||
import unittest
|
||||
import rospy
|
||||
|
||||
@@ -50,14 +49,18 @@ from manual_input import ManualInput
|
||||
#
|
||||
class ManualInputTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.actuator_status = actuator_armed()
|
||||
self.control_mode = vehicle_control_mode()
|
||||
|
||||
#
|
||||
# General callback functions used in tests
|
||||
#
|
||||
def actuator_armed_callback(self, data):
|
||||
self.actuatorStatus = data
|
||||
self.actuator_status = data
|
||||
|
||||
def vehicle_control_mode_callback(self, data):
|
||||
self.controlMode = data
|
||||
self.control_mode = data
|
||||
|
||||
#
|
||||
# Test arming
|
||||
@@ -67,19 +70,19 @@ class ManualInputTest(unittest.TestCase):
|
||||
rospy.Subscriber('iris/actuator_armed', actuator_armed, self.actuator_armed_callback)
|
||||
rospy.Subscriber('iris/vehicle_control_mode', vehicle_control_mode, self.vehicle_control_mode_callback)
|
||||
|
||||
man = ManualInput()
|
||||
man_in = ManualInput()
|
||||
|
||||
# Test arming
|
||||
man.arm()
|
||||
self.assertEquals(self.actuatorStatus.armed, True, "did not arm")
|
||||
man_in.arm()
|
||||
self.assertEquals(self.actuator_status.armed, True, "did not arm")
|
||||
|
||||
# Test posctl
|
||||
man.posctl()
|
||||
self.assertTrue(self.controlMode.flag_control_position_enabled, "flag_control_position_enabled is not set")
|
||||
man_in.posctl()
|
||||
self.assertTrue(self.control_mode.flag_control_position_enabled, "flag_control_position_enabled is not set")
|
||||
|
||||
# Test offboard
|
||||
man.offboard()
|
||||
self.assertTrue(self.controlMode.flag_control_offboard_enabled, "flag_control_offboard_enabled is not set")
|
||||
man_in.offboard()
|
||||
self.assertTrue(self.control_mode.flag_control_offboard_enabled, "flag_control_offboard_enabled is not set")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user