maliput / delphyne_gui

Graphical frontend and tools for Delphyne
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Unable to open XODR using maliput_viewer.sh #195

Closed liangfok closed 5 years ago

liangfok commented 5 years ago

When I try to open install/malidrive/share/malidrive/resources/odr/RRFigure8.xodr using maliput_viewer.sh, I get the following error:

$ ./install/delphyne-gui/bin/maliput_viewer.sh 
[Msg] Visualizer 0.1.0
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-liang'
[GUI] [Msg] Applying stylesheet [:/style.qss]
[GUI] [Msg] Loading config [/home/liang/dev/dsim_workspace/install/delphyne-gui/share/delphyne/layouts/layout_maliput_viewer.config]
[GUI] [Msg] Loading plugin [MaliputViewerWidget]
[GUI] [Msg] Added plugin [MaliputViewerWidget] to main window
[GUI] [Msg] Loading plugin [ignition-rendering0-ogre]
[GUI] [Msg] About to load [/home/liang/dev/dsim_workspace/install/malidrive/share/malidrive/resources/odr/RRFigure8.xodr] maliput file.
18_2_1's length is 0.0459861 and is smaller than linear_tolerance: 0.05
18_4_1's length is 0.0459466 and is smaller than linear_tolerance: 0.05
19_2_-1's length is 0.0459861 and is smaller than linear_tolerance: 0.05
19_4_-1's length is 0.0459466 and is smaller than linear_tolerance: 0.05
32_2_1's length is 0.0459861 and is smaller than linear_tolerance: 0.05
32_4_1's length is 0.0459862 and is smaller than linear_tolerance: 0.05
45_2_1's length is 0.0459861 and is smaller than linear_tolerance: 0.05
45_4_1's length is 0.0460257 and is smaller than linear_tolerance: 0.05
65_2_1's length is 0.0459466 and is smaller than linear_tolerance: 0.05
65_4_1's length is 0.0459862 and is smaller than linear_tolerance: 0.05
75_2_1's length is 0.0459466 and is smaller than linear_tolerance: 0.05
75_4_1's length is 0.0460257 and is smaller than linear_tolerance: 0.05
95_2_1's length is 0.0459862 and is smaller than linear_tolerance: 0.05
95_4_1's length is 0.0460257 and is smaller than linear_tolerance: 0.05
96_2_-1's length is 0.0459862 and is smaller than linear_tolerance: 0.05
96_4_-1's length is 0.0460257 and is smaller than linear_tolerance: 0.05
[GUI] [Msg] Loaded [/home/liang/dev/dsim_workspace/install/malidrive/share/malidrive/resources/odr/RRFigure8.xodr] maliput file.
[GUI] [Msg] Loading RoadGeometry meshes of RRFigure8.xodr
abort: Failure at /home/liang/dev/dsim_workspace/src/delphyne_gui/visualizer/maliput_mesh_builder.cc:175 in DrawLaneArrow(): condition '(s_offset + s_size) <= lane->length()' failed.
./install/delphyne-gui/bin/maliput_viewer.sh: line 36: 15880 Aborted                 (core dumped) visualizer --layout=${DELPHYNE_GUI_RESOURCE_ROOT}/layouts/layout_maliput_viewer.config "$@"

I tested all of the .xodr files in install/malidrive/share/malidrive/resources/odr/. here are the results:

Works (loads):
./install/malidrive/share/malidrive/resources/odr/ArcElevatedRoad.xodr
./install/malidrive/share/malidrive/resources/odr/ArcLane.xodr
./install/malidrive/share/malidrive/resources/odr/ComplexLaneSection.xodr  - but can't zoom into the road network
./install/malidrive/share/malidrive/resources/odr/Crossing8Course.xodr
./install/malidrive/share/malidrive/resources/odr/CrossingComplex8Course.xodr - but can't zoom into road network
./install/malidrive/share/malidrive/resources/odr/Highway.xodr
./install/malidrive/share/malidrive/resources/odr/LeftRightSidedRoads.xodr
./install/malidrive/share/malidrive/resources/odr/LineMultipleSections.xodr
./install/malidrive/share/malidrive/resources/odr/LShapeRoad.xodr
./install/malidrive/share/malidrive/resources/odr/LShapeSection.xodr
./install/malidrive/share/malidrive/resources/odr/Roundabout.xodr
./install/malidrive/share/malidrive/resources/odr/SingleLane.xodr
./install/malidrive/share/malidrive/resources/odr/SpiralRoad.xodr
./install/malidrive/share/malidrive/resources/odr/Town01.xodr
./install/malidrive/share/malidrive/resources/odr/TShapeRoad.xodr

Does not work (crashes):
./install/malidrive/share/malidrive/resources/odr/Figure8.xodr
./install/malidrive/share/malidrive/resources/odr/Leghorn.xodr
./install/malidrive/share/malidrive/resources/odr/onramp.xodr
./install/malidrive/share/malidrive/resources/odr/RRFigure8.xodr
./install/malidrive/share/malidrive/resources/odr/RRLongRoad.xodr
./install/malidrive/share/malidrive/resources/odr/Town02.xodr
./install/malidrive/share/malidrive/resources/odr/Town03.xodr
./install/malidrive/share/malidrive/resources/odr/Town04.xodr
./install/malidrive/share/malidrive/resources/odr/Town05.xodr
./install/malidrive/share/malidrive/resources/odr/Town06.xodr
./install/malidrive/share/malidrive/resources/odr/Town07.xodr
BMarchi commented 5 years ago

