编译:
bazel build //modules/tools/realtime_plot:realtime_plot
运行:
./bazel-bin/modules/tools/realtime_plot/realtime_plot
运行后报错,原因?
Traceback (most recent call last):
File “/apollo/./bazel-bin/modules/tools/realtime_plot/realtime_plot.runfiles/apollo/modules/tools/realtime_plot/realtime_plot.py”, line 261, in
main(sys.argv)
File “/apollo/./bazel-bin/modules/tools/realtime_plot/realtime_plot.runfiles/apollo/modules/tools/realtime_plot/realtime_plot.py”, line 242, in main
ax1.draw_artist(ax1.patch)
File “/usr/local/lib/python3.6/dist-packages/matplotlib/axes/_base.py”, line 2760, in draw_artist
raise AttributeError("draw_artist can only be used after an "
AttributeError: draw_artist can only be used after an initial draw which caches the renderer
临时方案:通过更新代码,先将数据打印出来,通过matlab进行显示,观察数据,待进一步了解后解决上述问题
def callback_planning(self, data): #add by sam #################################################################### print("planning data received") ################################################################################ """New Planning Trajectory""" if self.stgraph: st_s, st_t, polygons_s, polygons_t = proto_utils.flatten( data.debug.planning_data.st_graph, ['speed_profile.s', 'speed_profile.t', 'boundary.point.s', 'boundary.point.t']) with self.lock: for i in range(len(st_s)): self.ax[i].new_planning(st_t[i], st_s[i], polygons_t[i], polygons_s[i]) else: if len(data.trajectory_point) == 0: print(data) return x, y, speed, theta, kappa, acc, relative_time = np.array( proto_utils.flatten(data.trajectory_point, ['path_point.x', 'path_point.y', 'v', 'path_point.theta', 'path_point.kappa', 'a', 'relative_time'])) relative_time += data.header.timestamp_sec with self.lock: #add by sam #################################################################### print(x) print(y) ################################################################################ self.ax[0].new_planning(relative_time, x, y) self.ax[1].new_planning(relative_time, speed) if self.ax[2].title == "Curvature": self.ax[2].new_planning(relative_time, kappa) if self.ax[3].title == "Heading": self.ax[3].new_planning(relative_time, theta) else: self.ax[3].new_planning(relative_time, acc)
其中一组数据显示如下:
[587067.69582949 587067.77710254 587067.86076179 587067.94442104 587068.02808029 587068.11173954 587068.19558493 587068.28162801 587068.3676711 587068.45371418 587068.53975727 587068.62580035 587068.71408782 587068.80237529 587068.89072576 587068.98021707 587069.06970839 587069.1591997 587069.24869101 587069.33818232 587069.42959922 587069.52101612 587069.61251721 587069.7049791 587069.79744099 587069.88990289 587069.98236478 587070.07482667 587070.1690552 587070.26328372 587070.35751224 587070.45174076 587070.54613 587070.64203868 587070.73794737 587070.83385606 587070.92976475 587071.02567343 587071.12334492 587071.221204 587071.31906308 587071.41692215 587071.51478123 587071.61264031 587071.71219181 587071.8117433 587071.9112948 587072.0108463 587072.11039042 587072.2116581 587072.31292578 587072.41419346 587072.51546114 587072.61672882 587072.71974521 587072.82276161 587072.92577801 587073.0287944 587073.13179081 587073.23651198 587073.34123315 587073.44595431 587073.55067548 587073.65539664 587073.76179349 587073.86819034 587073.97458719 587074.08096753 587074.18734535 587074.29532549 587074.40330563 587074.51128577 587074.61926592 587074.72724606 587074.83673635 587074.94622629 587075.05569887 587075.16517144 587075.27464402 587075.38551871 587075.49639341 587075.6072681 587075.7181428 587075.82901749 587075.94116807 587076.0533087 587076.16544933 587076.27758996 587076.38973059 587076.95617975 587077.5276446 587078.10343778 587078.68283153 587079.26507113 587079.84944769 587080.43521052 587081.02164719 587081.60805648 587082.19373024 587082.77802262 587083.36027935 587083.93988104 587084.51624418 587085.08879171 587085.657005 587086.22037559 587086.7784299 587087.33073373 587087.87687285 587088.41648037 587088.94920592 587089.47474503 587089.99281782 587090.50318116 587091.00562434 587091.49996765 587091.98606781 587092.46380981 587092.93311622 587093.39393677 587093.84625852 587094.29009791 587094.72550382 587095.15255592 587095.57136292 587095.98206764 587096.38483472 587096.77986612 587097.16738321 587097.54763711 587097.92090226 587098.28747229 587098.64766655 587099.00181746 587099.35027508 587099.69340359 587100.03157276 587100.36516218 587100.69455272 587101.02012033 587101.342239 587101.66126942 587101.97755329 587102.29141427 587102.60314577 587102.91300424 587103.22120858 587103.52792733 587103.83327086] [4141571.48191421 4141571.45657634 4141571.43049455 4141571.40441275 4141571.37833096 4141571.35224917 4141571.32612202 4141571.29920354 4141571.27228506 4141571.24536658 4141571.2184481 4141571.19152962 4141571.16390899 4141571.13628836 4141571.10865239 4141571.08058045 4141571.05250852 4141571.02443658 4141570.99636464 4141570.9682927 4141570.93961674 4141570.91094078 4141570.88224438 4141570.85316486 4141570.82408533 4141570.79500581 4141570.76592628 4141570.73684676 4141570.70721162 4141570.67757649 4141570.64794135 4141570.61830622 4141570.5886321 4141570.55837497 4141570.52811784 4141570.49786072 4141570.46760359 4141570.43734646 4141570.40654304 4141570.37562086 4141570.34469869 4141570.31377652 4141570.28285435 4141570.25193217 4141570.22047522 4141570.18901826 4141570.1575613 4141570.12610435 4141570.09462405 4141570.06254355 4141570.03046305 4141569.99838255 4141569.96630205 4141569.93422156 4141569.90158708 4141569.86895261 4141569.83631814 4141569.80368367 4141569.77098618 4141569.73773776 4141569.70448934 4141569.67124092 4141569.6379925 4141569.60474408 4141569.57096364 4141569.53718319 4141569.50340275 4141569.46957039 4141569.43573007 4141569.40138002 4141569.36702996 4141569.33267991 4141569.29832986 4141569.26397981 4141569.22914936 4141569.19431781 4141569.15943173 4141569.12454564 4141569.08965956 4141569.05432665 4141569.01899375 4141568.98366084 4141568.94832794 4141568.91299503 4141568.87723503 4141568.84144381 4141568.8056526 4141568.76986139 4141568.73407017 4141568.55323838 4141568.37061292 4141568.18649955 4141568.00113379 4141567.81469555 4141567.62751194 4141567.43976293 4141567.25171357 4141567.06361446 4141566.87563269 4141566.68805712 4141566.50106918 4141566.31487082 4141566.12968169 4141565.94564299 4141565.76297542 4141565.5818262 4141565.40234367 4141565.2246895 4141565.04897713 4141564.87535577 4141564.703914 4141564.53477051 4141564.36800755 4141564.20370863 4141564.04194489 4141563.88277076 4141563.72624105 4141563.57238574 4141563.4212395 4141563.27280973 4141563.12710909 4141562.98413173 4141562.84386402 4141562.7062812 4141562.57134375 4141562.43901553 4141562.30922852 4141562.18193425 4141562.05705221 4141561.93450645 4141561.81421099 4141561.69606303 4141561.57997001 4141561.46581828 4141561.35349586 4141561.24289124 4141561.13387773 4141561.02633842 4141560.92015272 4141560.81519145 4141560.71134136 4141560.6084869 4141560.50651042 4141560.40531474 4141560.30480565 4141560.20489338 4141560.10551379 4141560.00661323 4141559.90815106]
打印出的数据绘图如下,对于我们了解planning模块的数据结构有所帮助
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)