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

RoboDK crash when enabling SetCollisionActive

#1
RoboDK crashes after calling SetCollisionActive in the API whenever there is already a collision happening or while a program is running. The crash seems to only occur whenever the existing collision's were found or whenever the program is started through the API functions.

This is the error message that appears when enabling SetCollisionActive:

Quote:System.Net.Sockets.SocketException: 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'


RoboDK v5.5.4
C# API
#2
This issue looks specific to your project. It looks like the API times out, maybe because RoboDK takes too long to calculate collisions.

Can you share the RoboDK project file and steps for us to reproduce?
#3
I found the cause, it was because I was also using RoboDK's event channel at the same time.
#4
OK thanks for letting us know. The event channel should be used on a separate Robolink instance.

If you can share a way to reproduce we can try to prevent a crash.
#5
In essence, I had two threads for handling robodk, the first has a queue which i use to send commands to robodk. This is so that robodk doesn't timeout and crash because two or more commands are running at the same time like what had happened in this post; also so that it doesn't freeze the main thread for the UI when sending a command like collision checking. The other thread is to handle robodk events, mainly used to check if the user has selected an object from the tree in the scene.

Code:
        async void DequeueCommands()
Code:
        {
            while (true)
            {
                if (commandsQueue.Count > 0)
                {
                    await Task.Run(() => DO ROBODK STUFF);
                }

                await Task.Delay(25);
            }
        }


Code:
        void RDKEventThread()
        {
            while (true)
            {
                EventResult eventResult = null;
                try
                {
                        eventResult = eventChannel.WaitForEvent();
                }
                catch (Exception e)
                {
                    eventResult = null;
                }
                finally
                {
                    if (eventResult != null)
                    {
                        switch (eventResult.EventType)
                        {
                            case EventType.Selection3DChanged:
                 
                                break;
                            default:
                                break;
                        }
                    }
                }

            }
        }
  




Users browsing this thread:
1 Guest(s)