Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Attach an object / Python Script


Can you tell me if we have access to the same hand configuration parameters, from graphical mode to python programming

I encounter a problem in taking an object in python programming that I do not encounter in object mode.

Thank you in advance
Ned C.

def TCP_On(toolitem):
    """Attaches the closest object to the toolitem Htool pose,
    It will also output appropriate function calls on the generated robot program (call to TCP_On)"""
    toolitem.RDK().RunMessage('Set air valve on')

while i < nparts:
    # ----------- place the box i on the convegor ------
    # approach to the conveyor
    target_conv_pose = target_conv.Pose()*transl(0,0,-SIZE_BOX_Z/2)
    target_conv_app = target_conv_pose*transl(0,0,-APPROACH)
    TCP_On(tool) # detach an place the object in the moving reference frame of the conveyor

    # ----------- take a part from the conveyor ------
    # get the xyz position of part i
    part_position_i = parts_positions[i]
    target_i = transl(part_position_i)*rotx(pi)
    target_i_app = target_i * transl(0,0,-(APPROACH+SIZE_BOX_Z))    
    # approach to the pallet
    # get the box i
    TCP_Off(tool, frame_pallet) # attach the closest part
    i = i + 1
Hi Ned, 

I think this is what you are looking for:


Take a look at this link to our API documentation.

You will also need:
and this:

Here's the link.

Hope it helps. 
Have a great day.
Hi Jeremy

Thank you but no the problem is still the same, attached is the video the problem video.

Thank for your support

Lien du téléchargement
Hi Need,

Could you attach your RoboDK station, I'll take a quick look.

Hi Jeremy
Attached is the project
Ned C.

Attached Files
.rdk   PPkM1v0.7.rdk (Size: 3.39 MB / Downloads: 7,784)
Bonjour Ned, 

Ok, I figured out your problem.
It will be easy to fix. 

Right now you are not able to pick the part because the distance between the TCP and the Object Reference is higher than the default setting. 
The default setting is 200 mm. 
The distance is shown in the picture below. 

You can see the object reference by right-clicking the object and selecting "Visible Object Reference". 

Know you can fix that issue in three different ways. 

1 - Modify the position of the object reference. 
To do so, you can either hold "Alt + Shift" and move the object reference manually or double-click the object to show the object panel, "More options" and use the text box to modify the position of the geometry. Click "Apply move" when you are done. 

2 - Change the default maximum grabbing distance. 
To do so, "Tools"->"Options"->"General"
At the bottom of the window, you should see "Maximum distance to attach an object". Simply increase that value. 

3 - Change the default type of attaching command use from "object reference" to "object surface". 
To do so, "Tools"->"Options"->"General"
At the bottom of the window, you should see "Check shortest distance between TCP and object shape". Active that option. 

Have a great day. 
Hello and thank you Jeremy
It works and I learned two important things.
See you soon

Users browsing this thread:
1 Guest(s)