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) 
> 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
> 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\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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/projectchrono/d7f69dab-d61a-4857-a55f-181796badbb2n%40googlegroups.com.

Reply via email to