Universal Robots Forum

How can you use an external button for freedrive mode

Hi,

I searched through the forum and even Google to try to find how I can use a button or a switch to toggle freedrive mode, but I haven’t found anything yet that I can understand well. I would be greatly appreciative if someone could explain how to do this.

Thanks,
Viktor

Installation Node -> I/O setup -> input -> Action -> Freedrive

1 Like

Sorry, that’s not what I meant. I want to create a URCap installation node, in which the user can configure digital I/Os to have specific functions, for example a switch for freedrive, a button to get waypoint… The other option is to have a tab in a program node where these can be set up, but I can’t figure out how to assign freemode to a digital input in Java.

To get this functionality from the Java Side you would need to send the correspondent Script Code via one of the Client Interfaces (30001/2/3) to the robot from within the URCap.

See this answer for reference: Setting Digital input to freedrive through java

I found this answer, but I don’t think I understand it very well.
Can I assign freemode function to an input in an installation node, if so does it permanently change the input, so that a program node can use it? Do I have to do this in the Program node itself? If I run a thread in a Program node, does it always run or does it stop when the program stops? After the freemode button is pushed and release, do I have to restart the threaad, or does it keep working?

Sorry for this many questions, but these are the things that are foggy to me.

I have found a solution, that works for me. I used @Ebbe 's ScriptCommunicator URCap, specifically the proxy class. I wrote the set_standard_digital_in(port, mode) function according to the already written methods, then I could use it to set any digital input to freedrive in my URCap Contribution’s constructor, or later if a user changes the port.

Also, while I’m here, I figured out how to use an external button to do basically anything. To get a waypoint on push, I created an onPush() method, that adds an already configured waypoint to the current move node. This method is called in a Runnable class’ overwritten run() method, which is called in SwingUtilities.InvokeAndWait(runnable). I put this in a Thread and started the monitoring of the button in the constructor of the URCap, but that can be changed too.

Viktor

1 Like