Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Trajectory Generator always starts at 0, never stops

I am trying to implement a simple single axis control based on the example shipped with Softmotion 2.2. Everything is running on a cFP and I am using an absolute wire draw encoder, outputting xx.xxx inch values. My main problem at this point is the trajectory generator. Rather than going to the target position from a current position, it always starts at zero and climbs (until manually stopped). This is after I essentially got rid of the position error limit, otherwise it would just stop immediately if the encoder was not at zero.

Any suggestions?

0 Kudos
Message 1 of 4
(3,564 Views)

The trajectory generator keeps the axes' position in memory and shouldn't jump to 0 position unless you reset the position in your program. Resetting the axis position could be an issue with an absolute encoder. If you do a position reset of the trajectory generator, you also need to reset the encoder position. This works fine for quadrature encoders, but it doesn't work directly for absolute encoders.

 

Please check if your code uses the reset position method. If you can't find the root cause of the issue, please post your code here. If it is too big and/or if you don't want to make it available to the public, please zip it and upload it to ftp://ftp.ni.com/incoming and post the URL to your code here. This directory is a write only directory for the public and the content can't be downloaded outside the NI firewall.

 

Thanks,

Jochen Klier

National Instruments

0 Kudos
Message 2 of 4
(3,543 Views)

I understand the reset issue, but was under the impression that SoftMotion worked with absolute encoders as well (such that the encoder output would not have to be reset to zero for the Traj. Gen. to work). I have tried running with and without a reset on initialization of the Main vi with no affect.

 

Attached is a copy of the VIs - I tried to copy all of the subVIs that I was modifying, so it's a bit of a mess compared to the original. everything is collected in the Project.

0 Kudos
Message 3 of 4
(3,531 Views)

Hi,

 

I'm pretty sure that the issue is caused by resetting the position not correctly. In general after system startup you should read the position of the absolute encoder and reset the position of the trajectory generator not to zero, but to the position value that you have just read. During this process the position controller should be inactive.

In general you should always keep in mind, that the control algorithm calculates the difference between the current feedback position and the setpoint that is generated by the trajectory generator. If you reset the position of the trajectory generator to zero, this means a significant jump in the axis' position from the control algorithm's point of view.

 

I hope that helps,

Jochen

0 Kudos
Message 4 of 4
(3,519 Views)