Skip to content

Commit 337f271

Browse files
authored
Merge pull request #79 from rt-net/ros2
2.1.0リリースのためにros2ブランチの変更差分をhumble-develブランチへマージ
2 parents 1c9901b + 73b465e commit 337f271

24 files changed

+891
-6
lines changed

README.en.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,102 @@ ros2 launch raspimouse_ros2_examples object_tracking.launch.py mouse:=false use_
9393

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

96+
### camera_line_follower
97+
98+
Terminal 1:
99+
100+
```sh
101+
ros2 launch raspimouse_gazebo raspimouse_with_line_follower_field.launch.py use_rgb_camera:=true camera_downward:=true
102+
```
103+
104+
Terminal 2:
105+
106+
```sh
107+
ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py mouse:=false use_camera_node:=false
108+
```
109+
110+
Terminal 3: Start
111+
112+
```sh
113+
ros2 topic pub --once /switches raspimouse_msgs/msg/Switches "{switch0: false, switch1: false, switch2: true}"
114+
```
115+
116+
Terminal 3: Stop
117+
```sh
118+
ros2 topic pub --once /switches raspimouse_msgs/msg/Switches "{switch0: true, switch1: false, switch2: false}"
119+
```
120+
121+
For information on parameters in camera line follower, click [here](https://github.com/rt-net/raspimouse_ros2_examples/blob/master/README.en.md#parameters).
122+
123+
![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_camerafollower_short.gif)
124+
125+
### SLAM & Navigation
126+
127+
#### SLAM
128+
129+
Terminal 1:
130+
```sh
131+
ros2 launch raspimouse_gazebo raspimouse_with_lakehouse.launch.py lidar:=urg
132+
```
133+
The lidar option supports `urg`, `lds`, and `rplidar`.
134+
135+
Terminal 2:
136+
```sh
137+
ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=false
138+
```
139+
140+
Terminal 3:
141+
```sh
142+
ros2 launch raspimouse_slam pc_slam.launch.py
143+
```
144+
145+
![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_slam.png)
146+
147+
Terminal 4:
148+
```sh
149+
ros2 run nav2_map_server map_saver_cli -f ~/MAP_NAME
150+
```
151+
152+
![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_slam_short.gif)
153+
154+
#### Navigation
155+
156+
Terminal 1:
157+
```sh
158+
ros2 launch raspimouse_gazebo raspimouse_with_lakehouse.launch.py lidar:=urg
159+
```
160+
The lidar option supports `urg`, `lds`, and `rplidar`.
161+
162+
Terminal 2:
163+
```sh
164+
ros2 launch raspimouse_navigation pc_navigation.launch.py map:=$HOME/MAP_NAME.yaml
165+
```
166+
167+
![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_navigation_short.gif)
168+
169+
## Model data list
170+
171+
### course_curve_50x50cm
172+
Curve course panel for line following.
173+
Panel size is 50 cm x 50 cm and line width is 4 cm.
174+
175+
![](./raspimouse_gazebo/models/course_curve_50x50cm/meshes/course_curve.jpg)
176+
177+
### course_straight_50x50cm
178+
Straight course panel for line following.
179+
Panel size is 50 cm x 50 cm and line width is 4 cm.
180+
181+
![](./raspimouse_gazebo/models/course_straight_50x50cm/meshes/course_straight.jpg)
182+
183+
### cube_*cm_color-name
184+
Each cube is 5 cm, 7.5 cm, 10 cm, and 15 cm, 30 cm on a side.
185+
The cube colors are red, yellow, blue, green and black.
186+
187+
![](https://rt-net.github.io/images/raspberry-pi-mouse/color_objects.png)
188+
189+
### about dae files
190+
The dae file is edited in Blender 4.0.
191+
96192
## License
97193

98194
This repository is licensed under the MIT license, see [LICENSE]( ./LICENSE ).

README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ git clone -b ros2 https://github.com/rt-net/raspimouse_sim.git
3939
```sh
4040
cd ~/ros2_ws/src
4141
git clone https://github.com/rt-net/raspimouse_ros2_examples.git
42+
git clone https://github.com/rt-net/raspimouse_slam_navigation_ros2.git
4243
git clone -b ros2 https://github.com/rt-net/raspimouse_description.git
4344
rosdep install -r -y -i --from-paths raspimouse*
4445
```
@@ -93,6 +94,103 @@ ros2 launch raspimouse_ros2_examples object_tracking.launch.py mouse:=false use_
9394

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

97+
### RGBカメラを用いたライントレースサンプル
98+
99+
端末1で次のコマンドを実行すると、ライントレースのサンプルコースが配置されたワールドが表示されます。
100+
```sh
101+
ros2 launch raspimouse_gazebo raspimouse_with_line_follower_field.launch.py use_rgb_camera:=true camera_downward:=true
102+
```
103+
104+
端末2で次のコマンドを実行すると、カメラライントレースのノードが起動します。
105+
```sh
106+
ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py mouse:=false use_camera_node:=false
107+
```
108+
109+
端末3で次のコマンドを実行すると、Raspberry Pi Mouseが走行を開始します。
110+
```sh
111+
ros2 topic pub --once /switches raspimouse_msgs/msg/Switches "{switch0: false, switch1: false, switch2: true}"
112+
```
113+
114+
次のコマンドを実行すると、Raspberry Pi Mouseが停止します。
115+
```sh
116+
ros2 topic pub --once /switches raspimouse_msgs/msg/Switches "{switch0: true, switch1: false, switch2: false}"
117+
```
118+
119+
カメラライントレースにおけるパラメータは[こちら](https://github.com/rt-net/raspimouse_ros2_examples?tab=readme-ov-file#parameters)を参照してください。
120+
121+
![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_camerafollower_short.gif)
122+
123+
### LiDARを用いたSLAMとNavigationのサンプル
124+
125+
#### SLAM
126+
127+
端末1で次のコマンドを実行すると、`Lake House`のモデルが配置されたワールドが表示されます。
128+
```sh
129+
ros2 launch raspimouse_gazebo raspimouse_with_lakehouse.launch.py lidar:=urg
130+
```
131+
`lidar``urg``lds``rplidar`のいずれかを指定してください。
132+
133+
端末2で次のコマンドを実行すると、Raspberry Pi Mouseをジョイスティックコントローラで操作できます。
134+
```sh
135+
ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=false
136+
```
137+
138+
端末3で次のコマンドを実行すると、SLAMが実行されます。
139+
```sh
140+
ros2 launch raspimouse_slam pc_slam.launch.py
141+
```
142+
143+
![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_slam.png)
144+
145+
端末4で次のコマンドを実行すると、作成した地図を保存できます。
146+
```sh
147+
ros2 run nav2_map_server map_saver_cli -f ~/MAP_NAME
148+
```
149+
`MAP_NAME`は任意の名前を指定できます。
150+
151+
![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_slam_short.gif)
152+
153+
#### Navigation
154+
155+
端末1で次のコマンドを実行すると、`Lake House`のモデルが配置されたワールドが表示されます。
156+
```sh
157+
ros2 launch raspimouse_gazebo raspimouse_with_lakehouse.launch.py lidar:=urg
158+
```
159+
`lidar``urg``lds``rplidar`のいずれかを指定してください。
160+
161+
端末2で次のコマンドを実行すると、Navigationが実行されます。
162+
```sh
163+
ros2 launch raspimouse_navigation pc_navigation.launch.py map:=$HOME/MAP_NAME.yaml
164+
```
165+
引数`map`にはSLAMで作成した地図ファイルのパスを指定してください。
166+
167+
![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_navigation_short.gif)
168+
169+
## モデルデータ一覧
170+
171+
### course_curve_50x50cm
172+
173+
ライントレース用の曲線コースパネルです。
174+
パネルサイズは50cm x 50cm、線の幅は4cmです。
175+
176+
![](./raspimouse_gazebo/models/course_curve_50x50cm/meshes/course_curve.jpg)
177+
178+
### course_straight_50x50cm
179+
180+
ライントレース用の直線コースパネルです。
181+
パネルサイズは50cm x 50cm、線の幅は4cmです。
182+
183+
![](./raspimouse_gazebo/models/course_straight_50x50cm/meshes/course_straight.jpg)
184+
185+
### cube_*cm_color-name
186+
それぞれ一辺5cm、7.5cm、10cm、15cm、30cmの立方体です。
187+
色は赤、黄、青、緑、黒です。
188+
189+
![](https://rt-net.github.io/images/raspberry-pi-mouse/color_objects.png)
190+
191+
### daeファイルについて
192+
daeファイルはBlender 4.0で編集しています。
193+
96194
## ライセンス
97195

98196
このリポジトリはMITライセンスに基づいて公開されています。

raspimouse_fake/CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
Changelog for package raspimouse_fake
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
2.1.0 (2024-03-05)
6+
------------------
7+
58
2.0.0 (2023-11-07)
69
------------------
710
* シミュレータ環境に擬似的なラズパイマウスノードを追加 (`#69 <https://github.com/rt-net/raspimouse_sim/issues/69>`_)

raspimouse_fake/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>raspimouse_fake</name>
5-
<version>2.0.0</version>
5+
<version>2.1.0</version>
66
<description>The raspimouse_control package</description>
77
<maintainer email="shop@rt-net.jp">RT Corporation</maintainer>
88
<license>MIT</license>

raspimouse_gazebo/CHANGELOG.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
Changelog for package raspimouse_gazebo
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
2.1.0 (2024-03-05)
6+
------------------
7+
* シミュレータ環境でSLAMとNavigationを実行 (`#77 <https://github.com/rt-net/raspimouse_sim/issues/77>`_)
8+
Co-authored-by: Shota Aoki <s.aoki@rt-net.jp>
9+
* コントローラのパラメータを調整してオドメトリのズレを修正 (`#76 <https://github.com/rt-net/raspimouse_sim/issues/76>`_)
10+
* camera_downwardがtrueのときRGBカメラが斜め下を向くように変更 (`#75 <https://github.com/rt-net/raspimouse_sim/issues/75>`_)
11+
Co-authored-by: Shota Aoki <s.aoki@rt-net.jp>
12+
* ライントレース用のコースを作成 (`#74 <https://github.com/rt-net/raspimouse_sim/issues/74>`_)
13+
Co-authored-by: Shota Aoki <s.aoki@rt-net.jp>
14+
* Contributors: YusukeKato
15+
516
2.0.0 (2023-11-07)
617
------------------
718
* Gazebo上で画像トピックを配信できるようにbridgeを設定 (`#71 <https://github.com/rt-net/raspimouse_sim/issues/71>`_)

raspimouse_gazebo/config/raspimouse_controllers.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ diff_drive_controller:
1919
wheel_separation : 0.09
2020
wheels_per_side: 1
2121
wheel_radius : 0.024
22-
wheel_separation_multiplier : 1.0
23-
left_wheel_radius_multiplier : 1.0
24-
right_wheel_radius_multiplier : 1.0
22+
wheel_separation_multiplier : 0.95
23+
left_wheel_radius_multiplier : 1.05
24+
right_wheel_radius_multiplier : 1.05
2525

2626
odom_frame_id: odom
2727
base_frame_id: base_footprint

raspimouse_gazebo/launch/raspimouse_with_emptyworld.launch.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,26 @@ def generate_launch_description():
4646
'use_rgb_camera',
4747
default_value='false',
4848
description='Set "true" to mount rgb camera.')
49+
declare_arg_camera_downward = DeclareLaunchArgument(
50+
'camera_downward',
51+
default_value='false',
52+
description='Set "true" to point the camera downwards.')
4953
declare_arg_world_name = DeclareLaunchArgument(
5054
'world_name',
5155
default_value=get_package_share_directory('raspimouse_gazebo')+'/worlds/empty_world.sdf',
5256
description='Set world name.')
57+
declare_arg_spawn_x = DeclareLaunchArgument(
58+
'spawn_x',
59+
default_value='0.0',
60+
description='Set initial position x.')
61+
declare_arg_spawn_y = DeclareLaunchArgument(
62+
'spawn_y',
63+
default_value='0.0',
64+
description='Set initial position y.')
65+
declare_arg_spawn_z = DeclareLaunchArgument(
66+
'spawn_z',
67+
default_value='0.02',
68+
description='Set initial position z.')
5369

5470
env = {'IGN_GAZEBO_SYSTEM_PLUGIN_PATH': os.environ['LD_LIBRARY_PATH'],
5571
'IGN_GAZEBO_RESOURCE_PATH': os.path.dirname(
@@ -71,6 +87,9 @@ def generate_launch_description():
7187
output='screen',
7288
arguments=['-topic', '/robot_description',
7389
'-name', 'raspimouse',
90+
'-x', LaunchConfiguration('spawn_x'),
91+
'-y', LaunchConfiguration('spawn_y'),
92+
'-z', LaunchConfiguration('spawn_z'),
7493
'-allow_renaming', 'true'],
7594
)
7695

@@ -79,6 +98,7 @@ def generate_launch_description():
7998
description_loader.lidar_frame = LaunchConfiguration('lidar_frame')
8099
description_loader.use_gazebo = 'true'
81100
description_loader.use_rgb_camera = LaunchConfiguration('use_rgb_camera')
101+
description_loader.camera_downward = LaunchConfiguration('camera_downward')
82102
description_loader.gz_control_config_package = 'raspimouse_gazebo'
83103
description_loader.gz_control_config_file_path = 'config/raspimouse_controllers.yaml'
84104

@@ -115,6 +135,7 @@ def generate_launch_description():
115135
package='ros_gz_bridge',
116136
executable='parameter_bridge',
117137
arguments=['/clock@rosgraph_msgs/msg/Clock[ignition.msgs.Clock',
138+
'/scan@sensor_msgs/msg/LaserScan@ignition.msgs.LaserScan',
118139
'/camera/color/image_raw@sensor_msgs/msg/Image@gz.msgs.Image',
119140
'/camera_info@sensor_msgs/msg/CameraInfo@gz.msgs.CameraInfo'],
120141
output='screen'
@@ -139,7 +160,11 @@ def generate_launch_description():
139160
declare_arg_lidar,
140161
declare_arg_lidar_frame,
141162
declare_arg_use_rgb_camera,
163+
declare_arg_camera_downward,
142164
declare_arg_world_name,
165+
declare_arg_spawn_x,
166+
declare_arg_spawn_y,
167+
declare_arg_spawn_z,
143168
ign_gazebo,
144169
ignition_spawn_entity,
145170
robot_state_publisher,
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright 2024 RT Corporation <support@rt-net.jp>
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
# this software and associated documentation files (the "Software"), to deal in
7+
# the Software without restriction, including without limitation the rights to
8+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
# the Software, and to permit persons to whom the Software is furnished to do so,
10+
# subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
22+
import os
23+
24+
from ament_index_python.packages import get_package_share_directory
25+
from launch import LaunchDescription
26+
from launch.actions import IncludeLaunchDescription
27+
from launch_ros.actions import SetParameter
28+
from launch.launch_description_sources import PythonLaunchDescriptionSource
29+
30+
31+
def generate_launch_description():
32+
world_file = os.path.join(
33+
get_package_share_directory('raspimouse_gazebo'),
34+
'worlds',
35+
'lakehouse.sdf')
36+
world_launch = IncludeLaunchDescription(
37+
PythonLaunchDescriptionSource([
38+
get_package_share_directory('raspimouse_gazebo'),
39+
'/launch/raspimouse_with_emptyworld.launch.py']),
40+
launch_arguments={
41+
'world_name': world_file
42+
}.items()
43+
)
44+
45+
return LaunchDescription([
46+
SetParameter(name='use_sim_time', value=True),
47+
world_launch
48+
])

0 commit comments

Comments
 (0)