Variable Waypoint using both Tool Position and Joint Position

Hai @francis ,Sorry to say that I only understood your question partially, I assume that you are using the URCaps SDK for developing the program. So can actually make that is what I think. To put it as a rough sketch you can actually create two variables GlobalVariable_p, GlobalVariable_q with dummy values and assign the proper values once you wish to assign it using a getter , setter function calls.

To get the joint position you can verify this JointPositions (api 1.3.0 API),

To move the robot by actually generating and executing a urscript using the SDK as shown shown here:- com.ur.urcap.api.domain.script (api 1.3.0 API)