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

[WIP] Debug/Fix #485 #495

Merged
merged 8 commits into from
Feb 16, 2024
Merged

[WIP] Debug/Fix #485 #495

merged 8 commits into from
Feb 16, 2024

Conversation

rhaschke
Copy link
Contributor

@rhaschke rhaschke commented Oct 13, 2023

Attempt to fix #485 (comment):

@rhaschke rhaschke changed the base branch from humble to master October 20, 2023 06:12
- Add Stage::introspection() accessor
- Introspection: debug-log solution registration
- RemoteSolutionModel: show internal solution id as tooltip in 1st column
@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (a905572) 59.00% compared to head (5674df2) 58.99%.
Report is 1 commits behind head on master.

❗ Current head 5674df2 differs from pull request most recent head e163f57. Consider uploading reports for the commit e163f57 to get more accurate results

Files Patch % Lines
core/src/stage.cpp 42.86% 8 Missing ⚠️
core/include/moveit/task_constructor/stage_p.h 0.00% 2 Missing ⚠️
core/src/container.cpp 33.34% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #495      +/-   ##
==========================================
- Coverage   59.00%   58.99%   -0.01%     
==========================================
  Files          90       90              
  Lines        8485     8497      +12     
==========================================
+ Hits         5006     5012       +6     
- Misses       3479     3485       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rhaschke rhaschke marked this pull request as ready for review October 25, 2023 20:43
@rhaschke rhaschke enabled auto-merge October 25, 2023 20:50
@rhaschke rhaschke disabled auto-merge October 25, 2023 20:53
@rhaschke rhaschke force-pushed the debug-#485 branch 2 times, most recently from 65537fc to 00074ef Compare October 26, 2023 07:53
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.

This was obviously a lot of tedious debugging (which I started to repeat yesterday before noticing this PR again). Thank you for these patches.

Please see my inline comments. I would love to merge this upstream, but am not clear on some details yet.

@@ -487,7 +487,8 @@ struct SolutionCollector
solutions.emplace_back(std::make_pair(trace, prio));
} else {
for (SolutionBase* successor : next) {
assert(!successor->isFailure()); // We shouldn't have invalid solutions
if (successor->isFailure())
continue; // skip failures
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried to get my head around why this happens in some situations I encountered in the past and failed.
Can you describe a scenario where the assert will be violated with pruning active?
I'm fine with changing it because it is a step necessary if we want to have a flag that disables pruning for a whole task (any unpruned stage with a dead end on the other side of a partial solution will trigger this assert), but I do not yet understand why it can be invalid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure about the reasons anymore (it's nearly half a year ago that I handled this).
I think we cannot be sure that only valid solutions enter the start/end interfaces. For example, Connect stages do preserve all InterfaceStates, both successes and failures. We just save failures for later inspection as well.
Thus, we need to explicitly filter them here.
I remember that this was a no-brainer when encountering it. But now I don't remember a concrete example.

Copy link
Contributor

Choose a reason for hiding this comment

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

it's nearly half a year ago that I handled this

Fair enough, my fault for letting it lie around for so long.

For example, Connect stages do preserve all InterfaceStates, both successes and failures.

Of course, but they also prune the paths on failure. so unless the solution path forks, the other end should not compute at all (as the interface state is pruned). I came up with an example case below where the assert is violated with forking solution paths:
g3811

But I observed a rare stochastic assert in the following situation some days ago where turn yielded a solution which hit the assert when propagating back the priority to the failed attempt in approach grasp:
screenshot240214-173210-red
In this situation there are no obvious forking solution paths (unless ComputeIK factors through a single pose in the wrapped generator, but that should not happen?) and the failure in approach grasp should have pruned the only connected interface start state in turn, so the compute call that generated the turn solution should not have happened.
I tried to write a test case for this, but failed to do so in reasonable time.

So TLDR: I guess dropping the assert is correct, but also obfuscates bugs in the pruning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Strange that you cannot reproduce the error in a simpler unit test.

core/test/test_serial.cpp Outdated Show resolved Hide resolved
core/src/stage.cpp Outdated Show resolved Hide resolved
When adding pending state pairs for a new incoming state to Connect,
we have to re-enable opposite states from ARMED state.
This changes the order of states in the interface.
If we do this while iterating over the states, we might add pairs multiple times,
because iteration continues with same state at an earlier position.
@rhaschke rhaschke force-pushed the debug-#485 branch 2 times, most recently from 5674df2 to e163f57 Compare February 15, 2024 21:22
@v4hn v4hn merged commit 7638e5f into moveit:master Feb 16, 2024
12 of 15 checks passed
@rhaschke rhaschke deleted the debug-#485 branch February 16, 2024 11:40
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.

Discontinuity in trajectory
2 participants