Skip to content

Commit 904856f

Browse files
Swap descartes assert with motion planning failure (#606)
1 parent 1627c9c commit 904856f

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

tesseract_motion_planners/descartes/include/tesseract_motion_planners/descartes/impl/descartes_motion_planner.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ constexpr auto SOLUTION_FOUND{ "Found valid solution" };
5454
constexpr auto ERROR_INVALID_INPUT{ "Failed invalid input: " };
5555
constexpr auto ERROR_FAILED_TO_BUILD_GRAPH{ "Failed to build graph" };
5656
constexpr auto ERROR_FAILED_TO_FIND_VALID_SOLUTION{ "Failed to find valid solution" };
57+
constexpr auto ERROR_SOLUTION_OUTSIDE_LIMITS{ "The solution generated has states outside the limits" };
5758

5859
namespace tesseract_planning
5960
{
@@ -157,7 +158,15 @@ PlannerResponse DescartesMotionPlanner<FloatType>::solve(const PlannerRequest& r
157158
for (const auto& js : descartes_result.trajectory)
158159
{
159160
solution.push_back(js->values.template cast<double>());
160-
assert(tesseract_common::satisfiesLimits<double>(solution.back(), joint_limits));
161+
162+
if (!tesseract_common::satisfiesLimits<double>(solution.back(), joint_limits))
163+
{
164+
CONSOLE_BRIDGE_logError("Descartes Motion Planner has solution state outside limits and will be clamped to "
165+
"limit");
166+
response.successful = false;
167+
response.message = ERROR_SOLUTION_OUTSIDE_LIMITS;
168+
return response;
169+
}
161170
tesseract_common::enforceLimits<double>(solution.back(), joint_limits);
162171
}
163172

0 commit comments

Comments
 (0)