bug in movel and movelrel
This commit is contained in:
parent
5f127b3b97
commit
3ed2040f28
26
urx/urx.py
26
urx/urx.py
@ -228,8 +228,9 @@ class URRobot(object):
|
|||||||
The RT interfaces is only used for the getForce related methods
|
The RT interfaces is only used for the getForce related methods
|
||||||
Rmq: A program sent to the robot i executed immendiatly and any running program is stopped
|
Rmq: A program sent to the robot i executed immendiatly and any running program is stopped
|
||||||
"""
|
"""
|
||||||
def __init__(self, host, useRTInterface=False):
|
def __init__(self, host, useRTInterface=False, debug=False):
|
||||||
self.host = host
|
self.host = host
|
||||||
|
self.debug = debug
|
||||||
|
|
||||||
self.secmon = SecondaryMonitor(self.host) #data from robot at 10Hz
|
self.secmon = SecondaryMonitor(self.host) #data from robot at 10Hz
|
||||||
|
|
||||||
@ -414,7 +415,8 @@ class URRobot(object):
|
|||||||
"""
|
"""
|
||||||
l = self.getl()
|
l = self.getl()
|
||||||
newl = [v + l[i] for i, v in enumerate(tpose)]
|
newl = [v + l[i] for i, v in enumerate(tpose)]
|
||||||
#print "going to: ", newl
|
if self.debug:
|
||||||
|
print("going to: ", newl)
|
||||||
return self.movel(newl, acc, vel, wait )
|
return self.movel(newl, acc, vel, wait )
|
||||||
|
|
||||||
def movel(self, tpose, acc=0.01, vel=0.01, wait=True):
|
def movel(self, tpose, acc=0.01, vel=0.01, wait=True):
|
||||||
@ -425,7 +427,8 @@ class URRobot(object):
|
|||||||
#todo: should check joints input and velocity
|
#todo: should check joints input and velocity
|
||||||
tpose = [round(i, 2) for i in tpose]
|
tpose = [round(i, 2) for i in tpose]
|
||||||
prog = "movel(p%s, a=%s, v=%s)" % (tpose, acc, vel)
|
prog = "movel(p%s, a=%s, v=%s)" % (tpose, acc, vel)
|
||||||
#print(prog)
|
if self.debug:
|
||||||
|
print("Sending: ", prog)
|
||||||
self.sendProgram(prog)
|
self.sendProgram(prog)
|
||||||
if not wait:
|
if not wait:
|
||||||
return None
|
return None
|
||||||
@ -444,9 +447,10 @@ class URRobot(object):
|
|||||||
"""
|
"""
|
||||||
pose = self.secmon.getCartesianInfo()
|
pose = self.secmon.getCartesianInfo()
|
||||||
if pose:
|
if pose:
|
||||||
return [pose["X"], pose["Y"], pose["Z"], pose["Rx"], pose["Ry"], pose["Rz"]]
|
pose = [pose["X"], pose["Y"], pose["Z"], pose["Rx"], pose["Ry"], pose["Rz"]]
|
||||||
else:
|
if self.debug:
|
||||||
return None
|
print("Got linear position from robot: ", pose)
|
||||||
|
return pose
|
||||||
|
|
||||||
def movels(self, joints, acc, vel , radius, wait=True):
|
def movels(self, joints, acc, vel , radius, wait=True):
|
||||||
"""
|
"""
|
||||||
@ -506,13 +510,14 @@ class Robot(object):
|
|||||||
and includes support for calibrating the robot coordinate system
|
and includes support for calibrating the robot coordinate system
|
||||||
and style portet to PEP 8
|
and style portet to PEP 8
|
||||||
"""
|
"""
|
||||||
def __init__(self, host, useRTInterface=False):
|
def __init__(self, host, useRTInterface=False, debug=False):
|
||||||
self.robot = URRobot(host, useRTInterface)
|
self.robot = URRobot(host, useRTInterface, debug)
|
||||||
self.default_linear_acceleration = 0.01
|
self.default_linear_acceleration = 0.01
|
||||||
self.default_linear_velocity = 0.01
|
self.default_linear_velocity = 0.01
|
||||||
|
|
||||||
self.calibration = math3d.Transform() #identity
|
self.calibration = math3d.Transform() #identity
|
||||||
self.inverse = self.calibration.inverse()
|
self.inverse = self.calibration.inverse()
|
||||||
|
self.tracker = None
|
||||||
|
|
||||||
def set_tcp(self, tcp):
|
def set_tcp(self, tcp):
|
||||||
if type(tcp) == math3d.Transform:
|
if type(tcp) == math3d.Transform:
|
||||||
@ -574,10 +579,10 @@ class Robot(object):
|
|||||||
|
|
||||||
def movel(self, pose, acc=None, vel=None, wait=True):
|
def movel(self, pose, acc=None, vel=None, wait=True):
|
||||||
t = math3d.Transform(pose)
|
t = math3d.Transform(pose)
|
||||||
self.apply_transform(self.inverse * t, acc, vel, wait)
|
self.apply_transform(t, acc, vel, wait)
|
||||||
|
|
||||||
def movelrel(self, pose, acc=None, vel=None, wait=True):
|
def movelrel(self, pose, acc=None, vel=None, wait=True):
|
||||||
self.apply_transform(math3d.Transform(pose), acc, vel, wait)
|
self.add_transform(math3d.Transform(pose), acc, vel, wait)
|
||||||
|
|
||||||
def movel_cnc(self, pose, acc=None, vel=None, wait=True):
|
def movel_cnc(self, pose, acc=None, vel=None, wait=True):
|
||||||
"""
|
"""
|
||||||
@ -634,7 +639,6 @@ class Robot(object):
|
|||||||
return t
|
return t
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if not MATH3D:
|
if not MATH3D:
|
||||||
Robot = URRobot
|
Robot = URRobot
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user