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

Malformed sub-payload detected. #382

Closed
BasJ93 opened this issue Feb 1, 2018 · 25 comments
Closed

Malformed sub-payload detected. #382

BasJ93 opened this issue Feb 1, 2018 · 25 comments
Labels
Milestone

Comments

@BasJ93
Copy link

BasJ93 commented Feb 1, 2018

I am running the Turtlebot2 with the Kobuki base. Both on Indigo en Kinetic, I receive the error:
Kobuki: malformed sub-payload detected, ...

The sub payload that is shown is always a sub-payload of the base-state as defined by the protocol specification with a lenght of 77 bytes. (AA 55 4D 01 0F) However, the reported error does not have 77 bytes of data. This does match the behaviour as described in kobuki.cpp line 405 of the kobuki_driver.

I have tested this with two laptops running in Indigo and one running on Kinetic, and two different Kobuki bases.

@mzaiady
Copy link

mzaiady commented Feb 7, 2018

I'm facing the same issue, using Intel NUC, it was working fine before! but this error start to show-up recently !

[ERROR] Kobuki : malformed sub-payload detected. [225][170][E1 AA 55 4D 01 0F ]
[ERROR] Kobuki : malformed sub-payload detected. [42][170][2A AA 55 4D 01 0F ]
[ERROR] Kobuki : malformed sub-payload detected. [94][170][5E AA 55 4D 01 0F ]
[ERROR] Kobuki : malformed sub-payload detected. [63][170][3F AA 55 4D 01 0F C0 E8 00 00 00 ]
[ERROR] Kobuki : malformed sub-payload detected. [221][170][DD AA 55 4D 01 0F 78 08 00 00 00 94 ]
[ERROR] Kobuki : malformed sub-payload detected. [43][170][2B AA 55 4D 01 0F 24 0C 00 00 00 ]
[ERROR] Kobuki : malformed sub-payload detected. [103][170][67 AA 55 4D 01 0F F0 80 00 00 00 94 ]
[ERROR] Kobuki : malformed sub-payload detected. [143][170][8F AA 55 4D 01 0F 30 8C 00 00 ]
[ERROR] Kobuki : malformed sub-payload detected. [27][170][1B AA 55 4D 01 0F 80 9B 00 00 00 94 58 63 9C 00 00 00 06 91 00 ]
[ERROR] Kobuki : malformed sub-payload detected. [62][170][3E AA 55 4D 01 0F 0C ]
[ERROR] Kobuki : malformed sub-payload detected. [212][170][D4 AA 55 4D 01 0F ]
[ERROR] Kobuki : malformed sub-payload detected. [193][170][C1 AA 55 4D 01 0F 18 30 00 00 00 ]
[ERROR] Kobuki : malformed sub-payload detected. [230][170][E6 AA 55 4D 01 0F AC DC 00 00 00 94 ]

ROS Indigo,
Ubuntu 14.04.5 LTS
kernal 4.4.0-112-generic

 rosrun kobuki_driver version_info
Version Info:
 * Hardware Version: 1.0.4
 * Firmware Version: 1.2.0
 * Software Version: 0.6.5

@robbiedood
Copy link

@BasJ93 @mzaiady , got the same issue with you in 2020. Do you find any solution for the error message "Malformed sub-payload detected" ? For example, update firmware or software ?

Hope to hear your expertise.

-- Luke

@stonier
Copy link
Member

stonier commented Aug 5, 2020

Does it show up continuously or sporadically? Is it an old kobuki? Old cable?

@robbiedood
Copy link

robbiedood commented Aug 5, 2020

Hi @stonier ,

It shows up when we execute: roslaunch kobuki_node minimal.launch --screen, and continuously shows up every tens second.

I just purchased and received it from Trossen Robotics, don't know if it is old or not, checked the version which shows:

Version Info:

  • Hardware Version: 1.0.4
  • Firmware Version: 1.2.0
  • Software Version: 0.7.8

First guess is caused by mis-matched data type in communication module of software.
Hope to hear your expertise on the error message.

-- Luke

Detail error msg:

[ WARN] [1596651469.513160176]: Kobuki : no robot description given on the parameter server #this one could be resolved by adding robot description in minimal.launch file. ref: kobuki_description/launch/view_model.launch

[ERROR] [1596645974.092839020]: Kobuki : malformed sub-payload detected. [246][170][F6 AA 55 4D 01 0F AC 10 00 00 00 ]
[ERROR] [1596645978.163092068]: Kobuki : malformed sub-payload detected. [179][170][B3 AA 55 4D 01 0F 9C 20 00 00 00 00 00 ]
[ERROR] [1596645983.250287666]: Kobuki : malformed sub-payload detected. [108][170][6C AA 55 4D 01 0F 88 34 00 00 00 00 ]
[ERROR] [1596646008.685343851]: Kobuki : malformed sub-payload detected. [65][170][41 AA 55 4D 01 0F 24 98 00 ]
[ERROR] [1596646011.737872785]: Kobuki : malformed sub-payload detected. [162][170][A2 AA 55 4D 01 0F 18 ]
[ERROR] [1596646014.790405568]: Kobuki : malformed sub-payload detected. [42][170][2A AA 55 4D 01 0F 0C B0 00 00 00 00 00 ]
[ERROR] [1596646073.444123853]: Kobuki : malformed sub-payload detected. [211][170][D3 AA 55 4D 01 0F ]
[ERROR] [1596646126.331871753]: Kobuki : malformed sub-payload detected. [118][170][76 AA 55 4D 01 0F D8 64 00 00 00 00 00 ]
[ERROR] [1596646132.436872369]: Kobuki : malformed sub-payload detected. [115][170][73 AA 55 4D 01 0F C0 7C 00 00 00 00 00 ]
[ERROR] [1596646138.561060588]: Kobuki : malformed sub-payload detected. [17][170][11 AA 55 4D 01 0F ]
[ERROR] [1596646159.908708671]: Kobuki : malformed sub-payload detected. [176][170][B0 AA 55 4D 01 0F 54 E8 00 00 ]
[ERROR] [1596646164.995873833]: Kobuki : malformed sub-payload detected. [254][170][FE AA 55 4D 01 0F 40 FC 00 00 00 ]
[ERROR] [1596646244.235419617]: Kobuki : malformed sub-payload detected. [98][170][62 AA 55 53 01 0F 90 32 00 00 00 00 ]
[ERROR] [1596646245.811301686]: Kobuki : malformed sub-payload detected. [125][170][7D AA 55 4D 01 0F ]
[ERROR] [1596646279.009082889]: Kobuki : malformed sub-payload detected. [251][170][FB AA 55 4D 01 0F ]
[ERROR] [1596646296.884336272]: Kobuki : malformed sub-payload detected. [66][170][42 AA 55 4D 01 0F BC 00 ]
[ERROR] [1596646301.971431705]: Kobuki : malformed sub-payload detected. [207][170][CF AA 55 4D 01 0F A8 14 00 00 ]
[ERROR] [1596646307.557649656]: Kobuki : malformed sub-payload detected. [253][170][FD AA 55 53 01 0F 88 2A 00 00 00 00 ]
[ERROR] [1596646308.076506120]: Kobuki : malformed sub-payload detected. [168][170][A8 AA 55 4D 01 0F 90 2C 00 00 00 ]
[ERROR] [1596646322.939303750]: Kobuki : malformed sub-payload detected. [212][170][D4 AA 55 53 01 0F C4 66 00 00 ]
[ERROR] [1596646329.443456332]: Kobuki : malformed sub-payload detected. [125][170][7D AA 55 4D 01 0F 3C ]
[ERROR] [1596646334.530391507]: Kobuki : malformed sub-payload detected. [104][170][68 AA 55 4D 01 0F 28 94 00 00 ]
[ERROR] [1596646339.617518921]: Kobuki : malformed sub-payload detected. [178][170][B2 AA 55 4D 01 0F 14 A8 00 00 00 00 00 ]
[ERROR] [1596646344.704746925]: Kobuki : malformed sub-payload detected. [104][170][68 AA 55 4D 01 0F 00 BC 00 00 00 ]
[ERROR] [1596646356.893960427]: Kobuki : malformed sub-payload detected. [27][170][1B AA 55 4D 01 0F ]
[ERROR] [1596646378.598489821]: Kobuki : malformed sub-payload detected. [180][170][B4 AA 55 4D 01 0F ]
[ERROR] [1596646402.854721336]: Kobuki : malformed sub-payload detected. [131][170][83 AA 55 4D 01 0F ]
[ERROR] [1596646422.004692726]: Kobuki : malformed sub-payload detected. [61][170][3D AA 55 4D 01 0F ]
[ERROR] [1596646451.151223039]: Kobuki : malformed sub-payload detected. [34][170][22 AA 55 4D 01 0F E0 5C 00 00 ]
[ERROR] [1596646456.238350501]: Kobuki : malformed sub-payload detected. [55][170][37 AA 55 4D 01 0F CC 70 00 00 00 00 00 ]
[ERROR] [1596646478.619834242]: Kobuki : malformed sub-payload detected. [157][170][9D AA 55 4D 01 0F 74 C8 ]
[ERROR] [1596646481.671401956]: Kobuki : malformed sub-payload detected. [200][170][C8 AA 55 4D 01 0F 68 ]
[ERROR] [1596646658.292779454]: Kobuki : malformed sub-payload detected. [185][170][B9 AA 55 4D 01 0F 34 ]
[ERROR] [1596646661.344518480]: Kobuki : malformed sub-payload detected. [239][170][EF AA 55 4D 01 0F 28 94 00 ]
[ERROR] [1596646689.548847758]: Kobuki : malformed sub-payload detected. [203][170][CB AA 55 53 01 0F A0 ]
[ERROR] [1596646770.828210134]: Kobuki : malformed sub-payload detected. [193][170][C1 AA 55 4D 01 0F FC 40 ]
[ERROR] [1596646775.914424523]: Kobuki : malformed sub-payload detected. [157][170][9D AA 55 4D 01 0F E8 54 00 ]
[ERROR] [1596646812.532723384]: Kobuki : malformed sub-payload detected. [63][170][3F AA 55 4D 01 0F 58 E4 ]
[ERROR] [1596646816.601049679]: Kobuki : malformed sub-payload detected. [129][170][81 AA 55 4D 01 0F 48 F4 ]
[ERROR] [1596646933.889739525]: Kobuki : malformed sub-payload detected. [90][170][5A AA 55 4D 01 0F ]
[ERROR] [1596646962.690243423]: Kobuki : malformed sub-payload detected. [85][77][55 4D 01 0F 8C 30 ]

@stonier
Copy link
Member

stonier commented Aug 5, 2020

The only thing that stands out for me (given that software/firmware works in general and has suddenly gone from working to not working) is that noise on the serial connection interferes with the payload. I've seen this happen on serial connections that are long / old / have a great deal of electromagnetic interference. Haven't seen it on a kobuki yet.

To debug further, see if you can isolate the problem to the communication line. Some experiments:

  • Try a different cable (new and shorter is ideal for comparison purposes) and see if that helps?
  • Get a laptop with serial port and use the serial comm device directly (not the usb).

@robbiedood
Copy link

The only thing that stands out for me (given that software/firmware works in general and has suddenly gone from working to not working) is that noise on the serial connection interferes with the payload. I've seen this happen on serial connections that are long / old / have a great deal of electromagnetic interference. Haven't seen it on a kobuki yet.

To debug further, see if you can isolate the problem to the communication line. Some experiments:

  • Try a different cable (new and shorter is ideal for comparison purposes) and see if that helps?
  • Get a laptop with serial port and use the serial comm device directly (not the usb).

Thanks for your advice @stonier , do you have any recommended serial communication cable which is short enough and interference free for the test ? In the same time, I'll get few shorter and better usb cable for further testing.

-- Luke

@stonier
Copy link
Member

stonier commented Aug 5, 2020

Nothing special. You're just chasing some second opinions on the communication problem to verify it isn't the cable that you have that is the source of the problem.

Equivalently, the second bullet above is to verify if the FTDI usb-serial io device on the kobuki is the source of the problem.

@stonier
Copy link
Member

stonier commented Aug 5, 2020

Note - you shouldn't have a software/firmware mismatch. If there was a major version mismatch, it would immediately abort and if there was a minor version mismatch you'd get a warning on startup. See here. It also wouldn't be sporadic.

@robbiedood
Copy link

Thanks for your prompt reply @stonier

BTW, what does "payload" and "sub-payload" in the context mean ? Is it a mechanical fixture to support physical loading or a virtual digits in protocols for communication ?

@stonier
Copy link
Member

stonier commented Aug 5, 2020

