SunFounder PiDog Kit, Release 1.0
(continued from previous page)
my_dog
.
legs_move(sit_leg, speed
=
30
)
for
_
in
range
(
5
):
my_dog
.
head_move(shake_head, pitch_comp
=-
30
, speed
=
50
)
my_dog
.
wait_head_done()
time
.
sleep(
0.5
)
2.3.4 Tail Move
Following are the functions that control PiDog’s tail. This function is similar to
Pidog
.
tail_move(target_angles, immediately
=
True
, speed
=
50
)
•
target_angles
: It is a two-dimensional array composed of an array of 1 servo angles (referred to as angle
group) as elements. These angle groups will be used to control the angles of the 8 foot servos. If multiple angle
groups are written, the unexecuted angle groups will be stored in the cache.
•
immediately
: When calling the function, set this parameter to
True
, the cache will be cleared immediately
to execute the newly written angle group; if the parameter is set to
False
, the newly written The incoming
angular group is added to the execution queue.
•
speed
: The speed at which the angular group is executed.
PiDog’s tail servo control also has some supporting functions:
Pidog
.
is_tail_done()
whether all the tail actions in the buffer to be executed
Pidog
.
wait_tail_done()
wait for all the tail actions in the buffer to be executed
Pidog
.
tail_stop()
clear all the tail actions of leg in the buffer, to make tail servo stop
Here are some common usages:
1. Wag tail for 10 seconds.
from
pidog
import
Pidog
import
time
my_dog
=
Pidog()
for
_
in
range
(
99
):
my_dog
.
tail_move([[
30
],[
-
30
]], immediately
=
False
, speed
=
30
)
# keep 10s
time
.
sleep(
10
)
my_dog
.
tail_stop()
2.3. Easy Coding
79
Содержание 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 ...