05-05-2026, 04:36 PM
Our PySide program will embed the RoboDK window so the user can visulize the robot movement. This worked perfectly in the last project - which only used one robot. The robot in the station was connected as normal and the simulated robot matched the real robot positions.
Skipping some steps... the self.RDK = robolink.Robolink(args=["-NEWINSTANCE", "-EXIT_LAST_COM", "-SKIPCOM_ALL"]) command provided a RoboLink instance for our program. That object could be used to move the robot or send a program to the controller. No problems so far.
The next project will use two robots - each with a seventh axis. Each robot will have a separate ABB controller running the RoboDK driver. I expect the RoboDK window to embed using the same steps as before. Each robot in the station can connect and (hopefully) the simulation will echo what is happening in real life as the two robots move. But here is where I get confused.
Consider the example where each robot needs to calibrate an end effector. Our program will move a robot to a position, signal the end effector to do something, then repeat for many positions. This should happen for each robot at the same time - but the two robots are not "synchronized", they are running independently. How do I do this?
The first idea is to start two threads and pass the main RoboLink object to them. The "self.RDK" object created above. Thread "A" will make a reference to "Robot A" using something like self.Robot = self.RDK.Item('RobotA', 2) and move it as needed. Similarly, thread "B" will move RobotB. In reality, they are both using methods in the same RoboLink object (I think). What happens if both threads tell RoboLink to move different robots at the same?
The "Synchronize 3 Robots" example in the documentation also creates a thread for each robot, but the threads then create a new RoboLink instance. How would this work if the RoboDK window (with the initial RoboLink) is embedded in our program? That "embedded RoboLink" is also talking to the drivers to update the display, correct?
I don't feel like I explained this very well - here is some pseudo-code that might help.
Skipping some steps... the self.RDK = robolink.Robolink(args=["-NEWINSTANCE", "-EXIT_LAST_COM", "-SKIPCOM_ALL"]) command provided a RoboLink instance for our program. That object could be used to move the robot or send a program to the controller. No problems so far.
The next project will use two robots - each with a seventh axis. Each robot will have a separate ABB controller running the RoboDK driver. I expect the RoboDK window to embed using the same steps as before. Each robot in the station can connect and (hopefully) the simulation will echo what is happening in real life as the two robots move. But here is where I get confused.
Consider the example where each robot needs to calibrate an end effector. Our program will move a robot to a position, signal the end effector to do something, then repeat for many positions. This should happen for each robot at the same time - but the two robots are not "synchronized", they are running independently. How do I do this?
The first idea is to start two threads and pass the main RoboLink object to them. The "self.RDK" object created above. Thread "A" will make a reference to "Robot A" using something like self.Robot = self.RDK.Item('RobotA', 2) and move it as needed. Similarly, thread "B" will move RobotB. In reality, they are both using methods in the same RoboLink object (I think). What happens if both threads tell RoboLink to move different robots at the same?
The "Synchronize 3 Robots" example in the documentation also creates a thread for each robot, but the threads then create a new RoboLink instance. How would this work if the RoboDK window (with the initial RoboLink) is embedded in our program? That "embedded RoboLink" is also talking to the drivers to update the display, correct?
I don't feel like I explained this very well - here is some pseudo-code that might help.
Code:
class ApplicationGUI(QtWidgets.QMainWindow):
def embedRoboSK(self):
self.RDK = robolink.Robolink(args=["-NEWINSTANCE", "-EXIT_LAST_COM", "-SKIPCOM_ALL"])
# Stuff happens to embed the window and connect to the robots
def startTreads(self):
# Each thread gets a reference to the main RoboLink object and a file of instructions
self.threadA = calibrationThreadA()
self.threadA.rdk = self.RDK
self.threadA.instructions = pathToListOfPositionsA
self.threadA.start()
self.threadB = calibrationThreadB(pathToListOfPositionsB)
self.threadB.rdk = self.RDK
self.threadB.instructions = pathToListOfPositionsB
self.threadB.start()
class calibrationThreadA(QThread):
def __init__(self, parent=None):
QThread.__init__(self, parent)
def run(self)
self.robot = self.rdk.Item('RobotA', 2)
# Read the self.instructions file and move the robot when needed.
class calibrationThreadB(QThread):
def __init__(self, parent=None):
QThread.__init__(self, parent)
def run(self):
self.robot = self.rdk.Item('RobotB', 2)
# Read the self.instructions file and move the robot when needed.

