Added ns, id to visualizeTrajectory()