Commit Graph

864 Commits

Author SHA1 Message Date
j-kuehn
67fe4faa30 allow to consider specific joints only in cost terms 2021-05-25 15:47:18 +02:00
Robert Haschke
81fae53009 PyMonitoringGenerator 2021-05-21 12:20:54 +02:00
Robert Haschke
9f7139f376 Fix names of trampoline classes
Using template names T is not a good idea, because this name is used
verbatim for some error reporting, resulting e.g. in:
Tried to call pure virtual function "T::canCompute"
2021-05-21 11:40:12 +02:00
Robert Haschke
0967aa808b Update pybind11 submodule 2021-05-21 01:55:39 +02:00
Robert Haschke
1e7fe85573 smart_holder: conservative mode
... to become compatible with classical pybind11 modules, e.g. the MoveIt packages
2021-05-21 01:55:39 +02:00
Robert Haschke
7d0b6da04f Generator::spawn() 2021-05-21 01:55:39 +02:00
Robert Haschke
a03ea5a4a9 Use pybind11's smart_holder branch 2021-05-20 03:56:47 +02:00
Robert Haschke
defe144b55 Use py:overload_cast<>() 2021-05-20 03:52:32 +02:00
Robert Haschke
fc0abe9dd9 Merge branch 'master' into wip-python-api 2021-05-20 03:49:52 +02:00
Robert Haschke
3c286b2226 Augment license/disclaimer 2021-05-19 23:04:44 +02:00
Robert Haschke
f006ff7a37 Allow casting of PoseStamped from string 2021-05-19 23:04:44 +02:00
Robert Haschke
84ccd679d9 Fix compiler warnings
unused parameters and functions
2021-05-19 21:54:48 +02:00
v4hn
7eb8fad57e remove unused helper method 2021-05-12 19:21:19 +02:00
v4hn
f7015ee021 fix pick_ur5 test
TAMS' models changed and often produces less solutions.
2021-05-12 19:21:19 +02:00
j-kuehn
d71c645d83
add visualization for Point goals (#264)
- move visualization from `getPoseGoal` to `compute`
- create target frame from `target_eigen` to allow visualization from Pose and Point goals
2021-05-11 10:53:15 +02:00
j-kuehn
ba0b4f6146
Improve arrow visualization for MoveRelative stage (#255)
Implement visualization as red-green arrow
* overload makeArrow to allow creation with points
* create new function for visualization
* if no plan is found, construct arrow from green cylinder and red arrow
* adjust arrow construction for backward propagators
2021-05-03 21:29:05 +02:00
Robert Haschke
cfcb1f274e Fix more clang-tidy issues 2021-04-24 02:12:24 +02:00
Robert Haschke
4fa8c10f44 clang-tidy auto-fixes 2021-04-24 02:03:24 +02:00
Robert Haschke
889b61529b Fix trailing white space 2021-04-23 23:49:50 +02:00
Robert Haschke
dc8cd34b86 Simplify tests 2021-04-01 00:21:07 +02:00
v4hn
4e09d78239 Implement pruning inside-to-outside of a container
- Remove public onNewFailure() interface
  Moved to ContainerBasePrivate to reuse logic for serial and parallel containers.
- Add tests
2021-04-01 00:19:15 +02:00
Robert Haschke
a204d94a19 Configure namespace package 2021-03-31 00:19:51 +02:00
Robert Haschke
5b4ca1d21a Rename wrapper -> bindings 2021-03-31 00:19:51 +02:00
Robert Haschke
045b358c30 rosdoc_lite configuration 2021-03-31 00:19:51 +02:00
Robert Haschke
3cf92442fb Simplify generation of pybind11 modules
* Install module libs into CATKIN_GLOBAL_PYTHON_DESTINATION (assuming unique names).
  This avoids the need to link them into the source space, because they are found also from devel space.
* Use pybind11's def_submodule() to create the `core` and `stages` submodules,
  everything linked into the same lib
2021-03-31 00:19:51 +02:00
Robert Haschke
d9b7aa37a3 clang-format python wrapping code 2021-03-31 00:19:51 +02:00
cpetersmeier
14e06659d5 Towards inherited classes in Python 2021-03-31 00:19:51 +02:00
v4hn
472a78800d implement bimap for internal_external state map
Get hashing for inverted lookups, but incur
structural overhead.

Whether this is worth it depends on the number of mapped interface states
and the number of pruning/reactivation requests.
2021-03-30 15:19:49 +02:00
Robert Haschke
0e3ec0b6ec fix constness 2021-03-30 15:19:49 +02:00
v4hn
106c138ef5 Implement pruning inside serial container
By inefficient inverse lookup.

Also add disabled test for the inverted inference (failure inside should prune outside)
2021-03-30 15:19:49 +02:00
Michael Görner
36d9d3e8c0
Rework PipelinePlanner creation (#249)
- Moved Task::createPlanner into PipelinePlanner::create
- Handle mutiple planner pipeline configs as introduced in https://github.com/ros-planning/moveit/pull/2127
2021-03-29 12:00:28 +02:00
Robert Haschke
4ee71881ae
Rework Pruning (#221) 2021-03-23 13:04:38 +01:00
Michael Görner
f2958a4a0b
Explicitly instantiate PropagatingEitherWay::send<> templates (#246)
Otherwise compiler was optimizing (inlining) them away.
2021-03-23 11:37:30 +01:00
v4hn
b7f80939ef add more asserts to onNewSolution
Strictly speaking there is no need for the invariant,
but if something violates it a stage computed something it wasn't meant to.
2021-03-22 14:42:23 +01:00
v4hn
3b6c13e26b only run propagators on enabled solutions
resolve simple pruning test
2021-03-22 14:42:23 +01:00
v4hn
3e5e1da429 add (failing) simple pruning test
to validate propagators do not compute disabled solutions.
It's also good to have a simpler test around than 2 connects.
2021-03-22 14:42:23 +01:00
v4hn
9cf3c01b9a pruning tests: restructure tests 2021-03-22 14:42:23 +01:00
v4hn
be1c8292b5 add more (commented-out) debug statements
Also print generator symbol for completeness.
2021-03-22 14:42:23 +01:00
v4hn
e33962364d resolve PruningMultiForward test
Every InterfaceState along the partial solution has to be disabled
for pruning, not just the ends that are currently relevant.
2021-03-22 14:42:23 +01:00
v4hn
f8f885966e add failing pruning test for branching propagator 2021-03-22 14:42:23 +01:00
v4hn
a82b88355e streamline trait parameters
state asked for a reference, but trajectories for a pointer.
2021-03-22 14:42:23 +01:00
v4hn
bca01e8aa7 rename Status values
Start and End are already used for an entirely different concept,
so if anyone ever wants to read this code, we should use new terms instead.

Because the source state is the disabled state that *failed* to extend,
triggering the whole subtree to be disabled, I went for the new terms
DISABLED and DISABLED_FAILED.
2021-03-22 14:42:23 +01:00
Robert Haschke
c0100ff775 Remove debug output 2021-03-22 14:42:23 +01:00
Robert Haschke
d3864596b6 Replace Priority::enabled() with status()
The key to pruning in the Connecting stage was the following:
- Don't remove states during pruning, but only disable them.
  They might become re-enabled due to further input.
- Distinguish START and END sides of a disabled solution tree to break their symmetry.
  The START side from where we started disabling, can be re-enabled by a new partner state in
  Connecting, the END side must not. This was important as, otherwise, the states would simply
  get re-enabled immediately. The END side only gets re-enabled if the START side actually
  connects the whole solution branch.
2021-03-22 14:42:23 +01:00
Robert Haschke
f229743024 Debug evolution of interfaces 2021-03-22 14:42:23 +01:00
Robert Haschke
9466517f72 operator<< for Interface + Priority
Co-authored by v4hn
2021-03-22 14:42:23 +01:00
Robert Haschke
7c6eb1c0f3 Extend unit tests: PruningForward + PruningBackward 2021-03-22 14:42:23 +01:00
Robert Haschke
604a0da1e4 Actually implement pruning and re-enabling of states 2021-03-22 14:42:23 +01:00
Robert Haschke
19484cec64 Restore pruning
If a stage fails to find a solution, this often implies that further planning
on the open end(s) of connected InterfaceStates is not needed anymore.
Thus the InterfaceStates along all connected solution paths will be marked as disabled.
They are not removed from the pending state lists though, because they might get
reactivated by solutions found in future.

To this end, we introduced the method ContainerBase::onNewFailure().
2021-03-22 14:42:23 +01:00
Robert Haschke
6c18e2b482 test comparison of ConnectingPrivate's StatePairs 2021-03-22 14:42:23 +01:00
Robert Haschke
2a09daa42f InterfaceState::Priority::enabled()
To allow pruning, we need to enable and disable InterfaceStates to be considered for further
planning. In the past, we just indicated the disabled status with infinite costs.
However, because we might need to re-enable states (with previous state),
we need to separate these two concepts.
2021-03-22 14:42:23 +01:00
cpetersmeier
6ab50fcc40 PythonWrapper: Use collective includes 2021-03-19 18:39:47 +01:00
Robert Haschke
1f5c684909 Simplify wrapper code 2021-03-19 18:39:47 +01:00
Robert Haschke
d7d54d828f Access to container's children 2021-03-19 18:39:47 +01:00
Robert Haschke
fd25a0626a auto-format python code with black 2021-03-19 18:39:44 +01:00
Robert Haschke
10f6b7a58e MoveTo/MoveRel: reduce code duplication
... using templated versions for computeForward + computeBackward
as they essentially perform the same operations.
2021-03-19 18:22:04 +01:00
Robert Haschke
dfffd77eee MoveTo/MoveRel: Report errors via solution comments instead of ROS_WARN 2021-03-19 18:22:04 +01:00
Robert Haschke
5de9ce7203 Perform clang-format check via github action from pre-commit.com 2021-03-15 14:29:19 +01:00
Robert Haschke
0b63c590c5 Replace MoveIt! -> MoveIt 2021-03-15 14:29:19 +01:00
v4hn
3d8faea079 add test to validate correct solution state in computeCost
This is somewhat cumbersome because of the additional internal/external
layer introduced through the container.
But it's still better than leaving this unverified.
2021-03-05 14:38:29 +01:00
v4hn
f4fb8c6f71 fix computeCost interface (again)
Fixes the missing creator pointer introduced in a6a23d3775
2021-03-05 14:38:23 +01:00
v4hn
629d266fbc remove leftover joint counting
Not used anywhere
2021-03-05 14:38:14 +01:00
v4hn
f7a94956c3 output stream formatting for InterfaceState::Priority 2021-03-05 14:38:06 +01:00
Robert Haschke
a6fa45214f Remove return value from Container::insert
adapted Container::add

Logical consequence of removing the ROS_ERROR output in `setParent`
2021-02-24 12:22:38 +01:00
v4hn
4386d0cc60 remove roscpp as an export dependency for the core package
We do use ROS in the background. But there is no need for a public export dependency on it.

This patch also resolves the following catkin_lint issue:

moveit_task_constructor_core: CMakeLists.txt(17): error: package 'roscpp' must be in CATKIN_DEPENDS in catkin_package()
2021-02-24 12:22:38 +01:00
Robert Haschke
f2d2cf10f0 Fallback: Correctly end iterating children
Fixes #234
2021-02-17 21:17:05 +01:00
Robert Haschke
f99d03386a
Use RobotModelBuilder to simplify tests (#225)
* Simplify RobotModel definition using RobotModelBuilder
* Silent RobotModel errors once in models.cpp
2020-12-30 11:07:57 +01:00
Jafar Abdi
8a913d8bf3
getTaskId(): Replace '-' in hostname with '_' (#223) 2020-12-15 20:39:01 +01:00
Robert Haschke
9f18219993 minor cleanups
* unify usage of pimpl()
* fix StatePair constructors
* improve/add comments
* test_container: reset MOCK_ID for each test to facilitate identification of stages
2020-12-06 23:55:58 +01:00
Robert Haschke
0925031a81 Propagating: disable infeasible state pruning
Because stages might get re-enabled later, we must not throw them away.
Remove dropFailedStarts(), dropFailedEnds().
Extend Pruning unittest.
2020-12-06 23:55:10 +01:00
Robert Haschke
a6a23d3775 Remove set[Start|End]StateUnsafe
These methods were introduced to temporarily set meaningful states for cost calculation
w/o connecting the solution to these temporary states (to solve a chicken-egg problem).
This commit provides TmpInterfaceStateProvider as an alternative approach to this problem.

This essentially reverts 53c0964618.
2020-12-06 04:11:35 +01:00
Robert Haschke
c8e75ab205 Simplify SolutionCollector 2020-12-06 04:11:35 +01:00
Robert Haschke
576a1aa48d Remove default constructor for Priority
It's better to explicitly state the initial value.
2020-12-06 04:11:35 +01:00
Robert Haschke
56ad37d80e Provide move constructor for InterfaceState
The code was tuned to move InterfaceStates around, but there wasn't the matching constructor!
2020-12-06 04:11:35 +01:00
Robert Haschke
bc25c5e3c1 Modernize: require cmake version 3.1.3 2020-12-06 04:11:35 +01:00
Robert Haschke
5d4cf640ef Fix issues #182 + #218 2020-12-06 04:10:47 +01:00
Robert Haschke
a9cd4e3281 Connect: Decouple subsolutions of SolutionSequence from external interface states 2020-12-06 04:09:59 +01:00
Robert Haschke
f05b08fa8a SerialContainer: Simplify solution traversal
Compute depth + accumulated cost of a partial solution sequence using InterfaceState::Priority.
2020-12-06 04:09:59 +01:00
Robert Haschke
11647fd3e5 Connect: mark failures in sub solutions of a sequence 2020-12-06 04:09:59 +01:00
Robert Haschke
c73c0c3555 Interface::updatePriority(): only allow decrease 2020-12-06 04:06:08 +01:00
Robert Haschke
08dc19f7b3 Fix cost calculation
The default CostTerm should rely on precomputed costs. Only, if a CostTerm is explicitly defined
for a particular stage, it should modify costs.
2020-12-06 04:06:08 +01:00
Robert Haschke
66fdff9711 Simplify state priority updates
Only need to update the end points of a partial solution.
2020-12-06 04:06:08 +01:00
Robert Haschke
5fd98ce307 SerialContainer tests 2020-12-06 04:06:08 +01:00
Robert Haschke
fe189cd692 Test Interface::updatePriority() 2020-12-06 04:06:08 +01:00
Robert Haschke
b2adcf0247 Python3 compatibility 2020-11-30 13:34:33 +01:00
Robert Haschke
c97b462024 migration: boost::python -> pybind11 2020-11-30 13:34:33 +01:00
Robert Haschke
8433e460e4 Merge branch 'master' into wip-python-api 2020-11-26 12:05:03 +01:00
cpetersmeier
012a10be25 StagesWrapper: Python Function Bindings
Add python bindings for

    - SimpleGrasp::setIKFrame
    - Pick::setApproachMotion
    - Pick::setLiftMotion
2020-11-26 11:47:20 +01:00
Robert Haschke
bfa2a6070d MoveTo: Publish failed planning attempts 2020-10-30 00:44:51 +01:00
Robert Haschke
ae843a784e Merge PR #214 (fix various issues) and #215 (rework rviz introspection) 2020-10-24 04:45:53 +02:00
Robert Haschke
cf5031e89d Create task-specific ServiceClients to fetch solutions
This finally allows to have multiple tasks publishing in the same namespace.
2020-10-24 04:43:30 +02:00
Robert Haschke
b91d87c6eb IntroSpection: indicateReset() on disable 2020-10-24 04:43:30 +02:00
Robert Haschke
8b1c66c4b7 Allow naming a Task
which just names the top-level container
2020-10-24 04:43:30 +02:00
Robert Haschke
c471879b08 Rename process_id -> task_id 2020-10-24 04:43:30 +02:00
Robert Haschke
b071a059f9 Rename TaskPrivate::id -> TaskPrivate::ns
TaskPrivate's id_ actually served as a namespace parameter.
2020-10-24 04:43:30 +02:00
Robert Haschke
3a7a4eb953 Connect: Fix segfault when accessing solutions from multiple plan() calls
Connect::init() was resetting its dynamically created JMG merged_jmg_,
thus invalidating all previous solutions. Only reset the JMG in reset().
2020-10-24 03:23:19 +02:00
Robert Haschke
cb0f20cad7 Improve task unittests 2020-10-24 03:22:46 +02:00
Jafar Abdi
be270cb574
Task: Add ability to set timeout (#213)
Task::setTimeout will allow setting an overall timeout.
2020-10-24 03:22:05 +02:00
cpetersmeier
ede5fe396f StagesWrapper: Add std::map setGoal overload.
Adding a further overload of the `setGoal()` function that is exposed to
the python api. This should provide an interface for passing in dicts as
joint name and -angle configurations.
2020-10-21 16:45:05 +02:00
Robert Haschke
d3b878a31c Fix issues with Merger stage 2020-09-23 08:00:42 +02:00
Robert Haschke
88c217e9a6 Report exceptions (e.g. config issues) 2020-09-23 07:59:39 +02:00
Robert Haschke
7499f7b297 Report merge failures 2020-09-23 07:59:39 +02:00
Robert Haschke
14fc3d2586 Reject failures early 2020-09-23 07:59:39 +02:00
Robert Haschke
49b2ff8ce5 Test Merger 2020-09-22 11:06:34 +02:00
Robert Haschke
745d6739bd fix typo 2020-09-22 11:06:01 +02:00
Robert Haschke
8152994e52 Fix interface resolution 2020-09-22 10:57:49 +02:00
Robert Haschke
4089d5eefa Container::remove(): return removed Stage 2020-09-22 10:56:11 +02:00
Robert Haschke
198f8f5389 clearer naming of cost variables 2020-09-21 22:52:19 +02:00
v4hn
04a8afb16c melodic compatibility 2020-09-21 22:52:19 +02:00
v4hn
5d0fd57754 initialize default CostTerm in constructor
It seems to be too fragile to rely on `init` being called.
On the other hand we should really enforce this anyway. -.-
2020-09-21 22:52:19 +02:00
Robert Haschke
687fcb6a6d Update comments to solution's computeCost() methods 2020-09-21 22:52:19 +02:00
v4hn
62586c2688 rework CostTerm's from support flags to vtable
requested in review.

Without support for custom aggregators, which we dropped again
after finding more flaws with it, I agree that this is the nicer solution.

On the downside, it converts the interfaces from copyable objects
to another round of shared_ptrs.

I added shortcuts for lambda costs to keep support for
`stage->setCostTerm([](auto&& s){ return 42; })`
without the additional
`stage->setCostTerm(LambdaCostTerm{ [](auto&& s){ return 42; } } )`
2020-09-21 22:52:19 +02:00
v4hn
45e6cdb47d Revert "add CostAggregator for SerialContainer"
This reverts commit dc7ce9bdfac97eb468f5a850adcb27cc118b5fd7.

It turns out multiple places in SerialContainer's cost inference
expect 0.0 as the neutral element (which is why std::min and multiply did not work).
While these additional issues can be fixed, it would make the interface much less elegant.

We should consider adding it back if an actual use-case is there to discuss.
2020-09-21 22:52:19 +02:00
v4hn
cce7380f9d Clearance: provide better interface for different modes
Interface::Direction should always designate a valid direction.
2020-09-21 22:52:19 +02:00
v4hn
f63d5b6892 Make transform in cost::Clearance configurable
In theory this can be done with a PassThrough with a modifying transform,
but this specific mapping is intrinsic to the definition of Clearance as a cost.
2020-09-21 22:52:19 +02:00
v4hn
cdc7cb04fc refactor Forward -> PassThrough
based on review feedback
2020-09-21 22:52:19 +02:00
v4hn
64e2440c53 simplify LinkMotion computation
review feedback
2020-09-21 22:52:19 +02:00
v4hn
05932ad5f1 enable implicit construction of CostTerm from lambdas
without the need for explicit casts to the correct signature.
2020-09-21 22:52:19 +02:00
v4hn
034a155315 provide CostTerm class for all CostTerms
This pattern allows cost::Constant to override the hierarchical cost computation
for the SerialContainer and avoid traversing the graph.

I implemented the CostTerm::supports() pattern over a full double visitor pattern
with overloads for each SolutionBase specialization, because the SerialContainer
needs to know whether cost aggregation of the subsolutions should take place or whether
the SolutionSequence should be forwarded to the CostTerm.
This would not be possible with a `virtual double operator()(const SolutionSequence&)`
callback in CostTerm.

Alternatively, implementing the hierarchical aggregation in the default implementation
of this operator would be possible as well, but breaks intuition:
- the corresponding methods to handle `SubTrajectory` and `WrappedSolution` *have to*
  default to not touching the solution's cost at all so it is inappropriate to have
  the default implementation for the Sequence do something else
- The SerialContainer also aggregates costs outside the `computeCost()` interface
  (in multiple places in `onNewSolution()` to aggregate costs along partial paths)
  and thus moving the hierarchical aggregation to the CostTerm methods requires
  the aggregator to be shared between the Container and the CostTerm,

The only shortcoming of the implemented approach, by contrast, is that user implementations
that want to handle WrappedSolution or SolutionSequence differently have to ensure
the supports_ flags are set correctly. Notice that most custom CostTerms will only
ever access SubTrajectories and this case is simplified with the provided CostTerm constructors.
2020-09-21 22:50:51 +02:00
v4hn
8ae1060b4d add CostAggregator for SerialContainer
It can be useful to change the default addition to other operators.

The simplest example is applying a Constant cost term to a container.
As the tests show, the visitor-based cost computation ends up adding
cost::Constant *for each subtrajectory*.
2020-09-21 22:50:51 +02:00
v4hn
28b98e989c improve cost term tests
- add tests for nested containers
- add descriptions to checks
- refactor helper to support different containers
2020-09-21 22:50:45 +02:00
v4hn
dcee7c408f add basic tests for using cost terms 2020-09-21 22:31:52 +02:00
v4hn
1689f6cd95 introduce new trivial stage Forward
This can be used together with a custom CostTerm to modify costs of a solution.
2020-09-21 22:31:52 +02:00
v4hn
0e38730fd4 compute cost in liftSolution as well 2020-09-21 22:31:52 +02:00
v4hn
939f0b7256 setCostTermShort(nullptr) must not set a valid function 2020-09-21 22:31:52 +02:00
v4hn
a0975e3afc avoid ambiguity of setCostTerm(nullptr) 2020-09-21 22:31:52 +02:00
v4hn
d68ab383b6 allow setCostTerm for containers
implement visitor pattern for cost computation on solutions

- compute cost terms for solution subtrees instead of only for SubTrajectory

- allows users to set cost terms for containers
2020-09-21 22:31:24 +02:00
v4hn
039b0a2c27 move more overhead to computeCost 2020-09-21 22:31:23 +02:00
v4hn
e53d943b75 remove CostTransform
If required, this can hopefully be implemented through Wrapper stages soon.
2020-09-21 22:31:23 +02:00
v4hn
53c0964618 cost computation: provide valid interface states for Solution
The CostTerm's should get only a single solution that is well-setup
with its InterfaceStates. That's impossible though because these
states are stored in different places depending on the cost.

To avoid this, set stub states for cost computation
and change them to the real states later on.

This is motivated by the Clearance cost which can act on an InterfaceState only.
2020-09-21 22:31:23 +02:00
v4hn
bbf7d415f6 make cost operators const 2020-09-21 22:28:36 +02:00
v4hn
1f8feaaf0a refactor addCost->computeCost 2020-09-21 22:26:25 +02:00
v4hn
d2bd0a0037 generalize Clearance cost
- can now be used to estimate cost for either interface state or the trajectory
- Introduced Interface::Direction NONE as a way of pointing to the trajectory in contrast to START or END
2020-09-21 22:26:25 +02:00
v4hn
7a00ac646e add missing license 2020-09-21 22:24:44 +02:00
v4hn
14c885621f remove Cost suffix for elements in mtc::cost:: 2020-09-21 22:24:44 +02:00
v4hn
9a96a7e4f6 implement LinkMotionCost 2020-09-21 22:24:44 +02:00
v4hn
6dbc742f20 implement correct PathLengthCost
The previous implementation depends on the dynamics limits of the robot,
which might be interesting in some cases, but shouldn't be a default anywhere.
2020-09-21 22:24:44 +02:00
v4hn
a92753dafc add cumulative distance to ClearanceCost 2020-09-21 22:24:44 +02:00
v4hn
18ed51d7f3 turn Clearance cost into parameterized struct
There is a lot of variations for how to compute clearance.
2020-09-21 22:24:44 +02:00
v4hn
cf0e4e3b01 establish struct cost pattern
for costs with multiple parameters, this option-style is more useful
than verbose getter/setter. There is nothing to hide here.
2020-09-21 22:24:07 +02:00
v4hn
f9ba302728 enable costs to (optionally) return a comment
With more complicated costs (such as the ClearanceCost), it's useful to get comments.
2020-09-21 22:22:37 +02:00
v4hn
a15204b40b allow wrappers to use CostTerm 2020-09-21 22:22:37 +02:00
v4hn
56268cb6cc first attempts on ClearanceCost 2020-09-21 22:22:37 +02:00
v4hn
9060404037 improve comments 2020-09-21 22:22:37 +02:00
v4hn
f3fec26f5a add CostTransform
CostTerms only apply to primitive solutions and generalizing them
to Containers would make them quite unintuitive (and adds overhead).

Instead CostTransform can be used in any container to scale, crop, square
the cost of the solutions.

I initially thought about adding scaling factors, but then again,
other transforms are of interest just as well.
2020-09-21 22:22:37 +02:00
v4hn
f79625d1bd fully restrict CostTerms to primitive solutions
simplify implementations.
2020-09-21 22:22:37 +02:00
v4hn
ffc62c2d11 add explicit default CostTerms to most basic stages
Simplifies code and makes the costs of each stage explicit.
2020-09-21 22:22:37 +02:00
v4hn
9eae554d89 provide Constant and PathLength cost terms 2020-09-21 22:22:37 +02:00
v4hn
9337743de2 add CostTerm interface
basic stages can now be configured with arbitrary cost terms.
2020-09-21 18:02:49 +02:00
v4hn
1a2eafa256 fix stage test mock
base class init needs to be called although this didn't pose problems
until now.
2020-09-17 23:00:12 +02:00
Robert Haschke
97e0b437f2 Silence -Wdeprecated-declarations due to std::auto_ptr 2020-09-07 23:18:43 +02:00
Robert Haschke
7306878b9e Merge branch master into wip-python-api 2020-09-07 23:18:20 +02:00
v4hn
c510c6b5b6 WrappedSolution: expose child solution
SolutionSequence allows to access children already,
but WrappedSolution blocked access to the full hierarchy.
2020-08-21 14:41:22 +02:00
v4hn
4a6c389aee expose WrappedSolution together with other Solution types
Moved out of private header.

Users can access these objects, so they should know about the type.
2020-08-21 14:41:22 +02:00
v4hn
7609f0b1e2 Solution: export public creator
It's a public interface, returning private pointer is not neat.
2020-08-21 14:41:22 +02:00
v4hn
3aa0cfc1a2 InterfaceState: provide constructor with initial Priority
most useful to prepare a valid InterfaceState in tests
2020-08-21 14:41:22 +02:00
v4hn
6e0e323a58 PredicateFilter: actually use declared property 2020-08-20 15:29:45 +02:00
v4hn
310ca3ef15 MoveTo: support map<string,double> joint target
There was a corresponding setGoal method already, but no implementation...
2020-08-20 15:20:29 +02:00
Michael Görner
ee6c50ad31
Apply clang-format-10 (#199) 2020-08-20 11:56:53 +02:00
Michael Görner
47f052b93d
adapt tests to new moveit_resources layout (#200) 2020-08-20 11:04:18 +02:00
v4hn
62813f33f7 fix c&p error in documentation 2020-08-11 20:43:34 +02:00
v4hn
62d894199f expose Stage API to get the matching introspection ID
This was implicitly requested in #192 .
2020-08-11 20:43:34 +02:00
v4hn
6bebe3f3ed do not mix pimpl() and impl for no reason 2020-08-11 20:43:34 +02:00
v4hn
03c7f55fcc fix unused-parameter warning 2020-08-11 20:43:34 +02:00
v4hn
e861d311e0 fix comment typo 2020-08-11 20:43:34 +02:00
v4hn
d031f1b1e3 send a single reset message when introspection is enabled
My previous patches accidentally disabled *all* (3) reset messages,
instead of keeping exactly one. This patch sends exactly one empty description
(reset) message every time an introspection instance is constructed for a task.

Notice the additional increase of the description queue_size from 1 to 2 to avoid
directly dropping the reset message in favor of the new description likely to be send
shortly afterwards.
2020-07-22 12:57:34 +02:00
v4hn
7ba73306ca introspection *can* be disabled
Otherwise a new task will always setup the publisher,
even if introspection is disabled afterwards.

It is a good idea to keep introspection on, but there should be a way to initialize the C++ classes without ROS communication.
2020-07-22 12:57:34 +02:00
v4hn
0aff5d56dd replace remaining typedefs by using declaration
I have no idea why these were not picked up by clang-tidy.
2020-07-22 12:57:34 +02:00
v4hn
21f3d95128 fix autocomplete typo 2020-07-22 12:57:34 +02:00
Robert Haschke
0902d432ce Improve code readability 2020-07-01 22:13:21 +02:00
Robert Haschke
ee7ebb3b96
SolutionMsg: always fill start_scene (#175)
So far, the start_scene field of a SolutionMsg was only filled by  Introspection::fillSolution(),
but not yet by Task::execute().

Addendum(v4hn): The previous approach was actually reasonable too (although the scene should have been marked as `is_diff`) for solutions sent for execution, but keeping the full start_scene around can facilitate debugging from recorded data.
2020-06-18 11:07:05 +02:00
Robert Haschke
1610f5ab1d MoveRelative: provide failure message 2020-06-13 22:48:48 +02:00
v4hn
15707673ed clang-tidy: performance-*
I NOLINTed the noexcept move constructor for Task for now because
the constructor *can* indeed throw exceptions.
2020-06-11 11:03:50 +02:00
v4hn
8faba159f9 clang-tidy: llvm-namespace-comment 2020-06-11 11:03:50 +02:00
v4hn
2153237643 clang-format: readability-identifier-naming
Probably the most invasive format patch, also changing some internal API.

I deliberately disabled ClassCase and MethodCase checks for the moment
to avoid public API changes in this patch set.
2020-06-11 11:03:50 +02:00
v4hn
fa041ed2e6 clang-format: readability-container-size-empty 2020-06-11 11:03:50 +02:00
v4hn
b762079478 clang-tidy: readability-named-parameters 2020-06-11 11:03:50 +02:00
v4hn
5da2df4c61 clang-tidy: modernize-use-nullptr 2020-06-11 11:03:50 +02:00
v4hn
3fe4436ad7 clang-tidy: modernize-use-override 2020-06-11 11:03:50 +02:00
v4hn
36166348bc clang-tidy: use using over typedef
$ run-clang-tidy.py -header-filter='.*' -checks='modernize-use-using' -fix

add .clang-tidy file
2020-06-11 11:03:50 +02:00
v4hn
c662311a78 grant access to subsolutions of a sequence
SubTrajectory allows to access the trajectory,
but for SolutionSequence is was not needed until now.
2020-06-11 11:03:50 +02:00
v4hn
98cac4fd7c add informative comment 2020-06-11 11:03:50 +02:00
v4hn
ebf7b751d2 do not reset on plan
users can reset explicitly as needed.
Reset sends ROS messages and prevents { plan(1); plan(1) } style usage.
2020-06-11 11:03:50 +02:00
v4hn
b9839a3f22 check for valid robot model
Also, no need to reset() unless the model is different and not the first.
2020-06-11 11:03:50 +02:00
v4hn
b27939cb27 fix typo 2020-06-11 11:03:50 +02:00
v4hn
d224097f3f extend comment on unintuitive setter 2020-06-11 11:03:50 +02:00
Jafar Abdi
b3b215a4f7
Add ability to add/remove objects to/from planning scene (#165) 2020-05-05 18:28:54 +02:00
Aris Synodinos
2d99017c17
Fix for GCC5 (Ubuntu 16.04 / Kinetic) call to non-constexpr function (#163)
Co-authored-by: Aris Synodinos <aris.synodinos@unibap.com>
2020-04-22 11:48:08 +02:00
v4hn
72af8bc94b add convenience includes 2020-04-18 21:04:57 +02:00
v4hn
05ce4d796b expose group property 2020-04-17 18:48:18 +02:00
Robert Haschke
1f8dae86dd Merge #156: Rework interface resolution 2020-04-10 22:44:59 +02:00
Robert Haschke
c4d0ab0636 SerialContainer: Resolve interfaces of all stages 2020-04-10 20:25:54 +02:00
Robert Haschke
499fcfb04b cleanup / renaming
* Rename pruneInterface() -> resolveInterface()
* Rename accepted (interface) -> expected
* Improve exception strings
2020-04-10 20:11:51 +02:00
Robert Haschke
aa732d8c66 simplify internal API 2020-04-10 19:59:27 +02:00
Robert Haschke
e56c772ecb Combine pruneInterface() + validateConnectivity()
Validate interfaces during resolution. No need to separately validate interfaces.
Thus, validateConnectivity() is removed from Task::init().
Functions are kept (but simplified) for unit testing.
2020-04-10 19:59:27 +02:00
Robert Haschke
10260b9dd7 Further simplify interface resolution
* Do not modify explicitly configured direction of Propagator
* Avoid code duplication in pruneInterface() and validateConnectivity()
  Only implement pruneInterface() for stages that actually need to adapt their interface.
2020-04-10 19:59:23 +02:00
Robert Haschke
4d8d32dda5 New test: keep previously configured propagate interface 2020-04-10 19:39:32 +02:00
Robert Haschke
9116e92d08 minor cleanup, fixing warnings, improving comments 2020-04-10 19:39:32 +02:00
Robert Haschke
a98d5ed8ae templated flowSymbol<input/output mask>(flags)
* Enforce at compile time that either input or output flags are considered.
* Use horizontal flow symbols (as in console output).
* Replace redundant direction(flags).
2020-04-10 19:39:32 +02:00
Robert Haschke
7f33633e82 Simplify test_container.cpp
* Reset mock_id for each test to facilitate assignment
* Simplify creation of nested containers
* Moved some test cases around
* Output all exception messages (even expected ones)
2020-04-10 19:34:51 +02:00
Jafar Abdi
b4fb8bb435
Allow constructing PipelinePlanner from PlanningPipelinePtr (#155) 2020-04-08 17:36:02 +02:00
v4hn
b6a5f89307 remove logical flow BOTH / simplify pruning
The PROPAGATE concept BOTH declared the stages *will* propagate solutions in
either direction. ANY, on the other hand, only means the propagation
direction is *not resolved yet* (but will be at planning time).

BOTH was originally described to support a more general control flow
than was eventually decided to support. The four exclusive Stage interfaces
CONNECT, PROPAGATE_FORWARDS, PROPAGATE_BACKWARDS, and GENERATOR
do not allow for BOTH as a valid setup anymore, unless you setup a very
convolved task like `Alternatives(GEN, PROP) - Alternatives(PROP, GEN)`
which would be very complex to inspect. The same functionality can still
be achieved more readable as `Alternatives(Seq(GEN, PROP), Seq(PROP, GEN))`.

The confusion between BOTH (propagator *will* send in both directions) and
ANY (propagator will send in *either* direction, decided during init) led
to a lot of confusion with users and was not fully accounted
throughout the pipeline.

Adjust tests.

Notice the difference between ANY (unresolved propagator) and UNKNOWN
(a container before introspecting its children). propagators still
report UNKNOWN as requiredInterface though to simplify control flow.

The simplification enables a much simpler linear inference of the connective
structure of a task, as the first interface direction is always given.

Additionally, unify the resource setup for static interfaces to run
in the constructor, and for dynamic initialization in `pruneInterface`,
getting rid of partial initializations in `init`.
2020-04-08 13:27:36 +02:00
v4hn
a193fc2ec5 enumerate test stages
remove ambiguity when multiple stages of the same type are used
2020-04-08 13:27:28 +02:00
v4hn
5ae7e54732 treat empty container as init exception 2020-04-08 13:27:21 +02:00
v4hn
87d70a5da1 minor documentation improvements 2020-04-08 13:27:14 +02:00
v4hn
b0df621f66 bump cmake version
get rid of CMP0048 warning.
2020-04-03 12:14:57 +02:00
Robert Haschke
f1acfa2f7e
Merge pull request #151: Various fixes 2020-04-03 11:58:19 +02:00
v4hn
00331414a6 merge: update states only once per waypoint 2020-04-03 11:36:05 +02:00
Robert Haschke
8834ce18f7 simplify trajectory merging
avoid code duplication: reuse merge(std::vector<JointModelGroup*>)
2020-04-03 11:36:05 +02:00
Robert Haschke
8debe68f99 fix joint_interpolation
- return a trajectory in any case (even if there is no motion needed)
- check feasability of goal pose
2020-04-03 11:36:05 +02:00
v4hn
07f62aa72f add override in Task
I very much considered just removing the protected inheritance again,
but it would add unnecessary code duplication.

Take note, the overriding `insert` function bypasses the Wrapper and directly forwards to the wrapped container.
This is somewhat dirty and could be an issue for anyone inheriting from `Task`.
2020-04-01 15:05:20 +02:00
v4hn
7cd82d5c04 resolve clang warnings & suggestions 2020-04-01 15:05:20 +02:00
v4hn
8578a64ac0 correct sign for StageCallback type
backward compatible, the function type implicitly converts from previous int definitions.
2020-04-01 15:05:20 +02:00
v4hn
cc86dd8a74 rename Task::erase -> eraseTaskCallback
`erase` is too general for a container class,
when it's not actually about erasing children or the container itself.
2020-04-01 15:05:20 +02:00
v4hn
c046ec605d streamline add/insert interfaces for Task/Container
`add` falls back to `insert` for both structures,
but `add` throws exceptions and does not provide a return value.

`insert` provides standard STL container access.
2020-04-01 15:05:20 +02:00
v4hn
df8a783239 enforce one-parent policy in StagePrivate
So new containers cannot get this wrong by accident.
2020-04-01 15:05:20 +02:00
Michael Görner
90f5d22e83
do not export inline functions (#147)
This makes sure that code using `pimpl()` will not compile out of the box unless the _p header is included.
2020-03-29 20:47:26 +02:00
Michael Görner
0eae0e652e
build tests using gmock via catkin_add_gmock (#148)
Otherwise these suddenly started to fail for me on Lunar Linux...
2020-03-20 20:33:33 +01:00
v4hn
8f56d4ae79 avoid copy from const id reference
This mustn't compile as users got confused about it:
```
Task t;
t.id() = "foobar";
```
2020-03-05 12:08:59 +01:00
Robert Haschke
9ee653453d Container: abort traversal with false return value of processor
So far, returning false from the processor function, just skipped further traversing the current child (depth-wise).
Now, traversal is completely aborted, even not traversing the remaining siblings of the current child.
Having a single boolean return value, we cannot distinguish both cases.
We need the new behaviour for 8061945c15bea22e8f8899c987bc28e3542885aa.
2020-03-03 17:57:06 +01:00
Mark Moll
0d6f79050a don't install PIMPL header files (#119) 2020-03-03 17:21:54 +01:00
Markus Vieth
534d520a04
Add return value to Task::execute (#136) 2020-02-20 11:31:51 +01:00
Robert Haschke
d10565cabf fix memory access issue
Fixes #132.
2020-02-18 09:01:00 +01:00
Aris Synodinos
8ac9957b55
Added C++11 flags for MOVEIT_MASTER check (#129) 2020-02-12 21:59:33 +01:00
Robert Haschke
463486257b Merge #120: Add computation timing 2020-02-06 16:18:49 +01:00
Jafar Abdi
fa9b177575 transmit and display computation in rviz 2020-02-06 16:18:20 +01:00
Jafar Abdi
aa11b66824 use runCompute() 2020-02-06 16:17:55 +01:00
Jafar Abdi
89fea00b33 Stage::runCompute() to measure computation time 2020-02-06 16:17:04 +01:00
Robert Haschke
5a85343490 Merge branch master into wip-python-api 2020-01-11 09:17:32 +01:00
Robert Haschke
ba815cff34 Task: don't publish solutions by default
Having multiple solutions, automatic publishing of intermediate solutions is confusing.
One never knows, which one is the final one. If desired, the user should setup a hook for this.
2020-01-11 09:00:34 +01:00
Henning Kayser
c1f6ca8e84 Expose SolutionCallback API in Task (#121) 2020-01-11 08:33:57 +01:00
Robert Haschke
f88bd8f54d RosMsgConverter: ensure that python and C++ types match 2020-01-11 07:56:47 +01:00
Robert Haschke
5293d2ed27 simplify method overloads 2020-01-11 07:56:47 +01:00
Robert Haschke
7d0daa6cd4 boost::python: provide generic converter for std::map 2020-01-11 07:55:31 +01:00
v4hn
233d63aa7a avoid deprecation warnings of MoveIt master branch
Use new methods
- moveit::core::isEmpty
- moveit::core::CartesianInterpolator::computeCartesianPath
2019-12-13 11:29:02 +01:00
Robert Haschke
acddc268ed compatibility to MoveIt master branch 2019-11-27 17:43:57 +01:00
Robert Haschke
3887b32ba1 fix MoveRelative::getJointStateFromOffset
Fix for #114: Accessing variable indexes was screwed.
2019-11-26 21:08:31 +01:00
Aris Synodinos
145bec1ed3 Added cost calculation in move_relative (#108) 2019-11-05 17:38:25 +01:00
Robert Haschke
facdc8e278 update RobotState in getJointStateGoal() 2019-11-02 22:02:56 +08:00
Robert Haschke
1ba4bc4508
MoveTo/MoveRelative: report failure on invalid trajectories (#107) 2019-10-22 12:06:11 +02:00
Robert Haschke
fd9462c27f Merge branch master into wip-python-api 2019-07-26 11:11:41 +02:00
Robert Haschke
975491fba9 Fixup: adding cost calculations to connect and move_to 2019-07-26 11:05:52 +02:00
Robert Haschke
4225671ae4 PipelinePlanner: always forward trajectory
(also in case of failure)
2019-07-19 13:45:07 +02:00
Robert Haschke
6ff1a5162f Fixup: adding cost calculations to connect and move_to
Need to handle nullptr trajectories.
2019-07-19 13:45:07 +02:00
Michael Görner
f7b259259e Introduce clang-format (#102)
* fix catkin_lint issues
* introduce clang-format config and apply it
2019-07-18 11:04:35 +02:00
Tyler Weaver
7ca49bc29b adding cost calculations to connect and move_to 2019-07-12 20:29:08 +02:00
v4hn
0b47224ef1 micro-fix whitespace
Let's use clang-format...
2019-07-12 13:51:21 +02:00
Robert Haschke
874994bdb5 test packages are required 2019-07-12 09:35:48 +02:00
Robert Haschke
95455c2a26 fix Task::operator=(Task&&)
To move a task instance to another one, it's not sufficient to swap all task members,
but we also need to adapt all back pointers, i.e. me_ and parent_ pointers of children,
to point to the (swapped) task instances.
2019-06-04 14:20:47 +02:00
Robert Haschke
26f679bd8e relax assertion 2019-05-16 18:12:20 +02:00