Quote:
Originally Posted by Hypnotoad
I was wondering if anyone ran their pid loops separately from the main code in a different thread so as to get a higher refresh frequency.
|
The WPILIB implementation for java already uses threads for each PID controller. (See PIDCommand). However, the threads still have to lock internally with the Squawk JVM, so that field communication can occur. I don't know that you can improve your sampling rate. Can you clarify why you think you need a higher sampling/control rate? Are you having a stability issue? Your parameter tuning likely needs to be adjusted, but no change to sampling rate should be necessary.
Quote:
Originally Posted by Hypnotoad
I fact, is multithreading even possible on the crio? I know that you can run separate loops in labview but I have read that the context switches eat the CPU. Is it possible in java?
|
The cRIO has a PowerPC processor and does run a real time operating system. So threads do exist for this configuration. Context switching is too low level to consider for FRC robotics -- the overhead is insignificant. This is not the cause of your issues with the PID controller.