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
b6bd1b0b
Commit
b6bd1b0b
authored
Sep 15, 2020
by
bliss administrator
Committed by
Matias Guijarro
Sep 16, 2020
Browse files
ensure FAULT state exits move loop with exception
parent
5f255007
Changes
3
Hide whitespace changes
Inline
Side-by-side
bliss/common/axis.py
View file @
b6bd1b0b
...
...
@@ -44,6 +44,10 @@ class AxisOnLimitError(RuntimeError):
pass
class
AxisFaultError
(
RuntimeError
):
pass
def
_prepare_one_controller_motions
(
controller
,
motions
):
try
:
controller
.
prepare_all
(
*
motions
)
...
...
@@ -1911,6 +1915,8 @@ class Axis:
if
not
state
.
MOVING
:
if
limit_error
and
(
state
.
LIMPOS
or
state
.
LIMNEG
):
raise
AxisOnLimitError
(
str
(
state
))
elif
state
.
FAULT
:
raise
AxisFaultError
(
str
(
state
))
return
state
gevent
.
sleep
(
polling_time
)
...
...
bliss/controllers/motors/mockup.py
View file @
b6bd1b0b
...
...
@@ -620,6 +620,7 @@ class FaultyMockup(Mockup):
Mockup
.
__init__
(
self
,
*
args
,
**
kwargs
)
self
.
bad_state
=
False
self
.
fault_state
=
False
self
.
bad_start
=
False
self
.
bad_state_after_start
=
False
self
.
bad_stop
=
False
...
...
@@ -633,6 +634,9 @@ class FaultyMockup(Mockup):
if
self
.
bad_state
:
self
.
state_msg_index
+=
1
raise
RuntimeError
(
"BAD STATE %d"
%
self
.
state_msg_index
)
elif
self
.
fault_state
:
self
.
_axis_moves
[
axis
][
"motion"
]
=
None
# stop motion immediately
return
AxisState
(
"FAULT"
)
else
:
return
Mockup
.
state
(
self
,
axis
)
...
...
tests/motors/test_bad_controller.py
View file @
b6bd1b0b
...
...
@@ -12,6 +12,7 @@ import math
from
bliss.common.standard
import
Group
from
bliss.common.standard
import
sync
from
bliss.common
import
event
from
bliss.common.axis
import
AxisFaultError
def
test_bad_start
(
bad_motor
):
...
...
@@ -153,3 +154,20 @@ def test_issue_1719(bad_motor, capsys):
not
"TypeError: '<=' not supported between instances of 'NoneType' and 'int'"
in
capsys
.
readouterr
().
err
)
def
test_fault_state
(
bad_motor
):
bad_motor
.
move
(
1000
,
wait
=
False
)
gevent
.
sleep
(
bad_motor
.
acctime
)
bad_motor
.
controller
.
fault_state
=
True
with
pytest
.
raises
(
AxisFaultError
):
bad_motor
.
wait_move
()
bad_motor
.
controller
.
fault_state
=
False
bad_motor
.
move
(
0
)
assert
"READY"
in
bad_motor
.
state
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