Create a sphere body

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Nashwa Elaraby
Posts: 13
Joined: Fri Apr 09, 2010 8:00 am

Create a sphere body

Post by Nashwa Elaraby » Thu Mar 03, 2011 10:36 am

Hi,

In the Developer's guide a block body was created. I would like to create a model for an eyeball. I have 2 problems:

1. How do I define the new sphere body with the required dimensions?
2. I got an eye.obj file that I could display on GUI opensim, but I do not know how I can rescale it. It is much larger than the ground objects, such that it is overlapping them.
I would appreciate your help.

Thank you,
Nashwa

User avatar
Ayman Habib
Posts: 2238
Joined: Fri Apr 01, 2005 12:24 pm

RE: Create a sphere body

Post by Ayman Habib » Thu Mar 03, 2011 11:27 am

Hi Nashwa,

Bodies do not have dimensions, but the geometry attached to them for display or contact purposes do have dimensions.

For the display part, there's a <scale_factors> attribute associated with the geometry that you can use to scale it up/down (the scaling is wrt the frame of the geometry) the attribute is in the osim file under the <VisibleObject> tag.

For contact, if you're using an idealized sphere, (<ContactSphere>)then it would have a <radius> tag in the osim file, as well as <location>, <orientation> to translate/rotate it relative to the body it's attached to.
If you're using a ContactMesh that happens to be a sphere then you'll need to scale your obj file outside of OpenSim using other third party tools (e.g. MeshLab or Paraview).

Hope this helps and please let us know if you have any questions,
Best,
-Ayman

User avatar
Nashwa Elaraby
Posts: 13
Joined: Fri Apr 09, 2010 8:00 am

RE: Create a sphere body

Post by Nashwa Elaraby » Thu Mar 03, 2011 12:27 pm


Thank you Dr.Habib for your reply. I am starting to work with opensim, and would really appreciate any help.

1. How do I add a ContactSphere, and how do I specify its inertia?

2. As far as I understand, in the case of a nonideal object, then I have to use opensim::contactmesh as in exercise 6 to add the contact geometry of that object. How do I define the weight and inertia of an irregular object then?

Thanks again,


User avatar
Ayman Habib
Posts: 2238
Joined: Fri Apr 01, 2005 12:24 pm

RE: Create a sphere body

Post by Ayman Habib » Thu Mar 03, 2011 2:03 pm

Hi Nashwa,

In OpenSim there's a distinction between the body/segment and the geometry attached to it (either for display or contact). A body may have none, either or both kinds. The mass properties are associated with the body (tags <mass>, <inertia_XX>, <mass_center> under the corresponding <Body> tag). You should compute these yourself, outside of OpenSim and put them in the file (regardless of which geometry you're using for contact: ContactMesh or ContactSphere).

If you want to specify a contact sphere in the model, you'd need to specify:
<ContactSphere>
<body_name> ..</body_name>
<location> ..</location>
<orientation> ..</orientation>
<radius> ...</radius>
</ContactSphere>

In general you can get the names of these properties by using any of the executables included in the OpenSim distribution, for example:

command prompt>analyze -PI ContactSphere

Yields the following output:

PROPERTIES FOR ContactSphere (4)
1. body_name
2. location
3. orientation
4. radius

Hope this helps, and good luck.
-Ayman

User avatar
Nashwa Elaraby
Posts: 13
Joined: Fri Apr 09, 2010 8:00 am

RE: Create a sphere body

Post by Nashwa Elaraby » Tue Mar 08, 2011 4:28 am

Thank you very much Dr. Habib.
That was very helpful. I appreciate it.

User avatar
Nashwa Elaraby
Posts: 13
Joined: Fri Apr 09, 2010 8:00 am

RE: Create a sphere body

Post by Nashwa Elaraby » Mon Mar 14, 2011 11:11 am

Hi,

I have attached a muscle to a sphere body, and would like to ask how can I make sure that the muscle wraps around the sphere, when the sphere rotates.

Thank you,
Nashwa

User avatar
Ayman Habib
Posts: 2238
Joined: Fri Apr 01, 2005 12:24 pm

RE: Create a sphere body

Post by Ayman Habib » Wed Mar 16, 2011 1:00 pm

Hi Nashwa,

Please check the Arm26 example model file in the distribution. It contains a set of WrapObjects and muscles that wrap around them. In general, a muscle specifies which Wrap Object(s) it can wrap itself around. Whether the actual wrapping happens or not depends on the actual muscle path and where it lies with respect to the wrap object in space. Wrapping would guarantee that the muscle path does not intersect the wrap object's geometry.

Hope this helps,
-Ayman

POST REPLY