Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROS 2 Jazzy対応 #62

Merged
merged 30 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
32258fe
The header file "cv_bridge.h" in the cv_bridge package has been renam…
KuraZuzu Sep 13, 2024
e42f8de
Replaced "Twist" with "TwistStamped" in "joystick_control.py"
KuraZuzu Sep 24, 2024
b051ed5
Replaced "Twist" with "TwistStamped" for "camera_line_follower.launch…
KuraZuzu Sep 27, 2024
9e0cf80
Replaced "Twist" with "TwistStamped" for "object_tracking.launch.py"
KuraZuzu Sep 27, 2024
1bc80b5
Replaced "Twist" with "TwistStamped" (Changed in all instances, rever…
KuraZuzu Sep 30, 2024
3480ac9
Modify CI to ensure compatibility with the act tool
KuraZuzu Oct 24, 2024
fefd643
Add author
KuraZuzu Oct 24, 2024
5bb5d4a
Update README for Support Jazzy
KuraZuzu Nov 18, 2024
5996db3
Add CI settings for Rolling
KuraZuzu Nov 18, 2024
00a8b6a
Revert "Add CI settings for Rolling"
KuraZuzu Nov 19, 2024
7b7a517
Replace ROS_REPO: [ros] with ROS_REPO: [main]
KuraZuzu Nov 19, 2024
b9605cd
Add rosinstall for CI
KuraZuzu Nov 19, 2024
0a42043
Adapt clang-format with Google style
KuraZuzu Nov 19, 2024
356a417
Fix order of include in c file
KuraZuzu Nov 19, 2024
a06b8a9
Revert "Add rosinstall for CI"
KuraZuzu Nov 20, 2024
37db57d
Reapply "Add rosinstall for CI"
KuraZuzu Nov 20, 2024
8797078
Revert "Fix order of include in c file"
KuraZuzu Nov 20, 2024
304f82b
Revert "Adapt clang-format with Google style"
KuraZuzu Nov 20, 2024
6c632e6
fix typo of distribution name
KuraZuzu Nov 20, 2024
2c1d411
Applied "ament_clang_format" and passed cpplint, with manual adjustme…
KuraZuzu Nov 20, 2024
0c851db
Adapted ruff formetter
KuraZuzu Nov 20, 2024
3e395d3
fix "import" module order
KuraZuzu Nov 20, 2024
182da8d
Adaptted "ament_uncrustify"
KuraZuzu Nov 20, 2024
26f8117
Update README.en.md fo Jazzy
KuraZuzu Nov 20, 2024
738aa9f
Fix pictures and page links
KuraZuzu Nov 20, 2024
5518f2f
Fix images for README in japanese
KuraZuzu Nov 20, 2024
8098d9e
Update Copyright years
KuraZuzu Nov 21, 2024
89e2187
Fix Indent and replace .h with .hpp
KuraZuzu Nov 22, 2024
54d5b6f
FIxed autho name
KuraZuzu Nov 22, 2024
40305e9
Add warnings for camera settings
KuraZuzu Nov 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/.ci.rosinstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- git:
uri: https://github.com/rt-net/raspimouse2.git
local-name: raspimouse2
version: jazzy
- git:
uri: https://github.com/rt-net/rt_usb_9axisimu_driver.git
local-name: rt_usb_9axisimu_driver
version: jazzy
13 changes: 9 additions & 4 deletions .github/workflows/industrial_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ on:
schedule:
- cron: "0 2 * * 0" # Weekly on Sundays at 02:00

env:
UPSTREAM_WORKSPACE: .github/workflows/.ci.rosinstall

jobs:
industrial_ci:
strategy:
fail-fast: false
matrix:
env:
- { ROS_DISTRO: humble, ROS_REPO: ros }
ROS_DISTRO: [jazzy]
ROS_REPO: [main]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: "ros-industrial/industrial_ci@master"
env: ${{ matrix.env }}
env:
ROS_DISTRO: ${{matrix.ROS_DISTRO}}
ROS_REPO: ${{matrix.ROS_REPO}}
33 changes: 16 additions & 17 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,24 @@ To run on Gazebo, click [here](https://github.com/rt-net/raspimouse_sim/blob/ros

## Supported ROS 2 distributions

- [Foxy](https://github.com/rt-net/raspimouse_ros2_examples/tree/foxy-devel)
- Humble (This branch)
- [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 22.04
- https://ubuntu.com/download/raspberry-pi
- Ubuntu server 24.04
- Device Driver
- [rt-net/RaspberryPiMouse](https://github.com/rt-net/RaspberryPiMouse)
- ROS
- [Humble Hawksbill](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html)
- [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
- [Humble Hawksbill](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html)
- [Jazzy Jalisco](https://docs.ros.org/en/jazzy/index.html)
- Raspberry Pi Mouse ROS 2 package
- https://github.com/rt-net/raspimouse2

Expand All @@ -41,7 +40,7 @@ To run on Gazebo, click [here](https://github.com/rt-net/raspimouse_sim/blob/ros
```sh
$ cd ~/ros2_ws/src
# Clone package
$ git clone -b $ROS_DISTRO-devel https://github.com/rt-net/raspimouse_ros2_examples.git
$ git clone -b $ROS_DISTRO https://github.com/rt-net/raspimouse_ros2_examples.git

# Install dependencies
$ rosdep install -r -y --from-paths . --ignore-src
Expand Down Expand Up @@ -71,7 +70,7 @@ This repository is licensed under the Apache 2.0, see [LICENSE](./LICENSE) for d

This is an example to use joystick controller to control a Raspberry Pi Mouse.

#### Requirements
#### Requirements

- Joystick Controller
- [Logicool Wireless Gamepad F710](https://gaming.logicool.co.jp/ja-jp/products/gamepads/f710-wireless-gamepad.html#940-0001440)
Expand Down Expand Up @@ -122,15 +121,15 @@ button_cmd_enable : 4

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

---
---

### object_tracking

<img src=https://rt-net.github.io/images/raspberry-pi-mouse/object_tracking.JPG width=500 />

This is an example to use RGB camera images and OpenCV library for object tracking.

#### Requirements
#### Requirements

- Web camera
- [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n)
Expand Down Expand Up @@ -190,7 +189,7 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame)

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

---
---

### line_follower

Expand Down Expand Up @@ -256,7 +255,7 @@ void Follower::publish_cmdvel_for_line_following(void)

This is an example for line following by RGB camera.

#### Requirements
#### Requirements

- Web camera
- [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n)
Expand Down Expand Up @@ -316,7 +315,7 @@ ros2 param set /camera_follower max_brightness 80

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

---
---

### SLAM

Expand All @@ -330,13 +329,13 @@ SLAM and Navigation examples for Raspberry Pi Mouse is [here](https://github.com

### direction_controller

<img src=https://www.rt-net.jp/wp-content/uploads/2018/02/img-usb9s_01.png width=500 />
<img src=https://www.rt-shop.jp/images/RT/RT-USB-9axisIMU.png width=200 /> <img src=https://www.rt-shop.jp/images/RT/%E8%A3%BD%E5%93%81%E5%86%99%E7%9C%9F.JPG height=200>

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&cPath=1348_1&products_id=3416&language=en)
- [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
Expand Down Expand Up @@ -369,8 +368,8 @@ Then, press SW0 ~ SW2 to change the control mode as following,

### Troubleshooting

The IMU might not be connected correctly.
Reconnect the USB cable several times and re-execute the above command.
The IMU might not be connected correctly.
Reconnect the USB cable several times and re-execute the above command.

#### Configure

Expand Down
41 changes: 20 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,24 @@ Gazebo(シミュレータ)でも動作します。詳細は[こちら](https

## Supported ROS 2 distributions

- [Foxy](https://github.com/rt-net/raspimouse_ros2_examples/tree/foxy-devel)
- Humble (This branch)
- [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 22.04
- https://ubuntu.com/download/raspberry-pi
- Ubuntu server 24.04
- Device Driver
- [rt-net/RaspberryPiMouse](https://github.com/rt-net/RaspberryPiMouse)
- ROS
- [Humble Hawksbill](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html)
- [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
- [Humble Hawksbill](https://dcs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html)
- [Jazzy Jalisco](https://docs.ros.org/en/jazzy/index.html)
- Raspberry Pi Mouse ROS 2 package
- https://github.com/rt-net/raspimouse2

Expand All @@ -41,7 +40,7 @@ Gazebo(シミュレータ)でも動作します。詳細は[こちら](https
```sh
$ cd ~/ros2_ws/src
# Clone package
$ git clone -b $ROS_DISTRO-devel https://github.com/rt-net/raspimouse_ros2_examples.git
$ git clone -b $ROS_DISTRO https://github.com/rt-net/raspimouse_ros2_examples.git

# Install dependencies
$ rosdep install -r -y --from-paths . --ignore-src
Expand All @@ -54,7 +53,7 @@ $ source ~/ros2_ws/install/setup.bash

## License

このリポジトリはApache 2.0ライセンスの元、公開されています。
このリポジトリはApache 2.0ライセンスの元、公開されています。
ライセンスについては[LICENSE](./LICENSE)を参照ください。

## How To Use Examples
Expand All @@ -72,7 +71,7 @@ $ source ~/ros2_ws/install/setup.bash

ジョイスティックコントローラでRaspberryPiMouseを動かすコード例です。

#### Requirements
#### Requirements

- Joystick Controller
- [Logicool Wireless Gamepad F710](https://gaming.logicool.co.jp/ja-jp/products/gamepads/f710-wireless-gamepad.html#940-0001440)
Expand Down Expand Up @@ -123,7 +122,7 @@ button_cmd_enable : 4

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

---
---

### object_tracking

Expand All @@ -132,7 +131,7 @@ button_cmd_enable : 4
色情報をもとにオレンジ色のボールの追跡を行うコード例です。
USB接続のWebカメラとOpenCVを使ってボール追跡をします。

#### Requirements
#### Requirements

- Webカメラ
- [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n)
Expand Down Expand Up @@ -194,7 +193,7 @@ void Tracker::tracking(const cv::Mat & input_frame, cv::Mat & result_frame)

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

---
---

### line_follower

Expand Down Expand Up @@ -252,15 +251,15 @@ void Follower::publish_cmdvel_for_line_following(void)

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

---
---

### camera_line_follower

<img src=https://rt-net.github.io/images/raspberry-pi-mouse/mouse_camera_line_trace_2.png width=500 />

RGBカメラによるライントレースのコード例です。

#### Requirements
#### Requirements

- Webカメラ
- [Logicool HD WEBCAM C310N](https://www.logicool.co.jp/ja-jp/product/hd-webcam-c310n)
Expand Down Expand Up @@ -309,7 +308,7 @@ $ ros2 launch raspimouse_ros2_examples camera_line_follower.launch.py video_devi
- Type: `double`
- Default: 0.8
- 旋回速度の最大値
- `area_threthold`
- `area_threshold`
- Type: `double`
- Default: 0.20
- 走行を開始するためのライン面積のしきい値
Expand All @@ -320,7 +319,7 @@ ros2 param set /camera_follower max_brightness 80

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

---
---

### SLAM

Expand All @@ -334,7 +333,7 @@ Raspberry Pi MouseでSLAMとNavigationを行うサンプルは[rt-net/raspimouse

### direction_controller

<img src=https://www.rt-net.jp/wp-content/uploads/2018/02/img-usb9s_01.png width=500 />
<img src=https://www.rt-shop.jp/images/RT/RT-USB-9axisIMU.png width=200 /> <img src=https://www.rt-shop.jp/images/RT/%E8%A3%BD%E5%93%81%E5%86%99%E7%9C%9F.JPG height=200>

IMUセンサを使用した角度制御のコード例です。

Expand Down Expand Up @@ -373,9 +372,9 @@ SW0 ~ SW2を押して動作モードを切り替えます。

### Troubleshooting

IMUの接続が正常に行われない場合があります。
その時は、IMUのUSBケーブルを抜き差ししてください。
抜き差し実施後は、コマンドを再度実行してください。
IMUの接続が正常に行われない場合があります。
その時は、IMUのUSBケーブルを抜き差ししてください。
抜き差し実施後は、コマンドを再度実行してください。

#### Configure

Expand Down Expand Up @@ -410,7 +409,7 @@ Set parameter successful
- 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.
Expand Down
31 changes: 15 additions & 16 deletions include/raspimouse_ros2_examples/camera_line_follower_component.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 RT Corporation
// Copyright 2023-2024 RT Corporation
YusukeKato marked this conversation as resolved.
Show resolved Hide resolved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -26,7 +26,7 @@
#include "std_msgs/msg/string.hpp"
#include "std_srvs/srv/set_bool.hpp"
#include "sensor_msgs/msg/image.hpp"
#include "geometry_msgs/msg/twist.hpp"
#include "geometry_msgs/msg/twist_stamped.hpp"
#include "opencv2/highgui/highgui.hpp"

namespace camera_line_follower
Expand All @@ -50,30 +50,29 @@ class CameraFollower : public rclcpp_lifecycle::LifecycleNode
cv::Point2d object_normalized_point_;
double object_normalized_area_;
std::shared_ptr<rclcpp_lifecycle::LifecyclePublisher<sensor_msgs::msg::Image>> result_image_pub_;
std::shared_ptr<rclcpp_lifecycle::LifecyclePublisher<geometry_msgs::msg::Twist>> cmd_vel_pub_;
std::shared_ptr<rclcpp_lifecycle::LifecyclePublisher<geometry_msgs::msg::TwistStamped>>
cmd_vel_pub_;
std::shared_ptr<rclcpp::Client<std_srvs::srv::SetBool>> motor_power_client_;
rclcpp::Subscription<sensor_msgs::msg::Image>::SharedPtr image_sub_;
rclcpp::Subscription<raspimouse_msgs::msg::Switches>::SharedPtr switches_sub_;
rclcpp::TimerBase::SharedPtr cmd_vel_timer_;

void set_motor_power(const bool motor_on);
std::string mat_type2encoding(const int mat_type) const;
void convert_frame_to_message(
const cv::Mat & frame,
sensor_msgs::msg::Image & msg) const;
void convert_frame_to_message(const cv::Mat & frame, sensor_msgs::msg::Image & msg) const;

bool detect_line(const cv::Mat & input_frame, cv::Mat & result_frame);

rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
on_configure(const rclcpp_lifecycle::State &);
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
on_activate(const rclcpp_lifecycle::State &);
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
on_deactivate(const rclcpp_lifecycle::State &);
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
on_cleanup(const rclcpp_lifecycle::State &);
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
on_shutdown(const rclcpp_lifecycle::State &);
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn on_configure(
const rclcpp_lifecycle::State &);
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn on_activate(
const rclcpp_lifecycle::State &);
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn on_deactivate(
const rclcpp_lifecycle::State &);
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn on_cleanup(
const rclcpp_lifecycle::State &);
rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn on_shutdown(
const rclcpp_lifecycle::State &);
};

} // namespace camera_line_follower
Expand Down
Loading