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

Convert racer joystick rates to PX4 acro rates #9591

Open
MaEtUgR opened this issue Jun 4, 2018 · 11 comments
Open

Convert racer joystick rates to PX4 acro rates #9591

MaEtUgR opened this issue Jun 4, 2018 · 11 comments
Assignees
Labels
Documentation 📑 Anything improving the documentation of the code / ecosystem
Projects

Comments

@MaEtUgR
Copy link
Member

MaEtUgR commented Jun 4, 2018

I think it would be useful to support racers who come from a different FC to test PX4 and let them convert their existing rates in cleanflight betaflight fork parameters described here https://oscarliang.com/rc-roll-pitch-yaw-rate-cleanflight/ to our better tunable solution.

Like I promised here
#9358 (comment)
#9358 (comment)
I provide the calculation script and it would probably be easiest to just run it on a website but best to include the functionality in QGC.

FYI @bkueng

@MaEtUgR MaEtUgR added the Documentation 📑 Anything improving the documentation of the code / ecosystem label Jun 4, 2018
@MaEtUgR MaEtUgR self-assigned this Jun 4, 2018
@MaEtUgR MaEtUgR added this to the Release v2.0.0 milestone Jun 4, 2018
@dagar
Copy link
Member

dagar commented Jun 4, 2018

That's a great idea.

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Jun 6, 2018

I realized existing FCs also have differences and I found an existing easy to use open source tool which already converts between them and visualizes the result: https://apocolipse.github.io/RotorPirates/

I could add PX4 rates and we can link to it in the documentation as soon as I understand where all the calculations are done: apocolipse/RotorPirates#4 That's more future proof because it can directly be maintained if anything changes for any FC in the future.

@stale
Copy link

stale bot commented Jan 22, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Jan 24, 2019

The maintainer of the value converter repo finally answered me now and I'll add the PX4 stick mapping to https://apocolipse.github.io/RotorPirates/ in a pr.

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Jan 26, 2019

PR for this now here: apocolipse/RotorPirates#7

@LorenzMeier
Copy link
Member

Very cool!

@stale
Copy link

stale bot commented Jun 25, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@MaEtUgR
Copy link
Member Author

MaEtUgR commented Jun 25, 2019

Recently I looked into the rate calculation of betaflight and it's in theory slightly different because they use an x^4 term as expo instead of x^3 like we do. But it's in practise totally different because they still use these totally unintuitive configuration parameters that all depend on each other...

I think a first step is to write both formulas down clearly and then figure out an approximate coefficient transformation.

@stale stale bot removed the Admin: Wont fix label Jun 25, 2019
@MaEtUgR
Copy link
Member Author

MaEtUgR commented Jun 25, 2019

PX4
https://github.com/PX4/Firmware/blob/6d9bf18ca6e1ef4c3a721832398cae72385bf360/src/lib/mathlib/math/Functions.hpp#L61-L95
y = RateMax * (1 - Expo) * x + Expo * x * x * x * (1 - Superexpo) / (1 - abs(x) * Superexpo)

Betaflight
Here's the betaflight rate formula that we should be compatible to in some documented way: https://github.com/betaflight/betaflight/blob/ecb67fcc097d284db706149bdeefaa40b17ce921/src/main/fc/rc.c#L120-L138

The extracted formula without corner case handling is:
y = 200 * rcRate * (x * x^3 * Expo + x * (1 - Expo)) * 1 / (1 - (abs(x) * (SuperRate / 100.0f)));

So we need to convert the scaling and the expo to approximate x^4.

@PX4 PX4 deleted a comment from stale bot Sep 25, 2019
@stale stale bot removed the Admin: Wont fix label Sep 25, 2019
@MaEtUgR MaEtUgR added this to To do in Multicopter via automation Oct 21, 2019
@MaEtUgR MaEtUgR removed this from the Release v1.10.0 milestone Oct 21, 2019
@stale
Copy link

stale bot commented Jan 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale label Jan 19, 2020
@junwoo091400
Copy link
Contributor

This is quite cool! And maybe worth keeping it open 🙌

@stale stale bot removed the stale label Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation 📑 Anything improving the documentation of the code / ecosystem
Projects
No open projects
Multicopter
  
To do
Development

No branches or pull requests

4 participants