Latest updates to data conversion

This commit is contained in:
dario
2024-10-08 14:06:54 +02:00
parent 5479773e32
commit 86cdc18c95
14 changed files with 9803 additions and 6360 deletions

View File

@@ -39,10 +39,10 @@ class ASTOSSource(CSVSource):
super().__init__(path, 'time', interpolation)
def get_position(self) -> NDArray:
return self.fetch_values(['x', 'y', 'z'])
return self.fetch_values(['px_L', 'py_L', 'pz_L'])
def get_velocity(self, frame: Literal['global', 'local']) -> NDArray:
vel = self.fetch_values(['vx', 'vy', 'vz'])
vel = self.fetch_values(['vx_L', 'vy_L', 'vz_L'])
if frame == 'local':
return self.global_to_local() @ vel
@@ -50,10 +50,10 @@ class ASTOSSource(CSVSource):
return vel
def get_acceleration(self, frame: Literal['global', 'local']) -> NDArray:
acc = self.fetch_values(['ax', 'ay', 'az'])
if frame == 'local':
return self.global_to_local() @ acc
if frame == 'global':
acc = self.fetch_values(['ax_L', 'ay_L', 'az_L']) + np.array([-self.fetch_value('gravity'), 0, 0])
else:
acc = self.fetch_values(['ax_B', 'ay_B', 'az_B']) + self.fetch_init_values(['gx_B', 'gy_B', 'gz_B'])
return acc
@@ -69,22 +69,7 @@ class ASTOSSource(CSVSource):
pitch_l, yaw_l, roll_l = rots[0], rots[1], rots[2]
local_to_body = T1(roll_l) @ T2(pitch_l - math.pi/2) @ T1(-yaw_l)
# ASTOS global to launch rail.
init_long = self.fetch_init_value('longitude')
init_lat = self.fetch_init_value('latitude')
global_to_launch_rail = T2(-math.pi/2 - init_lat) @ T3(init_long)
# ASTOS global to local.
decl = self.fetch_value('declination')
long = self.fetch_value('longitude')
t0 = self.get_start_time()
omega_E = (2*math.pi) / (24*60*60)
global_to_local = T2(-decl) @ T3(long + omega_E * t0)
# ASTOS local to launch rail inverted
local_to_launch_rail_inv = global_to_launch_rail @ global_to_local
return local_to_body @ local_to_launch_rail_inv
return local_to_body
def get_angular_velocity(self) -> NDArray:
return self.fetch_values(['OMEGA_X', 'OMEGA_Y', 'OMEGA_Z'])