def test_manual_input(self):
        rospy.init_node('test_node', anonymous=True)
        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_in = ManualInput()

        # Test arming
        man_in.arm()
        self.assertEquals(self.actuator_status.armed, True, "did not arm")

        # Test posctl
        man_in.posctl()
        self.assertTrue(self.control_mode.flag_control_position_enabled, "flag_control_position_enabled is not set")

        # Test offboard
        man_in.offboard()
        self.assertTrue(self.control_mode.flag_control_offboard_enabled, "flag_control_offboard_enabled is not set")
    def test_posctl(self):
        manIn = ManualInput()

        # arm and go into offboard
        manIn.arm()
        manIn.offboard()
        self.assertTrue(self.controlMode.flag_armed, "flag_armed is not set")
        self.assertTrue(self.controlMode.flag_control_offboard_enabled, "flag_control_offboard_enabled is not set")
        self.assertTrue(self.controlMode.flag_control_position_enabled, "flag_control_position_enabled is not set")

        # prepare flight path
        positions = (
            (0,0,0),
            (2,2,-2),
            (2,-2,-2),
            (-2,-2,-2),
            (2,2,-2))

        # flight path assertion
        self.fpa = FlightPathAssertion(positions, 1, 0)
        self.fpa.start()

        for i in range(0, len(positions)):
            self.reach_position(positions[i][0], positions[i][1], positions[i][2], 120)
            self.assertFalse(self.fpa.failed, "breached flight path tunnel (%d)" % i)
        
        # does it hold the position for Y seconds?
        positionHeld = True
        count = 0
        timeout = 50
        while(count < timeout):
            if(not self.is_at_position(2, 2, -2, 0.5)):
                positionHeld = False
                break
            count = count + 1
            self.rate.sleep()

        self.assertTrue(count == timeout, "position could not be held")
        self.fpa.stop()
예제 #3
0
    def test_manual_input(self):
        rospy.init_node('test_node', anonymous=True)
        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_in = ManualInput()

        # Test arming
        man_in.arm()
        self.assertEquals(self.actuator_status.armed, True, "did not arm")

        # Test posctl
        man_in.posctl()
        self.assertTrue(self.control_mode.flag_control_position_enabled,
                        "flag_control_position_enabled is not set")

        # Test offboard
        man_in.offboard()
        self.assertTrue(self.control_mode.flag_control_offboard_enabled,
                        "flag_control_offboard_enabled is not set")