How configure Until Contact in Move Node

I am creating a template of movements to do the pick of objects detected by a visual camera.
In order to avoid collisions and damage the robot, I want to have some of the movements with an until contact.

I have been able to set the until expression configuration, and the other possible configurations except the until contact configuration.

I don’t find the option in the api reference, so I don’t know if it is not possible to do it through it yet or I should do a different procedure.

Currently I am adding a Until Node as children of the desired waypoint node and then I set the configuration the Until Node.

In the possible Until node configuration, I can’t find the until contact configuration.

1 Like

I add an image of the possible configurations of the api reference, there is another configuration that is not show in the reference ?

I don’t see it on the API guide either. You can try copying the basic shell and replicate its behavior in your CAP.


For example, this basic Direction Until Tool Contact looks like this:

 def calculate_point_to_move_towards(feature, direction, position_distance):
    local posDir=[direction[0], direction[1], direction[2]]
    if (norm(posDir) < 1e-6):
      return get_target_waypoint()
    local direction_vector_normalized=normalize(posDir)
    local displacement_pose=p[direction_vector_normalized[0] * position_distance,direction_vector_normalized[1] * position_distance,direction_vector_normalized[2] * position_distance,0,0,0]
    local wanted_displacement_in_base_frame=pose_sub(pose_trans(feature, displacement_pose), feature)
    return pose_add(get_target_waypoint(), wanted_displacement_in_base_frame)
  while (True):
    $ 1 "Robot Program"
    $ 2 "MoveL"
    $ 3 "Direction: Base Z-"
    global move_thread_flag_3=0
    thread move_thread_3():
      move_thread_flag_3 = 1
      local towardsPos=calculate_point_to_move_towards(p[0.0,0.0,0.0,0.0,0.0,0.0], [0.0,0.0,-1.0], 1000.0)
      movel(towardsPos, a=1.2, v=0.25)
      move_thread_flag_3 = 2
    move_thread_flag_3 = 0
    move_thread_han_3 = run move_thread_3()
    while (True):
      local targetTcpDirection=get_target_tcp_speed()
      local stepsToRetract=tool_contact(direction=targetTcpDirection)
      if (stepsToRetract > 0):
        kill move_thread_han_3
        local backTrackMovement=get_actual_joint_positions_history(stepsToRetract)
        local contactPose=get_forward_kin(backTrackMovement)
        local posDir=[targetTcpDirection[0],targetTcpDirection[1],targetTcpDirection[2]]
        local retractTo=contactPose
        if (norm(posDir) > 1e-6):
          local normalizedPosDir=normalize(posDir)
          local additionalRetraction=p[normalizedPosDir[0] * 0.0, normalizedPosDir[1] * 0.0, normalizedPosDir[2] * 0.0, 0, 0, 0]
          retractTo = pose_sub(contactPose, additionalRetraction)
        movel(retractTo, a=3.0, v=0.1)
        $ 4 "Until (tool_contact_detection)"
        $ 5 "Popup: This is the Action"
        popup("This is the Action", "Message", False, False, blocking=True)

Which is uhhh a fair amount more complicated than I was expecting, to be honest.

Yes, I know I could try to make my own until contact having as reference the script.
But as it’s something that actually it can be done using Polyscope as user, I understand that the most appropriate will be do it through the API and it will be easier to keep the URcap updated to the UR Standards using the API. Otherwise I would have to be checking every version the script generated by Polyscope and update my Until Contact Version.

For these reasons I want to know if there is a way to do it through the API, which I am not seeing or it will be available in future versions.

Until I have a answer, I will change it to until expression force()>Threshold, which has a much similar behavior to the Polyscope Until Contact, but I am not sure that I can do it without damaging the robot. I feel more comfortable using the until contact function, which was designed by UR with this purpose.

good morning @sponsa

I have a “simple” pick and place application. To detect a crash (During the Picking process) I tried to use the “Until Contact function” too. Unfortunally this function is super sensitive. And There is no way to adjust the senitivity of that function.
Therefore it might be neccessary that u have to use the “Expression force()> X”.
At moment I´m using this function too.

I also need this functionality. The customer wants the until node configured as a until tool contact. Any updates on this??

No, I am still stuck here, by now I am using an until expression, with the expression force()> FORCEMAXVALUE.
This is the workaround which works best to me, but I don’t feel comfortable applying it to final product.
I would prefer the until contact, the function mantained by UR with this objective and the users can add.

This is exactly the same that I´m doing.
Cause it seems like there is no chance to adjust the sensitivity of the function “Until contact”.

But that expression force() > 80, is giving me some issues.
In case of a crash (force becomes > 80) I want the Robot to move to a waypoint.
Sometimes, when the Robot detects a crash I can see that the ForceValue is like 200, and the Robot directly stops because
of safety stop.
I´ve no idea why this happens and why the robot will NOT do its task (where i check that force()>80.
Tried to ask this in several posts, but never really got a answer that could explain me this behaviour/ solve that issue.

In a thread I´m checking continuesly for the actual force value and I´m saving the MAXforce Value.
So that i can see always the actual force, the max force as well as the force while i´m checking the expression force()>80.

A force value of > 200, while yes being greater than 80, is also likely greater than the safety parameters. In a situation like that, the safety protocol will always trump other software checks. In my opinion, 80 newtons of force is also crazy high. If you’re zeroing the force torque sensor after picking up a part or whatever, you should be able to detect a reasonable amount of force at like 10 newtons.

As a test, you can insert the force node and set a force of whatever newtons you want. Then you can press the Test button and when you hold freedrive it will apply the force. 80 just seems like a lot, and you’re likely riding a fine line between enough force to be above 80 yet under the safety limits.

As an interesting side note, you can look through the code I originally posted and see that the Until Contact node is not using the force sensor at all. It’s using some pretty sweet logic based on the expected TCP speed. You can’t really do anything with that information, but hopefully that can clear up the question of why there isn’t just a simple way to decrease its sensitivity.