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 exception in RobotStateDisplay and print warning to not crash RViz #1267

Closed
wants to merge 10 commits into from
Closed

Handle exception in RobotStateDisplay and print warning to not crash RViz #1267

wants to merge 10 commits into from

Conversation

christian-rauch
Copy link
Contributor

Description

The RobotStateDisplay plugin crashes RVIz if a robot state with a non-existing joint is provided. See: #1266

This PR simply catches the exception and shows a warning instead of forwarding the exception an have RViz crash.

@welcome
Copy link

welcome bot commented Dec 14, 2018

Thanks for helping in improving MoveIt!

Copy link
Contributor

@v4hn v4hn left a comment

Choose a reason for hiding this comment

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

Thanks for the pull-request!
Having RViz crash just because some validity checks are not in place is frustrating indeed...

@christian-rauch
Copy link
Contributor Author

@v4hn Done.

Copy link
Contributor

@v4hn v4hn left a comment

Choose a reason for hiding this comment

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

Looks good now.

Waiting for second review.

@v4hn v4hn added the awaits 2nd review one maintainer approved this request label Dec 16, 2018
Copy link
Contributor

@rhaschke rhaschke left a comment

Choose a reason for hiding this comment

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

After being approved by @v4hn, this PR had several remaining issues:

  • the exception was printed twice on the console, from here and here
  • the robot_state_ was left in an inconsistent state on an exception
  • the error status message wasn't reset upon a successful retrieval of the RobotState
  • the same exception crash occured for wrong DisplayTrajectory msgs

I fixed these issues, pushing directly to @christian-rauch's repo. @v4hn, please approve again.

@christian-rauch
Copy link
Contributor Author

@rhaschke Thanks for pointing to the additional ROS_ERROR_NAMED message. I saw it on the terminal but couldn't track it down in the source.
I am fine with the changes.

Copy link
Contributor

@v4hn v4hn left a comment

Choose a reason for hiding this comment

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

Indeed, your changes look good @rhaschke .

I'm not a fan of the additional make_shared though, see below.

robot_state::robotStateMsgToRobotState(state_msg->state, *robot_state_);
auto robot_state = std::make_shared<robot_state::RobotState>(robot_model_);
robot_state::robotStateMsgToRobotState(state_msg->state, *robot_state);
robot_state_.swap(robot_state);
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this makes sense. However, I preferred to skip the allocation because the failure case is very uncommon but the allocation is required on every update.
How about using setToDefaultValues to enforce a safe state in case of error?

@v4hn v4hn removed the awaits 2nd review one maintainer approved this request label Dec 18, 2018
@rhaschke
Copy link
Contributor

@v4hn Can you have a final look, please? If you approve, I would like to squash some of the commits for cleanup before finally merging.

@v4hn
Copy link
Contributor

v4hn commented Dec 19, 2018

Looks good now.

@rhaschke
Copy link
Contributor

Merged in 47ff403 after some cleanup squashing.

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

3 participants