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

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

Code:
"""
Control the robot via the RoboDK Python API

Parameters
----------
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")
RDK.AddFile("..\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
RDK.Render(False)

# Specify the reference frame you want to use
program.setPoseFrame(reference)

# Define a reference pose
targetname = 'Target Home'
target_home = RDK.AddTarget(targetname, reference, robot)
target_home.setJoints(robot.SolveFK(robot.JointsHome()))
program.MoveJ(target_home)

targetname = 'Target 0'
target = RDK.AddTarget(targetname, reference, robot)
target.setAsCartesianTarget()
target.setPose(htm[0])
program.MoveJ(target)

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

program.RunProgram()
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 :
target.setAsJointTarget()
The rail finally move to reach the target but it doens't reach the proper target.

Thank you


Attached Files Thumbnail(s)



Messages In This Thread
External Rail programmation with the Python API -byMarcGondran-09-11-2019, 07:45 PM



Users browsing this thread:
1 Guest(s)