RE: [chrono] Visualization for added collision shape

11 views
Skip to first unread message

Radu Serban

unread,
Jun 14, 2024, 10:59:57 AMJun 14
to ProjectChrono

Visual assets are separate from collision assets associated with any given physics item in a Chrono model.  You will need to create a visualization model that includes shapes corresponding to your collision model (although you do not always have to match them exactly) and associate that with the body.  This is illustrated in many (most) of the Chrono demos.

 

By the way, I strongly encourage you to switch using a newer version of Chrono.  Version 9.0.0 was recently released.

 

--Radu

 

From: projec...@googlegroups.com <projec...@googlegroups.com> On Behalf Of Yaqing Wang
Sent: Monday, June 3, 2024 2:35 PM
To: ProjectChrono <projec...@googlegroups.com>
Subject: [chrono] Visualization for added collision shape

 

Hi,

I am now creating an eccentric ellipsoid. I want the mass all concentrated in a small ball a little bit lower than the center of geometry. I first create a ChBody, then add an ellipsoid to its collision model. 

I am using Chrono v7. I am coding like this:

 

double robot_a = 0.118;
              double robot_b = 0.085;
              double robot_c = 0.033;
              auto robot = std::make_shared<ChBody>(collision_type);
              double inertia = (2.0 / 5.0) * AM_mass * pow(link_r, 2);
              robot->SetDensity(AM_density);
              robot->SetMass(AM_mass);
              robot->SetInertiaXX(ChVector<>(inertia, inertia, inertia));
              robot->SetPos(ChVector<>(x_start, y_e, height_e + AM_offset));
              robot->SetPos_dt(initial_v);
              robot->SetRot(QUNIT);
              robot->GetCollisionModel()->AddEllipsoid(material_PLA, robot_a, robot_b, robot_c, ChVector<>(0, 0, -AM_offset), ChMatrix33<>(1));
              robot->GetCollisionModel()->BuildModel();
              robot->SetCollide(true);
              robot->SetBodyFixed(false);
              auto robot_colorasset = std::make_shared<ChColorAsset>(0.2f, 0.3f, 0.6f);
              robot_colorasset->SetFading(0.5);
              robot->AddAsset(robot_colorasset);
              mphysicalSystem.Add(robot);

 

I am having a problem with not being able to make this ellipsoid visible. I think there should be a few lines of code that make this happen. Would you show me?

 

Thanks,

--
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 projectchron...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/e9a5fff4-1aa9-4469-a0af-373d73bfb008n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages