text: #!/usr/bin/env python
  
  import numpy as np
  
  from pycrazyswarm import *
  from uav_trajectory import Trajectory
  
  
  def executeTrajectory(timeHelper, cf, trajpath, rate=100, offset=np.zeros(3)):
      traj = Trajectory()
      traj.loadcsv(trajpath)
  
      start_time = timeHelper.time()
  
      while not timeHelper.isShutdown():
          t = timeHelper.time() - start_time
          if t > traj.duration:
              break
  
          e = traj.eval(t)
          current_omega = [0, 0, 0]
  
          # print(f"initialPosition={cf.initialPosition}")
          # print(f"offset={offset}")
          # print(f"pos={e.pos}")
          print(f"vel={e.vel}")
          print(f"acc={e.acc}\n")
          # print(f"yaw={e.yaw}")
          # print(f"t{round(t, 2)} | omega={e.omega}")
          # exit(0)
          
          # Down below the trajectory is executed
          cf.cmdFullState(
              e.pos + np.array(cf.initialPosition) + offset,
              e.vel,
              e.acc,
              e.yaw,
              current_omega)
  
          timeHelper.sleepForRate(rate)
  
  
  if __name__ == "__main__":
      swarm = Crazyswarm()
      timeHelper = swarm.timeHelper
      cf = swarm.allcfs.crazyflies[0]
  
      rate = 30.0
      Z = 0.5
  
      cf.takeoff(targetHeight=Z, duration=Z+1.0)
      timeHelper.sleep(Z+2.0)
  
      executeTrajectory(timeHelper, cf, "sequence_trajectories/1/1.csv",
                        rate, offset=np.array([0, 0, 0.5]))
  
      cf.notifySetpointsStop()
      cf.land(targetHeight=0.03, duration=Z+1.0)
      timeHelper.sleep(Z+2.0)
  