Skip to content

Commit 54e653e

Browse files
committed
Fix failing assertion
The cost of a newly created Priority does not need to be finite. An example occurs in the Pick+Place demo: the CurrentState solution is filtered by an applicibility test, which may set the cost to infinity while lifting the solution to the wrapper stage. In this case, new InterfaceStates are created from the infinite cost solution. Consequently, the state should be marked as PRUNED.
1 parent 9c05305 commit 54e653e

File tree

1 file changed

+3
-4
lines changed
  • core/include/moveit/task_constructor

1 file changed

+3
-4
lines changed

core/include/moveit/task_constructor/storage.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,9 @@ class InterfaceState
9494
*/
9595
struct Priority : std::tuple<Status, unsigned int, double>
9696
{
97-
Priority(unsigned int depth, double cost, Status status = ENABLED)
98-
: std::tuple<Status, unsigned int, double>(status, depth, cost) {
99-
assert(std::isfinite(cost));
100-
}
97+
Priority(unsigned int depth, double cost, Status status)
98+
: std::tuple<Status, unsigned int, double>(status, depth, cost) {}
99+
Priority(unsigned int depth, double cost) : Priority(depth, cost, std::isfinite(cost) ? ENABLED : PRUNED) {}
101100
// Constructor copying depth and cost, but modifying its status
102101
Priority(const Priority& other, Status status) : Priority(other.depth(), other.cost(), status) {}
103102

0 commit comments

Comments
 (0)