diff options
author | Andreas Antener <antener_a@gmx.ch> | 2015-02-22 14:54:32 +0100 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2015-02-28 18:25:36 +0100 |
commit | a54849eeffde2cfefd5b8274fc2d7ef2da4e92e6 (patch) | |
tree | adc0aae1f911df81998bb7c81b821fb5236f07c3 /integrationtests/demo_tests/manual_input.py | |
parent | cbbc660b88917fd0c4cf3fe54ca5c769775e7ae9 (diff) | |
download | px4-firmware-a54849eeffde2cfefd5b8274fc2d7ef2da4e92e6.tar.gz px4-firmware-a54849eeffde2cfefd5b8274fc2d7ef2da4e92e6.tar.bz2 px4-firmware-a54849eeffde2cfefd5b8274fc2d7ef2da4e92e6.zip |
adding previous integration demo tests
Diffstat (limited to 'integrationtests/demo_tests/manual_input.py')
-rwxr-xr-x | integrationtests/demo_tests/manual_input.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/integrationtests/demo_tests/manual_input.py b/integrationtests/demo_tests/manual_input.py new file mode 100755 index 000000000..4bf508509 --- /dev/null +++ b/integrationtests/demo_tests/manual_input.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +import sys +import rospy + +from sensor_msgs.msg import Joy +from std_msgs.msg import Header + + +# +# Manual input control helper, fakes joystick input +# > needs to correspond to default mapping in manual_input node +# +class ManualInput: + + def __init__(self): + rospy.init_node('test_node', anonymous=True) + self.joyPx4 = rospy.Publisher('px4_multicopter/joy', Joy, queue_size=10) + self.joyIris = rospy.Publisher('iris/joy', Joy, queue_size=10) + + def arm(self): + rate = rospy.Rate(10) # 10hz + + msg = Joy() + msg.header = Header() + msg.buttons = [0, 0, 0, 0, 0] + msg.axes = [-0.0, -0.0, 1.0, -0.0, -0.0, 0.0, 0.0] + count = 0 + while not rospy.is_shutdown() and count < 10: + rospy.loginfo("zeroing") + self.joyPx4.publish(msg) + self.joyIris.publish(msg) + rate.sleep() + count = count + 1 + + msg.buttons = [0, 0, 0, 0, 0] + msg.axes = [-1.0, -0.0, 1.0, -0.0, -0.0, 0.0, 0.0] + count = 0 + while not rospy.is_shutdown() and count < 10: + rospy.loginfo("arming") + self.joyPx4.publish(msg) + self.joyIris.publish(msg) + rate.sleep() + count = count + 1 + + def posctl(self): + rate = rospy.Rate(10) # 10hz + + # triggers posctl + msg = Joy() + msg.header = Header() + msg.buttons = [0, 0, 1, 0, 0] + msg.axes = [-0.0, -0.0, 1.0, -0.0, -0.0, 0.0, 0.0] + count = 0 + while not rospy.is_shutdown() and count < 10: + rospy.loginfo("triggering posctl") + self.joyPx4.publish(msg) + self.joyIris.publish(msg) + rate.sleep() + count = count + 1 |