diff --git a/devices/led_ctrl_1.properties b/devices/led_ctrl_1.properties
index 5927139..c4fe54c 100644
--- a/devices/led_ctrl_1.properties
+++ b/devices/led_ctrl_1.properties
@@ -1,4 +1,4 @@
-#Mon Sep 24 16:01:28 CEST 2018
+#Mon Oct 15 11:33:41 CEST 2018
maxValue=1.0
minValue=0.0
offset=0.0
diff --git a/devices/led_ctrl_2.properties b/devices/led_ctrl_2.properties
index 5927139..c4fe54c 100644
--- a/devices/led_ctrl_2.properties
+++ b/devices/led_ctrl_2.properties
@@ -1,4 +1,4 @@
-#Mon Sep 24 16:01:28 CEST 2018
+#Mon Oct 15 11:33:41 CEST 2018
maxValue=1.0
minValue=0.0
offset=0.0
diff --git a/devices/led_ctrl_3.properties b/devices/led_ctrl_3.properties
index 5927139..c4fe54c 100644
--- a/devices/led_ctrl_3.properties
+++ b/devices/led_ctrl_3.properties
@@ -1,4 +1,4 @@
-#Mon Sep 24 16:01:28 CEST 2018
+#Mon Oct 15 11:33:41 CEST 2018
maxValue=1.0
minValue=0.0
offset=0.0
diff --git a/plugins/Commands.form b/plugins/Commands.form
index c7911a6..f263024 100644
--- a/plugins/Commands.form
+++ b/plugins/Commands.form
@@ -381,13 +381,14 @@
-
+
+
-
+
@@ -395,8 +396,9 @@
+
-
+
@@ -410,15 +412,20 @@
-
-
+
+
-
-
+
+
-
+
+
+
+
+
+
@@ -527,12 +534,28 @@
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/Commands.java b/plugins/Commands.java
index 8a73abc..c542995 100644
--- a/plugins/Commands.java
+++ b/plugins/Commands.java
@@ -53,7 +53,7 @@ public class Commands extends Panel {
for (Component c: SwingUtils.getComponentsByType(this, JComponent.class)){
c.setEnabled(state == State.Ready);
}
- buttonHomingHexiposi.setEnabled(state == State.Ready);
+ buttonMoveAux.setEnabled(state == State.Ready);
}
@Override
@@ -148,7 +148,9 @@ public class Commands extends Panel {
buttonMoveScanner = new javax.swing.JButton();
buttonGetDewar = new javax.swing.JButton();
buttonPutDewar = new javax.swing.JButton();
- buttonHomingHexiposi = new javax.swing.JButton();
+ buttonMoveAux = new javax.swing.JButton();
+ buttonGetAux = new javax.swing.JButton();
+ buttonPutAux = new javax.swing.JButton();
pnDatabase = new javax.swing.JPanel();
buttonClearSampleDb = new javax.swing.JButton();
buttonResetPuckIds = new javax.swing.JButton();
@@ -437,10 +439,24 @@ public class Commands extends Panel {
}
});
- buttonHomingHexiposi.setText("Homing Hexiposi");
- buttonHomingHexiposi.addActionListener(new java.awt.event.ActionListener() {
+ buttonMoveAux.setText("Move Aux");
+ buttonMoveAux.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonHomingHexiposiActionPerformed(evt);
+ buttonMoveAuxActionPerformed(evt);
+ }
+ });
+
+ buttonGetAux.setText("Get Aux");
+ buttonGetAux.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonGetAuxActionPerformed(evt);
+ }
+ });
+
+ buttonPutAux.setText("Put Aux");
+ buttonPutAux.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonPutAuxActionPerformed(evt);
}
});
@@ -452,23 +468,25 @@ public class Commands extends Panel {
.addContainerGap()
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonMovePark, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buttonHomingHexiposi)
+ .addComponent(buttonMoveAux)
.addComponent(buttonMoveCold, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonMoveHeater)
.addComponent(buttonGetGonio)
- .addComponent(buttonGetDewar, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(buttonGetDewar, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buttonGetAux, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 54, Short.MAX_VALUE)
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonPutDewar, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonPutGonio, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonMoveGonio, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonMoveHome, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonMoveDewar, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buttonMoveScanner))
+ .addComponent(buttonMoveScanner)
+ .addComponent(buttonPutAux, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
- pnLowLevelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonGetDewar, buttonGetGonio, buttonHomingHexiposi, buttonMoveCold, buttonMoveDewar, buttonMoveGonio, buttonMoveHeater, buttonMoveHome, buttonMovePark, buttonMoveScanner, buttonPutDewar, buttonPutGonio});
+ pnLowLevelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonGetAux, buttonGetDewar, buttonGetGonio, buttonMoveAux, buttonMoveCold, buttonMoveDewar, buttonMoveGonio, buttonMoveHeater, buttonMoveHome, buttonMovePark, buttonMoveScanner, buttonPutAux, buttonPutDewar, buttonPutGonio});
pnLowLevelLayout.setVerticalGroup(
pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -479,13 +497,17 @@ public class Commands extends Panel {
.addComponent(buttonPutDewar))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(buttonGetGonio)
- .addComponent(buttonPutGonio))
+ .addComponent(buttonGetAux)
+ .addComponent(buttonPutAux))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(buttonMoveGonio)
- .addComponent(buttonHomingHexiposi))
+ .addComponent(buttonGetGonio)
+ .addComponent(buttonPutGonio))
.addGap(18, 18, 18)
+ .addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(buttonMoveGonio)
+ .addComponent(buttonMoveAux))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonMovePark)
.addComponent(buttonMoveHome))
@@ -620,9 +642,9 @@ public class Commands extends Panel {
}//GEN-LAST:event_buttonMountActionPerformed
- private void buttonHomingHexiposiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonHomingHexiposiActionPerformed
- execute("homing_hexiposi()");
- }//GEN-LAST:event_buttonHomingHexiposiActionPerformed
+ private void buttonMoveAuxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveAuxActionPerformed
+ execute("move_aux()");
+ }//GEN-LAST:event_buttonMoveAuxActionPerformed
private void buttonUnmountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUnmountActionPerformed
String segment = (String) spinnerSegment.getValue();
@@ -721,14 +743,25 @@ public class Commands extends Panel {
execute("scan_puck('" + segment + "'," + puck + ", force=" + force + ")", false, true);
}//GEN-LAST:event_buttonScanPin1ActionPerformed
+ private void buttonGetAuxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonGetAuxActionPerformed
+ int sample = (Integer) spinnerSample.getValue();
+ execute("get_aux('" + sample + ")");
+ }//GEN-LAST:event_buttonGetAuxActionPerformed
+
+ private void buttonPutAuxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPutAuxActionPerformed
+ int sample = (Integer) spinnerSample.getValue();
+ execute("put_aux('" + sample + ")");
+ }//GEN-LAST:event_buttonPutAuxActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonClearSampleDb;
private javax.swing.JButton buttonDry;
private javax.swing.JButton buttonEnableAll;
+ private javax.swing.JButton buttonGetAux;
private javax.swing.JButton buttonGetDewar;
private javax.swing.JButton buttonGetGonio;
- private javax.swing.JButton buttonHomingHexiposi;
private javax.swing.JButton buttonMount;
+ private javax.swing.JButton buttonMoveAux;
private javax.swing.JButton buttonMoveCold;
private javax.swing.JButton buttonMoveDewar;
private javax.swing.JButton buttonMoveGonio;
@@ -736,6 +769,7 @@ public class Commands extends Panel {
private javax.swing.JButton buttonMoveHome;
private javax.swing.JButton buttonMovePark;
private javax.swing.JButton buttonMoveScanner;
+ private javax.swing.JButton buttonPutAux;
private javax.swing.JButton buttonPutDewar;
private javax.swing.JButton buttonPutGonio;
private javax.swing.JButton buttonRecover;
diff --git a/plugins/HexiposiPanel.java b/plugins/HexiposiPanel.java
index 64ae671..b29a526 100644
--- a/plugins/HexiposiPanel.java
+++ b/plugins/HexiposiPanel.java
@@ -87,7 +87,8 @@ public class HexiposiPanel extends DevicePanel {
private void buttonHomingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonHomingActionPerformed
try {
- Context.getInstance().evalLineAsync("hexiposi.move_home()").handle((ret, ex) -> {
+ //Context.getInstance().evalLineAsync("hexiposi.move_home()").handle((ret, ex) -> {
+ Context.getInstance().evalLineAsync("homing_hexiposi()").handle((ret, ex) -> {
if (ex != null){
showException((Exception)ex);
}
diff --git a/script/calibration/ToolCalibration2.py b/script/calibration/ToolCalibration2.py
index b90289e..e9b71ae 100644
--- a/script/calibration/ToolCalibration2.py
+++ b/script/calibration/ToolCalibration2.py
@@ -54,7 +54,7 @@ off_x = x1 - x2
#For composing cannot use tcp_p, need another auxiliary point. tcp_t is also destroyed.
robot.set_pnt(robot.get_cartesian_pos(), "pTemp")
robot.set_trsf([off_x, 0,0,0,0,0])
-c=robot.compose("pTemp", "fTable", "tcp_t" )
+c=robot.compose("pTemp", FRAME_TABLE, "tcp_t" )
robot.set_pnt(c, "pTemp")
robot.movel("pTemp", cal_tool, DESC_SCAN, sync=True)
diff --git a/script/calibration/ToolCalibration3.py b/script/calibration/ToolCalibration3.py
index e1ee185..969707d 100644
--- a/script/calibration/ToolCalibration3.py
+++ b/script/calibration/ToolCalibration3.py
@@ -4,6 +4,7 @@ from mathutils import fit_gaussian, Gaussian
cal_tool = TOOL_CALIBRATION
robot.set_tool(cal_tool)
+
robot.enable()
move_to_laser()
@@ -13,13 +14,16 @@ robot.set_joint_motors_enabled(True)
initial_pos = robot.get_cartesian_pos()
#robot.align()
-
-run("calibration/ScanX")
+try:
+ robot.set_frame(FRAME_TABLE)
+ run("calibration/ScanX")
+finally:
+ robot.set_default_frame()
pos1 = robot.get_cartesian_pos()
x1, l1 = closest_x, closest_y
-print "Closest 1: ", [x1, l1]
+print "Scan 1 result: ", [x1, l1]
print "Position 1: ", pos1
@@ -30,31 +34,45 @@ else:
robot_j6.move(pj6 + 180.0)
-run("calibration/ScanX")
-
+try:
+ robot.set_frame(FRAME_TABLE)
+ run("calibration/ScanX")
+finally:
+ robot.set_default_frame()
+pos2 =robot.get_cartesian_pos()
x2, l2 = closest_x, closest_y
-pos2 = robot.get_cartesian_pos()
-print "Closest 2: ", [x2, l2]
-print "Position 2: ", pos2
+print "Scan 2 result: ", [x2, l2]
+print "Position 2: ", pos1
+
+off_l = l2 - l1
+print "Offset l: ", off_l
+
+#For composing cannot use tcp_p, need another auxiliary point. tcp_t is also destroyed.
+robot.set_pnt(robot.get_cartesian_pos(), "pTemp")
+robot.set_trsf([0, -off_l, 0, 0, 0, 0])
+c=robot.compose("pTemp", FRAME_TABLE, "tcp_t" )
+robot.set_pnt(c, "pTemp")
+robot.movel("pTemp", cal_tool, DESC_SCAN, sync=True)
+
+
+pos3 = robot.get_cartesian_pos()
+print "Position 3: ", pos3
#Updates the tool
t=robot.get_tool_trsf(TOOL_DEFAULT)
+print "Former tool: " + str(t)
-xoff = (x1-x2)/2
-yoff = (l2 - l1)/2
+xoff = (pos3[0]-pos1[0])/2
+yoff = (pos3[1]-pos1[1])/2
xrot = math.degrees(math.atan(yoff/t[2]))
yrot = math.degrees(math.atan(xoff/t[2]))
-
-print "Former tool: " + str(t)
t[0]=xoff
t[1]=-yoff
-print "Offset: ", [t[0], t[1]]
-
-print "CALIBRATED tool: " + str(t)
-#robot.set_tool_trsf(t, TOOL_DEFAULT)
+print "Calibrated tool: " + str(t)
+robot.set_tool_trsf(t, TOOL_DEFAULT)
robot.set_tool(TOOL_DEFAULT)
d = robot.get_distance_to_pnt("pLaser")
diff --git a/script/devices/RobotSC.py b/script/devices/RobotSC.py
index fbfb9a1..1ec04f6 100644
--- a/script/devices/RobotSC.py
+++ b/script/devices/RobotSC.py
@@ -2,11 +2,15 @@ TOOL_CALIBRATION = "tCalib"
TOOL_SUNA= "tSuna"
TOOL_DEFAULT= TOOL_SUNA
+FRAME_TABLE = "fTable"
+
DESC_FAST = "mFast"
DESC_SLOW = "mSlow"
DESC_SCAN = "mScan"
DESC_DEFAULT = DESC_FAST
+AUX_SEGMENT = "X"
+
DEFAULT_ROBOT_POLLING = 500
TASK_WAIT_ROBOT_POLLING = 50
@@ -22,8 +26,8 @@ joint_forces = False
class RobotSC(RobotTCP):
def __init__(self, name, server, timeout = 1000, retries = 1):
RobotTCP.__init__(self, name, server, timeout, retries)
- self.set_tasks(["getDewar", "putDewar", "putGonio", "getGonio", "robotRecover", "moveDewar", "moveCold", "movePark", "moveGonio","moveHeater", "moveScanner","moveHome"])
- self.set_known_points(["pPark", "pGonioHome", "pDewarWait", "pGonioGet", "pScanHome", "pHeaterHome", "pHeater", "pHeaterBottom", "pScanStop","pHelium", "pHome", "pCold"])
+ self.set_tasks(["getDewar", "putDewar", "putGonio", "getGonio", "recover", "moveDewar", "moveCold", "movePark", "moveGonio","moveHeater", "moveScanner","moveHome", "moveAux"])
+ self.set_known_points(["pPark", "pGonio", "pDewar", "pGonioG", "pScan", "pHeater", "pHeat", "pHeatB", "pScanStop","pHelium", "pHome", "pCold", "pAux"])
self.setPolling(DEFAULT_ROBOT_POLLING)
def move_dewar(self):
@@ -53,12 +57,12 @@ class RobotSC(RobotTCP):
self.start_task('putDewar',segment, puck, sample, is_room_temp())
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
#self.assert_dewar()
- self.assert_cold
+ self.assert_cold()
def put_gonio(self):
pin_offset = get_pin_offset()
pin_angle_offset = get_pin_angle_offset()
- self.start_task('putGonio', pin_offset, pin_angle_offset)
+ self.start_task('putGonio', pin_offset)
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
self.assert_gonio()
@@ -68,6 +72,18 @@ class RobotSC(RobotTCP):
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
self.assert_gonio()
+ def get_aux(self, sample):
+ self.assert_aux()
+ self.start_task('getAuxiliary', sample)
+ self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
+ self.assert_aux()
+
+ def put_aux(self, sample):
+ self.assert_aux()
+ self.start_task('putAuxiliary', sample)
+ self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
+ self.assert_aux()
+
def move_scanner(self):
self.start_task('moveScanner')
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
@@ -104,10 +120,15 @@ class RobotSC(RobotTCP):
def robot_recover(self):
- self.start_task('robotRecover')
+ self.start_task('recover')
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
self.assert_home()
+ def move_aux(self):
+ self.start_task('moveAux')
+ self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
+ self.assert_aux()
+
def toSegmentNumber(self, segment):
if is_string(segment):
segment = ord(segment.upper()) - ord('A') +1
@@ -158,25 +179,28 @@ class RobotSC(RobotTCP):
return self.is_in_point("pHome")
def is_dewar(self):
- return self.is_in_point("pDewarWait")
+ return self.is_in_point("pDewar")
def is_heater(self):
- return self.is_in_point("pHeater")
+ return self.is_in_point("pHeat")
def is_heater_home(self):
- return self.is_in_point("pHeaterHome")
+ return self.is_in_point("pHeater")
def is_heater_bottom(self):
- return self.is_in_point("pHeaterBottom")
+ return self.is_in_point("pHeatB")
def is_gonio(self):
- return self.is_in_point("pGonioHome")
+ return self.is_in_point("pGonio")
def is_helium(self):
return self.is_in_point("pHelium")
def is_scanner(self):
- return self.is_in_point("pScanHome")
+ return self.is_in_point("pScan")
+
+ def is_aux(self):
+ return self.is_in_point("pAux")
#def is_scan_stop(self):
# return self.is_in_point("pScanStop")
@@ -186,16 +210,16 @@ class RobotSC(RobotTCP):
return self.get_current_point() is not None
def assert_heater_home(self):
- self.assert_in_point("pHeaterHome")
+ self.assert_in_point("pHeater")
def assert_cold(self):
self.assert_in_point("pCold")
def assert_heater(self):
- self.assert_in_point("pHeater")
+ self.assert_in_point("pHeat")
def assert_heater_bottom(self):
- self.assert_in_point("pHeaterBottom")
+ self.assert_in_point("pHeatB")
def assert_park(self):
self.assert_in_point("pPark")
@@ -204,16 +228,19 @@ class RobotSC(RobotTCP):
self.assert_in_point("pHome")
def assert_dewar(self):
- self.assert_in_point("pDewarWait")
+ self.assert_in_point("pDewar")
def assert_gonio(self):
- self.assert_in_point("pGonioHome")
+ self.assert_in_point("pGonio")
def assert_helium(self):
self.assert_in_point("pHelium")
def assert_scanner(self):
- self.assert_in_point("pScanHome")
+ self.assert_in_point("pScan")
+
+ def assert_aux(self):
+ self.assert_in_point("pAux")
#def assert_scan_stop(self):
# self.assert_in_point("pScanStop")
@@ -236,6 +263,7 @@ else:
robot.set_default_desc(DESC_DEFAULT)
robot.default_speed = 20
+robot.set_frame(FRAME_DEFAULT)
robot.set_tool(TOOL_DEFAULT)
robot.setPolling(DEFAULT_ROBOT_POLLING)
diff --git a/script/devices/RobotTCP.py b/script/devices/RobotTCP.py
index 5df7078..10fb0f1 100644
--- a/script/devices/RobotTCP.py
+++ b/script/devices/RobotTCP.py
@@ -69,7 +69,20 @@ class RobotTCP(TcpDevice, Stoppable):
def get_tool(self):
return self.tool
+ def set_frame(self, frame):
+ self.frame = frame
+ self.evaluate("tcp_curframe=" + frame)
+ if self.cartesian_motors_enabled:
+ self.update()
+ self.set_motors_enabled(True)
+ self.waitCacheChange(5000)
+
+ def get_frame(self):
+ return self.frame
+ def set_default_frame(self):
+ self.set_frame(FRAME_DEFAULT)
+
def assert_tool(self, tool=None):
if tool is None:
if self.tool is None:
@@ -470,15 +483,18 @@ class RobotTCP(TcpDevice, Stoppable):
def distance_p(self, pnt1, pnt2):
return self.eval_float("distance(" + pnt1 + ", " + pnt2 + ")")
- def compose(self, pnt, frame = FRAME_DEFAULT, trsf = "tcp_t"):
+ def compose(self, pnt, frame = None, trsf = "tcp_t"):
+ if frame is None: frame = self.frame
return self.eval_pnt("compose(" + pnt + ", " + frame + ", " + trsf + ")")
- def here(self, tool=None, frame=FRAME_DEFAULT):
+ def here(self, tool=None, frame=None):
if tool is None: tool = self.tool
+ if frame is None: frame = self.frame
return self.eval_pnt("here(" + tool + ", " + frame + ")")
- def joint_to_point(self, tool=None, frame=FRAME_DEFAULT, joint="tcp_j"):
+ def joint_to_point(self, tool=None, frame=None, joint="tcp_j"):
if tool is None: tool = self.tool
+ if frame is None: frame = self.frame
return self.eval_pnt("jointToPoint(" + tool + ", " + frame + ", " + joint +")")
def point_to_joint(self, tool=None, initial_joint="tcp_j", point="tcp_p"):
@@ -486,7 +502,8 @@ class RobotTCP(TcpDevice, Stoppable):
if self.eval_bool("pointToJoint(" + tool + ", " + initial_joint + ", " + point +", j)"):
return self.get_jnt()
- def position(self, point, frame=FRAME_DEFAULT):
+ def position(self, point, frame=None):
+ if frame is None: frame = self.frame
return self.eval_trf("position(" + point + ", " + frame + ")")
#Profile
@@ -715,14 +732,15 @@ class RobotTCP(TcpDevice, Stoppable):
for m in self.joint_motors:
m.initialize()
#Alignment
- def align(self, point = None, frame = FRAME_DEFAULT, desc = None):
+ def align(self, point = None, frame = None, desc = None):
+ if frame is None: frame = self.frame
self.assert_tool()
if desc is None: desc = self.default_desc
if point is None:
self.get_cartesian_pos()
else:
self.set_pnt(point)
- np=self.eval_trf('align(tcp_p.trsf, ' + FRAME_DEFAULT + '.trsf)')
+ np=self.eval_trf('align(tcp_p.trsf, ' + frame + '.trsf)')
self.set_pnt(np)
self.movej("tcp_p", self.tool, desc)
#TODO: The first command is not executed (but receive a move id)
diff --git a/script/local.py b/script/local.py
index da251ff..3d405f0 100644
--- a/script/local.py
+++ b/script/local.py
@@ -93,6 +93,9 @@ run("motion/move_home")
run("motion/move_park")
run("motion/move_cold")
run("motion/move_scanner")
+run("motion/move_aux")
+run("motion/get_aux")
+run("motion/put_aux")
run("motion/dry")
run("motion/homing_hexiposi")
run("motion/scan_pin")
@@ -123,6 +126,8 @@ def get_puck_img_detection(segment, puck):
return str(Controller.getInstance().getPuck(str(segment).upper() + str(puck)).imageDetection)
def assert_puck_detected(segment, puck):
+ if (segment == AUX_SEGMENT) and (puck == 1):
+ return
if get_puck_elect_detection(segment, puck) != "Present":
raise Exception ("Puck " + str(segment).upper() + str(puck) + " not present")
@@ -163,6 +168,7 @@ except:
try:
robot.setPolling(DEFAULT_ROBOT_POLLING)
robot.set_tool(TOOL_DEFAULT)
+ robot.set_frame(FRAME_DEFAULT)
robot.set_motors_enabled(True)
robot.set_joint_motors_enabled(True)
except:
diff --git a/script/motion/get_aux.py b/script/motion/get_aux.py
new file mode 100644
index 0000000..67bfc7d
--- /dev/null
+++ b/script/motion/get_aux.py
@@ -0,0 +1,21 @@
+def get_aux(sample):
+ """
+ """
+ print "get_aux: ",sample
+
+ #Initial checks
+ assert_valid_sample(sample)
+
+ robot.assert_no_task()
+ robot.reset_motion()
+ robot.wait_ready()
+ robot.assert_cleared()
+ hexiposi.assert_homed()
+
+ #Enabling
+ enable_motion()
+
+ if not robot.is_aux():
+ robot.move_aux()
+
+ robot.get_aux(sample)
diff --git a/script/motion/mount.py b/script/motion/mount.py
index ca4fbb0..4ef32b7 100644
--- a/script/motion/mount.py
+++ b/script/motion/mount.py
@@ -9,6 +9,7 @@ def mount(segment, puck, sample, force=False, read_dm=False):
start = time.time()
+ is_aux = segment == AUX_SEGMENT
puck_address = get_puck_address(puck)
if puck_address is None:
puck_obj = get_puck_obj_by_id(puck)
@@ -39,16 +40,24 @@ def mount(segment, puck, sample, force=False, read_dm=False):
#Enabling
enable_motion()
-
- set_hexiposi(segment)
-
- if not force:
- visual_check_hexiposi(segment)
-
- if not robot.is_dewar():
- robot.move_dewar()
+
+ if is_aux:
+ if not robot.is_aux():
+ robot.move_aux()
- robot.get_dewar(segment, puck, sample)
+ robot.get_aux(sample)
+ robot.move_home()
+
+ else:
+ set_hexiposi(segment)
+
+ if not force:
+ visual_check_hexiposi(segment)
+
+ if not robot.is_dewar():
+ robot.move_dewar()
+
+ robot.get_dewar(segment, puck, sample)
set_setting("mounted_sample_position", get_sample_name(segment, puck, sample))
@@ -77,18 +86,22 @@ def mount(segment, puck, sample, force=False, read_dm=False):
dry_mount_count = 0
set_setting("dry_mount_counter", dry_mount_count+1)
#TODO: Auto-dry procedure
-
- robot.move_cold()
- mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
- #TODO: Should do on finally?
- update_samples_info_sample_mount(get_puck_name(segment, puck), sample, mount_sample_detected, mount_sample_id)
- if mount_sample_detected == False:
- raise Exception("No pin detected on gonio")
-
- if is_force_dry():
- print "Auto dry"
- log("Starting auto dry", False)
- dry()
+
+ if is_aux:
+ robot.move_home()
+ else:
+ robot.move_cold()
+
+ mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
+ #TODO: Should do on finally?
+ update_samples_info_sample_mount(get_puck_name(segment, puck), sample, mount_sample_detected, mount_sample_id)
+ if mount_sample_detected == False:
+ raise Exception("No pin detected on gonio")
+
+ if is_force_dry():
+ print "Auto dry"
+ log("Starting auto dry", False)
+ dry()
return [mount_sample_detected, mount_sample_id]
finally:
smart_magnet.set_default_current()
diff --git a/script/motion/move_aux.py b/script/motion/move_aux.py
new file mode 100644
index 0000000..94d6468
--- /dev/null
+++ b/script/motion/move_aux.py
@@ -0,0 +1,18 @@
+def move_aux():
+ """
+ """
+ print "move_aux"
+
+ #Initial checks
+ robot.assert_no_task()
+ robot.reset_motion()
+ robot.wait_ready()
+ robot.assert_cleared()
+ #robot.assert_in_known_point()
+
+ #Enabling
+ enable_motion()
+
+
+ if not robot.is_aux():
+ robot.move_aux()
\ No newline at end of file
diff --git a/script/motion/put_aux.py b/script/motion/put_aux.py
new file mode 100644
index 0000000..c41ee81
--- /dev/null
+++ b/script/motion/put_aux.py
@@ -0,0 +1,21 @@
+def put_aux(sample):
+ """
+ """
+ print "put_aux: ",sample
+
+ #Initial checks
+ assert_valid_sample(sample)
+
+ robot.assert_no_task()
+ robot.reset_motion()
+ robot.wait_ready()
+ robot.assert_cleared()
+ hexiposi.assert_homed()
+
+ #Enabling
+ enable_motion()
+
+ if not robot.is_aux():
+ robot.move_aux()
+
+ robot.put_aux(sample)
diff --git a/script/motion/recover.py b/script/motion/recover.py
index 9a5e347..97d430e 100644
--- a/script/motion/recover.py
+++ b/script/motion/recover.py
@@ -6,14 +6,15 @@ RECOVER_DESC = "mRecovery"
RECOVER_TOOL = TOOL_DEFAULT
known_segments = [ ("pHome", "pPark", 50), \
- ("pHome", "pGonioHome", 30), \
- ("pHome", "pScanHome", 25), \
- ("pHome", "pHeaterHome", 75), \
- ("pHome", "pDewarWait", 10), \
+ ("pHome", "pGonioH", 30), \
+ ("pHome", "pScan", 25), \
+ ("pHome", "pHeater", 75), \
+ ("pHome", "pDewar", 10), \
("pHome", "pHelium", 230), \
- ("pGonioHome", "pGonioGet", 10), \
- ("pPark", "pHeater", 40), \
- ("pHeaterHome", "pHeaterBottom", 10), \
+ ("pGonioH", "pGonioG", 10), \
+ ("pPark", "pHeat", 40), \
+ ("pHeater", "pHeatB", 10), \
+ ("pPark", "pAux", 30), \
]
def get_dist_to_line(segment):
diff --git a/script/motion/scan_pin.py b/script/motion/scan_pin.py
index 7e35def..5deaa61 100644
--- a/script/motion/scan_pin.py
+++ b/script/motion/scan_pin.py
@@ -31,8 +31,13 @@ def scan_pin(segment, puck, sample, force=False):
robot.move_dewar()
robot.put_dewar(segment, puck, sample)
-
- return (detected, dm)
+ ret = "Empty"
+ if detected:
+ if (dm is None) or (len(dm.strip())==0):
+ ret = "Present"
+ else:
+ ret = str(dm)
+ return ret
def scan_puck(segment, puck, force=False):
diff --git a/script/motion/tools.py b/script/motion/tools.py
index 40e141e..b45f5ae 100644
--- a/script/motion/tools.py
+++ b/script/motion/tools.py
@@ -129,6 +129,8 @@ def update_tool(tool=None, x_offset=0.0, y_offset=0.0, z_offset=0.0):
def assert_valid_address(segment, puck, sample):
+ if (segment == AUX_SEGMENT) and (puck == 1):
+ return
if is_string(segment):
segment = ord(segment.upper()) - ord('A') +1
if segment<=0 or segment >6:
@@ -137,6 +139,10 @@ def assert_valid_address(segment, puck, sample):
raise Exception ("Invalid puck")
if sample<=0 or sample >16:
raise Exception ("Invalid sample")
+
+def assert_valid_sample(sample):
+ if sample<=0 or sample >16:
+ raise Exception ("Invalid sample")
def get_puck_name(segment, puck):
try:
diff --git a/script/motion/unmount.py b/script/motion/unmount.py
index 548887a..763d846 100644
--- a/script/motion/unmount.py
+++ b/script/motion/unmount.py
@@ -9,6 +9,7 @@ def unmount(segment = None, puck = None, sample = None, force=False):
raise Exception("Mounted sample position is not defined")
segment, puck , sample = pos[0:1], int(pos[1]), int(pos[2])
print "Mounted sample position: ", segment, puck , sample
+ is_aux = segment == AUX_SEGMENT
#Initial checks
assert_valid_address(segment, puck, sample)
@@ -31,11 +32,12 @@ def unmount(segment = None, puck = None, sample = None, force=False):
#Enabling
enable_motion()
+
+ if not is_aux:
+ set_hexiposi(segment)
- set_hexiposi(segment)
-
- if not force:
- visual_check_hexiposi(segment)
+ if not force:
+ visual_check_hexiposi(segment)
#location = robot.get_current_point()
@@ -45,10 +47,17 @@ def unmount(segment = None, puck = None, sample = None, force=False):
smart_magnet.set_unmount_current()
robot.get_gonio()
- #TODO: Shuld check if smart magnet detection is off?
- update_samples_info_sample_unmount(get_puck_name(segment, puck), sample)
- robot.move_dewar()
- robot.put_dewar(segment, puck, sample)
+
+ if is_aux:
+ robot.move_dewar()
+ robot.move_aux()
+ robot.put_aux( sample)
+ robot.move_home()
+ else:
+ #TODO: Shuld check if smart magnet detection is off?
+ update_samples_info_sample_unmount(get_puck_name(segment, puck), sample)
+ robot.move_dewar()
+ robot.put_dewar(segment, puck, sample)
set_setting("mounted_sample_position", None)
finally:
smart_magnet.set_default_current()