-
Notifications
You must be signed in to change notification settings - Fork 1
/
live_dynamic_example_subscriber.py
95 lines (88 loc) · 2.6 KB
/
live_dynamic_example_subscriber.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Copyright (c) 2022. Tudor Oancea, EPFL Racing Team Driverless
import numpy as np
from data_visualization import *
np.random.seed(127)
def main():
plot = Plot(
mode=PlotMode.LIVE_DYNAMIC,
col_nbr=2,
row_nbr=2,
figsize=(7, 3),
sampling_time=0.1,
interval=10,
)
plot.add_subplot(
subplot_name="map",
row_idx=range(2),
col_idx=0,
subplot_type=SubplotType.SPATIAL,
unit="m",
show_unit=True,
curves={
"cones": {
"data": np.random.rand(10, 2) * np.pi,
"curve_type": CurveType.STATIC,
"curve_style": CurvePlotStyle.SCATTER,
"mpl_options": {"color": "red", "marker": "^"},
},
"trajectory": {
"data": None,
"curve_type": CurveType.REGULAR,
"curve_style": CurvePlotStyle.PLOT,
"mpl_options": {"color": "blue"},
},
"trajectory_pred": {
"data": None,
"curve_type": CurveType.PREDICTION,
"curve_style": CurvePlotStyle.PLOT,
"mpl_options": {"color": "green"},
},
},
)
plot.add_subplot(
subplot_name="orientation",
row_idx=0,
col_idx=1,
subplot_type=SubplotType.TEMPORAL,
unit="rad",
show_unit=True,
curves={
"orientation": {
"data": None,
"curve_type": CurveType.REGULAR,
"curve_style": CurvePlotStyle.PLOT,
"mpl_options": {"color": "blue"},
},
"orientation_pred": {
"data": None,
"curve_type": CurveType.PREDICTION,
"curve_style": CurvePlotStyle.PLOT,
"mpl_options": {"color": "green"},
},
},
)
plot.add_subplot(
subplot_name="steering",
row_idx=1,
col_idx=1,
subplot_type=SubplotType.TEMPORAL,
unit="rad",
show_unit=True,
curves={
"steering": {
"data": None,
"curve_type": CurveType.REGULAR,
"curve_style": CurvePlotStyle.STEP,
"mpl_options": {"color": "blue"},
},
"steering_pred": {
"data": None,
"curve_type": CurveType.PREDICTION,
"curve_style": CurvePlotStyle.STEP,
"mpl_options": {"color": "green"},
},
},
)
plot.plot(show=True)
if __name__ == "__main__":
main()