Like the MoveIt Ruckig plugin does here: https://github.com/ros-planning/moveit2/blob/f96c84c8e704bb038dd19af5f2892cfccc668fa3/moveit_core/trajectory_processing/src/ruckig_traj_smoothing.cpp#L140