diff --git a/mpc_local_planner/src/optimal_control/full_discretization_grid_base_se2.cpp b/mpc_local_planner/src/optimal_control/full_discretization_grid_base_se2.cpp index b322b83..396304c 100644 --- a/mpc_local_planner/src/optimal_control/full_discretization_grid_base_se2.cpp +++ b/mpc_local_planner/src/optimal_control/full_discretization_grid_base_se2.cpp @@ -58,6 +58,7 @@ corbo::GridUpdateResult FullDiscretizationGridBaseSE2::update(const Eigen::Vecto // check if we need to cache the reference trajectory values // TODO(roesmann): we could restrict this to new_run==true only as long as we do not // have a grid resize... int n = std::max(std::max(getNRef(), getN()), _n_adapt); + if (_dt.value() <= 0) _dt.value() = _dt_ref; // initialize _dt to _dt_ref in case it has not been optimized before if (!xref.isCached(getDt(), n, t)) xref.precompute(getDt(), n, t); if (!uref.isCached(getDt(), n, t)) uref.precompute(getDt(), n, t); if (sref && !sref->isCached(getDt(), n, t)) sref->precompute(getDt(), n, t);