Skip to content

Commit

Permalink
Merge pull request #255 from iory/converter
Browse files Browse the repository at this point in the history
Add urdf mesh converter
  • Loading branch information
k-okada authored Jul 17, 2024
2 parents 38a3e0e + d803763 commit 1f1a342
Show file tree
Hide file tree
Showing 19 changed files with 3,372 additions and 1 deletion.
2 changes: 2 additions & 0 deletions urdf_mesh_converter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
!.gitignore
requirements.txt
59 changes: 59 additions & 0 deletions urdf_mesh_converter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
cmake_minimum_required(VERSION 2.8.3)
project(urdf_mesh_converter)

Find_package(
catkin REQUIRED
catkin_virtualenv
)

if (${catkin_virtualenv_VERSION} VERSION_LESS "0.5.1")
message(WARNING "${PROJECT_NAME} requires catkin_virtualenv >= 0.5.1")
return()
endif()


catkin_python_setup()

catkin_package(
CATKIN_DEPENDS
)

if($ENV{ROS_DISTRO} STREQUAL "noetic")
catkin_generate_virtualenv(
INPUT_REQUIREMENTS requirements.in
PYTHON_INTERPRETER python3
)
else()
message(WARNING "This package uses trimesh for model conversion. Trimesh has discontinued support for Python 2 quite some time ago. Please use Python 3 or later.")
return()
endif()

file(GLOB SCRIPTS_FILES scripts/*)
catkin_install_python(
PROGRAMS ${SCRIPTS_FILES}
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

if(CATKIN_ENABLE_TESTING)
find_package(catkin REQUIRED COMPONENTS rostest)

set(python_test_scripts
tests/test_urdf_mesh_converter.py
)

catkin_install_python(PROGRAMS ${python_test_scripts}
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

add_rostest(tests/test_urdf_mesh_converter.test
DEPENDENCIES ${PROJECT_NAME}_generate_virtualenv)
endif()


install(DIRECTORY scripts
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
USE_SOURCE_PERMISSIONS
)

install(FILES requirements.txt
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
22 changes: 22 additions & 0 deletions urdf_mesh_converter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# URDF Mesh Converter

This package converts the colored output of the URDF Exporter plugin of SolidWorks into the format readable by ROS systems.
Specifically, this package generates colored `.dae` models from `.3dxml` files.

JSK users should refer to the URDF Exporter documentation for [guidance](https://docs.google.com/presentation/d/1c2fdw6f_ny4jizH5VS3M7yLNd60M3rzsZs-ACR1ghNI).


## Quick Start
After building this package, source your workspace. Then, simply execute the command below, specifying your .3dxml URDF file path and the desired output URDF path.

```
rosrun urdf_mesh_converter convert_urdf_mesh.py <YOUR_URDF_PATH> --output <OUTPUT_URDF_PATH>
```

For a practical example, you can apply this package to an actual URDF by running the following command:

```
rosrun urdf_mesh_converter convert_urdf_mesh.py $(rospack find urdf_mesh_converter)/samples/pitch_yaw_2axis_camera_module.urdf --output $(rospack find urdf_mesh_converter)/samples/pitch_yaw_2axis_camera_module_modified.urdf
```

![](./doc/samples_pitch_yaw_2axis_camera_module.jpg "Sample Converted URDF")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions urdf_mesh_converter/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<package format="3">

<name>urdf_mesh_converter</name>
<version>0.4.5</version>
<description>
Convert urdf mesh.
</description>

<license>BSD</license>
<maintainer email="yanokura@jsk.imi.i.u-tokyo.ac.jp">Iori Yanokura</maintainer>
<author email="yanokura@jsk.imi.i.u-tokyo.ac.jp">Iori Yanokura</author>

<buildtool_depend>catkin</buildtool_depend>
<buildtool_depend>catkin_virtualenv</buildtool_depend>

<!-- ALPHABETICAL ORDER -->
<build_depend condition="$ROS_PYTHON_VERSION == 3">python3</build_depend>
<!-- ALPHABETICAL ORDER -->

<!-- ALPHABETICAL ORDER -->
<exec_depend condition="$ROS_PYTHON_VERSION == 3">python3</exec_depend>
<!-- ALPHABETICAL ORDER -->

<test_depend>rostest</test_depend>

<export>
<pip_requirements>requirements.txt</pip_requirements>
</export>

</package>
Empty file.
Loading

0 comments on commit 1f1a342

Please sign in to comment.