0
$\begingroup$

Rosanswers logo

We have hard time converting our very cool robot SolidWorks files into URDF. They are way too complicated to make it somehow manually from scratch. As much I know there is no way to draw 3D model with some visual tools into URDF format. So we have options: SolidWorks converter on XML writing with vim.

To point. Simmechanics link creates XML file and lot of STL files. STL files are binary and ROS cannot open them. I compiled Meshlab and converted all STL files into non-binary ones. Content of files look OK to me. But ROS complains a lot about them:

[ERROR] [1303925218.756302760]: Could not load model '../../../../../../../../home/tonu/tyros/phippi/ros/phippi/xml/Media/models/Roboti_algus - roomuk-1 seib_4-3.STL' for link 'seib_4-31': OGRE EXCEPTION(2:InvalidParametersException): Header chunk didn't match either endian: Corrupted stream? in Serializer::determineEndianness at /home/tonu/ros/visualization_common/ogre/build/ogre_src_v1-7-1/OgreMain/src/OgreSerializer.cpp (line 89)

[ERROR] [1303925218.757941298]: Could not load model '../../../../../../../../home/tonu/tyros/phippi/ros/phippi/xml/Media/models/Roboti_algus - roomuk-1 seib_4-4.STL' for link 'seib_4-41': OGRE EXCEPTION(2:InvalidParametersException): Header chunk didn't match either endian: Corrupted stream? in Serializer::determineEndianness at /home/tonu/ros/visualization_common/ogre/build/ogre_src_v1-7-1/OgreMain/src/OgreSerializer.cpp (line 89)

[ERROR] [1303925218.758430673]: Could not load model '../../../../../../../../home/tonu/tyros/phippi/ros/phippi/xml/Media/models/Roboti_algus - roomuk-1 seib_4-4.STL' for link 'seib_4-41': OGRE EXCEPTION(2:InvalidParametersException): Header chunk didn't match either endian: Corrupted stream? in Serializer::determineEndianness at /home/tonu/ros/visualization_common/ogre/build/ogre_src_v1-7-1/OgreMain/src/OgreSerializer.cpp (line 89)

[ERROR] [1303925218.760367921]: Could not load model '../../../../../../../../home/tonu/tyros/phippi/ros/phippi/xml/Media/models/Roboti_algus - roomuk-1 seib_4-5.STL' for link 'seib_4-51': OGRE EXCEPTION(2:InvalidParametersException): Header chunk didn't match either endian: Corrupted stream? in Serializer::determineEndianness at /home/tonu/ros/visualization_common/ogre/build/ogre_src_v1-7-1/OgreMain/src/OgreSerializer.cpp (line 89)"

Example of STL file content:

tonu@hp:~/tyros/phippi/ros/phippi$ head "xml/Media/models/Roboti_algus - roomuk-1 seib_4-5.STL"
solid vcg
  facet normal  0.000000e+00  7.133919e-02 -9.974521e-01
    outer loop
      vertex   0.000000e+00 -2.618593e-04  1.821271e-03
      vertex  -9.000000e-04 -4.506700e-19  1.840000e-03
      vertex   0.000000e+00 -4.506700e-19  1.840000e-03
    endloop
  endfacet
  facet normal -0.000000e+00 -7.133919e-02 -9.974521e-01
    outer loop
tonu@hp:~/tyros/phippi/ros/phippi$ 

tonu@hp:~/tyros/phippi/ros/phippi$ tail "xml/Media/models/Roboti_algus - roomuk-1 seib_4-5.STL"
    endloop
  endfacet
  facet normal -1.000000e+00  0.000000e+00  0.000000e+00
    outer loop
      vertex  -9.000000e-04  1.390579e-03 -1.204944e-03
      vertex  -9.000000e-04  2.687582e-03 -2.242076e-03
      vertex  -9.000000e-04  2.442805e-03 -2.506533e-03
    endloop
  endfacet
endsolid vcg
tonu@hp:~/tyros/phippi/ros/phippi$ 

I am note sure what else should I show.

EDIT:

I followed first answer and tried to remove word "solid" from STL files:

for i in *.STL; do sed -ie 's/^solid/dilos/'  "$i" ; done

I also verified that files are acutally and properly changed. Still errors. Meshlab opens those modified files nicely. Then I have tried another suggestion:

for i in *.STL; do rosrun ivcon ivcon "$i" output.stlb; mv output.stlb "$i"; done

Still get errors:

[ERROR] [1304096832.894462256]: Could not load model '../../../../../../../../../../../../../../home/tonu/tyros/phippi/ros/phippi/Roboti_algus - roomuk-1 Jalg-2 seib_2-3.STL' for link 'seib_2-34': OGRE EXCEPTION(2:InvalidParametersException): Header chunk didn't match either endian: Corrupted stream? in Serializer::determineEndianness at /home/tonu/ros/visualization_common/ogre/build/ogre_src_v1-7-1/OgreMain/src/OgreSerializer.cpp (line 89)

I also verified with "strace -f" if proper files are opened at all. Yes they are. Any more ideas? I put my files on web: http://no.spam.ee/~tonu/urdfstl.tar.gz


Originally posted by Tõnu Samuel on ROS Answers with karma: 161 on 2011-04-27

Post score: 2

$\endgroup$

