From 3359fb5f5f037c857d55b13073ac02d2b565289b Mon Sep 17 00:00:00 2001 From: KuraZuzu Date: Thu, 24 Oct 2024 13:38:24 +0900 Subject: [PATCH 01/11] fix "ROS_DISTRO" of CI for Jazzy --- .github/workflows/industrial_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/industrial_ci.yml b/.github/workflows/industrial_ci.yml index 042d926..8529036 100644 --- a/.github/workflows/industrial_ci.yml +++ b/.github/workflows/industrial_ci.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: env: - - { ROS_DISTRO: humble, ROS_REPO: ros, AFTER_SETUP_TARGET_WORKSPACE: 'apt update && apt install -y git' } + - { ROS_DISTRO: jazzy, ROS_REPO: ros, AFTER_SETUP_TARGET_WORKSPACE: 'apt update && apt install -y git' } runs-on: ubuntu-latest steps: From 6d70c06a9c4858bb8fd6d14d79a4acdeaa314780 Mon Sep 17 00:00:00 2001 From: KuraZuzu Date: Thu, 24 Oct 2024 13:38:49 +0900 Subject: [PATCH 02/11] Add authors --- package.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.xml b/package.xml index c7c4671..bf29b38 100644 --- a/package.xml +++ b/package.xml @@ -7,6 +7,8 @@ RT Corporation RT Corporation + Yusuke Kato + Kazushi Kurasawa BSD @@ -29,4 +31,3 @@ ament_cmake - From 0a9b3edabfeff836404c238308220e2177697c27 Mon Sep 17 00:00:00 2001 From: KuraZuzu Date: Thu, 24 Oct 2024 13:39:28 +0900 Subject: [PATCH 03/11] Update README for Jazzy --- README.md | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 137adde..0e16575 100644 --- a/README.md +++ b/README.md @@ -2,30 +2,22 @@ # rt_usb_9axisimu_driver -株式会社アールティが販売しているUSB出力9軸IMUセンサモジュール用のROS 2パッケージです。 +[![industrial_ci](https://github.com/rt-net/rt_usb_9axisimu_driver/workflows/industrial_ci/badge.svg?branch=ros2-devel)](https://github.com/rt-net/rt_usb_9axisimu_driver/actions?query=workflow%3Aindustrial_ci+branch%3Aros2-devel) + +株式会社アールティが販売しているUSB出力9軸IMUセンサモジュール用のROS 2パッケージです。 ![usb-9axisimu](https://rt-net.github.io/images/usb-9axisimu/usb-9axisimu.png) 現在、以下のROSのディストリビューションに対応しております。 -- Melodic ([`melodic-devel`](https://github.com/rt-net/rt_usb_9axisimu_driver/tree/melodic-devel)) -- Noetic ([`noetic-devel`](https://github.com/rt-net/rt_usb_9axisimu_driver/tree/noetic-devel)) -- Foxy ([`foxy-devel`](https://github.com/rt-net/rt_usb_9axisimu_driver/tree/foxy-devel)) -- Humble ([`humble-devel`](https://github.com/rt-net/rt_usb_9axisimu_driver/tree/humble-devel)) - -| | industrial_ci | source build | amd64 binary | arm64 binary | -|:---:|:---:|:---:|:---:|:---:| -| main develop
([`master`](https://github.com/rt-net/rt_usb_9axisimu_driver/tree/master)) | [![industrial_ci](https://github.com/rt-net/rt_usb_9axisimu_driver/workflows/industrial_ci/badge.svg?branch=master)](https://github.com/rt-net/rt_usb_9axisimu_driver/actions?query=workflow%3Aindustrial_ci+branch%3Amaster) | - | - | - | - | -| ROS 2 develop
([`ros2-devel`](https://github.com/rt-net/rt_usb_9axisimu_driver/tree/ros2-devel)) | [![industrial_ci](https://github.com/rt-net/rt_usb_9axisimu_driver/workflows/industrial_ci/badge.svg?branch=ros2-devel)](https://github.com/rt-net/rt_usb_9axisimu_driver/actions?query=workflow%3Aindustrial_ci+branch%3Aros2-devel) | - | - | - | - | -| Bionic + Melodic
([`melodic-devel`](https://github.com/rt-net/rt_usb_9axisimu_driver/tree/melodic-devel)) | [![industrial_ci](https://github.com/rt-net/rt_usb_9axisimu_driver/workflows/industrial_ci/badge.svg?branch=melodic-devel)](https://github.com/rt-net/rt_usb_9axisimu_driver/actions?query=workflow%3Aindustrial_ci+branch%3Amelodic-devel) | [![Build Status](http://build.ros.org/job/Msrc_uB__rt_usb_9axisimu_driver__ubuntu_bionic__source/badge/icon)](http://build.ros.org/job/Msrc_uB__rt_usb_9axisimu_driver__ubuntu_bionic__source/) | [![Build Status](http://build.ros.org/view/Mbin_uB64/job/Mbin_uB64__rt_usb_9axisimu_driver__ubuntu_bionic_amd64__binary/badge/icon)](http://build.ros.org/view/Mbin_uB64/job/Mbin_uB64__rt_usb_9axisimu_driver__ubuntu_bionic_amd64__binary/) | [![Build Status](http://build.ros.org/job/Mbin_ubv8_uBv8__rt_usb_9axisimu_driver__ubuntu_bionic_arm64__binary/badge/icon)](http://build.ros.org/job/Mbin_ubv8_uBv8__rt_usb_9axisimu_driver__ubuntu_bionic_arm64__binary/) | -| Focal + Noetic
([`noetic-devel`](https://github.com/rt-net/rt_usb_9axisimu_driver/tree/noetic-devel)) | [![industrial_ci](https://github.com/rt-net/rt_usb_9axisimu_driver/workflows/industrial_ci/badge.svg?branch=noetic-devel)](https://github.com/rt-net/rt_usb_9axisimu_driver/actions?query=workflow%3Aindustrial_ci+branch%3Anoetic-devel) | - | - | - | - | -| Focal + Foxy
([`foxy-devel`](https://github.com/rt-net/rt_usb_9axisimu_driver/tree/foxy-devel)) | [![industrial_ci](https://github.com/rt-net/rt_usb_9axisimu_driver/workflows/industrial_ci/badge.svg?branch=foxy-devel)](https://github.com/rt-net/rt_usb_9axisimu_driver/actions?query=workflow%3Aindustrial_ci+branch%3Afoxy-devel) | [![Build Status](https://build.ros2.org/view/Fsrc_uF/job/Fsrc_uF__rt_usb_9axisimu_driver__ubuntu_focal__source/badge/icon)](https://build.ros2.org/view/Fsrc_uF/job/Fsrc_uF__rt_usb_9axisimu_driver__ubuntu_focal__source/) |[![Build Status](https://build.ros2.org/view/Fsrc_uF/job/Fbin_uF64__rt_usb_9axisimu_driver__ubuntu_focal_amd64__binary/badge/icon)](https://build.ros2.org/view/Fsrc_uF/job/Fbin_uF64__rt_usb_9axisimu_driver__ubuntu_focal_amd64__binary/) | [![Build Status](https://build.ros2.org/view/Fbin_ubv8_uFv8/job/Fbin_ubv8_uFv8__rt_usb_9axisimu_driver__ubuntu_focal_arm64__binary/badge/icon)](https://build.ros2.org/view/Fbin_ubv8_uFv8/job/Fbin_ubv8_uFv8__rt_usb_9axisimu_driver__ubuntu_focal_arm64__binary/) | -**TODO: Add Jammy + Humble** + +- ROS 2 Humble ([`humble`](https://github.com/rt-net/rt_usb_9axisimu_driver/tree/humble)) +- ROS 2 Jazzy ([`jazzy`](https://github.com/rt-net/rt_usb_9axisimu_driver/tree/jazzy)) ## 1. 概要 rt_usb_9axisimu_driverは株式会社アールティが販売している [USB出力9軸IMUセンサモジュール](https://www.rt-net.jp/products/9axisimu2/) -のROS 2パッケージです。 +のROS 2パッケージです。 株式会社アールティによって開発、メンテナンスがなされています。 @@ -33,22 +25,22 @@ rt_usb_9axisimu_driverは株式会社アールティが販売している ### 1.1 座標軸について -USB出力9軸IMUセンサモジュールは、センサとしてInvenSense社のMPU9250を使用しております。 +USB出力9軸IMUセンサモジュールは、センサとしてInvenSense社のMPU9250を使用しております。 このセンサの磁気センサの座標系はNED座標系(x-north, y-east, z-down)ですが、 モジュール内のマイコン(LPC1343)においてENU座標系(x-east, y-north, z-up)に変換され、 -ジャイロセンサおよび加速度センサの座標系と揃えられております。 +ジャイロセンサおよび加速度センサの座標系と揃えられております。 これはROSで使われる座標系のルールにも適合しています。詳しくは、[REP-0103](http://www.ros.org/reps/rep-0103.html#axis-orientation)をご覧ください。 ### 1.2 ファームウェア開発について -USB出力9軸IMUセンサモジュールはオープンハード・オープンソースのため、モジュール内のマイコンのファームウェアの変更が可能です。 +USB出力9軸IMUセンサモジュールはオープンハード・オープンソースのため、モジュール内のマイコンのファームウェアの変更が可能です。 このROSパッケージはデフォルトのファームウェアにのみ対応しております。ファームウェアを変更された場合、正常な動作ができなくなる恐れがございますので、ご了承ください。 ### 1.3 ver2.0でのご利用について -2020年8月現在、販売されているUSB出力9軸IMUセンサモジュールはver2.0となります。 -このバージョンのデフォルトのファームウェアには、ASCII出力とBinary出力の2つのデータ出力形式があります。 -センサ出荷時点ではASCII出力に設定されています。出力形式の切り替え方法は、以下のリポジトリにあるマニュアルをご参照ください。 +2020年8月現在、販売されているUSB出力9軸IMUセンサモジュールはver2.0となります。 +このバージョンのデフォルトのファームウェアには、ASCII出力とBinary出力の2つのデータ出力形式があります。 +センサ出荷時点ではASCII出力に設定されています。出力形式の切り替え方法は、以下のリポジトリにあるマニュアルをご参照ください。 https://github.com/rt-net/RT-USB-9AXIS-00 ### [ERROR] Error opening sensor device, please re-check your devices. が発生する場合 @@ -61,16 +53,13 @@ $ sudo chmod 666 /dev/ttyACM0 ## 2. インストール - -ROS Melodic等ROS 1のパッケージについては[`master`](https://github.com/rt-net/rt_usb_9axisimu_driver/tree/master)ブランチのREADMEをご覧ください。 - ### 2.1 バイナリをインストールする場合 ```sh -# ROS 2 Foxy -$ sudo apt install ros-foxy-rt-usb-9axisimu-driver -# ROS 2 Humble +# ROS 2 Humble $ sudo apt install ros-humble-rt-usb-9axisimu-driver +# ROS 2 Jazzy (ToDo) +$ ``` ### 2.2 ソースからインストールする場合 @@ -78,7 +67,7 @@ $ sudo apt install ros-humble-rt-usb-9axisimu-driver ```sh $ cd ~/ros2_ws/src # Clone package & checkout ROS 2 branch -$ git clone -b $ROS_DISTRO-devel https://github.com/rt-net/rt_usb_9axisimu_driver +$ git clone -b $ROS_DISTRO https://github.com/rt-net/rt_usb_9axisimu_driver # Install dependencies $ rosdep install -r -y -i --from-paths . From 0f3f9443ae7d841aef142e5303c4d06d4a803dbb Mon Sep 17 00:00:00 2001 From: KuraZuzu Date: Thu, 24 Oct 2024 16:17:34 +0900 Subject: [PATCH 04/11] Modify CI to ensure compatibility with the act tool --- .github/workflows/industrial_ci.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/industrial_ci.yml b/.github/workflows/industrial_ci.yml index 8529036..d7d8207 100644 --- a/.github/workflows/industrial_ci.yml +++ b/.github/workflows/industrial_ci.yml @@ -14,11 +14,15 @@ jobs: industrial_ci: strategy: matrix: - env: - - { ROS_DISTRO: jazzy, ROS_REPO: ros, AFTER_SETUP_TARGET_WORKSPACE: 'apt update && apt install -y git' } + ROS_DISTRO: [jazzy] + ROS_REPO: [ros] + AFTER_SETUP_TARGET_WORKSPACE: [apt update && apt install -y git] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: "ros-industrial/industrial_ci@master" - env: ${{ matrix.env }} + env: + ROS_DISTRO: ${{matrix.ROS_DISTRO}} + ROS_REPO: ${{matrix.ROS_REPO}} + AFTER_SETUP_TARGET_WORKSPACE: ${{matrix.AFTER_SETUP_TARGET_WORKSPACE}} From 3ba008f41c9dafdf95fa865395310a7a301b82c4 Mon Sep 17 00:00:00 2001 From: KuraZuzu Date: Mon, 28 Oct 2024 16:47:45 +0900 Subject: [PATCH 05/11] Add messages of compiler version message for debug --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2db4440..4ac4734 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,10 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif() +message(STATUS "CMake Version: ${CMAKE_VERSION}") +message(STATUS "C++ Compiler: ${CMAKE_CXX_COMPILER}") +message(STATUS "C++ Compiler Version: ${CMAKE_CXX_COMPILER_VERSION}") +message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") # find dependencies find_package(ament_cmake REQUIRED) From a5a47f8d4cd6caa659100c4184c39d49da1c5226 Mon Sep 17 00:00:00 2001 From: KuraZuzu Date: Mon, 28 Oct 2024 17:29:44 +0900 Subject: [PATCH 06/11] add ccache setting --- .github/workflows/industrial_ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/industrial_ci.yml b/.github/workflows/industrial_ci.yml index d7d8207..de3539a 100644 --- a/.github/workflows/industrial_ci.yml +++ b/.github/workflows/industrial_ci.yml @@ -16,7 +16,9 @@ jobs: matrix: ROS_DISTRO: [jazzy] ROS_REPO: [ros] - AFTER_SETUP_TARGET_WORKSPACE: [apt update && apt install -y git] + AFTER_SETUP_TARGET_WORKSPACE: [apt update && apt install -y git gcc-11 g++-11] + env: + CCACHE_DIR: "${{ github.workspace }}/.ccache" # ccache directory runs-on: ubuntu-latest steps: From bd012479f7ec46b8d87aa1bacdbbce3964506771 Mon Sep 17 00:00:00 2001 From: KuraZuzu Date: Mon, 28 Oct 2024 17:31:44 +0900 Subject: [PATCH 07/11] Set log level "debug" for CI --- .github/workflows/industrial_ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/industrial_ci.yml b/.github/workflows/industrial_ci.yml index de3539a..21418bc 100644 --- a/.github/workflows/industrial_ci.yml +++ b/.github/workflows/industrial_ci.yml @@ -28,3 +28,6 @@ jobs: ROS_DISTRO: ${{matrix.ROS_DISTRO}} ROS_REPO: ${{matrix.ROS_REPO}} AFTER_SETUP_TARGET_WORKSPACE: ${{matrix.AFTER_SETUP_TARGET_WORKSPACE}} + BUILD_TOOL_ARGS: "--event-handlers console_direct+" + COLCON_LOG_LEVEL: debug + VERBOSE_OUTPUT: true From c2cf4eb816e4a9118bf2e9953b852eb9441e42af Mon Sep 17 00:00:00 2001 From: KuraZuzu Date: Wed, 30 Oct 2024 17:40:15 +0900 Subject: [PATCH 08/11] comment out env for debug --- .github/workflows/industrial_ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/industrial_ci.yml b/.github/workflows/industrial_ci.yml index 21418bc..66644ad 100644 --- a/.github/workflows/industrial_ci.yml +++ b/.github/workflows/industrial_ci.yml @@ -17,8 +17,8 @@ jobs: ROS_DISTRO: [jazzy] ROS_REPO: [ros] AFTER_SETUP_TARGET_WORKSPACE: [apt update && apt install -y git gcc-11 g++-11] - env: - CCACHE_DIR: "${{ github.workspace }}/.ccache" # ccache directory + # env: + # CCACHE_DIR: "${{ github.workspace }}/.ccache" # ccache directory for debug runs-on: ubuntu-latest steps: From c946d533a3ccf0c6a0ba960675058944815e2b48 Mon Sep 17 00:00:00 2001 From: KuraZuzu Date: Wed, 30 Oct 2024 17:42:35 +0900 Subject: [PATCH 09/11] Replace "ROS_REPO: [ros]" with "ROS_REPO: [main]" for CI of "ROS 2" --- .github/workflows/industrial_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/industrial_ci.yml b/.github/workflows/industrial_ci.yml index 66644ad..3355069 100644 --- a/.github/workflows/industrial_ci.yml +++ b/.github/workflows/industrial_ci.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: ROS_DISTRO: [jazzy] - ROS_REPO: [ros] + ROS_REPO: [main] AFTER_SETUP_TARGET_WORKSPACE: [apt update && apt install -y git gcc-11 g++-11] # env: # CCACHE_DIR: "${{ github.workspace }}/.ccache" # ccache directory for debug From 4efec581994339d330710315c08141efd4ccc7ef Mon Sep 17 00:00:00 2001 From: KuraZuzu Date: Wed, 30 Oct 2024 18:08:40 +0900 Subject: [PATCH 10/11] Fix undefined behavior by storing `std::string` objects instead of `const 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. --- test/test_driver.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/test/test_driver.cpp b/test/test_driver.cpp index f303765..8626519 100644 --- a/test/test_driver.cpp +++ b/test/test_driver.cpp @@ -198,29 +198,30 @@ unsigned int create_dummy_ascii_imu_data(unsigned char *buf, bool is_invalid) { unsigned int create_dummy_ascii_imu_data(unsigned char *buf, bool is_invalid, double *gyro, double *acc, double *mag, double temp) { rt_usb_9axisimu::Consts consts; - std::vector dummy_ascii_imu_data(consts.IMU_ASCII_DATA_SIZE); + std::vector dummy_ascii_imu_data(consts.IMU_ASCII_DATA_SIZE); if (is_invalid) { dummy_ascii_imu_data[consts.IMU_ASCII_TIMESTAMP] = "0.0"; } else { dummy_ascii_imu_data[consts.IMU_ASCII_TIMESTAMP] = "0"; } - dummy_ascii_imu_data[consts.IMU_ASCII_GYRO_X] = double_to_string(gyro[0]).c_str(); - dummy_ascii_imu_data[consts.IMU_ASCII_GYRO_Y] = double_to_string(gyro[1]).c_str(); - dummy_ascii_imu_data[consts.IMU_ASCII_GYRO_Z] = double_to_string(gyro[2]).c_str(); - dummy_ascii_imu_data[consts.IMU_ASCII_ACC_X] = double_to_string(acc[0]).c_str(); - dummy_ascii_imu_data[consts.IMU_ASCII_ACC_Y] = double_to_string(acc[1]).c_str(); - dummy_ascii_imu_data[consts.IMU_ASCII_ACC_Z] = double_to_string(acc[2]).c_str(); - dummy_ascii_imu_data[consts.IMU_ASCII_MAG_X] = double_to_string(mag[0]).c_str(); - dummy_ascii_imu_data[consts.IMU_ASCII_MAG_Y] = double_to_string(mag[1]).c_str(); - dummy_ascii_imu_data[consts.IMU_ASCII_MAG_Z] = double_to_string(mag[2]).c_str(); - dummy_ascii_imu_data[consts.IMU_ASCII_TEMP] = double_to_string(temp).c_str(); + dummy_ascii_imu_data[consts.IMU_ASCII_GYRO_X] = double_to_string(gyro[0]); + dummy_ascii_imu_data[consts.IMU_ASCII_GYRO_Y] = double_to_string(gyro[1]); + dummy_ascii_imu_data[consts.IMU_ASCII_GYRO_Z] = double_to_string(gyro[2]); + dummy_ascii_imu_data[consts.IMU_ASCII_ACC_X] = double_to_string(acc[0]); + dummy_ascii_imu_data[consts.IMU_ASCII_ACC_Y] = double_to_string(acc[1]); + dummy_ascii_imu_data[consts.IMU_ASCII_ACC_Z] = double_to_string(acc[2]); + dummy_ascii_imu_data[consts.IMU_ASCII_MAG_X] = double_to_string(mag[0]); + dummy_ascii_imu_data[consts.IMU_ASCII_MAG_Y] = double_to_string(mag[1]); + dummy_ascii_imu_data[consts.IMU_ASCII_MAG_Z] = double_to_string(mag[2]); + dummy_ascii_imu_data[consts.IMU_ASCII_TEMP] = double_to_string(temp); const char split_char = ','; const char newline_char = '\n'; buf[0] = (unsigned char)newline_char; unsigned int char_count = 1; for(int i = 0; i < consts.IMU_ASCII_DATA_SIZE; i++) { - for(int j = 0; j < (int)strlen(dummy_ascii_imu_data.at(i)); j++) { - buf[char_count] = (unsigned char)dummy_ascii_imu_data.at(i)[j]; + const char* data_str = dummy_ascii_imu_data.at(i).c_str(); + for(int j = 0; j < (int)strlen(data_str); j++) { + buf[char_count] = (unsigned char)data_str[j]; char_count++; } if(i != consts.IMU_ASCII_DATA_SIZE - 1) buf[char_count] = (unsigned char)split_char; From 066d4cdefec1eee413107557c93e4c93348a5b13 Mon Sep 17 00:00:00 2001 From: KuraZuzu Date: Thu, 31 Oct 2024 09:31:26 +0900 Subject: [PATCH 11/11] Update copyright year --- test/test_driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_driver.cpp b/test/test_driver.cpp index 8626519..b0fe305 100644 --- a/test/test_driver.cpp +++ b/test/test_driver.cpp @@ -3,7 +3,7 @@ * * License: BSD-3-Clause * - * Copyright (c) 2015-2023 RT Corporation + * Copyright (c) 2015-2024 RT Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy