Running Swerve Drive with Labview

Hi, i am wondering how other teams code for swerve drive in labview is preforming from a timing standpoint, when using the elapsed time vi. i’ve tried shaving off time as much as possible but i get a fluctuating elapsed time of around 40-120ms per iteration while running in interactive mode with the roborio. Some trials that seemed to have worked to shave off time has been to run parallel loops for each drive module calculation, separating drive and steering module vis. and increasing timed loops but these seem minisqual in timing changes.
There maybe two paths to take 1) command and control and see what happens there but that looks like a nightmare in disguise. 2) using something else to do the calculations like a hero board and piping the values back to roborio.
Maybe the hole timing thing isn’t an issue because i am using the interactive mode and that is what is screwing me up.
Just a side question which maybe related, how much of the code actually goes to the FPGA on the roborio ? do you have to specifically code inside the FPGA to use it or will the compiler send sections to the FPGA as neede?
If i need to put calculations in the FPGA that would defiantly speed everything up but, but calculations are limited on the FPGA core?

  1. You will greatly increase your chances of getting fast accurate responses if you post your code.

  2. How are you measuring this 40-to-120ms per iteration?

  3. You can’t “code inside the FPGA”. At least, not the way you seem to be thinking.

  4. Look at this document. How does your computation compare to that?

Let me say kudos to team 2067 apple pi for whoms code this is based off of and which i have altered.
After i posted i did some research and found that they did lock the FPGA out for teams to use (disappointing ):frowning:
For measuring the timing i placed the elapsed time into each timed loop


this way i can monitor the time that each loop takes to complete its operation via the elapsed timing vi.

first vi is the calculations for inputs from the joystick which outputs swerve calculation array this is the vi that is in the first loop (timing is consistent and short on this loop )

in this call i send the swerve calculation array parameters to parallel interacted loops to run the calculations for each steering module and another parallel iterated loop to send to the drive motors. (Note this is the second loop in the first attachment)

this is the loop that is called in the previous vi that calculated the steering parameters

Hopefully i put the right image to each note











Well i think i fixed the issue; im down to 60 ms or so. this was found during trouble shooting the timing issue and was found by separating the code out as in the first image in the post above, the first timed loop at 50ms was taking the input parameters calculating the parameters and putting the values into global variables. The other routine should have no dependence on the other routine because the values to the drive routine are only reading global variables, BUT this is not the case since the two loops were at different timing parameters this is why the timing was fluctuating between 50 to 130 ms one loop iteration would be synced the other loop iteration would not and would wait for the other loop to complete and cause the timing to jump to 130 ms (hence the 80ms and 50ms loops). This is really confusing me, but is this due to the programming environment of the roborio and using the lab view iterative environment, and where we are not truly separating threads and making parallel operations and is actually running a sequential opeartion. Is Command and control the only way to to truly separate threads and run parallel operations?? Thank you Euler for at least giving me a different aspect to look into.