Universal Robots Forum

Open and close the freedrive switch while the program is running

Hello everybody,

I added a button as a digital input in order to trigger the freedrive mode.
When the button is on, the operator can move the UR3 robot with both hands freely and when it’s off, the robot is blocked.

But when a program is running the button doesnt work anymore.

What I’m looking for is to be able to put the button on while the program is running.

I mean when the robot is at the Waypoint_1 (for example) the program displays a pop-up message that inform the operator that he cans now open the button and move the Robot as he wants.
When the operator click on the pop up, the Robot move to the Waypoint_2 ect…

Program
Move L
Waypoint_1
Pop-up : “You can move the robot freely now”
Waypoint_2

Is there a way to solve this ?

Best regards,

That’s an interesting request. Seems like it would be a conflict of interest but I’m still a n00b and don’t know what I’m talking about. :rofl:

What is your process that it would require the operator to move the arm? (If you don’t mind my asking. :slight_smile: )

1 Like

Hello,

We are using a UR3 as a third arm helping the operator in the assembly of a product.
The robot fully supports the weight of the product while the operator is integrating and screwing sub-assemblies.

The robot is here in order to assist the operator in his working methods by indicating to him how should he go about assembling. The robot goes from waypoint_1 to waypoint_2 whenever the operator finish to screw a sub-assemblies at a special location on the product.

The robot is a kind of instruction monitor and a support arm.

If the position and orientation of the robot at the waypoint_1 doesn’t totally satisfy the operator, then he can change the orientation simply by pushing the button in ON mode and then the operator can push the OFF mode when he finished modifying slithly the initial orientation. He works on the product and when he clicks on the pop up the robot therefore continues to the waypoint_2 and indicates to the operator how he should screw another type of sub-assembly …ect

I’m not sure if I was clear but this is the idea of the process.

How do you think about it ?

I’m really interested to know if there is a solution or not… haha

1 Like

You can look at using the “freedrive_mode” script call to set the robot into freedrive mode and the corresponding “end_freedrive_mode” call to stop it. You can look at the URScript manual for understanding both of these functions.

In your case you could possible set up a thread that watches the digital input for enable/disabling the freedrive mode.

Thanks for your reply but I already tried the function freedrive_mode() but the problem is that the operator cannot make the cobot free or blocked at anytime of the program.

I want the operator to choose the moment when (and where on the program) he wants to change the initial orientation (given by the program) or to block the new orientation he gave to the robot.

What do you mean by a thread that watches digital input ?
I already have a button connected to the cobot that enable/disable the freedrive mode but as I said before, it works only if the program is not running. If the program is running then the button do not work unfortunately…

Like I said, I believe Freedrive during Operation would be a conflict of interest.

Only thing I can think of is to use a Select Case scenario that uses User Input for the selection.

Call the Case after the first waypoint and it will stop and wait for User to select a case.

You can set the cases as such:

Case 1: no action
Case 2: Direction X+ Until Contact (user can touch robot to make it stop) or Until Distance (user defined distance to move)
Case 3: Direction Y+ Until Contact (user can touch robot to make it stop) or Until Distance (user defined distance to move)
Case 4: Direction X- Until Contact (user can touch robot to make it stop) or Until Distance (user defined distance to move)
Case 5: Direction Y- Until Contact (user can touch robot to make it stop) or Until Distance (user defined distance to move)

Hope this helps.

1 Like

I think he means turn off your mapping of the button to freedrive, and instead use logic in the program to read the button state and apply the script function while the button is pressed.

Something like this might work, you’d probably need some debounce and timeout logic.

popup("Hey, hold the button and move the robot bud, you get one shot")
FREEDRIVE = True
while FREEDRIVE
    if digital_input == HIGH:
        freedrive_mode()
   else:
        end_freedrive_mode()
        FREEDRIVE = False

myPose = get_actual_tcp_pose()
doStuff()


    
1 Like

@terryc was right on what i meant. You can either use a variable or the Digital_input to enable or disable the freedrive_mode and the reason I suggested using a thread is because I am figuring you are pausing the main program with the popup. A thread will continue running while the popup is active so it can continue monitoring and changing the Freedrive mode.

For instance if you wanted to use a variable you could do in the main program

MoveL
Waypoint_1
your_variable = True
popup: "Freely move robot"
your_variable = False
Waypoint_2

and the thread would be

while(True)
    if(your_variable):
        freedrive_mode()
    else:
        end_freeedrive_mode()
    end:
    sync()
end:

Or you can also use the digital_input signal instead of the “your_variable” here. The sync() should always be used so it uses up the remaining “physical” time of the thread. If you dont use one in this situation you would run into an error.