-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_teach_path.py
46 lines (33 loc) · 1.35 KB
/
plot_teach_path.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
39
40
41
42
43
44
45
import os
import matplotlib.pyplot as plt
import numpy as np
from vtr_utils.bag_file_parsing import Rosbag2GraphFactory
from vtr_pose_graph.graph_iterators import PriviledgedIterator
import vtr_pose_graph.graph_utils as g_utils
import vtr_regression_testing.path_comparison as vtr_path
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(
prog = 'Verify Point Cloud',
description = 'Plots point cloud to verify alignment')
parser.add_argument('-g', '--graph', default=os.getenv("VTRDATA")) # option that takes a value
args = parser.parse_args()
offline_graph_dir = args.graph
factory = Rosbag2GraphFactory(offline_graph_dir)
test_graph = factory.buildGraph()
print(f"Graph {test_graph} has {test_graph.number_of_vertices} vertices and {test_graph.number_of_edges} edges")
g_utils.set_world_frame(test_graph, test_graph.root)
v_start = test_graph.root
path_matrix = vtr_path.path_to_matrix(test_graph, PriviledgedIterator(v_start))
print(path_matrix.shape)
x = []
y = []
t = []
for v, e in PriviledgedIterator(v_start):
x.append(v.T_v_w.r_ba_ina()[0])
y.append(v.T_v_w.r_ba_ina()[1])
t.append(v.stamp / 1e9)
plt.figure(0)
plt.plot(x, y, label="Teach", linewidth=5)
plt.axis('equal')
plt.show()