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

update to fcl 0.6 -- slower running code #579

Open
emielke12 opened this issue May 9, 2022 · 4 comments
Open

update to fcl 0.6 -- slower running code #579

emielke12 opened this issue May 9, 2022 · 4 comments

Comments

@emielke12
Copy link

I recently had to update libraries, and went from FCL v0.5 to v0.6. As such, there was a move to a more template-oriented design, so I ended up having to explicitly type things as float or double, (i.e. when creating a fcl::OBBRSS<double> vs how it was before fcl::OBRSS. I didn't think too much of it, but this has caused a significant slow down in calls to fcl::distance.

Has anyone else seen this? I also noticed in the ROS MoveIt! libraries also have some issues related to this, where function calls and/or class instantiations are running slower.

Not sure if there's a way to get the code running as fast as it was previously, but any help would be appreciated.

@jmirabel
Copy link

jmirabel commented May 9, 2022

If you really want some help, I suggest you to be more precise. E.g. give a working example with each version and the compilation line.

There are many possible reasons why this could happen, starting from compilation options.

@emielke12
Copy link
Author

Previously, I was working with code that looked something like this:

fcl::BVHModel<fcl::OBBRSS> *model = new fcl::BVHModel<fcl::OBBRSS>();
fcl::generateBVHModel(*model, fcl::Sphere(std::numeric_limits<double>::epsilon()), fcl::Matrix3f::getIdentity(), 100);
fcl::BVHModel<fcl::OBBRSS> *other_model = new fcl::BVHModel<fcl::OBBRSS>();
std::vector<fcl::Vec3f> vertices;
std::vector<fcl::Triangle> triangles;
other_model->beginModel();
... addSubModel via loop
other_model->endModel();
fcl::Transform3f I(fcl::Matrix3f::getIdentity(), fcl::Vec3f(0,0,0));
fcl::DistanceRequest request;
fcl::DistanceResult result;
fcl::distance(model, I, other_model, I, request, result);

Obviously, with v0.6 it is templatized to something like this:

fcl::BVHModel<fcl::OBBRSSd> *model = new fcl::BVHModel<fcl::OBBRSSd>();
fcl::Transform3d tf;
tf.setIdentity();
fcl::generateBVHModel(*model, fcl::Sphere<double>(std::numberic_limits<double>::epsilon()), tf, 100);
fcl::Transform3d I;
I.setIdentity();
fcl::BVHModel<fcl::OBBRSSd> *other_model = new fcl::BVHModel<fcl::OBBRSSd>();
std::vector<fcl::Vector3d> vertices;
std::vector<fcl::Triangle> triangles;
other_model->beginModel();
... addSubModel via loop
other_model->endModel();
fcl::DistanceRequest<double> request;
fcl::DistanceResult<double> result;
fcl::distance(model, I, other_model, I, request, result);

I attempted to keep everything as float, but experienced very long computation time at runtime, so I switched to double, and it's relatively close, but runs about 3 seconds slower.

Running Ubuntu 20.04, cmake compiled with GNU 9.4.0.

@jmirabel
Copy link

Do you use CMake option -DCMAKE_BUILD_TYPE=Release ?

Run VERBOSE=1 make and extract from the output the full compilation command. This is what tells you whether your code is truly optimized.

@emielke12
Copy link
Author

Run VERBOSE=1 make and extract from the output the full compilation command. This is what tells you whether your code is truly optimized.

I've done this, but I'm not sure I know what to look for...

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

2 participants