Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with high baudrates #14

Open
hbadino opened this issue Aug 10, 2015 · 4 comments
Open

Problems with high baudrates #14

hbadino opened this issue Aug 10, 2015 · 4 comments

Comments

@hbadino
Copy link

hbadino commented Aug 10, 2015

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

@versatran01
Copy link
Collaborator

@ke-sun

@ke-sun
Copy link
Collaborator

ke-sun commented Sep 1, 2015

@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

@voondebah
Copy link

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...

@ke-sun
Copy link
Collaborator

ke-sun commented Feb 10, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants