8000 improve graphics, doco · hanm2019/robotics-toolbox-python@f43c6e0 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit f43c6e0

Browse files
committed
improve graphics, doco
1 parent d3dd8de commit f43c6e0

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

roboticstoolbox/mobile/PoseGraph.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,14 @@ def __init__(self, filename, laser=False, verbose=False):
114114

115115
# indices into ROBOTLASER1 record for the 3x3 info matrix in column major
116116
# order
117+
# IXX IXY IXT IYY IYT ITT
118+
# 6 7 8 9 10 11
119+
# 0 1 2 3 4 5
117120
g2o = [0, 1, 2, 1, 3, 4, 2, 4, 5]
118-
toro = [0, 1, 4, 1, 2, 5, 4, 5, 3]
121+
# IXX IXY IYY ITT IXT IYT
122+
# 6 7 8 9 10 11
123+
# 0 1 2 3 4 5
124+
toro = [0, 1, 4, 1, 2, 5, 4, 5, 3]
119125

120126
# we keep an array self. = vindex(gi) to map g2o vertex index to PGraph vertex index
121127

@@ -192,7 +198,7 @@ def __init__(self, filename, laser=False, verbose=False):
192198
# IXX IXY IYY ITT IXT IYT
193199
# 6 7 8 9 10 11
194200
d = np.array([float(x) for x in tokens[6:12]])
195-
info = d[g2o].reshape((3,3))
201+
info = d[toro].reshape((3,3))
196202

197203
# create the edge
198204
v1 = self.graph[v1]
@@ -239,7 +245,7 @@ def __init__(self, filename, laser=False, verbose=False):
239245
filetype = "TORO/LAGO"
240246
else:
241247
filetype = "g2o"
242-
print(f"loaded {filetype} format file: {self.graph.n} nodes, {self.graph.ne} edges")
248+
print(f"loaded {filetype} format file: {self.graph.n} vertices, {self.graph.ne} edges")
243249

244250
if nlaser > 0:
245251
lasermeta = [float(x) for x in lasermeta]
@@ -280,7 +286,11 @@ def time(self, i):
280286
return self.vindex[i].time
281287

282288
def plot(self, **kwargs):
283-
self.graph.plot(**kwargs)
289+
if not 'vertex' in kwargs:
290+
kwargs['vertex'] = dict(markersize=8, markerfacecolor='blue', markeredgecolor='None')
291+
if not 'edge' in kwargs:
292+
kwargs['edge'] = dict(linewidth=1, color='black')
293+
self.graph.plot(colorcomponents=False, **kwargs)
284294
plt.xlabel('x')
285295
plt.ylabel('y')
286296
plt.grid(True)

0 commit comments

Comments
 (0)
0