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
Bliss
bliss
Commits
9480310b
Commit
9480310b
authored
Jul 01, 2021
by
Cyril Guilloud
Browse files
cleaning
parent
c6041213
Pipeline
#49651
failed with stages
in 115 minutes and 42 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bliss/controllers/motors/esrf_undulator.py
View file @
9480310b
...
...
@@ -6,8 +6,8 @@
# Distributed under the GNU LGPLv3. See LICENSE for more info.
import
time
import
numpy
import
functools
import
numpy
from
bliss.controllers.motor
import
Controller
from
bliss.common.axis
import
AxisState
,
NoSettingsAxis
...
...
@@ -28,11 +28,15 @@ def lazy_init(func):
class
UndulatorAxis
(
NoSettingsAxis
):
"""
Settings of undulators axes are maneged by tango device serve.
"""
def
sync_hard
(
self
):
st
=
self
.
hw_state
if
"DISABLED"
in
st
:
self
.
settings
.
set
(
"state"
,
st
)
user_warning
(
f
"undulator
{
self
.
name
}
is disabled, no position update"
)
st
ate
=
self
.
hw_state
if
"DISABLED"
in
st
ate
:
self
.
settings
.
set
(
"state"
,
st
ate
)
user_warning
(
"undulator
%s
is disabled, no position update"
,
self
.
name
)
else
:
super
().
sync_hard
()
...
...
@@ -43,7 +47,8 @@ Axis = UndulatorAxis
def
get_all
():
"""Return a list of all insertion device sevice server found in the
"""
Return a list of all insertion device sevice server found in the
global env.
"""
try
:
...
...
@@ -60,6 +65,7 @@ class ESRF_Undulator(Controller):
global_map
.
register
(
self
,
parents_list
=
[
"undulators"
])
self
.
axis_info
=
{}
self
.
device
=
None
try
:
self
.
ds_name
=
self
.
config
.
get
(
"ds_name"
)
...
...
@@ -68,10 +74,6 @@ class ESRF_Undulator(Controller):
self
,
"no 'ds_name' defined in config for %s"
%
self
.
config
.
get
(
"name"
)
)
"""
Controller initialization actions.
"""
def
initialize
(
self
):
# velocity and acceleration are not mandatory in config
self
.
axis_settings
.
config_setting
[
"velocity"
]
=
False
...
...
@@ -83,18 +85,13 @@ class ESRF_Undulator(Controller):
self
,
parents_list
=
[
"undulators"
],
children_list
=
[
self
.
device
]
)
"""
Axes initialization actions.
"""
def
initialize_axis
(
self
,
axis
):
"""
Read configuration to forge tango attributes names.
"""
attr_pos_name
=
axis
.
config
.
get
(
"attribute_position"
,
str
,
"Position"
)
log_debug
(
self
,
f
"attr_pos_name=
{
attr_pos_name
}
"
)
log_debug
(
self
,
f
"intialize_axis(
{
axis
.
name
}
)
\n
attr_pos_name=
{
attr_pos_name
}
"
)
attr_vel_name
=
axis
.
config
.
get
(
"attribute_velocity"
,
str
,
"Velocity"
)
log_debug
(
self
,
f
"attr_vel_name=
{
attr_vel_name
}
"
)
...
...
@@ -166,10 +163,6 @@ class ESRF_Undulator(Controller):
log_debug
(
self
,
"OK: axis well initialized"
)
"""
Actions to perform at controller closing.
"""
def
finalize
(
self
):
pass
...
...
@@ -177,16 +170,14 @@ class ESRF_Undulator(Controller):
if
"DISABLED"
in
self
.
state
(
axis
):
if
self
.
axis_info
[
axis
][
"is_revolver"
]:
raise
RuntimeError
(
"Revolver axis is disabled."
)
else
:
raise
RuntimeError
(
"Undulator is disabled."
)
raise
RuntimeError
(
"Undulator is disabled."
)
self
.
device
.
write_attribute
(
self
.
axis_info
[
axis
][
attribute_name
],
value
)
def
_get_attribute
(
self
,
axis
,
attribute_name
):
if
"DISABLED"
in
self
.
state
(
axis
):
if
self
.
axis_info
[
axis
][
"is_revolver"
]:
raise
RuntimeError
(
"Revolver axis is disabled."
)
else
:
raise
RuntimeError
(
"Undulator is disabled."
)
raise
RuntimeError
(
"Undulator is disabled."
)
return
self
.
device
.
read_attribute
(
self
.
axis_info
[
axis
][
attribute_name
]).
value
def
start_one
(
self
,
motion
,
t0
=
None
):
...
...
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