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

How can robot machine learning be realized with RoboDK API?

#11
(07-20-2023, 10:05 AM)Albert Wrote:You should be able to do both:
  1. Use one instance of RoboDK with multiple API connections (multiple instances of robolink). When you use the same instance of RoboDK, item pointers are exactly the same.
  2. Multiple instances of RoboDK running with one or more API connections each. Make sure you start RoboDK using the -NEWINSTANCE command line option so you open a new instance of RoboDK.

I chose the second method above.

However, although 3 RDKs corresponding to ports (20501, 20502, 20503) should have been started, 3 projects are added to the RDK corresponding to port (20500) which should not be used. I want to fix this bug.

In the code below three RDKs were created.
Code:
NUM_WORKERS = 3
robodk_executable_path = "/home/***/RoboDK/RoboDK-Start.sh"
for env_no in range(1, NUM_WORKERS+1):
api_port = 20500 + env_no
subprocess.Popen(["bash", robodk_executable_path, "-NEWINSTANCE", "-PORT", str(api_port)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
接下来,我planned to add projects to each RDK with the code below, but all projects were added to the RDK of port (20500) which should not exist.
Code:
class RoboController:
def __init__(self, env_no, api_port) -> None:
self.env_no = env_no
self.api_port = api_port
self.RDK = Robolink(args=["-PORT=" + str(self.api_port),])
self.project_directory = os.path.abspath(os.path.dirname(__file__))
self.RDK.AddFile(os.path.join(self.project_directory, "./rdk/Conveying.rdk"))
print(f"RDK.AddFile - RDK: {self.RDK}, API port: {self.api_port}" )
In the terminal display, it seems that projects have been added to the RDKs corresponding to the three ports. But as I wrote above, 3 projects are added to the RDK corresponding to port(20500).
Code:
(RoboController pid=1548973) RDK.AddFile - RDK: , API port: 20502
(RoboController pid=1548972) RDK.AddFile - RDK: , API port: 20501
(RoboController pid=1548974) RDK.AddFile - RDK: , API port: 20503


Attached Files Thumbnail(s)



Messages In This Thread
RE: How can robot machine learning be realized with RoboDK API? - bySAT0001- 07-24-2023, 04:59 AM



Users browsing this thread:
1 Guest(s)