Why is my encoder data becoming corrupted?

asked 2020-02-19 05:23:29 -0500

sh_ec_ks gravatar image

I'm working on a driver for the "Irobot Create2" (essentially a programmable roomba). I'm interfacing with the device in C using a termios struct and basic system calls. I'm able to access all of the data packets and write to the device, however the encoder data seems to get corrupted at some point. I'm publishing the data in a Int32MultiArray. The result would be something like: 1. encoder counting as expected from 0-30000 for both wheels. 2.) left and right encoder values swtich places in m array (seen in rostopic echo) or 3.) the values just all over the place and have no order or correlation with the actual count. Any ideas why something like this could occur?

edit retag flag offensive close merge delete

Comments

Hard to say without looking the code, but you seem to be saying that you are able to observe that the values are being read correctly from the robot, but publishing them produces errors - if that is the case then check the code that is publishing the data. Maybe use two separate topics that publish the left and right data first to see if it is an issue with how you are building your multi array message.

nickw gravatar image nickw  ( 2020-02-19 23:22:12 -0500 )edit