-
Notifications
You must be signed in to change notification settings - Fork 22
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
add gyro functionality #115
Comments
mstrens here is an explanation of the latching - it would affect PID calculations
Mike |
About stick priority :
About the latching control. It is not yet clear how this applies:
|
I reset my pswd on Github :-) stick priority : latching: |
Some of these vary from manufacturer to manufacturer - I have read of some that immediately over-ride all "corrections" if there is a stick input for that axis (I often have my gyros set up a low-ish gain so that it will pick up a big change, but I still correct small extraneous inputs myself - it helps the plane fly more naturally. My understanding (perhaps wrongly) that it was how quickly / aggressively it corrects for wind. Some FBL systems had different modes for different types of flight - 3D flight might select "Mechanical" as it wants fast / aggressive corrections whereas for a war-bird the user might select "Fluid" which would give gentler, longer return to position to reflect scale flight. This would be reflected in different PIS settings for different styles. Th 2 paragraph that I pasted earlier were copied from a Bavarian Demon thread on RCG explaining the Latching and stick priority. My assumption (based upon other gyros) is that these are used to change the "feel" of how the plane flies... |
@aeropic Latching: I will not take care of this now. I still have a conceptual issue. I will try to explain.
So, imagine that the original stick position is currently 1550. So oXs get a PWM value for left Ail of about 1540 (I did not calculate the exact value) The easy way to apply the correction would be just to add (subtract). So the servo would get a value of 1540-300 = 1240us. A more clever way (the one I expect to implement) is more complex and is the following. |
I understand the conceptual issue... |
I looked at the code (not deeply enough for sure) and I have few questions/comments:
So far no other comment... Good start :-) |
In case it helps, there's this code: https://github.com/John-RB/FlightStab It's a replacement firmware for some really simple gyro's (8-bit Atmel MCU's w/MPU6050). It works really well. Even includes firmware for programming boxes that work nicely in the field. Nothing fancy. No stick priorities. Just master gain, individual gains and configuration of wing type (delta, v-tail, std). -zeb |
Thanks for the feedback.
stick_gain will give a % of correction on each axis depending on the position of the stick. |
gyro.cpp : Are ... |
gyro.cpp This part has to be reviewed. |
apply gyro correction YES |
I need to understand what is calibration_wag : same for me ! I am not sure buy I expect it is used during some manual set up. It probably move the servo to confirm that a command/setup has been applied. |
Thanks for the link. |
Thanks @mstrens. Sounds great! If you need guinea pigs, I have a simple tester plane with elevons... -zeb |
Thanks for your answers. |
Yes, for sure it is to get a visual feedback when teaching different axis... |
This give a continuous gain on a range selected by the user (on whole range of the stick, on first 50 % only, on first 25% only) |
I put on Rc groups a proposal on the way to execute the learning process. |
So the bug is probably when I reused the PIO/SM from GPS. So I also presume that there is no issue with the sdk being used. |
Thanks for the info, |
gyro HOLD conceptual question Don't you fear some drift after few seconds of integration? At the opposite the estimated attitude (the one used in camera stab) is computed in the OXS Mahony filter taking into account the 3 gyro rates and the 3 accelero data. The Mahony filter thus recalibrates the initial attitude of the gyro trying to avoid drifts. But with the PID algo based only on gyro rates, I'm afraid all axis will drift? Do I miss something ? |
You are right. I am not sure that it makes sense to ask the gyro to maintain the attitude of the plane as it was when HOLD has been engaged if the sticks have been off center in the meantime. Perhaps I am wrong. I have no experience with gyro. |
From what I understand with the definition you give of HOLD and STABILIZE, both modes share the same equations , the only difference is the setpoint attitude. This is the reason why the RATE mode is much simpler to code and make it work. The gyro only removes the wind and compensates angular rates. When a plane is stabilized, whatever its attitude, the angular rates are equal to zero. For this mode using only gyroX/Y/Z is fine. RQ: I worked in Space business, in satellites we get the same issues. gyros are drifting, we compensate all this inside a big kalman filter which is mixing gyro values and absolute attitude given by star trackers. Star trackers may be unlocked, unable to find the attitude, when the satellite is rotating too fast, during those periods of time, the kalman relies on gyro angular rates to estimate the attitude. When the satellite attitude is quiet, star trackers give again an attitude measure which is used by the Kalman filter to reinitialize the gyros... gyros are good for high frequencies while absolute sensors (acceleros, star trackers) are noisy but good in low frequencies... |
Hello Aeropic, |
Hi Torsen, |
You are using the terminology differently to how most people use it for gyros (plane or FBL), generally Stabilised - means correction of changes of attitudes due to "outside forces" (wind, turbulence etc.) in this case the gyro will generate "corrections" to counter the "outside force", it does not know or care then attitude of the plane or if it is level. This is what AS3X does and how most people fly with gyros - much less set-up needed. This is only using the 3-axis gyro. Auto-level - in this case the gyro will try to return the plane to the attitude that it learned at set-up time (i.e. flat and level) - this uses 6-axis gyros to learn flat and level in the initialisation. This is used mainly by beginners or as a "rescue" if people get badly out of shape. I have heard of many gyros struggling in this mode. Hold - not many gyros have this - it is similar to "Heading Hold" where the gyro will try to keep the plane at the attitude commanded when the last stick input was received (i.e. not necessarily flat and level). These are certainly the way that the different modes are know in HobbyEagle, FrSky, Spektrum and most heli FBL units that I know |
The terminology seems to be used inconsistently, which makes it even more confusing. @Mike-HRC 's description is what sits in my brain too. Some differences I've seen: Stabilised = Normal, Auto-Level, Rate I know the code @mstrens is using has both Rate and Hold modes and I'd be happy with just the Rate mode. |
Thanks for the clarification. This would for sure not be the case in AUTO_LEVEL mode. |
FYI, I put on github test a version 2.9.5 with some more code in order to support a gyro.
To test it you have to connect oXs to a receiver with a wire that provides Rc channels (sbus,, fbus,...) and to a MPU6050 (scl/sda) Note: the learning process has been modified. Please read the file "gyro concepts.md" in the folder "doc" |
I expect it is "normal". If cameraRoll is e.g. +150, the correction must be in one direction and when -150 it must be in the opposite direction. Note: on pitch, I expect some more issue because the pitch value varies only in a range +90/-90°. |
All this will be fun to test in flight... I hope I will not crash my dirty plane before as it is the only one I can sacrifice ! |
I made a few (minor) changes in 2.10.9 version:
|
Humm, not sure the last bullet will help to secure the plane.... In case of panic, the pilot may leave the plane in an extreme attitude, then if he relies on stabilize to recover the situation what would happen ? I fly a parrot disco (autopilot drone flying wing). This bird can be set to full manual using a switch on the TX, I remember some situations with the plane diving towards ground, just switch to autopilot and it does the job whatever initial attitude! |
The issue I see is that roll does not seems reliable when pitch is close to 90°. I do not know how "good" flight controllers (like ardupilot, betaflight,...) works. They are so complex that I do not understand the code. Simple flight controllers seems to have the same issue as oXs about the stabilization. |
I understand... Let's see the inflight results :-) |
Hello Mstrens, |
When you use the command MPUCAL, the MP6050 may not move. |
Hello Mstrens, |
Your mp6050 is perhaps more noisy. |
I set it to: |
I set it to: |
Hello Mstrens, |
Hello Mstrens, can you please set |
It is done in 2.11.4 (500 for ACC, for gyro, I put 200 instead of 100) |
Ok, thank you. |
The goal is to detect if the imu is moving during calibration (and so to reject calibration). |
Hello Martens, |
I do not totally understand your question about averaging voltage conversions. |
Hello Mstrens, |
I think that the issue is more likely not that the fluctuations are very large, but because the value is being updated so often the value is changing many times per second but only by a small amount – for example 12.4v / 12.5v / 12.4v / 12.5 v / 12.4v all within 1 second. It may be that there is another parameter that I can change in my Tx – I haven’t had this with other sensors, but it may be because they are not updating the value as often. Also if I change the resolution from XX.XX to XX.X i.e only show tenths of a volt rather than hundreds of a volt that would resolve it.
I can take a video of it happening if that would help…
Cheers,
Mike
From: mstrens ***@***.***
Sent: 11 December 2023 14:12
To: mstrens/oXs_on_RP2040 ***@***.***>
Cc: Mike-HRC ***@***.***>; Mention ***@***.***>
Subject: Re: [mstrens/oXs_on_RP2040] add gyro functionality (Issue #115)
I do not totally understand your question about averaging voltage conversions.
Currently SUM_COUNT_MAX_VOLTAGE is set to 50.
It means that the voltages (or current/temp) transmitted to the handset are the averages of 50 loops.
In fact in each loop, oXs performs 3 ADC conversions but only summarizes 2 of them.
So the values transmitted to the handset are the averages of 100 ADC conversions.
It is strange that there are lots of fluctuation with 100 conversions.
If you change SUM_COUNT_MAX_VOLTAGE to e.g. 500, then the transmitted values will be the averages of 1000 conversions.
The drawback is that this average will be calculated only once every 2 sec (instead of once every 0.2 sec currently).
—
Reply to this email directly, view it on GitHub<#115 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AO23YKO4CAMVZIIN655NMSLYI4IDZAVCNFSM6AAAAAA6L7WIEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGE3DANRYGE>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
|
In the meantime, in order to get a better Idea of the raw fluctuations (and so to avoid a potential bug in the calculations) I made a version 2.11.5 that should print a line (on the PC) with the index (0=VOLT1, 1,=Volt2,...) the minimum , maximum and average raw adc values. Now that I read your last messages, I expect that there is no bug in oXs but it is just the issue that oXs sending frequency is to high. |
I never said it was a bug. |
That's exactly what I wanted to avoid. |
@Satcomix Changing the transmission/polling time is probably not the best solution because:
If there is a consensus, I can change the parameter to 250 and remove the debug messages I just added. |
I forgot to say that increasing or not the number of loops for averaging does not have an impact on the value for the consumed capacity. |
I was under the assumption that if I encrease the loops, e.g. set V2 Current higher, the calculation of the capacity would be inaccurate because it is calculated from the current. When increasing this value, it is about the time it takes to transmit/display a value and not the time it takes to calculate a value. Otherwise the capacity calculated from the current value would be inaccurate. |
Hello Mstrens, |
AOA (angle of attack) was a request of a member. I do not understand why you got an issue with this sensor ID. |
Hello Mstrens, |
In this issue, I propose to discuss the best way to implement gyro functionality
The text was updated successfully, but these errors were encountered: