EasyManua.ls Logo

SunFounder PiDog - Page 83

Default Icon
109 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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 Leg Move.
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

Related product manuals