Skip to content

Commit 59985c0

Browse files
YusukeKatoShota Aoki
and
Shota Aoki
authored
[Raspberry Pi Mouse] ROS 2版シミュレータの情報を追加 (#36)
Co-authored-by: Shota Aoki <[email protected]>
1 parent 63111a6 commit 59985c0

File tree

3 files changed

+147
-20
lines changed

3 files changed

+147
-20
lines changed

docs/raspimouse/simulator/install.md

+77-20
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ robot: Raspberry Pi Mouse
55

66
# シミュレータのインストール
77

8-
Raspberry Pi Mouse SimulatorはメインボードにRaspberry Piを使った左右独立二輪方式の小型移動プラットフォームロボット、Raspberry Pi Mouseのシミュレータです。
8+
Raspberry Pi Mouse Simulator([rt-net/raspimouse_sim](https://github.com/rt-net/raspimouse_sim){target=_blank rel=noopener})はメインボードにRaspberry Piを使った左右独立二輪方式の小型移動プラットフォームロボット、Raspberry Pi Mouseのシミュレータです。
99

10-
Gazebo上で動きます。ROSとGazeboがインストールされた環境で使用することができます。
1110

1211
このページでは、
1312
[rt-net/raspimouse_sim](https://github.com/rt-net/raspimouse_sim){target=_blank rel=noopener}
@@ -16,44 +15,102 @@ Gazebo上で動きます。ROSとGazeboがインストールされた環境で
1615
## 使用機材 {: #requirements}
1716

1817
* ノートパソコン等のPC
19-
* OS(**Ubuntu Desktop 20.04**)およびROS/ROS 2がインストール済みであることを前提としています
18+
* OS(**Ubuntu Desktop**)がインストール済みであることを前提としています
19+
* `ROS 2 Humble`を使用する場合: **Ubuntu Desktop 22.04**
20+
* `ROS Noetic`を使用する場合: **Ubuntu Desktop 20.04**
21+
* ROSまたはROS 2がインストール済みであることを前提としています
2022
* インストール方法については[ROS/ROS 2のインストール](../ros/install.md)を参照してください。
2123

2224
## パッケージのダウンロードとインストール {: #install}
2325

2426
=== "ROS"
2527
次のコマンドを実行します。
2628

29+
シミュレータパッケージのダウンロード
30+
31+
```sh
32+
cd ~/catkin_ws/src
33+
git clone https://github.com/rt-net/raspimouse_sim.git
34+
```
35+
36+
依存パッケージをインストール
37+
38+
```sh
39+
git clone https://github.com/rt-net/raspimouse.git
40+
git clone https://github.com/rt-net/raspimouse_description.git
41+
rosdep install -r -y -i --from-paths raspimouse*
42+
```
43+
44+
パッケージをビルド
45+
46+
```sh
47+
cd ~/catkin_ws && catkin_make
48+
source ~/catkin_ws/devel/setup.bash
49+
```
50+
51+
Gazeboで使用するハードウェアモデルデータをダウンロード
52+
53+
```sh
54+
rosrun raspimouse_gazebo download_gazebo_models.sh
55+
```
56+
57+
=== "ROS 2"
58+
次のコマンドを実行します。
59+
60+
シミュレータパッケージのダウンロード
61+
2762
```sh
28-
# シミュレータパッケージのダウンロード
29-
$ cd ~/catkin_ws/src
30-
$ git clone https://github.com/rt-net/raspimouse_sim.git
63+
cd ~/ros2_ws/src
64+
git clone -b humble-devel https://github.com/rt-net/raspimouse_sim.git
65+
```
3166

32-
# 依存パッケージをインストール
33-
$ git clone https://github.com/rt-net/raspimouse.git
34-
$ git clone https://github.com/rt-net/raspimouse_description.git
35-
$ rosdep install -r -y -i --from-paths raspimouse*
67+
依存パッケージをインストール
3668

37-
# パッケージをビルド
38-
$ cd ~/catkin_ws && catkin_make
39-
$ source ~/catkin_ws/devel/setup.bash
69+
```sh
70+
git clone -b humble-devel https://github.com/rt-net/raspimouse_ros2_examples.git
71+
rosdep install -r -y -i --from-paths raspimouse*
72+
```
73+
74+
パッケージをビルド
4075

41-
# Gazeboで使用するハードウェアモデルデータをダウンロード
42-
$ rosrun raspimouse_gazebo download_gazebo_models.sh
76+
```sh
77+
cd ~/ros2_ws
78+
colcon build --symlink-install
79+
source ~/ros2_ws/install/setup.bash
4380
```
4481

4582
## 動作確認(キーボードで操縦) {: #teleop}
4683

4784
=== "ROS"
4885
次のコマンドを実行します。
4986

50-
```sh
51-
# シミュレータの起動
52-
$ roslaunch raspimouse_gazebo raspimouse_with_samplemaze.launch
87+
シミュレータの起動
5388

54-
# 別のターミナルでコマンドを実行
55-
$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py _speed:=0.1 _turn:=1.57
89+
```sh
90+
roslaunch raspimouse_gazebo raspimouse_with_samplemaze.launch
5691
```
5792

93+
別のターミナルでコマンドを実行
94+
95+
```sh
96+
rosrun teleop_twist_keyboard teleop_twist_keyboard.py _speed:=0.1 _turn:=1.57
97+
```
5898

5999
![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_samplemaze_animation.gif)
100+
101+
=== "ROS 2"
102+
次のコマンドを実行します。
103+
104+
シミュレータの起動
105+
106+
```sh
107+
ros2 launch raspimouse_gazebo raspimouse_with_emptyworld.launch.py
108+
```
109+
110+
別のターミナルでコマンドを実行
111+
112+
```
113+
ros2 run teleop_twist_keyboard teleop_twist_keyboard
114+
```
115+
116+
![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_joystick.gif)

docs/raspimouse/simulator/samples.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: ROS 2サンプルの実行(シミュレータ)
3+
robot: Raspberry Pi Mouse
4+
---
5+
6+
# ROS 2サンプルの実行(シミュレータ)
7+
8+
このページではシミュレータ上で
9+
[ROS 2サンプル集(rt-net/raspimouse_ros2_examples)](https://github.com/rt-net/raspimouse_ros2_examples){target=_blank rel=noopener}
10+
を実行する方法を紹介します。
11+
12+
## 使用機材 {: #requirements}
13+
14+
* ノートパソコン等のPC
15+
* OS(**Ubuntu Desktop 22.04**)がインストール済みであることを前提としています
16+
* ROS 2がインストール済みであることを前提としています
17+
* インストール方法については[ROS/ROS 2のインストール](../ros/install.md)を参照してください。
18+
* ROS 2のシミュレータパッケージがインストール済みであることを前提としています
19+
* インストール方法については[シミュレータのインストール](./install.md)を参照してください。
20+
21+
## ROS 2パッケージ情報の読み込み {: #load-workspace}
22+
23+
=== "ROS 2"
24+
[ROS 2サンプル集(rt-net/raspimouse_ros2_examples)](https://github.com/rt-net/raspimouse_ros2_examples){target=_blank rel=noopener}
25+
のサンプルを実行する場合は下記コマンドを実行し、
26+
ROS 2とパッケージを読み込んでください。
27+
28+
```sh
29+
source /opt/ros/humble/setup.bash
30+
source ~/ros2_ws/install/setup.bash
31+
```
32+
33+
## ジョイスティックで操縦 {: #joystick}
34+
35+
=== "ROS 2"
36+
次のコマンドを実行します。
37+
38+
シミュレータの起動
39+
40+
```sh
41+
ros2 launch raspimouse_gazebo raspimouse_with_emptyworld.launch.py
42+
```
43+
44+
別のターミナルでコマンドを実行
45+
46+
```sh
47+
ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=false
48+
```
49+
50+
![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_joystick.gif)
51+
52+
## RGBカメラの色検出による物体追従 {: #object_tracking}
53+
54+
=== "ROS 2"
55+
次のコマンドを実行します。
56+
57+
シミュレータの起動
58+
59+
```sh
60+
ros2 launch raspimouse_gazebo raspimouse_with_color_objects.launch.py use_rgb_camera:=true
61+
```
62+
63+
別のターミナルでコマンドを実行
64+
65+
```sh
66+
ros2 launch raspimouse_ros2_examples object_tracking.launch.py mouse:=false use_camera_node:=false
67+
```
68+
69+
![](https://rt-net.github.io/images/raspberry-pi-mouse/raspimouse_sim_object_tracking.gif)

mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ nav:
9595
- 3. ROS / ROS 2サンプルの実行: raspimouse/ros/samples.md
9696
- 4. シミュレータの実行:
9797
- 1. シミュレータのインストール: raspimouse/simulator/install.md
98+
- 2. ROS 2サンプルの実行(シミュレータ): raspimouse/simulator/samples.md
9899
- 5. 関連リンク集: raspimouse/others.md
99100
- Jetson Nano Mouse:
100101
- 1. 製品について: jnmouse/products.md

0 commit comments

Comments
 (0)