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

Feature/multiple sdo write types #264

Conversation

kurtist123
Copy link
Contributor

The ros2_canopen::BasicSlave only supported SDO writes to UNSIGNED32 type data objects. A data length exception was thrown when trying to write to other data types.

The exception was coming from the line:
https://github.com/rosindustrial/ros2_canopen/blob/master/canopen_fake_slaves/include/canopen_fake_slaves/basic_slave.hpp#L49

It was calling Get<unsigned32_t>(), regardless of the data type of the object. This was resulting in a data length mismatch for data types other than UNSIGNED32.

I implemented a GetValue method to explicitly call Get<>() using the data object type. One thing to note is that the GetValue method only supports getting types that can fit inside a 32-bit container. Trying to SDO write larger values will result in the same data length exception as before. I also added more SDO write tests to exercise getting multiple data types.

This PR is related to the issue: #263

@hellantos hellantos merged commit e2522d3 into ros-industrial:master Apr 18, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants