diff options
author | Andreas Antener <antener_a@gmx.ch> | 2015-03-15 20:39:57 +0100 |
---|---|---|
committer | Andreas Antener <antener_a@gmx.ch> | 2015-03-18 08:33:46 +0100 |
commit | f3a2c66e89aa2da0e9f736b89b4da9e4e03283f0 (patch) | |
tree | 4bc33baeafa3c5e9e77f1ec58468633fba784e32 /integrationtests/demo_tests/mavros_offboard_attctl_test.py | |
parent | 0daf2232ec5f4cd70d7f61f520981125a83144d2 (diff) | |
download | px4-firmware-f3a2c66e89aa2da0e9f736b89b4da9e4e03283f0.tar.gz px4-firmware-f3a2c66e89aa2da0e9f736b89b4da9e4e03283f0.tar.bz2 px4-firmware-f3a2c66e89aa2da0e9f736b89b4da9e4e03283f0.zip |
write rosbags
Diffstat (limited to 'integrationtests/demo_tests/mavros_offboard_attctl_test.py')
-rwxr-xr-x | integrationtests/demo_tests/mavros_offboard_attctl_test.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/integrationtests/demo_tests/mavros_offboard_attctl_test.py b/integrationtests/demo_tests/mavros_offboard_attctl_test.py index 30e9fe9ba..aa6bd8d9f 100755 --- a/integrationtests/demo_tests/mavros_offboard_attctl_test.py +++ b/integrationtests/demo_tests/mavros_offboard_attctl_test.py @@ -39,8 +39,10 @@ PKG = 'px4' import unittest import rospy +import rosbag from px4.msg import vehicle_control_mode +from px4.msg import vehicle_local_position from std_msgs.msg import Header from std_msgs.msg import Float64 from geometry_msgs.msg import PoseStamped, Quaternion @@ -56,8 +58,10 @@ class MavrosOffboardAttctlTest(unittest.TestCase): def setUp(self): rospy.init_node('test_node', anonymous=True) + self.bag = rosbag.Bag('mavros_offboard_attctl_test.bag', 'w', compression="lz4") rospy.wait_for_service('iris/mavros/cmd/arming', 30) rospy.Subscriber('iris/vehicle_control_mode', vehicle_control_mode, self.vehicle_control_mode_callback) + self.sub_vlp = rospy.Subscriber("iris/vehicle_local_position", vehicle_local_position, self.vehicle_position_callback) rospy.Subscriber("iris/mavros/position/local", PoseStamped, self.position_callback) self.pub_att = rospy.Publisher('iris/mavros/setpoint/attitude', PoseStamped, queue_size=10) self.pub_thr = rospy.Publisher('iris/mavros/setpoint/att_throttle', Float64, queue_size=10) @@ -66,9 +70,17 @@ class MavrosOffboardAttctlTest(unittest.TestCase): self.control_mode = vehicle_control_mode() self.local_position = PoseStamped() + def tearDown(self): + self.sub_vlp.unregister() + self.rate.sleep() + self.bag.close() + # # General callback functions used in tests # + def vehicle_position_callback(self, data): + self.bag.write('vehicle_local_position', data) + def position_callback(self, data): self.has_pos = True self.local_position = data |