Nudge Example

HMI Panel File

Robot Program File

# Robot functions file
force_threshold = 50
force_z = 0
status = "WAITING NUDGE"

# nudge function
def wait_nudge():
    sleep(1)
    f = get_tcp_force()
    while norm(f[2]) < force_threshold:
        sleep(0.2)
        f = get_tcp_force()
    end
end

thread update_force():
    while True:
        force_z = get_tcp_force()[2]
        sync()
    end
end

run update_force()
# Robot task file
status = "WAITING NUDGE"
wait_nudge()
status = "NUDGE DETECTED!"

# counter
global i = 0
while i < 3:
    # pick
    movej([1.56, -1.86, 2.29, -2.00, -1.57, -0.01], r=0.03)
    movel(p[0.107, -0.331, 0.100, 0.00, 3.14, -0.00])
    movel(p[0.107, -0.331, 0.25, 0.00, 3.14, -0.00], r=0.03)

    # place
    movej([1.56, -1.40, 1.87, -2.04, -1.57, -0.01], r=0.03)
    movel(p[0.107, -0.517, 0.100, -0.00, 3.14, 0.00])
    movel(p[0.107, -0.517, 0.2500, -0.00, 3.14, 0.00], r=0.03)

    i = i + 1
end

Last updated