Exemplo n.º 1
0
    def __init__(self, DatComClass):

        self.config = Config()
        geometrieClass = self.config.mappingDict[
            DatComClass]  #welche Geometrie/DatCom Klasse wird benutzt
        self.geometry = geometrieClass()
        self.umrechnungenKoordinaten = UmrechnungenKoordinaten(
        )  #todo: nicht als self, sondern als extra Dienst

        # Ziel: ist die Flugbahngleichung
        #todo: prüfen ob der state in ein Dictonary soll
        #state/Zustand des Objects
        #np.array([u,v,w,x,y,z,p,q,r,theta,phi,psi])
        # 1. Position
        # im flugzeugfesten System | f_ks
        self.x = 0  # m
        self.y = 0  # m
        self.z = 0  # m

        # 2. Gechwindigkeit
        # im flugzeugfesten System | f_ks
        self.u = 0  # m/s
        self.v = 0  # m/s
        self.w = 0  # m/s

        # 3. Attitude | Winkel um die Drehachsen f-KS zu g-KS
        self.phi = 0  # rad
        self.theta = 0  # rad
        self.psi = 0  # rad

        # 4. Winkelgeschwindigkeiten p,q,r
        self.p = 0  # rad/s
        self.q = 0  # rad/s
        self.r = 0  # rad/s

        # der gesamte State
        self.state = np.array([
            self.u, self.v, self.w, self.x, self.y, self.z, self.p, self.q,
            self.r, self.phi, self.theta, self.psi
        ])

        # abgeleitete Werte
        self.alpha = 0.1e-10  #Deg
        self.alphaDot = 0.1e-10
        self.beta = 0
        self.mass = self.geometry.mass
        self.inertia = self.geometry.inertia
        self.TAS = 0.1e-10
        self.staudruck = 0
        self.Sw = 0

        # abgeleitete Koordinaten geodaetisch mit
        self.x_geo = 0
        self.y_geo = 0
        self.z_geo = 0
        self.x_dot_g_ks = 0
        self.y_dot_g_ks = 0
        self.z_dot_g_ks = 0

        # EARTH CONSTANTS
        # todo: hat nichts mit dem ac zu tun und muss ins Enviroment
        self.gravity = 9.80665  # Gravity of Ethe Earth (m/s^2) - [1]
        self.rho = 1.225
        self.mu = 1.983e-5  # kg/m/s

        # Forces & moments
        self.total_forces_f_ks = np.zeros(3)
        self.total_moments_f_ks = np.zeros(3)

        self.delta_elevator = 0
        self.delta_aileron = 0
        self.delta_rudder = 0
        self.delta_thrust = 0
Exemplo n.º 2
0
import gym
from gym import spaces
import numpy as np
import struct
import sys
sys.path.append('..')
sys.path.append('.')

from plain_fdm.physikFDM import Aircraft_baever
from plain_fdm.lfz_controlFDM import PidRegler
from plain_fdm.physikFDM import DynamicSystem6DoF
from plain_fdm.config import Config
from plain_fdm.servicesFDM import UdpClient
from plain_fdm.servicesFDM import PlotState

config = Config()


class WrapperOpenAI(gym.Env):
    """Custom Environment that follows gym interface"""
    metadata = {'render.modes': ['human']}

    def __init__(self, stepweite=0.01):
        super(WrapperOpenAI, self).__init__()
        # Define action and observation space
        # They must be gym.spaces objects
        # nur aileron
        high_action_space = np.array([1.], dtype=np.float32)
        self.action_space = spaces.Box(low=-high_action_space,
                                       high=high_action_space,
                                       dtype=np.float32)
Exemplo n.º 3
0
def main():
    config = Config()
    aircraft = AircraftBaever()
    aircraft.getForces()
    print(aircraft._calculate_engine_coeffs())