SunFounder PiDog Kit, Release 1.0
Pidog
.
wait_head_done()
Wait for all the head actions in the buffer to be executed
Pidog
.
head_stop()
Clear all the head actions of leg in the buffer, to make head servos stop
Here are some common use cases:
1. Nod five times.
from
pidog
import
Pidog
import
time
my_dog
=
Pidog()
for
_
in
range
(
5
):
my_dog
.
head_move([[
0
,
0
,
30
],[
0
,
0
,
-
30
]], speed
=
80
)
my_dog
.
wait_head_done()
time
.
sleep(
0.5
)
2. Shake your head for 10 seconds.
from
pidog
import
Pidog
import
time
my_dog
=
Pidog()
for
_
in
range
(
99
):
my_dog
.
head_move([[
30
,
0
,
0
],[
-
30
,
0
,
0
]], immediately
=
False
, speed
=
30
)
# keep 10s
time
.
sleep(
10
)
my_dog
.
head_move([[
0
,
0
,
0
]], immediately
=
True
, speed
=
80
)
3. Whether sitting or half standing, PiDog keeps its head level when shaking its head.
from
pidog
import
Pidog
import
time
my_dog
=
Pidog()
# action list
shake_head
=
[[
30
,
0
,
0
],[
-
30
,
0
,
0
]]
half_stand_leg
=
[[
45
,
10
,
-
45
,
-
10
,
45
,
10
,
-
45
,
-
10
]]
sit_leg
=
[[
30
,
60
,
-
30
,
-
60
,
80
,
-
45
,
-
80
,
45
]]
while
True
:
# shake head in half stand
my_dog
.
legs_move(half_stand_leg, speed
=
30
)
for
_
in
range
(
5
):
my_dog
.
head_move(shake_head, pitch_comp
=
0
, speed
=
50
)
my_dog
.
wait_head_done()
time
.
sleep(
0.5
)
# shake head in sit
(continues on next page)
78
Chapter 2. Play with Python
Содержание PiDog
Страница 1: ...SunFounder PiDog Kit Release 1 0 sunfounder Jan 09 2023 ...
Страница 2: ......
Страница 4: ...ii ...
Страница 6: ...SunFounder PiDog Kit Release 1 0 Content 2 CONTENTS ...
Страница 8: ...SunFounder PiDog Kit Release 1 0 4 Chapter 1 Component List and Assembly Instructions ...
Страница 15: ...SunFounder PiDog Kit Release 1 0 Step 7 Click the WRITE button 2 1 Quick Guide on Python 11 ...
Страница 92: ...SunFounder PiDog Kit Release 1 0 88 Chapter 2 Play with Python ...
Страница 108: ...SunFounder PiDog Kit Release 1 0 104 Chapter 4 Appendix ...