39 if (!
init(ros_trajectory))
41 throw std::invalid_argument(
"Trajectory not valid");
48 bool sign_flipped =
false;
52 for (
auto i = ros_trajectory.points.begin(); std::next(i) < ros_trajectory.points.end(); ++i)
55 if (i->time_from_start.toSec() >= std::next(i)->time_from_start.toSec())
65 state.
q = state.
q.conjugate();
66 state.
q.w() = state.
q.w() * -1;
71 double dot_product = state.
q.dot(next_state.
q);
72 if (dot_product < 0.0)
74 next_state.
q = next_state.
q.conjugate();
75 next_state.
q.w() = next_state.
q.w() * -1;