imu_3dm_gx4 icon indicating copy to clipboard operation
imu_3dm_gx4 copied to clipboard

Problems with high baudrates

Open hbadino opened this issue 10 years ago • 4 comments

Hi,

first of all, thanks for making this driver open source. I'm pretty sure the robotics community appreciates it.

I have a question regarding the baudrate. I'm able to run my 3DM-GX4-25 without any problems at baudrates 115200 and 230400. Setting the baudrate to 460800 is not always possible and I have to retry several times until it works. The max baudrate of 921600 always fails. The very first time I try with the max baudrate I get this error:

... logging to /home/hbadino/.ros/log/cda72c8c-3f8d-11e5-a219-14dda925ae96/roslaunch-PowerMotion-11802.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://PowerMotion:56630/

SUMMARY

PARAMETERS

  • /imu/baudrate: 921600
  • /imu/device: /dev/ttyUSB0
  • /imu/enable_accel_update: False
  • /imu/enable_filter: False
  • /imu/enable_mag_update: False
  • /imu/filter_rate: 100
  • /imu/frame_id: imu
  • /imu/imu_rate: 420
  • /imu/verbose: True
  • /rosdistro: indigo
  • /rosversion: 1.11.13

NODES / imu (imu_3dm_gx4/imu_3dm_gx4)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found process[imu-1]: started with pid [11820] [ INFO] [1439232889.437564255]: Selecting baud rate 921600 Switching to baud rate 9600 Switched baud rate to 9600 Sending a ping packet. Timed out reading response to: SyncMSB: 75 SyncLSB: 65 Descriptor: 1 Length: 2 Payload: 2 1 Check MSB: e0 Check LSB: c6 Timed out waiting for ping response. Switching to baud rate 19200 Switched baud rate to 19200 Sending a ping packet. Timed out reading response to: SyncMSB: 75 SyncLSB: 65 Descriptor: 1 Length: 2 Payload: 2 1 Check MSB: e0 Check LSB: c6 Timed out waiting for ping response. Switching to baud rate 115200 Switched baud rate to 115200 Sending a ping packet. Timed out reading response to: SyncMSB: 75 SyncLSB: 65 Descriptor: 1 Length: 2 Payload: 2 1 Check MSB: e0 Check LSB: c6 Timed out waiting for ping response. Switching to baud rate 230400 Switched baud rate to 230400 Sending a ping packet. Handling read : 75 Handling read : 65 Handling read : 1 Handling read : 4 Handling read : 4 Handling read : f1 Handling read : 1 0 Handling read : d5 Handling read : 6a Found correct baudrate. Instructing device to change to 921600 Sending command: SyncMSB: 75 SyncLSB: 65 Descriptor: c Length: 7 Payload: 7 40 1 0 e 10 0 Check MSB: 53 Check LSB: 9d Handling read : 75 65 c Handling read : 4 Handling read : 4 Handling read : f1 Handling read : 40 Handling read : 0 Handling read : 1f Handling read : 2a Sending command: SyncMSB: 75 SyncLSB: 65 Descriptor: 1 Length: 2 Payload: 2 1 Check MSB: e0 Check LSB: c6 Timed out reading response to: SyncMSB: 75 SyncLSB: 65 Descriptor: 1 Length: 2 Payload: 2 1 Check MSB: e0 Check LSB: c6 [ERROR] [1439232901.947359999]: Exception: Device did not respond to ping. Timed-out while reading. Time-out limit is 300ms.

Sending command: SyncMSB: 75 SyncLSB: 65 Descriptor: 1 Length: 2 Payload: 2 2 Check MSB: e1 Check LSB: c7 [imu-1] process has finished cleanly log file: /home/hbadino/.ros/log/cda72c8c-3f8d-11e5-a219-14dda925ae96/imu-1*.log all processes on machine have died, roslaunch will exit shutting down processing monitor... ... shutting down processing monitor complete done

After that first try, I get a different error message which reads:

... logging to /home/hbadino/.ros/log/cda72c8c-3f8d-11e5-a219-14dda925ae96/roslaunch-PowerMotion-12064.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://PowerMotion:45413/

SUMMARY

PARAMETERS

  • /imu/baudrate: 921600
  • /imu/device: /dev/ttyUSB0
  • /imu/enable_accel_update: False
  • /imu/enable_filter: False
  • /imu/enable_mag_update: False
  • /imu/filter_rate: 100
  • /imu/frame_id: imu
  • /imu/imu_rate: 420
  • /imu/verbose: True
  • /rosdistro: indigo
  • /rosversion: 1.11.13

