Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
External Rail programmation with the Python API

I experience issue while programming a path with robodk. My station looks like instation png. My code looks like this :

       Control the robot via the RoboDK Python API

                   htm = (n,4,4)
                       Homogeneous Transformation Matrices from the base to the tool holder of every positions
                   speed : (n-1) float
                       speed between each position

   RDK = Robolink()
   copyfile("..\Ressources\RDKFiles\CTTLab.rdk", "..\Ressources\RDKFiles\Test.rdk")
   robot = RDK.Item('KUKA KR 100-2 P', ITEM_TYPE_ROBOT)
   if not robot.Valid():
       raise Exception('No robot selected or available')

   reference = robot.Parent().Parent()

   # Create a new program
   program = RDK.AddProgram("Test", robot)

   # Turn off automatic rendering

   # Specify the reference frame you want to use

   # Define a reference pose
   targetname = 'Target Home'
   target_home = RDK.AddTarget(targetname, reference, robot)

   targetname = 'Target 0'
   target = RDK.AddTarget(targetname, reference, robot)

   for i in range(htm.shape[0] - 1):
       targetname = 'Target %i' % (i + 1)
       target = RDK.AddTarget(targetname, reference, robot)

I get a error : AttributeError: 'numpy.ndarray' object has no attribute 'isHomogeneous'
I overcome this by remplacing htm[i] by KUKA_2_Pose(Pose_2_KUKA(htm[i+1])). But it doesn`t seems to be the proper way.
When running the corrected program, i get an error that the target is out of reach. as shown in the picture enclosed.

Do you have an idea of where it can come from ?

I tried another solution. Indeed, I added the following :
The rail finally move to reach the target but it doens't reach the proper target.

Thank you

Attached Files Thumbnail(s)
I believe you are providing numpy matrices to the RoboDK API. RoboDK expects 4x4 matrices to be Mat objects. This Matrix object is defined in the robodk module:

You could do something like:
reference = KUKA_2_Pose(list(xyzabc))

Where xyzabc is a 1D numpy array given X,Y,Z,A,B,C values. The list function will convert it to a list of 6 values and the KUKA_2_Pose will create a Mat pose that you can provide to RoboDK as a pose.
Thank you for your answer.
Unfortunately, it doesn't solve the "target out of reach" issue. What about it ?

I should precise that I acheive placing the targets. It just says that they are out of reach while obviously they are not.

Attached Files Thumbnail(s)
Can you share the RoboDK project (RDK file)?
You may need to set a value for the external axis so targets can be reached.
Actually, I answered my question by myself. I solved it this way :
target_name = 'Target %i' % (i + 1)
robot.MoveJ(robot.SolveIK(KUKA_2_Pose(Pose_2_KUKA(htm[i+1])), tool=RDK.Item('Tool 1', ITEM_TYPE_TOOL).PoseTool()))
target = RDK.AddTarget(target_name, reference, robot)

Thank you


Users browsing this thread:
1 Guest(s)