Skip to content

Commit

Permalink
1.1.0リリースのためにros2ブランチの変更差分をhumble-develブランチへマージ (#49)
Browse files Browse the repository at this point in the history
Co-authored-by: Daisuke Sato <daisuke.sato@rt-net.jp>
Co-authored-by: Shota Aoki <s.aoki@rt-net.jp>
  • Loading branch information
3 people authored Nov 7, 2023
1 parent bdd3e2a commit 833a5e2
Show file tree
Hide file tree
Showing 17 changed files with 399 additions and 67 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/industrial_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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: humble, ROS_REPO: ros }
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: "ros-industrial/industrial_ci@master"
env: ${{ matrix.env }}
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
Changelog for package raspimouse_description
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1.1.0 (2023-11-07)
------------------
* READMEにRGBカメラを表示するコマンドを追記 (`#47 <https://github.com/rt-net/raspimouse_description/issues/47>`_)
* Gazebo上で画像トピックを配信できるように変更 (`#46 <https://github.com/rt-net/raspimouse_description/issues/46>`_)
* RGBカメラのモデルを表示できるように変更 (`#45 <https://github.com/rt-net/raspimouse_description/issues/45>`_)
Co-authored-by: Shota Aoki <s.aoki@rt-net.jp>
* cmd_velとodomのトピック名をremapping (`#44 <https://github.com/rt-net/raspimouse_description/issues/44>`_)
* controller managerが起動するように変更 (`#43 <https://github.com/rt-net/raspimouse_description/issues/43>`_)
Co-authored-by: Shota Aoki <s.aoki@rt-net.jp>
* robot_description_loaderを実装 (`#42 <https://github.com/rt-net/raspimouse_description/issues/42>`_)
Co-authored-by: Daisuke Sato <daisuke.sato@rt-net.jp>
* Contributors: YusukeKato

1.0.1 (2023-01-31)
------------------
* Updates README
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,17 @@ install(DIRECTORY
DESTINATION share/${PROJECT_NAME}/
)

ament_python_install_package(${PROJECT_NAME})
install(PROGRAMS
${PROJECT_NAME}/robot_description_loader.py
DESTINATION lib/${PROJECT_NAME})

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

find_package(ament_cmake_pytest REQUIRED)
ament_add_pytest_test(test_robot_description_loader test/test_robot_description_loader.py)
endif()

ament_package()
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contribution Guide

本リポジトリへのコントリビュート方法について記載しています。

## Issues

リポジトリの品質向上にご協力頂きありがとうございます。

Issueの作成を簡単にするテンプレートを用意しているので活用してください。

## Pull Requests

Pull Requestの作成ありがとうございます。
提出したPull Request(PR)には次のルールが適用されます。

