Weird issues solved

Josh Leverette's picture

After a lot of investigation, I found that the problems were indeed the fault of my code. Really, it was a result of too-similarly named types. Triple is a struct of shorts, and Triple_F is a struct of floats. In the update_Qstate function I was using a Triple when I meant to use a Triple_F, which explains some of the problems I had been having, but not all of them. I still don't know how the argument was being corrupted, but I can confirm that the g++ on my x86 Chromebook is definitely generating a different binary than the g++ running on my Raspberry Pi 2. Admittedly, they are different versions, so that's more or less to be expected, but I haven't had any issues with argument corruption since switching to my Chromebook.

Interestingly enough, the compiler never warned me about storing float values into shorts, even though I have -Wall on, until I started doing it in the initializer for the struct.. an interesting effect of automatic type coercion. I look forward to using Rust more in the future, where mistakes like this one cannot happen.

As part of this week's documentation, I've been characterizing the behavior of different pieces of my code so I can explain how well each part works, which means collecting tens of thousands of data points from various places in the code, running comparable computations in Python on my computer and comparing the answers, along with plotting how each variable is changing over time in order to see the bigger picture. Even though I double checked my quaternion math against the references I've found, I'm not entirely happy with the results I'm getting there. I believe the issue is that I could be using the wrong units (degrees vs radians), but I just decided that is likely as I was writing this post, so I haven't tested it.