-
Notifications
You must be signed in to change notification settings - Fork 0
/
grasp_controller.py
executable file
·41 lines (29 loc) · 1.12 KB
/
grasp_controller.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
from graspit_commander import GraspitCommander
import time
if __name__ == "__main__":
GraspitCommander.clearWorld()
GraspitCommander.loadWorld("plannerMug")
GraspitCommander.approachToContact()
GraspitCommander.setDynamics(True)
GraspitCommander.setDynamics(False)
GraspitCommander.toggleDynamicsController(False)
while not GraspitCommander.dynamicAutoGraspComplete():
r = GraspitCommander.getRobot(0)
print r.robot.dofs
GraspitCommander.setRobotDOFForces([0, 100000000, 100000000, 100000000])
GraspitCommander.stepDynamics(1)
r = GraspitCommander.getRobot(0)
dofs = list(r.robot.dofs)
for i in range(len(dofs)):
dofs[i] -= 0.01
GraspitCommander.toggleAllCollisions(False)
GraspitCommander.autoOpen(0)
GraspitCommander.approachToContact(-10)
GraspitCommander.toggleAllCollisions(True)
GraspitCommander.approachToContact(10)
GraspitCommander.forceRobotDof(dofs)
GraspitCommander.autoGrasp(0)
graspQuality = GraspitCommander.computeQuality()
print "DONE!"
print graspQuality.epsilon
print graspQuality.volume