Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

softmotion trajectory velocity seems incorrect

What am I doing incorrect here?  I have been having a real problem getting the trajectory generator to behave as it should.  In order to trouble shoot this problem, I made a simple FPGA vi that is simply an IRQ, which sets the host loop rate.  The rest pretty much follows shipped examples.  I have a timer which times the completion of a straight line move.  This time is both inaccurate as well as imprecise.  Can someone look at my code and tell me if there is something wrong with it?
Bscout
PS I've also tried using a timed loop with no real improvement
0 Kudos
Message 1 of 3
(4,672 Views)

oops, I guess the timed loop does work properly, but not the IRQ method.  This is the method used in the Softmotion Position Control example.

I thought that the FPGA timing would be very stable and accurate??

Bscout

0 Kudos
Message 2 of 3
(4,665 Views)
Hi Bscout,

I took a look at your code, and the first thing that occurs to me is that there is no target loop phase offset.  You need this to mitigate errors caused by real-time jitter.  You should take a look at (and run if you get a chance) the example code StepperGeneration.  In the realtime code associated with that project, the start of the Target Loop is offset by ((Host Loop Rate / 2) + RT response time).

Because your code lacks this, it is likely that RT jitter is causing the loop rate to appear to be inaccurate.

Let me know if this helps!

Regards,
Brandon M.
Applications Engineer
National Instruments
0 Kudos
Message 3 of 3
(4,168 Views)