2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

USB出力9軸IMUセンサモジュール

Posted at

環境

ubuntu18.04
ROS melodic

USB出力9軸IMUセンサモジュールのインストール

下記のgithubから
https://github.com/rt-net/rt_usb_9axisimu_driver/wiki
https://github.com/rt-net/rt_usb_9axisimu_driver/

cd ~/workspace/usb_9axisimu/src
git clone https://github.com/rt-net/rt_usb_9axisimu_driver.git
cd ~/workspace/usb_9axisimu
catkin build

USB出力9軸IMUセンサモジュールの実行

ターミナルごとに実行

source ~/workspace/usb_9axisimu/devel/setup.bash

launchファイルの実行

sudo chmod 666 /dev/ttyACM0 ※これしないとエラーが出る
roslaunch rt_usb_9axisimu_driver rt_usb_9axisimu_driver.launch  [or]
(rosrun rt_usb_9axisimu_driver rt_usb_9axisimu_driver) 

※ちゃんとしたUSBケーブルじゃないと認識しないので注意

rostopic list

ここで3つのデータが確認できればOK

配信データ形式をASCII形式からBinary形式への変更

githubのマニュアル

まずはttyACM0の中身を再生

sudo cat /dev/ttyACM0  
  • IMUのデータが流れてる画面でIMUのタクトスイッチを長押し3秒以上して設定画面を出す
  • タクトスイッチを短く押して modeset 8 を選び3秒長押し
  • 2 BINARY を選び3秒長押し

データを可視化

下記実行

rosrun rqt_plot rqt_plot
  • 以下の項目をプラスボタンから追加する

並進加速度
/imu/data_raw/linear_acceleration/x
/imu/data_raw/linear_acceleration/y 
/imu/data_raw/linear_acceleration/z

角速度
/imu/data_raw/angular_velocity/x
/imu/data_raw/angular_velocity/y
/imu/data_raw/angular_velocity/z

magnetic_field
/imu/mag/magnetic_field/x
/imu/mag/magnetic_field/y
/imu/mag/magnetic_field/z

4.1.1 パブリッシュされるトピック
/imu/data_raw(sensor_msgs/Imu)
並進加速度と角速度の生データ
/imu/mag(sensor_msgs/MagneticField)
磁束密度の生データ
/imu/temperature(std_msgs/Float64)
センサの温度データ

4.1.2 パラメータ
~port (string, default: /dev/ttyACM0)
モジュールが接続されているポート名
~linear_acceleration_stddev (double, default: 0.023145)
並進加速度の共分散行列の対角成分の平方根(m/s^2)
~angular_velocity_stddev (double, default: 0.0010621)
角速度の共分散行列の対角成分の平方根(rad/s)
~magnetic_field_stddev (double, default: 0.00000080786)
磁束密度の共分散行列の対角成分の平方根(T)

サンプルプログラムの実行

Linux, Mac環境でBinary出力を確認するサンプルプログラム
https://www.rt-net.jp/products/9axisimu2
https://github.com/rt-net/RT-USB-9AXIS-00
https://github.com/rt-net/RT-USB-9AXIS-00/tree/master/LinuxSampleProgram

mkdir workspace/9AXIS_sample
cd 9AXIS_sample
git clone https://github.com/rt-net/RT-USB-9AXIS-00.git

ポートの権限を設定する

サンプルプログラムを動かす前に、デバイスファイルの権限を設定してください。
9軸センサモジュールをPCに接続したあと、下記のコマンドを実行してください。
※/dev/ttyACM0 は環境によって名前が変わります。

sudo chmod 666 /dev/ttyACM0

サンプルプログラムのデバイスファイル名を変更する

usb9axis_test.cの70行目にてデバイスファイル名を指定してください。

cd workspace/9AXIS_sample/RT-USB-9AXIS-00/LinuxSampleProgram 
nano usb9axis_test.c
int main(int argc, char **argv){
    char serial_port[128]="/dev/ttyACM0"; // ここにデバイスファイル名を入力する

usb9axis_test.cをgccでコンパイルしてください。

gcc usb9axis_test.c 

サンプルプログラムを実行する

./a.out

別の方法

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?