EasyManua.ls Logo

SunFounder PiDog - Page 64

Default Icon
109 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 PiDog Kit, Release 1.0
(continued from previous page)
if people > 0 and flag == False:
flag = True
my_dog.do_action('wag_tail', step_count=2, speed=100)
bark(my_dog, [yaw, 0, 0], pitch_comp=-40)
if my_dog.ears.isdetected():
direction = my_dog.ears.read()
if ex > 15 and yaw > -80:
yaw -= 0.5
elif ex < -15 and yaw < 80:
yaw += 0.5
if ey > 25:
pitch -= 0.5
if pitch < - 30:
pitch = -30
elif ey < -25:
pitch += 0.5
if pitch > 30:
pitch = 30
print('direction: %s |number: %s | ex, ey: %s, %s | yrp: %s, %s, %s '
% (direction, people, ex, ey, round(yaw, 2), round(roll, 2), round(pitch,
˓2)),
end='\r',
flush=True,
)
my_dog.head_move([[yaw, 0, pitch]], pitch_comp=-
40, immediately=True, speed=100)
sleep(0.05)
if __name__ == "__main__":
try:
face_track()
except KeyboardInterrupt:
Vilib.camera_close()
my_dog.close()
2.2.9 Push Up
PiDog is an exercise-loving robot that will do push-ups with you.
Run the Code
cd /home/pi/pidog/examples
sudo python3 8_pushup.py
After the program runs, PiDog will perform a plank, then cycle through push-ups and barks.
Code
Note: You can Modify/Reset/Copy/Run/Stop the code below. But before that, you need to go to source code path
60 Chapter 2. Play with Python

Related product manuals