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

Look for Collision with MoveJ_Test

#1
I want to check if the new target i add is reachable via MoveJ without collision.
Code:
TargetPose = KUKA_2_Pose([x, y, z, rx, ry, rz])
                   
                    # Erstellen der Punkte (Target) im RoboDK
                    Target = RDK.AddTarget(TargetName,FRAME, Robot)
                    Target.setAsCartesianTarget()
                    Target.setPose(TargetPose)
                    Target.setParent(Sub2Ordner)
                    Target.setVisible(False)
                   
                    # Den ersten Punkt im Programm als Achsenbewegung anlegen, die anderen als Linearbewegung
                    #if not executed_once:             
                    #    Programm.MoveJ(Target)
                    #    executed_once = True
                    #else:
                     
                    j1 = Robot.SolveFK(Robot.Joints())
                    j2 = TargetPose
                    print(f"j1: {j1}, j2: {j2}")
                   
                   
                    try:
                        Status = Programm.MoveJ_Test(j1, j2, minstep_deg = -1)
                    except Exception as e:
                        print(f"Error in MoveJ_Test: {e}")

Code:
j1: Pose(1173.000, -0.000, 1650.000,  0.000, 90.000, -0.000):
[[ -0.000, -0.000, 1.000, 1173.000 ],
[ -0.000, 1.000, 0.000, -0.000 ],
[ -1.000, -0.000, -0.000, 1650.000 ],
[ 0.000, 0.000, 0.000, 1.000 ]]
, j2: Pose(1699.145, -101.928, 636.268,  -111.915, -20.361, 4.323):
[[ 0.935, -0.071, -0.348, 1699.145 ],
[ 0.294, -0.396, 0.870, -101.928 ],
[ -0.199, -0.915, -0.350, 636.268 ],
[ 0.000, 0.000, 0.000, 1.000 ]]

I get the following error calling the function MoveJ_Test

Invalid item provided: The item identifier provided is not valid or it does not exist.
#2
How do you retrieve the program or robot items?

MoveJ_Test and MoveL_Test functions should be called on a robot item, not a program. The program variable should be a robot (the type should be ITEM_TYPE_ROBOT). You can double check this by using:

If not, you should properly retrieve the program or the robot by using something like this:
Code:
program = RDK.Item("Program name", robolink.ITEM_TYPE_PROGRAM)
robot = RDK.Item("robot name", robolink.ITEM_TYPE_ROBOT)
# the following is also valid to get the robot linked to a program:
# robot = program.getLink(robolink.ITEM_TYPE_ROBOT)

# Trick to double check that the expected type is correct:
print(robot.type == robolink.ITEM_TYPE_ROBOT)
#3
i changed it from program to robot and it works, thanks for your help
  




Users browsing this thread:
1 Guest(s)