add parameters and logic to resample the trajectory
add parameters and logic to resample the trajectory