11. Play PiDog with KeyboardΒΆ

In this example, we will use the keyboard to control PiDog. You can press these keys in the terminal to make it act.

Keys

Function

Keys

Function

Keys

Function

1

doze off

q

bark harder

a

turn left

2

push-up

w

forward

s

backward

3

howling

e

pant

d

turn right

4

twist body

r

wag tail

f

shake head

5

scratch

t

hake head

g

high five

u

head roll

U

head roll+

z

lie

i

head pitch

I

head pitch+

x

stand up

o

head roll

O

head roll+

c

sit

j

head yaw

J

head yaw+

v

stretch

k

head pitch

K

head pitch+

m

head reset

l

head yaw

L

head yaw+

W

trot

Run the Code

cd ~/pidog/examples
sudo python3 11_keyboard_control.py

After the program runs, you will see a printed keyboard on the terminal. Now you can control PiDog with keyboard in terminal.

Code

Please find the code in 11_keyboard_control.py - Github.