Hello,
I am working with an Epson VT6L arm and have recently started using the RoboDK Python API to control it. I am running into errors when using the API to connect and execute a sequence of movements.
The most common sequence I have been encountering is as follows:
I would like to note that these errors are not always consistent, this is merely the most common sequence of events I have run into. There have been instances when I run the same program and it executes three movements without error and disconnects when instructed at the end. I have also encountered "Cannot execute command: Robot not in auto mode" when the robot is in auto mode and "Robot entered error state after execute returned". When working directly in a RoboDK workspace with targets and a program with joint movements between the targets, I have not encountered these issues.
I will attach my code, RoboDK workspace, and a screenshot of the errors below.
Thank you in advance for your time, I greatly appreciate any guidance you can provide.
Best,
Jessica
I am working with an Epson VT6L arm and have recently started using the RoboDK Python API to control it. I am running into errors when using the API to connect and execute a sequence of movements.
The most common sequence I have been encountering is as follows:
- I initially turn on the robot and switch it into auto mode from the teach pendant. It is clear of errors.
- I run my program (included below). "Trying to connect to Epson VT6..." is output due to my use of .ShowMessage(), followed by "WARNING: Robot connection problem: Connecting to robot " followed by the IP and port of the robot arm. Despite this output, the robot arm motors are activated and the Connection Status displayed in the "Connect Robot" Panel of the RoboDK workspace is "Ready".
- The movement is then attempted and "robodk.robolink.StoppedError: Robot not connected" is output and the program stops running. Most times, the first movement is still completed.
- After the program stops running, the Connection Status in RoboDK is often still "Ready" and error 1504 is displayed on the pendant (Communication disconnection between Remote Ethernet and Controller. Re-establish communication). Despite the error on the teach pendant, often the error LED on the robot is not illuminated and no reset is required to clear it.
I would like to note that these errors are not always consistent, this is merely the most common sequence of events I have run into. There have been instances when I run the same program and it executes three movements without error and disconnects when instructed at the end. I have also encountered "Cannot execute command: Robot not in auto mode" when the robot is in auto mode and "Robot entered error state after execute returned". When working directly in a RoboDK workspace with targets and a program with joint movements between the targets, I have not encountered these issues.
I will attach my code, RoboDK workspace, and a screenshot of the errors below.
Thank you in advance for your time, I greatly appreciate any guidance you can provide.
Best,
Jessica
Code:
from robolink import *
from robodk import *
import time
import argparse
RDK = robolink.Robolink()
def establish_connection() -> RDK.Item:
robot = RDK.Item("", robolink.ITEM_TYPE_ROBOT)
RDK.ShowMessage("Trying to connect to %s..." % robot.Name())
robot.Connect()
time.sleep(3)
return robot
def move(robot: RDK.Item, num_movements: int, target_names: list[str]) -> None:
status, status_msg = robot.ConnectedState()
while status_msg == "Ready":
for i in range(num_movements):
robot.MoveJ(RDK.Item(target_names[i]))
RDK.ShowMessage("Completed movement %s" % i)
robot.Disconnect()
def get_pos(robot: RDK.Item):
return robot.Pose()
def make_parser():
parser = argparse.ArgumentParser()
parser.add_argument("num_movements", type=int)
parser.add_argument("target_names", nargs="+", metavar="string")
return parser
def main():
parser = make_parser()
args = parser.parse_args()
robot = establish_connection()
move(robot=robot, num_movements=args.num_movements, target_names=args.target_names)
print(get_pos(robot=robot))
if __name__ == "__main__":
main()