Greetings Everyone,
I am new to SimBody and thus learning SimBody with basic examples.
In one such example, I have defined a body that rotates freely with a motor attached to it via a Pin Mobilizer.
I have successfully attached a motor with the body using the Pin Mobilizer and the simulation runs fine in my system. However, once I transfer and try running the code in the PC of my fellow enthusiast, I face the following error.
Please Note: I do not get any error and thus my code compiles successfully in my personal laptop. I am using a virtual-box for Linux Ubuntu and my colleague has root Linux Ubuntu installation.
Please find the inertia definition of the body in the below image. Please note: No inertia values are defined any where else in the code.
Request for help on the same.
Also I was thinking of rotating the body along the Y axis instead of the Z axis(default axis with the Pin Mobilizer). I understand that I need to rotate the Mobilizer axis using Transform() function and thus I went through the documentation but could not figure out the implementation of the same.
Code is not running due to inertia values
- Harshal Mehta
- Posts: 5
- Joined: Tue Nov 08, 2022 7:53 am
- Michael Sherman
- Posts: 807
- Joined: Fri Apr 01, 2005 6:05 pm
Re: Code is not running due to inertia values
Hi, Harshal.
An important thing to know is that Simbody expects inertias to be provided taken about the body origin, NOT the body mass center. I suspect your specification of the motor inertia was intended to be about the COM (0,0,.4) but Simbody interpreted it about (0,0,0) which, when shifted to (0,0,.4) is non-physical. The Inertia class provides functions for shifting inertias to and from COM; in this case you should take your central motor inertia (taken about (0,0,.4) and shift it from the COM to (0,0,0) before passing it to MassProperties.
See Inertia::shiftFromMassCenter
My guess is that the "works on one machine but not the other" is a red herring -- if I'm correct that the inertia was non-physical it didn't work anywhere but on your machine you didn't see the error message (maybe a Release vs. Debug difference?).
Let me know whether that addresses the problem.
Regards,
Sherm
An important thing to know is that Simbody expects inertias to be provided taken about the body origin, NOT the body mass center. I suspect your specification of the motor inertia was intended to be about the COM (0,0,.4) but Simbody interpreted it about (0,0,0) which, when shifted to (0,0,.4) is non-physical. The Inertia class provides functions for shifting inertias to and from COM; in this case you should take your central motor inertia (taken about (0,0,.4) and shift it from the COM to (0,0,0) before passing it to MassProperties.
See Inertia::shiftFromMassCenter
My guess is that the "works on one machine but not the other" is a red herring -- if I'm correct that the inertia was non-physical it didn't work anywhere but on your machine you didn't see the error message (maybe a Release vs. Debug difference?).
Let me know whether that addresses the problem.
Regards,
Sherm
- Harshal Mehta
- Posts: 5
- Joined: Tue Nov 08, 2022 7:53 am
Re: Code is not running due to inertia values
Greetings Sherman,
Apologies for the late reply.
Yes, it was the "release vs debug" that was letting the code run on my system.
Also I have understood the inertia definition criteria.
Thank you very much for your reply.
However, I am facing issues while trying to attach a pin mobilizer to rotate my body along the Y/X axis. Since the mobilizer by default provides mobility along the Z-Axis, I tried rotating the axis using Transform() function but I am getting pretty weird results. Can you please point me to a few examples or a documentation that I can refer to rectify this problem?
Thanks & Regards.
Apologies for the late reply.
Yes, it was the "release vs debug" that was letting the code run on my system.
Also I have understood the inertia definition criteria.
Thank you very much for your reply.
However, I am facing issues while trying to attach a pin mobilizer to rotate my body along the Y/X axis. Since the mobilizer by default provides mobility along the Z-Axis, I tried rotating the axis using Transform() function but I am getting pretty weird results. Can you please point me to a few examples or a documentation that I can refer to rectify this problem?
Thanks & Regards.
- Michael Sherman
- Posts: 807
- Joined: Fri Apr 01, 2005 6:05 pm
Re: Code is not running due to inertia values
This diagram may help (scroll down to "Mobilizer Terminology and Notation") -- notice that a mobilizer is a relationship between two frames. One (F) is on the parent (inboard) body and the other (M) is on the child (outboard) body. A Pin mobilizer aligns the Z axes of those two frames. Each frame can be repositioned separately, but in the end the two Z axes will be aligned. The two transforms in the MobilizedBody::Pin constructor are repositioning F and M with respect to their bodies.
An example where a Pin mobilizer rotates around the X axis is given here (in ExampleClosedTopologyMechanism). The ZtoX transform is defined here.
Regards,
Sherm
An example where a Pin mobilizer rotates around the X axis is given here (in ExampleClosedTopologyMechanism). The ZtoX transform is defined here.
Regards,
Sherm
- Harshal Mehta
- Posts: 5
- Joined: Tue Nov 08, 2022 7:53 am
Re: Code is not running due to inertia values
Thank you very much Sherman! It helped me a lot.
- Michael Sherman
- Posts: 807
- Joined: Fri Apr 01, 2005 6:05 pm
Re: Code is not running due to inertia values
You're welcome!