- PRの内容には本リポジトリのライセンス([LICENSE](./LICENSE)[README.md](./README.md)に記載されています)が適用されます
- PRは`rt-net`のメンバーによるレビューを経てからマージされます
- すべてのPRがマージされるわけではなく、希望に添えない場合もありますのでご容赦ください
- リポジトリにテストが設定されている場合はできるだけテストを通してください
- 何かしらの理由(テストに間違いがある場合など)でテストを通さずPRを出す場合はその旨をPRに記載してください
- マージする際にはPR内の全コミットが1つのコミットに`squash`されます
- [コミットをスカッシュしてマージする | GitHub Docs](https://docs.github.com/ja/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits)
- 1つのPRでリクエストする変更はできるだけシンプルにしてください
- 異なる内容の変更を含む場合はPRを分割してください
- 例えば、複数の機能追加したり、機能追加とリファクタリングを同時にする場合はそれぞれ別々のPRとしてください
- squashマージしても履歴を辿りやすくするためです

## LICENSE

Any contribution that you make to this repository will
be under the MIT license, as dictated by that
[license](https://opensource.org/licenses/MIT).
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ ros2 launch raspimouse_description display.launch.py lidar:=rplidar

The `lidar` option supports `urg`, `lds`, and `rplidar`.

Similarly, display a RGB Camera mounted robot model with the following command:

```sh
ros2 launch raspimouse_description display.launch.py use_rgb_camera:=true
```

## LICENSE

(C) 2016-2022 RT Corporation
Expand Down
25 changes: 12 additions & 13 deletions launch/display.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
# 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 raspimouse_description.robot_description_loader import RobotDescriptionLoader
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.conditions import IfCondition
from launch_ros.actions import Node
from launch_ros.actions import PushRosNamespace
from launch.substitutions import Command
from launch.substitutions import LaunchConfiguration


Expand All @@ -41,23 +40,22 @@ def generate_launch_description():
'use_rviz',
default_value='true',
description='Set "true" to launch rviz.')
declare_arg_use_rgb_camera = DeclareLaunchArgument(
'use_rgb_camera',
default_value='false',
description='Set "true" to mount rgb camera.')

xacro_file = os.path.join(
get_package_share_directory('raspimouse_description'),
'urdf',
'raspimouse.urdf.xacro')
params = {'robot_description': Command(['xacro ', xacro_file,
' lidar:=', LaunchConfiguration('lidar'),
' lidar_frame:=', LaunchConfiguration('lidar_frame'),
]),
'frame_prefix': [LaunchConfiguration('namespace'), '/']}
description_loader = RobotDescriptionLoader()
description_loader.lidar = LaunchConfiguration('lidar')
description_loader.lidar_frame = LaunchConfiguration('lidar_frame')
description_loader.use_rgb_camera = LaunchConfiguration('use_rgb_camera')

push_ns = PushRosNamespace([LaunchConfiguration('namespace')])

rsp = Node(package='robot_state_publisher',
executable='robot_state_publisher',
output='both',
parameters=[params])
parameters=[{'robot_description': description_loader.load()}])

jsp = Node(
package='joint_state_publisher_gui',
Expand All @@ -79,8 +77,9 @@ def generate_launch_description():
declare_arg_lidar_frame,
declare_arg_namespace,
declare_arg_use_rviz,
declare_arg_use_rgb_camera,
push_ns,
rsp,
jsp,
rviz_node,
])
])
11 changes: 8 additions & 3 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>raspimouse_description</name>
<version>1.0.1</version>
<version>1.1.0</version>
<description>The raspimouse_description package</description>
<maintainer email="shop@rt-net.jp">RT Corporation</maintainer>
<author email="daisuke.sato@rt-net.jp">Daisuke Sato</author>
<author email="s.aoki@rt-net.jp">Daisuke Sato</author>

<license>MIT</license>

<author email="daisuke.sato@rt-net.jp">Daisuke Sato</author>
<author email="s.aoki@rt-net.jp">Shota Aoki</author>
<author email="yusuke.kato@rt-net.jp">Yusuke Kato</author>

<buildtool_depend>ament_cmake</buildtool_depend>

Expand All @@ -18,6 +20,9 @@
<depend>rviz2</depend>
<depend>urdf</depend>
<depend>xacro</depend>
<depend>launch</depend>
<depend>ign_ros2_control</depend>
<depend>realsense2_description</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
Empty file.
52 changes: 52 additions & 0 deletions raspimouse_description/robot_description_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# The MIT License (MIT)
#
# Copyright 2023 RT Corporation <support@rt-net.jp>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import os

from ament_index_python.packages import get_package_share_directory
from launch.substitutions import Command


class RobotDescriptionLoader():

def __init__(self):
self.robot_description_path = os.path.join(
get_package_share_directory('raspimouse_description'),
'urdf',
'raspimouse.urdf.xacro')
self.lidar = 'none'
self.lidar_frame = 'laser'
self.use_gazebo = 'false'
self.use_rgb_camera = 'false'
self.gz_control_config_package = ''
self.gz_control_config_file_path = ''

def load(self):
return Command([
'xacro ',
self.robot_description_path,
' lidar:=', self.lidar,
' lidar_frame:=', self.lidar_frame,
' use_gazebo:=', self.use_gazebo,
' use_rgb_camera:=', self.use_rgb_camera,
' gz_control_config_package:=', self.gz_control_config_package,
' gz_control_config_file_path:=', self.gz_control_config_file_path
])
Empty file added test/dummy_controllers.yaml
Empty file.
110 changes: 110 additions & 0 deletions test/test_robot_description_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# The MIT License (MIT)
#
# Copyright 2023 RT Corporation <support@rt-net.jp>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from raspimouse_description.robot_description_loader import RobotDescriptionLoader
from launch.launch_context import LaunchContext
import pytest


