Thanks to anyone who clicked in.
My question stems from a technical validation of a project I’m working on, related to collision detection, and in fact, I had a discussion about this a long time ago - Visual Components’ collision detection doesn’t seem to be trustworthy, which is a pessimistic thought, and in fact, I haven’t found a suitable solution for it so far.
In fact, in the not too distant past, I participated in a project on small-pitch collision measurement, specifically flying probe testing of motherboard circuits. There were requirements in the project about how much distance the flying probe sticks into the component (in fact, in reality, a spring is used) counts as a collision, and in order to do this, I used vcCollisionDetector as my solution and wrote something like hit = detector.testAllCollisions(-0.5) for the collision tolerance, but The problem arises when, in testing, I found that when no collisions were occurring, there would still be positions where I would be prompted that an alarm had been raised (print ‘hit’), and then when I raised this value or just set it to 0, it would not occur again.
So the question that strikes me as odd is, why does setting it to -0.5 lead to false alarms, is it because of the absolute value that is actually used by the VC’s internal collider for this value? Or is it that VC can’t do a very fine job of detecting this?
Thanks to anyone who can read my question and listen to my rant, if anyone can give me some advice I’d be very grateful!
I think in general VC’s collision detection does not support any kind of “penetration depth” analysis.
It simply calculates whether any of the triangles of the chosen mesh geometries intersect, and if distance is desired to be known, minimum distance between those meshes by calculating distances between vertices, edges, and triangle faces. Also the meshes generally don’t have “inside” and “outside” defined, but it makes no difference for this particular purpose which only considers intersection of the “skin” of objects.
The collision checks are done by “polling”, i.e. is not a continuous process and generally is done at the same time when the 3D world is rendered so the polling interval in simulation time may also vary. This is generally OK for rough analysis and fairly fast to compute, but for reliable results the collision checks should be triggered through API at known accurate enough interval. The new VC OLP features do such more reliable analysis for robot programs.
Thanks for the explanation, in that case, what exactly is the definition of the Real tolerance parameter of testAllCollisions, in fact, until now I always thought it referred to the trigger distance, for example, testAllCollisions(0.1) means that any collision event with a distance less than or equal to 0.1 will be considered a collision, which I thought it was right before, but when it comes to negative values, he looks very strange.
I think Tolerance < 0 is handled same as Tolerance == 0, but can’t be sure. I would advice against using negative values there as the behavior might be unexpected. Note that 0 also has special effect.
https://help.visualcomponents.com/4.9/Premium/en/Python_API/vcCollisionDetector.htm
Hmm… Well, it sounds like this has to be solved in a different form, like making an extra processed model specifically for collisions? Anyway, thanks for the info and have a great day!