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への対応 #61

Merged
merged 11 commits into from
Oct 31, 2024
Merged

ROS 2 Jazzyへの対応 #61

merged 11 commits into from
Oct 31, 2024

Conversation

KuraZuzu
Copy link
Contributor

@KuraZuzu KuraZuzu commented Oct 30, 2024

What does this implement/fix?

ROS 2 Jazzyにドキュメントとテストを対応させます。

Does this close any currently open issues?

しません。

How has this been tested?

Raspberry Pi 4Bで動作確認しました。

動作環境

  • Raspberry Pi 4B (4GB model)
  • Ubuntu Server 24.04 (Linux ubuntu 6.8.0-1012-raspi)

手順

README.mdにある手順での動作確認を実施しました。

クローン・ビルド

$ cd ~/ros2_ws/src

# Clone package & checkout ROS 2 branch
$ git clone -b feature/support-jazzy https://github.com/rt-net/rt_usb_9axisimu_driver

# Clone package & checkout ROS 2 branch
$ git clone -b $ROS_DISTRO https://github.com/rt-net/rt_usb_9axisimu_driver

# Install dependencies
$ rosdep install -r -y -i --from-paths .
$ rosdep install -r -y -i --from-paths .

# Build & Install
$ cd ~/ros2_ws
$ colcon build --symlink-install
$ source ~/ros2_ws/install/setup.bash

動作

# Terminal 1
$ source ~/ros2_ws/install/setup.bash
$ ros2 run rt_usb_9axisimu_driver rt_usb_9axisimu_driver

# (以下のlaunchファイルからの起動での動作確認も実施しました)
# $ ros2 launch rt_usb_9axisimu_driver rt_usb_9axisimu_driver.launch.py
# Terminal 2
$ source ~/ros2_ws/install/setup.bash
$ ros2 lifecycle set rt_usb_9axisimu_driver configure
$ ros2 lifecycle set rt_usb_9axisimu_driver activate

$ ros2 topic echo /imu/data_raw
$ ros2 topic echo /imu/mag
$ ros2 topic echo /imu/temperature

各種センサの値が読めていることを確認しました。

Any other comments?

$ROS_DISTRO -develブランチから-develを除いた$ROS_DISTROブランチを想定したドキュメントに変更しているので、後ほど、Humble-develブランチからHumbleブランチを作成する必要があります。

Checklists

…onst char*` pointers

Previously, the test code for the 9-axis IMU was storing `const char*` pointers obtained from temporary `std::string` objects into a vector. Since these temporary `std::string` objects are destroyed immediately after the expression, the stored pointers became invalid (dangling pointers), leading to undefined behavior and causing tests to fail.
This commit fixes the issue by changing the vector to store *std::string* objects directly instead of `const char*` pointers. By maintaining the `std::string` objects, we ensure that the data remains valid throughout its usage, and any `c_str()` calls on these strings return valid pointers.

This change resolves the test failures and prevents potential crashes or incorrect data processing due to invalid memory access.
@KuraZuzu KuraZuzu added the Type: Feature New Feature label Oct 30, 2024
@KuraZuzu KuraZuzu requested a review from YusukeKato October 30, 2024 09:16
Copy link
Contributor

@YusukeKato YusukeKato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

変更内容、良いと思います。
テストの修正ありがとうございます。

@YusukeKato
Copy link
Contributor

Ubuntu 24.04 LTS + ROS 2 Jazzyでテストが通ることの確認と実機での動作確認が完了しました。
LGTMです。

@YusukeKato YusukeKato merged commit 9138e0d into ros2-devel Oct 31, 2024
2 checks passed
@YusukeKato YusukeKato deleted the feature/support-jazzy branch October 31, 2024 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants