Ebike trajectory optimization