Skip to content

Commit 20a17fb

Browse files
authored
Merge pull request #55 from rt-net/master
2.2.0リリースのためにmasterの変更差分をhumble-develブランチへマージ
2 parents acee967 + bdef32b commit 20a17fb

8 files changed

Lines changed: 608 additions & 113 deletions

File tree

CHANGELOG.rst

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

5+
2.2.0 (2024-03-05)
6+
------------------
7+
* READMEにSLAM&Navigationパッケージの案内を追加 (`#53 <https://github.com/rt-net/raspimouse_ros2_examples/issues/53>`_)
8+
* Camera_FollowerクラスをCameraFollowerに変更 (`#52 <https://github.com/rt-net/raspimouse_ros2_examples/issues/52>`_)
9+
* Update camera line follower: Set motor power with switch input. Add area_threthold param. (`#51 <https://github.com/rt-net/raspimouse_ros2_examples/issues/51>`_)
10+
* Add velocity parameters for camera_line_follower (`#50 <https://github.com/rt-net/raspimouse_ros2_examples/issues/50>`_)
11+
* カメラライントレースを修正 (`#49 <https://github.com/rt-net/raspimouse_ros2_examples/issues/49>`_)
12+
* Change threthold of line detection
13+
* Add usb_cam dependency (`#48 <https://github.com/rt-net/raspimouse_ros2_examples/issues/48>`_)
14+
* RGBカメラによるライントレースの実装 (`#47 <https://github.com/rt-net/raspimouse_ros2_examples/issues/47>`_)
15+
* リリースのためにCHANGELOG.rstとpackage.xmlを更新 (`#45 <https://github.com/rt-net/raspimouse_ros2_examples/issues/45>`_)
16+
* Contributors: Shota Aoki, ShotaAk, YusukeKato
17+
518
2.1.0 (2023-11-07)
619
------------------
720
* READMEにGazeboでも実行できることを追記 (`#44 <https://github.com/rt-net/raspimouse_ros2_examples/issues/44>`_)

CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ ament_target_dependencies(object_tracking_component
5151
cv_bridge)
5252
rclcpp_components_register_nodes(object_tracking_component "object_tracking::Tracker")
5353

