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

Handle NaN values for Wrench msgs #746

Merged
merged 12 commits into from
Sep 14, 2021

Conversation

bailaC
Copy link
Contributor

@bailaC bailaC commented Aug 18, 2021

Problems in Rviz

  1. Rviz can not process NaN values and shows error
  2. In ROS2 controllers, NaN values are being used to indicate unavailable axis for Wrench messages. And it leads to error in Rviz.

This PR will contain the changes to,

  1. handle NaN values for Wrench messages (in this PR).
  2. add a 'checkbox' to enable/disable this feature.
  3. If NaN values are received in Wrench messages and the 'checkbox' is marked, it will be converted to 0.0. If disabled, it will work as existing Rviz.

Copy link
Contributor

@destogl destogl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments to improve logic.

@@ -96,6 +100,7 @@ void WrenchDisplay::reset()

void WrenchDisplay::updateWrenchVisuals()
{
// bool accept_NaN = accept_NaN_values_->getBool();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kept as part of testing, will remove.

return;
}
} else {
custom_msg->wrench.force.x = (std::isnan(msg->wrench.force.x)) ? 0.0 : msg->wrench.force.x;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also validate if message has inf in it. Use again validate for this and then if true check if there are only NaNs and if not than do nothing/ignore message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, will add the validate part,

bailaC and others added 8 commits August 18, 2021 19:13
…wrench_display.cpp

Co-authored-by: Denis Štogl <destogl@users.noreply.github.com>
…wrench_display.cpp

Co-authored-by: Denis Štogl <destogl@users.noreply.github.com>
…wrench_display.cpp

Co-authored-by: Denis Štogl <destogl@users.noreply.github.com>
…nch/wrench_display.hpp

Co-authored-by: Denis Štogl <destogl@users.noreply.github.com>
…wrench_display.cpp

Co-authored-by: Denis Štogl <destogl@users.noreply.github.com>
@bailaC
Copy link
Contributor Author

bailaC commented Aug 19, 2021

This new option 'Accept NaN Values' looks like this.

image

Copy link
Contributor

@destogl destogl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good! Thanks!

@destogl
Copy link
Contributor

destogl commented Aug 19, 2021

@bmagyar can you also give it a look before we trigger RViz-maintainers

@ahcorde
Copy link
Contributor

ahcorde commented Sep 13, 2021

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

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

4 participants