Skip to content

Commit 1c49f5a

Browse files
committed
Making Copyright disclaimers consistent and removing dunder names
The copyright disclaimers were missing in multiple python files. furthermore I adapted them to contain my middle name which i forgot earlier. For now all the dunder names are removed until we decide to add them back in again.
1 parent 264ea29 commit 1c49f5a

30 files changed

+365
-107
lines changed

Tools/parametric_model/generate_parametric_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
*
3-
* Copyright (c) 2021 Manuel Galliker
3+
* Copyright (c) 2021 Manuel Yves Galliker
44
* 2021 Autonomous Systems Lab ETH Zurich
55
* All rights reserved.
66
* Redistribution and use in source and binary forms, with or without

Tools/parametric_model/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
h5py>=3.1.0
22
numpy>=1.19.5
33
pandas>=1.1.5
4-
# pyproj>=3.0.1
54
pyulog>=0.8.0
65
scikit-learn>=0.24.1
76
matplotlib>=3.3.4
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
"""Provides interface to access all modules available in the src directory"""
2-
3-
__author__ = "Manuel Galliker"
4-
__maintainer__ = "Manuel Galliker"
5-
__license__ = "BSD 3"
6-
71
from . import models
82
from . import tools
93
from . import optimizers

Tools/parametric_model/src/models/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
"""Provides interface to access all modules available in the model directly"""
2-
3-
__author__ = "Manuel Galliker"
4-
__maintainer__ = "Manuel Galliker"
5-
__license__ = "BSD 3"
6-
71
from . import aerodynamic_models
82
from . import rotor_models
93
from . import model_plots
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
"""Provides interface to access all modules available in the model directly"""
2-
3-
__author__ = "Manuel Galliker"
4-
__maintainer__ = "Manuel Galliker"
5-
__license__ = "BSD 3"
6-
7-
81
from .fuselage_drag_model import FuselageDragModel
92
from .standard_wing_model import StandardWingModel
103
from .control_surface_model import ControlSurfaceModel
11-

Tools/parametric_model/src/models/aerodynamic_models/control_surface_model.py

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
*
3-
* Copyright (c) 2021 Manuel Galliker
3+
* Copyright (c) 2021 Manuel Yves Galliker
44
* 2021 Autonomous Systems Lab ETH Zurich
55
* All rights reserved.
66
* Redistribution and use in source and binary forms, with or without
@@ -57,14 +57,17 @@ def compute_actuator_force_features(self, index, v_airspeed, angle_of_attack):
5757
Model description:
5858
"""
5959
actuator_input = self.actuator_input_vec[index]
60-
q_xz = 0.5 * self.air_density * (v_airspeed[0]**2 + v_airspeed[2]**2) #TODO Take dynamic pressure
60+
q_xz = 0.5 * self.air_density * \
61+
(v_airspeed[0]**2 + v_airspeed[2]**2) # TODO Take dynamic pressure
6162
# TODO Compute lift axis and drag axis
6263
lift_axis = np.array([v_airspeed[0], 0.0, v_airspeed[2]])
6364
lift_axis = (lift_axis / np.linalg.norm(lift_axis)).reshape((3, 1))
64-
drag_axis = (-1.0 * v_airspeed / np.linalg.norm(v_airspeed)).reshape((3, 1))
65-
X_lift = lift_axis @ np.array([[actuator_input]]) *q_xz * self.area
66-
X_drag = drag_axis @ np.array([[actuator_input]]) *q_xz * self.area
67-
R_aero_to_body = Rotation.from_rotvec([0, -angle_of_attack, 0]).as_matrix()
65+
drag_axis = (-1.0 * v_airspeed /
66+
np.linalg.norm(v_airspeed)).reshape((3, 1))
67+
X_lift = lift_axis @ np.array([[actuator_input]]) * q_xz * self.area
68+
X_drag = drag_axis @ np.array([[actuator_input]]) * q_xz * self.area
69+
R_aero_to_body = Rotation.from_rotvec(
70+
[0, -angle_of_attack, 0]).as_matrix()
6871
X_lift_body = R_aero_to_body @ X_lift
6972
X_drag_body = R_aero_to_body @ X_drag
7073

@@ -75,15 +78,21 @@ def compute_actuator_moment_features(self, index, v_airspeed, angle_of_attack):
7578
Model description:
7679
"""
7780
actuator_input = self.actuator_input_vec[index]
78-
q_xz = 0.5 * self.air_density * (v_airspeed[0]**2 + v_airspeed[2]**2) #TODO Take dynamic pressure
81+
q_xz = 0.5 * self.air_density * \
82+
(v_airspeed[0]**2 + v_airspeed[2]**2) # TODO Take dynamic pressure
7983
lift_axis = np.array([v_airspeed[0], 0.0, v_airspeed[2]])
8084
yaw_axis = (lift_axis / np.linalg.norm(lift_axis)).reshape((3, 1))
81-
roll_axis = ( v_airspeed / np.linalg.norm(v_airspeed)).reshape((3, 1))
82-
pitch_axis = np.cross(np.transpose(yaw_axis), np.transpose(roll_axis)).reshape((3, 1))
83-
X_roll_moment = roll_axis @ np.array([[actuator_input]]) * q_xz * self.area
84-
X_pitch_moment = pitch_axis @ np.array([[actuator_input]]) * q_xz * self.area
85-
X_yaw_moment = yaw_axis @ np.array([[actuator_input]]) *q_xz * self.area
86-
R_aero_to_body = Rotation.from_rotvec([0, -angle_of_attack, 0]).as_matrix()
85+
roll_axis = (v_airspeed / np.linalg.norm(v_airspeed)).reshape((3, 1))
86+
pitch_axis = np.cross(np.transpose(yaw_axis),
87+
np.transpose(roll_axis)).reshape((3, 1))
88+
X_roll_moment = roll_axis @ np.array(
89+
[[actuator_input]]) * q_xz * self.area
90+
X_pitch_moment = pitch_axis @ np.array(
91+
[[actuator_input]]) * q_xz * self.area
92+
X_yaw_moment = yaw_axis @ np.array([[actuator_input]]
93+
) * q_xz * self.area
94+
R_aero_to_body = Rotation.from_rotvec(
95+
[0, -angle_of_attack, 0]).as_matrix()
8796
X_roll_moment_body = R_aero_to_body @ X_roll_moment
8897
X_pitch_moment_body = R_aero_to_body @ X_pitch_moment
8998
X_yaw_moment_body = R_aero_to_body @ X_yaw_moment
@@ -93,11 +102,13 @@ def compute_actuator_moment_features(self, index, v_airspeed, angle_of_attack):
93102
def compute_actuator_force_matrix(self, v_airspeed_mat, angle_of_attack_vec):
94103
print("Computing force features for control surface:", self.name)
95104

