EasyManua.ls Logo

SunFounder PiDog - Page 80

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)
head_init_angles = [0, 0, -25],
tail_init_angle= [0]
)
2.3.2 Leg Move
PiDog’s leg movements are implemented by the following functions.
Pidog.legs_move(target_angles, immediately=True, speed=50)
target_angles: It is a two-dimensional array composed of an array of 8 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.
Some common usages are listed below:
1. Take action immediately.
from pidog import Pidog
import time
my_dog = Pidog()
# half stand
my_dog.legs_move([[45, 10, -45, -10, 45, 10, -45, -10]], speed=50)
2. Add some angular groups to the execution queue.
from pidog import Pidog
import time
my_dog = Pidog()
# half stand
my_dog.legs_move([[45, 10, -45, -10, 45, 10, -45, -10]], speed=50)
# multiple actions
my_dog.legs_move([[45, 35, -45, -35, 80, 70, -80, -70],
[90, -30, -90, 30, 80, 70, -80, -70],
[45, 35, -45, -35, 80, 70, -80, -70]], immediately=False,
˓speed=30)
3. Perform repetitions within 10 seconds.
from pidog import Pidog
import time
my_dog = Pidog()
# half stand
(continues on next page)
76 Chapter 2. Play with Python

Related product manuals