Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROS 2に対応 #28

Merged
merged 24 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
08e9a4a
samplesディレクトリを削除
ShotaAk May 27, 2022
8797d96
ros2 foxyでビルドできるようにCMakeLists.txtとpackage.xmlを追加
ShotaAk Jun 1, 2022
32b9a4a
CIをROS 2用に変更
ShotaAk Jun 1, 2022
b192f2a
Eigen3の依存関係を追加
ShotaAk Jun 1, 2022
fe95e4b
Revert "CIをROS 2用に変更"
ShotaAk Jun 1, 2022
e96cfd6
ROS 2 CI用のworkflowを追加
ShotaAk Jun 1, 2022
a6535d8
package.xmlを微修正
ShotaAk Jun 1, 2022
0373131
ライブラリが使えることの確認ようにサンプルパッケージを追加
ShotaAk Jun 1, 2022
38f0d37
includeパスを修正
ShotaAk Jun 1, 2022
9a5c6c8
Update build_test.yaml
ShotaAk Jun 2, 2022
7e01e91
READMEの文言をROS 2向けに変更
ShotaAk Jun 2, 2022
a4a056f
CIにgalacticとhumbleを追加
ShotaAk Jun 2, 2022
e9edbd2
Merge branch 'feature/support_ros2' of github.com:rt-net/rt_manipulat…
ShotaAk Jun 2, 2022
8609c75
CIにrollingを追加
ShotaAk Jun 2, 2022
60ddc16
ビルド手順を修正
ShotaAk Jun 2, 2022
063bb50
README微修正
ShotaAk Jun 2, 2022
cb605cd
Revert "samplesディレクトリを削除"
ShotaAk Jun 2, 2022
2051c32
actions/checkoutをv3に変更
ShotaAk Jun 2, 2022
2f76342
samplesディレクトリを削除
ShotaAk Jun 2, 2022
df05482
Update rt_manipulators_examples/package.xml
ShotaAk Jun 8, 2022
d62b4e8
Update rt_manipulators_lib/package.xml
ShotaAk Jun 8, 2022
c020218
Update README.md
ShotaAk Jun 8, 2022
d49c459
Update rt_manipulators_lib/package.xml
ShotaAk Jun 10, 2022
6d77ff7
vectorのwarning修正
ShotaAk Jun 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/build_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ name: BuildAndTest

on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
schedule:
- cron: "0 2 * * 0" # Weekly on Sundays at 02:00
- '**.md'

jobs:
lint:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/industrial_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: industrial_ci

on:
push:
paths-ignore:
- 'docs/**'
- '**.md'
pull_request:
paths-ignore:
- 'docs/**'
- '**.md'
schedule:
- cron: "0 2 * * 0" # Weekly on Sundays at 02:00

jobs:
industrial_ci:
strategy:
matrix:
env:
- { ROS_DISTRO: foxy, ROS_REPO: ros }
- { ROS_DISTRO: galactic, ROS_REPO: ros }
- { ROS_DISTRO: humble, ROS_REPO: ros }
- { ROS_DISTRO: rolling, ROS_REPO: ros }
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: "ros-industrial/industrial_ci@master"
env: ${{ matrix.env }}
82 changes: 10 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RTマニピュレータC++ライブラリとサンプル集(rt_manipulators_cpp)

