acarder Posted March 17, 2014 Posted March 17, 2014 I have a set of kinematics that is setup to have two modes. In mode 1 (P1338 = 2), I have a complicated relationship where I am not able to determine the commanded position based on the axis positions, so I use the last commanded position in the forward kinematics. In mode 2 (P1338 = 3), the kinematics are linear, but I use the motors current position to calculate the Q vars since these axes are always absolute. Here is the problem: When I start a program in the mode 1 of my kinematics and try to switch over to mode 2, I never get the right starting point when I start commanding the axes. I switch the mode with a p variable, issue a pmatch surrounded by dwells, and then command the axes to go to zero. If I have been in mode 1 and the axes are not at zero to begin with, then the machine does not go to zero. If I am using the actual axis positions to generate the starting commands (Q Vars) in forward kinematics and I issue a pmatch, what could possibly affect the kinematics? It seems as though a hidden command from the last kinematic mode is affecting the outcome. I have already checked my position bias (Mx64) and compensation correction (Mx69). If I run my routine when my last program was ran in my mode 2 kinematics, everything works great. Inverse Kinematics: IF(P1338 =2) CalculationA = Complicated relationship depending on commanded A/B and direction machine is heading CalculationB = Complicated relationship depending on commanded A/B and direction machine is heading P5 = CalculationA*Scale P6 = CalculationB*Scale ENDIF IF(P1338 = 3) P5 = Q1*Scale P5 = Q2*Scale ENDIF Forward Kinematics: IF(P1338 =2) ;Since my machine is not moving at the time forward kinematics are ran, I cannot know what command caused the current position, so I use the last commanded P5 and P6 Q1 = P5/Scale Q2 = P6/Scale ENDIF IF(P1338 = 3) ;I can't seem to trust the last commanded, so I use the current position as my start (my A/B axes are always absolute) Q1 = M562/(32*I508)/Scale Q2 = M662/(32*I608)/Scale ENDIF My routine to zero out some axes if I start in mode 1 (P1338 = 2) kinematics... DWELL20 P1338 = 3 ;Switch to direct command of A/B axes DWELL20 COMMAND "PMATCH" DWELL20 ABS RAPID A0 B0 DWELL1000 P1338 = 2 ;Switch to complicated kinematics DWELL20 COMMAND "PMATCH" DWELL20 Any insight would be very useful, Thanks Adam
curtwilson Posted March 18, 2014 Posted March 18, 2014 I can't figure out what is going on here. The PMAC simply takes the motor commanded position register (Mxx61) with any applicable offsets as the input to the forward kinematics. It should only differ from the Mxx62 value you use by the following error, and it is better to use the commanded position for this. It should not matter how your motors got to their present position - all that matters is where they are.
Richard Naddaf Posted March 18, 2014 Posted March 18, 2014 You have a typo in this loop: IF(P1338 = 3) P5 = Q1*Scale P5 = Q2*Scale ENDIF The 3rd line should be P6, not P5.
Recommended Posts