currently im working on the integration of an optoforce hex-e force-torque sensor.
I want to use optoforce functions brought with their URCap file.
For example of_move(…), of_search(…), etc…
I tried to call such functions via socket connection but as its not a native URscript command the interpreter can not handle the call. These functions are defined in the preamble of the local script.
One solution to get this working would be to start a program remotely. Is there a possibility to get this working? Any other/ better solution?
Thanks in advance!
Calling a function like
of_move() will only work, if the function is defined within the same context.
That means, that the function should be defined within the same program sequence sent.
This applies to all non-native script functions - i.e. any function not described in the URScript manual.
Hence, sending just one line over a client interface, will not be working, as the URControl process will have no memory of this function, if it is not sent in the same scope.
Hence, you can either start the program remotely using the Dashboard Server or send a complete script code with the function definition.
def myRemoteProgram(): def lightUp(n, t): set_digital_out(n, True) sleep(t) set_digital_out(n, False) end lightUp(0, 2) end
Or simply use the functional code wo. a function definition:
def myRemoteProgram(): set_digital_out(0, True) sleep(2) set_digital_out(0, False) end
we are trying to send a complete script code with function definition and control RG2 gripper. we tried it on 30002 and 30003 and couldn’t get it to work. How do we know that the sent script is received and running on the robot or robot failed to understand the sent script due to an error in the script.
Please find the code to control RG2 gripper below
def RG2(target_width=110, target_force=40):
while get_digital_in(9) == True:
while get_digital_in(9) == False:
Do you have indentations for every line in between the first “def RG():” and the last “end”?
Since it uses time. It should be send to the primary socket.
I am very new to this function creation and sharing,but when opened with notepad++ it has indentation for every def() and end ,
Thank you @Ebbe,
I will try to send the code on 30001 port and check if it works.