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

Allow non-standard IMU orientation (mostly for Bolt) #829

Merged
merged 4 commits into from
Sep 29, 2021

Conversation

matejkarasek
Copy link
Contributor

This PR enables to define non-standard orientation of the IMU on the airframe, e.g. when using the Crazyflie Bolt on unconventional aircrafts.
The user can specify the Euler angles of the IMU using the defines in the config file.

@jonasdn jonasdn requested a review from tobbeanton August 18, 2021 07:12
Copy link
Member

@tobbeanton tobbeanton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. Testing is needed.

@matejkarasek
Copy link
Contributor Author

As for the testing, I did test the code with:

  1. standard CF2.1 and default IMU orientation (IMU_PHI=0.0f, IMU_THETA=0.0f, IMU_PSI=0.0f)

  2. a CF2.1 with an upside-down PCB, manual flight as well as position control in both LPS and Lighthouse :
    https://user-images.githubusercontent.com/10943061/134651320-94adfd33-1af2-443c-8617-1f8f7c5118b6.mp4
    https://user-images.githubusercontent.com/10943061/134651302-33ec14b0-ba20-4c30-b951-d5c2783f036d.mp4
    (not spot on hover, but in our setup it oscillates like this also with standard firmware and orientation)
    I didn't keep the code, but I think I used IMU_PHI=180.0f and I had to swap motor numbers & signs in the power distribution.

  3. with our Flapper Drone, where the Bolt is mounted vertically, we use IMU_THETA=90.0f and IMU_PSI=180.0f

While I beleive this is enough evidence, always good if someone could reproduce the tests.
And, any volunteer to test "non-orthogonal" orientations? :)

@tobbeanton
Copy link
Member

@matejkarasek Could you try to resolve the merge conflict? The history is better preserved if you do it.

@matejkarasek
Copy link
Contributor Author

Done!

@tobbeanton
Copy link
Member

tobbeanton commented Sep 29, 2021

Thanks! I tested it simply by viewing the virtual horizon in the cfclient for different PHI, THETA, PSI values and it looked good.

I think this functionality is a really good start which also highlights that we should make this easier to configure in the future. The functionality is also overlapping the pitch and roll trimming which I think should be replaced with a easy to configure Euler angle setup in the future. Well that is then, let's start with this step first :-)

@tobbeanton tobbeanton merged commit 8a0c181 into bitcraze:master Sep 29, 2021
@matejkarasek
Copy link
Contributor Author

Great! I agree it would be nice to have this easily configurable, e.g. through some sort of persistent setting, and then it could indeed replace the roll/pitch trims...

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

Successfully merging this pull request may close these issues.

4 participants