Skip to content

Converter of meshes from STL to SDF format.

Notifications You must be signed in to change notification settings

alessandro-crescenzi/stl2sdf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stl2sdf

Converter of meshes from STL to SDF format.

Takes as input a mesh file (STL) and generates the corresponding .SDF file for importing the model into Gazebo.
It uses the TriMesh library.
It also allows to resize a mesh.

# Usage
python stl2sdf.py <FILENAME> <SCALING_FACTOR>

# Example:
python stl2sdf.py mesh.stl 1.5

Warning:

The SDF files contain hard-coded references to STL meshes, which means STL meshes should stay in their directory. Otherwise, you have to re-generate the SDF files.

Example usage with Gazebo:

# Generate the SDF description file for your mesh (without re-sizing it)
python stl2sdf.py mesh.stl 1.0

# Launch Gazebo:
roslaunch gazebo_ros empty_world.launch gui:=true

# Spawn the object inside Gazebo
rosrun gazebo_ros spawn_model -sdf -file /path/to/sdf/file/mesh.sdf -model myModelName

(optional) Trimesh installation

To install Trimesh, open a terminal and write:

pip install --user trimesh

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%