Found a minor bug in v4 Classes/CNMEA.cs

I can report this on github but this might be just as fast. I was trying to track down why my C++ port was driving differently than AOG. Was affecting both my turning rate and also my lookahead values. Turns out that I had the setting isRollFromAutoSteer enabled, but of course I didn’t have any roll values coming in from the simulator so the roll in ahrs.rollX16 was set to 9999.

But in the code I translated from Classes/CNMEA.cs, line 229 (in UpdateNorthingEast()), I noticed that the if statement does not check to see that ahrs.rollX16 is != 9999. Hence my code was getting a really wonky roll angle. After adding that check (similar to the code in OpenGL.Designer.cs that draws the roll bar), things seemed to work a lot better, and more like AOG (unless of course you turn on roll from autosteer while using the sim).

Hope this makes sense. I can put together a pull request for AOG if you want me to.

So is it a bug, or is the problem you set a setting that you should not have and weren’t using?

I’d say it’s a bug. No matter what the source of the roll is, if it’s the 9999 value (meaning it’s not currently valid) it shouldn’t be used. That’s the logic used in the DrawRollBar method in OpenGL.Designer.cs anyway.

Right now you can enable roll from any source in AOG but if there no valid roll coming in at that moment, there 9999 becomes an actual roll value that’s erroneously compensated for. In real life outside the simulator this condition may or may not happen. Either way making the if statement the same as the one in DrawRollbar seems like a good idea to me.

not everything sets it to 9999. if you are not using a roll source, turn it off

Ahh. Fair enough.

9999 was used for the arduino a long time ago, but now everything from udp imu to dual antenna provides roll