예제 #1
0
#  optimizer_trhot.step()

#-- Start Flight Engine -----------------------------------------------------
# --- set workdir with configuration of aircraft, textures etc.
flight.loadFromFile(
    "/home/aki/Dropbox/SimpleSimulationEngine/cpp/apps/AeroCombat/data/AeroCraftMainWing1.ini"
)

# --- initialize visualization (optional, just for debugging)
#fview = flight.FlightView("/home/aki/Dropbox/SimpleSimulationEngine/")

# --- set initial state of aircraft   setPose( position, velocity, rotMat==[left,up,forward] )
flight.setPose(
    np.array([0.0, random.uniform(0, 200), 0.0]),
    np.array([
        random.uniform(0, 100),
        random.uniform(-100, 100),
        random.uniform(0, 200)
    ]), np.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]))
flight.setTilt(2, 0.02)  # set Angle-of-incidence for wing #2 ( = elevator)

# --- initialize targets Spheres (x,y,z,Radius)
targets = np.random.random((30, 4))
flight.setTargets(targets)
# ---  initialize C-interface buffers
iPitch = 0
iYaw = 1
iRoll = 2
iThrottle = 3
iTrigger = 4
controlBuff = np.zeros(
예제 #2
0
n = 10
poss = np.zeros((n, 3))
vels = np.zeros((n, 3))
rots = np.zeros((n, 3, 3))
'''
plt.figure(figsize=(15,5));
plt.subplot(1,3,1); plt.plot( poss[:,0], poss[:,2] ); plt.title("X-Z")
plt.subplot(1,3,2); plt.plot( poss[:,0], poss[:,1] ); plt.title("X-Y")
plt.subplot(1,3,3); plt.plot( poss[:,2], poss[:,1] ); plt.title("Z-Y")
plt.show()
'''

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

for angle in np.linspace(0.0, 1.0, 16, False) * np.pi * 4.0:
    rot = getRotXZ(angle)
    print "angle", angle
    flight.setPose(np.array([0.0, 200.0, 0.0]), rot[2] * 100.0, rot)
    flight.fly(poss, vels, rots, nsub=10, dt=0.01)
    ps = poss.copy()
    ax.plot(ps[:, 0], ps[:, 2], ps[:, 1])

plt.axis('equal')

ax.set_xlabel('X')
ax.set_ylabel('Z')
ax.set_zlabel('Y')

plt.show()
예제 #3
0
    print(param.grad.data.clamp(-1,1))

  optimizer_pitch.step()
  optimizer_yaw.step()
  optimizer_roll.step()
  optimizer_trhot.step()

#-- Start Flight Engine ----------------------------------------------------- 
# --- set workdir with configuration of aircraft, textures etc.
flight.loadFromFile("/home/aki/Dropbox/SimpleSimulationEngine/cpp/apps/AeroCombat/data/AeroCraftMainWing1.ini" )

# --- initialize visualization (optional, just for debugging)
fview = flight.FlightView("/home/aki/Dropbox/SimpleSimulationEngine/")

# --- set initial state of aircraft   setPose( position, velocity, rotMat==[left,up,forward] )
flight.setPose( np.array([0.0,200.0,0.0]), np.array([0.0,0.0,100.0]) , np.array([[1.0,0.0,0.0],[0.0,1.0,0.0],[0.0,0.0,1.0]]) )
flight.setTilt( 2, 0.02 ) # set Angle-of-incidence for wing #2 ( = elevator)
#flight.setTilt( 0,  0.1 )
#flight.setTilt( 1, -0.1 )
#flight.setTilt( 3, 0.1 )

# --- initialize targets Spheres (x,y,z,Radius)
targets = np.random.random((30,4));
###targets[:, 0] += -0.5; targets[:, 0] *= 10000;  # x
###targets[:, 2] += -0.5; targets[:, 2] *= 10000;  # z
###targets[:, 1] *= 200;   # y=height
######targets[:, 3] += 50.0   # radius
#print targets
flight.setTargets( targets )

# ---  initialize C-interface buffers
예제 #4
0

#-- Start Flight Engine -----------------------------------------------------
# --- set workdir with configuration of aircraft, textures etc.
flight.loadFromFile(
    "/home/aki/Dropbox/SimpleSimulationEngine/cpp/apps/AeroCombat/data/AeroCraftMainWing1.ini"
)

# --- initialize visualization (optional, just for debugging)
#fview = flight.FlightView("/home/aki/Dropbox/SimpleSimulationEngine/")

# --- set initial state of aircraft   setPose( position, velocity, rotMat==[left,up,forward] )
flight.setPose(
    np.array([0.0, random.uniform(0, 200), 0.0]),
    np.array([
        random.uniform(0, 100),
        random.uniform(-100, 100),
        random.uniform(0, 200)
    ]), np.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]))
flight.setTilt(2, 0.02)  # set Angle-of-incidence for wing #2 ( = elevator)

# --- initialize targets Spheres (x,y,z,Radius)
targets = np.random.random((30, 4))
flight.setTargets(targets)
# ---  initialize C-interface buffers
iPitch = 0
iYaw = 1
iRoll = 2
iThrottle = 3
iTrigger = 4
controlBuff = np.zeros(