Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Im getting error when wait function is on #1

Open
Ukkeli12 opened this issue May 9, 2022 · 3 comments
Open

Im getting error when wait function is on #1

Ukkeli12 opened this issue May 9, 2022 · 3 comments

Comments

@Ukkeli12
Copy link

Ukkeli12 commented May 9, 2022

Code:
from urx import Robot
from time import sleep
from math import radians
import sys

rob = Robot("192.168.100.10")

base,shouder,elbow,wrist1,wrist2,wrist3,ja,jv = 68.95,-61.30,128.65,10.62,87.54,85.48,1.2,0.25 #Jointspace asetukset
x,y,z,rx,ry,rz,la,lv = 3.74,-323.51,-497.28,1.782,-2.389,0.227,1.4,1.05 #Toolspace asetukset

def DegToRad(degree): #Muunnetaan asteet radiaaneiksi jotta helpotetaan koodausta
return radians(degree)

def MilToM(mil): #Muunnetaan millimetri metreiksi
return mil / 1000

#print("Tässä on asteet radiaaneiksi",DegToRad(90))
#print("Tässä on millit metreiksi",MilToM(100))

rob.set_tcp((0, 0, 0.1, 0, 0, 0))
rob.set_payload(2, (0, 0, 0.1))
sleep(0.2) #leave some time to robot to process the setup commands
rob.movej((DegToRad(base), DegToRad(shouder), DegToRad(elbow), DegToRad(wrist1), DegToRad(wrist2), DegToRad(wrist3)), ja, jv,wait=True) #Jointspace
rob.movel((MilToM(x), MilToM(y), MilToM(z), rx, ry, rz), la, lv,wait=True) #Toolspace
print(rob.getj())
rob.close()
#rob.exit

tried 11 times to find a packet in data, advertised packet size: -2, type: 3
Data length: 68
tried 11 times to find a packet in data, advertised packet size: -2, type: 3
Data length: 1092
tried 11 times to find a packet in data, advertised packet size: -2, type: 3
Data length: 1420
Traceback (most recent call last):
File "c:\Users\OMISTAJA\OneDrive - Oulun ammattikorkeakoulu\Harjoittelu 2022 oamk\Koodit python\Demo_robotti.py", line 25, in
rob.movej((DegToRad(base), DegToRad(shouder), DegToRad(elbow), DegToRad(wrist1), DegToRad(wrist2), DegToRad(wrist3)), ja, jv,wait=True) #Jointspace
File "C:\Users\OMISTAJA\AppData\Roaming\Python\Python39\site-packages\urx\urrobot.py", line 277, in movej
self._wait_for_move(joints[:6], threshold=threshold, joints=True)
File "C:\Users\OMISTAJA\AppData\Roaming\Python\Python39\site-packages\urx\urrobot.py", line 217, in _wait_for_move
raise RobotException("Robot stopped")
urx.urrobot.RobotException: Robot stopped

When movel and movej wait=False it works normaly.

@Ukkeli12
Copy link
Author

Ukkeli12 commented May 9, 2022

My python is Python 3.9.7 in Windows 10 64 bit.

@Ukkeli12
Copy link
Author

Ukkeli12 commented May 9, 2022

Also robot is ur5.

@jkur
Copy link
Owner

jkur commented May 9, 2022

Hi,
first of all this is no upstream repository. Maybe another fork or the original repo contains newer and working code.
I still use this code but also do run into failures from time to time. I usually restart my application, because it's not critical.

Besides that, it's very important to know which software version you are running. The interface has changed over time and this code does not cover all versions.

The interface is documented here: https://www.universal-robots.com/articles/ur/interface-communication/remote-control-via-tcpip/

See the attached excel-sheets and PDFs.

The actual code is quite easy to read, maybe you can trace your problem yourself. It's somewhere in ursecmon.py i guess.
The way how this piece of software solves it, may not be the best way to do it.

Depending on what you're trying to solve it might be easier to just send some URScript code to the primary or secondary interface yourself.

It's as easy as opening a port (30001) and sending your code in plain text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants