Page 1 of 1

pick and toss robot

Posted: 30 Mar 2023, 10:30
by Potato22
Hi,I am trying to build a pick and toss robot,I want the UR5 to release its claws when throwing an object forward, so that the object has a forward acceleration.
But I don't know how to lift the mechanical arm and release the claws at the same time.Is there any relevant demo or function to solve my problem? I would really appreciate it if anyone could answer my question.

Re: pick and toss robot

Posted: 31 Mar 2023, 12:13
by fferri
There are no particular provisions to achieve that. You only need a good grasping (or fake it with sim.setObjectParent), a sufficient joint maximum velocity, and a good timing.
For a good timing, you can wait e.g. the robot tip to reach a particular position:

Code: Select all

function sysCall_init()
    ...
    corout=coroutine.create(function()
        local function waitTipZ(v,k)
            while true do
                local tipPos=sim.getObjectPosition(tip,-1)
                if k*tipPos[3]>k*v then break end
                sim.switchThread()
            end
        end
        setConfig(robotInPickPosition)
        waitTipZ(0.05,-1)
        grip(true)
        setConfig(robotInUpPosition)
        waitTipZ(0.8,1)
        grip(false)
    end)
end

function sysCall_actuation()
    if coroutine.status(corout)~='dead' then
        local ok,errorMsg=coroutine.resume(corout)
        if errorMsg then
            error(debug.traceback(corout,errorMsg),2)
        end
    end
end
where setConfig and grip are two simple functions to set the robot's joints' target positions and to control the gripper respectively.