Example #1
0
 def __init__(self, fdmexec):
     self.fdmexec = fdmexec
     self.type = "Rascal"
     self.sensors = Sensors(fdmexec)
     self.instruments = Instruments(fdmexec)
     self.engine = Engine(fdmexec)
     self.controls = Controls(fdmexec)
Example #2
0
    def test_inertialNavigationSystem(self):
        huginn_data_path = configuration.get_data_path()

        fdm_builder = FDMBuilder(huginn_data_path)
        fdm_builder.aircraft = "Rascal"
        fdmexec = fdm_builder.create_fdm()

        sensors = Sensors(fdmexec)

        self.assertAlmostEqual(sensors.inertial_navigation_system.true_roll,
                               fdmexec.GetPropagate().GetEulerDeg(1), 3)
        self.assertAlmostEqual(sensors.inertial_navigation_system.true_pitch,
                               fdmexec.GetPropagate().GetEulerDeg(2), 3)
        self.assertAlmostEqual(
            sensors.inertial_navigation_system.true_latitude,
            fdmexec.GetPropagate().GetLatitudeDeg(), 3)
        self.assertAlmostEqual(
            sensors.inertial_navigation_system.true_longitude,
            fdmexec.GetPropagate().GetLongitudeDeg(), 3)
        self.assertAlmostEqual(
            sensors.inertial_navigation_system.true_altitude,
            fdmexec.GetPropagate().GetAltitudeASLmeters(), 3)
        self.assertAlmostEqual(
            sensors.inertial_navigation_system.true_airspeed,
            convert_jsbsim_velocity(fdmexec.GetAuxiliary().GetVtrueFPS()), 3)
        self.assertAlmostEqual(
            sensors.inertial_navigation_system.true_heading,
            math.degrees(fdmexec.GetPropagate().GetEuler(3)), 3)
Example #3
0
    def test_pitot_tube(self):
        huginn_data_path = configuration.get_data_path()

        fdm_builder = FDMBuilder(huginn_data_path)
        fdm_builder.aircraft = "Rascal"
        fdmexec = fdm_builder.create_fdm()

        sensors = Sensors(fdmexec)

        self.assertAlmostEqual(
            sensors.pitot_tube.true_pressure,
            convert_jsbsim_pressure(fdmexec.GetAuxiliary().GetTotalPressure()))
Example #4
0
    def test_presure_sensor(self):
        huginn_data_path = configuration.get_data_path()

        fdm_builder = FDMBuilder(huginn_data_path)
        fdm_builder.aircraft = "Rascal"
        fdmexec = fdm_builder.create_fdm()

        sensors = Sensors(fdmexec)

        self.assertAlmostEqual(
            sensors.pressure_sensor.true_pressure,
            convert_jsbsim_pressure(fdmexec.GetAtmosphere().GetPressure()))
Example #5
0
    def test_gyroscope(self):
        huginn_data_path = configuration.get_data_path()

        fdm_builder = FDMBuilder(huginn_data_path)
        fdm_builder.aircraft = "Rascal"
        fdmexec = fdm_builder.create_fdm()

        sensors = Sensors(fdmexec)

        self.assertAlmostEqual(sensors.gyroscope.true_roll_rate,
                               math.degrees(fdmexec.GetPropagate().GetPQR(1)))
        self.assertAlmostEqual(sensors.gyroscope.true_pitch_rate,
                               math.degrees(fdmexec.GetPropagate().GetPQR(2)))
        self.assertAlmostEqual(sensors.gyroscope.true_yaw_rate,
                               math.degrees(fdmexec.GetPropagate().GetPQR(3)))
Example #6
0
    def test_accelerometer(self):
        huginn_data_path = configuration.get_data_path()

        fdm_builder = FDMBuilder(huginn_data_path)
        fdm_builder.aircraft = "Rascal"
        fdmexec = fdm_builder.create_fdm()

        sensors = Sensors(fdmexec)

        self.assertAlmostEqual(
            sensors.accelerometer.true_x,
            convert_jsbsim_acceleration(
                fdmexec.GetAuxiliary().GetPilotAccel(1)))
        self.assertAlmostEqual(
            sensors.accelerometer.true_y,
            convert_jsbsim_acceleration(
                fdmexec.GetAuxiliary().GetPilotAccel(2)))
        self.assertAlmostEqual(
            sensors.accelerometer.true_z,
            convert_jsbsim_acceleration(
                fdmexec.GetAuxiliary().GetPilotAccel(3)))