Is there any way to set up a digital input as your freedrive function through Java, or does it have to be a socket script command that is sent every time that input is on? I know you can manually configure through the I/O setup on the pendant, but I would like to be have this automatically configured by the Cap if possible.
I apologize if what I wrote above wasn’t clear enough, I have attached the document to reassign the input through the robot. I was wondering if you could do the exact same reassignment through the cap. Redefine UR Tool IO for free drive plus other options.pdf (603.1 KB)
You can from a daemon or thread monitor an input, and given this input toggles to a defined state, you can send a program to the controller that instructs the robot to stay in freedrive mode, such as:
def start_freedrive():
freedrive_mode()
while(True):
sync()
end
end
Since freedrive would be terminated, as soon as the program would stop, you cannot just send a single line, in which case the robot would only be in freedrive for a few milliseconds.
When the button is released, you need to terminate this program, e.g. by sending halt or end_freedrive_mode()
Thank you for the reply as I had that exact issue of the robot entering freedrive for only milliseconds. However, before I set up my daemon I am currently testing my function by monitoring the input through java and sending the function through the realtime client, and the robot is not behaving any differently. It is a very simple function so I am not sure what I am doing wrong? Is there a reason why you cannot send a while loop through the socket? The output I am getting from the command I send through the socket is below. Please advise
def myCustomCode():
while get_tool_digital_in(1) == True:
freedrive_mode()
sync()
end
end
To get proper formatting you need to have 4 spaces in the beginning of the line and have one empty line between code and previous paragraph.
To get also syntax coloring, write your code between 2 lines with triple ticks: ```. Then you don’t have to do indentation and free lines.
Yes I am sure its tool input 1, I actually looped the function i was sending through java so that I could feel the little jolts of freedrive, so it is going into freedrive, I just haven’t been able to get it to stay in freedrive yet. My end_freedrive_mode function is sending properly, so I just need to figure out how to make my while loop function. I will try what you said in the first part of your reply to start, and just see if I can get it to work by changing around my function and indentation a bit.
We have an integrator that was looking into doing the same thing.
Just for info for other people with similar problems:
One thing that gave us trouble was the character encoding that, it was not UTF, so it was not reading \n as we expected it.
Anyhow, for troubleshooting, a simple solution to test is to send it on the primary or secondary interface, this example with a popup instead of a input:
Locally on the robot: printf 'def test(): \n freedrive_mode() \n popup("test") \n while(1): \n sync() \n end \nend \n' | nc -q 0 127.0.0.1 30002
-q 0 flag on nc is to close the connection straight after sending.
or remote from a terminal with telnet echo -e 'def test(): \n freedrive_mode() \n popup("test", blocking=True) \n end_freedrive_mode() \nend \n' | telnet IP_ADRESS_OF_ROBOT 30002
-e flag on echo is the same output as printf and this is without the while loop, so the blocking will keep the programs from running further, til popup is closed…