10. BalanceΒΆ

Because PiDog is equipped with a 6-DOF IMU module, it has a great sense of balance.

In this example, you can make PiDog walk smoothly on the table, even if you lift one side of the table, PiDog will walk smoothly on the gentle slope.

../_images/py_10.gif

Run the Code

cd ~/pidog/examples
sudo python3 10_balance.py

After the program is running, you will see a printed keyboard on the terminal. You can control PiDog to walk smoothly on the ramp by typing the below keys.

Keys

Function

W

Forward

E

Stand

A

Turn Left

S

Backward

D

Turn Right

R

Each press slightly lifts the body; multiple presses are needed for a noticeable rise.

F

Each press lowers the body a bit; it takes multiple presses for a noticeable descent.

Code

Please find the code in 10_balance.py - Github.