Hi Yavor,

You can safely ignore the warning about static-static collision. This is a red 
herring coming from the fact that, while we only use its collision detection 
piece, Bullet has its own dynamics and this warning (issued only in Debug mode) 
is part of an internal Bullet coupling between the two which is irrelevant for 
us.  Since we anyway have custom Chrono modifications to the Bullet collision, 
I pushed another one to just disabled this misleading warning.

--Radu

From: projectchrono@googlegroups.com <projectchrono@googlegroups.com> On Behalf 
Of Yavor Vale
Sent: Tuesday, December 17, 2024 11:00 PM
To: ProjectChrono <projectchrono@googlegroups.com>
Subject: [chrono] Re: Cannot get ChBody and ChGravityLoader to work together

One thing I failed to mention in my previous post is that the following message 
appears in the console even before the simulation starts running:

warning cbtCollisionDispatcher::needsCollision: static-static collision!

As far as I understand, this is coming from within Bullet.
I'm surprised there's static-static collisions, since after consulting the 
code, it seems to me that by providing a material to the constructors of the 
Easy* objects, I'm initializing them as non-static.

What could be the objects that triggered the static-static collision? Is there 
a hook for me to find out?

Best, Yavor

On Saturday, December 14, 2024 at 11:58:29 AM UTC+2 Yavor Vale wrote:
Hi,

My previous post 
(https://groups.google.com/g/projectchrono/c/A7GlGUYS1Ik<https://urldefense.com/v3/__https:/groups.google.com/g/projectchrono/c/A7GlGUYS1Ik__;!!Mak6IKo!JUDGtO2ejNTgUHIOkCNHX9a-gtCfvr9p9NheOAIr6ret8ip17lfzOEGG82YhI2EV_zBiAGdvg-Vc3YM$>)
 failed to garner any engagement, so I did the only thing I could think of in 
the situation and moved to C++ to remove any Python/SWIG-related issues.

As much as I try, I can't get ChBody's to work with ChGravityLoader.
I started from demo_IRR_visualize_collision.cpp and made only two notable 
changes:
* I removed the built-in gravity by calling SetGravitationalAcceleration with 
the zero vector
* I added back the gravity individually to each object through a 
ChLoadContainer and a ChLoad for each object.

The simulation does not run at all when I try to use ChSystemNSC.
It starts with ChSystemSMC, but it looks like the gravity is working only until 
the first collision (or some other undetermined condition that I can't 
recognize).

I can't use ChCollisionSystem::Type::MULTICORE, because I didn't build Chrono 
to support it. Would this collision system solve my issues?

The full source is available at 
https://pastebin.com/fXEmB9Bg<https://urldefense.com/v3/__https:/pastebin.com/fXEmB9Bg__;!!Mak6IKo!JUDGtO2ejNTgUHIOkCNHX9a-gtCfvr9p9NheOAIr6ret8ip17lfzOEGG82YhI2EV_zBiAGdvnCY_6Vo$>
These are the changes I've made to the original source code:

diff --git a/src/demos/irrlicht/demo_IRR_visualize_collision.cpp 
b/src/demos/irrlicht/demo_IRR_visualize_collision.cpp
index 022d906c7..fc04cba6b 100644
--- a/src/demos/irrlicht/demo_IRR_visualize_collision.cpp
+++ b/src/demos/irrlicht/demo_IRR_visualize_collision.cpp
@@ -17,6 +17,8 @@

 #include "chrono/collision/bullet/ChCollisionSystemBullet.h"
 #include "chrono/physics/ChSystemNSC.h"
+#include "chrono/physics/ChSystemSMC.h"
+#include "chrono/physics/ChLoadContainer.h"
 #include "chrono/physics/ChBodyEasy.h"
 #include "chrono/core/ChTimer.h"
 #include "chrono/core/ChRealtimeStep.h"
@@ -59,10 +61,13 @@ int main(int argc, char* argv[]) {
     std::cout << "Copyright (c) 2017 
projectchrono.org<https://urldefense.com/v3/__http:/projectchrono.org__;!!Mak6IKo!JUDGtO2ejNTgUHIOkCNHX9a-gtCfvr9p9NheOAIr6ret8ip17lfzOEGG82YhI2EV_zBiAGdvGrgWvAM$>\nChrono
 version: " << CHRONO_VERSION << std::endl;

     // Create the Chrono system, bodies, and collison shapes
-    ChSystemNSC sys;
+    ChSystemSMC sys;
+    //ChSystemNSC sys;
     sys.SetCollisionSystemType(csys_type);
+    sys.SetGravitationalAcceleration(ChVector3d(0, 0, 0));

-    auto mat = chrono_types::make_shared<ChContactMaterialNSC>();
+    auto mat = chrono_types::make_shared<ChContactMaterialSMC>();
+    //auto mat = chrono_types::make_shared<ChContactMaterialNSC>();

     auto ground = chrono_types::make_shared<ChBodyEasyBox>(10, 3, 10, 100, 
mat);
     ground->SetFixed(true);
@@ -95,6 +100,14 @@ int main(int argc, char* argv[]) {
     mesh->GetVisualShape(0)->SetColor(ChColor(0.2f, 0.3f, 0.6f));
     sys.AddBody(mesh);

+    auto load_container = chrono_types::make_shared<ChLoadContainer>();
+    for (auto obj : sys.GetBodies()) {
+        auto custom_loader = chrono_types::make_shared<ChLoaderGravity>(obj);
+        auto custom_load = chrono_types::make_shared<ChLoad>(custom_loader);
+        load_container->Add(custom_load);
+    }
+    sys.Add(load_container);
+
     // Create the Irrlicht visualization system
     auto vis = chrono_types::make_shared<ChVisualSystemIrrlicht>();
     vis->AttachSystem(&sys);

I feel like I'm hitting something fundamental, but I don't know what it is and 
where to read more about it.

I'm using a 1 week old build of the `main` branch of Project Chrono, with 
Irrlicht support enabled. The example runs fine if I return the code to the 
original state, as do all other examples, so I have no reason to believe this 
is caused by a bad build of Project Chrono.

Can someone please provide any sort of insight as to what is happening?
I'm simply trying to add the simplest ChLoaderUVW force available and it is 
absolutely not working.

Does this even work for ChBody's? I've seen it works with 
demo_FEA_loads_dynamic, but according to the docs, ChBody is loadable.

Best regards, Yavor
--
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
projectchrono+unsubscr...@googlegroups.com<mailto:projectchrono+unsubscr...@googlegroups.com>.
To view this discussion visit 
https://groups.google.com/d/msgid/projectchrono/d7f69dab-d61a-4857-a55f-181796badbb2n%40googlegroups.com<https://urldefense.com/v3/__https:/groups.google.com/d/msgid/projectchrono/d7f69dab-d61a-4857-a55f-181796badbb2n*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Mak6IKo!JUDGtO2ejNTgUHIOkCNHX9a-gtCfvr9p9NheOAIr6ret8ip17lfzOEGG82YhI2EV_zBiAGdvEbHCcsw$>.

-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to projectchrono+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/projectchrono/CH3PPF46CDC21857EB7350E8284E84C9412A7032%40CH3PPF46CDC2185.namprd06.prod.outlook.com.

Reply via email to