96-
X_forces = self.compute_actuator_force_features(0, v_airspeed_mat[0, :], angle_of_attack_vec[0, :])
105+
X_forces = self.compute_actuator_force_features(
106+
0, v_airspeed_mat[0, :], angle_of_attack_vec[0, :])
97107
rotor_features_bar = Bar(
98108
'Feature Computatiuon', max=self.actuator_input_vec.shape[0])
99109
for index in range(1, self.n_timestamps):
100-
X_force_curr = self.compute_actuator_force_features(index, v_airspeed_mat[index, :], angle_of_attack_vec[index, :])
110+
X_force_curr = self.compute_actuator_force_features(
111+
index, v_airspeed_mat[index, :], angle_of_attack_vec[index, :])
101112
X_forces = np.vstack((X_forces, X_force_curr))
102113
rotor_features_bar.next()
103114
rotor_features_bar.finish()
@@ -109,11 +120,13 @@ def compute_actuator_force_matrix(self, v_airspeed_mat, angle_of_attack_vec):
109120
def compute_actuator_moment_matrix(self, v_airspeed_mat, angle_of_attack_vec):
110121
print("Computing moment features for control surface:", self.name)
111122

112-
X_moments = self.compute_actuator_moment_features(0, v_airspeed_mat[0, :], angle_of_attack_vec[0, :])
123+
X_moments = self.compute_actuator_moment_features(
124+
0, v_airspeed_mat[0, :], angle_of_attack_vec[0, :])
113125
rotor_features_bar = Bar(
114126
'Feature Computatiuon', max=self.actuator_input_vec.shape[0])
115127
for index in range(1, self.n_timestamps):
116-
X_moment_curr = self.compute_actuator_moment_features(index, v_airspeed_mat[index, :], angle_of_attack_vec[index, :])
128+
X_moment_curr = self.compute_actuator_moment_features(
129+
index, v_airspeed_mat[index, :], angle_of_attack_vec[index, :])
117130
X_moments = np.vstack((X_moments, X_moment_curr))
118131
rotor_features_bar.next()
119132
rotor_features_bar.finish()

Tools/parametric_model/src/models/aerodynamic_models/fuselage_drag_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
*
3-
* Copyright (c) 2021 Manuel Galliker
3+
* Copyright (c) 2021 Manuel Yves Galliker
44
* 2021 Autonomous Systems Lab ETH Zurich
55
* All rights reserved.
66
* Redistribution and use in source and binary forms, with or without

