From 67cb0def0925299b067f668799d3687ecd1739fc Mon Sep 17 00:00:00 2001 From: Alvaro Capellan Date: Fri, 20 May 2016 17:24:22 +0200 Subject: [PATCH 1/8] new_csys_from_xpy: corrected calculation of vector inputs to math3d --- urx/robot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/urx/robot.py b/urx/robot.py index 3e07d1e..dff9383 100644 --- a/urx/robot.py +++ b/urx/robot.py @@ -227,7 +227,7 @@ class Robot(URRobot): input("Move to second point and click Enter") pose = URRobot.getl(self) p2 = m3d.Vector(pose[:3]) - return m3d.Transform.new_from_xyp(p1 - p0, p2 - p0, p0) + return m3d.Transform.new_from_xyp(p0 - p1, p2 - p1, p1) @property def x(self): From 41e494758e470e257b2ca0fd62685c7fc94895bd Mon Sep 17 00:00:00 2001 From: Alvaro Capellan Date: Wed, 25 May 2016 12:44:03 +0200 Subject: [PATCH 2/8] new_csys_from_xpy: reset csys, changed notation, print collected points --- urx/robot.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/urx/robot.py b/urx/robot.py index dff9383..ed73a12 100644 --- a/urx/robot.py +++ b/urx/robot.py @@ -214,20 +214,26 @@ class Robot(URRobot): Return new coordinate system from three points: X, Origin, Y based on math3d: Transform.new_from_xyp """ + # Set coord. sys. to 0 + self.csys = m3d.Transform() + print("A new coordinate system will be defined from the next three points") print("Firs point is X, second Origin, third Y") print("Set it as a new reference by calling myrobot.set_csys(new_csys)") input("Move to first point and click Enter") # we do not use get_pose so we avoid rounding values pose = URRobot.getl(self) + print("Introduced point defining X: {}".format(pose[:3])) + px = m3d.Vector(pose[:3]) + input("Move to second point and click Enter") + pose = URRobot.getl(self) + print("Introduced point defining Origo: {}".format(pose[:3])) p0 = m3d.Vector(pose[:3]) - input("Move to second point and click Enter") + input("Move to third point and click Enter") pose = URRobot.getl(self) - p1 = m3d.Vector(pose[:3]) - input("Move to second point and click Enter") - pose = URRobot.getl(self) - p2 = m3d.Vector(pose[:3]) - return m3d.Transform.new_from_xyp(p0 - p1, p2 - p1, p1) + print("Introduced point defining Y: {}".format(pose[:3])) + py = m3d.Vector(pose[:3]) + return m3d.Transform.new_from_xyp(px - p0, py - p0, p0) @property def x(self): From 63dff0051388e2d3abd17073e209f3a8c8691c8f Mon Sep 17 00:00:00 2001 From: Alvaro Capellan Date: Fri, 27 May 2016 13:45:02 +0200 Subject: [PATCH 3/8] Avoided to orient velocity for joint speedj in robot.py, likely named method from urrobot.py received wrong data --- urx/robot.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/urx/robot.py b/urx/robot.py index ed73a12..52c6b08 100644 --- a/urx/robot.py +++ b/urx/robot.py @@ -149,9 +149,13 @@ class Robot(URRobot): send command to robot formated like speedl or speedj move at given velocities until minimum min_time seconds """ - v = self.csys.orient * m3d.Vector(velocities[:3]) - w = self.csys.orient * m3d.Vector(velocities[3:]) - URRobot.speedx(self, command, np.concatenate((v.array, w.array)), acc, min_time) + if command != "speedj": + v = self.csys.orient * m3d.Vector(velocities[:3]) + w = self.csys.orient * m3d.Vector(velocities[3:]) + vels = np.concatenate((v.array, w.array)) + else: + vels = velocities + URRobot.speedx(self, command, vels, acc, min_time) def speedl_tool(self, velocities, acc, min_time): """ From e4b102b706ebbfacf6d6f007a2534644ec09ac24 Mon Sep 17 00:00:00 2001 From: Alvaro Capellan Date: Mon, 4 Jul 2016 10:30:05 +0200 Subject: [PATCH 4/8] set_analog_out: Send correct URScript program --- urx/urrobot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/urx/urrobot.py b/urx/urrobot.py index e909437..f6d9120 100644 --- a/urx/urrobot.py +++ b/urx/urrobot.py @@ -181,7 +181,7 @@ class URRobot(object): """ set analog output, val is a float """ - prog = "set_analog_output(%s, %s)" % (output, val) + prog = "set_analog_out(%s, %s)" % (output, val) self.send_program(prog) def set_tool_voltage(self, val): From 3b0e38868b59b0439aad3576207f1fa104683103 Mon Sep 17 00:00:00 2001 From: Alvaro Capellan Date: Mon, 4 Jul 2016 14:45:21 +0200 Subject: [PATCH 5/8] Updated Masterboard data format for 3.x UR firmware --- urx/ursecmon.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/urx/ursecmon.py b/urx/ursecmon.py index 70c017a..ce8dd1c 100644 --- a/urx/ursecmon.py +++ b/urx/ursecmon.py @@ -88,7 +88,9 @@ class ParserUtils(object): elif ptype == 5: allData["LaserPointer(OBSOLETE)"] = self._get_data(pdata, "iBddd", ("size", "type")) elif ptype == 3: - allData["MasterBoardData"] = self._get_data(pdata, "iBhhbbddbbddffffBBb", ("size", "type", "digitalInputBits", "digitalOutputBits", "analogInputRange0", "analogInputRange1", "analogInput0", "analogInput1", "analogInputDomain0", "analogInputDomain1", "analogOutput0", "analogOutput1", "masterBoardTemperature", "robotVoltage48V", "robotCurrent", "masterIOCurrent")) # , "masterSafetyState" ,"masterOnOffState", "euromap67InterfaceInstalled" )) + #fmt = "iBhhbbddbbddffffBBb" # firmware 1.6, 1.7, 1.8 + fmt = "iBiibbddbbddffffBBb" # firmware 3.0, 3.1, 3.2 + allData["MasterBoardData"] = self._get_data(pdata, fmt, ("size", "type", "digitalInputBits", "digitalOutputBits", "analogInputRange0", "analogInputRange1", "analogInput0", "analogInput1", "analogInputDomain0", "analogInputDomain1", "analogOutput0", "analogOutput1", "masterBoardTemperature", "robotVoltage48V", "robotCurrent", "masterIOCurrent")) # , "masterSafetyState" ,"masterOnOffState", "euromap67InterfaceInstalled" )) elif ptype == 2: allData["ToolData"] = self._get_data(pdata, "iBbbddfBffB", ("size", "type", "analoginputRange2", "analoginputRange3", "analogInput2", "analogInput3", "toolVoltage48V", "toolOutputVoltage", "toolCurrent", "toolTemperature", "toolMode")) elif ptype == 9: From 70e13773df2e3e4a879d7e25c445dde5bf5b4f39 Mon Sep 17 00:00:00 2001 From: Alvaro Capellan Date: Tue, 5 Jul 2016 16:41:36 +0200 Subject: [PATCH 6/8] Removed speedx method in robot.py for avoiding confusion: moved speedj and speedl methods to robot.py --- urx/robot.py | 20 +++++++++++--------- urx/urrobot.py | 12 ------------ 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/urx/robot.py b/urx/robot.py index 52c6b08..bed5130 100644 --- a/urx/robot.py +++ b/urx/robot.py @@ -144,18 +144,20 @@ class Robot(URRobot): trans = self.get_pose(wait) return trans.pos - def speedx(self, command, velocities, acc, min_time): + def speedl(self, velocities, acc, min_time): """ - send command to robot formated like speedl or speedj move at given velocities until minimum min_time seconds """ - if command != "speedj": - v = self.csys.orient * m3d.Vector(velocities[:3]) - w = self.csys.orient * m3d.Vector(velocities[3:]) - vels = np.concatenate((v.array, w.array)) - else: - vels = velocities - URRobot.speedx(self, command, vels, acc, min_time) + v = self.csys.orient * m3d.Vector(velocities[:3]) + w = self.csys.orient * m3d.Vector(velocities[3:]) + vels = np.concatenate((v.array, w.array)) + return self.speedx("speedl", vels, acc, min_time) + + def speedj(self, velocities, acc, min_time): + """ + move at given joint velocities until minimum min_time seconds + """ + return self.speedx("speedj", velocities, acc, min_time) def speedl_tool(self, velocities, acc, min_time): """ diff --git a/urx/urrobot.py b/urx/urrobot.py index f6d9120..5b389c3 100644 --- a/urx/urrobot.py +++ b/urx/urrobot.py @@ -258,18 +258,6 @@ class URRobot(object): prog = "{}([{},{},{},{},{},{}], a={}, t_min={})".format(command, *vels) self.send_program(prog) - def speedl(self, velocities, acc, min_time): - """ - move at given velocities until minimum min_time seconds - """ - return self.speedx("speedl", velocities, acc, min_time) - - def speedj(self, velocities, acc, min_time): - """ - move at given joint velocities until minimum min_time seconds - """ - return self.speedx("speedj", velocities, acc, min_time) - def movej(self, joints, acc=0.1, vel=0.05, wait=True, relative=False, threshold=None): """ move in joint space From 58be13fdd3a0e72e39352d63471b2e2c617f5ba8 Mon Sep 17 00:00:00 2001 From: Alvaro Capellan Date: Tue, 5 Jul 2016 16:47:32 +0200 Subject: [PATCH 7/8] new_csys_from_xpy: Restore coord. system inside method --- urx/robot.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/urx/robot.py b/urx/robot.py index bed5130..51ad313 100644 --- a/urx/robot.py +++ b/urx/robot.py @@ -217,7 +217,8 @@ class Robot(URRobot): def new_csys_from_xpy(self): """ - Return new coordinate system from three points: X, Origin, Y + Restores and returns new coordinate system calculated from three points: X, Origin, Y + based on math3d: Transform.new_from_xyp """ # Set coord. sys. to 0 @@ -239,7 +240,11 @@ class Robot(URRobot): pose = URRobot.getl(self) print("Introduced point defining Y: {}".format(pose[:3])) py = m3d.Vector(pose[:3]) - return m3d.Transform.new_from_xyp(px - p0, py - p0, p0) + + new_csys = m3d.Transform.new_from_xyp(px - p0, py - p0, p0) + self.set_csys(new_csys) + + return new_csys @property def x(self): From b6eb54566d8f303800a606ea0aba397e81d7ad78 Mon Sep 17 00:00:00 2001 From: Alvaro Capellan Date: Tue, 9 Aug 2016 11:38:47 +0200 Subject: [PATCH 8/8] Parse MasterBoardData correctly for all firmware versions --- urx/ursecmon.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/urx/ursecmon.py b/urx/ursecmon.py index ce8dd1c..197ea74 100644 --- a/urx/ursecmon.py +++ b/urx/ursecmon.py @@ -88,8 +88,12 @@ class ParserUtils(object): elif ptype == 5: allData["LaserPointer(OBSOLETE)"] = self._get_data(pdata, "iBddd", ("size", "type")) elif ptype == 3: - #fmt = "iBhhbbddbbddffffBBb" # firmware 1.6, 1.7, 1.8 - fmt = "iBiibbddbbddffffBBb" # firmware 3.0, 3.1, 3.2 + + if self.version >= (3, 0): + fmt = "iBiibbddbbddffffBBb" # firmware >= 3.0 + else: + fmt = "iBhhbbddbbddffffBBb" # firmware < 3.0 + allData["MasterBoardData"] = self._get_data(pdata, fmt, ("size", "type", "digitalInputBits", "digitalOutputBits", "analogInputRange0", "analogInputRange1", "analogInput0", "analogInput1", "analogInputDomain0", "analogInputDomain1", "analogOutput0", "analogOutput1", "masterBoardTemperature", "robotVoltage48V", "robotCurrent", "masterIOCurrent")) # , "masterSafetyState" ,"masterOnOffState", "euromap67InterfaceInstalled" )) elif ptype == 2: allData["ToolData"] = self._get_data(pdata, "iBbbddfBffB", ("size", "type", "analoginputRange2", "analoginputRange3", "analogInput2", "analogInput3", "toolVoltage48V", "toolOutputVoltage", "toolCurrent", "toolTemperature", "toolMode"))