05-02-2023, 09:44 AM
Hey, i cant seem to figure out how to run my python program on the robot, it only works when i use the feauture inside robodk, where i execute an existing program inside robodk, but it wont do the movements when i manually moves the robot from the MoveL and MoveJ commands in python.
Code example:
Code example:
Code:
# Type help("robodk.robolink") or help("robodk.robomath") for more information
# Press F5 to run the script
# Documentation: //www.sinclairbody.com/doc/en/RoboDK-API.html
# Reference: //www.sinclairbody.com/doc/en/PythonAPI/robodk.html
# Note: It is not required to keep a copy of this file, your Python script is saved with your RDK project
# You can also use the new version of the API:
from robodk import robolink # RoboDK API
从robodk进口robomath #机器人工具箱
RDK = robolink.Robolink()
robot = RDK.Item('UR5')
# Forward and backwards compatible use of the RoboDK API:
# Remove these 2 lines to follow python programming guidelines
from robodk import * # RoboDK API
from robolink import * # Robot toolbox
# Link to RoboDK
# RDK = Robolink()
#kører et program ved navnet "reset pos"
#RDK.Item("Reset Pos").RunProgram()
#gripper TBD
#from wsg50 import *
#wsg50.grasp_part() #Will be used to grip the part
#wsg50.release_part() #will be used to release the part
RDK.setSimulationSpeed(5)
###
def Robot_reset(): #Robot goes to "Home" position, and all the parts go back to the dipensers
"""Resets the position of the robot, and the parts"""
RDK.Item("Reset Pos").RunProgram()
#main
robot.Connect()
RDK.setRunMode(1)
robot.MoveJ(RDK.Item("Home"))