-
Notifications
You must be signed in to change notification settings - Fork 4
/
csci_dronet.py
36 lines (33 loc) · 1.15 KB
/
csci_dronet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import rospy
from std_msgs.msg import Empty, Bool
import argparse
# quick python script to send the only controls you need for the bebop drone to fly.
# requires bebop autonomy ros to already be running
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--option', type=str, default='land', help='season year')
rospy.init_node('bebop_dronet_control')
# takeoff, dronet-switch, landing controller
takeoff_pub = rospy.Publisher('bebop/takeoff', Empty)
control_pub = rospy.Publisher('bebop/state_change', Bool)
land_pub = rospy.Publisher('bebop/land', Empty)
opt = parser.parse_args()
selection = opt.option
if selection == 'takeoff':
# takeoff drone
e = Empty()
takeoff_pub.publish(e)
elif selection == 'dronet_start':
# turn on dronet control
b = Bool()
b.data = True
control_pub.publish(b)
elif selection == 'dronet_end':
# turn off dronet control
b = Bool()
b.data = False
control_pub.publish(b)
# if any other command is pressed, simply land
else:
e = Empty()
land_pub.publish(e)