Skip to content

Instantly share code, notes, and snippets.

@awesomebytes
Last active August 1, 2023 05:11
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awesomebytes/2595b1dc41831c804a4f to your computer and use it in GitHub Desktop.
Save awesomebytes/2595b1dc41831c804a4f to your computer and use it in GitHub Desktop.
How to fix a malformed stl (says Rviz)

Fix malformed stl (says Rviz)

To correct:

The STL file 'package://wsg_50_simulation/meshes/WSG-FMF.stl' is malformed. It starts with the word 'solid', indicating that it's an ASCII STL file, but it does not contain the word 'endsolid' soit is either a malformed ASCII STL file or it is actually a binary STL file. Trying to interpret it as a binary STL file instead.

When launching Rviz with a URDF containing SolidWorks created meshes in STL.

Just go to the folder with STL's with this problem and do:

sed -i 's/^solid/robot/' *

This will substitute the starting string 'solid' for 'robot' (could be any non-keyword for STL file word).

Thanks to this issue.

@durovsky
Copy link

Can you be little bit more specific about this hint? Where should we call it from? launch file or some specific filepath?

@awesomebytes
Copy link
Author

Oh, I didn't get any warning about your comment so I didn't see it, sorry.
My intended use is to go into the folder with malformed STL's and just run that sed command (which will substitute any appearance at the start of the file of the word 'solid' for 'robot', the word 'robot' could be anything that's not a keyword for STL).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment