ros-industrial / ros_canopen

CANopen driver framework for ROS (http://wiki.ros.org/ros_canopen)
GNU Lesser General Public License v3.0
332 stars 270 forks source link

Issue reading multiple bytes #391

Closed srsidd closed 2 years ago

srsidd commented 4 years ago

Hi,

We've been using this driver and so far it's been great. We're using an encoder which is a 4 Byte Special Terminals and noticed a discrepancy - There were random spikes in the data every so often, but it was only the one value and would immediately go back to the correct value.

image (1)

Upon looking at the data more closely, we found that we may not be reading the entire 4 bytes as a single atomic operation. Here's a snapshot of the data image

The value was counting down. For packet 2, the least significant byte was read just before bit 8 was going to be decremented. It appears the next byte was read as a separate read, because by the time it is read, the value of bit 8 has already been decremented. The value of bit 8 should still have been 1 when the LSB was read.

mathias-luedtke commented 4 years ago

Why would this be a problem with ros_canopen? Did you check the data with candump?

mathias-luedtke commented 2 years ago

I will close this, because it is unclear how it is related to ros_canopen.