EasyManua.ls Logo

SunFounder PiCrawler Kit - Page 80

Default Icon
141 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)
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:
leg=0
coodinate=crawler.current_step_leg_value(leg)
elif '2' == key:
leg=1
coodinate=crawler.current_step_leg_value(leg)
elif '3' == key:
leg=2
coodinate=crawler.current_step_leg_value(leg)
elif '4' == key:
leg=3
coodinate=crawler.current_step_leg_value(leg)
(continues on next page)
76 Chapter 3. Play with Python

Other manuals for SunFounder PiCrawler Kit

Related product manuals