/// <summary> /// Get the altitude above ground level. /// </summary> /// <param name="location">Location at which the AGL is evaluated.</param> /// <returns>the altitude AGL in feet.</returns> /// <see cref="SetGroundCallback"/> public double GetAltitudeAGL(Location location) { Location lDummy; Vector3D vDummy; return(GroundCallback.GetAGLevel(location, out lDummy, out vDummy, out vDummy, out vDummy)); }
/* Functions that rely on the ground callback * The following functions allow to set and get the vehicle position above * the ground. The ground level is obtained by interrogating an instance of * FGGroundCallback. A ground callback must therefore be set with * SetGroundCallback() before calling any of these functions. */ /// <summary> /// Get terrain contact point information below the current location. /// </summary> /// <param name="location">Location at which the contact point is evaluated.</param> /// <param name="contact">Contact point location</param> /// <param name="normal">Terrain normal vector in contact point (ECEF frame)</param> /// <param name="velocity">Terrain linear velocity in contact point (ECEF frame)</param> /// <param name="ang_velocity">Terrain angular velocity in contact point (ECEF frame)</param> /// <returns>altitude above contact point (AGL) in feet.</returns> /// <see cref="SetGroundCallback"/> public double GetContactPoint(Location location, out Location contact, out Vector3D normal, out Vector3D velocity, out Vector3D ang_velocity) { return(GroundCallback.GetAGLevel(location, out contact, out normal, out velocity, out ang_velocity)); }
public void RecomputeRunwayRadius() { // Get the runway radius. Location contactloc; Vector3D dvNormal, dvVel; GroundCallback gcb = FDMExec.GroundCallback; double t = FDMExec.State.SimTime; gcb.GetAGLevel(t, VState.vLocation, out contactloc, out dvNormal, out dvVel); RunwayRadius = contactloc.Radius; }
/// <summary> /// Set the altitude above ground level. /// </summary> /// <param name="location">Location at which the AGL is set.</param> /// <param name="altitudeAGL">Altitude above Ground Level in feet.</param> /// <see cref="SetGroundCallback"/> public void SetAltitudeAGL(Location location, double altitudeAGL) { Location contact; Vector3D vDummy; GroundCallback.GetAGLevel(location, out contact, out vDummy, out vDummy, out vDummy); double groundHeight = contact.GeodAltitude; double longitude = location.Longitude; double geodLat = location.GeodLatitudeRad; location.SetPositionGeodetic(longitude, geodLat, groundHeight + altitudeAGL); }
private bool Allocate() { bool result = true; atmosphere = new Atmosphere(this); propulsion = new Propulsion(this); aerodynamics = new Aerodynamics(this); FCS = new FlightControlSystem(this); groundReactions = new GroundReactions(this); inertial = new Inertial(this); massBalance = new MassBalance(this); propagate = new Propagate(this); auxiliary = new Auxiliary(this); aircraft = new Aircraft(this); //output = new Output(this); input = new Input(this); groundCallback = new GroundCallback(); state = new State(this); // This must be done here, as the State // class needs valid pointers to the above model classes // Initialize models so they can communicate with each other if (!atmosphere.InitModel()) { if (log.IsErrorEnabled) { log.Error("Atmosphere model init failed"); } error += 1; } if (!FCS.InitModel()) { if (log.IsErrorEnabled) { log.Error("FCS model init failed"); } error += 2; } if (!propulsion.InitModel()) { if (log.IsErrorEnabled) { log.Error("Propulsion model init failed"); } error += 4; } if (!massBalance.InitModel()) { if (log.IsErrorEnabled) { log.Error("MassBalance model init failed"); } error += 8; } if (!aerodynamics.InitModel()) { if (log.IsErrorEnabled) { log.Error("Aerodynamics model init failed"); } error += 16; } if (!inertial.InitModel()) { if (log.IsErrorEnabled) { log.Error("Inertial model init failed"); } error += 32; } if (!groundReactions.InitModel()) { if (log.IsErrorEnabled) { log.Error("Ground Reactions model init failed"); } error += 64; } if (!aircraft.InitModel()) { if (log.IsErrorEnabled) { log.Error("Aircraft model init failed"); } error += 128; } if (!propagate.InitModel()) { if (log.IsErrorEnabled) { log.Error("Propagate model init failed"); } error += 256; } if (!auxiliary.InitModel()) { if (log.IsErrorEnabled) { log.Error("Auxiliary model init failed"); } error += 512; } if (!input.InitModel()) { if (log.IsErrorEnabled) { log.Error("Intput model init failed"); } error += 1024; } if (error > 0) { result = false; } ic = new InitialCondition(this); // Schedule a model. The second arg (the integer) is the pass number. For // instance, the atmosphere model gets executed every fifth pass it is called // by the executive. Everything else here gets executed each pass. // IC and Trim objects are NOT scheduled. Schedule(input, 1); Schedule(atmosphere, 1); Schedule(FCS, 1); Schedule(propulsion, 1); Schedule(massBalance, 1); Schedule(aerodynamics, 1); Schedule(inertial, 1); Schedule(groundReactions, 1); Schedule(aircraft, 1); Schedule(propagate, 1); Schedule(auxiliary, 1); //Schedule(output, 1); modelLoaded = false; return(result); }
/// <summary> /// Sets the ground callback pointer. /// FGInertial will take ownership of the pointer which must therefore be /// located in the heap. /// </summary> /// <param name="gc">A pointer to a ground callback object</param> /// <see cref="FGGroundCallback"/> public void SetGroundCallback(GroundCallback gc) { GroundCallback = gc; }
/// <summary> /// Set the simulation time. /// The elapsed time can be used by the ground callbck to assess the planet /// rotation or the movement of objects. /// </summary> /// <param name="time">elapsed time in seconds since the simulation started.</param> public void SetTime(double time) { GroundCallback.SetTime(time); }
/// <summary> /// Set the terrain elevation above sea level. /// </summary> /// <param name="h">Terrain elevation in ft.</param> /// <see cref="SetGroundCallback"/> public void SetTerrainElevation(double h) { GroundCallback.SetTerrainElevation(h); }