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

The behavior of setPoseTool is buggy

#1
Hello 

I asked about this in another thread, but now that I know more about it I'll report it here.

Sorry for the multiple posts

After calling Connect() without connecting to a robot, An error occurs when using setPoseTool().


I've included the code and Project below, so check it out.
Please let me know how to avoid this error

Code:
from robodk import robolink    # RoboDK API
from robodk import robomath    # Robot toolbox
from robodk import *      # RoboDK API
from robolink import *    # Robot toolbox

RDK = robolink.Robolink()
robot = RDK.Item("Yasakawa GP50")
tool = RDK.Item("FLANGE")
robot.setPoseTool(tool)
robot.Connect()
robot.Disconnect()
robot.setPoseTool(tool)
Code:
WARNING: Robot connection problem: Connection problems
Traceback (most recent call last):
  File "c:\Users\xxxx\AppData\Local\Temp\Prog1.py", line 23, in <module>
    robot.setPoseTool(tool)
  File "C:\RoboDK\Python\robodk\robolink.py", line 5555, in setPoseTool
    self.link._check_status()
  File "C:\RoboDK\Python\robodk\robolink.py", line 835, in _check_status
    raise Exception(self.LAST_STATUS_MESSAGE)
Exception: Robot connection timed out: Connection problems


Attached Files
.rdk   demo.rdk (Size: 4.79 MB / Downloads: 140)
#2
Are you using the latest version of RoboDK?
Connect raises a warning saying that the connection did not succeed. You can use ConnectedState to know if you are connected to the robot.

Either way, you could implement a try/catch to know when the connection fails and reconnect again. This could happen if the link between the robot controller and your computer is broken.
#3
The latest version is used.

The problem is that if you try to Connect without being connected to a robot, the connection with RoboDK becomes unstable, and a timeout error occurs with the next API command.

We believe that the reason for this is that RoboDK continues to send a connection signal to the Robot even after the robot.Connect() return value, preventing the processing of the next API command.

And, I found the solution.
When an error occurs in Connect, reconnecting with RoboDK will prevent a timeout from occurring on the next API command.

Please let me know if there is another way to solve this error.

I wrote the solution code below.

thanks
Code:
from robodk.robolink import *
from robodk.robomath import *

rdk = Robolink()

robot = rdk.Item("Yaskawa GP50", ITEM_TYPE_ROBOT_ARM)
tool = rdk.Item("FLANGE", ITEM_TYPE_TOOL)

try:
    robot.Connect()
except:
    rdk.Connect()
finally:
    rdk.Connect()

robot.setPoseTool(tool)
#4
I don't see the point of retrying to connect outside of the try/catch. I would approach this scenario in this manner:
Code:
while True:
    try:
        robot.Connect()
        ExecuteYouInstructions(robot)
        break # done: exit the main while
    except Exception as e:
        print(str(e)) # Print the error to know what is going on
        robot.Disconnect()
        robot.Disconnect() # This simulates a double click to Disconnect which provokes killing the driver process
        print("Retrying...")
#5
Actually, after further discussion with our team, setting the tool on Motoman robots is not supported. You should set the tool manually first or using a JBI program file. Note that setting the tool with a JBI program requires support for the SETTOOL command which is not available by default.
  




Users browsing this thread:
1 Guest(s)