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

[AIST-QA]Fix possibile division-by-zero issues. #1809

Conversation

max-krichenbauer
Copy link
Contributor

Description

Local variables are used as denominator in measure_ik_call_cost.cpp and chomp_optimizer.cpp.
These variables are initialized with zero and there are cases when they are used without changing value.
This fix adds checking the local variable against zero. (In chomp_optimizer, the fix is applied to the function ChompCost::scale)

This contribution is made by AIST ( https://www.aist.go.jp ) based on static code analysis with klocwork (Perforce Software).

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

- Correct the indication by the static analysis tool.
- Added a safeguard and display warning.
- Correct the indication by the static analysis tool.
- Added a safegurad that check scale value is zero or non-zero.
@welcome
Copy link

welcome bot commented Dec 12, 2019

Thanks for helping in improving MoveIt and open source robotics!

@max-krichenbauer
Copy link
Contributor Author

To fulfill the checklist requirement, I've reviewed this PR: #1804 and left a comment.

Copy link
Contributor

@felixvd felixvd left a comment

Choose a reason for hiding this comment

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

I don't have objections about the benchmark, but the addition in ChompCost should be changed imo. Unintuitive/edge-case behavior like that should not be silent, it's too easy to create hard-to-find bugs down the line.

Also pinging @BryceStevenWilley because he'd be more familiar with this part of the code.

moveit_kinematics/test/benchmark_ik.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@felixvd felixvd left a comment

Choose a reason for hiding this comment

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

LGTM if the small correction is added. Thanks for the quick iteration.

@rhaschke rhaschke merged commit 7880dd4 into moveit:melodic-devel Dec 13, 2019
@welcome
Copy link

welcome bot commented Dec 13, 2019

Congrats on getting your first MoveIt pull request merged and improving open source robotics!

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.

4 participants