aboutsummaryrefslogtreecommitdiff
path: root/integrationtests/demo_tests/direct_offboard_posctl_test.py
diff options
context:
space:
mode:
authorAndreas Antener <antener_a@gmx.ch>2015-02-23 21:45:01 +0100
committerThomas Gubler <thomasgubler@gmail.com>2015-02-28 18:25:36 +0100
commit952f91738ea0704fe5dbbb1598a17ca53f3a70a0 (patch)
tree5009242d88def69dd08a6ea4260c43b357542902 /integrationtests/demo_tests/direct_offboard_posctl_test.py
parent85ac3e3515bc214a770074182617208b24ee0209 (diff)
downloadpx4-firmware-952f91738ea0704fe5dbbb1598a17ca53f3a70a0.tar.gz
px4-firmware-952f91738ea0704fe5dbbb1598a17ca53f3a70a0.tar.bz2
px4-firmware-952f91738ea0704fe5dbbb1598a17ca53f3a70a0.zip
update flight path assertion and error handling
Diffstat (limited to 'integrationtests/demo_tests/direct_offboard_posctl_test.py')
-rwxr-xr-xintegrationtests/demo_tests/direct_offboard_posctl_test.py35
1 files changed, 19 insertions, 16 deletions
diff --git a/integrationtests/demo_tests/direct_offboard_posctl_test.py b/integrationtests/demo_tests/direct_offboard_posctl_test.py
index af8d4b821..6b28e0a18 100755
--- a/integrationtests/demo_tests/direct_offboard_posctl_test.py
+++ b/integrationtests/demo_tests/direct_offboard_posctl_test.py
@@ -29,6 +29,10 @@ class OffboardPosctlTest(unittest.TestCase):
self.pubSpt = rospy.Publisher('px4_multicopter/position_setpoint_triplet', position_setpoint_triplet, queue_size=10)
self.rate = rospy.Rate(10) # 10hz
+ def tearDown(self):
+ if (self.fpa):
+ self.fpa.stop()
+
#
# General callback functions used in tests
#
@@ -83,22 +87,21 @@ class OffboardPosctlTest(unittest.TestCase):
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 assertion
- fpa = FlightPathAssertion(
- (
- (0,0,0),
- (2,2,-2),
- (2,-2,-2),
- (-2,-2,-2),
- (2,2,-2),
- ), 0.5, 0)
- fpa.start()
-
- self.reach_position(2, 2, -2, 120)
- self.reach_position(2, -2, -2, 120)
- self.reach_position(-2, -2, -2, 120)
- self.reach_position(2, 2, -2, 120)
+ positions = (
+ (0,0,0),
+ (2,2,-2),
+ (2,-2,-2),
+ (-2,-2,-2),
+ (2,2,-2))
+
+ 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
@@ -112,7 +115,7 @@ class OffboardPosctlTest(unittest.TestCase):
self.rate.sleep()
self.assertTrue(count == timeout, "position could not be held")
- fpa.stop()
+ self.fpa.stop()
if __name__ == '__main__':