-
Notifications
You must be signed in to change notification settings - Fork 17
/
path.py
48 lines (33 loc) · 1.24 KB
/
path.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 21 11:44:32 2023
@author: stonneau
"""
import pinocchio as pin
import numpy as np
from numpy.linalg import pinv
from config import LEFT_HAND, RIGHT_HAND
import time
#returns a collision free path from qinit to qgoal under grasping constraints
#the path is expressed as a list of configurations
def computepath(qinit,qgoal,cubeplacementq0, cubeplacementqgoal):
#TODO
return [qinit, qgoal]
pass
def displaypath(robot,path,dt,viz):
for q in path:
viz.display(q)
time.sleep(dt)
if __name__ == "__main__":
from tools import setupwithmeshcat
from config import CUBE_PLACEMENT, CUBE_PLACEMENT_TARGET
from inverse_geometry import computeqgrasppose
robot, cube, viz = setupwithmeshcat()
q = robot.q0.copy()
q0,successinit = computeqgrasppose(robot, q, cube, CUBE_PLACEMENT, viz)
qe,successend = computeqgrasppose(robot, q, cube, CUBE_PLACEMENT_TARGET, viz)
if not(successinit and successend):
print ("error: invalid initial or end configuration")
path = computepath(q0,qe,CUBE_PLACEMENT, CUBE_PLACEMENT_TARGET)
displaypath(robot,path,dt=0.5,viz=viz) #you ll probably want to lower dt