pick and toss robot

Typically: "How do I... ", "How can I... " questions
Post Reply
Potato22
Posts: 1
Joined: 29 Mar 2023, 07:27

pick and toss robot

Post 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.

fferri
Posts: 1193
Joined: 09 Sep 2013, 19:28

Re: pick and toss robot

Post 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.

Post Reply