Skip to content

Commit 719c621

Browse files
author
Shota Aoki
authored
ROS 2に対応 (#28)
* samplesディレクトリを削除 * ROS 2でビルドできるようにCMakeLists.txtとpackage.xmlを追加 * Eigen3の依存関係を追加 * ROS 2 CI用のworkflowを追加 * package.xmlを微修正 * ライブラリが使えることの確認ようにサンプルパッケージを追加 * includeパスを修正 * READMEの文言をROS 2向けに変更
1 parent 311276d commit 719c621

File tree

71 files changed

+394
-6226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+394
-6226
lines changed

.github/workflows/build_test.yaml

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ name: BuildAndTest
22

33
on:
44
push:
5+
branches:
6+
- main
57
paths-ignore:
68
- '**.md'
79
pull_request:
10+
branches:
11+
- main
812
paths-ignore:
9-
- '**.md'
10-
schedule:
11-
- cron: "0 2 * * 0" # Weekly on Sundays at 02:00
13+
- '**.md'
1214

1315
jobs:
1416
lint:

.github/workflows/industrial_ci.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: industrial_ci
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'docs/**'
7+
- '**.md'
8+
pull_request:
9+
paths-ignore:
10+
- 'docs/**'
11+
- '**.md'
12+
schedule:
13+
- cron: "0 2 * * 0" # Weekly on Sundays at 02:00
14+
15+
jobs:
16+
industrial_ci:
17+
strategy:
18+
matrix:
19+
env:
20+
- { ROS_DISTRO: foxy, ROS_REPO: ros }
21+
- { ROS_DISTRO: galactic, ROS_REPO: ros }
22+
- { ROS_DISTRO: humble, ROS_REPO: ros }
23+
- { ROS_DISTRO: rolling, ROS_REPO: ros }
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
- uses: "ros-industrial/industrial_ci@master"
28+
env: ${{ matrix.env }}

README.md

+10-72
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# RTマニピュレータC++ライブラリとサンプル集(rt_manipulators_cpp)
22

3-
[![BuildAndTest](https://github.com/rt-net/rt_manipulators_cpp/actions/workflows/build_test.yaml/badge.svg)](https://github.com/rt-net/rt_manipulators_cpp/actions/workflows/build_test.yaml)
3+
[![industrial_ci](https://github.com/rt-net/rt_manipulators_cpp/actions/workflows/industrial_ci.yaml/badge.svg?branch=ros2)](https://github.com/rt-net/rt_manipulators_cpp/actions/workflows/industrial_ci.yaml)
44

55
本リポジトリは、株式会社アールティが販売している
66
[アームロボット**CRANE-X7(クラインエックスセブン)**](https://rt-net.jp/products/crane-x7/)
@@ -11,87 +11,25 @@
1111
[<img src=https://rt-net.github.io/images/crane-x7/CRANE-X7-500x500.png width=400px />](https://rt-net.jp/products/crane-x7/)
1212
[<img src=https://rt-net.github.io/images/sciurus17/Sciurus17-500x500.png width=400px />](https://rt-net.jp/products/sciurus17)
1313

14-
[![gravity_compensation](https://rt-net.github.io/images/crane-x7/x7_s17_gravity_compensation.gif)](./samples/samples03/README.md)
15-
1614
## 動作環境
1715

18-
- CMake (>= 3.1.0)
19-
- g++ (>= 7.5.0)
20-
- [DYNAMIXEL SDK](https://github.com/ROBOTIS-GIT/DynamixelSDK) (Linux 64bit向けにビルド&インストール)
21-
- [yaml-cpp (>= 0.5.0)](https://github.com/jbeder/yaml-cpp)
22-
- Eigen (>= 3.3.4)
23-
- Linux OS
24-
- Ubuntu 18.04
25-
- Ubuntu 20.04
26-
- ロボット
27-
- [CRANE-X7](https://rt-net.jp/products/crane-x7/)
28-
- [Sciurus17](https://rt-net.jp/products/sciurus17/)
16+
- ROS Foxy
17+
- ROS Galactic
18+
- ROS Humble
19+
- ROS Rolling
2920

3021
## インストール方法
3122

32-
### DYNAMIXEL SDKのインストール
33-
34-
[DYNAMIXEL SDKのe-manual](https://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp_linux/#cpp-linux)
35-
を参考に、Linux 64bit環境用にDYNAMIXEL SDKをビルド&インストールします。
36-
37-
```sh
38-
$ sudo apt install build-essential
39-
$ cd ~
40-
$ git clone https://github.com/ROBOTIS-GIT/DynamixelSDK.git
41-
$ cd ~/DynamixelSDK/c++/build/linux64
42-
$ make
43-
$ sudo make install
44-
```
45-
46-
### その他依存関係のインストール
47-
48-
次のコマンドを実行します。
49-
50-
```sh
51-
$ sudo apt install libyaml-cpp-dev libeigen3-dev cmake
52-
```
53-
5423
### RTマニピュレータC++ライブラリのビルド&インストール
5524

56-
詳細は[rt_manipulators_lib/README.md](./rt_manipulators_lib/README.md)を参照してください。
57-
5825
```sh
59-
$ cd ~
60-
$ git clone https://github.com/rt-net/rt_manipulators_cpp
61-
$ cd rt_manipulators_cpp/rt_manipulators_lib
62-
$ ./build_install_library.bash
26+
$ cd ~/ros2_ws/src # workspaceを~/ros2_wsに作成している場合
27+
$ git clone -b ros2 https://github.com/rt-net/rt_manipulators_cpp
28+
$ rosdep install -r -y --from-paths . --ignore-src
29+
$ cd ..
30+
$ colcon build --symlink-install
6331
```
6432

65-
## サンプルプログラムの実行
66-
67-
詳細は[samples/README.md](./samples/README.md)を参照してください。
68-
69-
```sh
70-
$ cd rt_manipulators_cpp/samples/samples01
71-
$ ./build_samples.bash
72-
73-
$ cd bin/
74-
$ ./x7_onoff
75-
CRANE-X7のトルクをON/OFFするサンプルです.
76-
CRANE-X7(ポート:/dev/ttyUSB0 ボーレート:3000000)に接続します.
77-
コンフィグファイル:../config/crane-x7.yamlを読み込みます.
78-
Config file '../config/crane-x7.yaml' loaded.
79-
arm
80-
joint1, id:2, mode:3
81-
joint2, id:3, mode:3
82-
joint3, id:4, mode:3
83-
joint4, id:5, mode:3
84-
joint5, id:6, mode:3
85-
joint6, id:7, mode:3
86-
joint7, id:8, mode:3
87-
hand
88-
joint_hand, id:9, mode:3
89-
サーボグループ:armのトルクをONにします.
90-
...
91-
```
92-
93-
[![](https://img.youtube.com/vi/cA_3HU3HfcM/sddefault.jpg)](https://youtu.be/cA_3HU3HfcM)
94-
9533
## 免責事項
9634

9735
当該製品および当ソフトウェアの使用中に生じたいかなる損害も株式会社アールティでは一切の責任を負いかねます。
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
project(rt_manipulators_examples)
3+
4+
# Default to C++17
5+
if(NOT CMAKE_CXX_STANDARD)
6+
set(CMAKE_CXX_STANDARD 17)
7+
endif()
8+
9+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
10+
add_compile_options(-Wall -Wextra -Wpedantic)
11+
endif()
12+
13+
# find dependencies
14+
find_package(ament_cmake REQUIRED)
15+
find_package(rclcpp REQUIRED)
16+
find_package(rt_manipulators_cpp REQUIRED)
17+
18+
add_executable(x7_forward_kinematics src/x7_forward_kinematics.cpp)
19+
ament_target_dependencies(x7_forward_kinematics
20+
rclcpp
21+
rt_manipulators_cpp
22+
)
23+
24+
if(BUILD_TESTING)
25+
find_package(ament_lint_auto REQUIRED)
26+
ament_lint_auto_find_test_dependencies()
27+
endif()
28+
29+
install(TARGETS x7_forward_kinematics
30+
DESTINATION lib/${PROJECT_NAME})
31+
32+
install(DIRECTORY
33+
launch
34+
config
35+
DESTINATION share/${PROJECT_NAME}/
36+
)
37+
38+
ament_package()

rt_manipulators_examples/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# RT Manipulators Examples
2+
3+
## CRANE-X7 Forward Kinematics
4+
5+
これは
6+
[rt_manipulators_cppのサンプル](https://github.com/rt-net/rt_manipulators_cpp/blob/v1.1.2/samples/samples02/src/x7_forward_kinematics.cpp)
7+
をROS 2用に変換したものです
8+
9+
```sh
10+
$ ros2 launch rt_manipulators_examples example.launch.py example:=x7_forward_kinematics
11+
```
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
リンク名称,ID,,,,ワールド座標系ホームポジション位置,,,ワールド座標系リンク間相対距離,,,ワールド座標系ホームポジション姿勢,,,質量[g],ローカル座標系質量位置,,,ローカル座標系慣性テンソル(重心),,,,,,ハードウェア可動範囲,,角度制限設定済可動範囲,,ホームポジション角度,回転軸方向,サーボモータ種類,トルク定数,サーボモータID,サーボモータ可動範囲,,通信速度,Return Delay Time,Operation Mode,Pゲイン,Iゲイン,Dゲイン
2-
,自分リンク,妹リンク,子リンク,親リンク,x[mm],y[mm],z[mm],x[mm],y[mm],z[mm],X[deg],Y[deg],Z[deg],m[g],x[mm],y[mm],z[mm],Ixx[gmm^2],Ixy[gmm^2],Iyy[gmm^2],Ixz[gmm^2],Iyz[gmm^2],Izz[gmm^2],θ1[deg],θ2[deg],θ1[deg],θ2[deg],サーボ指令値[deg],±XYZ,型番,[Nm/A],ID,θ1[-],θ2[-],bps,-,,-,-,-
3-
CRANE-X7_Base,1,-,2,-,0,0,0,0,0,0,0,0,0,388,-6.734,-0.001,17.921,324812.981,1.195,482993.163,-47122.898,19.475,585569.734,-,-,-,-,-,-,-,,-,-,-,-,-,,-,-,-
4-
CRANE-X7_Link1,2,-,3,1,0,0,41,0,0,41,0,0,0,253,0.243,-0.105,46.95,178706.106,-73.234,176299.332,888.676,623.013,89586.08,-160,160,-157,157,180,Z+,XM430-W350,1.783,2,262,3834,3Mbps,0,3,1000,300,200
5-
CRANE-X7_Link2,3,-,4,2,0,0,105,0,0,64,90,0,0,136,0.031,34.172,0.019,168092.477,20.51,96197.568,-400.417,62.417,134475.028,-90,90,-90,90,180,Y-,XM540-W270,2.409,3,1024,3072,3Mbps,0,3,2200,500,500
6-
CRANE-X7_Link3,4,-,5,3,0,0,170,0,0,65,0,0,0,321,-13.722,-0.081,95.202,1819759.341,753.977,1883280.126,-37299.429,4147.003,158644.809,-160,160,-157,157,180,Z+,XM430-W350,1.783,4,262,3834,3Mbps,0,3,3000,800,1000
7-
CRANE-X7_Link4,5,-,6,4,0,0,355,0,0,185,90,0,0,222,-9.388,80.39,0.064,488905.787,-3904.567,114431.658,82.949,2823.368,502575.787,-160,0,-160,0,180,Y-,XM430-W350,1.783,5,228,2048,3Mbps,0,3,1600,400,400
8-
CRANE-X7_Link5,6,-,7,5,0,0,476,0,0,121,0,0,0,207,-0.084,0.462,63.718,290227.705,100.249,257036.585,-476.631,-16861.834,87512.332,-160,160,-157,157,180,Z+,XM430-W350,1.783,6,262,3834,3Mbps,0,3,800,200,200
9-
CRANE-X7_Link6,7,-,8,6,0,0,605,0,0,129,90,0,0,140,6.1,-3.549,0.826,40139.362,-2908.265,61345.454,639.429,-489.787,73485.846,-90,90,-90,90,180,Y-,XM430-W350,1.783,7,1024,3072,3Mbps,0,3,800,100,200
10-
CRANE-X7_Link7,8,-,9,7,0,0,624,0,0,19,0,0,0,121,0.108,-1.034,20.848,32035.813,-94.503,41433.837,261.225,388.481,42899.559,-170,170,-167,167,180,Z+,XM430-W350,1.783,8,148,3948,3Mbps,0,3,800,100,200
11-
CRANE-X7_HandA,9,10,-,8,-12,0,648,-12,0,24,90,0,0,15.8,-2.647,26.904,3.541,10056.667,-197.178,4954.751,-98.854,536.803,6239.775,0,90,-5,90,180,Y-,XM430-W350,1.783,9,1991,3072,3Mbps,0,3,-,-,-
12-
CRANE-X7_HandB,10,-,-,8,12,0,648,12,0,24,90,0,0,13.9,3.008,30.851,2.845,7483.7,361.284,4088.581,63.385,228.226,4372.991,0,90,-5,90,180,Y+,-,,-,-,-,-,-,,-,-,-
1+
リンク名称,ID,,,,ワールド座標系ホームポジション位置,,,ワールド座標系リンク間相対距離,,,ワールド座標系ホームポジション姿勢,,,質量[g],ローカル座標系質量位置,,,ローカル座標系慣性テンソル(重心),,,,,,ハードウェア可動範囲,,角度制限設定済可動範囲,,ホームポジション角度,回転軸方向,サーボモータ種類,トルク定数,サーボモータID,サーボモータ可動範囲,,通信速度,Return Delay Time,Operation Mode,Pゲイン,Iゲイン,Dゲイン
2+
,自分リンク,妹リンク,子リンク,親リンク,x[mm],y[mm],z[mm],x[mm],y[mm],z[mm],X[deg],Y[deg],Z[deg],m[g],x[mm],y[mm],z[mm],Ixx[gmm^2],Ixy[gmm^2],Iyy[gmm^2],Ixz[gmm^2],Iyz[gmm^2],Izz[gmm^2],θ1[deg],θ2[deg],θ1[deg],θ2[deg],サーボ指令値[deg],±XYZ,型番,[Nm/A],ID,θ1[-],θ2[-],bps,-,,-,-,-
3+
CRANE-X7_Base,1,-,2,-,0,0,0,0,0,0,0,0,0,388,-6.734,-0.001,17.921,324812.981,1.195,482993.163,-47122.898,19.475,585569.734,-,-,-,-,-,-,-,,-,-,-,-,-,,-,-,-
4+
CRANE-X7_Link1,2,-,3,1,0,0,41,0,0,41,0,0,0,253,0.243,-0.105,46.95,178706.106,-73.234,176299.332,888.676,623.013,89586.08,-160,160,-157,157,180,Z+,XM430-W350,1.783,2,262,3834,3Mbps,0,3,1000,300,200
5+
CRANE-X7_Link2,3,-,4,2,0,0,105,0,0,64,90,0,0,136,0.031,34.172,0.019,168092.477,20.51,96197.568,-400.417,62.417,134475.028,-90,90,-90,90,180,Y-,XM540-W270,2.409,3,1024,3072,3Mbps,0,3,2200,500,500
6+
CRANE-X7_Link3,4,-,5,3,0,0,170,0,0,65,0,0,0,321,-13.722,-0.081,95.202,1819759.341,753.977,1883280.126,-37299.429,4147.003,158644.809,-160,160,-157,157,180,Z+,XM430-W350,1.783,4,262,3834,3Mbps,0,3,3000,800,1000
7+
CRANE-X7_Link4,5,-,6,4,0,0,355,0,0,185,90,0,0,222,-9.388,80.39,0.064,488905.787,-3904.567,114431.658,82.949,2823.368,502575.787,-160,0,-160,0,180,Y-,XM430-W350,1.783,5,228,2048,3Mbps,0,3,1600,400,400
8+
CRANE-X7_Link5,6,-,7,5,0,0,476,0,0,121,0,0,0,207,-0.084,0.462,63.718,290227.705,100.249,257036.585,-476.631,-16861.834,87512.332,-160,160,-157,157,180,Z+,XM430-W350,1.783,6,262,3834,3Mbps,0,3,800,200,200
9+
CRANE-X7_Link6,7,-,8,6,0,0,605,0,0,129,90,0,0,140,6.1,-3.549,0.826,40139.362,-2908.265,61345.454,639.429,-489.787,73485.846,-90,90,-90,90,180,Y-,XM430-W350,1.783,7,1024,3072,3Mbps,0,3,800,100,200
10+
CRANE-X7_Link7,8,-,9,7,0,0,624,0,0,19,0,0,0,121,0.108,-1.034,20.848,32035.813,-94.503,41433.837,261.225,388.481,42899.559,-170,170,-167,167,180,Z+,XM430-W350,1.783,8,148,3948,3Mbps,0,3,800,100,200
11+
CRANE-X7_HandA,9,10,-,8,-12,0,648,-12,0,24,90,0,0,15.8,-2.647,26.904,3.541,10056.667,-197.178,4954.751,-98.854,536.803,6239.775,0,90,-5,90,180,Y-,XM430-W350,1.783,9,1991,3072,3Mbps,0,3,-,-,-
12+
CRANE-X7_HandB,10,-,-,8,12,0,648,12,0,24,90,0,0,13.9,3.008,30.851,2.845,7483.7,361.284,4088.581,63.385,228.226,4372.991,0,90,-5,90,180,Y+,-,,-,-,-,-,-,,-,-,-
1313
右手系、正面はX方向,,,,,,,,,, ,,,,,,,,,,,,,,,,, c,,,,,,,,,,,,,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright 2022 RT Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import os
16+
17+
from ament_index_python.packages import get_package_share_directory
18+
from launch import LaunchDescription
19+
from launch.actions import DeclareLaunchArgument
20+
from launch.substitutions import LaunchConfiguration
21+
from launch_ros.actions import Node
22+
23+
24+
def generate_launch_description():
25+
declare_example_name = DeclareLaunchArgument(
26+
'example', default_value='x7_forward_kinematics',
27+
description=('Set an example executable name: '
28+
'[x7_forward_kinematics]')
29+
)
30+
31+
config_file_path = os.path.join(
32+
get_package_share_directory('rt_manipulators_examples'),
33+
'config',
34+
'crane-x7.yaml'
35+
)
36+
37+
link_file_path = os.path.join(
38+
get_package_share_directory('rt_manipulators_examples'),
39+
'config',
40+
'crane-x7_links.csv'
41+
)
42+
43+
example_node = Node(name=[LaunchConfiguration('example')],
44+
package='rt_manipulators_examples',
45+
executable=LaunchConfiguration('example'),
46+
output='screen',
47+
parameters=[{
48+
'port_name': '/dev/ttyUSB0',
49+
'baudrate': 3000000,
50+
'config_file_path': config_file_path,
51+
'link_file_path': link_file_path,
52+
}])
53+
54+
ld = LaunchDescription()
55+
ld.add_action(declare_example_name)
56+
ld.add_action(example_node)
57+
58+
return ld

rt_manipulators_examples/package.xml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
<name>rt_manipulators_examples</name>
5+
<version>0.0.0</version>
6+
<description>Examples for RT Manipulators C++ Library</description>
7+
<maintainer email="[email protected]">RT Corporation</maintainer>
8+
<license>Apache License 2.0</license>
9+
10+
<author email="[email protected]">ShotaAk</author>
11+
12+
<buildtool_depend>ament_cmake</buildtool_depend>
13+
14+
<depend>rclcpp</depend>
15+
<depend>rt_manipulators_cpp</depend>
16+
17+
<test_depend>ament_lint_auto</test_depend>
18+
<test_depend>ament_lint_common</test_depend>
19+
20+
<export>
21+
<build_type>ament_cmake</build_type>
22+
</export>
23+
</package>

0 commit comments

Comments
 (0)