NU = np.zeros(int((T - t0) / h) + 1) L = np.zeros(int((T - t0) / h) + 1) D = np.zeros(int((T - t0) / h) + 1) R = np.zeros(int((T - t0) / h) + 1) Xtg = np.zeros((int((T - t0) / h) + 1,2)) U = np.zeros(int((T - t0) / h) + 1) i = 0 for s in np.arange(t0, 1 + 1e-10,h / T): Xtg[i] = target.Xp(s) x = [x_plot[i], y_plot[i]] NU[i] = target.nu(s, x) D[i] = target.d(s, x) L[i] = channel.l(x) R[i] = channel.r(x) U[i] = uav.u(s, x) i = i + 1 ax1.scatter(Xbs[0],Xbs[1], marker = 'v', color = 'blue') ax1.plot(Xtg[:,0],Xtg[:,1], marker = 'x', color = 'red') ax1.scatter(XT[0],XT[1], marker = 'x', color = 'green') ax1.plot(X[:,0],X[:,1], color = 'blue', linewidth = 2.0, alpha = 0.3) ax1.plot(x_plot, y_plot, color = 'red') ax1.set_aspect('equal') ax2.plot(t, NU, color = 'blue', label = 'surv quality') ax2.plot(t, L, color = 'green', label = 'transfer quality') ax2.legend() ax3.plot(t, D, color = 'blue', label = 'target dist')
r0 = 7.0 d0 = 3.5 kappa = 0.05 epsilon = 0.05 V0 = 0.5 h = 0.1 t0 = 0 T = 60 target = Target(Xtg, d0) channel = Channel(Xbs, r0) uav = UAV(V0, X0, h) uav.setmission(target, channel, kappa) print(uav.u([0,0])) X = np.zeros((int((T-t0)/h)+1,2)) t = np.zeros(int((T-t0)/h)+1) u = np.zeros(int((T-t0)/h)+1) gamma = -np.pi/2 i = 0 for s in np.arange(t0, T+h, h): gamma = gamma + 0.01 t[i] = s x = uav.step(gamma) u[i] = uav.u(x) X[i] = x i = i + 1