def exec_load(loader):
# Command substitutionの実行方法はCommandのテストを参考にした
# https://github.com/ros2/launch/blob/074cd2903ddccd61bce8f40a0f58da0b7c200481/launch/test/launch/substitutions/test_command.py#L47
context = LaunchContext()
return loader.load().perform(context)


def test_load_description():
# xacroの読み込みが成功することを期待
rdl = RobotDescriptionLoader()
assert exec_load(rdl)


def test_change_description_path():
# xacroのファイルパスを変更し、読み込みが失敗することを期待
rdl = RobotDescriptionLoader()
rdl.robot_description_path = 'hoge'
with pytest.raises(Exception) as e:
exec_load(rdl)
assert e.value


def test_lidar_none():
# lidarが変更されて、xacroに何もセットされないことを期待
rdl = RobotDescriptionLoader()
rdl.lidar = 'none'
assert 'laser' not in exec_load(rdl)


def test_lidar_urg():
# lidarが変更されて、xacroにURGがセットされることを期待
rdl = RobotDescriptionLoader()
rdl.lidar = 'urg'
assert 'urg_mount_link' in exec_load(rdl)


def test_lidar_lds():
# lidarが変更されて、xacroにLDSがセットされることを期待
rdl = RobotDescriptionLoader()
rdl.lidar = 'lds'
assert 'lds_multi_mount_link' in exec_load(rdl)


def test_lidar_rplidar():
# lidarが変更されて、xacroにRPLiDARがセットされることを期待
rdl = RobotDescriptionLoader()
rdl.lidar = 'rplidar'
assert 'rplidar_multi_mount_link' in exec_load(rdl)


def test_lidar_frame():
# lidar_frameが変更されて、xacroにlaserがセットされることを期待
rdl = RobotDescriptionLoader()
rdl.lidar = 'urg'
rdl.lidar_frame = 'laser'
assert 'laser' in exec_load(rdl)


def test_use_gazebo():
# use_gazeboが変更され、xacroにgazebo_ros2_controlがセットされることを期待
rdl = RobotDescriptionLoader()
rdl.use_gazebo = 'true'
rdl.gz_control_config_package = 'raspimouse_description'
rdl.gz_control_config_file_path = 'test/dummy_controllers.yaml'
assert 'ign_ros2_control/IgnitionSystem' in exec_load(rdl)


def test_use_rgb_camera():
# use_rgb_cameraが変更され、xacroにRGB Cameraがセットされることを期待
rdl = RobotDescriptionLoader()
rdl.use_rgb_camera = 'true'
rdl.gz_control_config_package = 'raspimouse_description'
rdl.gz_control_config_file_path = 'test/dummy_controllers.yaml'
assert 'realsense2_description/meshes/d435.dae' in exec_load(rdl)


def test_camera_link():
# use_gazeboとuse_rgb_cameraが変更され、xacroにcamera linkがセットされることを期待
rdl = RobotDescriptionLoader()
rdl.use_gazebo = 'true'
rdl.use_rgb_camera = 'true'
rdl.gz_control_config_package = 'raspimouse_description'
rdl.gz_control_config_file_path = 'test/dummy_controllers.yaml'
assert 'camera_link' in exec_load(rdl)
1 change: 1 addition & 0 deletions urdf/common.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<!-- PROPERTY LIST -->
<!-- All units in m-kg-s-radians unit system -->
<xacro:property name="M_PI" value="3.1415926535897932" />
<xacro:property name="WHEEL_VELOCITY_LIMIT" value="90" />

<!-- Inertial macros. Units are kg*m^2 -->
<xacro:macro name="box_inertia" params="m x y z">
Expand Down
Loading

0 comments on commit 833a5e2

Please sign in to comment.