diff --git a/.github/workflows/industrial_ci.yml b/.github/workflows/industrial_ci.yml index 042d926..3355069 100644 --- a/.github/workflows/industrial_ci.yml +++ b/.github/workflows/industrial_ci.yml @@ -14,11 +14,20 @@ jobs: industrial_ci: strategy: matrix: - env: - - { ROS_DISTRO: humble, ROS_REPO: ros, AFTER_SETUP_TARGET_WORKSPACE: 'apt update && apt install -y git' } + ROS_DISTRO: [jazzy] + 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 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}} + BUILD_TOOL_ARGS: "--event-handlers console_direct+" + COLCON_LOG_LEVEL: debug + VERBOSE_OUTPUT: true 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) 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 . 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 - diff --git a/test/test_driver.cpp b/test/test_driver.cpp index f303765..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 @@ -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;