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

Add support for polyscope 3.15 #126

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions urx.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Metadata-Version: 2.1
Name: urx
Version: 0.11.0
Summary: Python library to control an UR robot
Home-page: https://github.com/oroulet/python-urx
Author: Olivier Roulet-Dubonnet
Author-email: [email protected]
License: GNU Lesser General Public License v3
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Topic :: System :: Hardware :: Hardware Drivers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Provides: urx
License-File: COPYING

UNKNOWN

15 changes: 15 additions & 0 deletions urx.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
COPYING
README.md
setup.py
urx/__init__.py
urx/robot.py
urx/robotiq_two_finger_gripper.py
urx/urrobot.py
urx/urrtmon.py
urx/urscript.py
urx/ursecmon.py
urx.egg-info/PKG-INFO
urx.egg-info/SOURCES.txt
urx.egg-info/dependency_links.txt
urx.egg-info/requires.txt
urx.egg-info/top_level.txt
1 change: 1 addition & 0 deletions urx.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions urx.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
math3d
numpy
1 change: 1 addition & 0 deletions urx.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
urx
11 changes: 9 additions & 2 deletions urx/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ def set_pose(self, trans, acc=0.01, vel=0.01, wait=True, command="movel", thresh
"""
self.logger.debug("Setting pose to %s", trans.pose_vector)
t = self.csys * trans
pose = URRobot.movex(self, command, t.pose_vector, acc=acc, vel=vel, wait=wait, threshold=threshold)
if hasattr(t.pose_vector,'__iter__'):
t = t.pose_vector
else:
t = t.pose_vector.array
pose = URRobot.movex(self, command, t, acc=acc, vel=vel, wait=wait, threshold=threshold)
if pose is not None:
return self.csys.inverse * m3d.Transform(pose)

Expand Down Expand Up @@ -208,7 +212,10 @@ def getl(self, wait=False, _log=True):
return current transformation from tcp to current csys
"""
t = self.get_pose(wait, _log)
return t.pose_vector.tolist()
if hasattr(t.pose_vector,'tolist'):
return t.pose_vector.tolist()
else:
return t.pose_vector.get_array().tolist()

def set_gravity(self, vector):
if isinstance(vector, m3d.Vector):
Expand Down
45 changes: 37 additions & 8 deletions urx/ursecmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def parse(self, data):
self.version = (3, 2)
allData['RobotModeData'] = self._get_data(pdata, "!IBQ???????BBdd", ("size", "type", "timestamp", "isRobotConnected", "isRealRobotEnabled", "isPowerOnRobot", "isEmergencyStopped", "isSecurityStopped", "isProgramRunning", "isProgramPaused", "robotMode", "controlMode", "speedFraction", "speedScaling", "speedFractionLimit"))
elif psize == 47:
self.version = (3, 5)
allData['RobotModeData'] = self._get_data(pdata, "!IBQ???????BBddc", ("size", "type", "timestamp", "isRobotConnected", "isRealRobotEnabled", "isPowerOnRobot", "isEmergencyStopped", "isSecurityStopped", "isProgramRunning", "isProgramPaused", "robotMode", "controlMode", "speedFraction", "speedScaling", "speedFractionLimit", "reservedByUR"))
self.version = max(self.version,(3, 5))
allData['RobotModeData'] = self._get_data(pdata, "!IBQ???????BBdddc", ("size", "type", "timestamp", "isRobotConnected", "isRealRobotEnabled", "isPowerOnRobot", "isEmergencyStopped", "isSecurityStopped", "isProgramRunning", "isProgramPaused", "robotMode", "controlMode", "speedFraction", "speedScaling", "speedFractionLimit", "reservedByUR"))
else:
allData["RobotModeData"] = self._get_data(pdata, "!iBQ???????Bd", ("size", "type", "timestamp", "isRobotConnected", "isRealRobotEnabled", "isPowerOnRobot", "isEmergencyStopped", "isSecurityStopped", "isProgramRunning", "isProgramPaused", "robotMode", "speedFraction"))
elif ptype == 1:
Expand All @@ -89,7 +89,15 @@ def parse(self, data):
else:
allData["CartesianInfo"] = self._get_data(pdata, "iBdddddddddddd", ("size", "type", "X", "Y", "Z", "Rx", "Ry", "Rz", "tcpOffsetX", "tcpOffsetY", "tcpOffsetZ", "tcpOffsetRx", "tcpOffsetRy", "tcpOffsetRz"))
elif ptype == 5:
allData["LaserPointer(OBSOLETE)"] = self._get_data(pdata, "iBddd", ("size", "type"))
if self.version >= (3,6):
tmpstr = ["size", "type"]
for name in ["cheksum", "DHtheta", "DHa", "Dhd", "Dhalpha"]:
for i in range(0,6):
tmpstr += ["%s%s" % (name,i)]
tmpstr += ["calibration_status"]
allData['KinematicsInfo'] = self._get_data(pdata,"!iB IIIIII dddddd dddddd dddddd dddddd I", tmpstr)
else:
allData["LaserPointer(OBSOLETE)"] = self._get_data(pdata, "iBddd", ("size", "type"))
elif ptype == 3:

if self.version >= (3, 0):
Expand All @@ -110,11 +118,29 @@ def parse(self, data):
# allData["varMessage"] = self._get_data(pdata, "!iBQbb iiBAcAc", ("size", "type", "timestamp", "source", "robotMessageType", "code", "argument", "titleSize", "messageTitle", "messageText"))
# elif ptype == 7:
# allData["keyMessage"] = self._get_data(pdata, "!iBQbb iiBAcAc", ("size", "type", "timestamp", "source", "robotMessageType", "code", "argument", "titleSize", "messageTitle", "messageText"))

elif ptype == 6:
fmt = "iB dddddddddddd dddddddddddd ddddd dddddd dddddd dddddd dddddd IIII"
tmpstr = ["size", "type"]
for i in range(0,6):
tmpstr += ["jointMinLimit%s" % i, "jointMaxLimit%s" % i]
for i in range(0,6):
tmpstr += ["jointMaxSpeed%s" % i, "jointMaxAcceleration%s" % i]
tmpstr += ["vJointDefault","aJointDefault","vToolDefault","aToolDefault","eqRadius"]
for name in ["DHa","Dhd","DHalpha","DHtheta"]:
for i in range(0,6):
tmpstr += ["%s%s" % (name,i)]
tmpstr += ["masterboardVersion","controllerBoxType","robotType","robotSubType"]
allData["ConfigurationData"] = self._get_data(pdata, fmt, tmpstr)
elif ptype == 20:
tmp = self._get_data(pdata, "!iB Qbb", ("size", "type", "timestamp", "source", "robotMessageType"))
if tmp["robotMessageType"] == 3:
allData["VersionMessage"] = self._get_data(pdata, "!iBQbb bAbBBiAb", ("size", "type", "timestamp", "source", "robotMessageType", "projectNameSize", "projectName", "majorVersion", "minorVersion", "svnRevision", "buildDate"))
tmpVersion = self._get_data(pdata, "!iBQbb bABB", ("size", "type", "timestamp", "source", "robotMessageType", "projectNameSize", "projectName", "majorVersion", "minorVersion"))
if (tmpVersion['majorVersion'],tmpVersion['minorVersion']) >= (3, 12):
fmt = "!iBQbb bABBiiA"
self.version = (tmpVersion['majorVersion'],tmpVersion['minorVersion'])
else:
fmt = "!iBQbb bAbBBiAb"
allData["VersionMessage"] = self._get_data(pdata, fmt, ("size", "type", "timestamp", "source", "robotMessageType", "projectNameSize", "projectName", "majorVersion", "minorVersion", "bugfixVersion", "buildNumber", "buildDate"))
elif tmp["robotMessageType"] == 6:
allData["robotCommMessage"] = self._get_data(pdata, "!iBQbb iiAc", ("size", "type", "timestamp", "source", "robotMessageType", "code", "argument", "messageText"))
elif tmp["robotMessageType"] == 1:
Expand All @@ -129,6 +155,8 @@ def parse(self, data):
allData["keyMessage"] = self._get_data(pdata, "!iBQbb iiBAcAc", ("size", "type", "timestamp", "source", "robotMessageType", "code", "argument", "titleSize", "messageTitle", "messageText"))
elif tmp["robotMessageType"] == 5:
allData["keyMessage"] = self._get_data(pdata, "!iBQbb iiAc", ("size", "type", "timestamp", "source", "robotMessageType", "code", "argument", "messageText"))
elif tmp["robotMessageType"] == 12:
allData["unknownMessage"] = self._get_data(pdata, "!iBQbb iib", ("size", "type", "timestamp", "source", "robotMessageType", "something1", "something2", "messageEnd?"))
else:
self.logger.debug("Message type parser not implemented %s", tmp)
else:
Expand All @@ -154,8 +182,9 @@ def _get_data(self, data, fmt, names):
j += 1
elif f == "A": # we got an array
# first we need to find its size
if j == len(fmt) - 2: # we are last element, size is the rest of data in packet
if j >= len(fmt) - 2: #added to account for later versions which don't add extra
arraysize = len(tmpdata)
j += 1
else: # size should be given in last element
asn = names[i - 1]
if not asn.endswith("Size"):
Expand All @@ -165,7 +194,7 @@ def _get_data(self, data, fmt, names):
d[names[i]] = tmpdata[0:arraysize]
# print "Array is ", names[i], d[names[i]]
tmpdata = tmpdata[arraysize:]
j += 2
j += 1
i += 1
else:
fmtsize = struct.calcsize(fmt[j])
Expand Down Expand Up @@ -206,7 +235,7 @@ def find_first_packet(self, data):
while True:
if len(data) >= 5:
psize, ptype = self.get_header(data)
if psize < 5 or psize > 2000 or ptype != 16:
if psize < 5 or psize > 2000 or (ptype != 20 and ptype != 16):
data = data[1:]
counter += 1
if counter > limit:
Expand Down