11import numpy as np
22
3- from ..mathutils .vector_matrix import Matrix , Vector
3+ from ..mathutils .vector_matrix import Vector
44from ..prints .sensors_prints import _GyroscopePrints
55from ..sensors .sensor import InertialSensor
66
@@ -44,7 +44,7 @@ class Gyroscope(InertialSensor):
4444 The cross axis sensitivity of the sensor in percentage.
4545 name : str
4646 The name of the sensor.
47- rotation_matrix : Matrix
47+ rotation_sensor_to_body : Matrix
4848 The rotation matrix of the sensor from the sensor frame to the rocket
4949 frame of reference.
5050 normal_vector : Vector
@@ -222,33 +222,26 @@ def measure(self, time, **kwargs):
222222 u_dot = kwargs ["u_dot" ]
223223 relative_position = kwargs ["relative_position" ]
224224
225- # Angular velocity of the rocket in the rocket frame
225+ # Angular velocity of the rocket in the body frame
226226 omega = Vector (u [10 :13 ])
227227
228228 # Transform to sensor frame
229- inertial_to_sensor = self ._total_rotation_matrix @ Matrix .transformation (
230- u [6 :10 ]
231- )
232- W = inertial_to_sensor @ omega
229+ W = self ._total_rotation_sensor_to_body @ omega
233230
234231 # Apply noise + bias and quantize
235232 W = self .apply_noise (W )
236233 W = self .apply_temperature_drift (W )
237234
238235 # Apply acceleration sensitivity
239236 if self .acceleration_sensitivity != Vector .zeros ():
240- W += self .apply_acceleration_sensitivity (
241- omega , u_dot , relative_position , inertial_to_sensor
242- )
237+ W += self .apply_acceleration_sensitivity (omega , u_dot , relative_position )
243238
244239 W = self .quantize (W )
245240
246241 self .measurement = tuple ([* W ])
247242 self ._save_data ((time , * W ))
248243
249- def apply_acceleration_sensitivity (
250- self , omega , u_dot , relative_position , rotation_matrix
251- ):
244+ def apply_acceleration_sensitivity (self , omega , u_dot , relative_position ):
252245 """
253246 Apply acceleration sensitivity to the sensor measurement
254247
@@ -260,8 +253,6 @@ def apply_acceleration_sensitivity(
260253 The time derivative of the state vector
261254 relative_position : Vector
262255 The vector from the rocket's center of mass to the sensor
263- rotation_matrix : Matrix
264- The rotation matrix from the rocket frame to the sensor frame
265256
266257 Returns
267258 -------
@@ -271,7 +262,7 @@ def apply_acceleration_sensitivity(
271262 # Linear acceleration of rocket cdm in inertial frame
272263 inertial_acceleration = Vector (u_dot [3 :6 ])
273264
274- # Angular velocity and accel of rocket
265+ # Angular accel of rocket in body frame
275266 omega_dot = Vector (u_dot [10 :13 ])
276267
277268 # Acceleration felt in sensor
@@ -281,7 +272,7 @@ def apply_acceleration_sensitivity(
281272 + Vector .cross (omega , Vector .cross (omega , relative_position ))
282273 )
283274 # Transform to sensor frame
284- A = rotation_matrix @ A
275+ A = self . _total_rotation_sensor_to_body @ A
285276
286277 return self .acceleration_sensitivity & A
287278
0 commit comments