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
ID11
id11
Commits
d33f6497
Commit
d33f6497
authored
Feb 04, 2020
by
Emmanuel Papillon
Browse files
add airpad hooks for 3dxrd (wago pulse)
parent
3963ff68
Changes
1
Hide whitespace changes
Inline
Side-by-side
id11/controllers/airpad.py
0 → 100644
View file @
d33f6497
from
gevent
import
sleep
from
bliss.common.hook
import
MotionHook
from
bliss.common.logtools
import
log_debug
class
AirpadWagoPulseHook
(
MotionHook
):
def
__init__
(
self
,
name
,
config
):
self
.
config
=
config
self
.
name
=
name
self
.
wago
=
config
[
"wago"
]
super
(
AirpadWagoPulseHook
,
self
).
__init__
()
def
_add_axis
(
self
,
axis
):
if
len
(
self
.
axes
):
axis_name
=
list
(
self
.
axes
.
keys
())[
0
]
raise
ValueError
(
"Cannot attach WagoAirpadHook {0!r} to {1!r}. "
"It is already attached to {2!r}"
.
format
(
self
.
name
,
axis
.
name
,
axis_name
)
)
super
(
WagoHook
,
self
).
_add_axis
(
axis
)
def
set
(
self
,
phase
):
channel
=
self
.
config
[
phase
][
"channel"
]
wait
=
self
.
config
[
phase
].
get
(
"wait"
,
0.1
)
log_debug
(
self
,
f
"start
{
phase
}
, pulse on
{
channel
}
for
{
wait
}
sec."
)
self
.
wago
.
set
(
channel
,
1
)
sleep
(
wait
)
self
.
wago
.
set
(
channel
,
0
)
log_debug
(
self
,
f
"finished
{
phase
}
"
)
def
pre_move
(
self
,
motion_list
):
self
.
set
(
"pre_move"
)
def
post_move
(
self
,
motion_list
):
self
.
set
(
"post_move"
)
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