diff --git a/paseos/attitude/attitude_model.py b/paseos/attitude/attitude_model.py index b9211b3..4c4610f 100644 --- a/paseos/attitude/attitude_model.py +++ b/paseos/attitude/attitude_model.py @@ -103,7 +103,7 @@ def calculate_disturbance_torque(self, position, velocity, euler_angles): T += calculate_aero_torque() if "gravitational" in self._actor.get_disturbances(): T += calculate_grav_torque(self._actor_pointing_vector_body,earth_rotation_vector_in_body, - self._actor._moment_of_inertia, self._actor._previous_altitude) + self._actor._moment_of_inertia, position[0]) if "magnetic" in self._actor.get_disturbances(): T += calculate_magnetic_torque() return T @@ -118,7 +118,9 @@ def calculate_angular_acceleration(self): # Euler's equation for rigid body rotation: a = I^(-1) (T - w x (Iw)) # with: a = angular acceleration, I = inertia matrix, T = torque vector, w = angular velocity self._actor_angular_acceleration = np.linalg.inv(I) @ ( - self.calculate_disturbance_torque() + self.calculate_disturbance_torque(position=np.array(self._actor.get_position(self._actor.local_time)), + velocity=np.array(self._actor.get_position_velocity(self._actor.local_time)[1]), + euler_angles=self._actor_attitude_in_rad) - np.cross(self._actor_angular_velocity, I @ self._actor_angular_velocity) ) diff --git a/paseos/attitude/disturbance_calculations.py b/paseos/attitude/disturbance_calculations.py index cb3d092..4bdc9fe 100644 --- a/paseos/attitude/disturbance_calculations.py +++ b/paseos/attitude/disturbance_calculations.py @@ -41,7 +41,8 @@ def calculate_grav_torque(u_r, u_n, J, h): tg_term_2 = 30 * np.dot(u_r, u_n) * (np.cross(u_n, J * u_r) + np.cross(u_r, J * u_n)) tg_term_3 = np.cross((15 - 105 * np.dot(u_r, u_n) ** 2 * u_r), J * u_r) + np.cross(6 * u_n, J * u_r) tg = tg_term_1 + mu * J2 * Re ** 2 / (2 * r ** 5) * (tg_term_2 + tg_term_3) - return np.array(tg) + T = [tg[0,0], tg[1,1], tg[2,2]] + return np.array(T) def calculate_magnetic_torque():