-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangle_test.py
55 lines (46 loc) · 1.16 KB
/
angle_test.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
import pypot.dynamixel
import time
from math import *
fire_ids=[2,4,6]
armangle=90
d=.06
head = int(raw_input())
#arm = degrees(atan((sin(head*pi/180)-d)/ cos(head*pi/180)))
ports = pypot.dynamixel.get_available_ports()
if not ports :
raise IOError("port bhakchodi pel rahe hain")
print "Is port se judna hai",ports[0]
dxl = pypot.dynamixel.DxlIO(ports[0])
ids = dxl.scan(range(25))
print ids
if head>0:
arm = head-135
dxl.set_goal_position({19: head})
dxl.set_goal_position({2:90})
time.sleep(0.01)
dxl.set_goal_position({4:head-135})
dxl.set_goal_position({3:-30})
time.sleep(0.01)
dxl.set_goal_position({1:0})
if head<0:
arm = head+135
dxl.set_goal_position({19: head})
dxl.set_goal_position({1:90})
time.sleep(0.01)
dxl.set_goal_position({3:head+135})
dxl.set_goal_position({4:30})
time.sleep(0.01)
dxl.set_goal_position({2:0})
if head == 0 :
dxl.set_goal_position({19: head})
time.sleep(0.01)
dxl.set_goal_position({2:90})
time.sleep(0.01)
dxl.set_goal_position({4:head-135})
time.sleep(0.01)
dxl.set_goal_position({1:90})
time.sleep(0.01)
dxl.set_goal_position({3:head})
print arm,head
#print dxl.get_present_position([4])
#dxl.enable_torque(ids)