UPDATE:
After finding out what was missing in the code I managed to run into a more fundamental problem. Apparently $GEAR_JERK is write-protected when the subprogram is called (as can be seen in image below in German). I have no idea why it should be write-protected, since I specifically didn't access $GEAR_JERK_C which I know is write-protected. Does anyone know how to circumvent this or is the only option to use a constant jerk limit for the whole SPTP motion?
In other news, if anyone ever wants to do something similar, I needed to fix a couple of mistakes in the code and now it works with acceleration & velocity constraints at least. Turns out spline motions are a bit finnicky in what parameters they expect.
- TRIGGER WHEN always needs either the DISTANCE or PATH argument. Keep in mind that DISTANCE doesn't work with SPTP. The DELAY is applied relative to the position determined by either of these (see documentation).
- If the trigger calls a subprogram you also need to insert PRIO, where a value of -1 lets the operating software schedule the priority of the subprogram call.
- Both $ACC_AXIS as well as $VEL_AXIS understandably expect values of at least 0.1 or greater but my python script that created the motion profile starts with zero acceleration. Not a big deal but I suggest to set a reasonable minimum value in your scripts from the get-go.
Code
DEF Approach4()
...
PTP {A1 0.00000,A2 -90.00000,A3 90.00000,A4 0.00000,A5 90.00000,A6 -0.00000,E1 0.00000}
PTP SP1 C_PTP
ChangeKinematics(7, 36, 100)
PTP_SPLINE
TRIGGER WHEN PATH=0 ONSTART DELAY = 10 DO ChangeKinematics(1, 1, 100) PRIO=-1
TRIGGER WHEN PATH=0 ONSTART DELAY = 500 DO ChangeKinematics(100, 100, 100) PRIO=-1
TRIGGER WHEN PATH=0 DELAY = -100 DO ChangeKinematics(7, 36, 100) PRIO=-1
SPTP SP2
ENDSPLINE
END
DEF ChangeKinematics(jrk:IN, acc:IN, vel:IN)
DECL INT ax
DECL INT jrk
DECL INT acc
DECL INT vel
FOR ax = 1 TO 6 STEP 1
;$GEAR_JERK = jrk
$ACC_AXIS[ax] = acc
$VEL_AXIS[ax] = vel
ENDFOR
END
Display More