-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
33 lines (25 loc) · 918 Bytes
/
main.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
from pg_classes import *
if __name__ == '__main__':
# Pose Graph creatin
pg = PoseGraph()
# Read Pose Graph from files
pg.read_graph(v_data = 'Data/Vertices.dat', e_data = 'Data/Edges.dat')
# Plot Unoptimized Pose Graph
plt.figure(1)
pg.plot_graph(title = 'Unoptimized Graph', show_constraints = False)
# Plot Unoptimized Pose Graph with constraints
plt.figure(2)
pg.plot_graph(title = 'Unoptimized Graph with Constraints', show_constraints = True)
# Graph Optimization
norm_dX = pg.optimize(max_iterations = 20, tolerance = 0.1)
# Plot Graph Convergence
plt.figure(3)
plt.plot(norm_dX, color = 'green')
plt.title('Pose Graph updates per iteration')
plt.ylabel('|dX|')
plt.xlabel('iteration')
plt.grid()
# Plot Optimized Graph
plt.figure(4)
pg.plot_graph(title = 'Optimized Graph', show_constraints = True)
plt.show()