Skip to content
Snippets Groups Projects
Commit 3517c8cc authored by Zhaoliang Zheng's avatar Zhaoliang Zheng
Browse files

test the decode function

parent cac1a3f8
No related merge requests found
......@@ -50,6 +50,17 @@ def manual_control(Ctl_com):
return Ctl_com
# print("manual_control function")
def decode_ctl(Ctl_com):
pwm1 = Ctl_com[0]
pwm2 = Ctl_com[1]
pwm3 = Ctl_com[2]
pwm4 = Ctl_com[3]
dir1 = Ctl_com[4]
dir2 = Ctl_com[5]
dir3 = Ctl_com[6]
dir4 = Ctl_com[7]
return pwm1, pwm2, pwm3, pwm4, dir1, dir2, dir3, dir4
def dynamic_variable(str_name_v):
global kpx,kix,kdx,start_speed
......@@ -71,7 +82,6 @@ def variables_change_once():
str_name = input("Enter your variable: ")
dynamic_variable(str_name)
# print("variables_change function")
def init():
......@@ -129,7 +139,8 @@ if __name__ == '__main__':
flag = 2
while (flag == 2):
Ctl_command = manual_control(Ctl_com)
print("Ctl_com:{}".format(Ctl_command))
pwm1, pwm2, pwm3, pwm4, dir1, dir2, dir3, dir4 = decode_ctl(Ctl_command)
print("Ctl_com:{},{},{},{},{},{},{},{}".format(pwm1, pwm2, pwm3, pwm4, dir1, dir2, dir3, dir4))
flag, print_count = keyboard_stop(flag,print_count)
elif get_key('v'):
......@@ -139,7 +150,8 @@ if __name__ == '__main__':
flag = 0
print_count = 1
# flag, print_count = keyboard_stop(flag,print_count)
elif get_key('k'):
elif get_key('k'): # kill the program
break
if print_count is not 0:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment