From: jeff (JSPRENGER)
URDF is a "Unified Robot Description Format". It's just an xml file with a list of links and joints, including mass, inertial matrix, joint properties and pointers to associated mesh files for the parts.
What's important is the position of each of these objects and their orientation, provided in as Euler angles or a quaternion.
To make it easier for me to generate a URDF for models designed in MoI, I'd like to write a script to iterate through selected objects and write out:
- object name
- object position (x,y,z)
- orientation/rotation (r,p,y)
Is there a script example of iterating through objects, accessing their position and orientation?
And another script example for writing to a file (or is it just plain ole javascript)?
If there is a general doc on writing scripts for MOI, that would be great too.
Thanks,
Jeff.
From: Michael Gibson
Hi Jeff, MoI doesn't store a local origin for every object, so an object in MoI does not really have any position or orientation stored for it, so that might be difficult to do. It might not be feasible until the time that MoI supports the concept of "instances" which will have that type of information stored.
There isn't much information about scripting available, what is available is here:
http://moi3d.com/wiki/scripting .
You might check out the CutList script as an example of gathering object names and writing out a text file:
http://moi3d.com/forum/index.php?webtag=MOI&msg=7759.2
- Michael
From: jeff (JSPRENGER)
hmm....
I think I can solve the position by:
creating a tiny "node" object like a small cube as a subobject for each part
then can I get the position of the bounding box of the node.
but for orientation, I'd need to know the rotation of the node.
I thought maybe a cube (as a primitive) would have orientation.
But playing with "Separate" on a cube, I see that it's composed as 6 planes to enclose a solid.
So when we rotate, moi just transforms the vertices?
Jeff.
From: Michael Gibson
Hi Jeff,
> So when we rotate, moi just transforms the vertices?
Yes, that's correct.
- Michael
From: Michael Gibson
But if you are able to attach some additional node objects to each main object instead of doing a cube if you did a 3 orthogonal lines one for x, one for y, one for z, that might be workable.
- Michael
From: jeff (JSPRENGER)
For importing into Unity, I think it ignores points and lines.
Only meshes are imported. So maybe three triangles in the form of a corner to represent the axes.
Jeff.
Image Attachments:
TriCorner.png
From: bemfarmer
There is a solidworks to urdf exporter:
http://wiki.ros.org/Industrial/Tutorials/Create%20a%20URDF%20for%20an%20Industrial%20Robot
- B
From: Michael Gibson
Hi Jeff, sorry I'm not understanding the part about importing into Unity - I thought you needed to write the rotation information into an XML file.
- Michael
From: jeff (JSPRENGER)
sorry for the confusion - I have URDF which I use for the physics engine import, but
I also to import robot models into Unity using URDF for easy visualization and PBR rendering.
(you can see some examples at my website
www.spryrobotics.com).
Jeff.
From: Frenchy Pilou (PILOU)
Cool!
https://vimeo.com/245327854