4 Answers 4

0
$\begingroup$

Rosanswers logo

I was able to load up STL's from your tar ball in diamondback without errors. Can you post a sample URDF file you used that you were able to reproduce the error? I have not seen the "endian" error before, what kind of system are you running on?

This is what I did: (I put the meshes under my_ros_pkg/debug_objects), and created test.urdf:

<robot name="simple_model">
  <link name="my_link">
    <inertial>
      <mass value="1.0" />
      <!-- center of mass (com) is defined w.r.t. link local coordinate system -->
      <origin xyz="1 0 0" /> 
      <inertia  ixx="1.0" ixy="0.0"  ixz="0.0"  iyy="100.0"  iyz="0.0"  izz="1.0" />
    </inertial>
    <visual>
      <!-- visual origin is defined w.r.t. link local coordinate system -->
      <origin xyz="1 0 0" rpy="0 0 0" />
      <geometry>
        <!--
        <mesh filename="package://my_ros_pkg/debug_objects/Roboti_algus - roomuk-1 Jalg-1 seib-28.STL" />
        -->
        <mesh filename="package://my_ros_pkg/debug_objects/Roboti_algus - roomuk-1 seib_4-3.STL" scale="10 10 10"/>
      </geometry>
    </visual>
    <collision>
      <!-- collision origin is defined w.r.t. link local coordinate system -->
      <origin xyz="1 0 0" rpy="0 0 0" />
      <geometry>
        <mesh filename="package://my_ros_pkg/debug_objects/Roboti_algus - roomuk-1 seib_4-3.STL" />
      </geometry>
    </collision>
  </link>
  <gazebo reference="my_link">
    <material>Gazebo/Blue</material>
    <turnGravityOff>true</turnGravityOff>
  </gazebo>
</robot>

started empty world

roslaunch gazebo_worlds empty_world.launch

then spawned the model

rosrun gazebo spawn_model -urdf -file test.urdf -model test_stl_mesh -z 1

Originally posted by hsu with karma: 5780 on 2011-04-29

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Tõnu Samuel on 2011-06-18:
ack. Busy times.

Comment by kwc on 2011-06-17:
marking this as answer as there has been no activity for ~3 weeks

Comment by David Lu on 2011-05-03:
That looks awesome. I'm really glad you could get the code to work. If you have any suggestions for the simmechanics tool, I'm all ears.

Comment by hsu on 2011-05-03:
nice looking model :)

Comment by Tõnu Samuel on 2011-05-03:
YESS! http://no.spam.ee/~tonu/rvizphippi2.png still did lot of manual work. Got always OGRE complaints until I removed all "" elements. Will redo soon all from scratch and post exact procedure we followed.

Comment by Tõnu Samuel on 2011-05-03:
Will check today and give feedback. Thanks for your time!!

$\endgroup$
0
$\begingroup$

Rosanswers logo

You are affected by a known incompatibility between Solidworks and ROS; see this ticket for details and workarounds. Your STL files have to be binary.

You can also have a look at the package katana_description, which uses STL meshes in URDF (not generated from Solidworks, though).

Also, there has been a similar question some while ago; the root cause of that one was different, but some of the answers fit your question.

EDIT: I downloaded your urdfstl.tar.gz, but was unable to run it unmodified, because a lot of files are missing. So I constructed a minimal example from your files which runs just fine and displays the meshes in RViz. You can get it here. If you still cannot get it to run, first try to construct a minimal example (i.e., only one or two meshes, only the files needed to reproduce the error, all files trimmed down to a minimum) and then upload the complete package folder including all necessary files.


Originally posted by Martin Günther with karma: 11816 on 2011-04-27

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by Tõnu Samuel on 2011-04-29:
About ticket - I applied such command to STL files but this didn't help: for i in *.STL; do sed -ie 's/^solid/dilos/' "$i" ; done

Comment by Tõnu Samuel on 2011-04-29:
We spent many other hours on this without positive result. I try to provide more information after.

$\endgroup$
0
$\begingroup$

Rosanswers logo

I took the original uploaded tarball, fixed link names and packaged it up as phippi.tar.gz. After unpacking the file and fixing ROS_PACKAGE_PATH, you can reproduce it by running:

roslaunch phippi phippi.launch

The model is spawned 0.5m above ground. Some of the joints/joint-axis looked incorrect (see video).

I am running against trunk of simulator_gazebo, so did not see any ogre asserts. But I was able to reproduce the ogre asserts + crash with released diamondback. This is probably because the improvements in fixed joint reduction prevented the crash.

Please let me know if you need help setting simulator to run from trunk. Thanks.


Originally posted by hsu with karma: 5780 on 2011-05-23

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Tõnu Samuel on 2011-05-28:
I really appreciate all help I get here. This is useful input.

Comment by David Lu on 2011-05-24:
The incorrect joint/joint-axes are a known "bug" of the conversion tool. At the moment, the tool is most useful for outputting geometries and using the parameter tool to correct all of the kinematic chains.

$\endgroup$
0
$\begingroup$

Rosanswers logo

I finally got around to writing a tutorial! Sorry about the delay.

Converting SimMechanics to URDF


Originally posted by David Lu with karma: 10932 on 2011-07-13

This answer was NOT ACCEPTED on the original site

Post score: 3

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.