Skip to content

Commit

Permalink
Merge branch 'master' into support_nox
Browse files Browse the repository at this point in the history
  • Loading branch information
k-okada authored Jul 17, 2024
2 parents 2e18082 + 1f1a342 commit 89f6eb1
Show file tree
Hide file tree
Showing 22 changed files with 3,376 additions and 5 deletions.
2 changes: 1 addition & 1 deletion euscollada/scripts/add_eef_to_urdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def addEEF(xdoc, end_effector_info, limb_info, limb_name):
if "parent" in end_effector_info:
parent = end_effector_info["parent"]
else:
parent = limb_info[-1].keys()[0].replace("JOINT", "LINK") # not goood!
parent = list(limb_info[-1].keys())[0].replace("JOINT", "LINK") # not goood!
if "translate" in end_effector_info:
pos = end_effector_info["translate"]
else:
Expand Down
4 changes: 2 additions & 2 deletions euscollada/scripts/parseColladaBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def fixed_writexml(self, writer, indent="", addindent="", newl=""):
writer.write(indent+"<" + self.tagName)

attrs = self._get_attributes()
a_names = attrs.keys()
a_names = list(attrs.keys())
a_names.sort()

for a_name in a_names:
Expand Down Expand Up @@ -441,7 +441,7 @@ def add_eef(self, xml_obj):
print("cannot find limb: %s" %(limb), file=sys.stderr)
return
limb_lst = self.yaml_data[limb]
parent = limb_lst[-1].keys()[0].replace("JOINT", "LINK") # not goood!
parent = list(limb_lst[-1].keys())[0].replace("JOINT", "LINK") # not goood!
xml_obj.add_manipulator('%s_end_coords'%limb, root, parent,
translate = translate, rotate = rotate)

Expand Down
2 changes: 1 addition & 1 deletion euscollada/scripts/urdf_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def runDiff(original_file, new_file, output_file):
def runPatch(input_file, patch_yaml, output_file):
input_robot = URDF.from_xml_file(input_file)
patch_param = yaml.load(open(patch_yaml))
for joint_name in patch_param.keys():
for joint_name in list(patch_param.keys()):
diff = patch_param[joint_name]
if "xyz" in diff:
j = input_robot.joint_map[joint_name]
Expand Down
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="[email protected]">Iori Yanokura</maintainer>
<author email="[email protected]">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 89f6eb1

Please sign in to comment.