-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More performant ObjectQuery's implementation #27
Comments
CC: @agalbachicar @tfoote I expect this issue to trigger the creation of implementation-related issues in this and other repos |
One slightly different way to approach this would be to first define which queries are required from maliput_object to a maliput::api::RoadGeometry and then define next steps. From reviewing the code and reading this issue I suspect we just need to do:
Am I missing any other query? |
I would suggest considering always the possibility of implementing the fast approach once and for all backends. Most probably, in maliput::geometry_base. |
In my mind those are the queries I was expecting yes.
I haven't thought about it. Is it something that RoadGeometry should provide? Shouldn't it be part of maliput_object?
How that approach would be? This new RoadGeometry implementation would already reorganize the space into a kdtree, in a way that all the |
Consider the following overloads in the RoadGeometry:
Jumping from one to another seems reasonable, actually, the former query can be converted into the second one as soon as we define a sphere as a |
The only drawback that I see in not having a collection as a KD-tree or R-tree oustide the RoadGeometry is that it becomes really hard to leverage the power of the structure to compute intersections between objects themselves. We could register those objects in the same collection but posterior filtering may degrade the performance. It is also true that if you have an object in space it is very likely to be on the road surface and not flying. |
Exactly. We could either offer 2 different queries to convert to and from Lane space and Inertial space depending on the algorithm to use. Aside from that, we might use this to implement another type of backend that relies on labeled point clouds. Any of the current backends might be exportable to a file that contains information about the connectivity graph, and then all the points per lane. We could use any interpolation method to derive points in between and keep using the kd-tree struct as backend. |
Probably more related to implementation however I agree about probable degradation in performance in that case, nevertheless, one thing that came up to my mind now is that even though at the moment the objects are expected to be static, if we add the ability to change their position, then the tree (for the kdtree impl) will need recomputation. Again, more related to implementation but I wanted to raise that.
This approach sounds like the most beneficial from a user perspective. Like it. |
Proof of conceptI've been working on a proof of concepts for this approach, I created two branches, one in maliput and the other one in maliput_malidrive. Disclaimer: This was implemented for testing purposes and the final approach will certainly be different to this implementation.
ConsiderationsThe RoadGeometry implementation in The kdtree was filled by uniformly sampling the I used Trying this outXodr file map being used: Town07 Brute force algorithm (Current behavior)
Usign kdtree (proof of concept)
Summary of tested maps
ConclusionsFrom the results:
This was just a proof of concept and there is a lot of room for improvements. |
Context
maliput::object::SimpleObjectQuery
complies with the ObjectQuery API however its underlying implementation may not be as performant as desired.The bottleneck happens when querying maliput by using methods like
maliput::api::RoadGeometry::FindRoadPositions
(orToRoadPosition
). The implementations of these methods are full responsibility of the backend, and so, maliput_object's performance is directly affected by the maliput backend that is being used.When using
maliput_malidrive
backend, how theSimpleObjectQuery
implementation performs, is directly affected by the number of lanes of the RoadNetwork as the implementation uses brute force when finding the lanes via FindRoadPosition.Some time measurements.
Proposal
We could detach from the maliput backend implementation's performance by proposing a re-organization of the
RoadNetwork
space into a convenient space-partitioning data structure (like kdtree).Therefore we could create a layer on top of maliput, to reorganize the space and provide FindRoadPositions methods like that can be used later on by this new ObjectQuery implementation.
Suggested Steps for designing
maliput_kdtree
layer/package.maliput
package? (I guess answer of this will be directly connected to whether which kdtree implementation is going to be used (third-library or homemade)kdtree
implementation:maliput_kdtree
necessities. (closest neighbor, etc)Our space will be static (once the roadnetwork is created there aren't expected modifications.)
Note: This issue's description is expected to be iterated if needed
The text was updated successfully, but these errors were encountered: