ElettraSciComp / witmotion_IMU_ros

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

HWT906 not showing any data #45

Closed musstt closed 2 weeks ago

musstt commented 2 weeks ago

this is my config.yaml file

witmotion_imu:
    port: ttyUSB0
    baud_rate: 115200 # baud
    polling_interval: 50 # ms
    timeout_ms: 150 # ms
    restart_service_name: /restart_imu
    imu_publisher:
        topic_name: /imu
        frame_id: imu
        use_native_orientation: false
        measurements:
            acceleration:
                enabled: true
                covariance: [ 0.0088,    0,       0,
                              0,         0.0550,  0,
                              0,         0,       0.0267 ]
            angular_velocity:
                enabled: true
                covariance: [ 0.1199,    0,       0,
                              0,         0.5753,  0,
                              0,         0,       0.0267 ]
            orientation:
                enabled: true
                covariance: [ 0.0190,    0,       0,
                              0,         0.0120,  0,
                              0,         0,       0.0107 ]
    temperature_publisher:
        enabled: false
        topic_name: /temperature
        frame_id: base_link
        from_message: magnetometer # acceleration, angular_vel, orientation, magnetometer
        variance: 0.02683
        coefficient: 1.0 # Linear calibration parameters: coefficient
        addition: 0.0 # and addendum
    magnetometer_publisher:
        enabled: true
        topic_name: /magnetometer
        frame_id: imu
        coefficient: 0.00000001 # Linear calibration parameters: coefficient
        addition: 0.0 # and addendum
        covariance: [ 0.000000187123,   0,              0,
                      0,                0.000000105373, 0,
                      0,                0,              0.000000165816  ]
    barometer_publisher:
        enabled: true
        topic_name: /barometer
        frame_id: base_link
        variance: 0.001
        coefficient: 1.0 # Linear calibration parameters: coefficient
        addition: 0.0 # and addendum
    altimeter_publisher:
        enabled: true
        topic_name: /altitude
        coefficient: 1.0 # Linear calibration parameters: coefficient
        addition: 0.0 # and addendum
    orientation_publisher:
        enabled: true
        topic_name: /orientation
    gps_publisher:
        enabled: false
        navsat_fix_frame_id: world
        navsat_fix_topic_name: /gps
        navsat_altitude_topic_name: /gps_altitude
        navsat_satellites_topic_name: /gps_satellites
        navsat_variance_topic_name: /gps_variance
        ground_speed_topic_name: /gps_ground_speed
    rtc_publisher:
        enabled: true
        topic_name: /witmotion_clock
        presync: true

i dont know what parameter need to be set true and false

musstt commented 2 weeks ago

Press Ctrl+C to stop enumeration and see the report Opening device "ttyUSB0" at 19200 baud Instantiating timer at 50 ms ^C Closing TTL connection

WITMOTION UART MESSAGE ENUMERATOR BY TWDRAGON

Acquired at Rabu, 06 November 2024 22.19.29 WIB

ID Qty Description

0x51 2 Accelerations 0x54 1 Magnetometer/Magnetic orientation 0x55 9 Data ports (D0-D3) status

Unknown IDs: 0 [  ] 

Total messages: 12

i try message enumator

twdragon commented 2 weeks ago

@musstt you should disable anything except Accelerations in the IMU ROS message builder, otherwise it will never consider the data structure complete, so:

    imu_publisher:
        topic_name: /imu
        frame_id: imu
        use_native_orientation: false
        measurements:
            acceleration:
                enabled: true
                covariance: [ 0.0088,    0,       0,
                              0,         0.0550,  0,
                              0,         0,       0.0267 ]
            angular_velocity:
-                 enabled: true
+                enabled: false
                covariance: [ 0.1199,    0,       0,
                              0,         0.5753,  0,
                              0,         0,       0.0267 ]
            orientation:
-                 enabled: true
+                enabled: false
                covariance: [ 0.0190,    0,       0,
                              0,         0.0120,  0,
                              0,         0,       0.0107 ]
twdragon commented 2 weeks ago

@musstt if you will have success, please do not hesitate to create the test report here: #16

musstt commented 2 weeks ago

what about the baud rate and polling interval parameters?

musstt commented 2 weeks ago

and another publisher? should i change the enable parameters to false?

musstt commented 2 weeks ago

musthofa@musthofa-ubuntu:~$ rosrun witmotion_ros message-enumerator -d ttyUSB0 -b 19200 -p 50 Press Ctrl+C to stop enumeration and see the report Opening device "ttyUSB0" at 19200 baud Instantiating timer at 50 ms ^C Closing TTL connection

WITMOTION UART MESSAGE ENUMERATOR BY TWDRAGON

Acquired at Rabu, 06 November 2024 22.30.38 WIB

ID Qty Description

0x51 2 Accelerations 0x54 1 Magnetometer/Magnetic orientation 0x55 2 Data ports (D0-D3) status 0x57 1 GPS Coordinates 0x59 1 Spatial orientation (Quaternion)

Unknown IDs: 0 [  ] 

Total messages: 7

musthofa@musthofa-ubuntu:~$ rosrun witmotion_ros message-enumerator -d ttyUSB0 -b 19200 -p 50 Press Ctrl+C to stop enumeration and see the report Opening device "ttyUSB0" at 19200 baud Instantiating timer at 50 ms ^C Closing TTL connection

WITMOTION UART MESSAGE ENUMERATOR BY TWDRAGON

Acquired at Rabu, 06 November 2024 22.32.15 WIB

ID Qty Description

0x51 2 Accelerations 0x55 1 Data ports (D0-D3) status

Unknown IDs: 0 [  ] 

Total messages: 3

i try another message enumator, but it seems like not consistent

twdragon commented 2 weeks ago

@musstt these parameters should be set up according to the actual settings of your device. Now I see only IMU and Magnetometer publishers should be enabled.

Update For now it seems 19200 baud is sufficient, but you should use one of the example controller applications or the official Witmotion application to set the parameters directly on the device

musstt commented 2 weeks ago

image what do you think?

musstt commented 2 weeks ago

image

twdragon commented 2 weeks ago

@musstt I recommend you reduce the baudrate to 115200, adjust the polling rate to 10 ms, and output rate to 100 Hz, and then set up the bandwidth accordingly. 1 KHz, as I see, will be less accurate (due to the Kalman filter) and redundant for most applications.

twdragon commented 2 weeks ago

@musstt sorry but I need to close this issue here, as your device is working and there are no bugs reported. Please, if you need still to reach me, do not hesitate to open a discussion on ROS Discourse mentioning me as @twdragon and inserting a link to this issue (#45)

musstt commented 2 weeks ago

Wait, could you tell me what parameters enable should be true or false, i cant figure it out although i see from the windows application, sorry

twdragon commented 2 weeks ago

@musstt you should set up enabled to all measurements in the IMU, and Magnetometer, it is enough for your setup. But please adjust in the official app the baudrate, and then set it up in your config accordingly.

twdragon commented 2 weeks ago

@musstt once you see them in the Content section of the official app, then you should enable them in the config

musstt commented 2 weeks ago

Thank you so much!!!!! It works!!!!!