I am trying to represent bending structures as systems of rigid bodies, so I was wondering what the 'practical limits' are regarding the number of actuated bodies in simbody, at least before performance times are not longer considered real-time. For a 2D example, I have played around with ExampleLongPendulum, but am not sure if my approach is the *most optimal* (I am using the CPODEs integrator).
Code: Select all
// Cylindrical rigid body with pre-computed inertias of Ix, Iy, and Iz
Body::Rigid pendulumBody(MassProperties(m, Vec3(0), Inertia(Ix, Iy, Iz)));
// Add a cylinder mesh of height h and radius r, re-orient it
pendulumBody.addDecoration(Rotation(Pi/2, CoordinateAxis(2)), DecorativeCylinder(r, h/2));
MobilizedBody lastBody = matter.Ground();
int num_bodies = 5;
for (int i = 0; i < num_bodies; ++i)
{
// The first cylinder body is attached to origin, the rest are attached to it's parent's tip
Vec3 attachPointParent = i == 0 ? Vec3(0, 0, 0) : Vec3(h / 2, 0, 0);
Vec3 attachPointSelf = Vec3(-h / 2, 0, 0);
Rotation r = Rotation(0, CoordinateAxis(2));
// Create mobilized body
MobilizedBody::Pin pendulum(lastBody, Transform(attachPointParent) * Transform(r),
pendulumBody, Transform(Vec3(attachPointSelf)));
lastBody = pendulum;
// This mobilized body will be acted upon a constant angular spring with precomputed spring constant k_z
Force::MobilityLinearSpring springForce(forces, lastBody, 0, k_z, 0.);
}