@@ -24,7 +24,7 @@ namespace ugv_nav4d
24
24
{\
25
25
LOG_ERROR_S << #val; \
26
26
LOG_ERROR_S << __FILE__ << " : " << __LINE__; \
27
- throw std::runtime_error (" meeeeh " ); \
27
+ throw std::runtime_error (" Error! " ); \
28
28
}
29
29
30
30
EnvironmentXYZTheta::EnvironmentXYZTheta (std::shared_ptr<MLGrid> mlsGrid,
@@ -103,9 +103,10 @@ void EnvironmentXYZTheta::setInitialPatch(const Eigen::Affine3d& ground2Mls, dou
103
103
104
104
void EnvironmentXYZTheta::updateMap (shared_ptr< ugv_nav4d::EnvironmentXYZTheta::MLGrid > mlsGrid)
105
105
{
106
- if (this ->mlsGrid && this ->mlsGrid ->getResolution () != mlsGrid->getResolution ())
106
+ if (this ->mlsGrid && this ->mlsGrid ->getResolution () != mlsGrid->getResolution ()){
107
+ LOG_ERROR_S << " EnvironmentXYZTheta::updateMap : Error got MLSMap with different resolution" ;
107
108
throw std::runtime_error (" EnvironmentXYZTheta::updateMap : Error got MLSMap with different resolution" );
108
-
109
+ }
109
110
if (!this ->mlsGrid )
110
111
{
111
112
availableMotions.computeMotions (mlsGrid->getResolution ().x (), travConf.gridResolution );
@@ -131,7 +132,7 @@ EnvironmentXYZTheta::ThetaNode* EnvironmentXYZTheta::createNewStateFromPose(cons
131
132
traversability_generator3d::TravGenNode *travNode = travGen.generateStartNode (pos);
132
133
if (!travNode)
133
134
{
134
- LOG_INFO_S << " Could not generate Node at pos" ;
135
+ LOG_ERROR_S << " Could not generate new state at pos: " << pos. transpose () ;
135
136
return nullptr ;
136
137
}
137
138
@@ -140,7 +141,7 @@ EnvironmentXYZTheta::ThetaNode* EnvironmentXYZTheta::createNewStateFromPose(cons
140
141
{
141
142
if (!travGen.expandNode (travNode))
142
143
{
143
- LOG_INFO_S << " createNewStateFromPose: Error: " << name << " Pose " << pos.transpose () << " is not traversable" ;
144
+ LOG_ERROR_S << " createNewStateFromPose: Error: " << name << " Pose " << pos.transpose () << " is not traversable" ;
144
145
return nullptr ;
145
146
}
146
147
travNode->setNotExpanded ();
@@ -165,13 +166,13 @@ bool EnvironmentXYZTheta::obstacleCheck(const maps::grid::Vector3d& pos, double
165
166
maps::grid::Index idxObstNode;
166
167
if (!obsGen.getTraversabilityMap ().toGrid (pos, idxObstNode))
167
168
{
168
- LOG_INFO_S << " Error " << nodeName << " is outside of obstacle map " ;
169
+ LOG_ERROR_S << " Error " << nodeName << " is outside of obstacle map " ;
169
170
return false ;
170
171
}
171
172
traversability_generator3d::TravGenNode* obstacleNode = obsGen.findMatchingTraversabilityPatchAt (idxObstNode, pos.z ());
172
173
if (!obstacleNode)
173
174
{
174
- LOG_INFO_S << " Error, could not find matching obstacle node for " << nodeName;
175
+ LOG_ERROR_S << " Error, could not find matching obstacle node for " << nodeName;
175
176
return false ;
176
177
}
177
178
@@ -209,8 +210,8 @@ bool EnvironmentXYZTheta::obstacleCheck(const maps::grid::Vector3d& pos, double
209
210
});
210
211
#endif
211
212
212
- LOG_INFO_S << " Num obstacles: " << stats.getRobotStats ().getNumObstacles ();
213
- LOG_INFO_S << " Error: " << nodeName << " inside obstacle" ;
213
+ LOG_DEBUG_S << " Num obstacles: " << stats.getRobotStats ().getNumObstacles ();
214
+ LOG_DEBUG_S << " Error: " << nodeName << " inside obstacle" ;
214
215
return false ;
215
216
}
216
217
}
@@ -246,7 +247,7 @@ void EnvironmentXYZTheta::setGoal(const Eigen::Vector3d& goalPos, double theta)
246
247
base::Vector3d (1 ,1 ,1 ), V3DD::Color::red);
247
248
#endif
248
249
249
- LOG_INFO_S << " GOAL IS: " << goalPos.transpose ();
250
+ LOG_DEBUG_S << " GOAL IS: " << goalPos.transpose ();
250
251
251
252
if (!startXYZNode)
252
253
throw std::runtime_error (" Error, start needs to be set before goal" );
@@ -266,7 +267,7 @@ void EnvironmentXYZTheta::setGoal(const Eigen::Vector3d& goalPos, double theta)
266
267
{
267
268
if (!checkOrientationAllowed (goalXYZNode->getUserData ().travNode , theta))
268
269
{
269
- LOG_INFO_S << " Goal orientation not allowed due to slope" ;
270
+ LOG_ERROR_S << " Goal orientation not allowed due to slope" ;
270
271
throw OrientationNotAllowed (" Goal orientation not allowed due to slope" );
271
272
}
272
273
}
@@ -278,13 +279,12 @@ void EnvironmentXYZTheta::setGoal(const Eigen::Vector3d& goalPos, double theta)
278
279
// check goal position
279
280
if (!checkStartGoalNode (" goal" , goalXYZNode->getUserData ().travNode , goalThetaNode->theta .getRadian ()))
280
281
{
281
- LOG_INFO_S << " goal position is invalid" ;
282
+ LOG_ERROR_S << " Goal position is invalid" ;
282
283
throw ObstacleCheckFailed (" goal position is invalid" );
283
284
}
284
285
285
286
try {
286
287
precomputeCost ();
287
- LOG_INFO_S << " Heuristic computed" ;
288
288
}
289
289
catch (const std::runtime_error& ex){
290
290
throw ex;
@@ -316,7 +316,7 @@ void EnvironmentXYZTheta::setGoal(const Eigen::Vector3d& goalPos, double theta)
316
316
}
317
317
}
318
318
if (!foundNextNode) {
319
- LOG_INFO_S << " nextNode has no connection" ;
319
+ LOG_DEBUG_S << " nextNode has no connection" ;
320
320
break ;
321
321
}
322
322
}
@@ -351,23 +351,24 @@ void EnvironmentXYZTheta::setStart(const Eigen::Vector3d& startPos, double theta
351
351
base::Vector3d (1 ,1 ,1 ), V3DD::Color::blue);
352
352
#endif
353
353
354
- LOG_INFO_S << " START IS: " << startPos.transpose ();
354
+ LOG_DEBUG_S << " START IS: " << startPos.transpose ();
355
355
356
356
startThetaNode = createNewStateFromPose (" start" , startPos, theta, &startXYZNode);
357
- if (!startThetaNode)
357
+ if (!startThetaNode){
358
+ LOG_ERROR_S << " Failed to create start state" ;
358
359
throw StateCreationFailed (" Failed to create start state" );
359
-
360
+ }
360
361
obstacleStartNode = obsGen.generateStartNode (startPos);
361
362
if (!obstacleStartNode)
362
363
{
363
- LOG_INFO_S << " Could not generate obstacle node at start pos" ;
364
+ LOG_ERROR_S << " Could not generate obstacle node at start pos" ;
364
365
throw ObstacleCheckFailed (" Could not generate obstacle node at start pos" );
365
366
}
366
367
367
368
// check start position
368
369
if (!checkStartGoalNode (" start" , startXYZNode->getUserData ().travNode , startThetaNode->theta .getRadian ()))
369
370
{
370
- LOG_INFO_S << " Start position is invalid" ;
371
+ LOG_ERROR_S << " Start position is invalid" ;
371
372
throw ObstacleCheckFailed (" Start position inside obstacle" );
372
373
}
373
374
}
@@ -425,9 +426,10 @@ const Motion& EnvironmentXYZTheta::getMotion(const int fromStateID, const int to
425
426
}
426
427
}
427
428
428
- if (cost == -1 )
429
+ if (cost == -1 ){
430
+ LOG_ERROR_S << " Internal Error: No matching motion for output path found" ;
429
431
throw std::runtime_error (" Internal Error: No matching motion for output path found" );
430
-
432
+ }
431
433
return availableMotions.getMotion (motionId);
432
434
}
433
435
@@ -452,7 +454,6 @@ int EnvironmentXYZTheta::GetGoalHeuristic(int stateID)
452
454
numToTravType[maps::grid::TraversabilityNodeBase::HOLE] = " HOLE" ;
453
455
numToTravType[maps::grid::TraversabilityNodeBase::UNSET] = " UNSET" ;
454
456
numToTravType[maps::grid::TraversabilityNodeBase::FRONTIER] = " FRONTIER" ;
455
- // throw std::runtime_error("tried to get heuristic for " + numToTravType[travNode->getType()] + " patch. StateID: " + std::to_string(stateID));
456
457
return std::numeric_limits<int >::max ();
457
458
}
458
459
@@ -469,18 +470,18 @@ int EnvironmentXYZTheta::GetGoalHeuristic(int stateID)
469
470
int result = maxTime >= 10000000 ? maxTime : maxTime * Motion::costScaleFactor;
470
471
if (result < 0 )
471
472
{
472
- LOG_INFO_S << sourceToGoalDist;
473
- LOG_INFO_S << stateID;
474
- LOG_INFO_S << mobilityConfig.translationSpeed ;
475
- LOG_INFO_S << timeTranslation;
476
- LOG_INFO_S << sourceThetaNode->theta .shortestDist (goalThetaNode->theta ).getRadian ();
477
- LOG_INFO_S << mobilityConfig.rotationSpeed ;
478
- LOG_INFO_S << timeRotation;
479
- LOG_INFO_S << result;
480
- LOG_INFO_S << travNode->getUserData ().id ;
481
- LOG_INFO_S << travNode->getType ();
473
+ LOG_ERROR_S << sourceToGoalDist;
474
+ LOG_ERROR_S << stateID;
475
+ LOG_ERROR_S << mobilityConfig.translationSpeed ;
476
+ LOG_ERROR_S << timeTranslation;
477
+ LOG_ERROR_S << sourceThetaNode->theta .shortestDist (goalThetaNode->theta ).getRadian ();
478
+ LOG_ERROR_S << mobilityConfig.rotationSpeed ;
479
+ LOG_ERROR_S << timeRotation;
480
+ LOG_ERROR_S << result;
481
+ LOG_ERROR_S << travNode->getUserData ().id ;
482
+ LOG_ERROR_S << travNode->getType ();
482
483
// throw std::runtime_error("Goal heuristic < 0");
483
- LOG_INFO_S << " Overflow while computing goal heuristic!" ;
484
+ LOG_ERROR_S << " Overflow while computing goal heuristic!" ;
484
485
result = std::numeric_limits<int >::max ();
485
486
}
486
487
oassert (result >= 0 );
@@ -556,7 +557,7 @@ traversability_generator3d::TravGenNode *EnvironmentXYZTheta::movementPossible(t
556
557
{
557
558
// FIXME this should never happen but it did happen in the past and I have no idea why
558
559
// needs investigation!
559
- LOG_INFO_S << " movement not possible. nodes not conncted " ;
560
+ LOG_DEBUG_S << " Movement not possible. Nodes are not connected " ;
560
561
return nullptr ;
561
562
}
562
563
@@ -569,7 +570,7 @@ traversability_generator3d::TravGenNode *EnvironmentXYZTheta::movementPossible(t
569
570
// during the expansion. Beforehand the type is undefined
570
571
if (targetNode->getType () != maps::grid::TraversabilityNodeBase::TRAVERSABLE)
571
572
{
572
- // LOG_INFO_S << "movement not possible. targetnode not traversable";
573
+ LOG_DEBUG_S << " movement not possible. targetnode not traversable" ;
573
574
return nullptr ;
574
575
}
575
576
return targetNode;
@@ -652,7 +653,7 @@ void EnvironmentXYZTheta::GetSuccs(int SourceStateID, vector< int >* SuccIDV, ve
652
653
if (!travGen.expandNode (sourceTravNode))
653
654
{
654
655
// expansion failed, current node is not driveable -> there are not successors to this state
655
- LOG_INFO_S << " GetSuccs: current node not expanded and not expandable" ;
656
+ LOG_DEBUG_S << " GetSuccs: current node not expanded and not expandable" ;
656
657
return ;
657
658
}
658
659
}
@@ -740,9 +741,10 @@ void EnvironmentXYZTheta::GetSuccs(int SourceStateID, vector< int >* SuccIDV, ve
740
741
{
741
742
const auto &candidateMap = searchGrid.at (finalPos);
742
743
743
- if (goalTravNode->getIndex () != finalPos)
744
- throw std::runtime_error (" Internal error, indexes do not match" );
745
-
744
+ if (goalTravNode->getIndex () != finalPos){
745
+ LOG_ERROR_S << " Internal error, indexes of goalTravNode and finalPos do not match" ;
746
+ throw std::runtime_error (" Internal error, indexes of goalTravNode and finalPos do not match" );
747
+ }
746
748
XYZNode searchTmp (goalTravNode->getHeight (), goalTravNode->getIndex ());
747
749
748
750
// this works, as the equals check is on the height, not the node itself
@@ -791,7 +793,6 @@ void EnvironmentXYZTheta::GetSuccs(int SourceStateID, vector< int >* SuccIDV, ve
791
793
}
792
794
const double slopeFactor = avgSlope * travConf.slopeMetricScale ;
793
795
cost = motion.baseCost + motion.baseCost * slopeFactor;
794
- LOG_INFO_S<< " cost: " << cost << " , baseCost: " << motion.baseCost << " , slopeFactor: " << slopeFactor;
795
796
break ;
796
797
}
797
798
case traversability_generator3d::SlopeMetric::MAX_SLOPE:
@@ -827,7 +828,8 @@ void EnvironmentXYZTheta::GetSuccs(int SourceStateID, vector< int >* SuccIDV, ve
827
828
cost = motion.baseCost ;
828
829
break ;
829
830
default :
830
- throw std::runtime_error (" unknown slope metric selected" );
831
+ LOG_ERROR_S << " Unknown slope metric selected" ;
832
+ throw std::runtime_error (" Unknown slope metric selected" );
831
833
}
832
834
833
835
if (usePathStatistics){
@@ -874,6 +876,7 @@ void EnvironmentXYZTheta::GetSuccs(int SourceStateID, vector< int >* SuccIDV, ve
874
876
875
877
if (travNodeh->getType () != maps::grid::TraversabilityNodeBase::TRAVERSABLE)
876
878
{
879
+ LOG_ERROR_S << " In GetSuccs() returned id for non-traversable patch" ;
877
880
throw std::runtime_error (" In GetSuccs() returned id for non-traversable patch" );
878
881
}
879
882
}
@@ -987,9 +990,8 @@ void EnvironmentXYZTheta::getTrajectory(const vector<int>& stateIDPath,
987
990
traversability_generator3d::TravGenNode *nextNode = curNode->getConnectedNode (curIndex);
988
991
if (!nextNode)
989
992
{
990
- for (auto *n : curNode->getConnections ())
991
- LOG_INFO_S<< " Con Node " << n->getIndex ().transpose ();;
992
- throw std::runtime_error (" Internal error, trajectory is not continuous on tr grid" );
993
+ LOG_ERROR_S << " Internal error, trajectory is not continuous on traversability grid" ;
994
+ throw std::runtime_error (" Internal error, trajectory is not continuous on traversability grid" );
993
995
}
994
996
curNode = nextNode;
995
997
lastIndex = curIndex;
@@ -1016,15 +1018,13 @@ void EnvironmentXYZTheta::getTrajectory(const vector<int>& stateIDPath,
1016
1018
if (mobilityConfig.remove_goal_offset == true &&
1017
1019
i == indexOfMotionToUpdate)
1018
1020
{
1019
- LOG_INFO_S << " Original spline end position: " << positions[positions.size ()-1 ];
1020
1021
double goal_offset_x = (goalPos.x () - positions[positions.size ()-1 ].x ()) / (positions.size ()-1 );
1021
1022
double goal_offset_y = (goalPos.y () - positions[positions.size ()-1 ].y ()) / (positions.size ()-1 );
1022
1023
1023
1024
for (int j{0 }; j < positions.size (); j++){
1024
1025
positions[j].x () += j*goal_offset_x;
1025
1026
positions[j].y () += j*goal_offset_y;
1026
1027
}
1027
- LOG_INFO_S << " Updated spline end position: " << positions[positions.size ()-1 ];
1028
1028
goal_position_updated = true ;
1029
1029
}
1030
1030
@@ -1172,8 +1172,8 @@ double EnvironmentXYZTheta::getAvgSlope(std::vector<const traversability_generat
1172
1172
{
1173
1173
if (path.size () <= 0 )
1174
1174
{
1175
+ LOG_ERROR_S << " Requested slope of path with length zero." ;
1175
1176
throw std::runtime_error (" Requested slope of path with length zero." );
1176
- return 0 ;
1177
1177
}
1178
1178
double slopeSum = 0 ;
1179
1179
for (const traversability_generator3d::TravGenNode* node : path)
@@ -1415,16 +1415,13 @@ std::shared_ptr<SubTrajectory> EnvironmentXYZTheta::findTrajectoryOutOfObstacle(
1415
1415
}
1416
1416
else
1417
1417
{
1418
- LOG_INFO_S << " EnvironmentXYZTheta::findTrajectoryOutOfObstacle(): NO WAY OUT, ROBOT IS STUCK!" ;
1419
- LOG_INFO_S << " EnvironmentXYZTheta::findTrajectoryOutOfObstacle(): NO WAY OUT, ROBOT IS STUCK!" ;
1420
- LOG_INFO_S << " EnvironmentXYZTheta::findTrajectoryOutOfObstacle(): NO WAY OUT, ROBOT IS STUCK!" ;
1418
+ LOG_ERROR_S << " EnvironmentXYZTheta::findTrajectoryOutOfObstacle(): NO WAY OUT, ROBOT IS STUCK!" ;
1419
+ LOG_ERROR_S << " EnvironmentXYZTheta::findTrajectoryOutOfObstacle(): NO WAY OUT, ROBOT IS STUCK!" ;
1420
+ LOG_ERROR_S << " EnvironmentXYZTheta::findTrajectoryOutOfObstacle(): NO WAY OUT, ROBOT IS STUCK!" ;
1421
1421
return nullptr ;
1422
1422
}
1423
1423
1424
1424
std::shared_ptr<SubTrajectory> subTraj (new SubTrajectory (trajectory));
1425
1425
return subTraj;
1426
1426
}
1427
-
1428
-
1429
-
1430
1427
}
0 commit comments