Commit Graph

1427 Commits

Author SHA1 Message Date
Robert Haschke
e67b3252fc static TaskPrivate::swap() -> ContainerBasePrivate::operator=()
- Enable moving/swapping of other container impls (e.g. Fallbacks)
- Clarify (via move semantics) that content of source impl will be lost
- Get rid of friend declarations
2021-11-24 21:17:49 +01:00
Robert Haschke
b84bb87102 pre-commit autoupdate 2021-11-24 21:17:49 +01:00
Robert Haschke
c822fd3822 Remove logger configuration
Logger config can be more easily handled via ROSCONSOLE_CONFIG_FILE.
2021-11-24 15:08:20 +01:00
Robert Haschke
a0bc0602e8 Enable tests
Adapt test results FallbacksFixturePropagate.computeFirstSuccessfulStagePerSolutionOnly
due to 2e63c154aa:

The order of computations has changed, because we lock the processed state
as soon as it is forwarded to the first fallback child.

In this case, after processing GEN1 und FWD1 once, we have the two states with costs 2, 4 in the queue.
The first one, i.e. with cost 2 is forwarded to the child FWD2, which fails.
In the next cycle, although we have new states in the queue (1, 2, 3, 4), we stick with state "2"
and forward it two FWD3, which adds costs 210, resulting in 212.

With previous code, the Fallback container switched to state "1", forwarded to FWD2.
2021-11-24 15:07:21 +01:00
Robert Haschke
2e63c154aa Reintroduce pending state 2021-11-22 01:39:45 +01:00
Robert Haschke
5c235ab580 debugging helper function 2021-11-22 01:39:45 +01:00
Robert Haschke
dcb6857f36 Simplify computePropagate()
- Drop variable current_external_state_
- Instead encode the info that the external state wasn't yet forwarded to any child via stage = children().cend()
- If all children have exhausted their solutions for this state, it is removed from the pending list
2021-11-22 01:39:45 +01:00
Robert Haschke
c33b1967bc Handle updates on external states 2021-11-22 01:36:34 +01:00
Robert Haschke
e5b20ac11f Fix pruning
Pruning - if acting on the external state - needs to pass the current stage (this).
2021-11-22 01:36:34 +01:00
Robert Haschke
6653c4853a Rename: computeFromExternal -> computePropagate 2021-11-22 01:36:34 +01:00
Robert Haschke
b783173b27 GENERATE: return correct canCompute() result as early as possible
Moving to next child generator only in compute() requires an extra call
to canCompute() to notice the failure of the next generator(s).
2021-11-22 01:35:34 +01:00
Robert Haschke
aef991602f Propagate either STATUS or PRIORITY updates into a container 2021-11-22 00:12:50 +01:00
Robert Haschke
a48b932dce Distinguish STATUS and PRIORITY updates in notify() callbacks
to allow propagating status updates only if the STATUS actually changed.
2021-11-21 15:05:29 +01:00
Robert Haschke
fdd5ff880b templatize: pullInterface(dir) -> pullInterface<dir>()
Also remove unused pushInterface(dir)
2021-11-21 14:15:59 +01:00
Robert Haschke
a31e52dd53 Propagate status across Connecting gap
Not only propagate updates along solution paths, but also bridge
the gap of a `Connecting` stage.

