ros_canopen icon indicating copy to clipboard operation
ros_canopen copied to clipboard

Support Boolean variables

Open lkm1321 opened this issue 4 years ago • 7 comments

Hi,

This PR adds support for Boolean (DataType=0x0001) variables. The new features are:

  1. DataType=0x0001 in EDS is parsed as C++ bool, regarding positive integer values of DefaultValue as "true"
  2. It's published as ROS std_msgs/Bool object.

Addresses https://github.com/ros-industrial/ros_canopen/issues/268

lkm1321 avatar Aug 31 '20 01:08 lkm1321

Hi, Thanks for proposing this PR, this feature would be really helpful. Since it has passed all the checks, would it be possible to have it merged with the melodic-devel branch ?

Roboprotos avatar Jun 16 '21 07:06 Roboprotos

This fix look okay, but I am unsure about PDO support. canopen_master does not support bit-wise access (granularity 1). Unfortunately, I was never able to test this, because none of our devices support boolean objects.

mathias-luedtke avatar Jun 21 '21 07:06 mathias-luedtke

I see, I was mainly interested in the DCF parser, to be able to parse boolean datatype from some manufacturer specific objects that can't be mapped to PDO.

I agree PDO support should be checked before merging, or if canopen_master doesn't support granularity 1, do you think the parser could just reject files which have a mappable boolean object ?

Roboprotos avatar Jun 21 '21 08:06 Roboprotos

do you think the parser could just reject files which have a mappable boolean object ?

I think it should be possible to fail the init service, if a boolean gets mapped.

mathias-luedtke avatar Jun 21 '21 09:06 mathias-luedtke

Hi guys, thanks for the interest. I do have a device with Boolean variables. I checked that parsing and SDOs are okay, but not PDOs. I'm happy to test whether PDO works. Would that help with having this merged?

lkm1321 avatar Jun 21 '21 23:06 lkm1321

Hi @lkm1321, were you able to test your PR with PDOs ?

Roboprotos avatar Sep 28 '21 15:09 Roboprotos

Hi @Roboprotos, I did a quick test of this feature with our device (Roboteq RGBL1896) but doesn't seem to work correctly. SDO just seems to read 0 even though the underlying value should be 1. I'm not sure if the fault is in ros_canopen or in the device's firmware, and I'd need to look at cansniffer output to debug, but I'll be away from lab until February so it'll be some time before I do any debugging. I'll update if any developments before that.

lkm1321 avatar Dec 05 '21 22:12 lkm1321