I'm trying to read a CSV file via a python script and I can't run correclty robot.setJoints command. This is my code. Do you know what's the problem?
Code:
LOAD_AS_PROGRAM = True
REFERENCE_NAME = 'Reffere to'
TARGET_NAME = 'Home'
RDK = Robolink()
path_file = r'C:/Users/giahn/OneDrive/Έγγραφα/Σχολή/ΔΙΠΛΩΜΑ/main/Test/program.csv'
data = LoadList(path_file)
program_name = getFileName(path_file)
robot = RDK.Item('Comau Smart5 NJ 110-3.0', ITEM_TYPE_ROBOT)
frame = RDK.Item(REFERENCE_NAME, ITEM_TYPE_FRAME)
if not frame.Valid():
raise Exception("Failed to retrieve the reference frame. Check frame configuration.")
robot.setPoseFrame(frame)
target = RDK.Item(TARGET_NAME, ITEM_TYPE_TARGET)
if not target.Valid():
raise Exception("Target not found. Ensure the name is correct.")
if not target.Valid():
raise Exception("Home target is not valid. Set a home target named: %s" % TARGET_NAME)
# Set the robot to the home position
# Get the pose reference from the home target
robot.setJoints(target.Joints())
pose_ref = robot.Pose()
if LOAD_AS_PROGRAM:
# Add a new program
program = RDK.AddProgram(program_name, robot)
# Turn off rendering (faster)
RDK.Render(False)
# Speed up by not showing the instruction:
program.ShowInstructions(False)
# Remember the speed so that we don't set it with every instruction
current_speed = None
target = None
# Very important: Make sure we set the reference frame and tool frame so that the robot is aware of it
program.setPoseFrame(frame)
program.setPoseTool(robot.PoseTool())