SunFounder PiCrawler Kit
(continued from previous page)
elif chr(32) == key:
print("[[right front],[left front],[left rear],[right rear]]")
print("saved new step")
print(crawler.current_step_all_leg_value())
save_new_step()
elif 'p' == key:
play_all_new_step()
elif chr(27) == key:# 27 for ESC
break
sleep(0.05)
crawler.do_single_leg(leg,coodinate,speed)
print("\n q Quit")
if __name__ == "__main__":
main()
How it works?
This project was born out of Adjust Posture. Added recording and replay functions.
The recording function is implemented by the following code.
new_step=[]
def save_new_step():
new_step.append(copy.deepcopy(crawler.current_step_all_leg_value()))
print(new_step)
Note: The assignment here needs to use the Deep Copy function, otherwise the new_step will not get a new array
object when appending.
The replay function is implemented by the following code.
def play_all_new_step():
for step in new_step:
crawler.do_step(step,speed)
sleep(0.6)
Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook!
Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Why Join?
• Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
• Learn & Share: Exchange tips and tutorials to enhance your skills.
• Exclusive Previews: Get early access to new product announcements and sneak peeks.
• Special Discounts: Enjoy exclusive discounts on our newest products.
• Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.
3.13. Record New Step 77