- If a state becomes enabled, re-enable opposite `ARMED` states as well.
- If a state becomes pruned, also prune opposite states if they don't have alternatives.
- Make sure that we don't run into a recursive update loop by disabling notify() callbacks.
2021-11-21 14:15:59 +01:00
Robert Haschke
3648db43ed Never overwrite ARMED with PRUNED 2021-11-21 14:00:50 +01:00
Robert Haschke
9d37495c0b Recombine both variants of Interface::updatePriority()
As only the InterfaceState* variant is actually called,
we can drop the splitting introduced for performance reasons in
29d1e44c5d
2021-11-21 14:00:50 +01:00
Robert Haschke
ffb8598363 Recursively prune new CONNECT state if there is no enabled opposite
This also requires to drop the assertion in SerialContainer::onNewSolution()
that new solutions will have enabled start+end states (a CONNECT stage's solution might not).
2021-11-21 14:00:50 +01:00
Robert Haschke
ab9af6a0fa Recursively re-enable states when matching an ARMED state 2021-11-21 14:00:50 +01:00
Robert Haschke
3c4ef68dbe Rename Interface::Status FAILED -> ARMED
... to better indicate that such a state can be immediately re-enabled.
2021-11-21 14:00:50 +01:00
Robert Haschke
1dda3d14d8 Switch order of function declarations
... to avoid explicit template initialization
2021-11-20 06:24:19 +01:00
Robert Haschke
52dc494525 Fix test Pruning.NoPruningIfAlternativesExist 2021-11-20 06:24:19 +01:00
Robert Haschke
06ae5ddf9c Fix hasPendingOpposites()
- Switch directions: FORWARD <-> BACKWARD to make the function reusable for status propagation.
- We need to ignore the source state when looking for opposite states of the target state.
  Thus add both, source and target state arguments.
2021-11-20 01:24:29 +01:00
Robert Haschke
29d1e44c5d Rework updatePriority() functions
- Centrally distinguish between have owner() or not in InterfaceState::updatePriority()
- Have a separate updateStatus() method to just update the pruning status
- Split Interface::updatePriority() into a method taking the InterfaceState*
  and one taking an Interface::iterator (for efficiency)
- Early return in container.cpp's updateStatePrios()
2021-11-19 23:03:15 +01:00
Robert Haschke
4170a1c93a Drop unused and misleading Direction enums 2021-11-19 23:03:15 +01:00
Robert Haschke
1ddf7dd3f0 Never remove pending CONNECT pairs
Both, failed and pruned states might get re-enabled later!
This also required rework (simplification) of the sorting function for pending pairs.
2021-11-19 23:03:15 +01:00
Robert Haschke
97c2130404 Improve readability 2021-11-19 21:49:44 +01:00
Robert Haschke
718170ab1e Always skip pruning if there exist alternative enabled solutions 2021-11-19 21:49:44 +01:00
Robert Haschke
c617e3353d Disable failing tests 2021-11-19 21:46:09 +01:00
Robert Haschke
011e4be059 Add more pruning tests 2021-11-19 09:42:30 +01:00
Robert Haschke
66e141db7b Fix printChildrenInterfaces() 2021-11-19 09:42:30 +01:00
Robert Haschke
ed459702bd Fix -Wsign-compare 2021-11-19 02:05:46 +01:00
v4hn
b675876d3b add debug logs to pruning code 2021-11-16 22:52:06 +01:00
JafarAbdi
2d775ffe28 GeneratorMockup: Add solutions_per_compute argument 2021-11-16 22:51:29 +01:00
v4hn
b6ac5b09ba add demo illustrating useful fallbacks behavior 2021-11-15 09:29:09 +01:00
v4hn
887da5b094 fix fallbacks logic
Setting up a demo for
Fallbacks({CartesianPath,PTP,RRTConnect})
I found the logic did not work as expected yet.

- process last job spec as well
- ignore failures when looking for a solution
- add more debug output
2021-11-15 09:29:09 +01:00
v4hn
22809c04a5 order external states 2021-11-15 09:29:09 +01:00
v4hn
9a583ab006 run only one compute step per call
Note that while this ensures other stages outside the Fallbacks container
can compute as well, it does not solve the problem internally.
A new incoming state will only ever be considered once
the current stage cannot compute any more.

We have no way of telling a child to compute for *a specific state* for now.
So once we copied a state to its interface we have to let it compute until
all possibilities are exhausted to detect whether or not it could generate a solution for it.
If we wouldn't do so, there were no way of knowing when to fall back
to the next child as long as the stage can still compute on *any* copied solution.
2021-11-15 09:29:09 +01:00
v4hn
5a9cfc50ea cleanup: get rid of superfluous parameter 2021-11-15 09:29:09 +01:00
v4hn
aa733fcf5f simplify onNewFailure
give an elaborate reason for an empty overload that doesn't call the parent.
2021-11-15 09:29:09 +01:00
v4hn
3d5cecd753 fallback generator can run a single job per compute call 2021-11-15 09:29:09 +01:00
v4hn
8719b1c3d6 Implement state-wise Fallbacks
Keep the previous logic around for Generator stages.
Note that this only makes sense for *pure* Generators and not for MonitoringGenerator,
because for the latter we would expect monitored solutions to be passed individually
(similar to pruning).
2021-11-15 09:29:09 +01:00
v4hn
f32e747645 add hook to ParallelContainerBase to customize state propagation 2021-11-15 09:29:09 +01:00
Michael Görner
79869b856c
Merge pull request #304 from v4hn/pr-move-to-tests
Add MoveTo tests & make them pass
2021-11-12 23:14:57 +01:00
v4hn
3b835986e3 refactor logic to handle ik_frame
fallbacks and verification.
2021-11-12 14:02:46 +01:00
v4hn
f1fc447e3b establish utils namespace
leaves us a place to put free helper functions
2021-11-10 14:36:58 +01:00
v4hn
48959c6806 add compat header to cmake
previous oversight
2021-11-10 14:35:25 +01:00
v4hn
0f53db5f12 simplify parameter-free lambdas
I just didn't know the syntax was allowed
2021-11-10 13:33:26 +01:00
Robert Haschke
01d0cf9a13 Extend mtc_add_test() macro to handle rostest as well 2021-11-10 13:14:04 +01:00
v4hn
ef27a6eb22 ComputeIK supports attached-object ik frame 2021-11-10 13:14:04 +01:00