36 _ucache.emplace_back(std::numeric_limits<double>::lowest(),
_uinit);
42 for (; start_idx < (
int)
_ucache.size(); ++start_idx)
44 if (ts <
_ucache[start_idx].first)
break;
53 double dti =
_ucache[idx + 1].first - cur_t;
55 if (dti + cur_t < ts + dt)
57 useq_out.emplace_back(dti,
_ucache[idx].second);
61 useq_out.emplace_back(ts + dt - cur_t,
_ucache[idx].second);
68 if (idx == (
int)
_ucache.size() - 1)
70 if (!useq_out.empty()) cur_t =
_ucache.back().first;
72 useq_out.emplace_back(ts + dt - cur_t,
_ucache.back().second);
76 if (start_idx - 1 > 0)
84 for (
int i = 0; i < useq_out.size(); ++i) dt_test += useq_out[i].first;
85 PRINT_ERROR_COND(
std::abs(dt_test - dt) > 1e-10,
"Deadtime: Computed dt (" << dt_test <<
") does not match original dt (" << dt <<
")");
93 _ucache.emplace_back(std::numeric_limits<double>::lowest(),
_uinit);
#define PRINT_ERROR_NAMED(msg)
void appendValues(double t, const Eigen::Ref< const Eigen::VectorXd > &u)
#define PRINT_WARNING_NAMED(msg)
#define PRINT_ERROR_COND(cond, msg)
Print msg-stream only if cond == true.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
A matrix or vector expression mapping an existing expression.
std::vector< std::pair< double, Eigen::VectorXd > > _ucache
void getValues(double ts, double dt, std::vector< std::pair< double, Eigen::VectorXd >> &useq_out)
Compute the delayed values.