Hi everybody,
I’m working with KUKA Sim Pro 3.1 and try to calculate process speed for one statement. It means that I need sample the position while the simulation is running. I use interpolator to realize this function, the main structure as follow:
app = getApplication() routine = app.TeachContext.ActiveRoutine controller = routine.Program.Executor.Controller times = [] sampleTime = 0.5 t = 0 sampleTargets = [] interpolator = controller.createMotionInterpolator() #targets are vcMotionTarget which are get from statements in scope interpolator.Targets = targets for i in range(len(targets)): cycletime = interpolator.getCycleTimeAtTarget(i) times.append(cycletime) #endfor while t < cycletime sampleTarget = interpolator.interpolate(t) sampleTargets.append(sampleTarget) t += sampleTime #endwhile
when I run this python, the method “interpolator.interpolate(t)” can only run once when t is zero, then the program will crash. And the “sampleTarget” I got is strange. it has no value of “JointValues” and many other properties.
Could you help me check for error?
As I known, Sim pro 3.1 add RCS module in KUKA robot controller. Is it the reason why the method “interpolator.interpolate(t)” can’t use? (I test same program in SimPro 3.0.5, it works good)
For Sim Pro 3.1 and KUKA robot, is there any other way obtain the process position?