Slotting pin into hole only works when I scale up by 4

Typically: "How do I... ", "How can I... " questions
Post Reply
RobAtLab
Posts: 92
Joined: 10 Jan 2018, 17:49

Slotting pin into hole only works when I scale up by 4

Post by RobAtLab »

I'm working on a simulation where one modular robot needs to slot a conical pin into a convex conical hole on another robot so they can join. Right now these pins are random meshes imported as collada .dae files, using convex hull techniques didn't go to well for these meshes as critical holes got blocked so for now I'm accepting the slowed simulation speed caused by random mesh geometry. The issue is that when I try to insert the pin into the hole the physics engine seems to act as if the pin is too wide to fit the hole, I have to scale up my simulations robots by a factor of 4, at which point the slotting in works fine and the rest of the docking mechanisms can actuate properly. I'm not too keen on this scaling up though so would like to get things to work at the real scale. I know my meshes should fit together with a tolerance of about 0.4mm, these are small parts on small robots, and the meshes are low poly versions of the CAD files to later be used to 3d print real robots with this tolerance accurately preserved and potentially slightly increased. Please can anyone advise as top what might be wrong, tips on if there is any way to simulate a "magnetic" dock and simplify the pin and hole mechanism of the sim could also be useful, so I could just have the pin enter the whole then a "magnet" activates and the two are prevented from sliding out rather than the complex hook system I'm simulating right now.

I'm new to V-REP as of last week, I'm testing it to see if other students at the uni I'm at could find it useful too, so please answer clearly and simply suitable for an absolute beginner, V-REP looks really great so far.


Thanks

The picture should show what I mean about the shape of the pin and hole, it is from my CAD program not a screenshot from V-REP. A slice of the robot with the pins is in red, and a small piece of the robot with the holes is in transparent blue. The pins have a radius of 19.2mm, the gap between the surface of the pin and the inside of the hole is 0.4mm. The yellow line shows where this tolerance is. It doesn't matter too much how deep the pin goes as long as the pin inserts deeply enough that some parts of the cylindrical section of the pin are within the cylindrical part of the hole. Each robot has several pairs of pins and several pairs of holes, but as long as one pair of pins fits one pair of holes on the other robot then all the rest are sure to line up. See the image at https://drive.google.com/file/d/1dRjmB9 ... sp=sharing

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: Slotting pin into hole only works when I scale up by 4

Post by coppelia »

Hello,

doing that kind of simulation is very tricky. It will depend on several factors (including on the physics engine you are using). But in the end, physics engines have difficulties and are slow when running with random-shaped rigid bodies. Best is to use approximations (e.g. the hole can be modeled with several cuboids arranged in a circle).
In your situation, and you also mentioned this, you could also use a different approach:

basically a combination of a rigid-attachement, and a distance detection: as soon as you detect your pin to be close enough to the virtual hole, simply apply this solution.

Cheers

RobAtLab
Posts: 92
Joined: 10 Jan 2018, 17:49

Re: Slotting pin into hole only works when I scale up by 4

Post by RobAtLab »

Thanks for the tips.

I'm not sure if that strategy with dummies would be appropriate though, would it not end up with one robot effectively becoming parent to the other?

As for giving up on random meshes there might be a way this could work, if the dummies system forces parenting and becomes inappropriate, but I would need to manually make the new convex/pure shapes rather than let V-REP try to autogenerate them from my mesh, is there any way to do this which is more efficient than positioning pure shapes one at a time?

Thanks

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: Slotting pin into hole only works when I scale up by 4

Post by coppelia »

This is a difficult task. But depending on the geometry you need to generate, you can programmatically generate pure shapes and position/orient them appropriately. For instance, for a hole, simple generate cuboid shapes, place them with an offset to the hole center, and rotate them until you have the hole complete.
You can see here a more complex example where a tube is being generated based on a mesh.

Cheers

RobAtLab
Posts: 92
Joined: 10 Jan 2018, 17:49

Re: Slotting pin into hole only works when I scale up by 4

Post by RobAtLab »

In the end I fixed this. It seems that by using some simplified versions of the meshes, and then making them into compound groups of convex shapes rather than random shapes this fixed itself completely. My pins now slide into the holes perfectly and seem pretty stable over the long term, no weird vibrations caused by the physics engine. What's more the conical end of the pin matches really well with an annoyingly large number of convex blocks I made to represent the hole part of the system, and if you try to slide it in when the pin doesn't align to the centre but does meet the conical edge of the hole it is pushed into alignment before entering. I'll keep that dummies method in mind though if I want to simplify to something faster later on.

Post Reply