Sphere – cylinder collision not detected

86 views
Skip to first unread message

Morten Haastrup

unread,
Aug 13, 2015, 8:14:01 AM8/13/15
to ProjectChrono

Hi


There seems to be a problem for the collision detection algorithm to detect collision between spheres and cylinders. I have made a model of a nice little tractor. The contact geometries of the front wheels are made of cylinders, while the rear wheels are made from convex hulls (inspired by the soil-bin demo).


The ground consists of four boxes which forms the walls for the soil model, which is just a lot of spheres. When the simulation starts, the tractor is situated on one of the boxes (Figure 1). There is no problem of contact detection between front wheels and ground at this stage.


When the front wheels reach the soil model (spheres) they just fall through (Figure 2). There is nothing wrong with the contact families which I have defined because the contact is working for the rear wheels (Figure 3). I have seen similar behavior with simpler models; a cylinder falling on a box of spheres.


The work-around I’m using now is to use polygons made from convex hulls instead of the two cylinders.

Best regards Morten




Auto Generated Inline Image 1
Auto Generated Inline Image 2
Auto Generated Inline Image 3

Ben Jackson

unread,
Aug 13, 2015, 11:07:45 PM8/13/15
to ProjectChrono
Post some code of your sphere generation and of the convex hull generation

Morten Haastrup

unread,
Aug 20, 2015, 11:51:22 AM8/20/15
to ProjectChrono
Hi Ben,

Here's the code for generating the front wheels. It starts with this line in both cases
// Add contact geometry
myWheel
->GetCollisionModel()->ClearModel();

Then I comment this bloc out when using the convex hull
// A cylinder has problems colliding with spheres
myWheel
->GetCollisionModel()->AddCylinder(radius, radius, width,
   
ChVector<>(0, 0, ContOffset), Q_from_AngX(CH_C_PI_2));

And this is how the convex hull is generated (if not using the cylinder above):
// Generate a convex hull
std
::vector<ChVector<>> ConvexPoints;
const int n = 21;
ConvexPoints.resize(n * 2);
for (int i = 0; i < n; i++){
   
double V = i * CH_C_PI * 2 / 21;
   
ChVector<>Pt1(radius*cos(V), radius*sin(V), 0.5 * width);
   
ConvexPoints[i] = Pt1;
   
ChVector<>Pt2(radius*cos(V), radius*sin(V), -0.5 * width);
   
ConvexPoints[i + n] = Pt2;
}
myWheel
->GetCollisionModel()->AddConvexHull(ConvexPoints, ChVector<>(0,0, ContOffset));

And finally, the contact model is created:
myWheel->GetCollisionModel()->BuildModel();
myWheel
->SetCollide(true);

I don't think there is a problem with the spheres because they do contact the walls (boxes) and rear wheels (convex hulls). And if I use convex hulls on the front wheels everything is working as expected.

Cheers, Morten

Ben Jackson

unread,
Aug 21, 2015, 3:51:33 PM8/21/15
to ProjectChrono
Try using a chrono traingle mesh collision hull instead
Reply all
Reply to author
Forward
0 new messages