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

Attach an object / Python Script

#1
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

Code:
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.AttachClosest()
    toolitem.RDK().RunMessage('Set air valve on')
    toolitem.RDK().RunProgram('TCP_On()');

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

    # ----------- take a part from the conveyor ------
    # get the xyz position of part i
    robot.setPoseFrame(frame_pallet)
    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
    robot.MoveJ(target_pallet_safe)
    # get the box i
    robot.MoveJ(target_i_app)
    robot.MoveL(target_i)
    TCP_Off(tool, frame_pallet) # attach the closest part
    robot.MoveL(target_i_app)
    robot.MoveJ(target_pallet_safe)
   
    i = i + 1
#2
Hi Ned, 

I think this is what you are looking for:

Code:
AttachClosest()

Take a look at this link to our API documentation.

You will also need:
Code:
DetachAll(parent=0)
and this:
Code:
DetachClosest(parent=0)

Here's the link.

Hope it helps. 
Have a great day.
Jeremy
#3
Hi Jeremy

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

Thank for your support
Ned
#4
Hi Need,

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

Jeremy
#5
Hi Jeremy
Attached is the project
Thank
Ned C.


Attached Files
.rdk   PPkM1v0.7.rdk (Size: 3.39 MB / Downloads: 7,846)
#6
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. 
Jeremy
#7
Hello and thank you Jeremy
It works and I learned two important things.
See you soon
  




Users browsing this thread:
1 Guest(s)