Fixed sensor.accelerometer gravity sign for consider_gravity = True case - #1175
Open
vapsik wants to merge 1 commit into
Open
Fixed sensor.accelerometer gravity sign for consider_gravity = True case#1175vapsik wants to merge 1 commit into
consider_gravity = True case#1175vapsik wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
In the case of$$a_{ \text{inertial} } = a_{\text{ENU}} + g$$ but since the gravity vector has components $g = (0,0,-9.8)$ in ENU frame then it must be $$a_{ \text{inertial} } = a_{\text{ENU}} - g$$ .
consider_gravity = Truethe currentsensor.accelerometersensor accounts for gravity vector incorrectly —A simple example showcasing the current implementation being incorrect is with a stationary state (1) and airless free-falling rocket (2) - both with ENU-aligned accelerometers: 1) during stationary phase where$a_{\text{ENU}} = 0$ the $a_{ \text{inertial} } = (0,0,-9.8)$ where as real IMU would show $a_{ \text{inertial} } = (0,0,+9.8)$ as normal force upward from the ground must negate the effect of gravity for achieving the stationary state. 2) as a rocket goes into (airless) free fall real IMU would show inertial acceleration of 0 (weightless) but with current implementation in free fall or near apogee before parachute opening the
consider_gravity = Trueaccelerometer reading showsconsider_gravity = Trueaccelerometer shows total acceleration of nearly 19.6 showcasing the wrong gravity sign usage.Changes
In
accelerometer.pychangedinertial_acceleration = Vector(u_dot[3:6]) + gravityintoinertial_acceleration = Vector(u_dot[3:6]) - gravity.Test file showcasing the bugs (made with Claude)
repro_gravity_bug.py