Move (JOG) along Base or Tool axis

The speedl command is what you’re looking for - you can find it in the URScript manual.

speedl([0,0,0.2,0,0,0],0.5,1)

By default this will drive the robot in the base frame Z direction at the desired speed for 1 second. Beware that when it times out the robot will stop with a nasty jolt, so make sure you follow it with a stopl() command for a nicer deceleration.

For jogging in the tool frame, I calculated a Z offset in the tool frame, then the direction towards that point in the base frame and used that for the speedl command (possibly not the smartest approach, but it works). These 3 lines could be nested together but i’ve separated them for clarity.

For the button push part, put the speedl command inside a loop checking the digital input, with “Check expression continuously” option checked in Polyscope.