-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRotate.py
56 lines (46 loc) · 1.59 KB
/
Rotate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from LegsControl import *
def RotateRight(front_left, front_right, rear_left, rear_right):
front_left_r = Process(target=frontLeg,args=(front_left,))
rear_right_r = Process(target=rearLeg,args=(rear_right,))
upLegs = Process(target=legsUP,args=(front_right,rear_left,))
front_left_r.start()
rear_right_r.start()
upLegs.start()
front_left_r.join()
rear_right_r.join()
upLegs.join()
def RotateLeft(front_left, front_right, rear_left, rear_right):
front_left_r = Process(target=frontLeg,args=(front_right,))
rear_right_r = Process(target=rearLeg,args=(rear_left,))
upLegs = Process(target=legsUP,args=(front_left,rear_right,))
front_left_r.start()
rear_right_r.start()
upLegs.start()
front_left_r.join()
rear_right_r.join()
upLegs.join()
def frontLeg(leg):
leg.move_h2(MIN_h2)
for x in range(MAX_h1_front, MIN_h1_front, -1):
leg.move_h1(x)
time.sleep(DELAY)
leg.move_h2(MAX_h2_front)
for x in range(MIN_h1_front, MAX_h1_front):
leg.move_h1(x)
time.sleep(DELAY)
def rearLeg(leg):
leg.move_h2(MIN_h2)
for x in range(MIN_h1_rear, MIN_h1_rear-h1_moving_angle,-1):
leg.move_h1(x)
time.sleep(DELAY)
leg.move_h2(MAX_h2_rear)
for x in range(MIN_h1_rear-h1_moving_angle, MIN_h1_rear):
leg.move_h1(x)
time.sleep(DELAY)
def legsUP(legFront, legRear):
time.sleep((h1_moving_angle+10) * DELAY)
legFront.move_h2(MIN_h2)
legRear.move_h2(MIN_h2)
time.sleep((h1_moving_angle-10) * DELAY)
legFront.move_h2(MAX_h2_front)
legRear.move_h2(MAX_h2_rear)