ros-drivers / um7

ROS driver for UM7 inertial measurement device.
15 stars 49 forks source link

IMU update rate limitation #17

Closed bobbyshashin closed 6 years ago

bobbyshashin commented 6 years ago

Hi,

I ran into an issue that the publishing rate of imu data was somehow limited to around 44.

I tried set the private param update_rate to 50, 100, 200, 254, and did a rostopic hz /imu/data to check the update frequency.

When the update_rate was set to 50, the actual rate was around 33. And it seems to be limited around 44 when the update_rate was set to higher than 100.

Attached is the terminal output:

[ INFO] [1517278895.267544447]: um7_driver successfully connected to serial port /dev/ttyUSB0.
[ INFO] [1517278895.419496168]: Received packet 02 without data.
[ INFO] [1517278895.420370581]: Setting update rate to 100Hz
[ INFO] [1517278895.726487629]: Received packet 02 without data.
[ INFO] [1517278895.748386890]: Received packet 04 without data.
[ INFO] [1517278896.042451602]: Received packet 05 without data.
[ INFO] [1517278896.340316161]: Received packet 06 without data.
[ INFO] [1517278896.764351782]: Received packet 08 without data.
[ INFO] [1517278896.765267983]: Sending command: zero gyroscopes
[ INFO] [1517278896.910323160]: Received packet ad without data.
subscribed to [/imu/data]
average rate: 44.748
    min: 0.012s max: 0.045s std dev: 0.01272s window: 44
average rate: 44.300
    min: 0.012s max: 0.045s std dev: 0.01280s window: 88
average rate: 44.155
    min: 0.012s max: 0.045s std dev: 0.01278s window: 132
average rate: 44.126
    min: 0.012s max: 0.045s std dev: 0.01277s window: 176
average rate: 44.074
    min: 0.012s max: 0.045s std dev: 0.01275s window: 220
average rate: 43.873
    min: 0.012s max: 0.060s std dev: 0.01292s window: 263
average rate: 43.616
    min: 0.012s max: 0.064s std dev: 0.01327s window: 305
average rate: 43.397
    min: 0.012s max: 0.064s std dev: 0.01349s window: 347
average rate: 43.227
    min: 0.012s max: 0.064s std dev: 0.01366s window: 389
average rate: 43.292
    min: 0.012s max: 0.064s std dev: 0.01357s window: 433
average rate: 43.360
    min: 0.012s max: 0.064s std dev: 0.01351s window: 477
cynosure4sure commented 6 years ago

have you found a solution to this? For rate of update_rate=80 I get 60Hz and if I set update_rate>80 I get buffer overflow, something like: [ WARN] [1517616760.842450021]: Serial read buffer is 455, now flushing in an attempt to catch up. [ WARN] [1517616760.910278452]: Discarded 10 junk byte(s) preceeding packet.

bobbyshashin commented 6 years ago

@cynosure4sure Haven't yet :( I never encounter your overflow issue though. However, I am using a very old um7 IMU (probably bought 2~3 years ago), and I cannot flush its firmware due to some serial connection error while using the serial interface provided by the manufacturer.

I suspect that the firmware inside is some old version that does not work perfectly together with the ROS driver here, which causes my publish rate issue. I just ordered two new um7, and will update on this issue when they arrive.

bobbyshashin commented 6 years ago

Update:

@cynosure4sure Finally I found a solution to this. The publishing rate is limited by the baud rate of the serial interface. The baud rate can be configured through the following way:

1. Download the Redshift Serial Interface software

2. Connect your UM7 to the PC through the serial interface software (default rate should be 115200).

1

3. Go to the Configuration tab, click read, then go to "Misc. Settings" -> "Baud Rate".

2

Select 230400 or higher (to get ~100Hz publishing rate, make sure your computer's port support that baud rate).

Then click "RAM" and then "FLASH".

4. Now go back to the Serial Settings tab, click disconnect.

5. Change the baud rate to the one you just set, click connect again. Then repeat step 3 once.

6. Now the baud rate should be set properly.

To double-check, disconnect UM7 from your computer, then plug it back in. Go through step 1 to 3 to ensure that the default baud rate is indeed changed, since there is an confusing issue described here.

7. Change the parameters related to baud rate configuration in this ROS driver. There should be two numbers to be changed in main.cpp.

8. Re-compile, restart the roscore and run it.

cynosure4sure commented 6 years ago

Thank you for the reply. I had actually done this previously. I set the baud rate to 921600 and I can connect to the IMU but it gives buffer overflow problem. I am also running an old firmware U71C but from the pictures you posted it looks like you are running the latest version of firmware i.e. U72A. A workaround solution to my problem is to go back to kernel number 4.4.0.62 and it works at 200Hz. Any kernel version above it doesn't work for me unfortunately.