[![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)
[![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)

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

[![gravity_compensation](https://rt-net.github.io/images/crane-x7/x7_s17_gravity_compensation.gif)](./samples/samples03/README.md)

## 動作環境

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

## インストール方法

### DYNAMIXEL SDKのインストール

[DYNAMIXEL SDKのe-manual](https://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_sdk/library_setup/cpp_linux/#cpp-linux)
を参考に、Linux 64bit環境用にDYNAMIXEL SDKをビルド&インストールします。

```sh
$ sudo apt install build-essential
$ cd ~
$ git clone https://github.com/ROBOTIS-GIT/DynamixelSDK.git
$ cd ~/DynamixelSDK/c++/build/linux64
$ make
$ sudo make install
```

### その他依存関係のインストール

次のコマンドを実行します。

```sh
$ sudo apt install libyaml-cpp-dev libeigen3-dev cmake
```

### RTマニピュレータC++ライブラリのビルド&インストール

詳細は[rt_manipulators_lib/README.md](./rt_manipulators_lib/README.md)を参照してください。

```sh
$ cd ~
$ git clone https://github.com/rt-net/rt_manipulators_cpp
$ cd rt_manipulators_cpp/rt_manipulators_lib
$ ./build_install_library.bash
$ cd ros2_ws/src
ShotaAk marked this conversation as resolved.
Show resolved Hide resolved
$ git clone -b ros2 https://github.com/rt-net/rt_manipulators_cpp
$ rosdep install -r -y --from-paths . --ignore-src
$ cd ..
$ colcon build --symlink-install
```

## サンプルプログラムの実行

詳細は[samples/README.md](./samples/README.md)を参照してください。

```sh
$ cd rt_manipulators_cpp/samples/samples01
$ ./build_samples.bash

$ cd bin/
$ ./x7_onoff
CRANE-X7のトルクをON/OFFするサンプルです.
CRANE-X7(ポート:/dev/ttyUSB0 ボーレート:3000000)に接続します.
コンフィグファイル:../config/crane-x7.yamlを読み込みます.
Config file '../config/crane-x7.yaml' loaded.
arm
joint1, id:2, mode:3
joint2, id:3, mode:3
joint3, id:4, mode:3
joint4, id:5, mode:3
joint5, id:6, mode:3
joint6, id:7, mode:3
joint7, id:8, mode:3
hand
joint_hand, id:9, mode:3
サーボグループ:armのトルクをONにします.
...
```

[![](https://img.youtube.com/vi/cA_3HU3HfcM/sddefault.jpg)](https://youtu.be/cA_3HU3HfcM)

## 免責事項

当該製品および当ソフトウェアの使用中に生じたいかなる損害も株式会社アールティでは一切の責任を負いかねます。
Expand Down
38 changes: 38 additions & 0 deletions rt_manipulators_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
cmake_minimum_required(VERSION 3.5)
project(rt_manipulators_examples)

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rt_manipulators_cpp REQUIRED)

add_executable(x7_forward_kinematics src/x7_forward_kinematics.cpp)
ament_target_dependencies(x7_forward_kinematics
rclcpp
rt_manipulators_cpp
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

install(TARGETS x7_forward_kinematics
DESTINATION lib/${PROJECT_NAME})

install(DIRECTORY
launch
config
DESTINATION share/${PROJECT_NAME}/
)

ament_package()
11 changes: 11 additions & 0 deletions rt_manipulators_examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# RT Manipulators Examples

## CRANE-X7 Forward Kinematics

これは
[rt_manipulators_cppのサンプル](https://github.com/rt-net/rt_manipulators_cpp/blob/v1.1.2/samples/samples02/src/x7_forward_kinematics.cpp)
をROS 2用に変換したものです

```sh
$ ros2 launch rt_manipulators_examples example.launch.py example:=x7_forward_kinematics
```
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
リンク名称,ID,,,,ワールド座標系ホームポジション位置,,,ワールド座標系リンク間相対距離,,,ワールド座標系ホームポジション姿勢,,,質量[g],ローカル座標系質量位置,,,ローカル座標系慣性テンソル(重心),,,,,,ハードウェア可動範囲,,角度制限設定済可動範囲,,ホームポジション角度,回転軸方向,サーボモータ種類,トルク定数,サーボモータID,サーボモータ可動範囲,,通信速度,Return Delay Time,Operation Mode,Pゲイン,Iゲイン,Dゲイン
,自分リンク,妹リンク,子リンク,親リンク,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,-,,-,-,-
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,-,-,-,-,-,-,-,,-,-,-,-,-,,-,-,-
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
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
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
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
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
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
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
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,-,-,-
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+,-,,-,-,-,-,-,,-,-,-
リンク名称,ID,,,,ワールド座標系ホームポジション位置,,,ワールド座標系リンク間相対距離,,,ワールド座標系ホームポジション姿勢,,,質量[g],ローカル座標系質量位置,,,ローカル座標系慣性テンソル(重心),,,,,,ハードウェア可動範囲,,角度制限設定済可動範囲,,ホームポジション角度,回転軸方向,サーボモータ種類,トルク定数,サーボモータID,サーボモータ可動範囲,,通信速度,Return Delay Time,Operation Mode,Pゲイン,Iゲイン,Dゲイン
,自分リンク,妹リンク,子リンク,親リンク,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,-,,-,-,-
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,-,-,-,-,-,-,-,,-,-,-,-,-,,-,-,-
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
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
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
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
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
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
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
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,-,-,-
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+,-,,-,-,-,-,-,,-,-,-
右手系、正面はX方向,,,,,,,,,, ,,,,,,,,,,,,,,,,, c,,,,,,,,,,,,,
58 changes: 58 additions & 0 deletions rt_manipulators_examples/launch/example.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2022 RT Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node


def generate_launch_description():
declare_example_name = DeclareLaunchArgument(
'example', default_value='x7_forward_kinematics',
description=('Set an example executable name: '
'[x7_forward_kinematics]')
)

config_file_path = os.path.join(
get_package_share_directory('rt_manipulators_examples'),
'config',
'crane-x7.yaml'
)

link_file_path = os.path.join(
get_package_share_directory('rt_manipulators_examples'),
'config',
'crane-x7_links.csv'
)

example_node = Node(name=[LaunchConfiguration('example')],
package='rt_manipulators_examples',
executable=LaunchConfiguration('example'),
output='screen',
parameters=[{
'port_name': '/dev/ttyUSB0',
'baudrate': 3000000,
'config_file_path': config_file_path,
'link_file_path': link_file_path,
}])

ld = LaunchDescription()
ld.add_action(declare_example_name)
ld.add_action(example_node)

return ld
23 changes: 23 additions & 0 deletions rt_manipulators_examples/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>rt_manipulators_examples</name>
<version>0.0.0</version>
<description>Examples for RT Manipulators C++ Library</description>
<maintainer email="shop@rt-net.jp">RT Corporation</maintainer>
ShotaAk marked this conversation as resolved.
Show resolved Hide resolved
<license>Apache License 2.0</license>

<author email="s.aoki@rt-net.jp">ShotaAk</author>

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>rclcpp</depend>
<depend>rt_manipulators_cpp</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
Loading