Skip to content

Commit

Permalink
show more info upon exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Nov 29, 2022
1 parent 322b0cc commit 11b14df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
11 changes: 10 additions & 1 deletion libselfdriving/src/algos/refine_trajectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@ void selfdriving::refine_trajectory(

const bool ok = ptg->inverseMap_WS2TP(
deltaNodes.x, deltaNodes.y, newK, newNormDist);
ASSERT_(ok);
if (!ok)
{
std::stringstream ss;
ss << "Assert failed: ptg->inverseMap_WS2TP() => returned "
"ok=false. More info:\n";
ss << " - PTG: " << ptg->getDescription() << "\n";
ss << " - deltaNodes: " << deltaNodes.asString() << "\n";
ss << " - edge: " << edge.asString() << "\n";
THROW_EXCEPTION(ss.str());
}

distance_t newDist = newNormDist * ptg->getRefDistance();

Expand Down
7 changes: 5 additions & 2 deletions libselfdriving/src/ptgs/HolonomicBlend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <mrpt/system/CTimeLogger.h>
#include <selfdriving/ptgs/HolonomicBlend.h>

#include <iostream> // debug only, remove!

using namespace mrpt::nav;
using namespace selfdriving::ptg;
using namespace mrpt::system;
Expand Down Expand Up @@ -272,8 +274,8 @@ void HolonomicBlend::saveToConfigFile(
std::string HolonomicBlend::getDescription() const
{
return mrpt::format(
"PTG_Holo_Blend_Tramp=%.03f_Vmax=%.03f_Wmax=%.03f", T_ramp_max, V_MAX,
W_MAX);
"selfdriving_HolonomicBlend=%.03f_Vmax=%.03f_Wmax=%.03f", T_ramp_max,
V_MAX, W_MAX);
}

void HolonomicBlend::serializeFrom(
Expand Down Expand Up @@ -397,6 +399,7 @@ bool HolonomicBlend::inverseMap_WS2TP(
const double found_dist = this->getPathDist(out_k, solved_step);

out_d = found_dist / this->refDistance;

return true;
}
else
Expand Down

0 comments on commit 11b14df

Please sign in to comment.