forked from ediaro23/lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inverse_geometry.py
38 lines (27 loc) · 1.15 KB
/
inverse_geometry.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 6 15:32:51 2023
@author: stonneau
"""
import pinocchio as pin
import numpy as np
from numpy.linalg import pinv,inv,norm,svd,eig
from tools import collision, getcubeplacement, setcubeplacement, projecttojointlimits
from config import LEFT_HOOK, RIGHT_HOOK, LEFT_HAND, RIGHT_HAND, EPSILON
from config import CUBE_PLACEMENT, CUBE_PLACEMENT_TARGET
from tools import setcubeplacement
def computeqgrasppose(robot, qcurrent, cube, cubetarget, viz=None):
'''Return a collision free configuration grasping a cube at a specific location and a success flag'''
setcubeplacement(robot, cube, cubetarget)
#TODO implement
print ("TODO: implement me")
return robot.q0, False
if __name__ == "__main__":
from tools import setupwithmeshcat
from setup_meshcat import updatevisuals
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)
updatevisuals(viz, robot, cube, q0)