34 : trajectory_(std::move(trajectory))
37 double current_time = 0;
38 double total_time = 0;
39 bool overwrite_dt =
false;
44 bool initial_state =
true;
48 current_time = state.time;
51 if (current_time < last_time)
54 double dt = current_time - last_time;
62 initial_state =
false;
65 state.time = total_time;
66 last_time = current_time;
81 std::size_t index = 0;
83 double running_duration = 0.0;
84 for (; index < num_points; ++index)
90 before =
static_cast<int>(std::max<std::size_t>(index - 1, 0));
91 after =
static_cast<int>(std::min<std::size_t>(index, num_points - 1));
95 if ((index == 0) || (after == before))
105 throw std::runtime_error(
"Invalid duration");
112 if (before < 0 && after < 0)
113 throw std::runtime_error(
"Invalid duration");
115 if (before < 0 && after == 0)
116 return trajectory_[
static_cast<std::size_t
>(after)];
119 return trajectory_[
static_cast<std::size_t
>(before)];
121 if (before >= 0 && after > 0)
128 throw std::runtime_error(
"Invalid duration");
140 return trajectory_[
static_cast<std::size_t
>(index)].time;
158 for (
long i = 0; i < static_cast<long>(out.
joint_names.size()); ++i)