SunFounder PiDog Kit, Release 1.0
(continued from previous page)
my_dog.legs_move([[45, 10, -45, -10, 45, 10, -45, -10]], speed=50)
# pushup preparation
my_dog.legs_move([[45, 35, -45, -35, 80, 70, -80, -70]], immediately=False, speed=20)
# pushup
for _ in range(99):
my_dog.legs_move([[90, -30, -90, 30, 80, 70, -80, -70],
[45, 35, -45, -35, 80, 70, -80, -70]], immediately=False,
˓→speed=30)
# keep 10s
time.sleep(10)
# stop and half stand
my_dog.legs_move([[45, 10, -45, -10, 45, 10, -45, -10]], immediately=True, speed=50)
PiDog’s leg control also has the following functions that can be used together:
Pidog.is_legs_done()
This function is used to determine whether the angle group in the cache has been executed. If yes, return True;
otherwise, return False.
Pidog.wait_legs_done()
Suspends the program until the angle groups in the cache have been executed.
Pidog.legs_stop()
Empty the angular group in the cache.
2.3.3 Head Move
The control of PiDog’s head servo is implemented by the following functions.
Pidog.head_move(target_yrps, roll_comp=0, pitch_comp=0, immediately=True, speed=50)
• target_angles : It is a two-dimensional array composed of an array of 3 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.
• roll_comp : Provides angular compensation on the roll axis.
• pitch_comp : Provides angle compensation on the pitch axis.
• 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 head servo control also has some supporting functions:
Pidog.is_head_done()
Whether all the head actions in the buffer to be executed
2.3. Easy Coding 77