NODES / imu (imu_3dm_gx4/imu_3dm_gx4)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found process[imu-1]: started with pid [12082] [ INFO] [1439233295.508459550]: Selecting baud rate 921600 Switching to baud rate 9600 Switched baud rate to 9600 Sending a ping packet. Timed out reading response to: SyncMSB: 75 SyncLSB: 65 Descriptor: 1 Length: 2 Payload: 2 1 Check MSB: e0 Check LSB: c6 Timed out waiting for ping response. Switching to baud rate 19200 Switched baud rate to 19200 Sending a ping packet. Timed out reading response to: SyncMSB: 75 SyncLSB: 65 Descriptor: 1 Length: 2 Payload: 2 1 Check MSB: e0 Check LSB: c6 Timed out waiting for ping response. Switching to baud rate 115200 Switched baud rate to 115200 Sending a ping packet. Timed out reading response to: SyncMSB: 75 SyncLSB: 65 Descriptor: 1 Length: 2 Payload: 2 1 Check MSB: e0 Check LSB: c6 Timed out waiting for ping response. Switching to baud rate 230400 Switched baud rate to 230400 Sending a ping packet. Timed out reading response to: SyncMSB: 75 SyncLSB: 65 Descriptor: 1 Length: 2 Payload: 2 1 Check MSB: e0 Check LSB: c6 Timed out waiting for ping response. Switching to baud rate 460800 Switched baud rate to 460800 Sending a ping packet. Timed out reading response to: SyncMSB: 75 SyncLSB: 65 Descriptor: 1 Length: 2 Payload: 2 1 Check MSB: e0 Check LSB: c6 Timed out waiting for ping response. Switching to baud rate 921600 Switched baud rate to 921600 Sending a ping packet. Handling read : 75 65 1 4 4 f1 1 2 Handling read : d7 6c Received NACK packet (class, command, code): 1, 1, 2 IMU returned error code for ping. [ERROR] [1439233299.215503549]: Exception: Failed to reach device /dev/ttyUSB0

Sending command: SyncMSB: 75 SyncLSB: 65 Descriptor: 1 Length: 2 Payload: 2 2 Check MSB: e1 Check LSB: c7 [imu-1] process has finished cleanly log file: /home/hbadino/.ros/log/cda72c8c-3f8d-11e5-a219-14dda925ae96/imu-1*.log all processes on machine have died, roslaunch will exit shutting down processing monitor... ... shutting down processing monitor complete done

The second time apparently does not time out, but it is unable to open the device.

After this, it is not possible to restart the device at any other baudrate and the only way to make it work again is to powercycle the IMU and select a lower baudrate.

The behaviour is the same whether connected to serial card or to usb by a serial-to-usb adapter.

Any help would be greatly appreciated it!

Hernan

Hernan

hbadino avatar Aug 10 '15 19:08 hbadino

@ke-sun

versatran01 avatar Sep 01 '15 15:09 versatran01

@hbadino

Hi hbadino,

Sorry for the late reply =P. I have checked the software by setting the baud rate to 460800 and 921600 and imu_rate to 500. However, I cannot reproduce your problem. The software works find at the provided settings.

/imu/baudrate=921600 /imu/verbose=False /imu/enable_mag_update=False /imu/enable_filter=False /imu/imu_rate=200 /imu/enable_accel_update=False /imu/frame_id=imu /imu/filter_rate=100 /imu/device=/dev/ttyACM0 /imu/diagnostic_period=0.2

ke-sun avatar Sep 01 '15 21:09 ke-sun

Hi,

I work with hbadino and we just resolved this issue on our end. We needed to insert a delay in the Imu::selectBaudRate() function, between when the set baud rate command is completed and when the ping() is sent to verify the connection.

The manual for the IMU says the there is a 0.25 second delay before the device will respond to commands at the new rate, so we just added a sleep statement (around line 622 of imu.cpp, just before the final ping() attempt in Imu::SelectBaudRate()).

If I can find some time I'll try to make a pull request, but I at least wanted to post the note here in case I don't get around to it soon...

voondebah avatar Feb 09 '16 18:02 voondebah

@voondebah Thanks for the careful inspection. Will update the repo soon.

ke-sun avatar Feb 10 '16 03:02 ke-sun