This is a cute simulation.
From the code you provided, I take it that you are using an older version of Chrono. I just tried your code with the latest Chrono from the main git branch, and I cannot reproduce the issue.
Regarding your question about ChBodyEasMesh, note that this creates under the hood a ChBodyAuxRef (and not a ChBody). In that case, you probably want to control the pose of the reference frame with respect to the global frame. However, SetPos and SetRot actually affect the pose of the centroidal frame (relative to the global frame).
I know that this is *very* confusing and it’s something I intend to change throughout Chrono whenever I will find the time.
In the meantime, I suggest you
I attached a modification of your code where I
Let me know what you get.
Radu
--
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 visit
https://groups.google.com/d/msgid/projectchrono/c35f6ec9-0d9f-4311-8b8c-f09a3afdbb94n%40googlegroups.com.
Good to hear that, Wing.
A couple of things:
--Radu
To view this discussion visit https://groups.google.com/d/msgid/projectchrono/29a899b2-e402-4de5-8978-840e0ee4b4fan%40googlegroups.com.
Wei,
It is not clear to me how you want these new tops to be oriented and spin. Right now, it looks like the top on the right hits the platform with its thin tip with large velocity (dure to its off-axis angular velocity). Use the code I provided to properly set the initial top orientation and its local angular speed.
To view this discussion visit https://groups.google.com/d/msgid/projectchrono/14e31e7c-3365-4547-96b5-ec90ca59296dn%40googlegroups.com.
Hi Wing,
This problem is similar to the previous one about using SetFrameRefToAbs instead of SetPos. Just like SetPos and SetRot, the function SetAngVelLocal expects an angular velocity expressed in the centroidal reference frame. However, the centroidal reference frame is calculated internally in the ChBodyEasyMesh constructor and may end up rotated relative to the body reference frame.
What you want is to specify the angular velocity relative to the body reference frame. You can either convert the desired angular velocity from the body reference frame to the body centroidal frame (using the transform returned by GetFrameCOMToRef) or else convert the desired angular velocity from the body reference frame to the global frame and set it using SetAngVelParent. I pushed a new demo based on your code and there I adopted the 2nd approach. See demo_MBS_spinning_tops.
One more reason to change how one specifies initial position and velocity in Chrono. The current API is a continuous source of confusion.
Best,
Radu
To view this discussion visit https://groups.google.com/d/msgid/projectchrono/5162a87b-bbf4-4adb-b2c5-bfbf19650850n%40googlegroups.com.
Hi Wing,
I think I know what happened and it was my mistake. I transformed the angular velocity vector as a position vector when it really should be transformed as a direction vector.
In other words, instead of:
top1->SetAngVelParent(X_G1 * ChVector3d(0, omega1, 0));
I should have used:
top1->SetAngVelParent(X_G1.GetRotMat() * ChVector3d(0, omega1, 0));
I’ll push the fix to demo_MBS_spinning_tops a little bit later with a couple of other commits. In the meantime, please check that the above fixes the problem.
To view this discussion visit https://groups.google.com/d/msgid/projectchrono/2b5106aa-c1d3-4817-a460-0361cd8720b1n%40googlegroups.com.