Comments (4)
One can define collision shapes for the vehicle chassis and enable collision for it (disabled by default). However, none of the sample vehicles and demos in Chrono illustrate that, so I'll look into adding an example.
from chrono.
Thanks for your help! I have the same idea with you and did a simple test based on "demo_VEH_Sedan.cpp". There are three differences in code and they are:
- define a box collision shape for the sedan chassis
// change.1 : add chassis collision shape
auto chassis_mat = chrono_types::make_shared<chrono::ChMaterialSurfaceNSC>();
my_sedan.GetChassis()->GetBody()->GetCollisionModel()->ClearModel();
my_sedan.GetChassis()->GetBody()->GetCollisionModel()->AddBox(chassis_mat, 2, 2, 2, ChVector<>(0.0, 0.0, 0.0));
my_sedan.GetChassis()->GetBody()->SetCollide(true);
- add an obstacle with an easy box collision shape for testing the collision with sedan
// change3 :add box obstacle with collision shape
auto ground_mat = chrono_types::make_shared<chrono::ChMaterialSurfaceNSC>();
ground_mat->SetFriction(1.0f);
auto obstacle = chrono_types::make_shared<chrono::ChBodyEasyBox>(5, 10, 1, 1000, true, true, ground_mat);
my_sedan.GetSystem()->Add(obstacle);
obstacle->SetBodyFixed(true);
obstacle->SetPos(chrono::ChVector<>(-10, 0, 0));
obstacle->GetVisualShape(0)->SetTexture(chrono::GetChronoDataFile("textures/concrete.jpg"));
obstacle->SetCollide(true);
- add some particles same as in "demo_IRR_assets.cpp" for testing the physics behavior of "Terrain"
// change2 : add particle same as in demo_IRR_assets.cpp
auto particles = chrono_types::make_shared<ChParticleCloud>();
auto particle_mat = chrono_types::make_shared<ChMaterialSurfaceNSC>();
particles->GetCollisionModel()->ClearModel();
particles->GetCollisionModel()->AddSphere(particle_mat, 0.05);
particles->GetCollisionModel()->BuildModel();
particles->SetCollide(true);
// Create the random particles
for (int np = 0; np < 100; ++np)
particles->AddParticle(ChCoordsys<>(ChVector<>(ChRandom() - 2, ChRandom() + 2, 3)));
// Mass and inertia properties.
// This will be shared among all particles in the ChParticleCloud.
particles->SetMass(0.1);
particles->SetInertiaXX(ChVector<>(0.001, 0.001, 0.001));
// Do not forget to add the particle cluster to the system:
my_sedan.GetSystem()->Add(particles);
// ==Asset== Attach a 'sphere' shape asset.. it will be used as a sample
// shape to display all particles when rendering in 3D!
auto sphereparticle = chrono_types::make_shared<ChSphereShape>();
sphereparticle->GetSphereGeometry().rad = 0.05;
particles->AddVisualShape(sphereparticle);
there are two conclusions:
- it can't take collision check by add collision shape for chassis in my way, as the following picture showing.
- the particles just go through the terrain and have not collision behavior as the MBS demo.
Are there some errors when i add collision shape for Sedan chassis? Why the particles canβt collision with terrain and how to do it?
from chrono.
- You did not invoke BuildModel() on the collision model you added to the Sedan chassis. Note that there is a more formal way of adding collision geometry to a vehicle chassis (see below)
- You created the particle cloud with an "NSC" contact material, while the system you place it in is of type "SMC" (the two contact formulations cannot be mixed).
I just pushed a demo that illustrates the use of collision geometry on a vehicle chassis. See demo_VEH_HMMWV_Rollover. Look also at the implementation of HMMWV_Chassis; I used a collision shape given as a convex hull (from a simplified mesh), but you could define a collision model composed of primitives (that requires a bit of extra work to properly match the collision model with the visual model)
from chrono.
Got it. Thanks so much!
from chrono.
Related Issues (20)
- Segmentation fault (Address not mapped to object [0x8]) HOT 1
- [Carla] Worst realistic with Chrono HOT 1
- Step files cannot be visualized, demo_CAS_stepfile HOT 10
- cannot find demo_FSI_Flexible_Shell.cpp HOT 3
- chrono software calculation accuracy problems HOT 4
- The ARM64 development board performs a make check error HOT 1
- terrain HOT 1
- FEA mesh and rigid body contacts, there is a difference between the theoretical solution and the results. HOT 1
- Includes don't work correctly when building my project HOT 1
- AttributeError:'ChSystemNSC' object has no attribute 'SetVisualSystem' HOT 14
- ModuleNotFoundError: No module named 'pychrono' on M1 Mac HOT 5
- ImportError: cannot import name '_core' from partially initialized module 'pychrono' (most likely due to a circular import)
- ChronoEngine Installation Issue on Ubuntu 23.10 with CMake 3.27.4: CHRONO_MPI_FOUND Variable Not Recognized in ChronoConfig.cmake HOT 6
- Chrono::Irrlicht and Chrono::Sensor sampling textures in opposite directions
- unable to use gpu HOT 1
- Certain fsi demos are not compatible with latest version of Chrono HOT 2
- PyChrono ChFunction example is out of date HOT 1
- How to use project chrono in QT? HOT 1
- How to simulate soil environment HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chrono.