BUG: Unecessary Gyroscope Rotation and Wrong Acceleremoter Rotation by MateusStano · Pull Request #811 · RocketPy-Team/RocketPy

Pull Request Overview

This PR fixes bugs in sensor rotation handling and clarifies sensor behavior by correcting the rotation transformations and updating docstrings for clarity. Key changes include:

  • Removing an extra rotation for gyroscopes and correcting the accelerometer’s rotation direction.
  • Updating tests to use the new sensor rotation naming and comparing individual sensor outputs.
  • Refining flight class documentation to clearly reflect the inertial and body frame conventions.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

File Description
tests/unit/test_sensor.py Updated test cases to compare against the new rotation_sensor_to_body and adjusted transposition.
tests/integration/test_sensor.py Separated axis comparisons for accelerometer and gyroscope to match the fixed sensor rotations.
rocketpy/simulation/flight.py Revised docstrings for flight attributes and added body frame functions for clarity.
rocketpy/sensors/sensor.py, gyroscope.py, accelerometer.py, sensors_prints.py Replaced rotation_matrix with rotation_sensor_to_body and adjusted related matrix operations.
Comments suppressed due to low confidence (4)

rocketpy/simulation/flight.py:2176

  • The docstring for Flight.alpha2 incorrectly refers to the x direction. Since yaw acceleration typically corresponds to the y-axis, please update this to reflect the correct axis.
Angular acceleration of the rocket in the x direction of the rocket's body frame as a function of time, in rad/s. Sometimes referred to as yaw acceleration.

rocketpy/simulation/flight.py:2184

  • The docstring for Flight.alpha3 incorrectly refers to the x direction. Roll acceleration should be associated with the z-axis, so please update the description accordingly.
Angular acceleration of the rocket in the x direction of the rocket's body frame as a function of time, in rad/s. Sometimes referred to as roll acceleration.

rocketpy/simulation/flight.py:2215

  • For Flight.M2, the description should likely refer to the y-axis (not the x-axis) to correctly match its intended behavior.
Aerodynamic moment acting along the x-axis of the rocket's body frame as a function of time. Expressed in Newtons (N).

rocketpy/simulation/flight.py:2222

  • For Flight.M3, the description should likely refer to the z-axis (not the x-axis) to correctly reflect its role, so please update the docstring.
Aerodynamic moment acting along the x-axis of the rocket's body frame as a function of time. Expressed in Newtons (N).