User Manual

Table Of Contents
75
step_set = 1
else:
pass
if turn_command != 'no': # gait of turning left and right
if SmoothMode:
dove(step_set,35,0.001,DPI,turn_command)
step_set += 1
if step_set == 5:
step_set = 1
else:
move(step_set, 35, turn_command)
time.sleep(0.1)
step_set += 1
if step_set == 5:
step_set = 1
else:
pass
if turn_command == 'no' and direction_command == 'stand':
stand()
step_set = 1
pass
else: #Self-balancing
steady_X()
steady()
class RobotM(threading.Thread):
def __init__(self, *args, **kwargs):
super(RobotM, self).__init__(*args, **kwargs)
self.__flag = threading.Event() #The default flag is False, set the flag to True when calli
ng set() self.__flag.clear()
def pause(self):
#print('......................pause..........................')
self.__flag.clear()
def resume(self):
self.__flag.set()
def run(self):
while 1:
self.__flag.wait() #wait for set()
move_thread()
pass
rm = RobotM()
rm.start()
rm.pause()