I would agree, printing the data in a csv format would be rather easy to plug into excel. It’s short sweet and simple.
Don’t worry about my post. I link things for completeness. I’ve found that learning to program is one of those one foot in front of the other type things at first (even for me).
You have a simple problem and you now have a simple solution to that problem. I’d go grab the data and throw it into excel, and I’d be happy that in the end I/you are going to get the PID loop tuned like you need (sorry for the tense change there).
The Cortex is 90 MIPS, or 90 million instructions per second. To put this into perspective, the MSL rover known as Curiosity has only about 400 MIPS of computational power. That is to say, it has about the computing power of four VEX Cortex’s.
So in one way the Cortex is weak, I mean that phone in your pocket can dance circles around it, but in another way, that Cortex could probably run the critical systems on a billion dollar robot currently functioning on Mars (and arguably the best robot ever built by mankind).
I’ve never managed to properly stress a Cortex. You’d have to run some pretty nasty algorithms in order to really max one. Something like a sort operation on a large list or image processing, etc.
In terms of ops, there are plenty. It’s more time that’s a concern. You have to understand that time stuck waiting for something to finish is basically wasted CPU time. It’s known as blocking, which I don’t want to get into right now because I’m tired.
Anywho, the wait() / delay() / sleep() functions are kind of a neat way of telling the OS that whatever code you have running can safely be suspended for X ms. The OS can then run other “tasks” or pseudo “threads” while the code is effectively snoozing.
So a good way of writing, say multiple PID loops might be to run each of them in their own task, and to make sure that they all sleep for at least 1ms every iteration.
1ms is actually a lot of time for a processor. In fact in 1ms (or 1/1000 of a second), the Cortex can do 90,000,000 (90 million) / 1,000 things. That’s 90,000 operations. While one line of code may end up being possibly MANY ops, it’s still a lot of things.
Generally speaking, code that updates motors ONLY can safely be run every 20ms, because motors can only be updated once every 20ms anyway, so there’s no point in updating them more often but for your PID code, it’s worth checking those sensor values as finely as possible so I would go ahead and run those at 1ms, just keep the code simple that’s all.