From b2c94b5fd4d198d147d6776d436f5ba457dffe0f Mon Sep 17 00:00:00 2001 From: PASTOR Philippe <philippe.pastor@isae.fr> Date: Wed, 11 Sep 2024 12:43:55 +0000 Subject: [PATCH] Update 3 files - /mavion/ctlfun.py - /mavion/mavion.yaml - /mavion/pygmavion.py --- mavion/ctlfun.py | 20 ++++++++++++++++++++ mavion/mavion.yaml | 24 ++++++++++++++++++++++++ mavion/pygmavion.py | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 mavion/ctlfun.py create mode 100644 mavion/mavion.yaml create mode 100644 mavion/pygmavion.py diff --git a/mavion/ctlfun.py b/mavion/ctlfun.py new file mode 100644 index 0000000..2f78993 --- /dev/null +++ b/mavion/ctlfun.py @@ -0,0 +1,20 @@ + +import numpy as np + +def pulse(t, t0, tf): + u = 0 if (t<t0 or t>=tf) else 1 + return u + +def step(t, t0) : + u = 0 if t<t0 else 1 + return u + +def ramp(t, t0) : + u = 0 if t<t0 else (t - t0) + return u + +time = np.arange(0, 20, 0.01) + +p = pulse(time, 1, 2) + +print(p) diff --git a/mavion/mavion.yaml b/mavion/mavion.yaml new file mode 100644 index 0000000..a1abdd6 --- /dev/null +++ b/mavion/mavion.yaml @@ -0,0 +1,24 @@ +--- +NAME : "MAVION" + +G : 9.81 +RHO : 1.225 +MASS : 0.438 +CHORD : 0.21 +WINGSPAN : 0.42 +THICKNESS : 0.02 +P_P1_CG : [0.15, -0.5, 0] +P_P2_CG : [0.15, 0.5, 0] +P_A1_CG : [0.00, -0.5, 0] +P_A2_CG : [0.00, 0.5, 0] +INERTIA : [0.0036, 0.0036, 0.0072] +INERTIA_PROP_X : 3.46e-6 +INERTIA_PROP_N : 0.0 +WET_SURFACE : 0.0441 +DRY_SURFACE : 0.0 +PHI_n : 0.0 +PROP_RADIUS : 0.105 +ELEVON_MEFFICIENCY : [0, 0.66, 0] +ELEVON_FEFFICIENCY : [0, 0.33,0] +PROP_KP : 7.84e-06 +PROP_KM : 2.400e-7 diff --git a/mavion/pygmavion.py b/mavion/pygmavion.py new file mode 100644 index 0000000..bf07d9f --- /dev/null +++ b/mavion/pygmavion.py @@ -0,0 +1,34 @@ +# import the pygame module, so you can use it +import pygame + +# define a main function +def main(): + + # initialize the pygame module + pygame.init() + # load and set the logo + logo = pygame.image.load("logo32x32.png") + pygame.display.set_icon(logo) + pygame.display.set_caption("minimal program") + + # create a surface on screen that has the size of 240 x 180 + screen = pygame.display.set_mode((240,180)) + + # define a variable to control the main loop + running = True + + # main loop + while running: + # event handling, gets all event from the event queue + for event in pygame.event.get(): + # only do something if the event is of type QUIT + if event.type == pygame.QUIT: + # change the value to False, to exit the main loop + running = False + + +# run the main function only if this module is executed as the main script +# (if you import this as a module then nothing is executed) +if __name__=="__main__": + # call the main function + main() \ No newline at end of file -- GitLab