54+
add_library(camera_line_follower_component SHARED
55+
src/camera_line_follower_component.cpp)
56+
target_compile_definitions(camera_line_follower_component
57+
PRIVATE "RASPIMOUSE_ROS2_EXAMPLES_BUILDING_DLL")
58+
ament_target_dependencies(camera_line_follower_component
59+
rclcpp
60+
rclcpp_components
61+
rclcpp_lifecycle
62+
std_msgs
63+
std_srvs
64+
sensor_msgs
65+
geometry_msgs
66+
OpenCV
67+
cv_bridge
68+
raspimouse_msgs)
69+
rclcpp_components_register_nodes(camera_line_follower_component "camera_line_follower::CameraFollower")
70+
5471
add_library(line_follower_component SHARED
5572
src/line_follower_component.cpp)
5673
target_compile_definitions(line_follower_component
@@ -112,6 +129,7 @@ ament_export_dependencies(OpenCV)
112129
ament_export_include_directories(include)
113130
ament_export_libraries(
114131
object_tracking_component
132+
camera_line_follower_component
115133
line_follower_component
116134
direction_controller_component)
117135

@@ -122,6 +140,7 @@ install(
122140

123141
install(TARGETS
124142
object_tracking_component
143+
camera_line_follower_component
125144
line_follower_component
126145
direction_controller_component
127146
EXPORT export_${PROJECT_NAME}

README.en.md

Lines changed: 50 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ This repository is licensed under the Apache 2.0, see [LICENSE](./LICENSE) for d
6161
- [joystick_control](#joystick_control)
6262
- [object_tracking](#object_tracking)
6363
- [line_follower](#line_follower)
64+
- [camera_line_follower](#camera_line_follower)
6465
- [SLAM](#slam)
6566
- [direction_controller](#direction_controller)
6667

@@ -162,7 +163,7 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/
162163

163164
This sample publishes two topics: `camera/color/image_raw` for the camera image and `result_image` for the object detection image.
164165
These images can be viewed with [RViz](https://index.ros.org/r/rviz/)
165-
or [rqt_image_view](https://index.ros.org/doc/ros2/Tutorials/RQt-Overview-Usage/).
166+
or [rqt_image_view](https://index.ros.org/p/rqt_image_view/).
166167

167168
**Viewing an image may cause the node to behave unstable and not publish cmd_vel or image topics.**
168169

@@ -247,87 +248,81 @@ void Follower::publish_cmdvel_for_line_following(void)
247248
248249
[back to example list](#how-to-use-examples)
249250
250-
---
251+
---
251252
252-
### SLAM
253+
### camera_line_follower
253254
254-
<img src=https://rt-net.github.io/images/raspberry-pi-mouse/slam_toolbox_ros2.png width=500 />
255+
<img src=https://rt-net.github.io/images/raspberry-pi-mouse/mouse_camera_line_trace_2.png width=500 />
255256
256-
This is an example to use LiDAR and [slam_toolbox](https://github.com/SteveMacenski/slam_toolbox) for SLAM (Simultaneous Localization And Mapping).
257+
This is an example for line following by RGB camera.
257258
258259
#### Requirements
259260
260-
- LiDAR
261-
<!-- - [URG-04LX-UG01](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1348_1296&products_id=2816&language=en)
262-
- [RPLIDAR A1](https://www.slamtec.com/en/Lidar/A1) -->
263-
- [LDS-01](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1348_5&products_id=3676&language=en)
264-
- [LiDAR Mount](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3867&language=en)
265-
- Joystick Controller (Optional)
266-
261+
- Web camera
262+
- [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n)
263+
- Camera mount
264+
- [Raspberry Pi Mouse Option kit No.4 \[Webcam mount\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584&language=en)
265+
267266
#### Installation
268267
269-
Install a LiDAR to the Raspberry Pi Mouse.
268+
Install a camera mount and a web camera to Raspberry Pi Mouse, then connect the camera to the Raspberry Pi.
270269
271-
<!-- - URG-04LX-UG01
272-
- <img src="https://github.com/rt-net/raspimouse_ros_examples/blob/images/mouse_with_urg.JPG" width=500 />
273-
- RPLIDAR A1
274-
- <img src="https://github.com/rt-net/raspimouse_ros_examples/blob/images/mouse_with_rplidar.png" width=500 /> -->
275-
- LDS-01
276-
- <img src=https://rt-net.github.io/images/raspberry-pi-mouse/mouse_with_lds01.JPG width=500 />
277-
278270
#### How to use
279271
280-
Launch nodes on Raspberry Pi Mouse with the following command:
272+
Then, launch nodes with the following command:
281273
282274
```sh
283-
# LDS
284-
$ ros2 launch raspimouse_ros2_examples mouse_with_lidar.launch.py lidar:=lds
275+
$ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_device:=/dev/video0
285276
```
286277

287-
Next, launch `teleop_joy.launch.py` to control Raspberry Pi Mouse with the following command:
288-
289-
```sh
290-
# Use DUALSHOCK 3
291-
$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=false
292-
```
278+
Place Raspberry Pi Mouse on the line and press SW2 to start line following.
293279

294-
Then, launch the slam_toolbox package (on a remote computer recommend) with the following command:
280+
Press SW0 to stop the following.
295281

296-
```sh
297-
$ ros2 launch raspimouse_ros2_examples slam.launch.py
298-
```
299-
300-
After moving Raspberry Pi Mouse and making a map, run a node to save the map with the following command:
282+
This sample publishes two topics: `camera/color/image_raw` for the camera image and `result_image` for the object detection image.
283+
These images can be viewed with [RViz](https://index.ros.org/r/rviz/)
284+
or [rqt_image_view](https://index.ros.org/p/rqt_image_view/).
301285

302-
```sh
303-
$ mkdir ~/maps
304-
$ ros2 run nav2_map_server map_saver_cli -f ~/maps/mymap --ros-args -p save_map_timeout:=10000.0
305-
```
286+
**Viewing an image may cause the node to behave unstable and not publish cmd_vel or image topics.**
306287

307-
#### Configure SLAM parameters
288+
<img src=https://rt-net.github.io/images/raspberry-pi-mouse/camera_line_trace.png width=500 />
308289

309-
Edit [./config/mapper_params_offline.yaml](./config/mapper_params_offline.yaml) to configure parameters of [slam_toolbox](https://github.com/SteveMacenski/slam_toolbox) package.
290+
#### Parameters
310291

311-
#### Configure Odometry calculation
292+
- `max_brightness`
293+
- Type: `int`
294+
- Default: 90
295+
- Maximum threshold value for image binarisation.
296+
- `min_brightness`
297+
- Type: `int`
298+
- Default: 0
299+
- Minimum threshold value for image binarisation.
300+
- `max_linear_vel`
301+
- Type: `double`
302+
- Default: 0.05
303+
- Maximum linear velocity.
304+
- `max_angular_vel`
305+
- Type: `double`
306+
- Default: 0.8
307+
- Maximum angular velocity.
308+
- `area_threthold`
309+
- Type: `double`
310+
- Default: 0.20
311+
- Threshold value of the area of the line to start following.
312312

313-
Edit [mouse.yml](./config/mouse.yml) to set `use_pulse_counters` to `true` (default: `false`) then the `raspimouse` node calculate the odometry (`/odom`) from motor control pulse counts.
313+
```sh
314+
ros2 param set /camera_follower max_brightness 80
315+
```
314316

315-
This improves the accuracy of self-localization.
317+
[back to example list](#how-to-use-examples)
316318

317-
```yaml
318-
raspimouse:
319-
ros__parameters:
320-
odometry_scale_left_wheel : 1.0
321-
odometry_scale_right_wheel: 1.0
322-
use_light_sensors : true
323-
use_pulse_counters : true
324-
```
319+
---
325320

326-
<!-- #### Videos
321+
### SLAM
327322

328-
[![slam_urg](http://img.youtube.com/vi/gWozU47UqVE/sddefault.jpg)](https://youtu.be/gWozU47UqVE)
323+
<img src=https://rt-net.github.io/images/raspberry-pi-mouse/slam_toolbox_ros2.png width=500 />
329324

330-
[![slam_urg](http://img.youtube.com/vi/hV68UqAntfo/sddefault.jpg)](https://youtu.be/hV68UqAntfo) -->
325+
SLAM and Navigation examples for Raspberry Pi Mouse is [here](https://github.com/rt-net/raspimouse_slam_navigation_ros2).
331326

332327
[back to example list](#how-to-use-examples)
333328

README.md

Lines changed: 48 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ $ source ~/ros2_ws/install/setup.bash
6262
- [joystick_control](#joystick_control)
6363
- [object_tracking](#object_tracking)
6464
- [line_follower](#line_follower)
65+
- [camera_line_follower](#camera_line_follower)
6566
- [SLAM](#slam)
6667
- [direction_controller](#direction_controller)
6768

@@ -164,7 +165,7 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/
164165

165166
カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。
166167
これらの画像は[RViz](https://index.ros.org/r/rviz/)
167-
[rqt_image_view](https://index.ros.org/doc/ros2/Tutorials/RQt-Overview-Usage/)
168+
[rqt_image_view](https://index.ros.org/p/rqt_image_view/)
168169
で表示できます。
169170

170171
**画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。**
@@ -253,89 +254,79 @@ void Follower::publish_cmdvel_for_line_following(void)
253254
254255
---
255256
256-
### SLAM
257+
### camera_line_follower
257258
258-
<img src=https://rt-net.github.io/images/raspberry-pi-mouse/slam_toolbox_ros2.png width=500 />
259+
<img src=https://rt-net.github.io/images/raspberry-pi-mouse/mouse_camera_line_trace_2.png width=500 />
259260
260-
LiDARと[slam_toolbox](https://github.com/SteveMacenski/slam_toolbox)
261-
を使ってSLAM(自己位置推定と地図作成)を行うサンプルです。
261+
RGBカメラによるライントレースのコード例です。
262262
263263
#### Requirements
264264
265-
- LiDAR
266-
<!-- - [~URG-04LX-UG01~](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1348_1296&products_id=2816)
267-
- [RPLIDAR A1](https://www.slamtec.com/en/Lidar/A1) -->
268-
- [LDS-01](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1348_5&products_id=3676)
269-
- [LiDAR Mount](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3867)
270-
- Joystick Controller (Optional)
271-
265+
- Webカメラ
266+
- [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n)
267+
- カメラマウント
268+
- [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584)
269+
272270
#### Installation
273271
274-
Raspberry Pi MouseにLiDARを取り付けます
272+
Raspberry Pi Mouseにカメラマウントを取り付け、WebカメラをRaspberry Piに接続します
275273
276-
<!-- - URG-04LX-UG01
277-
- <img src="https://github.com/rt-net/raspimouse_ros_examples/blob/images/mouse_with_urg.JPG" width=500 />
278-
- RPLIDAR A1
279-
- <img src="https://github.com/rt-net/raspimouse_ros_examples/blob/images/mouse_with_rplidar.png" width=500 /> -->
280-
- LDS-01
281-
- <img src=https://rt-net.github.io/images/raspberry-pi-mouse/mouse_with_lds01.JPG width=500 />
282-
283274
#### How to use
284275
285-
Raspberry Pi Mouse上で次のコマンドでノードを起動します
276+
次のコマンドでノードを起動します
286277
287278
```sh
288-
# LDS
289-
$ ros2 launch raspimouse_ros2_examples mouse_with_lidar.launch.py lidar:=lds
279+
$ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_device:=/dev/video0
290280
```
291281

292-
Raspberry Pi Mouseを動かすため`teleop_joy.launch.py`を起動します
282+
ライン上にRaspberry Pi Mouseを置き、SW2を押してライントレースを開始します。
283+
停止させる場合はSW0を押します。
293284

294-
```sh
295-
# Use DUALSHOCK 3
296-
$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=false
297-
```
285+
カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。
286+
これらの画像は[RViz](https://index.ros.org/r/rviz/)
287+
[rqt_image_view](https://index.ros.org/p/rqt_image_view/)
288+
で表示できます。
298289

299-
次のコマンドでslam_toolboxパッケージを起動します。(Remote computerでの実行推奨)
290+
**画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。**
300291

301-
```sh
302-
$ ros2 launch raspimouse_ros2_examples slam.launch.py
303-
```
292+
<img src=https://rt-net.github.io/images/raspberry-pi-mouse/camera_line_trace.png width=500 />
304293

305-
Raspberry Pi Mouseを動かして地図を作成します。
294+
#### Parameters
306295

307-
次のコマンドで作成した地図を保存します。
296+
- `max_brightness`
297+
- Type: `int`
298+
- Default: 90
299+
- 画像の2値化のしきい値の最大値
300+
- `min_brightness`
301+
- Type: `int`
302+
- Default: 0
303+
- 画像の2値化のしきい値の最小値
304+
- `max_linear_vel`
305+
- Type: `double`
306+
- Default: 0.05
307+
- 直進速度の最大値
308+
- `max_angular_vel`
309+
- Type: `double`
310+
- Default: 0.8
311+
- 旋回速度の最大値
312+
- `area_threthold`
313+
- Type: `double`
314+
- Default: 0.20
315+
- 走行を開始するためのライン面積のしきい値
308316

309317
```sh
310-
$ mkdir ~/maps
311-
$ ros2 run nav2_map_server map_saver_cli -f ~/maps/mymap --ros-args -p save_map_timeout:=10000.0
318+
ros2 param set /camera_follower max_brightness 80
312319
```
313320

314-
#### Configure SLAM parameters
315-
316-
[./config/mapper_params_offline.yaml](./config/mapper_params_offline.yaml)[slam_toolbox](https://github.com/SteveMacenski/slam_toolbox)パッケージのパラメータを調節します。
317-
318-
#### Configure Odometry calculation
319-
320-
下記のように[mouse.yml](./config/mouse.yml)を編集し、`use_pulse_counters``true`に(初期値: `false`)することで、
321-
`raspimouse`ノードがモータの制御パルス数からオドメトリ(`/odom`)を計算します。
322-
323-
これは自己位置推定の精度を向上させます。
321+
[back to example list](#how-to-use-examples)
324322

325-
```yaml
326-
raspimouse:
327-
ros__parameters:
328-
odometry_scale_left_wheel : 1.0
329-
odometry_scale_right_wheel: 1.0
330-
use_light_sensors : true
331-
use_pulse_counters : true
332-
```
323+
---
333324

334-
<!-- #### Videos
325+
### SLAM
335326

336-
[![slam_urg](http://img.youtube.com/vi/gWozU47UqVE/sddefault.jpg)](https://youtu.be/gWozU47UqVE)
327+
<img src=https://rt-net.github.io/images/raspberry-pi-mouse/slam_toolbox_ros2.png width=500 />
337328

338-
[![slam_urg](http://img.youtube.com/vi/hV68UqAntfo/sddefault.jpg)](https://youtu.be/hV68UqAntfo) -->
329+
Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。
339330

340331
[back to example list](#how-to-use-examples)
341332

0 commit comments

Comments
 (0)