-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CREO2URDF – Validation of MVP-1 #16
Comments
A possible additional validation: the |
At the moment I'm struggling with visualizing the urdf with And the model seems to work as expected. According to the viewer, we also can see that the collision matches the solid. msedge_RkXPBipgrr.mp4Of course we need to make it work with our tools, but it's one small step towards validation. |
So if the terminal shows no error what is not working? Nothing is visualized? |
@traversaro Exactly, no mesh is visualized in the viewer, only a coordinate system. I thought it could just be that the model is too small or somewhere else in the world but it does not seem the case. idyntree-model-view_Y7M9U58fTD.mp4 |
As I mentioned to @Nicogene in chat, this could also be related to how you are specifying the location of meshes. Unfortunatly the URDF specification does not clearly support the use of relative paths to specify meshes, see robotology/idyntree#291 or https://discourse.ros.org/t/urdf-improvements/30520/21?u=traversaro . However, perhaps this is not the issue, another source of problems could be the use of binary or ascii STLs. Which kind of STLs are you using at the moment? |
Another thing that could influence what we see is if that there is a bug in the irrlicht version used by iDynTree, which iDynTree are you using? The one with dependencies (including irrlicht) installed by vcpkg or the one with dependencies installed by conda-forge? |
Binary!
I tried with the one installed with conda-forge, but I can double check with the vcpkg version. |
Just to understand if that is the issue you can also try to convert to ascii, just to try: for example using https://github.com/cmpolis/convertSTL or similar. |
By the way, which URDF are you trying? |
<?xml version="1.0"?>
<robot name="2BARS">
<link name="BAR">
<inertial>
<mass value="0.00741938044781609"/>
<origin xyz="0 -0.015 0.0035" rpy="0 -0 0"/>
<inertia ixx="-8.349706673190367e-7" ixy="0" ixz="0" iyy="-1.970110919505906e-9" iyz="-3.895174735103447e-7" izz="-7.157575641017976e-7"/>
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 -0 0"/>
<geometry>
<mesh filename="bar.stl"/>
</geometry>
<material name="">
<color rgba="0.5 0.5 0.5 1"/>
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 -0 0"/>
<geometry>
<mesh filename="bar.stl"/>
</geometry>
<material name="">
<color rgba="0.5 0.5 0.5 1"/>
</material>
</collision>
</link>
<joint name="BAR--BARLONGER" type="revolute">
<origin xyz="0 0 6.811996306092723e-18" rpy="0 -0 -0.7060878385670463"/>
<axis xyz="0 0 1"/>
<parent link="BAR"/>
<child link="BARLONGER"/>
<limit lower="0" upper="3.141592653589793" effort="1e+9" velocity="1e+9"/>
</joint>
<link name="BARLONGER">
<inertial>
<mass value="0.010359380471568048"/>
<origin xyz="0 -0.0225 0.0035" rpy="0 -0 0"/>
<inertia ixx="-2.9047306372231453e-6" ixy="-2.249810035331474e-12" ixz="0" iyy="-1.4799217693475475e-9" iyz="-8.158012121359838e-7" izz="-2.7370073443897514e-6"/>
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 -0 0"/>
<geometry>
<mesh filename="barlonger.stl"/>
</geometry>
<material name="">
<color rgba="0.5 0.5 0.5 1"/>
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 -0 0"/>
<geometry>
<mesh filename="barlonger.stl"/>
</geometry>
<material name="">
<color rgba="0.5 0.5 0.5 1"/>
</material>
</collision>
</link>
</robot>
For completeness, I'm uploading both the urdf and the stl in binary format: bars_urdf.zip |
Sadly the ruby script in the repo wrongly detects the binary .stl that I have as an ascii one, so the conversion gets all messed up. I'll download Paraview to make the conversion and try again. Additionally, I tried with the absolute path of the .stl files, but with no success. |
That's because in that file I removed the scaling from meters to millimeters to make sure the model was well visible. Thanks @traversaro ! |
By re-exporting the ascii stl to binary (again with MeshLab) I am able to visualize also the model with binary stl. So I guess there is something in the STL as exported by Creo that triggers a bug in Irrlicht. We would need to understand if it is the STL that is malformed or the irrlicht parser of STL that has a bug, but this is kind of not due to the creo2urdf code itself. |
For reference, this are the fixed files: bars_urdf_fixed_with_meshlab.zip . |
Maybe the prova del nove could be opening it in Gazebo? To see if it is actually the fault of Irrlicht. |
Anyhow, to minimize the possibility of other such bugs and solve this specific problem with idyntree-model-view we can just import the STL in assimp and export it, idyntree already depends on assimp so it should not a problem for creo2urdf to depend on assimp (hoping that assimp can load Creo's stl file fine). |
Just as a refernce, the only know stl-related bugs for irrlicht are quite old and fixed https://sourceforge.net/p/irrlicht/bugs/search/?q=stl . |
The idea for the validation was:
Sounds good @traversaro? This validator function would be nice to have as unit test, but I think is quite complicated create unit tests with creo. |
Yes! |
I think the bug/problem is on the Creo side. I just checked for curiosity, and the binary STL generated by Creo start with the first 5 bytes that are
It is not clear if they mean STL binary file starting with However, the original specification(s) according to Wikipedia appears to be "StereoLithography Interface Specification, 3D Systems, Inc., July 1988" and "StereoLithography Interface Specification, 3D Systems, Inc., October 1989" , but I can't find any copy of those online. Anyhow, being pragmatic it probably could make sense to sanitize binary STL generated by Creo changing the initial |
Apparently the fact that STL binary files created by Creo start with |
Sadly not much is said in the reply: |
Apparently not only creo does that, also Solidworks: nschloe/meshio#530 . All STL reader that work have hacks to deal with this, see https://github.com/assimp/assimp/blob/b1afa41047de5e81f3c6b8b083a1ba8c169adce6/code/AssetLib/STL/STLLoader.cpp#L111-L119, https://github.com/nschloe/meshio/pull/534/files or https://github.com/gazebosim/gz-common/blob/6f5ee941536e5c781bd826f6ce35360347d581ba/graphics/src/STLLoader.cc#L62 . |
Latest commit (e3fc531) implements a simple validation mechanism for the kinematics:
|
I think that point can be split in 3:
I think the first two are correct, because we can see in the urdf: <link name="BAR">
<inertial>
<mass value="0.00741938044781609"/>
<origin xyz="0 -0.015 0.0035" rpy="0 -0 0"/>
...
<link name="BARLONGER">
<inertial>
<mass value="0.010359380471568048"/>
<origin xyz="0 -0.0225 0.0035" rpy="0 -0 0"/> In Creo:
However, the inertia does not match: URDF: <link name="BAR">
<inertia ixx="-8.349706673190367e-7" ixy="0" ixz="0" iyy="-1.970110919505906e-9"
iyz="-3.895174735103447e-7" izz="-7.157575641017976e-7"/>
<link name="BARLONGER">
<inertia ixx="-2.9047306372231453e-6" ixy="-2.249810035331474e-12" ixz="0" iyy="-1.4799217693475475e-9"
iyz="-8.158012121359838e-7" izz="-2.7370073443897514e-6"/> CREO:
|
Note that you can also check a-priori if the inertia that you are passing to the model make sense by calling the |
Just ran it before the urdf generation, and it does return false for both links. I will inspect how the |
I found what I think was the error:
If we print the spatial inertia object info with Therefore, we might need an extra transformation in the code (maybe fromRotationalInertiaWrtCenterOfMass ?) However, at the moment (depending on the requirements for the PI) we could use the Creo function And we get the correct inertia (converted from mm2 to m2): <link name="BAR">
<inertial>
<mass value="0.00741938044781609"/>
<origin xyz="0 -0.015 0.0035" rpy="0 -0 0"/>
<inertia ixx="9.252773439253307e-7" ixy="0" ixz="0" iyy="8.891729956624118e-8" iyz="1.0587911840678754e-22" izz="9.536030366568225e-7"/>
</inertial> <link name="BARLONGER">
<inertial>
<mass value="0.010359380471568048"/>
<origin xyz="0 -0.0225 0.0035" rpy="0 -0 0"/>
<inertia ixx="2.4666081372848873e-6" ixy="-2.249810035660938e-12" ixz="0" iyy="1.2542248900736103e-7" iyz="0" izz="2.507429019341573e-6"/>
</inertial> |
And yep, we now have a valid URDF: <?xml version="1.0"?>
<robot name="2BARS">
<link name="BAR">
<inertial>
<mass value="0.00741938044781609"/>
<origin xyz="0 -0.015 0.0035" rpy="0 -0 0"/>
<inertia ixx="9.252773439253307e-7" ixy="0" ixz="0" iyy="8.891729956624118e-8" iyz="0" izz="9.536030366568229e-7"/>
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 -0 0"/>
<geometry>
<mesh filename="BAR.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="">
<color rgba="0.5 0.5 0.5 1"/>
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 -0 0"/>
<geometry>
<mesh filename="BAR.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="">
<color rgba="0.5 0.5 0.5 1"/>
</material>
</collision>
</link>
<joint name="BAR--BARLONGER" type="revolute">
<origin xyz="0 0 6.811996306092723e-18" rpy="0 -0 -0.7060878385670463"/>
<axis xyz="0 0 1"/>
<parent link="BAR"/>
<child link="BARLONGER"/>
<limit lower="0" upper="3.141592653589793" effort="1e+9" velocity="1e+9"/>
</joint>
<link name="BARLONGER">
<inertial>
<mass value="0.010359380471568048"/>
<origin xyz="0 -0.0225 0.0035" rpy="0 -0 0"/>
<inertia ixx="2.4666081372848873e-6" ixy="-2.249810035331474e-12" ixz="0" iyy="1.2542248900736103e-7" iyz="0" izz="2.507429019341573e-6"/>
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 -0 0"/>
<geometry>
<mesh filename="BARLONGER.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="">
<color rgba="0.5 0.5 0.5 1"/>
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 -0 0"/>
<geometry>
<mesh filename="BARLONGER.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="">
<color rgba="0.5 0.5 0.5 1"/>
</material>
</collision>
</link>
</robot> |
Thanks, this seems indeed the correct fix! |
The latest commit (9e4ecb7) also sanitizes the STL 👨⚕️ . I replaced "solid" with "iCubT" and it works fine: |
Well done! |
Task description
This is a follow-up of #13.
idyntree-visualizer
Optional:
iDynTree::RevoluteJoint
iDynTree::RevoluteJoint
protk.dat
via cmake with the correct pathsDefinition of done
The above list is completed
cc @pattacini
The text was updated successfully, but these errors were encountered: