ros-drivers / um7

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

IMU driver functioning, but "45 junk byte(s)" #16

Closed zlacelle closed 4 years ago

zlacelle commented 6 years ago

The UM7 driver is working, but I'm getting a bunch of the following printouts:

[ WARN] [1516642357.915028182]: Discarding packet due to bad checksum. [ WARN] [1516642357.915173597]: Discarded 45 junk byte(s) preceeding packet. [ WARN] [1516642358.912416875]: Discarding packet due to bad checksum. [ WARN] [1516642358.912582761]: Discarded 45 junk byte(s) preceeding packet. [ WARN] [1516642359.437074282]: Discarding packet due to bad checksum. [ WARN] [1516642359.437217849]: Discarded 45 junk byte(s) preceeding packet. [ WARN] [1516642360.434506927]: Discarding packet due to bad checksum. [ WARN] [1516642360.434664011]: Discarded 45 junk byte(s) preceeding packet. [ WARN] [1516642361.430834304]: Discarding packet due to bad checksum. [ WARN] [1516642361.431024971]: Discarded 45 junk byte(s) preceeding packet. [ WARN] [1516642362.951950582]: Discarding packet due to bad checksum. [ WARN] [1516642362.952095466]: Discarded 45 junk byte(s) preceeding packet. [ WARN] [1516642363.948314500]: Discarding packet due to bad checksum. [ WARN] [1516642363.948457447]: Discarded 45 junk byte(s) preceeding packet. [ WARN] [1516642364.945671500]: Discarding packet due to bad checksum. [ WARN] [1516642364.945816956]: Discarded 45 junk byte(s) preceeding packet. [ WARN] [1516642365.470350214]: Discarding packet due to bad checksum. [ WARN] [1516642365.470493856]: Discarded 45 junk byte(s) preceeding packet.

These are only happening at about 1Hz.

Any idea what packets are failing, if this is expected, or any additional information I can gather?

cynosure4sure commented 6 years ago

I get something slightly different:

[ WARN] [1517599730.987274613]: Discarded 16 junk byte(s) preceeding packet. [ WARN] [1517599730.987371238]: Serial read buffer is 462, now flushing in an attempt to catch up. [ WARN] [1517599731.056239963]: Discarded 10 junk byte(s) preceeding packet. [ WARN] [1517599731.056334869]: Serial read buffer is 468, now flushing in an attempt to catch up. [ WARN] [1517599731.122947562]: Discarded 20 junk byte(s) preceeding packet. [ WARN] [1517599731.123050774]: Serial read buffer is 458, now flushing in an attempt to catch up. [ WARN] [1517599731.191103062]: Discarded 7 junk byte(s) preceeding packet.

Were you able to solve your problem?

zlacelle commented 6 years ago

Nope, still no idea why it's dumping these.

cynosure4sure commented 6 years ago

If I switch to kernel 4.4.0.62 on ubuntu 14.04 for some reason all my issues get resolved and I get a consistent update rate of 200Hz.

tonybaltovski commented 6 years ago

Try setserial IMU-DEVICE low_latency. The Linux kernel changed from low latency being default to not in the more recent ones. 4.4.52 is where the change happened.

TSRyan commented 6 years ago

I am having the same issue on Ubuntu 16.04 with ROS Kinetic:

[ INFO] [1536770661.446961138]: um7_driver successfully connected to serial port /dev/ttyUSB0.
[ INFO] [1536770661.453841344]: Received packet 02 without data.
[ INFO] [1536770661.454969725]: Setting update rate to 20Hz
[ INFO] [1536770661.460115326]: Received packet 02 without data.
[ INFO] [1536770661.466205632]: Received packet 04 without data.
[ INFO] [1536770661.472320941]: Received packet 05 without data.
[ INFO] [1536770661.478441450]: Received packet 06 without data.
[ INFO] [1536770661.484543436]: Received packet 08 without data.
[ INFO] [1536770661.485241753]: Sending command: zero gyroscopes
[ INFO] [1536770661.490513000]: Received packet ad without data.
[ WARN] [1536770661.693957576]: Timed out waiting for packet from device.
[ WARN] [1536770661.747707100]: Timed out waiting for packet from device.
[ WARN] [1536770661.898623025]: Timed out waiting for packet from device.
[ WARN] [1536770661.915817501]: Timed out waiting for packet from device.
[ WARN] [1536770661.928608311]: Timed out waiting for packet from device.
[ WARN] [1536770661.940660101]: Timed out waiting for packet from device.
[ WARN] [1536770661.946562747]: Discarded 41 junk byte(s) preceeding packet.
[ WARN] [1536770662.109901064]: Timed out waiting for packet from device.
[ WARN] [1536770662.126786333]: Timed out waiting for packet from device.
[ WARN] [1536770662.139568977]: Timed out waiting for packet from device.
[ WARN] [1536770662.151870692]: Timed out waiting for packet from device.
[ WARN] [1536770662.157710138]: Discarded 41 junk byte(s) preceeding packet.
[ WARN] [1536770662.349884436]: Discarded 54 junk byte(s) preceeding packet.

The command setserial /dev/ttyUSB0 low_latency results in:

Cannot get serial info: Inappropriate ioctl for device

Various posts on other forums (e.g., https://stackoverflow.com/questions/13126138/low-latency-serial-communication-on-linux indicate that stty should allow any necessary serial configuration, but low_latency is an invalid argument. Is there another way to do this?

cynosure4sure commented 6 years ago

You can lower the latency of the Ubuntu kernel by using command: sudo sh -c "echo 1 > /sys/bus/usb-serial/devices/ttyUSB0/latency_timer"

and the check using: cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer

it will go from 16 to 1 but you will need to do it every time you plug/unplug the USB.

tonybaltovski commented 4 years ago

You can make a udev rule for this, similar to:

`SUBSYSTEM=="tty", KERNEL=="ttyUSB[0-9]*", ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403", MODE="0666", RUN+="/bin/bash -c 'echo 1 > /sys$devpath/device/latency_timer'"