ElettraSciComp / witmotion_IMU_ros

ROS wrapper for the family of IMU sensor devices manufactured by Witmotion Ltd.
MIT License
29 stars 36 forks source link

[ROS2] WT901C issues #29

Closed Chambana closed 1 year ago

Chambana commented 1 year ago

environment:

Ubuntu 22.04
ROS2 Humble
pulled repo today

I'm getting good data off the sensor with the message enumerator utility and witmotionctl-wt901 util, but only the /temperature topic is getting published in ROS2 (the /imu and /orientation topics are not publishing). See below.

My output looks correct at 9600 on ttyUSB0:

~/ros2_ws/build/witmotion_ros/witmotion-uart-qt$ ./witmotionctl-wt901
    Creating multithreaded interface for Witmotion WT901 IMU sensor connected to ttyUSB0 at 9600 baud
    Running reader thread
    Opening device "ttyUSB0" at 9600 baud
    Instantiating timer at 50 ms
    1   Accelerations [X|Y|Z]:  [ 0.36883 | 0.11017 | 9.93454 ], temp 32.03000 degrees, in 0.00000 s
    2   Angular velocities [X|Y|Z]: [ 0.00000 | 0.00000 | 0.00000 ], temp 32.03000 degrees, in 0.00006 s
    3   Euler angles [R|P|Y]:   [ 0.62073 | -2.10388 | 174.33105 ], temp 181.24001 degrees,  in 0.00003 s
    4   Magnetic field [X|Y|Z]: [ 560.00000 | -6488.00000 | -4700.00000 ], temp 0.00000 degrees,  in 0.00001 s
    5   Accelerations [X|Y|Z]:  [ 0.36883 | 0.09580 | 9.88664 ], temp 32.00000 degrees, in 0.00000 s
    6   Angular velocities [X|Y|Z]: [ 0.00000 | 0.00000 | 0.00000 ], temp 32.00000 degrees, in 0.00000 s
    7   Euler angles [R|P|Y]:   [ 0.62073 | -2.10388 | 174.33105 ], temp 181.24001 degrees,  in 0.00000 s
    8   Magnetic field [X|Y|Z]: [ 555.00000 | -6466.00000 | -4693.00000 ], temp 0.00000 degrees,  in 0.00000 s
    9   Accelerations [X|Y|Z]:  [ 0.36404 | 0.11017 | 9.96328 ], temp 32.01000 degrees, in 0.00000 s
    10  Angular velocities [X|Y|Z]: [ 0.00000 | 0.00000 | 0.00000 ], temp 32.01000 degrees, in 0.00000 s
    11  Euler angles [R|P|Y]:   [ 0.62073 | -2.10388 | 174.33105 ], temp 181.24001 degrees,  in 0.00000 s
    12  Magnetic field [X|Y|Z]: [ 558.00000 | -6473.00000 | -4679.00000 ], temp 0.00000 degrees,  in 0.00000 s
    13  Accelerations [X|Y|Z]:  [ 0.36404 | 0.11017 | 9.95370 ], temp 32.01000 degrees, in 0.00000 s

./message-enumerator
    Press Ctrl+C to stop enumeration and see the report
    Opening device "ttyUSB0" at 9600 baud
    Instantiating timer at 50 ms
    ^C
    Closing TTL connection

    WITMOTION UART MESSAGE ENUMERATOR BY TWDRAGON

    Acquired at Wednesday, June 14, 2023 5:47:02 PM CDT

    ID  Qty Description

    0x51    780 Accelerations
    0x52    781 Angular velocities
    0x53    781 Spatial orientation (Euler angles)
    0x54    781 Magnetometer/Magnetic orientation

        Unknown IDs: 0 [  ] 
    Total messages: 3123

This is what the node outputs (i set the wt901 config file to 9600 baud and sourced it). Should the output continue after the QT Spin line?

$ ros2 launch witmotion_ros wt901.launch.py 
[INFO] [launch]: All log files can be found below /home/alluvial/.ros/log/2023-06-14-18-16-01-248129-dampers-8129
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [witmotion_ros_node-1]: process started with pid [8130]
[witmotion_ros_node-1] [INFO] [1686784561.373864647] [ROSWitmotionSensorController]: Controller started
[witmotion_ros_node-1] [INFO] [1686784561.373946602] [MinimalPublisher]: QT spin !!!!!
Chambana commented 1 year ago

Is there any further debug output I can produce to help diagnose the problem?

Chambana commented 1 year ago

I didn't figure out why I didn't get much data out of the box, but for anyone that finds this issue do this for the WT901C-TTL:

Find a windows machine and load up Witmotion software. I never got unit to display in 3D realtime in windows, but I was able to change the settings to set the WT901C to 115200 baud and 20hz update rate. I also turned on quaternions, accel, gyro, etc. After that, I got the ROS2 data output I needed from this repo.

twdragon commented 1 year ago

@Chambana it seems that the sensor settings out of the box are quite low: 9600 baud at 10 Hz or even worse