Corentin Posted June 19 Share Posted June 19 Hello, I'm having issues trying to apply a matrix interpolation to my kinematic variables. We are designing a 3-axis robotic arm with a polar coordinate system. Basically, we have 2 15x15 2D matrices measured at the factory that give a radius correction and a Z correction based on current radius and Z, in order to compensate for inaccuracies in axis polynomial definitions and frame deformations. I need to implement these compensation matrices in my kinematics as an addition to my radius and Z. I tried 2 methods which gave me basically the same result : - Using the CompTable by setting virtual motors as sources which are set in inverse and forward kinematics (different CompTable for inverse and forward with the exact same setup/data except sources and target), and using Target motor's CompPos as my interpolated value in my kinematic - Calculating a bilinear interpolation myself in the kinematic (using CfromScript actually but it should not matter) In both cases, the compensation is working. My only remaining issue is the noisy acceleration command that results from this. The "noise" frequency is 1/Coord[1].SegMoveTime so I guess this has to do with the way the PMAC segmentation calculation works. If I disable the matrix correction factors, the acceleration is smooth, so the noise only comes from this. Do you have any suggestions regarding matrix compensation implementation in kinematics that could solve this issue ? I can share screenshots and code snippets tomorrow if necessary. Best regards, Quote Link to comment Share on other sites More sharing options...
MoMo Posted June 20 Share Posted June 20 My personal advice is to refer to the following structure. It is better to write your own interpolation correction in an Kinematic Routine. The CompTable function inside the controller is used to correct the motor position during the servo cycle. The kinematics function is executed ahead of time, so I think your first approach is going to be problematic. Quote Link to comment Share on other sites More sharing options...
Corentin Posted June 20 Author Share Posted June 20 Hello, Thank you for your answer. That's what I thought, using the Comptable with virtual motors inside the kinematic should lead to issues as their result is calculated after the inverse kinematic, so the CompPos I read are from the previous inverse kinematic calculation. What I don't understand is why calculating the matrix interpolation directly in the kinematic leads to the same issue. Here is the code I use in my forward kinematic (Um_fr and Zm_fr being the Radius and Z before compensation) : It's basically the same in my Inverse kinematic with compensation inversed obviously. If I set MATRIX_COMP_ENABLE to 0, no issues. If I set it to 1, I get "noise" at f = (1/Coord[1].SegMoveTime) Hz on CmdAcceleration of all my motors in Coord[1]. Attached is my CfromScript code. I tested it against CompTable calculation and it gives the same result so no issues there. Maybe using a CfromScript mixed with script-based kinematic is an issue ? Or using the same CfromScript call in inverse and forward kinematic ? Also I call my forward kinematic every 10ms in a RTPLC to display live XYZ coordinates. usrcode.c Quote Link to comment Share on other sites More sharing options...
MoMo Posted June 24 Share Posted June 24 I think the noise comes from the data in your compensation table. The data in the compensation table may cause discontinuity in the command velocity. You can try using the pre-filter. Quote Link to comment Share on other sites More sharing options...
Corentin Posted June 24 Author Share Posted June 24 (edited) Thank you for your help once again. I found the issue: I was using the forward kinematic variables as input to my inverse kinematic in the CfromScript function, a simple copy-paste error. I have another question regarding kinematics and acceleration commands: I have two linear axes whose lengths are measured and factored into my kinematics (these are the lengths of each element in my polar system). I don't control them using the kinematics; they are set at startup and remain fixed during motion. However, they slowly drift over the course of the day, and I need to correct for this. If I use the measured variables directly in the kinematics, the movement stops, which is unacceptable for me as maintaining a constant speed is very important. My solution has been to use a slew rate filter with a very slow change rate. This works to account for the change in length and mitigates the slowdown issue, but it introduces noise in the commanded acceleration. Also I can't stop to make this adjustments as the machine often runs at constant speed for hours. Is there a better way to integrate non-commanded axis positions into a kinematic system? Edited June 24 by Corentin Quote Link to comment Share on other sites More sharing options...
MoMo Posted June 24 Share Posted June 24 If your measured value is a kinematic coefficient, suddenly changing it will definitely cause a jump in velocity and acceleration. I think this is a physical law. You can only correct it at a very slow speed, or when the machine is not processing. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.