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
(
'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
Summary of Contents for PiDog
Page 1: ...SunFounder PiDog Kit Release 1 0 sunfounder Jan 09 2023 ...
Page 2: ......
Page 4: ...ii ...
Page 6: ...SunFounder PiDog Kit Release 1 0 Content 2 CONTENTS ...
Page 8: ...SunFounder PiDog Kit Release 1 0 4 Chapter 1 Component List and Assembly Instructions ...
Page 15: ...SunFounder PiDog Kit Release 1 0 Step 7 Click the WRITE button 2 1 Quick Guide on Python 11 ...
Page 92: ...SunFounder PiDog Kit Release 1 0 88 Chapter 2 Play with Python ...
Page 108: ...SunFounder PiDog Kit Release 1 0 104 Chapter 4 Appendix ...