Each packet carries a variable length chain of data packets depending on what was requested in the last command window. Each sub-payload caries the data for a single quantity (e.g. cliff sensors). You can see details (not great english, but you'll get the idea) here: http://yujinrobot.github.io/kobuki/enAppendixProtocolSpecification.html.

If I remember correctly, there might be a rostopic you can tune into to see the full packet (good and bad) stream?

@robbiedood
Copy link

Thanks for your suggestion @stonier
Now we can eliminate cable issue since we've tried multiple cables with a variety of length (from 0.5 feet to 3 feet).
Still figure out the root cause of malformed sub-payload detected, will check if there is a ros way to see the full packet stream.

-- Luke

@corot
Copy link
Collaborator

corot commented Aug 13, 2020

@lukelu0520, to rule out another possibility: do you have several USB devices connected to the same hub (or same USB board within the PC) as Kobuki? I noticed with my robot that the number of malformed sub-payload detected errors increases a lot when that happen.

@swinterbotix
Copy link

I think I fixed this issue! By default the usb latency timer in Linux is set to 16ms for FTDI usb communication. By changing this to the lowest possible value (1ms), this issue disappears! Let me know if this works for you guys and I'll submit a PR to update the udev rules for kobuki.

There are a couple ways to change the latency timer. The best approach is to just edit the kobuki udev rule. Mine is located at /lib/udev/rules.d/60-ros-melodic-kobuki-ftdi.rules.

Substitute the line with ...

SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="kobuki*", ATTR{device/latency_timer}="1", MODE:="0666", GROUP:="dialout", SYMLINK+="kobuki"

@stonier
Copy link
Member

stonier commented Aug 14, 2020

Oh, looks like the world shifted in linux kernel 4.10 (which was after the initial releases of kobuki) for the ftdi driver. See here and here. That would explain why the problems are occurring now and not when Kobuki was initially released.

That udev rule could well work (looking forward to hearing from others), but perhaps a better solution is to do it programatically (see the second link above) so the /dev/kobuki port isn't spinning insanely, even when idle.

@stonier
Copy link
Member

stonier commented Aug 14, 2020

A long thread over in Octopi about this: guysoft/OctoPi#566

Interesting to note, if we could pad packets out to multiples of 64bytes, it would fire off the chain of sub-packets with no 16ms delays. Unfortunately we don't have access to the firmware :/

Potentially, some code that could set the low latency flag:

# serial struct is defined in <linux/serial.h>
ioctl(file_descriptor, TIOCGSERIAL, &serial); 
serial.flags |= ASYNC_LOW_LATENCY; // (0x2000)
ioctl(file_descriptor, TIOCSSERIAL, &serial);

However, folks in threads I've read mention that you need root permissions to set that flag :/

@swinterbotix
Copy link

swinterbotix commented Aug 14, 2020

That udev rule could well work (looking forward to hearing from others), but perhaps a better solution is to do it programatically (see the second link above) so the /dev/kobuki port isn't spinning insanely, even when idle.

Correct me if I'm wrong (and there's a good chance I am since I don't really work in serial communication) but it sounds like the latency timer only comes in to play when a 'read' command is sent to a device from a host computer. If no 'read' command is sent, which I imagine would be the case if the Kobuki is just plugged in to the computer but no code is running, then the port wouldn't be spinning at all?

@stonier
Copy link
Member

stonier commented Aug 20, 2020

Not an expert either, but looks like you're correct. Reference: FTDI Knowledgebase - Custom Latency Timer Value.

Having said that - this looks like the right thing to do, if only to reduce the latencies in reading the packet stream. That still doesn't explain however why the data is malformed at 16ms latencies, I would have expected it to be ok, just slower on the uptake.

@stonier
Copy link
Member

stonier commented Aug 20, 2020

For reference, you can determine the configured latency timer on your loaded device with:

cat /sys/bus/usb-serial/devices/ttyUSB0/tty/ttyUSB0/device/latency_timer

I can confirm the udev rule above does set it to 1ms.

I'm getting some interesting results with stream.cpp:

With 16ms latency:

[879570.639372021] Encoders [65532,65517]
[879570.697347595] Encoders [65532,65517]
[879570.720376262] Encoders [65532,65517]
[879570.779421650] Encoders [65532,65517]
[879570.837478482] Encoders [65532,65517]
[879570.860657557] Encoders [65532,65517]
[879570.920656717] Encoders [65532,65517]
[879570.978353900] Encoders [65532,65517]
[879571.001313090] Encoders [65532,65517]
[879571.060234311] Encoders [65532,65517]
[879571.118218788] Encoders [65532,65517]
[879571.140584549] Encoders [65532,65517]
[879571.200559087] Encoders [65532,65517]

With 1ms latency:

[880250.400911652] Encoders [65532,65515]
[880250.421051170] Encoders [65532,65515]
[880250.440984560] Encoders [65532,65515]
[880250.461133893] Encoders [65532,65515]
[880250.482130926] Encoders [65532,65515]
[880250.500816462] Encoders [65532,65515]
[880250.521110288] Encoders [65532,65515]
[880250.541922923] Encoders [65532,65515]
[880250.561056298] Encoders [65532,65515]
[880250.580858288] Encoders [65532,65515]
[880250.600774594] Encoders [65532,65515]
[880250.621897606] Encoders [65532,65515]
[880250.641907712] Encoders [65532,65515]
[880250.661814168] Encoders [65532,65515]
[880250.680774966] Encoders [65532,65515]
[880250.701015174] Encoders [65532,65515]

Conclusions:

  • At 16ms, packets arrive @ 15-60ms with high variance
  • At 1ms, packets arrive @ 20ms, with minimal variance <- this was the behaviour when kobuki was released (and of course, the desirable behaviour!)

I don't seen any negative ramifications due to increasing the polling rate that affects usual use of kobuki.

+1 for getting this patch in.

stonier added a commit to kobuki-base/kobuki_core that referenced this issue Aug 20, 2020
stonier added a commit to kobuki-base/kobuki_ftdi that referenced this issue Aug 20, 2020
stonier added a commit to kobuki-base/kobuki_ftdi that referenced this issue Aug 20, 2020
stonier added a commit to kobuki-base/kobuki_core that referenced this issue Aug 20, 2020
stonier added a commit to yujinrobot/kobuki_core that referenced this issue Aug 20, 2020
stonier added a commit to yujinrobot/kobuki_core that referenced this issue Aug 21, 2020
@robbiedood
Copy link

robbiedood commented Aug 21, 2020

@swinterbotix @stonier , amazing, problem solved after applying your solution.
Super happy we get rid of the error message !

@stonier
Copy link
Member

stonier commented Aug 21, 2020

Released kobuki_core - v0.7.9 in melodic and v1.1.1 in foxy. Thanks @swinterbotix.

@swinterbotix
Copy link

Do you plan to make version 0.7.9 available on APT for kinetic/melodic? It's still showing 0.7.8 as the most recent version.

@stonier
Copy link
Member

stonier commented Sep 10, 2020

http://repositories.ros.org/status_page/ros_melodic_default.html?q=kobuki

You'll see that it's still just a release candidate and hasn't yet been pushed to the release servers. You can get early access to it via the ros-testing server, see this wiki page.

I didn't release it in kinetic. I can't test it at the moment and there are some changes that might not backport so was cautious about sync'ing branches. If you would like to use it there, and can confirm the udev rule changes in yujinrobot/kobuki_core@45f834c work, I'll cherry-pick that single change and re-release.

@stonier stonier reopened this Sep 10, 2020
@swinterbotix
Copy link

I've confirmed that the robot still works even with the updated udev rule. I did this by first installing version 0.7.8 from apt on kinetic, then updating the udev rule in the /lib/udev/rules.d directory with the latency changes. Next, I ran
roslaunch kobuki_node minimal.launch in one terminal, then opened another terminal and typed roslaunch kobuki_keyop keyop.launch . I was then able to successfully control the robot using the keyboard.

During the couple minutes I was playing with it, I did not see any malformed sub-payload errors.

Honestly, the main reason I'd like it offered in kinetic is just for flexibility. The company I work for sells a few dozen kobuki bases as part of our robot platforms, and I'd like to give users the ability to choose between kinetic or melodic.

stonier added a commit to yujinrobot/kobuki_core that referenced this issue Sep 12, 2020
stonier added a commit to yujinrobot/kobuki_core that referenced this issue Sep 12, 2020
stonier added a commit to yujinrobot/kobuki_core that referenced this issue Sep 14, 2020
@stonier
Copy link
Member

stonier commented Sep 14, 2020

On it's way in kinetic, melodic & noetic, v0.7.10.

@stonier stonier closed this as completed Sep 14, 2020
@corot
Copy link
Collaborator

corot commented Dec 31, 2020

Finally regain access to my old, good kobuki;
Malformed sub-payload errors gone!!! thank u guys,, and happy new year!

Kin-Zhang added a commit to KTH-RPL/rpl_kobuki that referenced this issue Mar 16, 2023
update readme, the kobuki working now!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants