EasyManua.ls Logo

SunFounder PiCrawler Kit - Record New Step

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
3.13 Record New Step
We use the keyboard to control PiCrawler to make several poses in turn, and record these poses. Replay them later.
Run the Code
cd ~/picrawler/examples
sudo python3 record_new_step_by_keyboard.py
After the code runs, please operate according to the prompt that pops up in the terminal.
Press 1234 to select the feet separately, 1: right front foot, 2: left front foot, 3: left rear foot, 4: right rear foot
Press w, a, s, d, r, and f to slowly control the PiCrawlers coordinate values.
Press space to print all coordinate values.
Press p to have PiCrawler replay the recorded action.
Press esc to exit.
Code
from picrawler import Picrawler
from time import sleep
import sys
import tty
import termios
import copy
crawler = Picrawler()
speed = 80
def readchar():
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1)
finally:
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
(continues on next page)
3.13. Record New Step 75

Other manuals for SunFounder PiCrawler Kit

Related product manuals