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

2.1.0リリースのためにros2ブランチの変更差分をhumble-develブランチへマージ #79

Merged
merged 5 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
96 changes: 96 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,102 @@ ros2 launch raspimouse_ros2_examples object_tracking.launch.py mouse:=false use_

![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_object_tracking.gif)

### camera_line_follower

Terminal 1:

```sh
ros2 launch raspimouse_gazebo raspimouse_with_line_follower_field.launch.py use_rgb_camera:=true camera_downward:=true
```

Terminal 2:

```sh
ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py mouse:=false use_camera_node:=false
```

Terminal 3: Start

```sh
ros2 topic pub --once /switches raspimouse_msgs/msg/Switches "{switch0: false, switch1: false, switch2: true}"
```

Terminal 3: Stop
```sh
ros2 topic pub --once /switches raspimouse_msgs/msg/Switches "{switch0: true, switch1: false, switch2: false}"
```

For information on parameters in camera line follower, click [here](https://github.com/rt-net/raspimouse_ros2_examples/blob/master/README.en.md#parameters).

![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_camerafollower_short.gif)

### SLAM & Navigation

#### SLAM

Terminal 1:
```sh
ros2 launch raspimouse_gazebo raspimouse_with_lakehouse.launch.py lidar:=urg
```
The lidar option supports `urg`, `lds`, and `rplidar`.

Terminal 2:
```sh
ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=false
```

Terminal 3:
```sh
ros2 launch raspimouse_slam pc_slam.launch.py
```

![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_slam.png)

Terminal 4:
```sh
ros2 run nav2_map_server map_saver_cli -f ~/MAP_NAME
```

![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_slam_short.gif)

#### Navigation

Terminal 1:
```sh
ros2 launch raspimouse_gazebo raspimouse_with_lakehouse.launch.py lidar:=urg
```
The lidar option supports `urg`, `lds`, and `rplidar`.

Terminal 2:
```sh
ros2 launch raspimouse_navigation pc_navigation.launch.py map:=$HOME/MAP_NAME.yaml
```

![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_navigation_short.gif)

## Model data list

### course_curve_50x50cm
Curve course panel for line following.
Panel size is 50 cm x 50 cm and line width is 4 cm.

![](./raspimouse_gazebo/models/course_curve_50x50cm/meshes/course_curve.jpg)

### course_straight_50x50cm
Straight course panel for line following.
Panel size is 50 cm x 50 cm and line width is 4 cm.

![](./raspimouse_gazebo/models/course_straight_50x50cm/meshes/course_straight.jpg)

### cube_*cm_color-name
Each cube is 5 cm, 7.5 cm, 10 cm, and 15 cm, 30 cm on a side.
The cube colors are red, yellow, blue, green and black.

![](https://rt-net.github.io/images/raspberry-pi-mouse/color_objects.png)

### about dae files
The dae file is edited in Blender 4.0.

## License

This repository is licensed under the MIT license, see [LICENSE]( ./LICENSE ).
Expand Down
98 changes: 98 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ git clone -b ros2 https://github.com/rt-net/raspimouse_sim.git
```sh
cd ~/ros2_ws/src
git clone https://github.com/rt-net/raspimouse_ros2_examples.git
git clone https://github.com/rt-net/raspimouse_slam_navigation_ros2.git
git clone -b ros2 https://github.com/rt-net/raspimouse_description.git
rosdep install -r -y -i --from-paths raspimouse*
```
Expand Down Expand Up @@ -93,6 +94,103 @@ ros2 launch raspimouse_ros2_examples object_tracking.launch.py mouse:=false use_

![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_object_tracking.gif)

### RGBカメラを用いたライントレースサンプル

端末1で次のコマンドを実行すると、ライントレースのサンプルコースが配置されたワールドが表示されます。
```sh
ros2 launch raspimouse_gazebo raspimouse_with_line_follower_field.launch.py use_rgb_camera:=true camera_downward:=true
```

端末2で次のコマンドを実行すると、カメラライントレースのノードが起動します。
```sh
ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py mouse:=false use_camera_node:=false
```

端末3で次のコマンドを実行すると、Raspberry Pi Mouseが走行を開始します。
```sh
ros2 topic pub --once /switches raspimouse_msgs/msg/Switches "{switch0: false, switch1: false, switch2: true}"
```

次のコマンドを実行すると、Raspberry Pi Mouseが停止します。
```sh
ros2 topic pub --once /switches raspimouse_msgs/msg/Switches "{switch0: true, switch1: false, switch2: false}"
```

カメラライントレースにおけるパラメータは[こちら](https://github.com/rt-net/raspimouse_ros2_examples?tab=readme-ov-file#parameters)を参照してください。

![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_camerafollower_short.gif)

### LiDARを用いたSLAMとNavigationのサンプル

#### SLAM

端末1で次のコマンドを実行すると、`Lake House`のモデルが配置されたワールドが表示されます。
```sh
ros2 launch raspimouse_gazebo raspimouse_with_lakehouse.launch.py lidar:=urg
```
`lidar`は`urg`、`lds`、`rplidar`のいずれかを指定してください。

端末2で次のコマンドを実行すると、Raspberry Pi Mouseをジョイスティックコントローラで操作できます。
```sh
ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=false
```

端末3で次のコマンドを実行すると、SLAMが実行されます。
```sh
ros2 launch raspimouse_slam pc_slam.launch.py
```

![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_slam.png)

端末4で次のコマンドを実行すると、作成した地図を保存できます。
```sh
ros2 run nav2_map_server map_saver_cli -f ~/MAP_NAME
```
`MAP_NAME`は任意の名前を指定できます。

![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_slam_short.gif)

#### Navigation

端末1で次のコマンドを実行すると、`Lake House`のモデルが配置されたワールドが表示されます。
```sh
ros2 launch raspimouse_gazebo raspimouse_with_lakehouse.launch.py lidar:=urg
```
`lidar`は`urg`、`lds`、`rplidar`のいずれかを指定してください。

端末2で次のコマンドを実行すると、Navigationが実行されます。
```sh
ros2 launch raspimouse_navigation pc_navigation.launch.py map:=$HOME/MAP_NAME.yaml
```
引数`map`にはSLAMで作成した地図ファイルのパスを指定してください。

![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_navigation_short.gif)

## モデルデータ一覧

### course_curve_50x50cm

ライントレース用の曲線コースパネルです。
パネルサイズは50cm x 50cm、線の幅は4cmです。

![](./raspimouse_gazebo/models/course_curve_50x50cm/meshes/course_curve.jpg)

### course_straight_50x50cm

ライントレース用の直線コースパネルです。
パネルサイズは50cm x 50cm、線の幅は4cmです。

![](./raspimouse_gazebo/models/course_straight_50x50cm/meshes/course_straight.jpg)

### cube_*cm_color-name
それぞれ一辺5cm、7.5cm、10cm、15cm、30cmの立方体です。
色は赤、黄、青、緑、黒です。

![](https://rt-net.github.io/images/raspberry-pi-mouse/color_objects.png)

### daeファイルについて
daeファイルはBlender 4.0で編集しています。

## ライセンス

このリポジトリはMITライセンスに基づいて公開されています。
Expand Down
3 changes: 3 additions & 0 deletions raspimouse_fake/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Changelog for package raspimouse_fake
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2.1.0 (2024-03-05)
------------------

2.0.0 (2023-11-07)
------------------
* シミュレータ環境に擬似的なラズパイマウスノードを追加 (`#69 <https://github.com/rt-net/raspimouse_sim/issues/69>`_)
Expand Down
2 changes: 1 addition & 1 deletion raspimouse_fake/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>raspimouse_fake</name>
<version>2.0.0</version>
<version>2.1.0</version>
<description>The raspimouse_control package</description>
<maintainer email="shop@rt-net.jp">RT Corporation</maintainer>
<license>MIT</license>
Expand Down
11 changes: 11 additions & 0 deletions raspimouse_gazebo/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
Changelog for package raspimouse_gazebo
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2.1.0 (2024-03-05)
------------------
* シミュレータ環境でSLAMとNavigationを実行 (`#77 <https://github.com/rt-net/raspimouse_sim/issues/77>`_)
Co-authored-by: Shota Aoki <s.aoki@rt-net.jp>
* コントローラのパラメータを調整してオドメトリのズレを修正 (`#76 <https://github.com/rt-net/raspimouse_sim/issues/76>`_)
* camera_downwardがtrueのときRGBカメラが斜め下を向くように変更 (`#75 <https://github.com/rt-net/raspimouse_sim/issues/75>`_)
Co-authored-by: Shota Aoki <s.aoki@rt-net.jp>
* ライントレース用のコースを作成 (`#74 <https://github.com/rt-net/raspimouse_sim/issues/74>`_)
Co-authored-by: Shota Aoki <s.aoki@rt-net.jp>
* Contributors: YusukeKato

2.0.0 (2023-11-07)
------------------
* Gazebo上で画像トピックを配信できるようにbridgeを設定 (`#71 <https://github.com/rt-net/raspimouse_sim/issues/71>`_)
Expand Down
6 changes: 3 additions & 3 deletions raspimouse_gazebo/config/raspimouse_controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ diff_drive_controller:
wheel_separation : 0.09
wheels_per_side: 1
wheel_radius : 0.024
wheel_separation_multiplier : 1.0
left_wheel_radius_multiplier : 1.0
right_wheel_radius_multiplier : 1.0
wheel_separation_multiplier : 0.95
left_wheel_radius_multiplier : 1.05
right_wheel_radius_multiplier : 1.05

odom_frame_id: odom
base_frame_id: base_footprint
Expand Down
25 changes: 25 additions & 0 deletions raspimouse_gazebo/launch/raspimouse_with_emptyworld.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,26 @@ def generate_launch_description():
'use_rgb_camera',
default_value='false',
description='Set "true" to mount rgb camera.')
declare_arg_camera_downward = DeclareLaunchArgument(
'camera_downward',
default_value='false',
description='Set "true" to point the camera downwards.')
declare_arg_world_name = DeclareLaunchArgument(
'world_name',
default_value=get_package_share_directory('raspimouse_gazebo')+'/worlds/empty_world.sdf',
description='Set world name.')
declare_arg_spawn_x = DeclareLaunchArgument(
'spawn_x',
default_value='0.0',
description='Set initial position x.')
declare_arg_spawn_y = DeclareLaunchArgument(
'spawn_y',
default_value='0.0',
description='Set initial position y.')
declare_arg_spawn_z = DeclareLaunchArgument(
'spawn_z',
default_value='0.02',
description='Set initial position z.')

env = {'IGN_GAZEBO_SYSTEM_PLUGIN_PATH': os.environ['LD_LIBRARY_PATH'],
'IGN_GAZEBO_RESOURCE_PATH': os.path.dirname(
Expand All @@ -71,6 +87,9 @@ def generate_launch_description():
output='screen',
arguments=['-topic', '/robot_description',
'-name', 'raspimouse',
'-x', LaunchConfiguration('spawn_x'),
'-y', LaunchConfiguration('spawn_y'),
'-z', LaunchConfiguration('spawn_z'),
'-allow_renaming', 'true'],
)

Expand All @@ -79,6 +98,7 @@ def generate_launch_description():
description_loader.lidar_frame = LaunchConfiguration('lidar_frame')
description_loader.use_gazebo = 'true'
description_loader.use_rgb_camera = LaunchConfiguration('use_rgb_camera')
description_loader.camera_downward = LaunchConfiguration('camera_downward')
description_loader.gz_control_config_package = 'raspimouse_gazebo'
description_loader.gz_control_config_file_path = 'config/raspimouse_controllers.yaml'

Expand Down Expand Up @@ -115,6 +135,7 @@ def generate_launch_description():
package='ros_gz_bridge',
executable='parameter_bridge',
arguments=['/clock@rosgraph_msgs/msg/Clock[ignition.msgs.Clock',
'/scan@sensor_msgs/msg/LaserScan@ignition.msgs.LaserScan',
'/camera/color/image_raw@sensor_msgs/msg/Image@gz.msgs.Image',
'/camera_info@sensor_msgs/msg/CameraInfo@gz.msgs.CameraInfo'],
output='screen'
Expand All @@ -139,7 +160,11 @@ def generate_launch_description():
declare_arg_lidar,
declare_arg_lidar_frame,
declare_arg_use_rgb_camera,
declare_arg_camera_downward,
declare_arg_world_name,
declare_arg_spawn_x,
declare_arg_spawn_y,
declare_arg_spawn_z,
ign_gazebo,
ignition_spawn_entity,
robot_state_publisher,
Expand Down
48 changes: 48 additions & 0 deletions raspimouse_gazebo/launch/raspimouse_with_lakehouse.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# The MIT License (MIT)
#
# Copyright 2024 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 import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch_ros.actions import SetParameter
from launch.launch_description_sources import PythonLaunchDescriptionSource


def generate_launch_description():
world_file = os.path.join(
get_package_share_directory('raspimouse_gazebo'),
'worlds',
'lakehouse.sdf')
world_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([
get_package_share_directory('raspimouse_gazebo'),
'/launch/raspimouse_with_emptyworld.launch.py']),
launch_arguments={
'world_name': world_file
}.items()
)

return LaunchDescription([
SetParameter(name='use_sim_time', value=True),
world_launch
])
Loading