Skip to content
Snippets Groups Projects
Commit abe6057d authored by bliss administrator's avatar bliss administrator
Browse files

Added error handling in the align, load_sample and unload_sample macros.

parent a424e22a
Branches add_helical
No related tags found
No related merge requests found
...@@ -535,7 +535,8 @@ def tomo_sc_load_sample '{ ...@@ -535,7 +535,8 @@ def tomo_sc_load_sample '{
local sample_pos local sample_pos
local aligned local aligned
local align_pos local align_pos
local robot_state local ret
local robot_state, robot_status
if ($# < 1 || $# > 2 ) { if ($# < 1 || $# > 2 ) {
print "usage: $0 <sample position or name>" print "usage: $0 <sample position or name>"
...@@ -586,15 +587,29 @@ def tomo_sc_load_sample '{ ...@@ -586,15 +587,29 @@ def tomo_sc_load_sample '{
_tango_error (ret) _tango_error (ret)
} }
print "\nMove to experiment position" sleep(1)
tomo_sc_experiment_position (align_pos[0], align_pos[1], align_pos[2]) ret = tango_get (TOMO_SC_ROBOT_DEVICE, "State", robot_state)
_tango_error (ret)
print "\nSample loading done!" if ( robot_state == 0 ) {
print "\nMove to experiment position"
tomo_sc_experiment_position (align_pos[0], align_pos[1], align_pos[2])
print "\nSample loading done!"
} else {
print "\nSample loading did not finish as expected!"
print "\nThe sample changer status is:"
ret = tango_get (TOMO_SC_ROBOT_DEVICE, "Status", robot_status)
_tango_error (ret)
print robot_status
exit
}
}' }'
def tomo_sc_unload_sample '{ def tomo_sc_unload_sample '{
local ret
local robot_state, robot_status
print "Beam shutter closing" print "Beam shutter closing"
shclose shclose
...@@ -609,12 +624,26 @@ def tomo_sc_unload_sample '{ ...@@ -609,12 +624,26 @@ def tomo_sc_unload_sample '{
ret = tango_get (TOMO_SC_ROBOT_DEVICE, "State", robot_state) ret = tango_get (TOMO_SC_ROBOT_DEVICE, "State", robot_state)
_tango_error (ret) _tango_error (ret)
while (robot_state == 6) { while (robot_state == 6) {
sleep(5) sleep(3)
printf (".") printf (".")
ret = tango_get (TOMO_SC_ROBOT_DEVICE, "State", robot_state) ret = tango_get (TOMO_SC_ROBOT_DEVICE, "State", robot_state)
_tango_error (ret) _tango_error (ret)
} }
print "\nSample unloading done!"
sleep(1)
ret = tango_get (TOMO_SC_ROBOT_DEVICE, "State", robot_state)
_tango_error (ret)
if ( robot_state == 0 ) {
print "\nSample unloading done!"
} else {
print "\nSample unloading did not finish as expected!"
print "\nThe sample changer status is:"
ret = tango_get (TOMO_SC_ROBOT_DEVICE, "Status", robot_status)
_tango_error (ret)
print robot_status
exit
}
}' }'
...@@ -622,6 +651,7 @@ def tomo_sc_align '{ ...@@ -622,6 +651,7 @@ def tomo_sc_align '{
local ret local ret
local confirm local confirm
local is_aligned local is_aligned
local robot_state, robot_status
print "Move to alignment position" print "Move to alignment position"
tomo_sc_change_position tomo_sc_change_position
...@@ -642,22 +672,32 @@ def tomo_sc_align '{ ...@@ -642,22 +672,32 @@ def tomo_sc_align '{
ret = tango_get (TOMO_SC_ROBOT_DEVICE, "State", robot_state) ret = tango_get (TOMO_SC_ROBOT_DEVICE, "State", robot_state)
_tango_error (ret) _tango_error (ret)
# test to 6 == robot is moving, if not return error! # test to 6 == robot is moving, if not return error!
print robot_state
while (robot_state == 6) { while (robot_state == 6) {
sleep(5) sleep(3)
printf (".") printf (".")
ret = tango_get (TOMO_SC_ROBOT_DEVICE, "State", robot_state) ret = tango_get (TOMO_SC_ROBOT_DEVICE, "State", robot_state)
_tango_error (ret) _tango_error (ret)
} }
ret = tango_get (TOMO_SC_ROBOT_DEVICE, "Aligned", is_aligned) sleep(1)
ret = tango_get (TOMO_SC_ROBOT_DEVICE, "State", robot_state)
_tango_error (ret) _tango_error (ret)
if ( robot_state == 0 ) {
ret = tango_get (TOMO_SC_ROBOT_DEVICE, "Aligned", is_aligned)
_tango_error (ret)
if (is_aligned == 1) { if (is_aligned == 1) {
print "\n\nThe sample changer is aligned!" print "\n\nThe sample changer is aligned!"
} else {
print "\n\nThe alignment procedure ended without error, but the alignment failed!"
print "Please check the sample changer!"
}
} else { } else {
print "\n\nThe alignment procedure ended without error, but the alignment failed!" print "\nAlignment did not finish as expected!"
print "Please check the sample changer!" print "\nThe sample changer status is:"
ret = tango_get (TOMO_SC_ROBOT_DEVICE, "Status", robot_status)
_tango_error (ret)
print robot_status
} }
} }
}' }'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment