1
from mayaviclient import RemoteMlab
5
def __init__(self, npts=100000, Rotate=False, title=''):
6
self.mlab = RemoteMlab()
17
self.p3d = self.mlab.getreturnvar()
18
self.lasttrajectorypoint = None
19
self.trajectory_point = np.eye(4)
21
def addmappts(self, xyzs, colour=None):
23
self.mlab.ex("""{0}.mlab_source.x = a0""".format(self.p3d), xyzs[:, 0],
25
self.mlab.ex("""{0}.mlab_source.y = a0""".format(self.p3d), xyzs[:, 1],
27
self.mlab.ex("""{0}.mlab_source.z = a0""".format(self.p3d), xyzs[:, 2],
29
self.mlab.ex("""{0}.mlab_source.t = a0""".format(self.p3d), xyzs[:, 2],
32
def setrobotpose(self, transform_mat):
33
"""Display robot position with given pose"""
34
self.trajectory_point[:3, :3] = transform_mat[:3, :3]
35
rotv = np.dot(np.array([0, 0, 1]), transform_mat[:3, :3])
36
if self.lasttrajectorypoint:
37
self.mlab.ex("""{0}.mlab_source.u = a0""".format(
38
self.lasttrajectorypoint), rotv[0])
39
self.mlab.ex("""{0}.mlab_source.v = a0""".format(
40
self.lasttrajectorypoint), rotv[1])
41
self.mlab.ex("""{0}.mlab_source.w = a0""".format(
42
self.lasttrajectorypoint), rotv[2])
44
def addtrajectorypoint(self, xyz):
45
"""Display robot position at given coordinate"""
46
self.trajectory_point[:3, 3] = np.array(xyz)
51
self.trajectory_point[0, 3],
52
self.trajectory_point[1, 3],
53
self.trajectory_point[2, 3],
55
self.lasttrajectorypoint = self.mlab.getreturnvar()
57
def getkeypress(self):
60
def setminmax(self, colourmin, colourmax):
63
def setautominmax(self, Bool=True):
66
def set_orthographic(self, Bool=False):
69
def setleftpts(self, xyzs, M=None):
72
def setrightpts(self, xyzs, M=None):
75
def setspinpts(self, xyzs, M=None):
81
def setinfostr(self, labeltext):