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

Better OMPL error logging and fail on start/goal in collision #552

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ void OMPLDefaultPlanProfile::applyGoalStates(OMPLProblem& prob,
else
{
CONSOLE_BRIDGE_logDebug("In OMPLDefaultPlanProfile: Goal state has invalid bounds");
throw std::runtime_error("In OMPLDefaultPlanProfile: Goal state has invalid bounds");
}

// Get discrete contact manager for testing provided start and end position
Expand All @@ -487,12 +488,19 @@ void OMPLDefaultPlanProfile::applyGoalStates(OMPLProblem& prob,
tesseract_collision::ContactResultMap contact_map;
if (checkStateInCollision(prob, solution, contact_map))
{
CONSOLE_BRIDGE_logError("In OMPLDefaultPlanProfile: Goal state is in collision");
std::stringstream contact_msg;
contact_msg << "In OMPLPlannerFreespaceConfig: Goal state (";
contact_msg << solution.transpose().matrix() << ") is in collision. ";

for (const auto& contact_vec : contact_map)
for (const auto& contact : contact_vec.second)
CONSOLE_BRIDGE_logError(("Links: " + contact.link_names[0] + ", " + contact.link_names[1] +
" Distance: " + std::to_string(contact.distance))
.c_str());
{
contact_msg << "Links: " << contact.link_names[0] << ", " << contact.link_names[1]
<< " Distance: " << std::to_string(contact.distance);
CONSOLE_BRIDGE_logError(contact_msg.str().c_str());
}

throw std::runtime_error(contact_msg.str());
}

ompl::base::ScopedState<> goal_state(prob.simple_setup->getStateSpace());
Expand Down Expand Up @@ -616,6 +624,7 @@ void OMPLDefaultPlanProfile::applyStartStates(OMPLProblem& prob,
else
{
CONSOLE_BRIDGE_logDebug("In OMPLDefaultPlanProfile: Start state is outside limits");
throw std::runtime_error("In OMPLDefaultPlanProfile: Start state is outside limits");
}

// Get discrete contact manager for testing provided start and end position
Expand All @@ -624,12 +633,19 @@ void OMPLDefaultPlanProfile::applyStartStates(OMPLProblem& prob,
tesseract_collision::ContactResultMap contact_map;
if (checkStateInCollision(prob, joint_waypoint, contact_map))
{
CONSOLE_BRIDGE_logError("In OMPLPlannerFreespaceConfig: Start state is in collision");
std::stringstream contact_msg;
contact_msg << "In OMPLPlannerFreespaceConfig: Start state (";
contact_msg << solution.transpose().matrix() << ") is in collision. ";

for (const auto& contact_vec : contact_map)
for (const auto& contact : contact_vec.second)
CONSOLE_BRIDGE_logError(("Links: " + contact.link_names[0] + ", " + contact.link_names[1] +
" Distance: " + std::to_string(contact.distance))
.c_str());
{
contact_msg << "Links: " << contact.link_names[0] << ", " << contact.link_names[1]
<< " Distance: " << std::to_string(contact.distance);
CONSOLE_BRIDGE_logError(contact_msg.str().c_str());
}

throw std::runtime_error(contact_msg.str());
}

ompl::base::ScopedState<> start_state(prob.simple_setup->getStateSpace());
Expand Down
Loading