Skip to content

Commit c3c2f29

Browse files
init commit
0 parents  commit c3c2f29

22 files changed

+270040
-0
lines changed

.github/workflows/ci.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: CI of mc_ur3e_description
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- README.md
7+
- ".pre-commit-config.yaml"
8+
branches:
9+
- '**'
10+
pull_request:
11+
branches:
12+
- '**'
13+
14+
jobs:
15+
build-and-test:
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- name: Colcon build
19+
uses: jrl-umi3218/github-actions/build-catkin-project@master

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*~
2+
urdf
3+
meshes
4+
.vscode

.pre-commit-config.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
repos:
2+
- repo: meta
3+
hooks:
4+
- id: check-useless-excludes
5+
- id: check-hooks-apply
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.6.0
8+
hooks:
9+
- id: check-ast
10+
- id: check-executables-have-shebangs
11+
- id: check-merge-conflict
12+
- id: check-yaml
13+
- id: debug-statements
14+
- id: destroyed-symlinks
15+
- id: detect-private-key
16+
- id: end-of-file-fixer
17+
- id: fix-byte-order-marker
18+
- id: mixed-line-ending
19+
- id: trailing-whitespace
20+
exclude: |
21+
(?x)^(
22+
convex/ur3e/.*\.txt$|
23+
README.md|
24+
)$
25+
26+
- repo: https://github.com/cheshirekow/cmake-format-precommit
27+
rev: v0.6.13
28+
hooks:
29+
- id: cmake-format

CMakeLists.txt

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
project(mc_ur3e_description)
3+
4+
if(NOT DEFINED ENV{ROS_VERSION})
5+
message(FATAL_ERROR "ROS_VERSION is not set in the environment")
6+
endif()
7+
if($ENV{ROS_VERSION} EQUAL 1)
8+
set(ROS_VERSION 1)
9+
find_package(catkin REQUIRED COMPONENTS ur_description)
10+
elseif($ENV{ROS_VERSION} EQUAL 2)
11+
set(ROS_VERSION 2)
12+
find_package(ament_cmake REQUIRED)
13+
find_package(ur_description REQUIRED)
14+
else()
15+
message(FATAL_ERROR "Unknown ROS version: $ENV{ROS_VERSION}")
16+
endif()
17+
18+
set(PACKAGE_NAME "ur_description")
19+
20+
message(STATUS "ur_description path ${ur_description_DIR}")
21+
22+
if("${ur_description_INSTALL_PREFIX}" STREQUAL "")
23+
if("${ur_description_SOURCE_PREFIX}" STREQUAL "")
24+
if("${ur_description_DIR}" STREQUAL "")
25+
message(
26+
FATAL_ERROR
27+
"ur_description does not provide SOURCE_PREFIX or INSTALL_PREFIX")
28+
else()
29+
set(ur_description_PREFIX "${ur_description_DIR}/..")
30+
endif()
31+
else()
32+
set(ur_description_PREFIX "${ur_description_SOURCE_PREFIX}")
33+
endif()
34+
else()
35+
set(ur_description_PREFIX
36+
"${ur_description_INSTALL_PREFIX}/share/ur_description")
37+
endif()
38+
39+
set(DATA_INSTALL_FOLDER "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}")
40+
41+
set(xacro_SRC
42+
${ur_description_PREFIX}/urdf/inc/ur_common.xacro
43+
${ur_description_PREFIX}/urdf/inc/ur_transmissions.xacro
44+
${ur_description_PREFIX}/config/ur3e/joint_limits.yaml
45+
${ur_description_PREFIX}/config/ur3e/default_kinematics.yaml
46+
${ur_description_PREFIX}/config/ur3e/physical_parameters.yaml
47+
${ur_description_PREFIX}/config/ur3e/visual_parameters.yaml)
48+
49+
find_program(XACRO xacro REQUIRED)
50+
set(urdf_OUT "${CMAKE_CURRENT_SOURCE_DIR}/urdf/ur3e.urdf")
51+
52+
if(${ROS_VERSION} EQUAL 1)
53+
set(xacro_IN ${ur_description_PREFIX}/urdf/ur3e.xacro)
54+
set(xacro_SRC ${xacro_SRC} ${xacro_IN}
55+
${ur_description_PREFIX}/urdf/inc/ur_macro.xacro)
56+
57+
add_custom_command(
58+
OUTPUT ${urdf_OUT}
59+
COMMAND ${XACRO} -i ${xacro_IN} -o ${urdf_OUT}
60+
DEPENDS ${xacro_SRC}
61+
COMMENT "Generate ${urdf_OUT}")
62+
elseif(${ROS_VERSION} EQUAL 2)
63+
set(xacro_IN ${ur_description_PREFIX}/urdf/ur.urdf.xacro)
64+
set(xacro_SRC ${xacro_SRC} ${xacro_IN}
65+
${ur_description_PREFIX}/urdf/ur_macro.xacro)
66+
67+
add_custom_command(
68+
OUTPUT ${urdf_OUT}
69+
COMMAND ${XACRO} ${xacro_IN} name:=ur ur_type:=ur3e -o ${urdf_OUT}
70+
DEPENDS ${xacro_SRC}
71+
COMMENT "Generate ${urdf_OUT}")
72+
endif()
73+
74+
add_custom_target(generate-mc-ur3e-urdf ALL DEPENDS ${urdf_OUT})
75+
install(FILES "${urdf_OUT}" DESTINATION ${DATA_INSTALL_FOLDER}/urdf/)
76+
77+
install(DIRECTORY convex rsdf launch DESTINATION ${DATA_INSTALL_FOLDER})
78+
79+
if(${ROS_VERSION} EQUAL 1)
80+
catkin_package()
81+
elseif(${ROS_VERSION} EQUAL 2)
82+
set(CATKIN_PACKAGE_SHARE_DESTINATION share/${PROJECT_NAME})
83+
else()
84+
set(CATKIN_PACKAGE_SHARE_DESTINATION share/mc_rtc/${PROJECT_NAME})
85+
86+
include(CMakePackageConfigHelpers)
87+
set(VERSION_CONFIG
88+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
89+
set(PROJECT_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake")
90+
set(CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
91+
92+
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/ConfigVersion.cmake.in"
93+
"${VERSION_CONFIG}" @ONLY)
94+
configure_package_config_file(
95+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in" "${PROJECT_CONFIG}"
96+
INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}")
97+
98+
install(FILES "${VERSION_CONFIG}" "${PROJECT_CONFIG}"
99+
DESTINATION "${CONFIG_INSTALL_DIR}")
100+
install(FILES package.xml DESTINATION "${CATKIN_PACKAGE_SHARE_DESTINATION}")
101+
endif()
102+
103+
foreach(dir convex launch meshes rsdf urdf rviz)
104+
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${dir})
105+
install(DIRECTORY ${dir}/
106+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir})
107+
endif()
108+
endforeach(dir)
109+
110+
if(${ROS_VERSION} EQUAL 2)
111+
configure_file(
112+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/robot_INSTALL_PREFIX.cmake.in"
113+
"${CMAKE_CURRENT_BINARY_DIR}/cmake/mc_ur3_description_INSTALL_PREFIX.cmake"
114+
@ONLY)
115+
ament_package(
116+
CONFIG_EXTRAS
117+
"${CMAKE_CURRENT_BINARY_DIR}/cmake/mc_ur3_description_INSTALL_PREFIX.cmake")
118+
endif()

