autotest: added --wind option to sim_quad
this is in the form of speed,direction,turbulance
This commit is contained in:
parent
a58e81469f
commit
228d1620d2
@ -36,6 +36,8 @@ class Aircraft(object):
|
||||
self.gravity = 9.8 # m/s/s
|
||||
self.accelerometer = euclid.Vector3(0, 0, -self.gravity)
|
||||
|
||||
self.wind = util.Wind('0,0,0')
|
||||
|
||||
def normalise(self):
|
||||
'''normalise roll, pitch and yaw
|
||||
|
||||
|
@ -74,6 +74,9 @@ class QuadCopter(Aircraft):
|
||||
accel3D += euclid.Vector3(0, 0, -self.gravity)
|
||||
accel3D += air_resistance
|
||||
|
||||
# add in some wind
|
||||
accel3D += self.wind.accel(self.velocity)
|
||||
|
||||
# new velocity vector
|
||||
self.velocity += accel3D * delta_time
|
||||
self.accel = accel3D
|
||||
|
@ -84,6 +84,7 @@ parser.add_option("--simin", dest="simin", help="SIM input (IP:port)",
|
||||
parser.add_option("--simout", dest="simout", help="SIM output (IP:port)", default="127.0.0.1:5501")
|
||||
parser.add_option("--home", dest="home", type='string', default=None, help="home lat,lng,alt,hdg (required)")
|
||||
parser.add_option("--rate", dest="rate", type='int', help="SIM update rate", default=1000)
|
||||
parser.add_option("--wind", dest="wind", help="Simulate wind (speed,direction,turbulance)", default='0,0,0')
|
||||
|
||||
(opts, args) = parser.parse_args()
|
||||
|
||||
@ -141,7 +142,7 @@ a.altitude = a.home_altitude
|
||||
a.yaw = float(v[3])
|
||||
a.ground_level = a.home_altitude
|
||||
a.position.z = 0
|
||||
|
||||
a.wind = util.Wind(opts.wind)
|
||||
|
||||
print("Starting at lat=%f lon=%f alt=%.1f heading=%.1f" % (
|
||||
a.home_latitude,
|
||||
|
Loading…
Reference in New Issue
Block a user