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

[ROS2] Fix setting of diagnostic status level by diagnostic updater #184

Merged

Conversation

BasVolkers
Copy link
Contributor

This PR resolves #183

It replaces every byte creation b'0' by b'\x00', b'1' by b'\x01', and b'2' by b'\x02'.
With these changes the diagnostic_aggregator_node no longer produces an ERROR.

@BasVolkers BasVolkers changed the title Fix setting of diagnostic status level by diagnostic updater [ROS2] Fix setting of diagnostic status level by diagnostic updater Jan 29, 2021
@BasVolkers
Copy link
Contributor Author

@Karsten1987

@Karsten1987 Karsten1987 self-assigned this Feb 26, 2021
@Karsten1987
Copy link
Contributor

@BasVolkers this looks to me as if we most likely don't test this correctly. Do you have an idea if we could enhance the test suite with some regression test for this change?

@Karsten1987
Copy link
Contributor

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@Karsten1987 Karsten1987 merged commit 8041491 into ros:ros2-devel Mar 3, 2021
Karsten1987 pushed a commit that referenced this pull request Mar 3, 2021
Karsten1987 added a commit that referenced this pull request Mar 4, 2021
Co-authored-by: BasVolkers <basvolkers99@gmail.com>
@BasVolkers
Copy link
Contributor Author

BasVolkers commented Mar 8, 2021

@BasVolkers this looks to me as if we most likely don't test this correctly. Do you have an idea if we could enhance the test suite with some regression test for this change?

The tests only check that a certain value is set for the level of a DiagnosticStatus. Since the wrong values were used in the expected part of the assertEquals the tests still passed.

The actual error happens when the DiagnosticStatus's level is converted in status_item.hpp.
Since b'0' gives the ASCII value of '0' (48), the conversion fails. This fix make sure the level is in range [0-3].
A better fix may be using the DiagnosticStatus.msg levels (OK, WARN, ERROR), instead of creating the byte by hand.

I'm opening up MR #193 for this.

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.

None yet

2 participants