I'm looking at this issue and something interesting is that any of the files that works, they don't have lanes that violate linear tolerances. The following files crash when I try to convert them to obj using malidrive_to_obj:

Leghorn.xodr
RRFigure8.xodr
Town03.xodr
Town07.xodr

And the next ones hang on trying to convert them (I waited 10 minutes and nothing happened):

onramp.xodr
Town04.xodr
Town05.xodr
Town06.xodr

For example, if we run malidrive_to_obj with RRLongroad.xodr we get
image. I opened the generated obj with blender and everything seems okay, I guess. I decided to not draw the directional arrows in the lane and not draw the segments which don't fulfill the linear tolerance, which is "the culprit" of this abort: Failure at /home/liang/dev/dsim_workspace/src/delphyne_gui/visualizer/maliput_mesh_builder.cc:175 in DrawLaneArrow(): condition '(s_offset + s_size) <= lane->length()' failed.. Doing so, I found out that ignition is sucking the ram and CPU updating the camera over and over again. I was wondering if it's possible to have RRLongroad.xodr without any violation with the lineal tolerance to check if this could be causing some unexpected behaviour

liangfok commented 5 years ago

/cc: @andrewbest-tri regarding whether RRLongRoad.xodr can be updated to not have any linear tolerance violation.

andrewbest-tri commented 5 years ago

I will see if I can re-export today with latest RoadRunner. We should also look into Malidrive's extensive queries tests, as all of the XODR maps in Malidrive pass the test I believe.

hidmic commented 5 years ago

I will see if I can re-export today with latest RoadRunner.

Thanks. We can look into malidrive for sure, but I'd like to have as much insight as possible to reduce the debugging time.

liangfok commented 5 years ago

@andrewbest-tri, the new figure8_trafficlights.xodr cannot be opened using Delphine GUI:

$ ./install/delphyne-gui/bin/maliput_viewer.sh 
[Msg] Visualizer 0.1.0
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-liang'
[GUI] [Msg] Applying stylesheet [:/style.qss]
[GUI] [Msg] Loading config [/home/liang/dev/maliput_workspace/install/delphyne-gui/share/delphyne/layouts/layout_maliput_viewer.config]
[GUI] [Msg] Loading plugin [MaliputViewerWidget]
[GUI] [Msg] Added plugin [MaliputViewerWidget] to main window
[GUI] [Msg] Loading plugin [ignition-rendering0-ogre]
[GUI] [Msg] About to load [/home/liang/dev/maliput_workspace/src/malidrive/resources/figure8_trafficlights/figure8_trafficlights.xodr] maliput file.
[GUI] [Msg] Loaded [/home/liang/dev/maliput_workspace/src/malidrive/resources/figure8_trafficlights/figure8_trafficlights.xodr] maliput file.
[GUI] [Msg] Loading RoadGeometry meshes of figure8_trafficlights.xodr
abort: Failure at /home/liang/dev/maliput_workspace/src/delphyne_gui/visualizer/maliput_mesh_builder.cc:174 in DrawLaneArrow(): condition '(s_offset + s_size) <= lane->length()' failed.
./install/delphyne-gui/bin/maliput_viewer.sh: line 36: 24029 Aborted                 (core dumped) visualizer --layout=${DELPHYNE_GUI_RESOURCE_ROOT}/layouts/layout_maliput_viewer.config "$@"

I discovered this when I failed to generate an OBJ of it:

$ ./install/malidrive/bin/malidrive/applications/malidrive_to_obj src/malidrive/resources/figure8_trafficlights/figure8_trafficlights.xodr .
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
Aborted (core dumped)

Do you know what difference between Figure8.xodr and figure8_trafficlights.xodr could have made the latter incompatible with some of our tools?

BMarchi commented 5 years ago

These days I was working on #198 , which made me push some changes to ignition libraries to make some things work better. We are still waiting for one last change to get merged so the binaries get released. In the meantime, I got back to work on this and for some meshes that contains some thousands of vertices, the visualizer kinda hangs or takes too much time to load. The camera also lags the whole pc when it's moved so I started to see the simplification method that it's provided by maliput. I saw that this method doesn't triangulate the mesh at all and we require triangles to work with our renderer. I was trying to implement the ear-clipping algorithm to triangulate, but it's too slow for big meshes. Better algorithms are quite difficult to implement so we thought about some ideas to tackle this issue:

  1. Modify the simplification method so it triangulates the model properly as it simplifies:
    • We avoid having to iterate trough a bunch of vertices more than once
  2. Implement a better algorithm for triangulation
    • This would require some time, first to understand the algorithm and more time to implement it.
  3. Discuss with OSRF the possibility to work together in a triangulation method for 3d polygons for their libraries.
  4. Understand and copy/refactor the code for triangulation that lives in tinyobj (it's the ear clipping method with some modifications).

For the moment, my preference would be between 1 and 3, since using the ear-clipping algorithm for big meshes is not that good, but I'm not an expert in mesh generation/simplification so I would like to hear everyone's opinion.

BMarchi commented 5 years ago

After some discussion, with the huge help from @agalbachicar , we were able to load all files from malidrive by modifying the mesh generation algorithm that was already in maliput. You can see the changes and discuss further here.

BMarchi commented 5 years ago

This issue was solved by:

Closing this.