more renaming, fixed tabing
This commit is contained in:
parent
a6ae969769
commit
c9c1becc69
@ -18,22 +18,22 @@ class Tracker(Process):
|
||||
self._stop = Event()
|
||||
self._finished = Event()
|
||||
self._data = []
|
||||
if MATH3D:
|
||||
self.calibration = Transform()
|
||||
if MATH3D:
|
||||
self.calibration = math3d.Transform()
|
||||
self.inverse = self.calibration.inverse()
|
||||
|
||||
def _log(self, *args):
|
||||
print(self.__class__.__name__, ": ".join([str(i) for i in args]))
|
||||
|
||||
def set_calibration_matrix(self, cal):
|
||||
if MATH3D:
|
||||
if MATH3D:
|
||||
self.calibration = cal
|
||||
self.inverse = self.calibration.inverse()
|
||||
|
||||
def _save_data(self):
|
||||
if MATH3D:
|
||||
if MATH3D:
|
||||
for data in self._data:
|
||||
data["transform"] = self.inverse * Transform(data["tcp"])
|
||||
data["transform"] = self.inverse * math3d.Transform(data["tcp"])
|
||||
self._queue.put(self._data)
|
||||
|
||||
|
||||
|
@ -206,7 +206,7 @@ class SecondaryMonitor(Thread):
|
||||
self.start()
|
||||
self.wait()# make sure we got some data before someone calls us
|
||||
|
||||
def sendProgram(self, prog):
|
||||
def send_program(self, prog):
|
||||
"""
|
||||
send program to robot in URRobot format
|
||||
If another program is send while a program is running the first program is aborded.
|
||||
@ -279,7 +279,7 @@ class SecondaryMonitor(Thread):
|
||||
with self._dataEvent:
|
||||
self._dataEvent.wait()
|
||||
|
||||
def getCartesianInfo(self, wait=False):
|
||||
def get_cartesian_info(self, wait=False):
|
||||
if wait:
|
||||
self.wait()
|
||||
with self._dictLock:
|
||||
@ -288,7 +288,7 @@ class SecondaryMonitor(Thread):
|
||||
else:
|
||||
return None
|
||||
|
||||
def getAllData(self, wait=False):
|
||||
def get_all_data(self, wait=False):
|
||||
"""
|
||||
return last data obtained from robot in dictionnary format
|
||||
"""
|
||||
@ -297,7 +297,7 @@ class SecondaryMonitor(Thread):
|
||||
with self._dictLock:
|
||||
return self._dict.copy()
|
||||
|
||||
def getJointData(self, wait=False):
|
||||
def get_joint_data(self, wait=False):
|
||||
if wait:
|
||||
self.wait()
|
||||
with self._dictLock:
|
||||
@ -306,7 +306,7 @@ class SecondaryMonitor(Thread):
|
||||
else:
|
||||
return None
|
||||
|
||||
def isProgramRunning(self, wait=False):
|
||||
def is_program_running(self, wait=False):
|
||||
"""
|
||||
return True if robot is executing a program
|
||||
Rmq: The refresh rate is only 10Hz so the information may be outdated
|
||||
|
33
urx/urx.py
33
urx/urx.py
@ -65,12 +65,11 @@ class URRobot(object):
|
||||
if useRTInterface:
|
||||
self.rtmon.start()
|
||||
|
||||
self.start_pose = [1.57, -1.77, 1.57, -1.8, -1.57, -1.57]
|
||||
self.secmon.wait() # make sure we get data to not suprise clients
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
return "Robot Object (IP=%s, state=%s)" % (self.host, self.secmon.getAllData()["RobotModeData"])
|
||||
return "Robot Object (IP=%s, state=%s)" % (self.host, self.secmon.get_all_data()["RobotModeData"])
|
||||
|
||||
def __str__(self):
|
||||
return self.__repr__()
|
||||
@ -102,12 +101,6 @@ class URRobot(object):
|
||||
force += i**2
|
||||
return force**0.5
|
||||
|
||||
def moveToStartPose(self):
|
||||
"""
|
||||
move to pos defined in self.start_pose attribute
|
||||
"""
|
||||
self.movej(self.start_pose)
|
||||
|
||||
def set_tcp(self, x=0, y=0, z=0, a=0, b=0, c=0):
|
||||
"""
|
||||
"""
|
||||
@ -156,7 +149,7 @@ class URRobot(object):
|
||||
"""
|
||||
get analog input
|
||||
"""
|
||||
data = self.secmon.getAllData()
|
||||
data = self.secmon.get_all_data()
|
||||
return data["MasterBoardData"]["analogInput0"], data["MasterBoardData"]["analogInput1"]
|
||||
|
||||
|
||||
@ -164,21 +157,21 @@ class URRobot(object):
|
||||
"""
|
||||
get analog input
|
||||
"""
|
||||
data = self.secmon.getAllData()
|
||||
data = self.secmon.get_all_data()
|
||||
return data["MasterBoardData"]["analogInput" + str(nb)]
|
||||
|
||||
def get_digital_inBits(self):
|
||||
def get_digital_in_bits(self):
|
||||
"""
|
||||
get digital output
|
||||
"""
|
||||
data = self.secmon.getAllData()
|
||||
data = self.secmon.get_all_data()
|
||||
return data["MasterBoardData"]["digitalInputBits"]
|
||||
|
||||
def get_digital_in(self, nb):
|
||||
"""
|
||||
get digital output
|
||||
"""
|
||||
data = self.secmon.getAllData()
|
||||
data = self.secmon.get_all_data()
|
||||
val = data["MasterBoardData"]["digitalInputBits"]
|
||||
mask = 1 << nb
|
||||
if (val & mask):
|
||||
@ -186,11 +179,11 @@ class URRobot(object):
|
||||
else:
|
||||
return 0
|
||||
|
||||
def getDigitalOutput(self, val):
|
||||
def get_digital_out(self, val):
|
||||
"""
|
||||
get digital output
|
||||
"""
|
||||
data = self.secmon.getAllData()
|
||||
data = self.secmon.get_all_data()
|
||||
output = data["MasterBoardData"]["digitalOutputBits"]
|
||||
mask = 1 << val
|
||||
if (output & mask):
|
||||
@ -198,14 +191,14 @@ class URRobot(object):
|
||||
else:
|
||||
return 0
|
||||
|
||||
def setAnalogOut(self, output, val):
|
||||
def set_analog_out(self, output, val):
|
||||
"""
|
||||
set analog output, val is a float
|
||||
"""
|
||||
prog = "set_analog_output(%s, %s)" % (output, val)
|
||||
self.secmon.send_program(prog)
|
||||
|
||||
def setToolVoltage(self, val):
|
||||
def set_tool_voltage(self, val):
|
||||
"""
|
||||
set voltage to be delivered to the tool, val is 0, 12 or 24
|
||||
"""
|
||||
@ -232,7 +225,7 @@ class URRobot(object):
|
||||
while True:
|
||||
if not self.is_running():
|
||||
raise RobotException("Robot stopped")
|
||||
jts = self.secmon.getJointData(wait=True)
|
||||
jts = self.secmon.get_joint_data(wait=True)
|
||||
finished = True
|
||||
for i in range(0, 6):
|
||||
if abs(jts["q_actual%s"%i] - jts["q_targets%s"%i]) > self.radialEpsilon:
|
||||
@ -245,7 +238,7 @@ class URRobot(object):
|
||||
"""
|
||||
get joints position
|
||||
"""
|
||||
jts = self.secmon.getJointData(wait)
|
||||
jts = self.secmon.get_joint_data(wait)
|
||||
return [jts["q_actual0"], jts["q_actual1"], jts["q_actual2"], jts["q_actual3"], jts["q_actual4"], jts["q_actual5"]]
|
||||
|
||||
def movel(self, tpose, acc=0.01, vel=0.01, wait=True, relative=False):
|
||||
@ -268,7 +261,7 @@ class URRobot(object):
|
||||
"""
|
||||
get TCP position
|
||||
"""
|
||||
pose = self.secmon.getCartesianInfo(wait)
|
||||
pose = self.secmon.get_cartesian_info(wait)
|
||||
if pose:
|
||||
pose = [pose["X"], pose["Y"], pose["Z"], pose["Rx"], pose["Ry"], pose["Rz"]]
|
||||
self.logger.debug("Current pose from robot: " + str(pose))
|
||||
|
Loading…
x
Reference in New Issue
Block a user