PID and Homing with index.

More
8 years 10 months ago #102799 by UAVpilot
Hello,

I have this configuration:
5i25 or 7i92 -> 7i77 -> servo (fast)
At the end of the process homing, the servo drive jerks sharply and sometimes shuts down due to overload. I found out why this happens:
At the signal index-enable (falling to low), the encoder counter pid.x.feedback do reset. However, pid.x.command will only be reset in the next servocycle. As a result, in the current servocycle, pid.x.error becomes
equal pid.x.command and a very large value appears briefly at the output of PID (pid.x.output). A fast servo manages to do it.

Attachment not found



The PID component has a pin pid.x.error-previous-target, which is TRUE by default. If change it to FALSE, the result is slightly improved, but the problem does not resolve.

Attachment not found

Please Log in to join the conversation.

More
8 years 10 months ago #102800 by UAVpilot
Replied by UAVpilot on topic PID and Homing with index.
I made a small patch for pid.c, which seems to completely solve this problem:
Code:
--- pid.c.orig 2017-11-25 04:26:15.000000000 +0300 +++ pid.c 2017-12-09 01:36:06.645777032 +0300 @@ -325,6 +325,8 @@ } else { tmp1 = command - feedback; } + if(pid->prev_ie && !*(pid->index_enable)) + tmp1 = 0; /* store error to error pin */ *(pid->error) = tmp1; /* apply error limits */

Results:

Attachment not found



Attachment not found

Please Log in to join the conversation.

More
8 years 10 months ago #102801 by Todd Zuercher
Do you only have a servo thread?

I have this same problem on a machine that is running a servo thread and a floatingpoint base thread, For me the problem goes away If I run only a single thread. Also if I try to home the machine again after the error, it does not do it because the encoder offset was zeroed with the first failed attempt. (I only get the error after closing and restarting Linuxcnc.)

Please Log in to join the conversation.

More
8 years 10 months ago #102804 by UAVpilot
Replied by UAVpilot on topic PID and Homing with index.
Yes, only servo thread.

Stable way to reproduce the problem:
1. Move the axis (mechanically) to a distance of 30mm or more from the home switch.
2. Start LinuxCNC.
3. Start the homing procedure.

Please Log in to join the conversation.

More
8 years 10 months ago #102807 by Todd Zuercher
Do you have pid.N.index-enable connected?

Please Log in to join the conversation.

More
8 years 10 months ago #102808 by PCW
Replied by PCW on topic PID and Homing with index.
If pid.N.index-enable is connected and you still get this issue it may be a thread order problem

Can you post your hal/ini files?

Please Log in to join the conversation.

More
8 years 10 months ago #102817 by UAVpilot
Replied by UAVpilot on topic PID and Homing with index.
index-enable connected.
hm2_7i92.0.encoder.00.index-enable <=> pid.x.index-enable <=> axis.0.index-enable

INI & HAL, inessential removed:
Warning: Spoiler!


I tried to change the order of the components in the thread - the result does not change. As expected.
Code:
... addf pid.x.do-pid-calcs servo-thread ... addf motion-command-handler servo-thread addf motion-controller servo-thread ...

Please Log in to join the conversation.

More
8 years 10 months ago #102823 by PCW
Replied by PCW on topic PID and Homing with index.
Thread order is wrong, it should be:
hardware read
everything else
hardware write

Please Log in to join the conversation.

More
8 years 10 months ago #102851 by UAVpilot
Replied by UAVpilot on topic PID and Homing with index.
So?
Code:
loadrt hostmot2 loadrt [HOSTMOT2]DRIVER0 board_ip=[HOSTMOT2]BOARD0IP config=" num_encoders=6 num_pwmgens=0 num_stepgens=0 sserial_port_0=000xxx" addf hm2_7i92.0.read servo-thread loadrt trivkins loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES addf motion-command-handler servo-thread addf motion-controller servo-thread loadrt pid names=pid.x,pid.z,pid.s addf pid.x.do-pid-calcs servo-thread addf pid.z.do-pid-calcs servo-thread addf pid.s.do-pid-calcs servo-thread .... addf hm2_7i92.0.write servo-thread

I tried it. As expected, the problem remained.

I noticed that on the given oscillograms I was mistaken in the designation of cycles: The inscription "Cycle N + 1" should be read as "Cycle N + 2". Below is the correct picture. Sorry.

Attachment not found



My patch causes the PID to skip the cycle N+1

Please Log in to join the conversation.

More
8 years 10 months ago #102852 by PCW
Replied by PCW on topic PID and Homing with index.
I suspect there's still a hal file issue of some kind as this is not a common problem with home to index

The feedback position should change at the same time as and the commanded position. If not
that still suggests a thread order or HAL connection problem

Can you post your complete hal and ini files?

Please Log in to join the conversation.

Time to create page: 0.065 seconds
Powered by Kunena Forum