ros-industrial/ros_canopen

Subindex parsing doesn't abide by standard, misses parsing arrays that have skipped subindices

oren-hinkis opened this issue · 1 comments

According to the standard, SubNumber indicates the total number of available objects in the array but doesn't indicate the highest subindex that is available. That is supposed to be give in the value of the sub0 object of that array.

image

However, the code uses the SubNumber as the variable to parse the array. This leads to issues in cases where a sub number is skipped in the EDS
read_integer(subs, *object, "SubNumber");
for(uint8_t i=0; i < subs; ++i){}

https://www.can-cia.org/can-knowledge/canopen/cia306/

Good point!

A fix should not be too hard: The code needs to iterate SubNumber times between 0 and sub0.