EasyManua.ls Logo

SunFounder PiCrawler Kit - Page 82

Default Icon
137 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SunFounder PiCrawler Kit
(continued from previous page)
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
return ch
manual = '''
Press keys on keyboard to control PiSloth!
w: Y++
a: X--
s: Y--
d: X++
r: Z++
f: Z--
1: Select right front leg
2: Select left front leg
3: Select left rear leg
4: Select right rear leg
space: Print all leg coodinate & Save this step
p: Play all saved step
esc: Quit
'''
new_step=[]
def save_new_step():
new_step.append(copy.deepcopy(crawler.current_step_all_leg_value()))
print(new_step)
def play_all_new_step():
for step in new_step:
crawler.do_step(step,speed)
sleep(0.6)
def main():
speed = 80
print(manual)
crawler.do_step('sit',speed)
leg = 0
coodinate=crawler.current_step_leg_value(leg)
while True:
key = readchar()
key = key.lower()
# print(key)
if 'w' == key:
coodinate[1]=coodinate[1]+2
elif 's' == key:
coodinate[1]=coodinate[1]-2
elif 'a' == key:
coodinate[0]=coodinate[0]-2
elif 'd' == key:
coodinate[0]=coodinate[0]+2
elif 'r' == key:
coodinate[2]=coodinate[2]+2
elif 'f' == key:
coodinate[2]=coodinate[2]-2
elif '1' == key:
(continues on next page)
78 Chapter 3. Play with Python

Other manuals for SunFounder PiCrawler Kit

Related product manuals