diff --git a/modules/planning/tasks/optimizers/path_time_heuristic/gridded_path_time_graph.cc b/modules/planning/tasks/optimizers/path_time_heuristic/gridded_path_time_graph.cc index 9cdb7c4090f4516f31550f2e760664045cb1e6bb..1e06db03279211942da898d2c33ed423157481d8 100644 --- a/modules/planning/tasks/optimizers/path_time_heuristic/gridded_path_time_graph.cc +++ b/modules/planning/tasks/optimizers/path_time_heuristic/gridded_path_time_graph.cc @@ -146,11 +146,21 @@ Status GriddedPathTimeGraph::Search(SpeedData* const speed_data) { Status GriddedPathTimeGraph::InitCostTable() { // Time dimension is homogeneous while Spatial dimension has two resolutions, // dense and sparse with dense resolution coming first in the spatial horizon - // The least meaningful unit_t_ + + // Sanity check for numerical stability if (unit_t_ < kDoubleEpsilon) { - // Sanity check for numerical stability - AERROR << "unit_t is smaller than the kDoubleEpsilon."; + const std::string msg = "unit_t is smaller than the kDoubleEpsilon."; + AERROR << msg; + return Status(ErrorCode::PLANNING_ERROR, msg); + } + + // Sanity check on s dimension setting + if (dense_dimension_s_ < 1) { + const std::string msg = "dense_dimension_s is at least 1."; + AERROR << msg; + return Status(ErrorCode::PLANNING_ERROR, msg); } + dimension_t_ = static_cast(std::ceil( total_length_t_ / static_cast(unit_t_))) + 1;