def __init__(self): self.home_latitude = 0 self.home_longitude = 0 self.home_altitude = 0 self.ground_level = 0 self.frame_height = 0.0 self.latitude = self.home_latitude self.longitude = self.home_longitude self.altitude = self.home_altitude self.dcm = Matrix3() # rotation rate in body frame self.gyro = Vector3(0, 0, 0) # rad/s self.velocity = Vector3(0, 0, 0) # m/s, North, East, Down self.position = Vector3(0, 0, 0) # m North, East, Down self.mass = 0.0 self.update_frequency = 50 # in Hz self.gravity = 9.80665 # m/s/s self.accelerometer = Vector3(0, 0, -self.gravity) self.wind = util.Wind('0,0,0') self.time_base = time.time() self.time_now = self.time_base + 100 * 1.0e-6
def __init__(self): self.home_latitude = 0 self.home_longitude = 0 self.home_altitude = 0 self.ground_level = 0 self.frame_height = 0.0 self.latitude = self.home_latitude self.longitude = self.home_longitude self.altitude = self.home_altitude self.pitch = 0.0 # degrees self.roll = 0.0 # degrees self.yaw = 0.0 # degrees # rates in earth frame self.pitch_rate = 0.0 # degrees/s self.roll_rate = 0.0 # degrees/s self.yaw_rate = 0.0 # degrees/s # rates in body frame self.pDeg = 0.0 # degrees/s self.qDeg = 0.0 # degrees/s self.rDeg = 0.0 # degrees/s self.velocity = euclid.Vector3(0, 0, 0) # m/s, North, East, Up self.position = euclid.Vector3(0, 0, 0) # m North, East, Up self.accel = euclid.Vector3(0, 0, 0) # m/s/s North, East, Up self.mass = 0.0 self.update_frequency = 50 # in Hz self.gravity = 9.8 # m/s/s self.accelerometer = euclid.Vector3(0, 0, -self.gravity) self.wind = util.Wind('0,0,0')
sim_in.setblocking(0) # setup output to SITL sim sim_out = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sim_out.connect(interpret_address(opts.simout)) sim_out.setblocking(0) # setup possible output to FlightGear for display fg_out = None if opts.fgout: fg_out = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) fg_out.connect(interpret_address(opts.fgout)) # setup wind generator wind = util.Wind(opts.wind) fdm = fgFDM.fgFDM() jsb_console.send('info\n') jsb_console.send('resume\n') jsb.expect(["trim computation time","Trim Results"]) time.sleep(1.5) jsb_console.send('step\n') jsb_console.logfile = None print("Simulator ready to fly") def main_loop(): '''run main loop''' tnow = time.time()
#!/usr/bin/env python # simple test of wind generation code import util, time, random wind = util.Wind('3,90,0.1') t0 = time.time() velocity = Vector3(0,0,0) t = 0 deltat = 0.01 while t < 60: print("%.4f %f" % (t, wind.accel(velocity, deltat=deltat).magnitude())) t += deltat
#!/usr/bin/env python """ simple test of wind generation code """ from __future__ import print_function import time import util from pymavlink.rotmat import Vector3 wind = util.Wind('7,90,0.1') t0 = time.time() velocity = Vector3(0, 0, 0) t = 0 deltat = 0.01 while t < 60: print("%.4f %f" % (t, wind.drag(velocity, deltat=deltat).length())) t += deltat