forked from Mcpigeons04/Drone-Simulation-Gazebo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pid_tune_drone.py
93 lines (74 loc) · 3.28 KB
/
pid_tune_drone.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env python3
import rospy
import time
from pid_lib import *
if __name__ == '__main__':
rospy.init_node('Tune_pid_drone')
pitch_ui = rospy.get_param('~ppid_ui_enable',True) #set it as True if you need pitch pid ui
roll_ui = rospy.get_param('~rpid_ui_enable',True)
yaw_ui = rospy.get_param('~ypid_ui_enable',True)
throttle_ui = rospy.get_param('~tpid_ui_enable',True)
if pitch_ui and roll_ui and yaw_ui and throttle_ui :
ppid = Pid_dim("Pitch","pid_tuning_pitch",1000) #Title of the ui, topic name of the publisher, queue size
rpid = Pid_dim("Roll","pid_tuning_roll",1000)
ypid = Pid_dim("Yaw","pid_tuning_yaw",1000)
tpid = Pid_dim("Throttle","pid_tuning_altitude",1000)
ppid.root.mainloop()
elif pitch_ui and roll_ui and yaw_ui:
ppid = Pid_dim("Pitch","pid_tuning_pitch",1000) #Title of the ui, topic name of the publisher, queue size
rpid = Pid_dim("Roll","pid_tuning_roll",1000)
ypid = Pid_dim("Yaw","pid_tuning_yaw",1000)
ppid.root.mainloop()
elif pitch_ui and roll_ui and throttle_ui:
ppid = Pid_dim("Pitch","pid_tuning_pitch",1000) #Title of the ui, topic name of the publisher, queue size
rpid = Pid_dim("Roll","pid_tuning_roll",1000)
tpid = Pid_dim("Throttle","pid_tuning_altitude",1000)
ppid.root.mainloop()
elif pitch_ui and yaw_ui and throttle_ui:
ppid = Pid_dim("Pitch","pid_tuning_pitch",1000) #Title of the ui, topic name of the publisher, queue size
ypid = Pid_dim("Yaw","pid_tuning_yaw",1000)
tpid = Pid_dim("Throttle","pid_tuning_altitude",1000)
ppid.root.mainloop()
elif roll_ui and yaw_ui and throttle_ui:
rpid = Pid_dim("Roll","pid_tuning_roll",1000)#Title of the ui, topic name of the publisher, queue size
ypid = Pid_dim("Yaw","pid_tuning_yaw",1000)
tpid = Pid_dim("Throttle","pid_tuning_altitude",1000)
rpid.root.mainloop()
elif pitch_ui and roll_ui:
ppid = Pid_dim("Pitch","pid_tuning_pitch",1000) #Title of the ui, topic name of the publisher, queue size
rpid = Pid_dim("Roll","pid_tuning_roll",1000)
ppid.root.mainloop()
elif pitch_ui and yaw_ui:
ppid = Pid_dim("Pitch","pid_tuning_pitch",1000) #Title of the ui, topic name of the publisher, queue size
ypid = Pid_dim("Yaw","pid_tuning_yaw",1000)
ppid.root.mainloop()
elif pitch_ui and yaw_ui:
ppid = Pid_dim("Pitch","pid_tuning_pitch",1000) #Title of the ui, topic name of the publisher, queue size
tpid = Pid_dim("Throttle","pid_tuning_altitude",1000)
ppid.root.mainloop()
elif roll_ui and yaw_ui:
rpid = Pid_dim("Roll","pid_tuning_roll",1000)
ypid = Pid_dim("Yaw","pid_tuning_yaw",1000)
rpid.root.mainloop()
elif roll_ui and throttle_ui:
rpid = Pid_dim("Roll","pid_tuning_roll",1000)
tpid = Pid_dim("Throttle","pid_tuning_altitude",1000)
rpid.root.mainloop()
elif yaw_ui and throttle_ui:
ypid = Pid_dim("Yaw","pid_tuning_yaw",1000)
tpid = Pid_dim("Throttle","pid_tuning_altitude",1000)
ypid.root.mainloop()
elif pitch_ui:
ppid = Pid_dim("Pitch","pid_tuning_pitch",1000) #Title of the ui, topic name of the publisher, queue size
ppid.root.mainloop()
elif roll_ui:
rpid = Pid_dim("Roll","pid_tuning_roll",1000)
rpid.root.mainloop()
elif yaw_ui:
ypid = Pid_dim("Yaw","pid_tuning_yaw",1000)
ypid.root.mainloop()
elif throttle_ui:
tpid = Pid_dim("Throttle","pid_tuning_altitude",1000)
tpid.root.mainloop()
else:
rospy.loginfo("UI DISABLED")