README.md

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# UR3e robot description for [mc_rtc](https://jrl-umi3218.github.io/mc_rtc/)
2+
This package has additional convex files for mc_ur3e robot module used by [mc_rtc](https://jrl-umi3218.github.io/mc_rtc/) control framework.
3+
UR3e robot has urdf, collada and meshes in the original [ur_description](https://github.com/ros-industrial/universal_robot/tree/melodic-devel/ur_description) package.
4+
5+
It contains the following directories:
6+
- `convex/`: convex hulls (generated from pointclouds sampled from the dae meshes)
7+
- `rsdf/`: Special urdf-like format describing surfaces attached to links on the robot (The folder is empty)
8+
9+
## Required dependencies
10+
11+
* ROS1 : [ur_description](https://github.com/ros-industrial/universal_robot/tree/melodic-devel/ur_description)
12+
* ROS2 : [ur_description](https://github.com/UniversalRobots/Universal_Robots_ROS2_Description)
13+
14+
## Installation
15+
16+
### ROS1
17+
On an environment with ROS and catkin properly setup:
18+
19+
```bash
20+
$ cd ~/catkin_ws/src
21+
$ git clone https://github.com/ros-industrial/universal_robot
22+
$ git clone https://github.com/isri-aist/mc_ur3e_description
23+
$ cd ..
24+
$ catkin_make
25+
```
26+
27+
If you install into a different directory than the src directory of the catkin workspace, run the following commands.
28+
```bash
29+
$ cd build
30+
$ make install
31+
```
32+
If your catkin environment is sourced `source ~/catkin_ws/install/setup.bash`, the robot model will be available to all ROS tools, and mc_rtc robot module.
33+
34+
To display the robot, you can use:
35+
36+
```
37+
$ roslaunch mc_ur3e_description display_ur3e.launch
38+
```
39+
40+
41+
### ROS2
42+
On an envrionnement with ROS and a workspace properly setup :
43+
44+
```bash
45+
$ cd ~/ros2_ws/src
46+
$ git clone https://github.com/UniversalRobots/Universal_Robots_ROS2_Description # you may need to change branch depending on your ros version
47+
$ git clone https://github.com/isri-aist/mc_ur3e_description
48+
$ cd ..
49+
$ colcon build
50+
```
51+
If your catkin environment is sourced `source ~/ros2_ws/install/setup.bash`, the robot model will be available to all ROS tools, and mc_rtc robot module.
52+
53+
To display the robot, you can use:
54+
55+
```bash
56+
$ ros2 launch mc_ur3e_description display_ur3e.launch.py
57+
```
58+
59+
> If you have mc_rtc and the corresponding robot module installed, you can use the `convexes:=True` or `surfaces:=True` arguments to display the robot convexes and surfaces. These arguments can be used for both ROS version.
60+
***
61+
62+
## When updating convex files
63+
64+
### Dependencies
65+
- [ur_description](https://github.com/ros-industrial/universal_robot/tree/melodic-devel/ur_description)
66+
- [mesh_sampling](https://github.com/arntanguy/mesh_sampling)
67+
- qhull-bin
68+
69+
### Generation of convex files
70+
To run the conversion, simply run
71+
72+
```
73+
$ source ~/catkin_ws/devel/setup.bash
74+
$ roscd mc_ur3e_description/scripts
75+
$ ./generate_convex.sh
76+
Running generate_convex.sh script from directory <MC_UR3E_DESCRIPTION_PATH>/script
77+
:
78+
:
79+
-- Generating convex hull for /home/@USERNAME@/catkin_ws/install/share/ur_description/meshes/ur3e/collision/upperarm.stl
80+
-- Generating convex hull for /home/@USERNAME@/catkin_ws/install/share/ur_description/meshes/ur3e/collision/forearm.stl
81+
-- Generating convex hull for /home/@USERNAME@/catkin_ws/install/share/ur_description/meshes/ur3e/collision/base.stl
82+
-- Generating convex hull for /home/@USERNAME@/catkin_ws/install/share/ur_description/meshes/ur3e/collision/wrist2.stl
83+
-- Generating convex hull for /home/@USERNAME@/catkin_ws/install/share/ur_description/meshes/ur3e/collision/wrist3.stl
84+
-- Generating convex hull for /home/@USERNAME@/catkin_ws/install/share/ur_description/meshes/ur3e/collision/shoulder.stl
85+
-- Generating convex hull for /home/@USERNAME@/catkin_ws/install/share/ur_description/meshes/ur3e/collision/wrist1.stl
86+
87+
Successfully generated convex from ur_description package in /tmp/mc_ur3e_description
88+
89+
$ mv /tmp/mc_ur3e_description/convex/ur3e `rospack find mc_ur3e_description`/convex/
90+
```

cmake/Config.cmake.in

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@PACKAGE_INIT@
2+
3+
set(@PROJECT_NAME@_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@/@CATKIN_PACKAGE_SHARE_DESTINATION@")

cmake/ConfigVersion.cmake.in

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file is the same as CMake's BasicConfigVersion-SameMajorVersion.cmake.in
2+
# but we skip architecture checks
3+
set(PACKAGE_VERSION "@PROJECT_VERSION@")
4+
5+
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
6+
set(PACKAGE_VERSION_COMPATIBLE FALSE)
7+
else()
8+
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL "@PROJECT_VERSION_MAJOR@")
9+
set(PACKAGE_VERSION_COMPATIBLE TRUE)
10+
else()
11+
set(PACKAGE_VERSION_COMPATIBLE FALSE)
12+
endif()
13+
14+
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
15+
set(PACKAGE_VERSION_EXACT TRUE)
16+
endif()
17+
endif()

cmake/robot_INSTALL_PREFIX.cmake.in

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
set(@PROJECT_NAME@_INSTALL_PREFIX "${@PROJECT_NAME@_DIR}/../")
2+
get_filename_component(@PROJECT_NAME@_INSTALL_PREFIX
3+
"${@PROJECT_NAME@_INSTALL_PREFIX}" REALPATH)

0 commit comments

Comments
 (0)