Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acceleration units are not consistent #455

Closed
vasarhelyi opened this issue Aug 14, 2019 · 5 comments
Closed

Acceleration units are not consistent #455

vasarhelyi opened this issue Aug 14, 2019 · 5 comments

Comments

@vasarhelyi
Copy link

the state_t variable definition contains the followings:

  point_t position;         // m
  velocity_t velocity;      // m/s
  acc_t acc;                // Gs (but acc.z without considering gravity)
} state_t;

which is consistent with the StateEstimate.ax, ay, az logs that show the acceleration presumably correctly in G units (max around 0.3-0.4, which is more or less consistent with the acc calculated from StateEstimate.vx,vy,vz logs)

However, the stateCompressed and setpointCompressed structs define acc values in mm/s/s:

  // acceleration - mm / sec^2
  int16_t ax;
  int16_t ay;
  int16_t az;
} setpointCompressed;

and it is calculated from state.acc with a multiplication of 1000, assuming that state.acc is in SI units (m/s/s) instead of G units. E.g.:

  stateCompressed.ax = state.acc.x * 1000.0f;
  stateCompressed.ay = state.acc.y * 1000.0f;
  stateCompressed.az = state.acc.z * 1000.0f;
@krichardsson
Copy link
Contributor

I assume the slightly odd unit is used to make it possible to use an int16 instead of a float and thus reduce the number of bytes used from 6 to 2 per axis (hence the name Compressed).

This code is contributed by @whoenig, maybe he can shed some more light over this?

@vasarhelyi
Copy link
Author

That is fine but then it should not be called mm / sec^2 as it is a different unit (mG)

@krichardsson
Copy link
Contributor

There is a pull request (#450) that was merged recently that probably is what you are looking for.

@vasarhelyi
Copy link
Author

Yes, I did not see this, consistent with my report, corrects the problem, thank you! Sorry for the superfluous discussion...

@krichardsson
Copy link
Contributor

NP :-)

cafeciaojoe pushed a commit to cafeciaojoe/crazyflie-firmware that referenced this issue Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants