Skip to content
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

SetLinkGeometriesFromGroup is slow because FCL geometries are always re-computed from scratch for all the geometry groups #1049

Open
eisoku9618 opened this issue Feb 1, 2022 · 0 comments

Comments

@eisoku9618
Copy link
Collaborator

Here is a snippet to reproduce this issue.

from openravepy.databases import convexdecomposition
cdmodel = convexdecomposition.ConvexDecompositionModel(robot=robot, padding=0.010)
if not cdmodel.load():
   cdmodel.generate(padding=0.010)
linkGeometryGroups = [None] * len(robot.GetLinks())
for ilink, link in enumerate(robot.GetLinks()):
   linkGeometryGroups[link.GetIndex()] = cdmodel.GetGeometryInfosFromLink(ilink)
robot.SetLinkGroupGeometries('padding=0.010', linkGeometryGroups)

robot.SetLinkGeometriesFromGroup('padding=0.010') # time consumping part

When we call SetLinkGeometriesFromGroup with a geometry group name (padding=0.010 in this case), _ResetCurrentGeometryCallback in _vlistRegisteredCallbacks is called. There are following 2 problems and it is time consuming.

  1. _ResetCurrentGeometryCallback calls InitKinBody, and InitKinBody always computes FCL geometries from scratch.
  2. _ResetCurrentGeometryCallback is called for all the geometry groups (padding=0.010 and self in this case) even though we have specified a certain geometry group name (padding=0.010 in this case)

In my case, roughly speaking, 1 call of InitKinBody takes 50ms and SetLinkGeometriesFromGroup takes 100ms = 50ms x 2 (= len(['padding=0.010', 'self'])) in total.

For 1, using a cache will help, but it is prone to bugs.
For 2, we should call _ResetCurrentGeometryCallback once for the specified geometry group name.

cc @kanbouchou @yoshikikanemoto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant