python-fcl
python-fcl copied to clipboard
Inconsistent results for continuous collision checking
This program gives different results if run repeatedly:
from __future__ import print_function
import numpy as np
import fcl
def main():
g1 = fcl.Box(1,2,3)
t1 = fcl.Transform([-10.0, 0, 0])
o1 = fcl.CollisionObject(g1, t1)
t1_final = fcl.Transform(np.array([10.0, 0.0, 0.0]))
g2 = fcl.Cone(1,3)
t2 = fcl.Transform([0, 0, 0])
o2 = fcl.CollisionObject(g2, t2)
t2_final = fcl.Transform(np.array([0.0, 0.0, 0.0]))
request = fcl.ContinuousCollisionRequest()
result = fcl.ContinuousCollisionResult()
ret = fcl.continuousCollide(o1, t1_final, o2, t2_final, request, result)
return result
if __name__ == "__main__":
print("FCL version: ", fcl.__version__)
result = main()
print("Time of contact: ", result.time_of_contact)
print("Is colliding: ", result.is_collide)
Why?
Thanks for the minimal working example. I'm not sure why this could be happening -- the Python code looks correct, so I'll need to run a CPP test and see if the issue is with FCL itself.
Ok, I get consistent results if I use GST_INDEP as the narrow phase collision solver (request.gjk_solver_type = 1).
Just a wild guess: This might be related to this issue: https://github.com/flexible-collision-library/fcl/issues/243 (since the continuous collision check interface has a maximum number of iterations, 'hanging' might result in no detected collision)
Good find. I can change the default solver to avoid that issue.