Multi-hour debug session

Josh Leverette's picture

Tonight, I started digging deeply into the data coming from my device, trying to get a feel for it, and I realized there was something rather interesting going on. Upon deeper inspection, I found that I had not properly been converting my gyroscopic values to degrees per second, and from there to a raw number of degrees.

Once I fixed that, I encountered a much stranger, and much more troubling issue: the gyro argument being passed in was corrupted, completely. I feared that the communications link to the LSM9DS0 might have been broken, but instrumenting the code one level up in the stack, before this function was called showed that the data was completely valid before being passed into the function, and then garbage once inside the function. It seems that passing a basic integer into the function works, but no attempt has been successful to make a Triple instance retain valuable data, whether it is an argument, a local variable, or a local pointer to a new Triple. It refuses to retain data -- all of the data coming over the serial port is garbage, if it is stored in Triple struct. If I place each value of the triple into a separate, local float variable, the data is retained correctly. The gyro values seem perfectly reasonable, but right now my device claims to be in an uncontrolled spin, according a graph of the Quaternion state data vs time. I believe the ao_quaternion structs are also being corrupted in this one function. If I can get to the root of this issue, I think the output data will be quite valuable, even without the Kalman filter, but I do plan to get the Kalman filter finished as well.


Josh Leverette's picture


It is also notable that I'm largely avoiding manual memory management. I have a vector or two that manage their own memory usage, but I don't think I'm doing anything to start stack smashing, and yet a stack smash would be the most probable explanation I have right now for the symptoms I'm seeing. Investigation is ongoing.