Timeout and retry to secure real controllers discovery with PC SDK
labu
✭✭
Dear All,
We are long time users of PC SDK and are facing increasing difficulties to secure the initial controllers discovery. I am feeling that our way of scanning for the controllers is "old fashion" and might be the cause for our troubles.
Is anybody experiencing such issues (controllers not discovered and needing several retries, long delays, ...)
Workarounds, code samples for this initial discovery xwarmly welcomed.
Thanks in advance to the community.
We are long time users of PC SDK and are facing increasing difficulties to secure the initial controllers discovery. I am feeling that our way of scanning for the controllers is "old fashion" and might be the cause for our troubles.
Is anybody experiencing such issues (controllers not discovered and needing several retries, long delays, ...)
Workarounds, code samples for this initial discovery xwarmly welcomed.
Thanks in advance to the community.
Tagged:
0
Comments
-
Hi,
Yes this have been a problem for years (allways) also for me. The scan don't allways find the controllers well. Very frustrated.
In couple of last projects I have try to connect anyway if I know the controller before by using its id. something like following code (still working on this)Guid gid = new Guid(id);netScanner.TryFind(gid, 1000, 2, out info);
However I haven't yet made good pattern for this. I have some issues with timing to do this as I call scan in class constructor and I don't have the controller id's yet. I have to make timer etc.
If somebodyhave ideas for this problem I am interested as well to hear them.
Mika0 -
Are we only 2 to have this issue?
0 -
I also have this issue.
My PC SDK application seems to find the specified controller by GUID very quickly if I have RobotStudio running and the controller is listed in the 'Recent Controllers' sections. There is some correlation there, I just have no Idea what the problem is.
If RobotStudio is not running, my PC SDK application will fail while trying to find the controller.
Any help on this would be greatly appreciated!0 -
Hello,
We've initiated troubleshooting for this issue.
A collegue of mine will soon post a proposed workaround in the meanwhile.—Maxim RiabichevPC Software Support Engineer1 -
Hello!I have taken a look at the issue of controllers not being discovered correctly.The reason it behaves this way is because the discovery of controllers is not really managed by the PC SDK application you are writing, but instead by a service called RobNetScanHost.exe. This service is started whenever you Scan using a NetworkScanner for example. It takes a while for this service to actually discover and get information from all controllers on the network.RobotStudio also uses this service, meaning that if you have had RobotStudio running for a while beforehand, the service will already have been running for a while.One quite simple way to work around this is by calling NetworkScanner.Scan() and then wait for a few seconds using a Stopwatch or by Sleeping the Thread. You can then call Scan again and get more discovered controllers.Another way to deal with it is by knowing which controllers you actually are looking for. As you discussed before, this can be done using Guids. If you take your time and let the scan find all controllers on the network you are interested in, you can then save the Guid of these controllers in a text file for example. This text file can then be read by a program and used with NetworkScanner.TryFind().I have attached a Visual Studio Project file with a simple example of how this can be implemented. It has worked well on our system and managed to find all our controllers consistently and quickly even after just having rebooted my computer (meaning that the service hasn't had a lot of time to look for controllers).Simply run SaveControllers() and then LoadControllers().Below is also the raw code:using System;using System.Collections.Generic;using System.IO;using System.Linq;using ABB.Robotics.Controllers;using ABB.Robotics.Controllers.Discovery;namespace GuidControllerScan{class Program{private static readonly int WAIT_TIME = 1000;private static readonly int RETRIES = 2;private static readonly string PATH_GUID = "C:\\TestGuid\\guid.txt";static void Main(string[] args){//SaveControllers();LoadControllers();Console.ReadKey();}// Save the scanned controllers to the Guid filepublic static void SaveControllers(){ControllerInfo[] cInf = ScanControllerInfo();Guid[] guid = cInf.Select(e => new Guid(e.SystemId.ToString())).ToArray();WriteGuidLog(guid, PATH_GUID);}// Load the controllers from the saved Guid filepublic static void LoadControllers(){Guid[] guid = ReadGuidLog(PATH_GUID);ControllerInfo[] cInf = GetControllers(guid);}/// Attempts to get the controllers from an array of Guidpublic static ControllerInfo[] GetControllers(Guid[] guidArray){Console.WriteLine($"Scanning for {guidArray.Length} Guid...");NetworkScanner networkScanner = new NetworkScanner();List<ControllerInfo> controllerInfoList = new List<ControllerInfo>();for (int i = 0; i < guidArray.Length; i++)if (networkScanner.TryFind(guidArray[i], WAIT_TIME, RETRIES, out ControllerInfo info))controllerInfoList.Add(info);Console.WriteLine($"Found {controllerInfoList.Count} ControllerInfo.");return controllerInfoList.ToArray();}/// Save the Guid as a text fileprivate static void WriteGuidLog(Guid[] guidArray, string filePath){Console.WriteLine($"Writing Guid log {filePath}");FileInfo info = new FileInfo(filePath);if (info.Exists)info.Delete();elseinfo.Directory.Create();File.WriteAllLines(filePath, guidArray.Select(e => e.ToString()).ToArray());Console.WriteLine($"Finished writing Guid log {filePath}");}/// Read Guid from a text fileprivate static Guid[] ReadGuidLog(string filePath){Console.WriteLine($"Reading Guid log {filePath}");return File.ReadAllLines(filePath).Select(e => new Guid(e)).ToArray();}/// Scan the network for controllersprivate static ControllerInfo[] ScanControllerInfo(){Console.WriteLine($"Scanning for controllers...");NetworkScanner scanner = new NetworkScanner();scanner.Scan();// Wait a while for the scan to find more controllers if needed.System.Threading.Thread.Sleep(4000);scanner.Scan();Console.WriteLine($"Found {scanner.GetControllers().Length} controllers.");return scanner.GetControllers();}}}Post edited by AdamSG on—Adam GustavssonPC Software Support Engineer1
-
Hi Adam,
Thank you very much for the reply! I tried the code that you attached above and had the same result. The application will not find any controllers unless they are listed in the 'recent controllers' section of RobotStudio and RobotStudio is running. I did some investigation into the RobNetScanHost service and this is what I found: With RobotStudio running, the following ports are opened:
Without RobotStudio running, there are no ports open. However, the RobNetScanHost service is started when the PC SDK application is launced.
Is RobotStudio passing in parameters to RobNetScanHost? RobNetScanHost seems to respond differently depending on which application starts it.
I look forward to your reply.0 -
Hi Adam,
Another thing I have found is that once I add a controller into RobotStudio, the RobComCtrlServer consumes the following port:
0 -
Hello again,
I tried the same thing as you did and looked at netstat after restarting my computer and starting my PC SDK application right away. I did however find that the service was actually using the right ports from the start without having to start RobotStudio! (see image)
I wonder if there are any differences in our systems and RobotStudio versions. I am running Windows 10 with RobotStudio 6.07.01. The version of
C:\Program Files (x86)\Common Files\ABB Industrial IT\Robotics IT\RobAPI\RobNetScanHost.exe for me is 6.7.1011.1 (see image). Is there any difference on your system?
—Adam GustavssonPC Software Support Engineer0 -
Hi Adam,
There is a difference in our systems. I am running Windows 7.
I am going to remove all of the software and reinstall it. I will report back with the results.0 -
I just checked with my colleague who is running windows 7 on his computer and it worked fine there as well... I will await your re-installation meanwhile. We are also leaving for the weekend so I will give it some more thinking until then,—Adam GustavssonPC Software Support Engineer0
-
Hey Adam,
I am starting to believe this is a windows firewall problem associated with with my VPN. I assume that the firewall is allowing traffic when RobotStudio is open but blocking the ports when RobotStudio is closed.
I uninstalled and reinstalled everything but had the same result.0 -
Hi Adam,
I have been able to get my application to work. I believe there were two steps that fixed the problem.
The first step was to setup ports 5512 thru 5515 in the firewall (outlined in this document http://developercenter.robotstudio.com/BlobProxy/manuals/RobotStudioOpManual/doc76.html).
Although RobNetScanHost was allowed through the firewall, adding the ports seemed to help.
The second step was to add the remote controllers to the App.config file.<remoteControllers><controller id="192.168.10.11" /><controller id="192.168.10.12" /><controller id="192.168.10.21" /><controller id="192.168.10.22" /><controller id="192.168.10.23" /><controller id="192.168.10.24" /><controller id="192.168.10.31" /><controller id="192.168.10.32" /><controller id="192.168.10.33" /><controller id="192.168.10.34" /><controller id="192.168.10.41" /><controller id="192.168.10.42" /><controller id="192.168.10.43" /><controller id="192.168.10.44" /><controller id="192.168.10.51" /><controller id="192.168.10.52" /><controller id="192.168.10.53" /><controller id="192.168.10.54" /></remoteControllers>
I hope this information will prove useful to other users.1 -
Glad you got it to work!—Adam GustavssonPC Software Support Engineer0
-
Dear All,
I've the same problem.
I'm using Visual Studio through a Virtual Box machine. Not always RobotStudio can reach the robot. Some times is necessary to Close a Open again RobotStudio.
In the same way, networkscanner works properly only if I've already reached the robot by robot studio, otherwise it doesn't find any robot.
I've disabled also the firewall...
Any idea that could help me?
Kind regards,
DavideBye Davide Rossi0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 60 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 797 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings