File size: 807 Bytes
ef17c16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# example of Python script using cisstRobotPython

import cisstRobotPython
import numpy

# create a manipulator
r = cisstRobotPython.robManipulator()

# load DH parameters from a .rob file, result is 0 if loaded properly 
r.LoadRobot('../../share/deprecated/dvpsm.rob')

# check the length of the kinematic chain
print('length of kinematic chain: %d' % len(r.links))

# position when all joints are at 0
jp = numpy.zeros(6)
cp = numpy.zeros(shape = (4, 4)) # 4x4 matrix
cp = r.ForwardKinematics(jp)
print('joint position:')
print(jp)
print('cartesian position:')
print(cp)

# for a PSM, joint 3 is along instrument shaft
print('cartesian position for joint position [0,0,0.08,0,0,0]')
jp[2] = 0.08 # 8cm
cp = r.ForwardKinematics(jp)
print('joint position:')
print(jp)
print('cartesian position:')
print(cp)