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

# RelTool in loop issues...

I'm not super familiar with Python, but I'm learning.  This is the whole code... this is day 1 for me and I'm just modifying some tutorial code.

The RelTool in the circle function works fine the first time through, but then fails on the second pass when assigning the relative target pose to t.Pose.  The python error says 'Mat' object is not callable.

I don't know what is going on here.

Code:
```from robolink import *    # RoboDK API from robodk import *      # Robot toolbox RL = Robolink() #get the robot item robot = RL.Item('Fanuc LR Mate 200iC') #get the home target and the first move target home = RL.Item('Home') target = RL.Item('Target 1') #poseref = target.Pose() print(target.Pose) #move the robot to home then to the center robot.MoveL(home) def circle(targ,n):    t = targ      t.Pose = RelTool(targ,0,50*n,0)    #get the pose of the target 4x4 matrix    poseref = t.Pose    robot.MoveL(t)    hexnum=80    #make a hexagon around the center    for i in range(hexnum):        ang = i*2*pi/(hexnum-1)        posei = poseref*rotz(ang)*transl(30,0,0)*rotz(-ang)        robot.MoveL(posei)    #move back to center then home    robot.MoveL(t)    robot.MoveL(home) for i in range(2):    circle(target,i)```
You should use Item.Pose() and Item.setPose(pose) as functions.

Example:
target1 = RDK.Item('Target 1')
target1_pose = target1.Pose()        # Pose() gives you a Mat() object
# ...
target1.setPose(new_target1_pose)    # You should provide a Mat() object

You can create Mat objects like this:
pose1 = transl(100,200,300)*rotz(pi)   # impose a new position (calculated)
pose2 = RelTool(pose1, 0,0, -100)      # Create an approach pose with respect to the first one (move along negative Z axis
pose3 = KUKA_2_Pose([x,y,z,A,B,C])     # Create a pose given KUKA's XYZABC values