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
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 ...