CurryKitten / CurryKitten-Sim

FPV quad simulator
70 stars 7 forks source link

Add Angle & Horizon flight modes (reluctantly) #35

Closed CurryKitten closed 4 years ago

CurryKitten commented 4 years ago

One thing that came out of testing the LOS feature #13 is that it wasn't very easy to fly Acro in LOS. It probably is for some people, but despite me flying lots of quads for the last 8 years or so, I've never liked LOS flying so never bothered to really knuckle down and learn how to do it with my normal Acro rates.

What I do IRL is fly in Angle (mainly) in LOS just to make sure everything is looking good before I fly FPV. Although I have self-levelling modes with a passion when it comes to outside FPV, it only seems fair to add these options in for beginners who just can't get to grips with acro straight away (or are like me and are crap at LOS acro)

CurryKitten commented 4 years ago

I was going great guns on this, it appeared to be a case of seeing if we had an stick input, and if we didn't capturing the current x/z angles and then producing phantom stick input to represent us moving back to level.

I did the pitch first - and had no issues, but then when I implemented the roll side of the equation, the roll self level seemed fine, but all hell broke loose as soon as I went past around 100 degrees in the picth axis. I took me a little while to figure out why, but the reason is gimbal lock. Which is explained quite well in this video https://www.youtube.com/watch?v=zc8b2Jo7mno

I started off using Quaternions to work out the angle but found that this didn't translate easy to human readable figures, so converted to eulerangles. It seems going past that magical point aligns two of the gimbal axis and the angle changes on both z and x, causing the self level to kick in where we don't want it to. Eseentially I can slowly pitch forwards to a point whereroll just constantly kicks in and I'm forever spinning in circles.

I'm not sure how to fix it yet, but I did at least manage to get angle mode working, and I'm fairly happy that it's easy to fly los just pitching forward and yawing around.

CurryKitten commented 4 years ago

After some thought, I've decided Horizon is something I don't see the point in right now. I'll accept that angle is a useful mode for an emergency situation, but I don't see the value in horizon mode, so I'm going to close this issue off for now unless someone can give me a more compelling reason why it should stay.