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
27be99fa
Commit
27be99fa
authored
Jun 21, 2021
by
Perceval Guillou
Browse files
fix motor children
parent
ec229a7d
Changes
6
Hide whitespace changes
Inline
Side-by-side
bliss/controllers/motors/moco.py
View file @
27be99fa
...
...
@@ -7,17 +7,18 @@ class Moco(Controller):
bliss.controllers.motor.Controller
"""
def
_
_init__
(
self
,
name
,
config
,
axes
,
*
args
):
def
_
load_config
(
self
):
if
len
(
axes
)
>
1
:
super
().
_load_config
()
axnum
=
len
(
self
.
config
.
get
(
"axes"
))
if
axnum
>
1
:
raise
RuntimeError
(
f
"moco: only 1 motor is allowed, but
{
len
(
axes
)
}
are configured."
f
"moco: only 1 motor is allowed, but
{
axnum
}
are configured."
)
self
.
moco
=
config
.
get
(
"moco"
)
super
().
__init__
(
self
.
moco
.
name
+
"_motor"
,
config
,
axes
,
*
args
)
self
.
moco
=
self
.
config
.
get
(
"moco"
)
self
.
_name
=
self
.
moco
.
name
+
"_motor"
self
.
moco
.
motor
=
self
def
initialize
(
self
):
...
...
bliss/controllers/motors/spec.py
View file @
27be99fa
...
...
@@ -39,27 +39,17 @@ _log = logging.getLogger("bliss.controllers.motors.spec")
class
Spec
(
Controller
):
def
__init__
(
self
,
name
,
config
,
axes
,
*
args
,
**
kwargs
):
new_axes
=
{}
# _log.warning(f"axes[{axes}]")
for
axis_name
,
axis_cfg
in
axes
.
items
():
axis_cfg
=
list
(
axis_cfg
)
# change class name for axes created by this controller
# to NoSettingsAxis: no settings will be stored in redis,
# thus forcing to ask spec every time (no cache)
axis_cfg
[
0
]
=
NoSettingsAxis
# make sure steps per unit is 1, to avoid conversions
# between spec units and Bliss units
assert
(
axis_cfg
[
1
].
get
(
"steps_per_unit"
,
int
)
==
1
),
"steps_per_unit must be defined and equal to 1"
new_axes
[
axis_name
]
=
axis_cfg
Controller
.
__init__
(
self
,
name
,
config
,
new_axes
,
*
args
,
**
kwargs
)
def
_load_config
(
self
):
super
().
_load_config
()
for
ax_cfg
in
self
.
config
.
get
(
"axes"
,
[]):
if
ax_cfg
.
get
(
"steps_per_unit"
)
!=
1
:
raise
ValueError
(
f
"steps_per_unit must be defined and equal to 1"
)
def
_get_subitem_default_class_name
(
self
,
cfg
,
parent_key
):
if
parent_key
==
"axes"
:
return
"NoSettingsAxis"
else
:
return
super
().
_get_subitem_default_class_name
(
cfg
,
parent_key
)
def
initialize
(
self
):
self
.
connection
=
SpecConnection
(
self
.
config
.
get
(
"spec"
))
...
...
bliss/controllers/motors/speedgoat.py
View file @
27be99fa
...
...
@@ -50,9 +50,9 @@ from bliss.common.utils import object_attribute_get
class
SpeedgoatMotor
(
Controller
):
def
_
_init__
(
self
,
name
,
config
,
*
args
,
**
kwargs
):
Controller
.
__init__
(
self
,
name
,
config
,
*
args
,
**
kwargs
)
self
.
speedgoat
=
config
.
get
(
"speedgoat"
)
def
_
load_config
(
self
):
super
().
_load_config
(
)
self
.
speedgoat
=
self
.
config
.
get
(
"speedgoat"
)
self
.
_axis_init_done
=
{}
def
initialize
(
self
):
...
...
bliss/controllers/motors/tangoemot.py
View file @
27be99fa
...
...
@@ -23,14 +23,12 @@ computer.
class
TangoEMot
(
Controller
):
def
_
_init__
(
self
,
*
args
,
**
kwargs
):
Controller
.
__init__
(
self
,
*
args
,
**
kwargs
)
def
_
load_config
(
self
):
super
().
_load_config
(
)
# Gets DS name from xml config.
self
.
ds_name
=
self
.
config
.
get
(
"ds_name"
)
# tests if DS is responding.
def
initialize
(
self
):
pass
...
...
bliss/controllers/motors/wago.py
View file @
27be99fa
...
...
@@ -8,10 +8,6 @@ class Wago:
class
WagoMotor
(
Controller
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
def
initialize
(
self
):
# initialize hardware communication
self
.
wago
=
self
.
config
.
get
(
"wago"
,
converter
=
None
)
...
...
bliss/tango/servers/axis_ds.py
View file @
27be99fa
...
...
@@ -1136,9 +1136,10 @@ def get_server_axis_names(instance_name=None):
result
=
[]
for
item_name
in
cfg
.
names_list
:
item_cfg
=
cfg
.
get_config
(
item_name
)
if
item_cfg
.
plugin
==
"bliss_controller"
and
instance_name
in
item_cfg
.
get
(
"tango_server"
,
()
):
if
item_cfg
.
plugin
in
[
"bliss_controller"
,
"emotion"
,
]
and
instance_name
in
item_cfg
.
get
(
"tango_server"
,
()):
result
.
append
(
item_name
)
return
result
...
...
@@ -1351,7 +1352,7 @@ def initialize_bliss(info, db=None):
# if tango_server is defined it means it is manually added
if
"tango_server"
in
obj_cfg
:
continue
if
obj_cfg
.
plugin
==
"bliss_controller"
:
if
obj_cfg
.
plugin
in
[
"bliss_controller"
,
"emotion"
]
:
try
:
if
name
in
[
x
[
"name"
]
for
x
in
obj_cfg
.
parent
[
"axes"
]]:
axis_names
.
append
(
name
)
...
...
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