From cf52b0f6f4112f0b5bc364279fd0749b54f96af8 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 2 Oct 2025 16:03:59 +0900 Subject: [PATCH 01/48] =?UTF-8?q?=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=83=89?= =?UTF-8?q?=E3=82=AD=E3=83=A5=E3=83=A1=E3=83=B3=E3=83=88=E3=81=AE=E9=9B=9B?= =?UTF-8?q?=E5=BD=A2=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EXAMPLES.md | 158 +++++++++++ README.md | 463 ++++++++----------------------- README.en.md => old_README.en.md | 0 old_README.md | 424 ++++++++++++++++++++++++++++ 4 files changed, 693 insertions(+), 352 deletions(-) create mode 100644 EXAMPLES.md rename README.en.md => old_README.en.md (100%) create mode 100644 old_README.md diff --git a/EXAMPLES.md b/EXAMPLES.md new file mode 100644 index 0000000..6c89b4a --- /dev/null +++ b/EXAMPLES.md @@ -0,0 +1,158 @@ +# Examples + +## joystick_control + +ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 + +[![joystick_control](http://img.youtube.com/vi/GswxdB8Ia0Y/sddefault.jpg)](https://youtu.be/GswxdB8Ia0Y) + +次のコマンドでノードを起動します。 + +```sh +# Use F710 +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true + +# Use DUALSHOCK 3 +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true + +# Control from remote computer +## on RaspberryPiMouse +$ ros2 run raspimouse raspimouse +## on remote computer +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false +``` + +デフォルトのキー割り当てはこちらです。 + +Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを __D__ (DirectInput Mode)に設定します。 + +![](https://rt-net.github.io/images/raspberry-pi-mouse/joystick_control_keyconfig.png) + +[back to example list](#how-to-use-examples) + +--- + +## object_tracking + +色情報をもとにオレンジ色のボールの追跡を行うコード例です。 +USB接続のWebカメラとOpenCVを使ってボール追跡をします。 + + + +次のスクリプトを実行して、カメラの自動調節機能(自動露光,オートホワイトバランス等)を切ります。 + +```sh +$ cd ~/ros2_ws/src/raspimouse_ros2_examples/config +$ ./configure_camera.bash +``` + +次のコマンドでノードを起動します。 + +```sh +$ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/dev/video0 +``` + + +カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 +これらの画像は[RViz](https://index.ros.org/r/rviz/) +や[rqt_image_view](https://index.ros.org/p/rqt_image_view/) +で表示できます。 + +**画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。** + + + +## line_follower + +ライントレースのコード例です。 + +![mouse_with_line_trace_sensor](https://rt-net.github.io/images/raspberry-pi-mouse/mouse_with_line_trace_sensor.JPG) + +次のコマンドでノードを起動します。 + +```sh +$ ros2 launch raspimouse_ros2_examples line_follower.launch.py +``` + +Raspberry Pi Mouseをフィールドに置き、SW2を押してフィールド上のセンサ値をサンプリングします。 + + + +次に、センサとラインが重なるようにRaspberry Pi Mouseを置き、SW1を押してライン上のセンサ値をサンプリングします。 + + + +最後に、ライン上にRaspberry Pi Mouseを置き、SW0を押してライントレースを開始します。 + + + +もう一度SW0を押すとライントレースを停止します。 + +[![line_follower](http://img.youtube.com/vi/oPm0sW2V_tY/sddefault.jpg)](https://youtu.be/oPm0sW2V_tY) + +[back to example list](#how-to-use-examples) + +--- + +## camera_line_follower + +RGBカメラによるライントレースのコード例です。 + +![mouse_camera_line_trace_2](https://rt-net.github.io/images/raspberry-pi-mouse/mouse_camera_line_trace_2.png) + +```bash +# Terminal 1 +ros2 run ... + +# Terminal 2 +ros2 launch ... +``` + +次のコマンドでノードを起動します。 + +```sh +$ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_device:=/dev/video0 +``` + +ライン上にRaspberry Pi Mouseを置き、SW2を押してライントレースを開始します。 +停止させる場合はSW0を押します。 + +カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 +これらの画像は[RViz](https://index.ros.org/r/rviz/)や[rqt_image_view](https://index.ros.org/p/rqt_image_view/) +で表示できます。 + +[back to example list](#how-to-use-examples) + +--- + +## direction_controller + +IMUセンサを使用した角度制御のコード例です。 + + + +次のコマンドでノードを起動します。 + +```sh +$ ros2 launch raspimouse_ros2_examples direction_controller.launch.py +``` + +SW0 ~ SW2を押して動作モードを切り替えます。 + +- SW0: ジャイロセンサのバイアスをキャリブレーションし、ラズパイマウスの方位角を`0 rad`にリセットします +- SW1: 方位角を`0 rad`に維持する角度制御を開始します + - SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します +- SW2: 方位角を`-π ~ π rad`に変化させる角度制御を開始します + - SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します + +## SLAM + +![注意] + +Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 + +![slam_toolbox_ros2](https://rt-net.github.io/images/raspberry-pi-mouse/slam_toolbox_ros2.png) + +[back to example list](#how-to-use-examples) + +--- diff --git a/README.md b/README.md index 7a1924f..84e6661 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ # raspimouse_ros2_examples -[![industrial_ci](https://github.com/rt-net/raspimouse_ros2_examples/workflows/industrial_ci/badge.svg?branch=master)](https://github.com/rt-net/raspimouse_ros2_examples/actions?query=workflow%3Aindustrial_ci+branch%3Amaster) + +[![industrial_ci](https://github.com/rt-net/<リポジトリのパス>/actions/workflows/industrial_ci.yml/badge.svg?branch=<対象のブランチ>)](https://github.com/rt-net/<リポジトリのパス>/actions/workflows/industrial_ci.yml) Raspberry Pi MouseのROS 2サンプルコード集です。 @@ -10,12 +11,38 @@ ROS1のサンプルコード集は[こちら](https://github.com/rt-net/raspimou Gazebo(シミュレータ)でも動作します。詳細は[こちら](https://github.com/rt-net/raspimouse_sim/blob/ros2/README.md)。 - - -## Supported ROS 2 distributions - -- [Humble](https://github.com/rt-net/raspimouse_ros2_examples/tree/humble) -- [Jazzy](https://github.com/rt-net/raspimouse_ros2_examples/tree/jazzy) (This branch) +![raspberry_pi_mouse](https://rt-net.github.io/images/raspberry-pi-mouse/raspberry_pi_mouse.JPG) + +## Table of Contents + +- [raspimouse_ros2_examples](#raspimouse_ros2_examples) + - [Table of Contents](#table-of-contents) + - [Supported ROS distributions](#supported-ros-distributions) + - [Requirements](#requirements) + - [Installation](#installation) + - [Binary Installation](#binary-installation) + - [Source Build](#source-build) + - [QuickStart](#quickstart) + - [How To Use Examples](#how-to-use-examples) + - [](#sample名) + - [Packages](#packages) + - [Topics](#topics) + - [Subscribed](#subscribed) + - [Published](#published) + - [Services](#services) + - [Actions](#actions) + - [Parameters](#parameters) + - [](#etc-lifecycle-description等) + - [License](#license) + - [Contributing](#contributing) + - [Contributors](#contributors) + +## Supported ROS distributions + +### ROS 2 + +- [Humble Hawksbill](https://github.com/rt-net/raspimouse_ros2_examples/tree/humble) +- [Jazzy Jalisco](https://github.com/rt-net/raspimouse_ros2_examples/tree/jazzy) ## Requirements @@ -25,400 +52,132 @@ Gazebo(シミュレータ)でも動作します。詳細は[こちら](https - Ubuntu server 24.04 - Device Driver - [rt-net/RaspberryPiMouse](https://github.com/rt-net/RaspberryPiMouse) - - ROS + - ROS 2 - [Jazzy Jalisco](https://docs.ros.org/en/jazzy/index.html) - Raspberry Pi Mouse ROS 2 package - https://github.com/rt-net/raspimouse2 - Remote Computer (Optional) - - ROS + - ROS 2 - [Jazzy Jalisco](https://docs.ros.org/en/jazzy/index.html) - Raspberry Pi Mouse ROS 2 package - https://github.com/rt-net/raspimouse2 -## Installation - -```sh -$ cd ~/ros2_ws/src -# Clone package -$ git clone -b $ROS_DISTRO https://github.com/rt-net/raspimouse_ros2_examples.git - -# Install dependencies -$ rosdep install -r -y --from-paths . --ignore-src - -# Build & Install -$ cd ~/ros2_ws -$ colcon build --symlink-install -$ source ~/ros2_ws/install/setup.bash -``` - -## License - -このリポジトリはApache 2.0ライセンスの元、公開されています。 -ライセンスについては[LICENSE](./LICENSE)を参照ください。 -## How To Use Examples - -- [joystick_control](#joystick_control) -- [object_tracking](#object_tracking) -- [line_follower](#line_follower) -- [camera_line_follower](#camera_line_follower) -- [SLAM](#slam) -- [direction_controller](#direction_controller) - ---- - -### joystick_control - -ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 - -#### Requirements - -- Joystick Controller - - [Logicool Wireless Gamepad F710](https://gaming.logicool.co.jp/ja-jp/products/gamepads/f710-wireless-gamepad.html#940-0001440) - - [SONY DUALSHOCK 3](https://www.jp.playstation.com/ps3/peripheral/cechzc2j.html) - -#### How to use - -次のコマンドでノードを起動します。 - -```sh -# Use F710 -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true - -# Use DUALSHOCK 3 -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true - -# Control from remote computer -## on RaspberryPiMouse -$ ros2 run raspimouse raspimouse -## on remote computer -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false -``` - -デフォルトのキー割り当てはこちらです。 - -Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを __D__ (DirectInput Mode)に設定します。 - -![](https://rt-net.github.io/images/raspberry-pi-mouse/joystick_control_keyconfig.png) - -#### Configure - -[./config/joy_f710.yml](./config/joy_f710.yml)、[./config/joy_dualshock3.yml](./config/joy_dualshock3.yml) -のキー番号を編集することで、キー割り当てを変更できます。 - -```yaml -button_shutdown_1 : 8 -button_shutdown_2 : 9 - -button_motor_off : 8 -button_motor_on : 9 - -button_cmd_enable : 4 -``` - -#### Videos - -[![joystick_control](http://img.youtube.com/vi/GswxdB8Ia0Y/sddefault.jpg)](https://youtu.be/GswxdB8Ia0Y) - -[back to example list](#how-to-use-examples) - ---- - -### object_tracking - - - -色情報をもとにオレンジ色のボールの追跡を行うコード例です。 -USB接続のWebカメラとOpenCVを使ってボール追跡をします。 - -#### Requirements - -- Webカメラ - - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) -- カメラマウント - - [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584) -- ボール(Optional) - - [ソフトボール(オレンジ)](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1307&products_id=3701) -- Software - - OpenCV - - v4l-utils - -#### Installation - -Raspberry Pi Mouseにカメラマウントを取り付け、WebカメラをRaspberry Piに接続します。 - -#### How to use - -次のスクリプトを実行して、カメラの自動調節機能(自動露光,オートホワイトバランス等)を切ります。 - -```sh -$ cd ~/ros2_ws/src/raspimouse_ros2_examples/config -$ ./configure_camera.bash -``` - -次のコマンドでノードを起動します。 - -```sh -$ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/dev/video0 -``` - -カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 -これらの画像は[RViz](https://index.ros.org/r/rviz/) -や[rqt_image_view](https://index.ros.org/p/rqt_image_view/) -で表示できます。 - -**画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。** - - - -#### Configure - -追跡対象の色を変更するには -[`./src/object_tracking_component.cpp`](./src/object_tracking_component.cpp) -を編集します。 +## Installation -物体検出精度が悪い時にはカメラの露光や関数内のパラメータを調整して下さい。 +### Binary Installation -```cpp -void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) -{ - cv::inRange(hsv, cv::Scalar(9, 100, 100), cv::Scalar(29, 255, 255), extracted_bin); // Orange - // cv::inRange(hsv, cv::Scalar(60, 100, 100), cv::Scalar(80, 255, 255), extracted_bin); // Green - // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue +```bash +sudo apt install <パッケージ名> ``` -#### Videos - -[![object_tracking](http://img.youtube.com/vi/8lgmSTScP98/sddefault.jpg)](https://youtu.be/8lgmSTScP98) - -[back to example list](#how-to-use-examples) - ---- +### Source Build -### line_follower +```bash +# Create workspace directory +mkdir -p ~/ros2_ws/src && cd ~/ros2_ws/src - - -ライントレースのコード例です。 - -#### Requirements - -- ライントレースセンサ - - [Raspberry Pi Mouse オプションキット No.3 \[ライントレース\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3591) -- フィールドとライン (Optional) - -#### Installation - -Raspberry Pi Mouseにライントレースセンサを取り付けます。 - -#### How to use +# Clone package +git clone -b $ROS_DISTRO https://github.com/rt-net/raspimouse_ros2_examples.git -次のコマンドでノードを起動します。 +# Install dependencies +rosdep install -r -y -i --from-paths . -```sh -$ ros2 launch raspimouse_ros2_examples line_follower.launch.py +# Build & Install +cd ~/ros2_ws +colcon build --symlink-install +source ~/ros2_ws/install/setup.bash ``` -Raspberry Pi Mouseをフィールドに置き、SW2を押してフィールド上のセンサ値をサンプリングします。 - - - -次に、センサとラインが重なるようにRaspberry Pi Mouseを置き、SW1を押してライン上のセンサ値をサンプリングします。 - - +## QuickStart -最後に、ライン上にRaspberry Pi Mouseを置き、SW0を押してライントレースを開始します。 +```bash +# Terminal 1 +ros2 run ... - - -もう一度SW0を押すとライントレースを停止します。 - -#### Configure - -走行速度を変更するには[`./src/line_follower_component.cpp`](./src/line_follower_component.cpp)を編集します。 - -```cpp -void Follower::publish_cmdvel_for_line_following(void) -{ - const double VEL_LINEAR_X = 0.08; // m/s - const double VEL_ANGULAR_Z = 0.8; // rad/s - const double LOW_VEL_ANGULAR_Z = 0.5; // rad/s +# Terminal 2 +ros2 launch ... ``` -#### Videos - -[![line_follower](http://img.youtube.com/vi/oPm0sW2V_tY/sddefault.jpg)](https://youtu.be/oPm0sW2V_tY) - -[back to example list](#how-to-use-examples) +## How to Use Examples ---- +サンプルプログラムの詳細な動作方法は、[EXAMPLES](./EXAMPLES.md)で説明しています。 -### camera_line_follower +### - +サンプルプログラムの説明 -RGBカメラによるライントレースのコード例です。 + +![画像](画像ファイルパス) +[![動画名](表示画像パス)](Youtubeのリンクパス) -#### Requirements + -- Webカメラ - - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) -- カメラマウント - - [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584) - -#### Installation - -Raspberry Pi Mouseにカメラマウントを取り付け、WebカメラをRaspberry Piに接続します。 - -#### How to use - -次のコマンドでノードを起動します。 - -```sh -$ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_device:=/dev/video0 -``` +```bash +# Terminal 1 +ros2 run ... -ライン上にRaspberry Pi Mouseを置き、SW2を押してライントレースを開始します。 -停止させる場合はSW0を押します。 - -カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 -これらの画像は[RViz](https://index.ros.org/r/rviz/) -や[rqt_image_view](https://index.ros.org/p/rqt_image_view/) -で表示できます。 - -**画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。** - -**ラインの検出精度が悪い場合はカメラの露光やホワイトバランスの調整を行ってください。** - - - -#### Parameters - -- `max_brightness` - - Type: `int` - - Default: 90 - - 画像の2値化のしきい値の最大値 -- `min_brightness` - - Type: `int` - - Default: 0 - - 画像の2値化のしきい値の最小値 -- `max_linear_vel` - - Type: `double` - - Default: 0.05 - - 直進速度の最大値 -- `max_angular_vel` - - Type: `double` - - Default: 0.8 - - 旋回速度の最大値 -- `area_threshold` - - Type: `double` - - Default: 0.20 - - 走行を開始するためのライン面積のしきい値 - -```sh -ros2 param set /camera_follower max_brightness 80 +# Terminal 2 +ros2 launch ... ``` -[back to example list](#how-to-use-examples) +## Topics ---- + -### SLAM +### Subscribed - +- `` + - Type: `<型名>` + - 説明の記述 + +### Published -Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 +- `` + - Type: `<型名>` + - 説明の記述 -[back to example list](#how-to-use-examples) +## Services ---- + -### direction_controller +- `` + - Type: `<型名>` + - 説明の記述 - +## Actions -IMUセンサを使用した角度制御のコード例です。 + -#### Requirements +- `` + - Type: `<型名>` + - 説明の記述 -- [USB出力9軸IMUセンサモジュール](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1348_1&products_id=3416&language=ja) -- LiDAR Mount ([Raspberry Pi Mouse オプションキットNo.8 [マルチLiDARマウント]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3867)) -- RT-USB-9axisIMU ROS Package - - https://github.com/rt-net/rt_usb_9axisimu_driver +## Parameters -#### Installation + -LiDAR MountにIMUセンサモジュールを取り付けます。 +- `` + - Type: `<型名>` + - Default: `<デフォルト値>` + - 説明の記述 - +## -Raspberry Pi Mouse にLiDAR Mountを取り付けます。 + - - -#### How to use - -次のコマンドでノードを起動します。 - -```sh -$ ros2 launch raspimouse_ros2_examples direction_controller.launch.py -``` - -SW0 ~ SW2を押して動作モードを切り替えます。 - -- SW0: ジャイロセンサのバイアスをキャリブレーションし、ラズパイマウスの方位角を`0 rad`にリセットします -- SW1: 方位角を`0 rad`に維持する角度制御を開始します - - SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します -- SW2: 方位角を`-π ~ π rad`に変化させる角度制御を開始します - - SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します - -### Troubleshooting - -IMUの接続が正常に行われない場合があります。 -その時は、IMUのUSBケーブルを抜き差ししてください。 -抜き差し実施後は、コマンドを再度実行してください。 - -#### Configure - -パラメータで角度制御に使うPIDゲインを変更できます。 +## License -```sh -$ ros2 param set /direction_controller p_gain 10.0 -Set parameter successful +(C) 2022 RT Corporation \ -$ ros2 param set /direction_controller i_gain 0.5 -Set parameter successful +各ファイルはライセンスがファイル中に明記されている場合、そのライセンスに従います。 特に明記されていない場合は、Apache License, Version 2.0に基づき公開されています。 +ライセンスの全文は[LICENSE](./LICENSE)または[https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)から確認できます。 -$ ros2 param set /direction_controller d_gain 0.0 -Set parameter successful -``` +## Contributing -#### Parameters - -- p_gain - - Proportional gain of a PID controller for the direction control - - default: 10.0, min:0.0, max:30.0 - - type: double -- i_gain - - Integral gain of a PID controller for the direction control - - default: 0.0, min:0.0, max:5.0 - - type: double -- d_gain - - Derivative gain of a PID controller for the direction control - - default: 20.0, min:0.0, max:30.0 - - type: double -- target_angle - - Target angle for the SW1 control mode. - - default: 0.0, min:-π, max:+π - - type: double - -#### Publish topics -- heading_angle - - Heading angle of the robot that calculated from the IMU module sensor values. - - type: std_msgs/Float64 - -#### Videos - -[![](http://img.youtube.com/vi/ghcCYOh9_MM/sddefault.jpg)](https://youtu.be/ghcCYOh9_MM) - -[back to example list](#how-to-use-examples) +- 本ソフトウェアはオープンソースですが、開発はオープンではありません。 +- 本ソフトウェアは基本的にオープンソースソフトウェアとして「AS IS」(現状有姿のまま)で提供しています。 +- 本ソフトウェアに関する無償サポートはありません。 +- バグの修正や誤字脱字の修正に関するリクエストは常に受け付けていますが、 +それ以外の機能追加等のリクエストについては社内のガイドラインを優先します。 +詳しくは[コントリビューションガイドライン](https://github.com/rt-net/.github/blob/master/CONTRIBUTING.md)に従ってください。 diff --git a/README.en.md b/old_README.en.md similarity index 100% rename from README.en.md rename to old_README.en.md diff --git a/old_README.md b/old_README.md new file mode 100644 index 0000000..7a1924f --- /dev/null +++ b/old_README.md @@ -0,0 +1,424 @@ +[English](README.en.md) | [日本語](README.md) + +# raspimouse_ros2_examples + +[![industrial_ci](https://github.com/rt-net/raspimouse_ros2_examples/workflows/industrial_ci/badge.svg?branch=master)](https://github.com/rt-net/raspimouse_ros2_examples/actions?query=workflow%3Aindustrial_ci+branch%3Amaster) + +Raspberry Pi MouseのROS 2サンプルコード集です。 + +ROS1のサンプルコード集は[こちら](https://github.com/rt-net/raspimouse_ros_examples/blob/master/README.md)。 + +Gazebo(シミュレータ)でも動作します。詳細は[こちら](https://github.com/rt-net/raspimouse_sim/blob/ros2/README.md)。 + + + +## Supported ROS 2 distributions + +- [Humble](https://github.com/rt-net/raspimouse_ros2_examples/tree/humble) +- [Jazzy](https://github.com/rt-net/raspimouse_ros2_examples/tree/jazzy) (This branch) + +## Requirements + +- Raspberry Pi Mouse + - https://rt-net.jp/products/raspberrypimousev3/ + - Linux OS + - Ubuntu server 24.04 + - Device Driver + - [rt-net/RaspberryPiMouse](https://github.com/rt-net/RaspberryPiMouse) + - ROS + - [Jazzy Jalisco](https://docs.ros.org/en/jazzy/index.html) + - Raspberry Pi Mouse ROS 2 package + - https://github.com/rt-net/raspimouse2 +- Remote Computer (Optional) + - ROS + - [Jazzy Jalisco](https://docs.ros.org/en/jazzy/index.html) + - Raspberry Pi Mouse ROS 2 package + - https://github.com/rt-net/raspimouse2 + +## Installation + +```sh +$ cd ~/ros2_ws/src +# Clone package +$ git clone -b $ROS_DISTRO https://github.com/rt-net/raspimouse_ros2_examples.git + +# Install dependencies +$ rosdep install -r -y --from-paths . --ignore-src + +# Build & Install +$ cd ~/ros2_ws +$ colcon build --symlink-install +$ source ~/ros2_ws/install/setup.bash +``` + +## License + +このリポジトリはApache 2.0ライセンスの元、公開されています。 +ライセンスについては[LICENSE](./LICENSE)を参照ください。 + +## How To Use Examples + +- [joystick_control](#joystick_control) +- [object_tracking](#object_tracking) +- [line_follower](#line_follower) +- [camera_line_follower](#camera_line_follower) +- [SLAM](#slam) +- [direction_controller](#direction_controller) + +--- + +### joystick_control + +ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 + +#### Requirements + +- Joystick Controller + - [Logicool Wireless Gamepad F710](https://gaming.logicool.co.jp/ja-jp/products/gamepads/f710-wireless-gamepad.html#940-0001440) + - [SONY DUALSHOCK 3](https://www.jp.playstation.com/ps3/peripheral/cechzc2j.html) + +#### How to use + +次のコマンドでノードを起動します。 + +```sh +# Use F710 +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true + +# Use DUALSHOCK 3 +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true + +# Control from remote computer +## on RaspberryPiMouse +$ ros2 run raspimouse raspimouse +## on remote computer +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false +``` + +デフォルトのキー割り当てはこちらです。 + +Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを __D__ (DirectInput Mode)に設定します。 + +![](https://rt-net.github.io/images/raspberry-pi-mouse/joystick_control_keyconfig.png) + +#### Configure + +[./config/joy_f710.yml](./config/joy_f710.yml)、[./config/joy_dualshock3.yml](./config/joy_dualshock3.yml) +のキー番号を編集することで、キー割り当てを変更できます。 + +```yaml +button_shutdown_1 : 8 +button_shutdown_2 : 9 + +button_motor_off : 8 +button_motor_on : 9 + +button_cmd_enable : 4 +``` + +#### Videos + +[![joystick_control](http://img.youtube.com/vi/GswxdB8Ia0Y/sddefault.jpg)](https://youtu.be/GswxdB8Ia0Y) + +[back to example list](#how-to-use-examples) + +--- + +### object_tracking + + + +色情報をもとにオレンジ色のボールの追跡を行うコード例です。 +USB接続のWebカメラとOpenCVを使ってボール追跡をします。 + +#### Requirements + +- Webカメラ + - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) +- カメラマウント + - [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584) +- ボール(Optional) + - [ソフトボール(オレンジ)](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1307&products_id=3701) +- Software + - OpenCV + - v4l-utils + +#### Installation + +Raspberry Pi Mouseにカメラマウントを取り付け、WebカメラをRaspberry Piに接続します。 + +#### How to use + +次のスクリプトを実行して、カメラの自動調節機能(自動露光,オートホワイトバランス等)を切ります。 + +```sh +$ cd ~/ros2_ws/src/raspimouse_ros2_examples/config +$ ./configure_camera.bash +``` + +次のコマンドでノードを起動します。 + +```sh +$ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/dev/video0 +``` + +カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 +これらの画像は[RViz](https://index.ros.org/r/rviz/) +や[rqt_image_view](https://index.ros.org/p/rqt_image_view/) +で表示できます。 + +**画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。** + + + +#### Configure + +追跡対象の色を変更するには +[`./src/object_tracking_component.cpp`](./src/object_tracking_component.cpp) +を編集します。 + +物体検出精度が悪い時にはカメラの露光や関数内のパラメータを調整して下さい。 + +```cpp +void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) +{ + cv::inRange(hsv, cv::Scalar(9, 100, 100), cv::Scalar(29, 255, 255), extracted_bin); // Orange + // cv::inRange(hsv, cv::Scalar(60, 100, 100), cv::Scalar(80, 255, 255), extracted_bin); // Green + // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue +``` + +#### Videos + +[![object_tracking](http://img.youtube.com/vi/8lgmSTScP98/sddefault.jpg)](https://youtu.be/8lgmSTScP98) + +[back to example list](#how-to-use-examples) + +--- + +### line_follower + + + +ライントレースのコード例です。 + +#### Requirements + +- ライントレースセンサ + - [Raspberry Pi Mouse オプションキット No.3 \[ライントレース\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3591) +- フィールドとライン (Optional) + +#### Installation + +Raspberry Pi Mouseにライントレースセンサを取り付けます。 + +#### How to use + +次のコマンドでノードを起動します。 + +```sh +$ ros2 launch raspimouse_ros2_examples line_follower.launch.py +``` + +Raspberry Pi Mouseをフィールドに置き、SW2を押してフィールド上のセンサ値をサンプリングします。 + + + +次に、センサとラインが重なるようにRaspberry Pi Mouseを置き、SW1を押してライン上のセンサ値をサンプリングします。 + + + +最後に、ライン上にRaspberry Pi Mouseを置き、SW0を押してライントレースを開始します。 + + + +もう一度SW0を押すとライントレースを停止します。 + +#### Configure + +走行速度を変更するには[`./src/line_follower_component.cpp`](./src/line_follower_component.cpp)を編集します。 + +```cpp +void Follower::publish_cmdvel_for_line_following(void) +{ + const double VEL_LINEAR_X = 0.08; // m/s + const double VEL_ANGULAR_Z = 0.8; // rad/s + const double LOW_VEL_ANGULAR_Z = 0.5; // rad/s +``` + +#### Videos + +[![line_follower](http://img.youtube.com/vi/oPm0sW2V_tY/sddefault.jpg)](https://youtu.be/oPm0sW2V_tY) + +[back to example list](#how-to-use-examples) + +--- + +### camera_line_follower + + + +RGBカメラによるライントレースのコード例です。 + +#### Requirements + +- Webカメラ + - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) +- カメラマウント + - [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584) + +#### Installation + +Raspberry Pi Mouseにカメラマウントを取り付け、WebカメラをRaspberry Piに接続します。 + +#### How to use + +次のコマンドでノードを起動します。 + +```sh +$ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_device:=/dev/video0 +``` + +ライン上にRaspberry Pi Mouseを置き、SW2を押してライントレースを開始します。 +停止させる場合はSW0を押します。 + +カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 +これらの画像は[RViz](https://index.ros.org/r/rviz/) +や[rqt_image_view](https://index.ros.org/p/rqt_image_view/) +で表示できます。 + +**画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。** + +**ラインの検出精度が悪い場合はカメラの露光やホワイトバランスの調整を行ってください。** + + + +#### Parameters + +- `max_brightness` + - Type: `int` + - Default: 90 + - 画像の2値化のしきい値の最大値 +- `min_brightness` + - Type: `int` + - Default: 0 + - 画像の2値化のしきい値の最小値 +- `max_linear_vel` + - Type: `double` + - Default: 0.05 + - 直進速度の最大値 +- `max_angular_vel` + - Type: `double` + - Default: 0.8 + - 旋回速度の最大値 +- `area_threshold` + - Type: `double` + - Default: 0.20 + - 走行を開始するためのライン面積のしきい値 + +```sh +ros2 param set /camera_follower max_brightness 80 +``` + +[back to example list](#how-to-use-examples) + +--- + +### SLAM + + + +Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 + +[back to example list](#how-to-use-examples) + +--- + +### direction_controller + + + +IMUセンサを使用した角度制御のコード例です。 + +#### Requirements + +- [USB出力9軸IMUセンサモジュール](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1348_1&products_id=3416&language=ja) +- LiDAR Mount ([Raspberry Pi Mouse オプションキットNo.8 [マルチLiDARマウント]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3867)) +- RT-USB-9axisIMU ROS Package + - https://github.com/rt-net/rt_usb_9axisimu_driver + +#### Installation + +LiDAR MountにIMUセンサモジュールを取り付けます。 + + + +Raspberry Pi Mouse にLiDAR Mountを取り付けます。 + + + +#### How to use + +次のコマンドでノードを起動します。 + +```sh +$ ros2 launch raspimouse_ros2_examples direction_controller.launch.py +``` + +SW0 ~ SW2を押して動作モードを切り替えます。 + +- SW0: ジャイロセンサのバイアスをキャリブレーションし、ラズパイマウスの方位角を`0 rad`にリセットします +- SW1: 方位角を`0 rad`に維持する角度制御を開始します + - SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します +- SW2: 方位角を`-π ~ π rad`に変化させる角度制御を開始します + - SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します + +### Troubleshooting + +IMUの接続が正常に行われない場合があります。 +その時は、IMUのUSBケーブルを抜き差ししてください。 +抜き差し実施後は、コマンドを再度実行してください。 + +#### Configure + +パラメータで角度制御に使うPIDゲインを変更できます。 + +```sh +$ ros2 param set /direction_controller p_gain 10.0 +Set parameter successful + +$ ros2 param set /direction_controller i_gain 0.5 +Set parameter successful + +$ ros2 param set /direction_controller d_gain 0.0 +Set parameter successful +``` + +#### Parameters + +- p_gain + - Proportional gain of a PID controller for the direction control + - default: 10.0, min:0.0, max:30.0 + - type: double +- i_gain + - Integral gain of a PID controller for the direction control + - default: 0.0, min:0.0, max:5.0 + - type: double +- d_gain + - Derivative gain of a PID controller for the direction control + - default: 20.0, min:0.0, max:30.0 + - type: double +- target_angle + - Target angle for the SW1 control mode. + - default: 0.0, min:-π, max:+π + - type: double + +#### Publish topics +- heading_angle + - Heading angle of the robot that calculated from the IMU module sensor values. + - type: std_msgs/Float64 + +#### Videos + +[![](http://img.youtube.com/vi/ghcCYOh9_MM/sddefault.jpg)](https://youtu.be/ghcCYOh9_MM) + +[back to example list](#how-to-use-examples) From 62d298cf00d882f80a1fb988062a85ba30b5e90c Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 2 Oct 2025 17:23:52 +0900 Subject: [PATCH 02/48] =?UTF-8?q?=E3=83=AA=E3=83=9D=E3=82=B8=E3=83=88?= =?UTF-8?q?=E3=83=AA=E3=83=88=E3=83=83=E3=83=97=E3=81=AEREADME=E3=82=92?= =?UTF-8?q?=E6=95=B4=E5=82=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 100 ++++++++++++------------------------------------------ 1 file changed, 22 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index 84e6661..56d268c 100644 --- a/README.md +++ b/README.md @@ -24,18 +24,8 @@ Gazebo(シミュレータ)でも動作します。詳細は[こちら](https - [Source Build](#source-build) - [QuickStart](#quickstart) - [How To Use Examples](#how-to-use-examples) - - [](#sample名) - - [Packages](#packages) - - [Topics](#topics) - - [Subscribed](#subscribed) - - [Published](#published) - - [Services](#services) - - [Actions](#actions) - - [Parameters](#parameters) - - [](#etc-lifecycle-description等) - [License](#license) - [Contributing](#contributing) - - [Contributors](#contributors) ## Supported ROS distributions @@ -67,13 +57,13 @@ Gazebo(シミュレータ)でも動作します。詳細は[こちら](https ### Binary Installation -```bash +```sh sudo apt install <パッケージ名> ``` ### Source Build -```bash +```sh # Create workspace directory mkdir -p ~/ros2_ws/src && cd ~/ros2_ws/src @@ -91,80 +81,34 @@ source ~/ros2_ws/install/setup.bash ## QuickStart -```bash -# Terminal 1 -ros2 run ... +ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 -# Terminal 2 -ros2 launch ... -``` - -## How to Use Examples - -サンプルプログラムの詳細な動作方法は、[EXAMPLES](./EXAMPLES.md)で説明しています。 - -### +- 対応コントローラ + - [Logicool Wireless Gamepad F710](https://gaming.logicool.co.jp/ja-jp/products/gamepads/f710-wireless-gamepad.html#940-0001440) + - [SONY DUALSHOCK 3](https://www.jp.playstation.com/ps3/peripheral/cechzc2j.html) -サンプルプログラムの説明 +### Controlled directly on Raspberry Pi Mouse - -![画像](画像ファイルパス) -[![動画名](表示画像パス)](Youtubeのリンクパス) - - - -```bash -# Terminal 1 -ros2 run ... - -# Terminal 2 -ros2 launch ... +```sh +# Controlled directly on Raspberry Pi Mouse +## Use F710 +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true +## Use DUALSHOCK 3 +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true ``` -## Topics - - - -### Subscribed - -- `` - - Type: `<型名>` - - 説明の記述 - -### Published +### Control from remote computer -- `` - - Type: `<型名>` - - 説明の記述 - -## Services - - - -- `` - - Type: `<型名>` - - 説明の記述 - -## Actions - - - -- `` - - Type: `<型名>` - - 説明の記述 - -## Parameters - - - -- `` - - Type: `<型名>` - - Default: `<デフォルト値>` - - 説明の記述 +```sh +## on RaspberryPiMouse +$ ros2 run raspimouse raspimouse +## on remote computer +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false +``` -## +## How to Use Examples - +サンプルプログラムの詳細な動作方法は、[EXAMPLES](./EXAMPLES.md)で説明しています。 ## License From 0297965a80941fe9a30e95748f6b38f49398b705 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 2 Oct 2025 17:28:32 +0900 Subject: [PATCH 03/48] =?UTF-8?q?QuickStart=E3=82=92=E7=B0=A1=E6=BD=94?= =?UTF-8?q?=E3=81=AB=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/README.md b/README.md index 56d268c..0f8533a 100644 --- a/README.md +++ b/README.md @@ -81,24 +81,12 @@ source ~/ros2_ws/install/setup.bash ## QuickStart -ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 +ジョイスティックコントローラで、Raspberry Pi Mouseをリモート操作します。 - 対応コントローラ - [Logicool Wireless Gamepad F710](https://gaming.logicool.co.jp/ja-jp/products/gamepads/f710-wireless-gamepad.html#940-0001440) - [SONY DUALSHOCK 3](https://www.jp.playstation.com/ps3/peripheral/cechzc2j.html) -### Controlled directly on Raspberry Pi Mouse - -```sh -# Controlled directly on Raspberry Pi Mouse -## Use F710 -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true -## Use DUALSHOCK 3 -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true -``` - -### Control from remote computer - ```sh ## on RaspberryPiMouse $ ros2 run raspimouse raspimouse From f53b0d8c731655780a085170ba7f273cfe554d91 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 2 Oct 2025 17:36:10 +0900 Subject: [PATCH 04/48] =?UTF-8?q?=E3=83=91=E3=83=83=E3=82=B1=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=82=A4=E3=83=B3=E3=82=B9=E3=83=88=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E6=89=8B=E9=A0=86=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0f8533a..42fcb2d 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Gazebo(シミュレータ)でも動作します。詳細は[こちら](https ### Binary Installation ```sh -sudo apt install <パッケージ名> +sudo apt install raspimouse-ros2-examples ``` ### Source Build @@ -88,9 +88,9 @@ source ~/ros2_ws/install/setup.bash - [SONY DUALSHOCK 3](https://www.jp.playstation.com/ps3/peripheral/cechzc2j.html) ```sh -## on RaspberryPiMouse +# on RaspberryPiMouse $ ros2 run raspimouse raspimouse -## on remote computer +# on remote computer $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false ``` From cb7f096bf47c7edccbc4fefb181e0761a516178f Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 2 Oct 2025 17:37:44 +0900 Subject: [PATCH 05/48] =?UTF-8?q?=E3=83=AA=E3=83=9D=E3=82=B8=E3=83=88?= =?UTF-8?q?=E3=83=AA=E3=83=88=E3=83=83=E3=83=97=E3=81=AE=E7=94=BB=E5=83=8F?= =?UTF-8?q?=E3=82=B5=E3=82=A4=E3=82=BA=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 42fcb2d..5afdf53 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ # raspimouse_ros2_examples - [![industrial_ci](https://github.com/rt-net/<リポジトリのパス>/actions/workflows/industrial_ci.yml/badge.svg?branch=<対象のブランチ>)](https://github.com/rt-net/<リポジトリのパス>/actions/workflows/industrial_ci.yml) Raspberry Pi MouseのROS 2サンプルコード集です。 @@ -11,7 +10,7 @@ ROS1のサンプルコード集は[こちら](https://github.com/rt-net/raspimou Gazebo(シミュレータ)でも動作します。詳細は[こちら](https://github.com/rt-net/raspimouse_sim/blob/ros2/README.md)。 -![raspberry_pi_mouse](https://rt-net.github.io/images/raspberry-pi-mouse/raspberry_pi_mouse.JPG) + ## Table of Contents From ef9fa260be2b0f58da5b0f70a5b62bdc21dc78f7 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 2 Oct 2025 17:39:07 +0900 Subject: [PATCH 06/48] =?UTF-8?q?=E3=83=90=E3=83=83=E3=82=B8=E3=81=AEURL?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5afdf53..13508ef 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # raspimouse_ros2_examples -[![industrial_ci](https://github.com/rt-net/<リポジトリのパス>/actions/workflows/industrial_ci.yml/badge.svg?branch=<対象のブランチ>)](https://github.com/rt-net/<リポジトリのパス>/actions/workflows/industrial_ci.yml) +[![industrial_ci](https://github.com/rt-net/raspimouse_ros2_examples/workflows/industrial_ci/badge.svg?branch=master)](https://github.com/rt-net/raspimouse_ros2_examples/actions?query=workflow%3Aindustrial_ci+branch%3Amaster) Raspberry Pi MouseのROS 2サンプルコード集です。 From 1143181dd4a31b3dedf8cd5c2b344ca024cd9d43 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 2 Oct 2025 17:41:51 +0900 Subject: [PATCH 07/48] =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E5=90=8D=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EXAMPLES.md => Examples.md | 0 README.md | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename EXAMPLES.md => Examples.md (100%) diff --git a/EXAMPLES.md b/Examples.md similarity index 100% rename from EXAMPLES.md rename to Examples.md diff --git a/README.md b/README.md index 13508ef..5c5ba37 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false ## How to Use Examples -サンプルプログラムの詳細な動作方法は、[EXAMPLES](./EXAMPLES.md)で説明しています。 +サンプルプログラムの詳細な動作方法は、[Examples](./Examples.md)で説明しています。 ## License From 64d3f1d9650f7daa1149fbaa43165e884882060e Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 2 Oct 2025 17:46:45 +0900 Subject: [PATCH 08/48] =?UTF-8?q?Examples=E3=81=AE=E4=B8=80=E8=A6=A7?= =?UTF-8?q?=E3=82=92=E6=98=8E=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 5c5ba37..b47f5c3 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,14 @@ $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false サンプルプログラムの詳細な動作方法は、[Examples](./Examples.md)で説明しています。 +- Examples + - joystick_control + - object_tracking + - line_follower + - camera_line_follower + - direction_controller + - SLAM/Navigation ([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) + ## License (C) 2022 RT Corporation \ From b2670c7f32894b5180ed1bd95d1d7dd3776491df Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 2 Oct 2025 18:06:53 +0900 Subject: [PATCH 09/48] =?UTF-8?q?Example=E3=81=AE=E7=94=BB=E5=83=8F?= =?UTF-8?q?=E3=82=B5=E3=82=A4=E3=82=BA=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples.md | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Examples.md b/Examples.md index 6c89b4a..f397fbe 100644 --- a/Examples.md +++ b/Examples.md @@ -4,7 +4,7 @@ ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 -[![joystick_control](http://img.youtube.com/vi/GswxdB8Ia0Y/sddefault.jpg)](https://youtu.be/GswxdB8Ia0Y) +joystick_control 次のコマンドでノードを起動します。 @@ -26,7 +26,7 @@ $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを __D__ (DirectInput Mode)に設定します。 -![](https://rt-net.github.io/images/raspberry-pi-mouse/joystick_control_keyconfig.png) + [back to example list](#how-to-use-examples) @@ -37,7 +37,7 @@ Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを _ 色情報をもとにオレンジ色のボールの追跡を行うコード例です。 USB接続のWebカメラとOpenCVを使ってボール追跡をします。 - + 次のスクリプトを実行して、カメラの自動調節機能(自動露光,オートホワイトバランス等)を切ります。 @@ -54,19 +54,21 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/ カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 -これらの画像は[RViz](https://index.ros.org/r/rviz/) -や[rqt_image_view](https://index.ros.org/p/rqt_image_view/) -で表示できます。 +これらの画像は[RViz](https://index.ros.org/r/rviz/)や[rqt_image_view](https://index.ros.org/p/rqt_image_view/)で表示できます。 **画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。** +[back to example list](#how-to-use-examples) + +--- + ## line_follower ライントレースのコード例です。 -![mouse_with_line_trace_sensor](https://rt-net.github.io/images/raspberry-pi-mouse/mouse_with_line_trace_sensor.JPG) + 次のコマンドでノードを起動します。 @@ -98,7 +100,7 @@ Raspberry Pi Mouseをフィールドに置き、SW2を押してフィールド RGBカメラによるライントレースのコード例です。 -![mouse_camera_line_trace_2](https://rt-net.github.io/images/raspberry-pi-mouse/mouse_camera_line_trace_2.png) + ```bash # Terminal 1 @@ -129,7 +131,7 @@ $ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_devi IMUセンサを使用した角度制御のコード例です。 - + 次のコマンドでノードを起動します。 @@ -145,6 +147,10 @@ SW0 ~ SW2を押して動作モードを切り替えます。 - SW2: 方位角を`-π ~ π rad`に変化させる角度制御を開始します - SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します +[back to example list](#how-to-use-examples) + +--- + ## SLAM ![注意] From 5bfcb4bf11e1071f93af65e36356dfbc150ad622 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 2 Oct 2025 18:28:57 +0900 Subject: [PATCH 10/48] =?UTF-8?q?=E7=94=BB=E5=83=8F=E3=82=B5=E3=82=A4?= =?UTF-8?q?=E3=82=BA=E3=81=AA=E3=81=A9=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Examples.md b/Examples.md index f397fbe..a540da6 100644 --- a/Examples.md +++ b/Examples.md @@ -131,7 +131,7 @@ $ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_devi IMUセンサを使用した角度制御のコード例です。 - + 次のコマンドでノードを起動します。 @@ -153,11 +153,10 @@ SW0 ~ SW2を押して動作モードを切り替えます。 ## SLAM -![注意] +> [!NOTE] +> Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 -Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 - -![slam_toolbox_ros2](https://rt-net.github.io/images/raspberry-pi-mouse/slam_toolbox_ros2.png) + [back to example list](#how-to-use-examples) From 3346e8fc41207efb12409ea7fc2500a3fdd2289e Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 10:00:24 +0900 Subject: [PATCH 11/48] =?UTF-8?q?=E7=94=BB=E5=83=8F=E3=82=B5=E3=82=A4?= =?UTF-8?q?=E3=82=BA=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Examples.md b/Examples.md index a540da6..2badbf7 100644 --- a/Examples.md +++ b/Examples.md @@ -4,7 +4,7 @@ ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 -joystick_control +joystick_control 次のコマンドでノードを起動します。 @@ -37,7 +37,7 @@ Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを _ 色情報をもとにオレンジ色のボールの追跡を行うコード例です。 USB接続のWebカメラとOpenCVを使ってボール追跡をします。 - + 次のスクリプトを実行して、カメラの自動調節機能(自動露光,オートホワイトバランス等)を切ります。 @@ -68,7 +68,7 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/ ライントレースのコード例です。 - + 次のコマンドでノードを起動します。 @@ -100,7 +100,7 @@ Raspberry Pi Mouseをフィールドに置き、SW2を押してフィールド RGBカメラによるライントレースのコード例です。 - + ```bash # Terminal 1 @@ -156,7 +156,7 @@ SW0 ~ SW2を押して動作モードを切り替えます。 > [!NOTE] > Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 - + [back to example list](#how-to-use-examples) From e2fe01106115f9da99b070dfea5cd69a60b0a2f9 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 10:14:07 +0900 Subject: [PATCH 12/48] =?UTF-8?q?=E7=94=BB=E5=83=8F=E3=81=AE=E3=82=B5?= =?UTF-8?q?=E3=82=A4=E3=82=BA=E3=82=84=E3=83=AA=E3=83=B3=E3=82=AF=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples.md | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/Examples.md b/Examples.md index 2badbf7..838f0a0 100644 --- a/Examples.md +++ b/Examples.md @@ -4,7 +4,9 @@ ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 -joystick_control + + joystick_control + 次のコマンドでノードを起動します。 @@ -26,7 +28,7 @@ $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを __D__ (DirectInput Mode)に設定します。 - + [back to example list](#how-to-use-examples) @@ -37,7 +39,7 @@ Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを _ 色情報をもとにオレンジ色のボールの追跡を行うコード例です。 USB接続のWebカメラとOpenCVを使ってボール追跡をします。 - + 次のスクリプトを実行して、カメラの自動調節機能(自動露光,オートホワイトバランス等)を切ります。 @@ -58,7 +60,7 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/ **画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。** - + [back to example list](#how-to-use-examples) @@ -68,7 +70,7 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/ ライントレースのコード例です。 - + 次のコマンドでノードを起動します。 @@ -78,19 +80,21 @@ $ ros2 launch raspimouse_ros2_examples line_follower.launch.py Raspberry Pi Mouseをフィールドに置き、SW2を押してフィールド上のセンサ値をサンプリングします。 - + 次に、センサとラインが重なるようにRaspberry Pi Mouseを置き、SW1を押してライン上のセンサ値をサンプリングします。 - + 最後に、ライン上にRaspberry Pi Mouseを置き、SW0を押してライントレースを開始します。 - + もう一度SW0を押すとライントレースを停止します。 -[![line_follower](http://img.youtube.com/vi/oPm0sW2V_tY/sddefault.jpg)](https://youtu.be/oPm0sW2V_tY) + + joystick_control + [back to example list](#how-to-use-examples) @@ -100,7 +104,7 @@ Raspberry Pi Mouseをフィールドに置き、SW2を押してフィールド RGBカメラによるライントレースのコード例です。 - + ```bash # Terminal 1 @@ -131,7 +135,8 @@ $ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_devi IMUセンサを使用した角度制御のコード例です。 - + + 次のコマンドでノードを起動します。 @@ -156,7 +161,7 @@ SW0 ~ SW2を押して動作モードを切り替えます。 > [!NOTE] > Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 - + [back to example list](#how-to-use-examples) From 9a988ae2e2186272cea90b8d3f89a137a97b8b66 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 11:15:18 +0900 Subject: [PATCH 13/48] =?UTF-8?q?=E5=90=84=E7=A8=AE=E5=8B=95=E4=BD=9C?= =?UTF-8?q?=E3=81=AE=E8=A9=B3=E7=B4=B0=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples.md | 181 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 168 insertions(+), 13 deletions(-) diff --git a/Examples.md b/Examples.md index 838f0a0..9fff7e5 100644 --- a/Examples.md +++ b/Examples.md @@ -1,5 +1,15 @@ # Examples +Raspberry Pi Mouseを動作させるサンプル集です。 + +- [Examples](#examples) + - [joystick/_control](#joystick_control) + - [object/_tracking](#object_tracking) + - [line](#line_follower) + - [camera/_line/_follower](#camera_line_follower) + - [direction/_controller](#direction_controller) + - [slam](#slam) + ## joystick_control ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 @@ -8,13 +18,15 @@ joystick_control +### Usages + 次のコマンドでノードを起動します。 ```sh -# Use F710 +# Controlled directly on Raspberry Pi Mouse +## Use F710 $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true - -# Use DUALSHOCK 3 +## Use DUALSHOCK 3 $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true # Control from remote computer @@ -24,12 +36,27 @@ $ ros2 run raspimouse raspimouse $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false ``` +### Configure + デフォルトのキー割り当てはこちらです。 Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを __D__ (DirectInput Mode)に設定します。 +[./config/joy_f710.yml](./config/joy_f710.yml)、[./config/joy_dualshock3.yml](./config/joy_dualshock3.yml) +のキー番号を編集することで、キー割り当てを変更できます。 + +```yaml +button_shutdown_1 : 8 +button_shutdown_2 : 9 + +button_motor_off : 8 +button_motor_on : 9 + +button_cmd_enable : 4 +``` + [back to example list](#how-to-use-examples) --- @@ -41,6 +68,20 @@ USB接続のWebカメラとOpenCVを使ってボール追跡をします。 +### Requirements + +- Webカメラ + - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) +- カメラマウント + - [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584) +- ボール(Optional) + - [ソフトボール(オレンジ)](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1307&products_id=3701) +- Software + - OpenCV + - v4l-utils + +### Usages + 次のスクリプトを実行して、カメラの自動調節機能(自動露光,オートホワイトバランス等)を切ります。 ```sh @@ -54,7 +95,6 @@ $ ./configure_camera.bash $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/dev/video0 ``` - カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 これらの画像は[RViz](https://index.ros.org/r/rviz/)や[rqt_image_view](https://index.ros.org/p/rqt_image_view/)で表示できます。 @@ -62,6 +102,22 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/ +### Configure + +追跡対象の色を変更するには +[`./src/object_tracking_component.cpp`](./src/object_tracking_component.cpp) +を編集します。 + +物体検出精度が悪い時にはカメラの露光や関数内のパラメータを調整して下さい。 + +```cpp +void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) +{ + cv::inRange(hsv, cv::Scalar(9, 100, 100), cv::Scalar(29, 255, 255), extracted_bin); // Orange + // cv::inRange(hsv, cv::Scalar(60, 100, 100), cv::Scalar(80, 255, 255), extracted_bin); // Green + // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue +``` + [back to example list](#how-to-use-examples) --- @@ -72,6 +128,14 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/ +### Requirements + +- ライントレースセンサ + - [Raspberry Pi Mouse オプションキット No.3 \[ライントレース\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3591) +- フィールドとライン (Optional) + +### Usages + 次のコマンドでノードを起動します。 ```sh @@ -96,6 +160,18 @@ Raspberry Pi Mouseをフィールドに置き、SW2を押してフィールド joystick_control +### Configure + +走行速度を変更するには[`./src/line_follower_component.cpp`](./src/line_follower_component.cpp)を編集します。 + +```cpp +void Follower::publish_cmdvel_for_line_following(void) +{ + const double VEL_LINEAR_X = 0.08; // m/s + const double VEL_ANGULAR_Z = 0.8; // rad/s + const double LOW_VEL_ANGULAR_Z = 0.5; // rad/s +``` + [back to example list](#how-to-use-examples) --- @@ -106,13 +182,14 @@ RGBカメラによるライントレースのコード例です。 -```bash -# Terminal 1 -ros2 run ... +### Requirements -# Terminal 2 -ros2 launch ... -``` +- Webカメラ + - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) +- カメラマウント + - [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584) + +### Usages 次のコマンドでノードを起動します。 @@ -127,6 +204,42 @@ $ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_devi これらの画像は[RViz](https://index.ros.org/r/rviz/)や[rqt_image_view](https://index.ros.org/p/rqt_image_view/) で表示できます。 +> [!NOTE] +> 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 + +### Configure + +ラインの検出精度が悪い場合はカメラの露光やホワイトバランスの調整を行ってください。 + + + +### Parameters + +- `max_brightness` + - Type: `int` + - Default: 90 + - 画像の2値化のしきい値の最大値 +- `min_brightness` + - Type: `int` + - Default: 0 + - 画像の2値化のしきい値の最小値 +- `max_linear_vel` + - Type: `double` + - Default: 0.05 + - 直進速度の最大値 +- `max_angular_vel` + - Type: `double` + - Default: 0.8 + - 旋回速度の最大値 +- `area_threshold` + - Type: `double` + - Default: 0.20 + - 走行を開始するためのライン面積のしきい値 + +```sh +ros2 param set /camera_follower max_brightness 80 +``` + [back to example list](#how-to-use-examples) --- @@ -137,6 +250,18 @@ IMUセンサを使用した角度制御のコード例です。 +### Requirements + +- [USB出力9軸IMUセンサモジュール](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1348_1&products_id=3416&language=ja) +- LiDAR Mount ([Raspberry Pi Mouse オプションキットNo.8 [マルチLiDARマウント]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3867)) +- RT-USB-9axisIMU ROS Package + - https://github.com/rt-net/rt_usb_9axisimu_driver + +IMUセンサモジュールを取り付けたLiDAR MountをRaspberry Pi Mouseに取り付けます。 + + + +### Usages 次のコマンドでノードを起動します。 @@ -152,17 +277,47 @@ SW0 ~ SW2を押して動作モードを切り替えます。 - SW2: 方位角を`-π ~ π rad`に変化させる角度制御を開始します - SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します +> [!NOTE] +> IMUの接続が正常に行われない場合があります。 +> その際は、IMUのUSBケーブルを抜き差しした後、コマンドを再度実行してください。 + +### Parameters + +- `p_gain` + - Type: `double` + - Default: 10.0, min:0.0, max:30.0 + - 角度制御用PIDコントローラの比例ゲイン +- `i_gain` + - Type: `double` + - Default: 0.0, min:0.0, max:5.0 + - 角度制御用PIDコントローラの積分ゲイン +- `d_gain` + - Type: `double` + - Default: 20.0, min:0.0, max:30.0 + - 角度制御用PIDコントローラの微分ゲイン +- `target_angle` + - Type: `double` + - default: 0.0, min:-π, max:+π + - SW1(角度制御モード)の目標角度 + +### Published +- `heading_angle` + - Type: `std_msgs/Float64` + - IMUモジュールのセンサ値をもとに計算されたロボットの向き(進行方向の角度) + [back to example list](#how-to-use-examples) --- -## SLAM +## SLAM/Navigation -> [!NOTE] -> Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 +SLAMとNavigationを行います。 +> [!NOTE] +> Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 + [back to example list](#how-to-use-examples) --- From a1bd89b09473c0d3c2b1079c59a6637d279fa1ad Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 11:26:27 +0900 Subject: [PATCH 14/48] =?UTF-8?q?=E7=B5=84=E3=81=BF=E7=AB=8B=E3=81=A6?= =?UTF-8?q?=E3=83=9E=E3=83=8B=E3=83=A5=E3=82=A2=E3=83=AB=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E8=A8=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Examples.md b/Examples.md index 9fff7e5..f9b2814 100644 --- a/Examples.md +++ b/Examples.md @@ -236,6 +236,8 @@ $ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_devi - Default: 0.20 - 走行を開始するためのライン面積のしきい値 +各種パラメータを設定する際は、以下のコマンドを実行します。 + ```sh ros2 param set /camera_follower max_brightness 80 ``` @@ -257,7 +259,7 @@ IMUセンサを使用した角度制御のコード例です。 - RT-USB-9axisIMU ROS Package - https://github.com/rt-net/rt_usb_9axisimu_driver -IMUセンサモジュールを取り付けたLiDAR MountをRaspberry Pi Mouseに取り付けます。 +IMUセンサモジュールを取り付けたLiDAR MountをRaspberry Pi Mouseに取り付けます。詳細は、[マルチLiDARマウント組み立てマニュアル](https://rt-net.jp/wp-content/uploads/2020/04/RaspberryPiMouseOptionKitManual_No08.pdf)を参照してください。 From 46406777fe273be29830c669314a6fb367f6335b Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 11:36:20 +0900 Subject: [PATCH 15/48] =?UTF-8?q?=E5=90=84=E7=A8=AE=E3=82=B5=E3=83=B3?= =?UTF-8?q?=E3=83=97=E3=83=AB=E5=90=8D=E3=82=92=E4=BB=96=E3=81=AE=E3=83=AA?= =?UTF-8?q?=E3=83=9D=E3=82=B8=E3=83=88=E3=83=AA=E3=81=A8=E7=B5=B1=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Examples.md b/Examples.md index f9b2814..9e7a2d1 100644 --- a/Examples.md +++ b/Examples.md @@ -3,14 +3,14 @@ Raspberry Pi Mouseを動作させるサンプル集です。 - [Examples](#examples) - - [joystick/_control](#joystick_control) - - [object/_tracking](#object_tracking) - - [line](#line_follower) - - [camera/_line/_follower](#camera_line_follower) - - [direction/_controller](#direction_controller) - - [slam](#slam) + - [Joystick Control](#joystick-control) + - [Object Tracking](#object-tracking) + - [Line Follower](#line-follower) + - [Camera Line Follower](#camera-line-follower) + - [Direction Controller](#direction-controller) + - [SLAM & Navigation](#slam--navigation) -## joystick_control +## Joystick Control ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 @@ -61,7 +61,7 @@ button_cmd_enable : 4 --- -## object_tracking +## Object Tracking 色情報をもとにオレンジ色のボールの追跡を行うコード例です。 USB接続のWebカメラとOpenCVを使ってボール追跡をします。 @@ -122,7 +122,7 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) --- -## line_follower +## Line Follower ライントレースのコード例です。 @@ -176,7 +176,7 @@ void Follower::publish_cmdvel_for_line_following(void) --- -## camera_line_follower +## Camera Line Follower RGBカメラによるライントレースのコード例です。 @@ -246,7 +246,7 @@ ros2 param set /camera_follower max_brightness 80 --- -## direction_controller +## Direction Controller IMUセンサを使用した角度制御のコード例です。 @@ -311,7 +311,7 @@ SW0 ~ SW2を押して動作モードを切り替えます。 --- -## SLAM/Navigation +## SLAM & Navigation SLAMとNavigationを行います。 From 553fd1e95bee1fcf843f2947a714e1cccf9b7253 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 11:40:54 +0900 Subject: [PATCH 16/48] =?UTF-8?q?ROS=201=E3=81=B8=E3=81=AE=E3=83=AA?= =?UTF-8?q?=E3=83=B3=E3=82=AF=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index b47f5c3..cebf4d4 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,7 @@ Raspberry Pi MouseのROS 2サンプルコード集です。 -ROS1のサンプルコード集は[こちら](https://github.com/rt-net/raspimouse_ros_examples/blob/master/README.md)。 - -Gazebo(シミュレータ)でも動作します。詳細は[こちら](https://github.com/rt-net/raspimouse_sim/blob/ros2/README.md)。 +Gazebo(シミュレータ)で動作させる場合は、[rt-net/raspimouse_sim](https://github.com/rt-net/raspimouse_sim/blob/ros2/README.md)パッケージを参照してください。 From 2746c6fa293127cdd45d4525daefad015981ff7f Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 11:43:41 +0900 Subject: [PATCH 17/48] =?UTF-8?q?=E7=94=BB=E5=83=8F=E9=96=93=E3=81=AE?= =?UTF-8?q?=E3=82=B9=E3=83=9A=E3=83=BC=E3=82=B9=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples.md b/Examples.md index 9e7a2d1..57edeaa 100644 --- a/Examples.md +++ b/Examples.md @@ -261,7 +261,7 @@ IMUセンサを使用した角度制御のコード例です。 IMUセンサモジュールを取り付けたLiDAR MountをRaspberry Pi Mouseに取り付けます。詳細は、[マルチLiDARマウント組み立てマニュアル](https://rt-net.jp/wp-content/uploads/2020/04/RaspberryPiMouseOptionKitManual_No08.pdf)を参照してください。 - + ### Usages From 080ae75e85fc23a106ed1dcf01b69eee9a124749 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 11:56:35 +0900 Subject: [PATCH 18/48] =?UTF-8?q?=E3=83=AA=E3=83=9D=E3=82=B8=E3=83=88?= =?UTF-8?q?=E3=83=AA=E3=83=88=E3=83=83=E3=83=97README=E3=81=AE=E3=82=B5?= =?UTF-8?q?=E3=83=B3=E3=83=97=E3=83=AB=E5=90=8D=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cebf4d4..6f816ce 100644 --- a/README.md +++ b/README.md @@ -96,12 +96,12 @@ $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false サンプルプログラムの詳細な動作方法は、[Examples](./Examples.md)で説明しています。 - Examples - - joystick_control - - object_tracking - - line_follower - - camera_line_follower - - direction_controller - - SLAM/Navigation ([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) + - Joystick Control + - Object Tracking + - Line Follower + - Camera Line Follower + - Direction Controller + - SLAM & Navigation ([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) ## License From 1bc4cbf8a5102ce114dc59ddf03fec1f4d76eb47 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 12:01:41 +0900 Subject: [PATCH 19/48] =?UTF-8?q?=E3=83=AA=E3=83=9D=E3=82=B8=E3=83=88?= =?UTF-8?q?=E3=83=AA=E3=83=88=E3=83=83=E3=83=97=E3=81=AE=E8=8B=B1=E8=AA=9E?= =?UTF-8?q?=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1=E3=83=B3=E3=83=88=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 README.en.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..cb9e835 --- /dev/null +++ b/README.en.md @@ -0,0 +1,119 @@ +[English](README.en.md) | [日本語](README.md) + +# raspimouse_ros2_examples + +[![industrial_ci](https://github.com/rt-net/raspimouse_ros2_examples/workflows/industrial_ci/badge.svg?branch=master)](https://github.com/rt-net/raspimouse_ros2_examples/actions?query=workflow%3Aindustrial_ci+branch%3Amaster) + +ROS 2 examples for Raspberry Pi Mouse. + +For running in Gazebo (simulator), see the [rt-net/raspimouse_sim](https://github.com/rt-net/raspimouse_sim/blob/ros2/README.md) packages. + + + +## Table of Contents + +- [raspimouse_ros2_examples](#raspimouse_ros2_examples) + - [Table of Contents](#table-of-contents) + - [Supported ROS distributions](#supported-ros-distributions) + - [Requirements](#requirements) + - [Installation](#installation) + - [Binary Installation](#binary-installation) + - [Source Build](#source-build) + - [QuickStart](#quickstart) + - [How To Use Examples](#how-to-use-examples) + - [License](#license) + - [Contributing](#contributing) + +## Supported ROS distributions + +### ROS 2 + +- [Humble Hawksbill](https://github.com/rt-net/raspimouse_ros2_examples/tree/humble) +- [Jazzy Jalisco](https://github.com/rt-net/raspimouse_ros2_examples/tree/jazzy) + +## Requirements + +- Raspberry Pi Mouse + - https://rt-net.jp/products/raspberrypimousev3/ + - Linux OS + - Ubuntu server 24.04 + - Device Driver + - [rt-net/RaspberryPiMouse](https://github.com/rt-net/RaspberryPiMouse) + - ROS 2 + - [Jazzy Jalisco](https://docs.ros.org/en/jazzy/index.html) + - Raspberry Pi Mouse ROS 2 package + - https://github.com/rt-net/raspimouse2 +- Remote Computer (Optional) + - ROS 2 + - [Jazzy Jalisco](https://docs.ros.org/en/jazzy/index.html) + - Raspberry Pi Mouse ROS 2 package + - https://github.com/rt-net/raspimouse2 + + +## Installation + +### Binary Installation + +```sh +sudo apt install raspimouse-ros2-examples +``` + +### Source Build + +```sh +# Create workspace directory +mkdir -p ~/ros2_ws/src && cd ~/ros2_ws/src + +# Clone package +git clone -b $ROS_DISTRO https://github.com/rt-net/raspimouse_ros2_examples.git + +# Install dependencies +rosdep install -r -y -i --from-paths . + +# Build & Install +cd ~/ros2_ws +colcon build --symlink-install +source ~/ros2_ws/install/setup.bash +``` + +## QuickStart + +Control the Raspberry Pi Mouse remotely with a joystick controller. + +- Supported Controllers + - [Logicool Wireless Gamepad F710](https://gaming.logicool.co.jp/ja-jp/products/gamepads/f710-wireless-gamepad.html#940-0001440) + - [SONY DUALSHOCK 3](https://www.jp.playstation.com/ps3/peripheral/cechzc2j.html) + +```sh +# on RaspberryPiMouse +$ ros2 run raspimouse raspimouse +# on remote computer +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false +``` + +## How to Use Examples + +The detailed operation of the sample program is explained in[Examples](./Examples.md). + +- Examples + - Joystick Control + - Object Tracking + - Line Follower + - Camera Line Follower + - Direction Controller + - SLAM & Navigation (relocated [rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)) + +## License + +(C) 2022 RT Corporation \ + +Each file is licensed as stated in their headers. +If no license is specified, the file is licensed under the MIT License. +The full license text is available in the [LICENSE](./LICENSE) file or at [https://opensource.org/license/MIT](https://opensource.org/license/MIT). + +## Contributing + +- This software is open source, but its development is not open. +- This software is essentially provided as open source software on an “AS IS” (in its current state) basis. +- No free support is available for this software. +- Requests for bug fixes and corrections of typographical errors are always accepted; however, requests for additional features will be subject to our internal guidelines. For further details, please refer to the [Contribution Guidelines](https://github.com/rt-net/.github/blob/master/CONTRIBUTING.md). From 5dff993014729d824934009253352132e3b8af61 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 14:46:53 +0900 Subject: [PATCH 20/48] =?UTF-8?q?Example.en.md=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples.en.md | 326 +++++++++++++++++++++++++++++++++++++++++++++++++ Examples.md | 6 +- 2 files changed, 329 insertions(+), 3 deletions(-) create mode 100644 Examples.en.md diff --git a/Examples.en.md b/Examples.en.md new file mode 100644 index 0000000..ab88fc5 --- /dev/null +++ b/Examples.en.md @@ -0,0 +1,326 @@ +# Examples + +Sample programs for the Raspberry Pi Mouse. + +- [Examples](#examples) + - [Joystick Control](#joystick-control) + - [Object Tracking](#object-tracking) + - [Line Follower](#line-follower) + - [Camera Line Follower](#camera-line-follower) + - [Direction Controller](#direction-controller) + - [SLAM & Navigation](#slam--navigation) + +## Joystick Control + +This is an example with a joystick controller to operate a Raspberry Pi Mouse. + + + joystick_control + + +### Usages + +launch the nodes with the following command: + +```sh +# Controlled directly on Raspberry Pi Mouse +## Use F710 +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true +## Use DUALSHOCK 3 +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true + +# Control from remote computer +## on RaspberryPiMouse +$ ros2 run raspimouse raspimouse +## on remote computer +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false +``` + +### Configure + +This picture shows the default key configuration. + +To use Logicool Wireless Gamepad F710, set the input mode to __D__ (DirectInput Mode). + + + +Key assignments can be edited with key numbers in [./config/joy_f710.yml](./config/joy_f710.yml) or [./config/joy_dualshock3.yml](./config/joy_dualshock3.yml). + +```yaml +button_shutdown_1 : 8 +button_shutdown_2 : 9 + +button_motor_off : 8 +button_motor_on : 9 + +button_cmd_enable : 4 +``` + +[back to example list](#how-to-use-examples) + +--- + +## Object Tracking + +This is a code example for tracking an orange ball based on color information. +The ball tracking is performed with a USB webcam and the OpenCV library. + + + +### Requirements + +- Web camera + - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) +- Camera mount + - [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) +- Orange ball(Optional) + - [Soft Ball (Orange)](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1307&products_id=3701&language=en) +- Software + - OpenCV + - v4l-utils + +### Usages + +Disable the automatic camera adjustment parameters (auto focus, auto white balance, etc.) with the following command: + +```sh +$ cd ~/ros2_ws/src/raspimouse_ros2_examples/config +$ ./configure_camera.bash +``` + +Then, launch the nodes with the following command: + +```sh +$ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/dev/video0 +``` + +This sample publishes two topics: `camera/color/image_raw` for the camera image and `result_image` for the object detection image. +These images can be viewed with [RViz](https://index.ros.org/r/rviz/) or [rqt_image_view](https://index.ros.org/p/rqt_image_view/). + +> [!NOTE] +> Viewing the images may cause the node to become unstable, resulting in cmd_vel or image topics not being published. + + + +### Configure + +Edit [`./src/object_tracking_component.cpp`](./src/object_tracking_component.cpp) to change the color of the tracking target. + +If the object detection accuracy is poor, adjust the camera exposure and the parameters in the function. + +```cpp +void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) +{ + cv::inRange(hsv, cv::Scalar(9, 100, 100), cv::Scalar(29, 255, 255), extracted_bin); // Orange + // cv::inRange(hsv, cv::Scalar(60, 100, 100), cv::Scalar(80, 255, 255), extracted_bin); // Green + // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue +``` + +[back to example list](#how-to-use-examples) + +--- + +## Line Follower + +This is an example for line following. + + + +### Requirements + +- Line following sensor + - [Raspberry Pi Mouse Option kit No.3 \[Line follower\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3591&language=en) +- Field and lines for following (Optional) + +### Usages + +Launch nodes with the following command: + +```sh +$ ros2 launch raspimouse_ros2_examples line_follower.launch.py +``` + +Next, place the Raspberry Pi Mouse on a field and press SW2 to sample sensor values on the field. + + + +Then, place the Raspberry Pi Mouse on the line and press SW1 to sample sensor values. + + + +Finally, place the Raspberry Pi Mouse on the line and press SW0 to start line following. + + + +Press SW0 again to stop the line following. + + + joystick_control + + +### Configure + +Edit [`./src/line_follower_component.cpp`](./src/line_follower_component.cpp) to change the robot velocity. + +```cpp +void Follower::publish_cmdvel_for_line_following(void) +{ + const double VEL_LINEAR_X = 0.08; // m/s + const double VEL_ANGULAR_Z = 0.8; // rad/s + const double LOW_VEL_ANGULAR_Z = 0.5; // rad/s +``` + +[back to example list](#how-to-use-examples) + +--- + +## Camera Line Follower + +This is an example for line following by RGB camera. + + + +### Requirements + +- Web camera + - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) +- Camera mount + - [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) + +### Usages + +launch nodes with the following command: + +```sh +$ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_device:=/dev/video0 +``` + +Place Raspberry Pi Mouse on the line and press SW2 to start line following. +Press SW0 to stop the line following. + +This sample publishes two topics: `camera/color/image_raw` for the camera image and `result_image` for the object detection image. +These images can be viewed in [RViz](https://index.ros.org/r/rviz/)or [rqt_image_view](https://index.ros.org/p/rqt_image_view/). + +> [!NOTE] +> Viewing the images may cause the node to become unstable, resulting in cmd_vel or image topics not being published. + +### Configure + +If the line detection accuracy is poor, adjust the camera exposure and white balance. + + + +### Parameters + +- `max_brightness` + - Type: `int` + - Default: 90 + - Maximum threshold value for image binarization. +- `min_brightness` + - Type: `int` + - Default: 0 + - Minimum threshold value for image binarization. +- `max_linear_vel` + - Type: `double` + - Default: 0.05 + - Maximum linear velocity. +- `max_angular_vel` + - Type: `double` + - Default: 0.8 + - Maximum angular velocity. +- `area_threshold` + - Type: `double` + - Default: 0.20 + - Threshold value of the area of the line to start following. + +Run the following command to set the parameters: + +```sh +ros2 param set /camera_follower max_brightness 80 +``` + +[back to example list](#how-to-use-examples) + +--- + +## Direction Controller + +This is an example of using an IMU sensor for direction control. + + + +### Requirements + +- [USB output 9 degrees IMU sensor module](https://www.rt-shop.jp/index.php?main_page=product_info&products_id=3416&language=en) +- [LiDAR Mount](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3867) +- RT-USB-9axisIMU ROS Package. + - https://github.com/rt-net/rt_usb_9axisimu_driver + + +IMUセンサモジュールを取り付けたLiDAR MountをRaspberry Pi Mouseに取り付けます。詳細は、[マルチLiDARマウント組み立てマニュアル](https://rt-net.jp/wp-content/uploads/2020/04/RaspberryPiMouseOptionKitManual_No08.pdf)を参照してください。 + +Attach the LiDAR mount with the IMU sensor module to the Raspberry Pi Mouse. For details, refer to the [Multi-LiDAR Mount Assembly Manual (in Japanese)](https://rt-net.jp/wp-content/uploads/2020/04/RaspberryPiMouseOptionKitManual_No08.pdf). + + + +### Usages + +Launch nodes on the Raspberry Pi Mouse with the following command: + +```sh +$ ros2 launch raspimouse_ros2_examples direction_controller.launch.py +``` + +Then, press SW0 ~ SW2 to change the control mode as follows: + +- SW0: Calibrate the gyroscope bias and reset the Raspberry Pi Mouse's heading angle to 0 rad. +- SW1: Start direction control to keep the heading angle at 0 rad. + - Press SW0 ~ SW2 or tilt the body sideways to terminate the control. +- SW2: Start direction control to change the heading angle between -π and π rad. + - Press SW0 ~ SW2 or tilt the body sideways to terminate the control. + +> [!NOTE] +> The IMU might not be connected correctly. +> If this happens, unplug and reconnect the USB cable, then run the above command again. + +### Parameters + +- `p_gain` + - Type: `double` + - Default: 10.0, min:0.0, max:30.0 + - Proportional gain of a PID controller for the direction control +- `i_gain` + - Type: `double` + - Default: 0.0, min:0.0, max:5.0 + - Integral gain of a PID controller for the direction control +- `d_gain` + - Type: `double` + - Default: 20.0, min:0.0, max:30.0 + - Derivative gain of a PID controller for the direction control +- `target_angle` + - Type: `double` + - default: 0.0, min:-π, max:+π + - Target angle for the SW1 (direction control mode). + +### Published + +- `heading_angle` + - Type: `std_msgs/Float64` + - Heading angle of the robot calculated from IMU module sensor values + +[back to example list](#how-to-use-examples) + +--- + +## SLAM & Navigation + +This is an example of SLAM & Navigation. + + + +> [!NOTE] +> The sample for SLAM and Navigation with Raspberry Pi Mouse has been moved to [rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2). + +[back to example list](#how-to-use-examples) + +--- diff --git a/Examples.md b/Examples.md index 57edeaa..321c271 100644 --- a/Examples.md +++ b/Examples.md @@ -44,8 +44,7 @@ Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを _ -[./config/joy_f710.yml](./config/joy_f710.yml)、[./config/joy_dualshock3.yml](./config/joy_dualshock3.yml) -のキー番号を編集することで、キー割り当てを変更できます。 +[./config/joy_f710.yml](./config/joy_f710.yml)、[./config/joy_dualshock3.yml](./config/joy_dualshock3.yml)のキー番号を編集することで、キー割り当てを変更できます。 ```yaml button_shutdown_1 : 8 @@ -98,7 +97,8 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/ カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 これらの画像は[RViz](https://index.ros.org/r/rviz/)や[rqt_image_view](https://index.ros.org/p/rqt_image_view/)で表示できます。 -**画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。** +> [!NOTE] +> 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 From 7310ce44298b31926f34186f088063d868907d70 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 14:48:07 +0900 Subject: [PATCH 21/48] =?UTF-8?q?=E5=8F=A4=E3=81=84=E3=83=89=E3=82=AD?= =?UTF-8?q?=E3=83=A5=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- old_README.en.md | 1 + old_README.md | 424 ----------------------------------------------- 2 files changed, 1 insertion(+), 424 deletions(-) delete mode 100644 old_README.md diff --git a/old_README.en.md b/old_README.en.md index fa2a296..fa2d904 100644 --- a/old_README.en.md +++ b/old_README.en.md @@ -164,6 +164,7 @@ This sample publishes two topics: `camera/color/image_raw` for the camera image These images can be viewed with [RViz](https://index.ros.org/r/rviz/) or [rqt_image_view](https://index.ros.org/p/rqt_image_view/). +> {!} **Viewing an image may cause the node to behave unstable and not publish cmd_vel or image topics.** diff --git a/old_README.md b/old_README.md deleted file mode 100644 index 7a1924f..0000000 --- a/old_README.md +++ /dev/null @@ -1,424 +0,0 @@ -[English](README.en.md) | [日本語](README.md) - -# raspimouse_ros2_examples - -[![industrial_ci](https://github.com/rt-net/raspimouse_ros2_examples/workflows/industrial_ci/badge.svg?branch=master)](https://github.com/rt-net/raspimouse_ros2_examples/actions?query=workflow%3Aindustrial_ci+branch%3Amaster) - -Raspberry Pi MouseのROS 2サンプルコード集です。 - -ROS1のサンプルコード集は[こちら](https://github.com/rt-net/raspimouse_ros_examples/blob/master/README.md)。 - -Gazebo(シミュレータ)でも動作します。詳細は[こちら](https://github.com/rt-net/raspimouse_sim/blob/ros2/README.md)。 - - - -## Supported ROS 2 distributions - -- [Humble](https://github.com/rt-net/raspimouse_ros2_examples/tree/humble) -- [Jazzy](https://github.com/rt-net/raspimouse_ros2_examples/tree/jazzy) (This branch) - -## Requirements - -- Raspberry Pi Mouse - - https://rt-net.jp/products/raspberrypimousev3/ - - Linux OS - - Ubuntu server 24.04 - - Device Driver - - [rt-net/RaspberryPiMouse](https://github.com/rt-net/RaspberryPiMouse) - - ROS - - [Jazzy Jalisco](https://docs.ros.org/en/jazzy/index.html) - - Raspberry Pi Mouse ROS 2 package - - https://github.com/rt-net/raspimouse2 -- Remote Computer (Optional) - - ROS - - [Jazzy Jalisco](https://docs.ros.org/en/jazzy/index.html) - - Raspberry Pi Mouse ROS 2 package - - https://github.com/rt-net/raspimouse2 - -## Installation - -```sh -$ cd ~/ros2_ws/src -# Clone package -$ git clone -b $ROS_DISTRO https://github.com/rt-net/raspimouse_ros2_examples.git - -# Install dependencies -$ rosdep install -r -y --from-paths . --ignore-src - -# Build & Install -$ cd ~/ros2_ws -$ colcon build --symlink-install -$ source ~/ros2_ws/install/setup.bash -``` - -## License - -このリポジトリはApache 2.0ライセンスの元、公開されています。 -ライセンスについては[LICENSE](./LICENSE)を参照ください。 - -## How To Use Examples - -- [joystick_control](#joystick_control) -- [object_tracking](#object_tracking) -- [line_follower](#line_follower) -- [camera_line_follower](#camera_line_follower) -- [SLAM](#slam) -- [direction_controller](#direction_controller) - ---- - -### joystick_control - -ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 - -#### Requirements - -- Joystick Controller - - [Logicool Wireless Gamepad F710](https://gaming.logicool.co.jp/ja-jp/products/gamepads/f710-wireless-gamepad.html#940-0001440) - - [SONY DUALSHOCK 3](https://www.jp.playstation.com/ps3/peripheral/cechzc2j.html) - -#### How to use - -次のコマンドでノードを起動します。 - -```sh -# Use F710 -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true - -# Use DUALSHOCK 3 -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true - -# Control from remote computer -## on RaspberryPiMouse -$ ros2 run raspimouse raspimouse -## on remote computer -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false -``` - -デフォルトのキー割り当てはこちらです。 - -Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを __D__ (DirectInput Mode)に設定します。 - -![](https://rt-net.github.io/images/raspberry-pi-mouse/joystick_control_keyconfig.png) - -#### Configure - -[./config/joy_f710.yml](./config/joy_f710.yml)、[./config/joy_dualshock3.yml](./config/joy_dualshock3.yml) -のキー番号を編集することで、キー割り当てを変更できます。 - -```yaml -button_shutdown_1 : 8 -button_shutdown_2 : 9 - -button_motor_off : 8 -button_motor_on : 9 - -button_cmd_enable : 4 -``` - -#### Videos - -[![joystick_control](http://img.youtube.com/vi/GswxdB8Ia0Y/sddefault.jpg)](https://youtu.be/GswxdB8Ia0Y) - -[back to example list](#how-to-use-examples) - ---- - -### object_tracking - - - -色情報をもとにオレンジ色のボールの追跡を行うコード例です。 -USB接続のWebカメラとOpenCVを使ってボール追跡をします。 - -#### Requirements - -- Webカメラ - - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) -- カメラマウント - - [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584) -- ボール(Optional) - - [ソフトボール(オレンジ)](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1307&products_id=3701) -- Software - - OpenCV - - v4l-utils - -#### Installation - -Raspberry Pi Mouseにカメラマウントを取り付け、WebカメラをRaspberry Piに接続します。 - -#### How to use - -次のスクリプトを実行して、カメラの自動調節機能(自動露光,オートホワイトバランス等)を切ります。 - -```sh -$ cd ~/ros2_ws/src/raspimouse_ros2_examples/config -$ ./configure_camera.bash -``` - -次のコマンドでノードを起動します。 - -```sh -$ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/dev/video0 -``` - -カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 -これらの画像は[RViz](https://index.ros.org/r/rviz/) -や[rqt_image_view](https://index.ros.org/p/rqt_image_view/) -で表示できます。 - -**画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。** - - - -#### Configure - -追跡対象の色を変更するには -[`./src/object_tracking_component.cpp`](./src/object_tracking_component.cpp) -を編集します。 - -物体検出精度が悪い時にはカメラの露光や関数内のパラメータを調整して下さい。 - -```cpp -void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) -{ - cv::inRange(hsv, cv::Scalar(9, 100, 100), cv::Scalar(29, 255, 255), extracted_bin); // Orange - // cv::inRange(hsv, cv::Scalar(60, 100, 100), cv::Scalar(80, 255, 255), extracted_bin); // Green - // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue -``` - -#### Videos - -[![object_tracking](http://img.youtube.com/vi/8lgmSTScP98/sddefault.jpg)](https://youtu.be/8lgmSTScP98) - -[back to example list](#how-to-use-examples) - ---- - -### line_follower - - - -ライントレースのコード例です。 - -#### Requirements - -- ライントレースセンサ - - [Raspberry Pi Mouse オプションキット No.3 \[ライントレース\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3591) -- フィールドとライン (Optional) - -#### Installation - -Raspberry Pi Mouseにライントレースセンサを取り付けます。 - -#### How to use - -次のコマンドでノードを起動します。 - -```sh -$ ros2 launch raspimouse_ros2_examples line_follower.launch.py -``` - -Raspberry Pi Mouseをフィールドに置き、SW2を押してフィールド上のセンサ値をサンプリングします。 - - - -次に、センサとラインが重なるようにRaspberry Pi Mouseを置き、SW1を押してライン上のセンサ値をサンプリングします。 - - - -最後に、ライン上にRaspberry Pi Mouseを置き、SW0を押してライントレースを開始します。 - - - -もう一度SW0を押すとライントレースを停止します。 - -#### Configure - -走行速度を変更するには[`./src/line_follower_component.cpp`](./src/line_follower_component.cpp)を編集します。 - -```cpp -void Follower::publish_cmdvel_for_line_following(void) -{ - const double VEL_LINEAR_X = 0.08; // m/s - const double VEL_ANGULAR_Z = 0.8; // rad/s - const double LOW_VEL_ANGULAR_Z = 0.5; // rad/s -``` - -#### Videos - -[![line_follower](http://img.youtube.com/vi/oPm0sW2V_tY/sddefault.jpg)](https://youtu.be/oPm0sW2V_tY) - -[back to example list](#how-to-use-examples) - ---- - -### camera_line_follower - - - -RGBカメラによるライントレースのコード例です。 - -#### Requirements - -- Webカメラ - - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) -- カメラマウント - - [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584) - -#### Installation - -Raspberry Pi Mouseにカメラマウントを取り付け、WebカメラをRaspberry Piに接続します。 - -#### How to use - -次のコマンドでノードを起動します。 - -```sh -$ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_device:=/dev/video0 -``` - -ライン上にRaspberry Pi Mouseを置き、SW2を押してライントレースを開始します。 -停止させる場合はSW0を押します。 - -カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 -これらの画像は[RViz](https://index.ros.org/r/rviz/) -や[rqt_image_view](https://index.ros.org/p/rqt_image_view/) -で表示できます。 - -**画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。** - -**ラインの検出精度が悪い場合はカメラの露光やホワイトバランスの調整を行ってください。** - - - -#### Parameters - -- `max_brightness` - - Type: `int` - - Default: 90 - - 画像の2値化のしきい値の最大値 -- `min_brightness` - - Type: `int` - - Default: 0 - - 画像の2値化のしきい値の最小値 -- `max_linear_vel` - - Type: `double` - - Default: 0.05 - - 直進速度の最大値 -- `max_angular_vel` - - Type: `double` - - Default: 0.8 - - 旋回速度の最大値 -- `area_threshold` - - Type: `double` - - Default: 0.20 - - 走行を開始するためのライン面積のしきい値 - -```sh -ros2 param set /camera_follower max_brightness 80 -``` - -[back to example list](#how-to-use-examples) - ---- - -### SLAM - - - -Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 - -[back to example list](#how-to-use-examples) - ---- - -### direction_controller - - - -IMUセンサを使用した角度制御のコード例です。 - -#### Requirements - -- [USB出力9軸IMUセンサモジュール](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1348_1&products_id=3416&language=ja) -- LiDAR Mount ([Raspberry Pi Mouse オプションキットNo.8 [マルチLiDARマウント]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3867)) -- RT-USB-9axisIMU ROS Package - - https://github.com/rt-net/rt_usb_9axisimu_driver - -#### Installation - -LiDAR MountにIMUセンサモジュールを取り付けます。 - - - -Raspberry Pi Mouse にLiDAR Mountを取り付けます。 - - - -#### How to use - -次のコマンドでノードを起動します。 - -```sh -$ ros2 launch raspimouse_ros2_examples direction_controller.launch.py -``` - -SW0 ~ SW2を押して動作モードを切り替えます。 - -- SW0: ジャイロセンサのバイアスをキャリブレーションし、ラズパイマウスの方位角を`0 rad`にリセットします -- SW1: 方位角を`0 rad`に維持する角度制御を開始します - - SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します -- SW2: 方位角を`-π ~ π rad`に変化させる角度制御を開始します - - SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します - -### Troubleshooting - -IMUの接続が正常に行われない場合があります。 -その時は、IMUのUSBケーブルを抜き差ししてください。 -抜き差し実施後は、コマンドを再度実行してください。 - -#### Configure - -パラメータで角度制御に使うPIDゲインを変更できます。 - -```sh -$ ros2 param set /direction_controller p_gain 10.0 -Set parameter successful - -$ ros2 param set /direction_controller i_gain 0.5 -Set parameter successful - -$ ros2 param set /direction_controller d_gain 0.0 -Set parameter successful -``` - -#### Parameters - -- p_gain - - Proportional gain of a PID controller for the direction control - - default: 10.0, min:0.0, max:30.0 - - type: double -- i_gain - - Integral gain of a PID controller for the direction control - - default: 0.0, min:0.0, max:5.0 - - type: double -- d_gain - - Derivative gain of a PID controller for the direction control - - default: 20.0, min:0.0, max:30.0 - - type: double -- target_angle - - Target angle for the SW1 control mode. - - default: 0.0, min:-π, max:+π - - type: double - -#### Publish topics -- heading_angle - - Heading angle of the robot that calculated from the IMU module sensor values. - - type: std_msgs/Float64 - -#### Videos - -[![](http://img.youtube.com/vi/ghcCYOh9_MM/sddefault.jpg)](https://youtu.be/ghcCYOh9_MM) - -[back to example list](#how-to-use-examples) From 6f9f005a58a1150af83d9b53fa33df1c080d1938 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 14:49:53 +0900 Subject: [PATCH 22/48] =?UTF-8?q?=E8=8B=B1=E8=AA=9E=E7=89=88=E3=81=AE?= =?UTF-8?q?=E5=8F=A4=E3=81=84=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- old_README.en.md | 421 ----------------------------------------------- 1 file changed, 421 deletions(-) delete mode 100644 old_README.en.md diff --git a/old_README.en.md b/old_README.en.md deleted file mode 100644 index fa2d904..0000000 --- a/old_README.en.md +++ /dev/null @@ -1,421 +0,0 @@ -[English](README.en.md) | [日本語](README.md) - -# raspimouse_ros2_examples - -[![industrial_ci](https://github.com/rt-net/raspimouse_ros2_examples/workflows/industrial_ci/badge.svg?branch=master)](https://github.com/rt-net/raspimouse_ros2_examples/actions?query=workflow%3Aindustrial_ci+branch%3Amaster) - -ROS 2 examples for Raspberry Pi Mouse. - -ROS1 examples is [here](https://github.com/rt-net/raspimouse_ros_examples/blob/master/README.en.md). - -To run on Gazebo, click [here](https://github.com/rt-net/raspimouse_sim/blob/ros2/README.en.md). - - - -## Supported ROS 2 distributions - -- [Humble](https://github.com/rt-net/raspimouse_ros2_examples/tree/humble) -- [Jazzy](https://github.com/rt-net/raspimouse_ros2_examples/tree/jazzy) (This branch) - -## Requirements - -- Raspberry Pi Mouse - - https://rt-net.jp/products/raspberrypimousev3/ - - Linux OS - - Ubuntu server 24.04 - - Device Driver - - [rt-net/RaspberryPiMouse](https://github.com/rt-net/RaspberryPiMouse) - - ROS - - [Jazzy Jalisco](https://docs.ros.org/en/jazzy/index.html) - - Raspberry Pi Mouse ROS 2 package - - https://github.com/rt-net/raspimouse2 -- Remote Computer (Optional) - - ROS - - [Jazzy Jalisco](https://docs.ros.org/en/jazzy/index.html) - - Raspberry Pi Mouse ROS 2 package - - https://github.com/rt-net/raspimouse2 - -## Installation - -```sh -$ cd ~/ros2_ws/src -# Clone package -$ git clone -b $ROS_DISTRO https://github.com/rt-net/raspimouse_ros2_examples.git - -# Install dependencies -$ rosdep install -r -y --from-paths . --ignore-src - -# Build & Install -$ cd ~/ros2_ws -$ colcon build --symlink-install -$ source ~/ros2_ws/install/setup.bash -``` - -## License - -This repository is licensed under the Apache 2.0, see [LICENSE](./LICENSE) for details. - -## How To Use Examples - -- [joystick_control](#joystick_control) -- [object_tracking](#object_tracking) -- [line_follower](#line_follower) -- [camera_line_follower](#camera_line_follower) -- [SLAM](#slam) -- [direction_controller](#direction_controller) - ---- - -### joystick_control - -This is an example to use joystick controller to control a Raspberry Pi Mouse. - -#### Requirements - -- Joystick Controller - - [Logicool Wireless Gamepad F710](https://gaming.logicool.co.jp/ja-jp/products/gamepads/f710-wireless-gamepad.html#940-0001440) - - [SONY DUALSHOCK 3](https://www.jp.playstation.com/ps3/peripheral/cechzc2j.html) - -#### How to use - -Launch nodes with the following command: - -```sh -# Use F710 -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true - -# Use DUALSHOCK 3 -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true - -# Control from remote computer -## on RaspberryPiMouse -$ ros2 run raspimouse raspimouse -## on remote computer -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false -``` - -This picture shows the default key configuration. - -To use Logicool Wireless Gamepad F710, set the input mode to __D__ (DirectInput Mode). - -![](https://rt-net.github.io/images/raspberry-pi-mouse/joystick_control_keyconfig.png) - -#### Configure - -Key assignments can be edited with key numbers in [./config/joy_f710.yml](./config/joy_f710.yml) or -[./config/joy_dualshock3.yml](./config/joy_dualshock3.yml). - -```yaml -button_shutdown_1 : 8 -button_shutdown_2 : 9 - -button_motor_off : 8 -button_motor_on : 9 - -button_cmd_enable : 4 -``` - -#### Videos - -[![joystick_control](http://img.youtube.com/vi/GswxdB8Ia0Y/sddefault.jpg)](https://youtu.be/GswxdB8Ia0Y) - -[back to example list](#how-to-use-examples) - ---- - -### object_tracking - - - -This is an example to use RGB camera images and OpenCV library for object tracking. - -#### Requirements - -- Web camera - - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) -- Camera mount - - [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) -- Orange ball(Optional) - - [Soft Ball (Orange)](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1307&products_id=3701&language=en) -- Software - - OpenCV - - v4l-utils - -#### Installation - -Install a camera mount and a web camera to Raspberry Pi Mouse, then connect the camera to the Raspberry Pi. - -#### How to use - -Turn off automatic adjustment parameters of a camera (auto focus, auto while balance, etc.) with the following command: - -```sh -$ cd ~/ros2_ws/src/raspimouse_ros2_examples/config -$ ./configure_camera.bash -``` - -Then, launch nodes with the following command: - -```sh -$ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/dev/video0 -``` - -This sample publishes two topics: `camera/color/image_raw` for the camera image and `result_image` for the object detection image. -These images can be viewed with [RViz](https://index.ros.org/r/rviz/) -or [rqt_image_view](https://index.ros.org/p/rqt_image_view/). - -> {!} -**Viewing an image may cause the node to behave unstable and not publish cmd_vel or image topics.** - - - -#### Configure - -Edit [`./src/object_tracking_component.cpp`](./src/object_tracking_component.cpp) -to change a color of tracking target. - -If the object detection accuracy is poor, adjust the camera exposure and parameters in the function - -```cpp -void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) -{ - cv::inRange(hsv, cv::Scalar(9, 100, 100), cv::Scalar(29, 255, 255), extracted_bin); // Orange - // cv::inRange(hsv, cv::Scalar(60, 100, 100), cv::Scalar(80, 255, 255), extracted_bin); // Green - // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue -``` - -#### Videos - -[![object_tracking](http://img.youtube.com/vi/8lgmSTScP98/sddefault.jpg)](https://youtu.be/8lgmSTScP98) - -[back to example list](#how-to-use-examples) - ---- - -### line_follower - - - -This is an example for line following. - -#### Requirements - -- Line following sensor - - [Raspberry Pi Mouse Option kit No.3 \[Line follower\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3591&language=en) -- Field and lines for following (Optional) - -#### Installation - -Install a line following sensor unit to Raspberry Pi Mouse. - -#### How to use - -Launch nodes with the following command: - -```sh -$ ros2 launch raspimouse_ros2_examples line_follower.launch.py -``` - -Next, place Raspberry Pi Mouse on a field and press SW2 to sample sensor values on the field. - - - -Then, place Raspberry Pi Mouse to detect a line and press SW1 to sample sensor values on the line. - - - -Last, place Raspberry Pi Mouse on the line and press SW0 to start line following. - - - -Press SW0 again to stop the following. - -#### Configure - -Edit [`./src/line_follower_component.cpp`](./src/line_follower_component.cpp) to change a velocity command. - -```cpp -void Follower::publish_cmdvel_for_line_following(void) -{ - const double VEL_LINEAR_X = 0.08; // m/s - const double VEL_ANGULAR_Z = 0.8; // rad/s - const double LOW_VEL_ANGULAR_Z = 0.5; // rad/s -``` - -#### Videos - -[![line_follower](http://img.youtube.com/vi/oPm0sW2V_tY/sddefault.jpg)](https://youtu.be/oPm0sW2V_tY) - -[back to example list](#how-to-use-examples) - ---- - -### camera_line_follower - - - -This is an example for line following by RGB camera. - -#### Requirements - -- Web camera - - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) -- Camera mount - - [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) - -#### Installation - -Install a camera mount and a web camera to Raspberry Pi Mouse, then connect the camera to the Raspberry Pi. - -#### How to use - -Then, launch nodes with the following command: - -```sh -$ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_device:=/dev/video0 -``` - -Place Raspberry Pi Mouse on the line and press SW2 to start line following. - -Press SW0 to stop the following. - -This sample publishes two topics: `camera/color/image_raw` for the camera image and `result_image` for the object detection image. -These images can be viewed with [RViz](https://index.ros.org/r/rviz/) -or [rqt_image_view](https://index.ros.org/p/rqt_image_view/). - -**Viewing an image may cause the node to behave unstable and not publish cmd_vel or image topics.** - -**If the line detection accuracy is poor, please adjust the camera's exposure and white balance.** - - - -#### Parameters - -- `max_brightness` - - Type: `int` - - Default: 90 - - Maximum threshold value for image binarisation. -- `min_brightness` - - Type: `int` - - Default: 0 - - Minimum threshold value for image binarisation. -- `max_linear_vel` - - Type: `double` - - Default: 0.05 - - Maximum linear velocity. -- `max_angular_vel` - - Type: `double` - - Default: 0.8 - - Maximum angular velocity. -- `area_threthold` - - Type: `double` - - Default: 0.20 - - Threshold value of the area of the line to start following. - -```sh -ros2 param set /camera_follower max_brightness 80 -``` - -[back to example list](#how-to-use-examples) - ---- - -### SLAM - - - -SLAM and Navigation examples for Raspberry Pi Mouse is [here](https://github.com/rt-net/raspimouse_slam_navigation_ros2). - -[back to example list](#how-to-use-examples) - ---- - -### direction_controller - - - -This is an example to use an IMU sensor for direction control. - -#### Requirements - -- [USB output 9 degrees IMU sensor module](https://www.rt-shop.jp/index.php?main_page=product_info&products_id=3416&language=en) -- [LiDAR Mount](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3867) -- RT-USB-9axisIMU ROS Package. - - https://github.com/rt-net/rt_usb_9axisimu_driver - -#### Installation - -Install the IMU sensor module to the LiDAR mount. - - - -Install the LiDAR mount to the Raspberry Pi Mouse. - - - -#### How to use - -Launch nodes on Raspberry Pi Mouse with the following command: - -```sh -$ ros2 launch raspimouse_ros2_examples direction_controller.launch.py -``` - -Then, press SW0 ~ SW2 to change the control mode as following, - -- SW0: Calibrate the gyroscope bias and reset a heading angle of Raspberry Pi Mouse to 0 rad. -- SW1: Start a direction control to keep the heading angle to 0 rad. - - Press SW0 ~ SW2 or tilt the body to sideways to finish the control. -- SW2: Start a direction control to change the heading angle to `-π ~ π rad`. - - Press SW0 ~ SW2 or tilt the body to sideways to finish the control. - -### Troubleshooting - -The IMU might not be connected correctly. -Reconnect the USB cable several times and re-execute the above command. - -#### Configure - - -Set parameters to configure gains of a PID controller for the direction control. - -```sh -$ ros2 param set /direction_controller p_gain 10.0 -Set parameter successful - -$ ros2 param set /direction_controller i_gain 0.5 -Set parameter successful - -$ ros2 param set /direction_controller d_gain 0.0 -Set parameter successful -``` -#### Parameters - -- p_gain - - Proportional gain of a PID controller for the direction control - - default: 10.0, min:0.0, max:30.0 - - type: double -- i_gain - - Integral gain of a PID controller for the direction control - - default: 0.0, min:0.0, max:5.0 - - type: double -- d_gain - - Derivative gain of a PID controller for the direction control - - default: 20.0, min:0.0, max:30.0 - - type: double -- target_angle - - Target angle for the SW1 control mode. - - default: 0.0, min:-π, max:+π - - type: double - -#### Publish topics - -- heading_angle - - Heading angle of the robot that calculated from the IMU module sensor values. - - type: std_msgs/Float64 - -#### Videos - -[![](http://img.youtube.com/vi/ghcCYOh9_MM/sddefault.jpg)](https://youtu.be/ghcCYOh9_MM) - -[back to example list](#how-to-use-examples) From d1be225b1ec277072509349cb0836b57786357bf Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 14:51:40 +0900 Subject: [PATCH 23/48] =?UTF-8?q?=E3=83=AA=E3=83=B3=E3=82=AF=E3=83=9F?= =?UTF-8?q?=E3=82=B9=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.en.md b/README.en.md index cb9e835..ead4212 100644 --- a/README.en.md +++ b/README.en.md @@ -93,7 +93,7 @@ $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false ## How to Use Examples -The detailed operation of the sample program is explained in[Examples](./Examples.md). +The detailed operation of the sample program is explained in[Examples](./Examples.en.md). - Examples - Joystick Control From 1d6f4c612f915ab61eda1938eeae6311fb2fb4fb Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 15:01:50 +0900 Subject: [PATCH 24/48] =?UTF-8?q?=E3=83=A9=E3=82=A4=E3=82=BB=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E3=81=AE=E3=83=9F=E3=82=B9=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 8 ++++---- README.md | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.en.md b/README.en.md index ead4212..fb43b9d 100644 --- a/README.en.md +++ b/README.en.md @@ -93,7 +93,7 @@ $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false ## How to Use Examples -The detailed operation of the sample program is explained in[Examples](./Examples.en.md). +The detailed operation of the sample program is explained in d[Examples](./Examples.en.md). - Examples - Joystick Control @@ -105,11 +105,11 @@ The detailed operation of the sample program is explained in[Examples](./Example ## License -(C) 2022 RT Corporation \ +(C) 2022 RT Corporation Each file is licensed as stated in their headers. -If no license is specified, the file is licensed under the MIT License. -The full license text is available in the [LICENSE](./LICENSE) file or at [https://opensource.org/license/MIT](https://opensource.org/license/MIT). +If no license is specified, the file is licensed under the Apache License, Version 2.0. +The full license text is available in the [LICENSE](./LICENSE) file or at [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0). ## Contributing diff --git a/README.md b/README.md index 6f816ce..0fae017 100644 --- a/README.md +++ b/README.md @@ -105,10 +105,11 @@ $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false ## License -(C) 2022 RT Corporation \ +(C) 2022 RT Corporation -各ファイルはライセンスがファイル中に明記されている場合、そのライセンスに従います。 特に明記されていない場合は、Apache License, Version 2.0に基づき公開されています。 -ライセンスの全文は[LICENSE](./LICENSE)または[https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)から確認できます。 +各ファイルはライセンスがファイル中に明記されている場合、そのライセンスに従います。 +特に明記されていない場合は、Apache License, Version 2.0に基づき公開されています。 +ライセンスの全文はLICENSEまたはhttps://www.apache.org/licenses/LICENSE-2.0から確認できます。 ## Contributing From 92b8bc0750b350125d7989ebe8314828bd30b4b7 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Fri, 3 Oct 2025 15:29:07 +0900 Subject: [PATCH 25/48] =?UTF-8?q?=E8=AA=A4=E5=AD=97=E8=84=B1=E5=AD=97?= =?UTF-8?q?=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples.en.md | 56 +++++++++++++++++++++++++------------------------- Examples.md | 38 +++++++++++++++++----------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/Examples.en.md b/Examples.en.md index ab88fc5..2a6d566 100644 --- a/Examples.en.md +++ b/Examples.en.md @@ -18,9 +18,9 @@ This is an example with a joystick controller to operate a Raspberry Pi Mouse. joystick_control -### Usages +### Usage -launch the nodes with the following command: +Launch nodes with the following command: ```sh # Controlled directly on Raspberry Pi Mouse @@ -56,7 +56,7 @@ button_motor_on : 9 button_cmd_enable : 4 ``` -[back to example list](#how-to-use-examples) +[back to example list](#examples) --- @@ -73,22 +73,22 @@ The ball tracking is performed with a USB webcam and the OpenCV library. - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) - Camera mount - [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) -- Orange ball(Optional) +- Orange ball (Optional) - [Soft Ball (Orange)](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1307&products_id=3701&language=en) - Software - OpenCV - v4l-utils -### Usages +### Usage -Disable the automatic camera adjustment parameters (auto focus, auto white balance, etc.) with the following command: +Disable the automatic camera adjustment parameters (autofocus, auto white balance, etc.) with the following command: ```sh $ cd ~/ros2_ws/src/raspimouse_ros2_examples/config $ ./configure_camera.bash ``` -Then, launch the nodes with the following command: +Then, launch nodes with the following command: ```sh $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/dev/video0 @@ -116,7 +116,7 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue ``` -[back to example list](#how-to-use-examples) +[back to example list](#examples) --- @@ -132,7 +132,7 @@ This is an example for line following. - [Raspberry Pi Mouse Option kit No.3 \[Line follower\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3591&language=en) - Field and lines for following (Optional) -### Usages +### Usage Launch nodes with the following command: @@ -155,7 +155,7 @@ Finally, place the Raspberry Pi Mouse on the line and press SW0 to start line fo Press SW0 again to stop the line following. - joystick_control + line_follwer ### Configure @@ -165,12 +165,12 @@ Edit [`./src/line_follower_component.cpp`](./src/line_follower_component.cpp) to ```cpp void Follower::publish_cmdvel_for_line_following(void) { - const double VEL_LINEAR_X = 0.08; // m/s - const double VEL_ANGULAR_Z = 0.8; // rad/s - const double LOW_VEL_ANGULAR_Z = 0.5; // rad/s + const double VEL_LINEAR_X = 0.08; // [m/s] + const double VEL_ANGULAR_Z = 0.8; // [rad/s] + const double LOW_VEL_ANGULAR_Z = 0.5; // [rad/s] ``` -[back to example list](#how-to-use-examples) +[back to example list](#examples) --- @@ -187,9 +187,9 @@ This is an example for line following by RGB camera. - Camera mount - [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) -### Usages +### Usage -launch nodes with the following command: +Launch nodes with the following command: ```sh $ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_device:=/dev/video0 @@ -199,7 +199,7 @@ Place Raspberry Pi Mouse on the line and press SW2 to start line following. Press SW0 to stop the line following. This sample publishes two topics: `camera/color/image_raw` for the camera image and `result_image` for the object detection image. -These images can be viewed in [RViz](https://index.ros.org/r/rviz/)or [rqt_image_view](https://index.ros.org/p/rqt_image_view/). +These images can be viewed in [RViz](https://index.ros.org/r/rviz/) or [rqt_image_view](https://index.ros.org/p/rqt_image_view/). > [!NOTE] > Viewing the images may cause the node to become unstable, resulting in cmd_vel or image topics not being published. @@ -239,7 +239,7 @@ Run the following command to set the parameters: ros2 param set /camera_follower max_brightness 80 ``` -[back to example list](#how-to-use-examples) +[back to example list](#examples) --- @@ -263,7 +263,7 @@ Attach the LiDAR mount with the IMU sensor module to the Raspberry Pi Mouse. For -### Usages +### Usage Launch nodes on the Raspberry Pi Mouse with the following command: @@ -271,13 +271,13 @@ Launch nodes on the Raspberry Pi Mouse with the following command: $ ros2 launch raspimouse_ros2_examples direction_controller.launch.py ``` -Then, press SW0 ~ SW2 to change the control mode as follows: +Then, press SW0–SW2 to change the control mode as follows: -- SW0: Calibrate the gyroscope bias and reset the Raspberry Pi Mouse's heading angle to 0 rad. -- SW1: Start direction control to keep the heading angle at 0 rad. - - Press SW0 ~ SW2 or tilt the body sideways to terminate the control. -- SW2: Start direction control to change the heading angle between -π and π rad. - - Press SW0 ~ SW2 or tilt the body sideways to terminate the control. +- SW0: Calibrate the gyroscope bias and reset the Raspberry Pi Mouse's heading angle to `0`[rad]. +- SW1: Start direction control to keep the heading angle at `0`[rad]. + - Press SW0–SW2 or tilt the body sideways to terminate the control. +- SW2: Start direction control to change the heading angle between `-π` and `π`[rad]. + - Press SW0–SW2 or tilt the body sideways to terminate the control. > [!NOTE] > The IMU might not be connected correctly. @@ -299,7 +299,7 @@ Then, press SW0 ~ SW2 to change the control mode as follows: - Derivative gain of a PID controller for the direction control - `target_angle` - Type: `double` - - default: 0.0, min:-π, max:+π + - Default: 0.0, min:-π, max:+π - Target angle for the SW1 (direction control mode). ### Published @@ -308,7 +308,7 @@ Then, press SW0 ~ SW2 to change the control mode as follows: - Type: `std_msgs/Float64` - Heading angle of the robot calculated from IMU module sensor values -[back to example list](#how-to-use-examples) +[back to example list](#examples) --- @@ -321,6 +321,6 @@ This is an example of SLAM & Navigation. > [!NOTE] > The sample for SLAM and Navigation with Raspberry Pi Mouse has been moved to [rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2). -[back to example list](#how-to-use-examples) +[back to example list](#examples) --- diff --git a/Examples.md b/Examples.md index 321c271..c52babf 100644 --- a/Examples.md +++ b/Examples.md @@ -18,7 +18,7 @@ Raspberry Pi Mouseを動作させるサンプル集です。 joystick_control -### Usages +### Usage 次のコマンドでノードを起動します。 @@ -56,7 +56,7 @@ button_motor_on : 9 button_cmd_enable : 4 ``` -[back to example list](#how-to-use-examples) +[back to example list](#examples) --- @@ -79,9 +79,9 @@ USB接続のWebカメラとOpenCVを使ってボール追跡をします。 - OpenCV - v4l-utils -### Usages +### Usage -次のスクリプトを実行して、カメラの自動調節機能(自動露光,オートホワイトバランス等)を切ります。 +次のスクリプトを実行して、カメラの自動調節機能(自動露光、オートホワイトバランス等)を切ります。 ```sh $ cd ~/ros2_ws/src/raspimouse_ros2_examples/config @@ -118,7 +118,7 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue ``` -[back to example list](#how-to-use-examples) +[back to example list](#examples) --- @@ -134,7 +134,7 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) - [Raspberry Pi Mouse オプションキット No.3 \[ライントレース\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3591) - フィールドとライン (Optional) -### Usages +### Usage 次のコマンドでノードを起動します。 @@ -172,7 +172,7 @@ void Follower::publish_cmdvel_for_line_following(void) const double LOW_VEL_ANGULAR_Z = 0.5; // rad/s ``` -[back to example list](#how-to-use-examples) +[back to example list](#examples) --- @@ -189,7 +189,7 @@ RGBカメラによるライントレースのコード例です。 - カメラマウント - [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584) -### Usages +### Usage 次のコマンドでノードを起動します。 @@ -242,7 +242,7 @@ $ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_devi ros2 param set /camera_follower max_brightness 80 ``` -[back to example list](#how-to-use-examples) +[back to example list](#examples) --- @@ -263,7 +263,7 @@ IMUセンサモジュールを取り付けたLiDAR MountをRaspberry Pi Mouseに -### Usages +### Usage 次のコマンドでノードを起動します。 @@ -271,13 +271,13 @@ IMUセンサモジュールを取り付けたLiDAR MountをRaspberry Pi Mouseに $ ros2 launch raspimouse_ros2_examples direction_controller.launch.py ``` -SW0 ~ SW2を押して動作モードを切り替えます。 +SW0-SW2を押して動作モードを切り替えます。 -- SW0: ジャイロセンサのバイアスをキャリブレーションし、ラズパイマウスの方位角を`0 rad`にリセットします -- SW1: 方位角を`0 rad`に維持する角度制御を開始します - - SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します -- SW2: 方位角を`-π ~ π rad`に変化させる角度制御を開始します - - SW0 ~ SW2を押すか、ラズパイマウス本体を横に傾けると終了します +- SW0: ジャイロセンサのバイアスをキャリブレーションし、ラズパイマウスの方位角を`0`[rad]にリセットします +- SW1: 方位角を`0`[rad]に維持する角度制御を開始します + - SW0–SW2を押すか、ラズパイマウス本体を横に傾けると終了します +- SW2: 方位角を`-π ~ π`[rad]に変化させる角度制御を開始します + - SW0–SW2を押すか、ラズパイマウス本体を横に傾けると終了します > [!NOTE] > IMUの接続が正常に行われない場合があります。 @@ -299,7 +299,7 @@ SW0 ~ SW2を押して動作モードを切り替えます。 - 角度制御用PIDコントローラの微分ゲイン - `target_angle` - Type: `double` - - default: 0.0, min:-π, max:+π + - Default: 0.0, min:-π, max:+π - SW1(角度制御モード)の目標角度 ### Published @@ -307,7 +307,7 @@ SW0 ~ SW2を押して動作モードを切り替えます。 - Type: `std_msgs/Float64` - IMUモジュールのセンサ値をもとに計算されたロボットの向き(進行方向の角度) -[back to example list](#how-to-use-examples) +[back to example list](#examples) --- @@ -320,6 +320,6 @@ SLAMとNavigationを行います。 > [!NOTE] > Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 -[back to example list](#how-to-use-examples) +[back to example list](#examples) --- From c833ece6fd70ea6f134da2af287986cd50233e5e Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 23 Oct 2025 15:56:53 +0900 Subject: [PATCH 26/48] =?UTF-8?q?=E6=97=A5=E6=9C=AC=E8=AA=9E=E3=81=AEExamp?= =?UTF-8?q?le.md=E3=82=92README.m=E3=81=AB=E7=B5=B1=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples.md | 325 -------------------------------------------------- README.md | 334 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 327 insertions(+), 332 deletions(-) delete mode 100644 Examples.md diff --git a/Examples.md b/Examples.md deleted file mode 100644 index c52babf..0000000 --- a/Examples.md +++ /dev/null @@ -1,325 +0,0 @@ -# Examples - -Raspberry Pi Mouseを動作させるサンプル集です。 - -- [Examples](#examples) - - [Joystick Control](#joystick-control) - - [Object Tracking](#object-tracking) - - [Line Follower](#line-follower) - - [Camera Line Follower](#camera-line-follower) - - [Direction Controller](#direction-controller) - - [SLAM & Navigation](#slam--navigation) - -## Joystick Control - -ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 - - - joystick_control - - -### Usage - -次のコマンドでノードを起動します。 - -```sh -# Controlled directly on Raspberry Pi Mouse -## Use F710 -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true -## Use DUALSHOCK 3 -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true - -# Control from remote computer -## on RaspberryPiMouse -$ ros2 run raspimouse raspimouse -## on remote computer -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false -``` - -### Configure - -デフォルトのキー割り当てはこちらです。 - -Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを __D__ (DirectInput Mode)に設定します。 - - - -[./config/joy_f710.yml](./config/joy_f710.yml)、[./config/joy_dualshock3.yml](./config/joy_dualshock3.yml)のキー番号を編集することで、キー割り当てを変更できます。 - -```yaml -button_shutdown_1 : 8 -button_shutdown_2 : 9 - -button_motor_off : 8 -button_motor_on : 9 - -button_cmd_enable : 4 -``` - -[back to example list](#examples) - ---- - -## Object Tracking - -色情報をもとにオレンジ色のボールの追跡を行うコード例です。 -USB接続のWebカメラとOpenCVを使ってボール追跡をします。 - - - -### Requirements - -- Webカメラ - - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) -- カメラマウント - - [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584) -- ボール(Optional) - - [ソフトボール(オレンジ)](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1307&products_id=3701) -- Software - - OpenCV - - v4l-utils - -### Usage - -次のスクリプトを実行して、カメラの自動調節機能(自動露光、オートホワイトバランス等)を切ります。 - -```sh -$ cd ~/ros2_ws/src/raspimouse_ros2_examples/config -$ ./configure_camera.bash -``` - -次のコマンドでノードを起動します。 - -```sh -$ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/dev/video0 -``` - -カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 -これらの画像は[RViz](https://index.ros.org/r/rviz/)や[rqt_image_view](https://index.ros.org/p/rqt_image_view/)で表示できます。 - -> [!NOTE] -> 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 - - - -### Configure - -追跡対象の色を変更するには -[`./src/object_tracking_component.cpp`](./src/object_tracking_component.cpp) -を編集します。 - -物体検出精度が悪い時にはカメラの露光や関数内のパラメータを調整して下さい。 - -```cpp -void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) -{ - cv::inRange(hsv, cv::Scalar(9, 100, 100), cv::Scalar(29, 255, 255), extracted_bin); // Orange - // cv::inRange(hsv, cv::Scalar(60, 100, 100), cv::Scalar(80, 255, 255), extracted_bin); // Green - // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue -``` - -[back to example list](#examples) - ---- - -## Line Follower - -ライントレースのコード例です。 - - - -### Requirements - -- ライントレースセンサ - - [Raspberry Pi Mouse オプションキット No.3 \[ライントレース\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3591) -- フィールドとライン (Optional) - -### Usage - -次のコマンドでノードを起動します。 - -```sh -$ ros2 launch raspimouse_ros2_examples line_follower.launch.py -``` - -Raspberry Pi Mouseをフィールドに置き、SW2を押してフィールド上のセンサ値をサンプリングします。 - - - -次に、センサとラインが重なるようにRaspberry Pi Mouseを置き、SW1を押してライン上のセンサ値をサンプリングします。 - - - -最後に、ライン上にRaspberry Pi Mouseを置き、SW0を押してライントレースを開始します。 - - - -もう一度SW0を押すとライントレースを停止します。 - - - joystick_control - - -### Configure - -走行速度を変更するには[`./src/line_follower_component.cpp`](./src/line_follower_component.cpp)を編集します。 - -```cpp -void Follower::publish_cmdvel_for_line_following(void) -{ - const double VEL_LINEAR_X = 0.08; // m/s - const double VEL_ANGULAR_Z = 0.8; // rad/s - const double LOW_VEL_ANGULAR_Z = 0.5; // rad/s -``` - -[back to example list](#examples) - ---- - -## Camera Line Follower - -RGBカメラによるライントレースのコード例です。 - - - -### Requirements - -- Webカメラ - - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) -- カメラマウント - - [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584) - -### Usage - -次のコマンドでノードを起動します。 - -```sh -$ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_device:=/dev/video0 -``` - -ライン上にRaspberry Pi Mouseを置き、SW2を押してライントレースを開始します。 -停止させる場合はSW0を押します。 - -カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 -これらの画像は[RViz](https://index.ros.org/r/rviz/)や[rqt_image_view](https://index.ros.org/p/rqt_image_view/) -で表示できます。 - -> [!NOTE] -> 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 - -### Configure - -ラインの検出精度が悪い場合はカメラの露光やホワイトバランスの調整を行ってください。 - - - -### Parameters - -- `max_brightness` - - Type: `int` - - Default: 90 - - 画像の2値化のしきい値の最大値 -- `min_brightness` - - Type: `int` - - Default: 0 - - 画像の2値化のしきい値の最小値 -- `max_linear_vel` - - Type: `double` - - Default: 0.05 - - 直進速度の最大値 -- `max_angular_vel` - - Type: `double` - - Default: 0.8 - - 旋回速度の最大値 -- `area_threshold` - - Type: `double` - - Default: 0.20 - - 走行を開始するためのライン面積のしきい値 - -各種パラメータを設定する際は、以下のコマンドを実行します。 - -```sh -ros2 param set /camera_follower max_brightness 80 -``` - -[back to example list](#examples) - ---- - -## Direction Controller - -IMUセンサを使用した角度制御のコード例です。 - - - -### Requirements - -- [USB出力9軸IMUセンサモジュール](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1348_1&products_id=3416&language=ja) -- LiDAR Mount ([Raspberry Pi Mouse オプションキットNo.8 [マルチLiDARマウント]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3867)) -- RT-USB-9axisIMU ROS Package - - https://github.com/rt-net/rt_usb_9axisimu_driver - -IMUセンサモジュールを取り付けたLiDAR MountをRaspberry Pi Mouseに取り付けます。詳細は、[マルチLiDARマウント組み立てマニュアル](https://rt-net.jp/wp-content/uploads/2020/04/RaspberryPiMouseOptionKitManual_No08.pdf)を参照してください。 - - - -### Usage - -次のコマンドでノードを起動します。 - -```sh -$ ros2 launch raspimouse_ros2_examples direction_controller.launch.py -``` - -SW0-SW2を押して動作モードを切り替えます。 - -- SW0: ジャイロセンサのバイアスをキャリブレーションし、ラズパイマウスの方位角を`0`[rad]にリセットします -- SW1: 方位角を`0`[rad]に維持する角度制御を開始します - - SW0–SW2を押すか、ラズパイマウス本体を横に傾けると終了します -- SW2: 方位角を`-π ~ π`[rad]に変化させる角度制御を開始します - - SW0–SW2を押すか、ラズパイマウス本体を横に傾けると終了します - -> [!NOTE] -> IMUの接続が正常に行われない場合があります。 -> その際は、IMUのUSBケーブルを抜き差しした後、コマンドを再度実行してください。 - -### Parameters - -- `p_gain` - - Type: `double` - - Default: 10.0, min:0.0, max:30.0 - - 角度制御用PIDコントローラの比例ゲイン -- `i_gain` - - Type: `double` - - Default: 0.0, min:0.0, max:5.0 - - 角度制御用PIDコントローラの積分ゲイン -- `d_gain` - - Type: `double` - - Default: 20.0, min:0.0, max:30.0 - - 角度制御用PIDコントローラの微分ゲイン -- `target_angle` - - Type: `double` - - Default: 0.0, min:-π, max:+π - - SW1(角度制御モード)の目標角度 - -### Published -- `heading_angle` - - Type: `std_msgs/Float64` - - IMUモジュールのセンサ値をもとに計算されたロボットの向き(進行方向の角度) - -[back to example list](#examples) - ---- - -## SLAM & Navigation - -SLAMとNavigationを行います。 - - - -> [!NOTE] -> Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 - -[back to example list](#examples) - ---- diff --git a/README.md b/README.md index 0fae017..c056591 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,12 @@ Gazebo(シミュレータ)で動作させる場合は、[rt-net/raspimouse_s - [Source Build](#source-build) - [QuickStart](#quickstart) - [How To Use Examples](#how-to-use-examples) + - [Joystick Control](#joystick-control) + - [Object Tracking](#object-tracking) + - [Line Follower](#line-follower) + - [Camera Line Follower](#camera-line-follower) + - [Direction Controller](#direction-controller) + - [SLAM & Navigation](#slam--navigation)([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) - [License](#license) - [Contributing](#contributing) @@ -93,15 +99,329 @@ $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false ## How to Use Examples -サンプルプログラムの詳細な動作方法は、[Examples](./Examples.md)で説明しています。 +Raspberry Pi Mouseを動作させるサンプル集です。 - Examples - - Joystick Control - - Object Tracking - - Line Follower - - Camera Line Follower - - Direction Controller - - SLAM & Navigation ([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) + - [Joystick Control](#joystick-control) + - [Object Tracking](#object-tracking) + - [Line Follower](#line-follower) + - [Camera Line Follower](#camera-line-follower) + - [Direction Controller](#direction-controller) + - [SLAM & Navigation](#slam--navigation)([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) + +### Joystick Control + +ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 + + + joystick_control + + +#### Usage + +次のコマンドでノードを起動します。 + +```sh +# Controlled directly on Raspberry Pi Mouse +## Use F710 +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true +## Use DUALSHOCK 3 +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true + +# Control from remote computer +## on RaspberryPiMouse +$ ros2 run raspimouse raspimouse +## on remote computer +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false +``` + +#### Configure + +デフォルトのキー割り当てはこちらです。 + +Logicool Wireless Gamepad F710を使う場合はモード切替スイッチを __D__ (DirectInput Mode)に設定します。 + + + +[./config/joy_f710.yml](./config/joy_f710.yml)、[./config/joy_dualshock3.yml](./config/joy_dualshock3.yml)のキー番号を編集することで、キー割り当てを変更できます。 + +```yaml +button_shutdown_1 : 8 +button_shutdown_2 : 9 + +button_motor_off : 8 +button_motor_on : 9 + +button_cmd_enable : 4 +``` + +[back to example list](#examples) + +--- + +### Object Tracking + +色情報をもとにオレンジ色のボールの追跡を行うコード例です。 +USB接続のWebカメラとOpenCVを使ってボール追跡をします。 + + + +#### Requirements + +- Webカメラ + - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) +- カメラマウント + - [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584) +- ボール(Optional) + - [ソフトボール(オレンジ)](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1307&products_id=3701) +- Software + - OpenCV + - v4l-utils + +#### Usage + +次のスクリプトを実行して、カメラの自動調節機能(自動露光、オートホワイトバランス等)を切ります。 + +```sh +$ cd ~/ros2_ws/src/raspimouse_ros2_examples/config +$ ./configure_camera.bash +``` + +次のコマンドでノードを起動します。 + +```sh +$ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/dev/video0 +``` + +カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 +これらの画像は[RViz](https://index.ros.org/r/rviz/)や[rqt_image_view](https://index.ros.org/p/rqt_image_view/)で表示できます。 + +> [!NOTE] +> 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 + + + +#### Configure + +追跡対象の色を変更するには +[`./src/object_tracking_component.cpp`](./src/object_tracking_component.cpp) +を編集します。 + +物体検出精度が悪い時にはカメラの露光や関数内のパラメータを調整して下さい。 + +```cpp +void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) +{ + cv::inRange(hsv, cv::Scalar(9, 100, 100), cv::Scalar(29, 255, 255), extracted_bin); // Orange + // cv::inRange(hsv, cv::Scalar(60, 100, 100), cv::Scalar(80, 255, 255), extracted_bin); // Green + // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue +``` + +[back to example list](#examples) + +--- + +### Line Follower + +ライントレースのコード例です。 + + + +#### Requirements + +- ライントレースセンサ + - [Raspberry Pi Mouse オプションキット No.3 \[ライントレース\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3591) +- フィールドとライン (Optional) + +#### Usage + +次のコマンドでノードを起動します。 + +```sh +$ ros2 launch raspimouse_ros2_examples line_follower.launch.py +``` + +Raspberry Pi Mouseをフィールドに置き、SW2を押してフィールド上のセンサ値をサンプリングします。 + + + +次に、センサとラインが重なるようにRaspberry Pi Mouseを置き、SW1を押してライン上のセンサ値をサンプリングします。 + + + +最後に、ライン上にRaspberry Pi Mouseを置き、SW0を押してライントレースを開始します。 + + + +もう一度SW0を押すとライントレースを停止します。 + + + joystick_control + + +#### Configure + +走行速度を変更するには[`./src/line_follower_component.cpp`](./src/line_follower_component.cpp)を編集します。 + +```cpp +void Follower::publish_cmdvel_for_line_following(void) +{ + const double VEL_LINEAR_X = 0.08; // m/s + const double VEL_ANGULAR_Z = 0.8; // rad/s + const double LOW_VEL_ANGULAR_Z = 0.5; // rad/s +``` + +[back to example list](#examples) + +--- + +### Camera Line Follower + +RGBカメラによるライントレースのコード例です。 + + + +#### Requirements + +- Webカメラ + - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) +- カメラマウント + - [Raspberry Pi Mouse オプションキット No.4 \[Webカメラマウント\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3584) + +#### Usage + +次のコマンドでノードを起動します。 + +```sh +$ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_device:=/dev/video0 +``` + +ライン上にRaspberry Pi Mouseを置き、SW2を押してライントレースを開始します。 +停止させる場合はSW0を押します。 + +カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 +これらの画像は[RViz](https://index.ros.org/r/rviz/)や[rqt_image_view](https://index.ros.org/p/rqt_image_view/) +で表示できます。 + +> [!NOTE] +> 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 + +#### Configure + +ラインの検出精度が悪い場合はカメラの露光やホワイトバランスの調整を行ってください。 + + + +#### Parameters + +- `max_brightness` + - Type: `int` + - Default: 90 + - 画像の2値化のしきい値の最大値 +- `min_brightness` + - Type: `int` + - Default: 0 + - 画像の2値化のしきい値の最小値 +- `max_linear_vel` + - Type: `double` + - Default: 0.05 + - 直進速度の最大値 +- `max_angular_vel` + - Type: `double` + - Default: 0.8 + - 旋回速度の最大値 +- `area_threshold` + - Type: `double` + - Default: 0.20 + - 走行を開始するためのライン面積のしきい値 + +各種パラメータを設定する際は、以下のコマンドを実行します。 + +```sh +ros2 param set /camera_follower max_brightness 80 +``` + +[back to example list](#examples) + +--- + +### Direction Controller + +IMUセンサを使用した角度制御のコード例です。 + + + +#### Requirements + +- [USB出力9軸IMUセンサモジュール](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1348_1&products_id=3416&language=ja) +- LiDAR Mount ([Raspberry Pi Mouse オプションキットNo.8 [マルチLiDARマウント]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3867)) +- RT-USB-9axisIMU ROS Package + - https://github.com/rt-net/rt_usb_9axisimu_driver + +IMUセンサモジュールを取り付けたLiDAR MountをRaspberry Pi Mouseに取り付けます。詳細は、[マルチLiDARマウント組み立てマニュアル](https://rt-net.jp/wp-content/uploads/2020/04/RaspberryPiMouseOptionKitManual_No08.pdf)を参照してください。 + + + +#### Usage + +次のコマンドでノードを起動します。 + +```sh +$ ros2 launch raspimouse_ros2_examples direction_controller.launch.py +``` + +SW0-SW2を押して動作モードを切り替えます。 + +- SW0: ジャイロセンサのバイアスをキャリブレーションし、ラズパイマウスの方位角を`0`[rad]にリセットします +- SW1: 方位角を`0`[rad]に維持する角度制御を開始します + - SW0–SW2を押すか、ラズパイマウス本体を横に傾けると終了します +- SW2: 方位角を`-π ~ π`[rad]に変化させる角度制御を開始します + - SW0–SW2を押すか、ラズパイマウス本体を横に傾けると終了します + +> [!NOTE] +> IMUの接続が正常に行われない場合があります。 +> その際は、IMUのUSBケーブルを抜き差しした後、コマンドを再度実行してください。 + +#### Parameters + +- `p_gain` + - Type: `double` + - Default: 10.0, min:0.0, max:30.0 + - 角度制御用PIDコントローラの比例ゲイン +- `i_gain` + - Type: `double` + - Default: 0.0, min:0.0, max:5.0 + - 角度制御用PIDコントローラの積分ゲイン +- `d_gain` + - Type: `double` + - Default: 20.0, min:0.0, max:30.0 + - 角度制御用PIDコントローラの微分ゲイン +- `target_angle` + - Type: `double` + - Default: 0.0, min:-π, max:+π + - SW1(角度制御モード)の目標角度 + +#### Published +- `heading_angle` + - Type: `std_msgs/Float64` + - IMUモジュールのセンサ値をもとに計算されたロボットの向き(進行方向の角度) + +[back to example list](#examples) + +--- + +### SLAM & Navigation + +SLAMとNavigationを行います。 + + + +> [!NOTE] +> Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 + +[back to example list](#examples) + +--- ## License From 4f2d5a49af5665bfaad1a9a55e886bfdce0485ce Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 23 Oct 2025 16:06:37 +0900 Subject: [PATCH 27/48] =?UTF-8?q?Example.en.md=E3=82=92README.en.md?= =?UTF-8?q?=E3=81=AB=E7=B5=B1=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples.en.md | 326 ----------------------------------------------- README.en.md | 337 +++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 329 insertions(+), 334 deletions(-) delete mode 100644 Examples.en.md diff --git a/Examples.en.md b/Examples.en.md deleted file mode 100644 index 2a6d566..0000000 --- a/Examples.en.md +++ /dev/null @@ -1,326 +0,0 @@ -# Examples - -Sample programs for the Raspberry Pi Mouse. - -- [Examples](#examples) - - [Joystick Control](#joystick-control) - - [Object Tracking](#object-tracking) - - [Line Follower](#line-follower) - - [Camera Line Follower](#camera-line-follower) - - [Direction Controller](#direction-controller) - - [SLAM & Navigation](#slam--navigation) - -## Joystick Control - -This is an example with a joystick controller to operate a Raspberry Pi Mouse. - - - joystick_control - - -### Usage - -Launch nodes with the following command: - -```sh -# Controlled directly on Raspberry Pi Mouse -## Use F710 -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true -## Use DUALSHOCK 3 -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true - -# Control from remote computer -## on RaspberryPiMouse -$ ros2 run raspimouse raspimouse -## on remote computer -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false -``` - -### Configure - -This picture shows the default key configuration. - -To use Logicool Wireless Gamepad F710, set the input mode to __D__ (DirectInput Mode). - - - -Key assignments can be edited with key numbers in [./config/joy_f710.yml](./config/joy_f710.yml) or [./config/joy_dualshock3.yml](./config/joy_dualshock3.yml). - -```yaml -button_shutdown_1 : 8 -button_shutdown_2 : 9 - -button_motor_off : 8 -button_motor_on : 9 - -button_cmd_enable : 4 -``` - -[back to example list](#examples) - ---- - -## Object Tracking - -This is a code example for tracking an orange ball based on color information. -The ball tracking is performed with a USB webcam and the OpenCV library. - - - -### Requirements - -- Web camera - - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) -- Camera mount - - [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) -- Orange ball (Optional) - - [Soft Ball (Orange)](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1307&products_id=3701&language=en) -- Software - - OpenCV - - v4l-utils - -### Usage - -Disable the automatic camera adjustment parameters (autofocus, auto white balance, etc.) with the following command: - -```sh -$ cd ~/ros2_ws/src/raspimouse_ros2_examples/config -$ ./configure_camera.bash -``` - -Then, launch nodes with the following command: - -```sh -$ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/dev/video0 -``` - -This sample publishes two topics: `camera/color/image_raw` for the camera image and `result_image` for the object detection image. -These images can be viewed with [RViz](https://index.ros.org/r/rviz/) or [rqt_image_view](https://index.ros.org/p/rqt_image_view/). - -> [!NOTE] -> Viewing the images may cause the node to become unstable, resulting in cmd_vel or image topics not being published. - - - -### Configure - -Edit [`./src/object_tracking_component.cpp`](./src/object_tracking_component.cpp) to change the color of the tracking target. - -If the object detection accuracy is poor, adjust the camera exposure and the parameters in the function. - -```cpp -void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) -{ - cv::inRange(hsv, cv::Scalar(9, 100, 100), cv::Scalar(29, 255, 255), extracted_bin); // Orange - // cv::inRange(hsv, cv::Scalar(60, 100, 100), cv::Scalar(80, 255, 255), extracted_bin); // Green - // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue -``` - -[back to example list](#examples) - ---- - -## Line Follower - -This is an example for line following. - - - -### Requirements - -- Line following sensor - - [Raspberry Pi Mouse Option kit No.3 \[Line follower\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3591&language=en) -- Field and lines for following (Optional) - -### Usage - -Launch nodes with the following command: - -```sh -$ ros2 launch raspimouse_ros2_examples line_follower.launch.py -``` - -Next, place the Raspberry Pi Mouse on a field and press SW2 to sample sensor values on the field. - - - -Then, place the Raspberry Pi Mouse on the line and press SW1 to sample sensor values. - - - -Finally, place the Raspberry Pi Mouse on the line and press SW0 to start line following. - - - -Press SW0 again to stop the line following. - - - line_follwer - - -### Configure - -Edit [`./src/line_follower_component.cpp`](./src/line_follower_component.cpp) to change the robot velocity. - -```cpp -void Follower::publish_cmdvel_for_line_following(void) -{ - const double VEL_LINEAR_X = 0.08; // [m/s] - const double VEL_ANGULAR_Z = 0.8; // [rad/s] - const double LOW_VEL_ANGULAR_Z = 0.5; // [rad/s] -``` - -[back to example list](#examples) - ---- - -## Camera Line Follower - -This is an example for line following by RGB camera. - - - -### Requirements - -- Web camera - - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) -- Camera mount - - [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) - -### Usage - -Launch nodes with the following command: - -```sh -$ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_device:=/dev/video0 -``` - -Place Raspberry Pi Mouse on the line and press SW2 to start line following. -Press SW0 to stop the line following. - -This sample publishes two topics: `camera/color/image_raw` for the camera image and `result_image` for the object detection image. -These images can be viewed in [RViz](https://index.ros.org/r/rviz/) or [rqt_image_view](https://index.ros.org/p/rqt_image_view/). - -> [!NOTE] -> Viewing the images may cause the node to become unstable, resulting in cmd_vel or image topics not being published. - -### Configure - -If the line detection accuracy is poor, adjust the camera exposure and white balance. - - - -### Parameters - -- `max_brightness` - - Type: `int` - - Default: 90 - - Maximum threshold value for image binarization. -- `min_brightness` - - Type: `int` - - Default: 0 - - Minimum threshold value for image binarization. -- `max_linear_vel` - - Type: `double` - - Default: 0.05 - - Maximum linear velocity. -- `max_angular_vel` - - Type: `double` - - Default: 0.8 - - Maximum angular velocity. -- `area_threshold` - - Type: `double` - - Default: 0.20 - - Threshold value of the area of the line to start following. - -Run the following command to set the parameters: - -```sh -ros2 param set /camera_follower max_brightness 80 -``` - -[back to example list](#examples) - ---- - -## Direction Controller - -This is an example of using an IMU sensor for direction control. - - - -### Requirements - -- [USB output 9 degrees IMU sensor module](https://www.rt-shop.jp/index.php?main_page=product_info&products_id=3416&language=en) -- [LiDAR Mount](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3867) -- RT-USB-9axisIMU ROS Package. - - https://github.com/rt-net/rt_usb_9axisimu_driver - - -IMUセンサモジュールを取り付けたLiDAR MountをRaspberry Pi Mouseに取り付けます。詳細は、[マルチLiDARマウント組み立てマニュアル](https://rt-net.jp/wp-content/uploads/2020/04/RaspberryPiMouseOptionKitManual_No08.pdf)を参照してください。 - -Attach the LiDAR mount with the IMU sensor module to the Raspberry Pi Mouse. For details, refer to the [Multi-LiDAR Mount Assembly Manual (in Japanese)](https://rt-net.jp/wp-content/uploads/2020/04/RaspberryPiMouseOptionKitManual_No08.pdf). - - - -### Usage - -Launch nodes on the Raspberry Pi Mouse with the following command: - -```sh -$ ros2 launch raspimouse_ros2_examples direction_controller.launch.py -``` - -Then, press SW0–SW2 to change the control mode as follows: - -- SW0: Calibrate the gyroscope bias and reset the Raspberry Pi Mouse's heading angle to `0`[rad]. -- SW1: Start direction control to keep the heading angle at `0`[rad]. - - Press SW0–SW2 or tilt the body sideways to terminate the control. -- SW2: Start direction control to change the heading angle between `-π` and `π`[rad]. - - Press SW0–SW2 or tilt the body sideways to terminate the control. - -> [!NOTE] -> The IMU might not be connected correctly. -> If this happens, unplug and reconnect the USB cable, then run the above command again. - -### Parameters - -- `p_gain` - - Type: `double` - - Default: 10.0, min:0.0, max:30.0 - - Proportional gain of a PID controller for the direction control -- `i_gain` - - Type: `double` - - Default: 0.0, min:0.0, max:5.0 - - Integral gain of a PID controller for the direction control -- `d_gain` - - Type: `double` - - Default: 20.0, min:0.0, max:30.0 - - Derivative gain of a PID controller for the direction control -- `target_angle` - - Type: `double` - - Default: 0.0, min:-π, max:+π - - Target angle for the SW1 (direction control mode). - -### Published - -- `heading_angle` - - Type: `std_msgs/Float64` - - Heading angle of the robot calculated from IMU module sensor values - -[back to example list](#examples) - ---- - -## SLAM & Navigation - -This is an example of SLAM & Navigation. - - - -> [!NOTE] -> The sample for SLAM and Navigation with Raspberry Pi Mouse has been moved to [rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2). - -[back to example list](#examples) - ---- diff --git a/README.en.md b/README.en.md index fb43b9d..5d56e47 100644 --- a/README.en.md +++ b/README.en.md @@ -21,6 +21,12 @@ For running in Gazebo (simulator), see the [rt-net/raspimouse_sim](https://githu - [Source Build](#source-build) - [QuickStart](#quickstart) - [How To Use Examples](#how-to-use-examples) + - [Joystick Control](#joystick-control) + - [Object Tracking](#object-tracking) + - [Line Follower](#line-follower) + - [Camera Line Follower](#camera-line-follower) + - [Direction Controller](#direction-controller) + - [SLAM & Navigation](#slam--navigation) (Relocated [rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)) - [License](#license) - [Contributing](#contributing) @@ -93,15 +99,330 @@ $ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false ## How to Use Examples -The detailed operation of the sample program is explained in d[Examples](./Examples.en.md). +Sample programs for the Raspberry Pi Mouse. -- Examples - - Joystick Control - - Object Tracking - - Line Follower - - Camera Line Follower - - Direction Controller - - SLAM & Navigation (relocated [rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)) +- [Examples](#examples) + - [Joystick Control](#joystick-control) + - [Object Tracking](#object-tracking) + - [Line Follower](#line-follower) + - [Camera Line Follower](#camera-line-follower) + - [Direction Controller](#direction-controller) + - [SLAM & Navigation](#slam--navigation) (Relocated [rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)) + +### Joystick Control + +This is an example with a joystick controller to operate a Raspberry Pi Mouse. + + + joystick_control + + +#### Usage + +Launch nodes with the following command: + +```sh +# Controlled directly on Raspberry Pi Mouse +## Use F710 +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=f710 mouse:=true +## Use DUALSHOCK 3 +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py joydev:="/dev/input/js0" joyconfig:=dualshock3 mouse:=true + +# Control from remote computer +## on RaspberryPiMouse +$ ros2 run raspimouse raspimouse +## on remote computer +$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false +``` + +#### Configure + +This picture shows the default key configuration. + +To use Logicool Wireless Gamepad F710, set the input mode to __D__ (DirectInput Mode). + + + +Key assignments can be edited with key numbers in [./config/joy_f710.yml](./config/joy_f710.yml) or [./config/joy_dualshock3.yml](./config/joy_dualshock3.yml). + +```yaml +button_shutdown_1 : 8 +button_shutdown_2 : 9 + +button_motor_off : 8 +button_motor_on : 9 + +button_cmd_enable : 4 +``` + +[back to example list](#examples) + +--- + +### Object Tracking + +This is a code example for tracking an orange ball based on color information. +The ball tracking is performed with a USB webcam and the OpenCV library. + + + +#### Requirements + +- Web camera + - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) +- Camera mount + - [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) +- Orange ball (Optional) + - [Soft Ball (Orange)](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1307&products_id=3701&language=en) +- Software + - OpenCV + - v4l-utils + +#### Usage + +Disable the automatic camera adjustment parameters (autofocus, auto white balance, etc.) with the following command: + +```sh +$ cd ~/ros2_ws/src/raspimouse_ros2_examples/config +$ ./configure_camera.bash +``` + +Then, launch nodes with the following command: + +```sh +$ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/dev/video0 +``` + +This sample publishes two topics: `camera/color/image_raw` for the camera image and `result_image` for the object detection image. +These images can be viewed with [RViz](https://index.ros.org/r/rviz/) or [rqt_image_view](https://index.ros.org/p/rqt_image_view/). + +> [!NOTE] +> Viewing the images may cause the node to become unstable, resulting in cmd_vel or image topics not being published. + + + +#### Configure + +Edit [`./src/object_tracking_component.cpp`](./src/object_tracking_component.cpp) to change the color of the tracking target. + +If the object detection accuracy is poor, adjust the camera exposure and the parameters in the function. + +```cpp +void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) +{ + cv::inRange(hsv, cv::Scalar(9, 100, 100), cv::Scalar(29, 255, 255), extracted_bin); // Orange + // cv::inRange(hsv, cv::Scalar(60, 100, 100), cv::Scalar(80, 255, 255), extracted_bin); // Green + // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue +``` + +[back to example list](#examples) + +--- + +### Line Follower + +This is an example for line following. + + + +#### Requirements + +- Line following sensor + - [Raspberry Pi Mouse Option kit No.3 \[Line follower\]](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3591&language=en) +- Field and lines for following (Optional) + +#### Usage + +Launch nodes with the following command: + +```sh +$ ros2 launch raspimouse_ros2_examples line_follower.launch.py +``` + +Next, place the Raspberry Pi Mouse on a field and press SW2 to sample sensor values on the field. + + + +Then, place the Raspberry Pi Mouse on the line and press SW1 to sample sensor values. + + + +Finally, place the Raspberry Pi Mouse on the line and press SW0 to start line following. + + + +Press SW0 again to stop the line following. + + + line_follwer + + +#### Configure + +Edit [`./src/line_follower_component.cpp`](./src/line_follower_component.cpp) to change the robot velocity. + +```cpp +void Follower::publish_cmdvel_for_line_following(void) +{ + const double VEL_LINEAR_X = 0.08; // [m/s] + const double VEL_ANGULAR_Z = 0.8; // [rad/s] + const double LOW_VEL_ANGULAR_Z = 0.5; // [rad/s] +``` + +[back to example list](#examples) + +--- + +### Camera Line Follower + +This is an example for line following by RGB camera. + + + +#### Requirements + +- Web camera + - [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n) +- Camera mount + - [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) + +#### Usage + +Launch nodes with the following command: + +```sh +$ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_device:=/dev/video0 +``` + +Place Raspberry Pi Mouse on the line and press SW2 to start line following. +Press SW0 to stop the line following. + +This sample publishes two topics: `camera/color/image_raw` for the camera image and `result_image` for the object detection image. +These images can be viewed in [RViz](https://index.ros.org/r/rviz/) or [rqt_image_view](https://index.ros.org/p/rqt_image_view/). + +> [!NOTE] +> Viewing the images may cause the node to become unstable, resulting in cmd_vel or image topics not being published. + +#### Configure + +If the line detection accuracy is poor, adjust the camera exposure and white balance. + + + +#### Parameters + +- `max_brightness` + - Type: `int` + - Default: 90 + - Maximum threshold value for image binarization. +- `min_brightness` + - Type: `int` + - Default: 0 + - Minimum threshold value for image binarization. +- `max_linear_vel` + - Type: `double` + - Default: 0.05 + - Maximum linear velocity. +- `max_angular_vel` + - Type: `double` + - Default: 0.8 + - Maximum angular velocity. +- `area_threshold` + - Type: `double` + - Default: 0.20 + - Threshold value of the area of the line to start following. + +Run the following command to set the parameters: + +```sh +ros2 param set /camera_follower max_brightness 80 +``` + +[back to example list](#examples) + +--- + +### Direction Controller + +This is an example of using an IMU sensor for direction control. + + + +#### Requirements + +- [USB output 9 degrees IMU sensor module](https://www.rt-shop.jp/index.php?main_page=product_info&products_id=3416&language=en) +- [LiDAR Mount](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1299_1395&products_id=3867) +- RT-USB-9axisIMU ROS Package. + - https://github.com/rt-net/rt_usb_9axisimu_driver + + +IMUセンサモジュールを取り付けたLiDAR MountをRaspberry Pi Mouseに取り付けます。詳細は、[マルチLiDARマウント組み立てマニュアル](https://rt-net.jp/wp-content/uploads/2020/04/RaspberryPiMouseOptionKitManual_No08.pdf)を参照してください。 + +Attach the LiDAR mount with the IMU sensor module to the Raspberry Pi Mouse. For details, refer to the [Multi-LiDAR Mount Assembly Manual (in Japanese)](https://rt-net.jp/wp-content/uploads/2020/04/RaspberryPiMouseOptionKitManual_No08.pdf). + + + +#### Usage + +Launch nodes on the Raspberry Pi Mouse with the following command: + +```sh +$ ros2 launch raspimouse_ros2_examples direction_controller.launch.py +``` + +Then, press SW0–SW2 to change the control mode as follows: + +- SW0: Calibrate the gyroscope bias and reset the Raspberry Pi Mouse's heading angle to `0`[rad]. +- SW1: Start direction control to keep the heading angle at `0`[rad]. + - Press SW0–SW2 or tilt the body sideways to terminate the control. +- SW2: Start direction control to change the heading angle between `-π` and `π`[rad]. + - Press SW0–SW2 or tilt the body sideways to terminate the control. + +> [!NOTE] +> The IMU might not be connected correctly. +> If this happens, unplug and reconnect the USB cable, then run the above command again. + +#### Parameters + +- `p_gain` + - Type: `double` + - Default: 10.0, min:0.0, max:30.0 + - Proportional gain of a PID controller for the direction control +- `i_gain` + - Type: `double` + - Default: 0.0, min:0.0, max:5.0 + - Integral gain of a PID controller for the direction control +- `d_gain` + - Type: `double` + - Default: 20.0, min:0.0, max:30.0 + - Derivative gain of a PID controller for the direction control +- `target_angle` + - Type: `double` + - Default: 0.0, min:-π, max:+π + - Target angle for the SW1 (direction control mode). + +#### Published + +- `heading_angle` + - Type: `std_msgs/Float64` + - Heading angle of the robot calculated from IMU module sensor values + +[back to example list](#examples) + +--- + +### SLAM & Navigation + +This is an example of SLAM & Navigation. + + + +> [!NOTE] +> The sample for SLAM and Navigation with Raspberry Pi Mouse has been moved to [rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2). + +[back to example list](#examples) + +--- ## License From fcca2117fef7ce73eeffbb450c1b9e1c90c3ad60 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 23 Oct 2025 16:21:37 +0900 Subject: [PATCH 28/48] =?UTF-8?q?README.md=E3=81=AE=E3=82=B5=E3=83=B3?= =?UTF-8?q?=E3=83=97=E3=83=AB=E3=81=AE=E3=82=B3=E3=83=BC=E3=83=89=E3=81=8C?= =?UTF-8?q?=E9=95=B7=E3=81=84=E3=81=9F=E3=82=81=E3=80=81=E3=83=96=E3=83=AD?= =?UTF-8?q?=E3=83=83=E3=82=AF=E3=81=A7=E7=95=B3=E3=82=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index c056591..ffd183d 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,9 @@ Raspberry Pi Mouseを動作させるサンプル集です。 joystick_control +
+Usage + #### Usage 次のコマンドでノードを起動します。 @@ -155,6 +158,8 @@ button_motor_on : 9 button_cmd_enable : 4 ``` +
+ [back to example list](#examples) --- @@ -166,6 +171,9 @@ USB接続のWebカメラとOpenCVを使ってボール追跡をします。 +
+Usage + #### Requirements - Webカメラ @@ -217,6 +225,8 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue ``` +
+ [back to example list](#examples) --- @@ -227,6 +237,9 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) +
+Usage + #### Requirements - ライントレースセンサ @@ -271,6 +284,8 @@ void Follower::publish_cmdvel_for_line_following(void) const double LOW_VEL_ANGULAR_Z = 0.5; // rad/s ``` +
+ [back to example list](#examples) --- @@ -281,6 +296,9 @@ RGBカメラによるライントレースのコード例です。 +
+Usage + #### Requirements - Webカメラ @@ -341,6 +359,8 @@ $ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_devi ros2 param set /camera_follower max_brightness 80 ``` +
+ [back to example list](#examples) --- @@ -351,6 +371,9 @@ IMUセンサを使用した角度制御のコード例です。 +
+Usage + #### Requirements - [USB出力9軸IMUセンサモジュール](https://www.rt-shop.jp/index.php?main_page=product_info&cPath=1348_1&products_id=3416&language=ja) @@ -406,6 +429,8 @@ SW0-SW2を押して動作モードを切り替えます。 - Type: `std_msgs/Float64` - IMUモジュールのセンサ値をもとに計算されたロボットの向き(進行方向の角度) +
+ [back to example list](#examples) --- From f40de4a44fd5274118f016ac32d7ec76eb748933 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 23 Oct 2025 16:25:18 +0900 Subject: [PATCH 29/48] =?UTF-8?q?=E6=8A=98=E3=82=8A=E3=81=9F=E3=81=9F?= =?UTF-8?q?=E3=82=80=E3=83=96=E3=83=AD=E3=83=83=E3=82=AF=E5=90=8D=E3=82=92?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ffd183d..bba4cfa 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ Raspberry Pi Mouseを動作させるサンプル集です。
-Usage +Details #### Usage @@ -172,7 +172,7 @@ USB接続のWebカメラとOpenCVを使ってボール追跡をします。
-Usage +Details #### Requirements @@ -238,7 +238,7 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame)
-Usage +Details #### Requirements @@ -297,7 +297,7 @@ RGBカメラによるライントレースのコード例です。
-Usage +Details #### Requirements @@ -372,7 +372,7 @@ IMUセンサを使用した角度制御のコード例です。
-Usage +Details #### Requirements @@ -429,7 +429,7 @@ SW0-SW2を押して動作モードを切り替えます。 - Type: `std_msgs/Float64` - IMUモジュールのセンサ値をもとに計算されたロボットの向き(進行方向の角度) -
+ [back to example list](#examples) From 66cad7a3eed66c5778e87042fbed3789f174c6a7 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 23 Oct 2025 16:39:39 +0900 Subject: [PATCH 30/48] =?UTF-8?q?README.en.md=E3=81=AE=E3=82=B5=E3=83=B3?= =?UTF-8?q?=E3=83=97=E3=83=AB=E9=9B=86=E3=82=92=E3=83=96=E3=83=AD=E3=83=83?= =?UTF-8?q?=E3=82=AF=E3=81=A7=E7=95=B3=E3=82=80=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.en.md b/README.en.md index 5d56e47..fd1551e 100644 --- a/README.en.md +++ b/README.en.md @@ -117,6 +117,9 @@ This is an example with a joystick controller to operate a Raspberry Pi Mouse. joystick_control +
+Details + #### Usage Launch nodes with the following command: @@ -155,6 +158,8 @@ button_motor_on : 9 button_cmd_enable : 4 ``` +
+ [back to example list](#examples) --- @@ -166,6 +171,9 @@ The ball tracking is performed with a USB webcam and the OpenCV library. +
+Details + #### Requirements - Web camera @@ -215,6 +223,8 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue ``` +
+ [back to example list](#examples) --- @@ -225,6 +235,9 @@ This is an example for line following. +
+Details + #### Requirements - Line following sensor @@ -269,6 +282,8 @@ void Follower::publish_cmdvel_for_line_following(void) const double LOW_VEL_ANGULAR_Z = 0.5; // [rad/s] ``` +
+ [back to example list](#examples) --- @@ -279,6 +294,9 @@ This is an example for line following by RGB camera. +
+Details + #### Requirements - Web camera @@ -338,6 +356,8 @@ Run the following command to set the parameters: ros2 param set /camera_follower max_brightness 80 ``` +
+ [back to example list](#examples) --- @@ -348,6 +368,9 @@ This is an example of using an IMU sensor for direction control. +
+Details + #### Requirements - [USB output 9 degrees IMU sensor module](https://www.rt-shop.jp/index.php?main_page=product_info&products_id=3416&language=en) @@ -407,6 +430,8 @@ Then, press SW0–SW2 to change the control mode as follows: - Type: `std_msgs/Float64` - Heading angle of the robot calculated from IMU module sensor values +
+ [back to example list](#examples) --- From 8e97c07bc3e4b11789bcb3af6d81c74d3eb02fc4 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 23 Oct 2025 16:43:44 +0900 Subject: [PATCH 31/48] =?UTF-8?q?Back=20to=20example=20list=E3=81=AE?= =?UTF-8?q?=E3=83=AA=E3=83=B3=E3=82=AF=E5=85=88=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 12 ++++++------ README.md | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.en.md b/README.en.md index fd1551e..b05a2a5 100644 --- a/README.en.md +++ b/README.en.md @@ -160,7 +160,7 @@ button_cmd_enable : 4
-[back to example list](#examples) +[Back to example list](#how-to-use-examples) --- @@ -225,7 +225,7 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame)
-[back to example list](#examples) +[Back to example list](#how-to-use-examples) --- @@ -284,7 +284,7 @@ void Follower::publish_cmdvel_for_line_following(void)
-[back to example list](#examples) +[Back to example list](#how-to-use-examples) --- @@ -358,7 +358,7 @@ ros2 param set /camera_follower max_brightness 80
-[back to example list](#examples) +[Back to example list](#how-to-use-examples) --- @@ -432,7 +432,7 @@ Then, press SW0–SW2 to change the control mode as follows: -[back to example list](#examples) +[Back to example list](#how-to-use-examples) --- @@ -445,7 +445,7 @@ This is an example of SLAM & Navigation. > [!NOTE] > The sample for SLAM and Navigation with Raspberry Pi Mouse has been moved to [rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2). -[back to example list](#examples) +[Back to example list](#how-to-use-examples) --- diff --git a/README.md b/README.md index bba4cfa..89a48a8 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,7 @@ button_cmd_enable : 4 -[back to example list](#examples) +[Back to example list](#how-to-use-examples) --- @@ -227,7 +227,7 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) -[back to example list](#examples) +[Back to example list](#how-to-use-examples) --- @@ -286,7 +286,7 @@ void Follower::publish_cmdvel_for_line_following(void) -[back to example list](#examples) +[Back to example list](#how-to-use-examples) --- @@ -361,7 +361,7 @@ ros2 param set /camera_follower max_brightness 80 -[back to example list](#examples) +[Back to example list](#how-to-use-examples) --- @@ -431,7 +431,7 @@ SW0-SW2を押して動作モードを切り替えます。 -[back to example list](#examples) +[Back to example list](#how-to-use-examples) --- @@ -444,7 +444,7 @@ SLAMとNavigationを行います。 > [!NOTE] > Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 -[back to example list](#examples) +[Back to example list](#how-to-use-examples) --- From ccc991fb8e6e6b395a870f3c3d20a65017302528 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 14:17:34 +0900 Subject: [PATCH 32/48] =?UTF-8?q?apt=20install=20=E3=82=B3=E3=83=9E?= =?UTF-8?q?=E3=83=B3=E3=83=89=E3=81=AB$ROS=5FDISTRO=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: YusukeKato --- README.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.en.md b/README.en.md index b05a2a5..4b28a9f 100644 --- a/README.en.md +++ b/README.en.md @@ -61,7 +61,7 @@ For running in Gazebo (simulator), see the [rt-net/raspimouse_sim](https://githu ### Binary Installation ```sh -sudo apt install raspimouse-ros2-examples +sudo apt install ros-$ROS_DISTRO-raspimouse-ros2-examples ``` ### Source Build From 191909b17d1b1415ed9a390ca8a95016caa7ca5f Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 14:27:13 +0900 Subject: [PATCH 33/48] =?UTF-8?q?README.en.md=E3=81=AE=E4=B8=AD=E3=81=AE?= =?UTF-8?q?=E6=97=A5=E6=9C=AC=E8=AA=9E=E8=A8=98=E8=BF=B0=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.en.md b/README.en.md index 4b28a9f..eaa5ba2 100644 --- a/README.en.md +++ b/README.en.md @@ -378,9 +378,6 @@ This is an example of using an IMU sensor for direction control. - RT-USB-9axisIMU ROS Package. - https://github.com/rt-net/rt_usb_9axisimu_driver - -IMUセンサモジュールを取り付けたLiDAR MountをRaspberry Pi Mouseに取り付けます。詳細は、[マルチLiDARマウント組み立てマニュアル](https://rt-net.jp/wp-content/uploads/2020/04/RaspberryPiMouseOptionKitManual_No08.pdf)を参照してください。 - Attach the LiDAR mount with the IMU sensor module to the Raspberry Pi Mouse. For details, refer to the [Multi-LiDAR Mount Assembly Manual (in Japanese)](https://rt-net.jp/wp-content/uploads/2020/04/RaspberryPiMouseOptionKitManual_No08.pdf). From 3bff3124ce4b6540cba7bbace48e3566ea6edbc8 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 14:30:47 +0900 Subject: [PATCH 34/48] =?UTF-8?q?apt=20install=E3=82=B3=E3=83=9E=E3=83=B3?= =?UTF-8?q?=E3=83=89=E3=81=AB$ROS=5FDISTRO=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: YusukeKato --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89a48a8..bf503c7 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Gazebo(シミュレータ)で動作させる場合は、[rt-net/raspimouse_s ### Binary Installation ```sh -sudo apt install raspimouse-ros2-examples +sudo apt install ros-$ROS_DISTRO-raspimouse-ros2-examples ``` ### Source Build From ad73a166c12fd4223d74be0b54af951eeef07f46 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 14:40:04 +0900 Subject: [PATCH 35/48] =?UTF-8?q?=E8=A9=B3=E7=B4=B0=E3=81=AE=E3=82=BF?= =?UTF-8?q?=E3=83=96=E3=82=92=E4=B8=80=E6=97=A6=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bf503c7..c3c0cf0 100644 --- a/README.md +++ b/README.md @@ -171,8 +171,8 @@ USB接続のWebカメラとOpenCVを使ってボール追跡をします。 -
-Details + #### Requirements @@ -225,7 +225,7 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue ``` -
+ [Back to example list](#how-to-use-examples) From 63d5ba7cedb148ed6a0b9da6fbf81b71f2b4c980 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 14:55:14 +0900 Subject: [PATCH 36/48] =?UTF-8?q?NOTE=E3=81=AE=E8=A3=85=E9=A3=BE=E3=82=92?= =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c3c0cf0..46224e3 100644 --- a/README.md +++ b/README.md @@ -171,8 +171,8 @@ USB接続のWebカメラとOpenCVを使ってボール追跡をします。 - +
+Details #### Requirements @@ -207,6 +207,15 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/ > [!NOTE] > 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 +:warning: NOTE1 +テスト1 + +> :warning: NOTE1 +> テスト1 + +:note: NOTE2 +テスト2 + #### Configure @@ -225,7 +234,7 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame) // cv::inRange(hsv, cv::Scalar(100, 100, 100), cv::Scalar(120, 255, 255), extracted_bin); // Blue ``` - +
[Back to example list](#how-to-use-examples) From dcb3214d62a6b5d014456586eb5ef67b91fddc11 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 15:01:06 +0900 Subject: [PATCH 37/48] =?UTF-8?q?NOTE=E3=81=AE=E8=A8=98=E8=BF=B0=E3=82=92?= =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 46224e3..937b816 100644 --- a/README.md +++ b/README.md @@ -207,14 +207,17 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/ > [!NOTE] > 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 + :warning: NOTE1 -テスト1 +> パターン1の場合はこちら +> 2段目 + -> :warning: NOTE1 -> テスト1 +> :warning: NOTE2 +> +> パターン2の場合はこちら +> 2段目 -:note: NOTE2 -テスト2 From bf21ad779b7bb2e60ae11ce3ba727c2ad4461bf7 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 15:05:21 +0900 Subject: [PATCH 38/48] =?UTF-8?q?NOTE=E3=81=AE=E8=A8=98=E8=BF=B0=E3=82=92?= =?UTF-8?q?=E5=B7=AE=E3=81=97=E3=81=8B=E3=81=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 937b816..f30a80c 100644 --- a/README.md +++ b/README.md @@ -204,19 +204,18 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/ カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 これらの画像は[RViz](https://index.ros.org/r/rviz/)や[rqt_image_view](https://index.ros.org/p/rqt_image_view/)で表示できます。 -> [!NOTE] +> :grey_exclamation: +> > 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 +> :exclamation: +> +> 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 -:warning: NOTE1 -> パターン1の場合はこちら -> 2段目 - - -> :warning: NOTE2 +> :warning: Note > -> パターン2の場合はこちら -> 2段目 +> 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 + From 756f029ee9c145e51d1634747ed35528921fcca6 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 15:07:03 +0900 Subject: [PATCH 39/48] =?UTF-8?q?Note=E3=81=AE=E6=96=87=E5=AD=97=E5=88=97?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f30a80c..d2c1a0f 100644 --- a/README.md +++ b/README.md @@ -204,11 +204,11 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/ カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 これらの画像は[RViz](https://index.ros.org/r/rviz/)や[rqt_image_view](https://index.ros.org/p/rqt_image_view/)で表示できます。 -> :grey_exclamation: +> :grey_exclamation: Note > > 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 -> :exclamation: +> :exclamation: Note > > 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 From 786d41397e689828d2d55b7ee6cc6fbc28f9c00c Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 15:09:27 +0900 Subject: [PATCH 40/48] =?UTF-8?q?=E5=85=A8=E3=81=A6=E3=81=AENote=E3=81=AE?= =?UTF-8?q?=E8=A8=98=E8=BF=B0=E6=B3=95=E3=82=92=E5=B7=AE=E3=81=97=E6=9B=BF?= =?UTF-8?q?=E3=81=88=EF=BC=88
=E3=81=A7=E3=83=8D=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=81=A7=E3=81=8D=E3=82=8B=E5=BD=A2=E5=BC=8F=E3=81=AB=E7=BD=AE?= =?UTF-8?q?=E3=81=8D=E6=8F=9B=E3=81=88=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 12 ++++++++---- README.md | 19 ++++++------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/README.en.md b/README.en.md index eaa5ba2..e339ba5 100644 --- a/README.en.md +++ b/README.en.md @@ -204,7 +204,8 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/ This sample publishes two topics: `camera/color/image_raw` for the camera image and `result_image` for the object detection image. These images can be viewed with [RViz](https://index.ros.org/r/rviz/) or [rqt_image_view](https://index.ros.org/p/rqt_image_view/). -> [!NOTE] +> :warning: Note +> > Viewing the images may cause the node to become unstable, resulting in cmd_vel or image topics not being published. @@ -318,7 +319,8 @@ Press SW0 to stop the line following. This sample publishes two topics: `camera/color/image_raw` for the camera image and `result_image` for the object detection image. These images can be viewed in [RViz](https://index.ros.org/r/rviz/) or [rqt_image_view](https://index.ros.org/p/rqt_image_view/). -> [!NOTE] +> :warning: Note +> > Viewing the images may cause the node to become unstable, resulting in cmd_vel or image topics not being published. #### Configure @@ -398,7 +400,8 @@ Then, press SW0–SW2 to change the control mode as follows: - SW2: Start direction control to change the heading angle between `-π` and `π`[rad]. - Press SW0–SW2 or tilt the body sideways to terminate the control. -> [!NOTE] +> :warning: Note +> > The IMU might not be connected correctly. > If this happens, unplug and reconnect the USB cable, then run the above command again. @@ -439,7 +442,8 @@ This is an example of SLAM & Navigation. -> [!NOTE] +> :warning: Note +> > The sample for SLAM and Navigation with Raspberry Pi Mouse has been moved to [rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2). [Back to example list](#how-to-use-examples) diff --git a/README.md b/README.md index d2c1a0f..13de01b 100644 --- a/README.md +++ b/README.md @@ -204,20 +204,10 @@ $ ros2 launch raspimouse_ros2_examples object_tracking.launch.py video_device:=/ カメラ画像は`camera/color/image_raw`、物体検出画像は`result_image`というトピックとして発行されます。 これらの画像は[RViz](https://index.ros.org/r/rviz/)や[rqt_image_view](https://index.ros.org/p/rqt_image_view/)で表示できます。 -> :grey_exclamation: Note -> -> 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 - -> :exclamation: Note -> -> 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 - > :warning: Note > > 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 - - #### Configure @@ -332,7 +322,8 @@ $ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_devi これらの画像は[RViz](https://index.ros.org/r/rviz/)や[rqt_image_view](https://index.ros.org/p/rqt_image_view/) で表示できます。 -> [!NOTE] +> :warning: Note +> > 画像を表示するとノードの動作が不安定になり、cmd_velや画像トピックが発行されないことがあります。 #### Configure @@ -412,7 +403,8 @@ SW0-SW2を押して動作モードを切り替えます。 - SW2: 方位角を`-π ~ π`[rad]に変化させる角度制御を開始します - SW0–SW2を押すか、ラズパイマウス本体を横に傾けると終了します -> [!NOTE] +> :warning: Note +> > IMUの接続が正常に行われない場合があります。 > その際は、IMUのUSBケーブルを抜き差しした後、コマンドを再度実行してください。 @@ -452,7 +444,8 @@ SLAMとNavigationを行います。 -> [!NOTE] +> :warning: Note +> > Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)へ移行しました。 [Back to example list](#how-to-use-examples) From 9e7d822b2fbefdd54a94aaddf0e853ea88faf9b6 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 15:22:36 +0900 Subject: [PATCH 41/48] =?UTF-8?q?=E4=B8=8D=E8=B6=B3=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=82=8Bdetails=E3=81=AE=E3=83=96=E3=83=AD=E3=83=83?= =?UTF-8?q?=E3=82=AF=E7=B5=82=E7=AB=AF=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13de01b..6c1e079 100644 --- a/README.md +++ b/README.md @@ -432,7 +432,7 @@ SW0-SW2を押して動作モードを切り替えます。 - Type: `std_msgs/Float64` - IMUモジュールのセンサ値をもとに計算されたロボットの向き(進行方向の角度) - +
[Back to example list](#how-to-use-examples) From a5333cafa4978c29aeb4916ef01839c022abf139 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 15:25:42 +0900 Subject: [PATCH 42/48] =?UTF-8?q?QuickStart=E3=81=AE=E9=A0=85=E7=9B=AE?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 16 ---------------- README.md | 16 ---------------- 2 files changed, 32 deletions(-) diff --git a/README.en.md b/README.en.md index e339ba5..dd6d6de 100644 --- a/README.en.md +++ b/README.en.md @@ -19,7 +19,6 @@ For running in Gazebo (simulator), see the [rt-net/raspimouse_sim](https://githu - [Installation](#installation) - [Binary Installation](#binary-installation) - [Source Build](#source-build) - - [QuickStart](#quickstart) - [How To Use Examples](#how-to-use-examples) - [Joystick Control](#joystick-control) - [Object Tracking](#object-tracking) @@ -82,21 +81,6 @@ colcon build --symlink-install source ~/ros2_ws/install/setup.bash ``` -## QuickStart - -Control the Raspberry Pi Mouse remotely with a joystick controller. - -- Supported Controllers - - [Logicool Wireless Gamepad F710](https://gaming.logicool.co.jp/ja-jp/products/gamepads/f710-wireless-gamepad.html#940-0001440) - - [SONY DUALSHOCK 3](https://www.jp.playstation.com/ps3/peripheral/cechzc2j.html) - -```sh -# on RaspberryPiMouse -$ ros2 run raspimouse raspimouse -# on remote computer -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false -``` - ## How to Use Examples Sample programs for the Raspberry Pi Mouse. diff --git a/README.md b/README.md index 6c1e079..09fef4f 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,6 @@ Gazebo(シミュレータ)で動作させる場合は、[rt-net/raspimouse_s - [Installation](#installation) - [Binary Installation](#binary-installation) - [Source Build](#source-build) - - [QuickStart](#quickstart) - [How To Use Examples](#how-to-use-examples) - [Joystick Control](#joystick-control) - [Object Tracking](#object-tracking) @@ -82,21 +81,6 @@ colcon build --symlink-install source ~/ros2_ws/install/setup.bash ``` -## QuickStart - -ジョイスティックコントローラで、Raspberry Pi Mouseをリモート操作します。 - -- 対応コントローラ - - [Logicool Wireless Gamepad F710](https://gaming.logicool.co.jp/ja-jp/products/gamepads/f710-wireless-gamepad.html#940-0001440) - - [SONY DUALSHOCK 3](https://www.jp.playstation.com/ps3/peripheral/cechzc2j.html) - -```sh -# on RaspberryPiMouse -$ ros2 run raspimouse raspimouse -# on remote computer -$ ros2 launch raspimouse_ros2_examples teleop_joy.launch.py mouse:=false -``` - ## How to Use Examples Raspberry Pi Mouseを動作させるサンプル集です。 From f52f901326e7e5ca6d24572b0b4aa1a3dc8dd466 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 15:29:27 +0900 Subject: [PATCH 43/48] =?UTF-8?q?=E8=87=AA=E7=84=B6=E3=81=AA=E6=96=87?= =?UTF-8?q?=E4=BD=93=E3=81=AB=E3=81=AA=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=80=81=E6=96=87=E7=AB=A0=E4=B8=AD=E3=81=AB=E3=82=B9=E3=83=9A?= =?UTF-8?q?=E3=83=BC=E3=82=B9=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 09fef4f..5b03709 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Raspberry Pi Mouseを動作させるサンプル集です。 - [Line Follower](#line-follower) - [Camera Line Follower](#camera-line-follower) - [Direction Controller](#direction-controller) - - [SLAM & Navigation](#slam--navigation)([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) + - [SLAM & Navigation](#slam--navigation) ([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) ### Joystick Control From a5f6fc9ae88aee10fe15121342c12abe809c7347 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 15:34:33 +0900 Subject: [PATCH 44/48] =?UTF-8?q?()=E3=81=AE=E8=A8=98=E8=BF=B0=E3=83=9F?= =?UTF-8?q?=E3=82=B9=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 5b03709..68a0713 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,6 @@ Raspberry Pi Mouseを動作させるサンプル集です。 - [Camera Line Follower](#camera-line-follower) - [Direction Controller](#direction-controller) - [SLAM & Navigation](#slam--navigation) ([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) - ### Joystick Control ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 From 09ff402210ccee3ffe6c87b91150899659753e85 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 15:38:52 +0900 Subject: [PATCH 45/48] =?UTF-8?q?=E3=82=B9=E3=83=9A=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 68a0713..95a139d 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Raspberry Pi Mouseを動作させるサンプル集です。 - [Line Follower](#line-follower) - [Camera Line Follower](#camera-line-follower) - [Direction Controller](#direction-controller) - - [SLAM & Navigation](#slam--navigation) ([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) + - [SLAM & Navigation ](#slam--navigation) ([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) ### Joystick Control ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 From 3473a244ab632f4f376ad49cda0065b76104f02f Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 15:40:38 +0900 Subject: [PATCH 46/48] =?UTF-8?q?=E4=B8=80=E9=83=A8=E3=81=AE=E5=8D=8A?= =?UTF-8?q?=E8=A7=92=E3=82=92=E5=85=A8=E8=A7=92=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 95a139d..8a971ca 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Raspberry Pi Mouseを動作させるサンプル集です。 - [Line Follower](#line-follower) - [Camera Line Follower](#camera-line-follower) - [Direction Controller](#direction-controller) - - [SLAM & Navigation ](#slam--navigation) ([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) + - [SLAM & Navigation](#slam--navigation)([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) ### Joystick Control ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 From 1bd95b96eecfacb9336da60aed5d607211b5811c Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Mon, 27 Oct 2025 15:42:51 +0900 Subject: [PATCH 47/48] =?UTF-8?q?How=20to=20Use=20Examples=E3=81=AE?= =?UTF-8?q?=E7=AE=87=E6=9D=A1=E6=9B=B8=E3=81=8D=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8a971ca..bf350a3 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Gazebo(シミュレータ)で動作させる場合は、[rt-net/raspimouse_s - [Line Follower](#line-follower) - [Camera Line Follower](#camera-line-follower) - [Direction Controller](#direction-controller) - - [SLAM & Navigation](#slam--navigation)([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) + - [SLAM & Navigation](#slam--navigation) ([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) - [License](#license) - [Contributing](#contributing) @@ -91,7 +91,8 @@ Raspberry Pi Mouseを動作させるサンプル集です。 - [Line Follower](#line-follower) - [Camera Line Follower](#camera-line-follower) - [Direction Controller](#direction-controller) - - [SLAM & Navigation](#slam--navigation)([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) + - [SLAM & Navigation](#slam--navigation) ([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) + ### Joystick Control ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。 From 4a89f4d9c35c254a00f67f8b24ca4a015b27a402 Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Thu, 30 Oct 2025 11:37:03 +0900 Subject: [PATCH 48/48] =?UTF-8?q?=E3=83=AA=E3=83=9D=E3=82=B8=E3=83=88?= =?UTF-8?q?=E3=83=AA=E3=83=88=E3=83=83=E3=83=97=E3=81=AEREADME=E3=81=AE?= =?UTF-8?q?=E3=82=B5=E3=83=B3=E3=83=97=E3=83=AB=E3=81=AE=E5=88=97=E6=8C=99?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 6 ------ README.md | 6 ------ 2 files changed, 12 deletions(-) diff --git a/README.en.md b/README.en.md index dd6d6de..0fa373b 100644 --- a/README.en.md +++ b/README.en.md @@ -20,12 +20,6 @@ For running in Gazebo (simulator), see the [rt-net/raspimouse_sim](https://githu - [Binary Installation](#binary-installation) - [Source Build](#source-build) - [How To Use Examples](#how-to-use-examples) - - [Joystick Control](#joystick-control) - - [Object Tracking](#object-tracking) - - [Line Follower](#line-follower) - - [Camera Line Follower](#camera-line-follower) - - [Direction Controller](#direction-controller) - - [SLAM & Navigation](#slam--navigation) (Relocated [rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)) - [License](#license) - [Contributing](#contributing) diff --git a/README.md b/README.md index bf350a3..28aa67a 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,6 @@ Gazebo(シミュレータ)で動作させる場合は、[rt-net/raspimouse_s - [Binary Installation](#binary-installation) - [Source Build](#source-build) - [How To Use Examples](#how-to-use-examples) - - [Joystick Control](#joystick-control) - - [Object Tracking](#object-tracking) - - [Line Follower](#line-follower) - - [Camera Line Follower](#camera-line-follower) - - [Direction Controller](#direction-controller) - - [SLAM & Navigation](#slam--navigation) ([rt-net/raspimouse_slam_navigation_ros2](https://github.com/rt-net/raspimouse_slam_navigation_ros2)に移動しました) - [License](#license) - [Contributing](#contributing)