Tools/parametric_model/src/models/aerodynamic_models/standard_wing_model.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
*
3-
* Copyright (c) 2021 Manuel Galliker
3+
* Copyright (c) 2021 Manuel Yves Galliker
44
* 2021 Autonomous Systems Lab ETH Zurich
55
* All rights reserved.
66
* Redistribution and use in source and binary forms, with or without
@@ -137,7 +137,8 @@ def compute_wing_moment_features(self, v_airspeed, angle_of_attack, angle_of_sid
137137
if abs(AoA) < stall_angle: cropped_sym_sigmoid(AoA) = 0
138138
if abs(AoA) > stall_angle: cropped_sym_sigmoid(AoA) = 1
139139
"""
140-
q_xz = 0.5 * self.air_density * (v_airspeed[0]**2 + v_airspeed[2]**2) #TODO Take dynamic pressure
140+
q_xz = 0.5 * self.air_density * \
141+
(v_airspeed[0]**2 + v_airspeed[2]**2) # TODO Take dynamic pressure
141142
q_xy = 0.5 * self.air_density * (v_airspeed[0]**2 + v_airspeed[1]**2)
142143

143144
X_wing_aero_frame = np.zeros((3, 3))
@@ -153,12 +154,12 @@ def compute_wing_moment_features(self, v_airspeed, angle_of_attack, angle_of_sid
153154

154155
# Compute Pitch Moment coeffiecients:
155156
X_wing_aero_frame[1, 0] = flow_attached_region * q_xz * self.area
156-
X_wing_aero_frame[1, 1] = flow_attached_region * q_xz * self.area * angle_of_attack
157-
158-
# TODO: Compute Yaw Moment coeffiecients:
159-
X_wing_aero_frame[2, 2] = flow_attached_region * q_xy * self.area * angle_of_sideslip
157+
X_wing_aero_frame[1, 1] = flow_attached_region * \
158+
q_xz * self.area * angle_of_attack
160159

161-
160+
# TODO: Compute Yaw Moment coeffiecients:
161+
X_wing_aero_frame[2, 2] = flow_attached_region * \
162+
q_xy * self.area * angle_of_sideslip
162163

163164
# Transorm from stability axis frame to body FRD frame
164165
R_aero_to_body = Rotation.from_rotvec(
@@ -167,7 +168,6 @@ def compute_wing_moment_features(self, v_airspeed, angle_of_attack, angle_of_sid
167168

168169
return X_wing_body_frame
169170

170-
171171
def compute_aero_force_features(self, v_airspeed_mat, angle_of_attack_vec):
172172
"""
173173
Inputs:
@@ -209,6 +209,7 @@ def compute_aero_moment_features(self, v_airspeed_mat, angle_of_attack_vec, angl
209209
X_aero = np.vstack((X_aero, X_curr))
210210
aero_features_bar.next()
211211
aero_features_bar.finish()
212-
wing_coef_list = ["c_m_x_wing_xz_offset", "c_m_x_wing_xz_lin", "c_m_z_wing_lin"]
212+
wing_coef_list = ["c_m_x_wing_xz_offset",
213+
"c_m_x_wing_xz_lin", "c_m_z_wing_lin"]
213214
aero_coef_list = wing_coef_list
214215
return X_aero, aero_coef_list

Tools/parametric_model/src/models/dynamics_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
*
3-
* Copyright (c) 2021 Manuel Galliker
3+
* Copyright (c) 2021 Manuel Yves Galliker
44
* 2021 Autonomous Systems Lab ETH Zurich
55
* All rights reserved.
66
* Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,9 @@
3535
""" The model class contains properties shared between all models and shgall simplyfy automated checks and the later
3636
export to a sitl gazebo model by providing a unified interface for all models. """
3737

38+
39+
40+
3841
from progress.bar import Bar
3942
import pandas as pd
4043
import math
@@ -44,15 +47,12 @@
4447
import src.optimizers as optimizers
4548
from scipy.linalg import block_diag
4649
import matplotlib.pyplot as plt
47-
4850
from .rotor_models import RotorModel, BiDirectionalRotorModel, TiltingRotorModel, ChangingAxisRotorModel
4951
from .model_plots import model_plots, aerodynamics_plots, linear_model_plots
5052
from src.tools.ulog_tools import load_ulog, pandas_from_topic
5153
from src.tools.dataframe_tools import compute_flight_time, resample_dataframe_list
5254
from src.tools.quat_utils import quaternion_to_rotation_matrix
5355
from src.tools.math_tools import cropped_sym_sigmoid
54-
55-
5656
class DynamicsModel():
5757
def __init__(self, config_dict):
5858

Tools/parametric_model/src/models/model_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
*
3-
* Copyright (c) 2021 Manuel Galliker
3+
* Copyright (c) 2021 Manuel Yves Galliker
44
* 2021 Autonomous Systems Lab ETH Zurich
55
* All rights reserved.
66
* Redistribution and use in source and binary forms, with or without

0 commit comments

Comments
 (0)