With my URCap i need to add in the preamble of a program some customized functions that i’m going to recall in the main program.
I’ve already check the samples (i.e. ScriptFunction) and this is usually done by typing the code, line by line, in the script generation section of the Installation/ProgramNodeContribution.java file (using ScriptWriter methods).
Is there a simpler way to quickly add a already written .script file as input within the generateScript method? I mean a method that allows to read a .script file (previusly loaded in the resources folder), something like the getResource method to load an image.
I’m asking this because i’ve a couple of .script files (hundreds of rows), already tested within an urp program, and adding line by line all the code would be a bit annoying.
I’ve notice that the script code added in the previous way (generateScript method) will appear in the .script file that is autogenerated whenever i save a new urp program with the related URCap package installed.
Is it possible to hide to the user all the URCap-related functions which are going to appear in this file?
If you already have the “complete” URScript code, you could use the appendRaw method to just paste the code as is.
They you would have to read the script code from the desired file in Java, and paste it.
All URScript necessary to execute the program should be contained in the script file generated, as this is the code sent as one single program for execution in by URControl.
PolyScope basically sends the same as is stored in the .script file to URControl for execution. If the script functions are not defined there, the URControl would not know what they mean.
If you are looking to protect your code, e.g. from an IP point of view, I would suggest generating your functions so they e.g. to an XML-RPC call to a daemon, which contains your core code.
XML-RPC is basically another way to create your “own” script codes, which are not covered by the generic URScript language.
I’ve solved the issues regarding the parsing of a .script file.
About the IP protection of the code, using the XML-RPC call to a daemon sounds interesting but i’m not sure if it will be my case.
Some functions that I’ve already defined in the script are sub-part of the main robot program and they contain direct commands to the robot (i.e. movej, movel, activation and deactivation of freedrive,…): is it possible to call such part of the program using the XML-RPC communication?
If not, is there any different way to protect a pre-defined part of the main robot program and hide the related code contained in the .script file?
All script that the robot should execute, should be contained in the script program.
An alternative, would be to send the script program directly over TCP to a client interface, however there is a risk that this might be intercepted by a LAN sniffer.
An option is to use an XML-RPC call to give the next instruction.
Something like:
runThisControlLoop = True
while( runThisControlLoop ):
command = myRPC.get_cmd()
if ( command = 0 ):
# Could be some linear motion
movel(myRPC.get_pose(),...)
elif ( command = 1 ):
# Could be some joint motion
movej(myRPC.get_joints(),...)
elif ( command = 2 ):
# Could be some servoj
servoj(myRPC.get_joints(),...)
elif ( command = 3 ):
# Could be enter freedrive
freedrive_mode()
elif ( command = 4 ):
# Could be exit freedrive
end_freedrive_mode()
elif ( command = x ):
# Could be something else
...
else:
# Exit control loop and do the next thing in program
runThisControlLoop = False
end
end
In this way, the way your code actually generates the next motion and all the clever logic behind this will not be undisclosed. And only the respective waypoints and commands could be intercepted.
Hey, Jacob I have to move robot to five different position like home, park and application specific so if I give input home it will move to home position I have tried using generate script method by getting input from tcp/ip client that was not working so i need to know how this task to be approached like in daemon or else in java itself .I need to know is there possible to use tcp/ip server in daemon for external input and another tcp/ip was for 30002 port for getting robot data simultaneously and if my client send something like home it will move to home postion that was scripted in daemon to urcontroller by 30002 port .can you give me some example and different ways to approach this problem