Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
F-CRG
BM07
bm07
Commits
0ffabbf9
Commit
0ffabbf9
authored
Aug 24, 2021
by
Yoann Sallaz Damaz
Browse files
add actuator device with interlock
parent
ff642ab7
Pipeline
#53270
failed with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bm07/actuator_multiwago.py
deleted
100644 → 0
View file @
ff642ab7
from
bliss.controllers.actuator
import
Actuator
class
Actuator_multiwago
(
Actuator
):
def
__init__
(
self
,
name
,
config
):
Actuator
.
__init__
(
self
,
name
,
config
)
self
.
controller_state
=
config
[
"controller_state"
]
def
_is_in
(
self
):
""" Check if the actuator is in position IN
Returns:
(bool): True if IN. False if OUT, None if no check possible.
"""
if
self
.
key_in
:
return
self
.
controller_state
.
get
(
self
.
key_in
)
==
1
if
self
.
key_out
:
return
self
.
controller_state
.
get
(
self
.
key_out
)
==
0
if
self
.
key_cmd
:
return
self
.
controller
.
get
(
self
.
key_cmd
)
==
1
def
_is_out
(
self
):
""" Check if the actuator is in position OUT
Returns:
(bool): True if OUT. False if IN, None if no check possible.
"""
if
self
.
key_out
:
return
self
.
controller_state
.
get
(
self
.
key_out
)
==
1
if
self
.
key_in
:
return
self
.
controller_state
.
get
(
self
.
key_in
)
==
0
if
self
.
key_cmd
:
return
self
.
controller
.
get
(
self
.
key_cmd
)
==
0
def
is_open
(
self
):
return
self
.
_is_out
()
def
is_close
(
self
):
return
self
.
_is_in
()
def
on
(
self
):
self
.
set_in
()
def
off
(
self
):
self
.
set_out
()
def
__repr__
(
self
):
if
self
.
state
==
"IN"
:
return
"IN/ON/CLOSE"
elif
self
.
state
==
"OUT"
:
return
"OUT/OFF/OPEN"
else
:
return
self
.
state
\ No newline at end of file
bm07/actuator_multiwago_interlocked.py
0 → 100644
View file @
0ffabbf9
#from bm07.actuator_multiwago import Actuator_multiwago
from
bliss.controllers.actuator
import
Actuator
class
Actuator_Multiwago_Interlocked
(
Actuator
):
def
__init__
(
self
,
name
,
config
):
Actuator
.
__init__
(
self
,
name
,
config
)
self
.
controller_state
=
config
.
get
(
"controller_state"
)
self
.
in_name
=
config
.
get
(
"in_name"
)
self
.
out_name
=
config
.
get
(
"out_name"
)
self
.
grob
=
config
.
get
(
"grob"
)
self
.
grob_state_ok
=
config
.
get
(
"grob_state_ok"
)
self
.
controller_state_interlock
=
config
.
get
(
"controller_state_interlock"
)
self
.
controller_state_interlock_ok
=
config
.
get
(
"controller_state_interlock_ok"
)
#create dynamic method from in/out name
setattr
(
self
,
self
.
in_name
,
self
.
set_in
)
setattr
(
self
,
self
.
out_name
,
self
.
set_out
)
setattr
(
self
,
"force_"
+
self
.
in_name
,
self
.
_force_in
)
setattr
(
self
,
"force_"
+
self
.
out_name
,
self
.
_force_out
)
def
__repr__
(
self
):
txt
=
""
if
self
.
state
==
"IN"
:
txt
+=
"State: %s
\n
"
%
self
.
in_name
.
upper
()
elif
self
.
state
==
"OUT"
:
txt
+=
"State: %s
\n
"
%
self
.
out_name
.
upper
()
else
:
txt
+=
"State: %s
\n
"
%
self
.
state
if
self
.
grob
:
if
self
.
grob
.
Status
in
self
.
grob_state_ok
:
txt
+=
"Grob status is good to allow this device movement
\n
"
else
:
txt
+=
"Grob status is NOT good to allow this device movement
\n
"
elif
self
.
controller_state_interlock
:
if
(
self
.
controller_state
.
get
(
self
.
controller_state_interlock
)
==
self
.
controller_state_interlock_ok
):
txt
+=
"%s value is good to allow this device movement
\n
"
%
self
.
controller_state_interlock
else
:
txt
+=
"%s value is NOT good to allow this device movement
\n
"
%
self
.
controller_state_interlock
return
txt
def
set_in
(
self
,
timeout
=
None
):
if
self
.
grob
:
if
self
.
grob
.
Status
in
self
.
grob_state_ok
:
super
(
Actuator
,
self
).
set_in
()
else
:
print
(
"Grob is not in the good state : move forbidden"
)
elif
self
.
controller_state_interlock
:
if
(
self
.
controller_state
.
get
(
self
.
controller_state_interlock
)
==
self
.
controller_state_interlock_ok
):
super
(
Actuator
,
self
).
set_in
()
else
:
print
(
"%s set an interlock : move forbidden"
%
self
.
controller_state_interlock
)
else
:
super
(
Actuator
,
self
).
set_in
()
def
set_out
(
self
,
timeout
=
None
):
if
self
.
grob
:
if
self
.
grob
.
Status
in
self
.
grob_state_ok
:
super
(
Actuator
,
self
).
set_out
()
else
:
print
(
"Grob is not in the good state : move forbidden"
)
elif
self
.
controller_state_interlock
:
if
(
self
.
controller_state
.
get
(
self
.
controller_state_interlock
)
==
self
.
controller_state_interlock_ok
):
super
(
Actuator
,
self
).
set_out
()
else
:
print
(
"%s set an interlock : move forbidden"
%
self
.
controller_state_interlock
)
else
:
super
(
Actuator
,
self
).
set_out
()
def
_is_in
(
self
):
if
self
.
key_in
:
return
self
.
controller_state
.
get
(
self
.
key_in
)
==
1
if
self
.
key_out
:
return
self
.
controller_state
.
get
(
self
.
key_out
)
==
0
if
self
.
key_cmd
:
return
self
.
controller
.
get
(
self
.
key_cmd
)
==
1
def
_is_out
(
self
):
if
self
.
key_out
:
return
self
.
controller_state
.
get
(
self
.
key_out
)
==
1
if
self
.
key_in
:
return
self
.
controller_state
.
get
(
self
.
key_in
)
==
0
if
self
.
key_cmd
:
return
self
.
controller
.
get
(
self
.
key_cmd
)
==
0
def
_force_in
(
self
):
super
(
Actuator
,
self
).
set_in
()
def
_force_out
(
self
):
super
(
Actuator
,
self
).
set_out
()
\ No newline at end of file
bm07/datacollection.py
View file @
0ffabbf9
...
...
@@ -77,17 +77,6 @@ def acq_externalSingle(expo_s, step_deg, start_angle_deg, end_angle_deg):
omega
.
velocity
=
20
umv
(
omega
,
0
)
def
dstop_up
():
wcd07f
.
set
(
"dstop_up"
,
1
)
def
dstop_down
():
wcd07f
.
set
(
"dstop_up"
,
0
)
def
bstop1_up
():
wcd07f
.
set
(
"bstop1"
,
1
)
def
bstop1_down
():
wcd07f
.
set
(
"bstop1"
,
0
)
def
opensh
():
fast_shutter_pseudo
.
open_manual
()
...
...
bm07/grob_FIP.py
View file @
0ffabbf9
...
...
@@ -126,7 +126,8 @@ class grob_FIP(object):
"mount_plate"
:
5
,
"dismount_plate"
:
6
,
"mount_gonio"
:
7
,
"dismount_gonio"
:
8
,
"send_setup"
:
9
,
"wash"
:
10
,
"anneal"
:
11
,
"mount_versa_pin"
:
12
,
"move_rel"
:
13
,
"move_abs"
:
14
,
"expose"
:
15
,
"open_grip"
:
16
,
"close_grip"
:
17
,
"set_grip"
:
18
,
"set_angles"
:
19
,
"force_mounted_sample"
:
22
}
"close_grip"
:
17
,
"set_grip"
:
18
,
"set_angles"
:
19
,
"force_gripper"
:
20
,
"force_mounted_sample"
:
22
}
self
.
addr
=
{
"Command"
:
{
"addr"
:
0
,
"struct_format"
:
"16H"
},
"Status"
:
{
"addr"
:
16
,
"struct_format"
:
"H"
},
"CurMode"
:
{
"addr"
:
17
,
"struct_format"
:
"H"
},
...
...
@@ -212,6 +213,7 @@ class grob_FIP(object):
self
.
z
=
config
[
"gonio_z"
]
self
.
kappa
=
config
[
"gonio_kappa"
]
self
.
detfw
=
config
[
"det_move"
]
self
.
wago
=
config
[
"wago"
]
#geometry
#mount sample
...
...
@@ -235,6 +237,15 @@ class grob_FIP(object):
self
.
read_all_memory
()
def
__repr__
(
self
):
self
.
read_all_memory
()
txt
=
""
txt
+=
"Status: %s
\n
"
%
self
.
status_code
[
self
.
Status
]
txt
+=
"Mounted sample: %d
\n
"
%
self
.
NumSampleMounted
txt
+=
"Mode: %d
\n
"
%
self
.
CurrentMode
txt
+=
"SIMULATED: %s
\n
"
%
self
.
SIMU
return
txt
def
send_command
(
self
,
cmd
,
arg
=
[]):
param
=
arg
.
copy
()
print
(
param
)
...
...
@@ -270,6 +281,13 @@ class grob_FIP(object):
return
True
def
force_gripper
(
self
,
gripper_number
):
#0 rien, 3 Pince double
self
.
send_command
(
"force_gripper"
,[
nugripper_numberm
])
def
force_mounted_sample
(
self
,
sample_number
):
self
.
send_command
(
"force_mounted_sample"
,
[
sample_number
])
def
move_gonio_in_sample_mount_geo
(
self
,
checkonly
=
False
):
motor_list_first
=
[
self
.
omega
,
self
.
y
]
target_list_first
=
[
self
.
omega_mountsample
,
self
.
y_mountsample
]
...
...
@@ -335,17 +353,38 @@ class grob_FIP(object):
return
False
#robot mount
if
self
.
SIMU
:
self
.
state_grob
=
2
self
.
send_command
(
"force_mounted_sample"
,
[
sample_number
])
if
sample_number
==
0
:
if
self
.
SIMU
:
self
.
state_grob
=
2
self
.
send_command
(
"force_mounted_sample"
,
[
0
])
else
:
self
.
send_command
(
"dismount_sample"
,
[])
else
:
self
.
send_command
(
"mount_sample"
,
[
sample_number
])
if
self
.
SIMU
:
self
.
state_grob
=
2
self
.
send_command
(
"force_mounted_sample"
,
[
sample_number
])
else
:
self
.
send_command
(
"mount_sample"
,
[
sample_number
])
with
gevent
.
Timeout
(
15
,
False
):
while
self
.
NumSampleMounted
!=
sample_number
:
self
.
read_all_memory
()
print
(
self
.
NumSampleMounted
)
time
.
sleep
(
1
)
time
.
sleep
(
3
)
self
.
read_all_memory
()
#with gevent.Timeout(15,False):
while
self
.
Status
==
2
:
#self.NumSampleMounted != sample_number:
self
.
read_all_memory
()
#print(self.NumSampleMounted)
if
self
.
SmartMagnet
==
3
:
print
(
"SMARTMAGNET BOOST"
)
self
.
wago
.
set
(
"magnet_boost"
,
1
)
self
.
wago
.
set
(
"magnet_degauss"
,
0
)
elif
self
.
SmartMagnet
==
2
:
print
(
"SMARTMAGNET DEGAUSS"
)
self
.
wago
.
set
(
"magnet_boost"
,
0
)
self
.
wago
.
set
(
"magnet_degauss"
,
1
)
else
:
self
.
wago
.
set
(
"magnet_boost"
,
0
)
self
.
wago
.
set
(
"magnet_degauss"
,
0
)
time
.
sleep
(
0.1
)
if
self
.
NumSampleMounted
!=
sample_number
:
return
False
if
self
.
SIMU
:
...
...
@@ -354,12 +393,11 @@ class grob_FIP(object):
self
.
state_gonio
=
1
#gonio position for collecting sample
if
not
self
.
move_gonio_in_sample_collect_geo
():
return
False
#
if not self.move_gonio_in_sample_collect_geo():
#
return False
def
dismount_sample
(
self
):
#self.send_command("dismount_sample")
self
.
send_command
(
"force_mounted_sample"
,
[
0
])
self
.
mount_sample
(
0
)
def
mount_plate
(
self
,
sample_number
):
self
.
send_command
(
"mount_plate"
,
[
sample_number
])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment