forked from Mcpigeons04/Drone-Simulation-Gazebo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pid_tune_gui.py
30 lines (25 loc) · 1.03 KB
/
pid_tune_gui.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
#!/usr/bin/env python3
from Tkinter import *
from pid_tune.msg import PidTune
import rospy
rospy.init_node('tune_pid')
send_pid = rospy.Publisher('/pid_tuning', PidTune, queue_size=10)
pid_value = PidTune()
def set_value():
pid_value.Kp = scale.get()
pid_value.Ki = scale1.get()
pid_value.Kd = scale2.get()
# pid_value.Kp_z = scale3.get()
send_pid.publish(pid_value)
# print scale.get(), scale1.get(), scale2.get()
root = Tk()
scale = Scale(root, orient='horizontal', from_=0, to=300, label= 'Kp',width = "50", length = "500",troughcolor="red")
scale1 =Scale(root, orient='horizontal', from_=0, to=1000, label= 'Ki',width = "50", length = "500",troughcolor="green")
scale2 =Scale(root, orient='horizontal', from_=0, to=100, label= 'Kd',width = "50", length = "500", troughcolor="blue")
# scale3 =Scale(root, orient='horizontal', from_=0, to=300, label= 'Kp_z',width = "50", length = "500", troughcolor="gray")
scale.pack()
scale1.pack()
scale2.pack()
# scale3.pack()
Button(root, text='set_value', command=set_value).pack()
root.mainloop()