SunFounder PiDog Kit, Release 1.0
(continued from previous page)
(f
"legs buffer length (5s): {len(my_dog.legs_action_buffer)}"
)
# stop action & show buffer length
my_dog
.
stop_and_lie()
(f
"legs buffer length (stop): {len(my_dog.legs_action_buffer)}"
)
except
KeyboardInterrupt
:
pass
except
Exception
as
e:
(f
"
\033
[31mERROR: {e}
\033
[m"
)
finally
:
(
"closing ..."
)
my_dog
.
close()
# close all the servo threads
2.3.6 Do Preset Action
Some commonly used actions have been pre-written in PiDog’s library. You can call the following function to make
PiDog do these actions directly.
Pidog
.
do_action(action_name, step_count
=
1
, speed
=
50
)
•
action_name
: Action name, the following strings can be written.
–
"sit"
–
"half_sit"
–
"stand"
–
"lie"
–
"lie_with_hands_out"
–
"forward"
–
"backward"
–
"turn_left"
–
"turn_right"
–
"trot"
–
"stretch"
–
"pushup"
–
"doze_off"
–
"nod_lethargy"
–
"shake_head"
–
"tilting_head_left"
–
"tilting_head_right"
–
"tilting_head"
–
"head_bark"
–
"head_up_down"
2.3. Easy Coding
81
Содержание 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 ...