Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bliss
bliss
Commits
6411ba66
Commit
6411ba66
authored
Jul 06, 2021
by
bliss administrator
Committed by
Matias Guijarro
Jul 08, 2021
Browse files
micos: add encoder support to make available an encoder steps_per_unit for fscan for instance
parent
fee48fd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
bliss/controllers/motors/micos.py
View file @
6411ba66
...
...
@@ -135,6 +135,14 @@
# 0 (no trigger) or 1 of [1,2,3 or 4]
# (4 Digital Output channels)
cloop_wintime: 1.2E-3 # closed-loop settling time [sec]
home_position: -119 # position to set when homing has been performed
encoder: $ths_enc
check_encoder: False
encoders:
- name: ths_enc
number: 1 # encoder channel number, must be the same as the axis number
steps_per_unit: 65550 # add an encoder if you need to do fscan
# there is not way to read encoder resolution
"""
...
...
@@ -146,6 +154,7 @@ from bliss.common.utils import Null
from
bliss.common.axis
import
AxisState
from
bliss.comm.util
import
get_comm
,
SERIAL
from
bliss.controllers.motor
import
Controller
from
bliss.common.encoder
import
Encoder
,
lazy_init
from
bliss.common.utils
import
object_method
from
bliss.common.utils
import
object_attribute_get
,
object_attribute_set
from
bliss.common.logtools
import
(
...
...
@@ -282,6 +291,27 @@ class micos(Controller):
# self._micos_state.create_state("IN_CLOSED_LOOP_WINDOW","In Closed-loop Window")
# TODO: see if some other special state should be created here
def
initialize_encoder
(
self
,
encoder
):
if
encoder
.
name
not
in
self
.
_micos_enc
.
keys
():
number
=
encoder
.
config
.
get
(
"number"
,
int
,
None
)
if
number
is
None
:
raise
ValueError
(
f
"Missing number key in
{
encoder
.
name
}
encoder config"
)
steps
=
encoder
.
config
.
get
(
"steps_per_unit"
,
int
,
None
)
if
steps
is
None
:
raise
ValueError
(
f
"Missing steps_per_unit key in
{
encoder
.
name
}
encoder config"
)
encoder
.
number
=
number
def
read_encoder
(
self
,
encoder
):
"""
No way to read the encoder, so just convert the motor position reading into encoder steps
"""
cmd
=
f
"
{
encoder
.
number
}
npos "
ans
=
self
.
_send
(
cmd
)
pos
=
float
(
ans
)
return
int
(
pos
*
encoder
.
steps_per_unit
)
def
initialize_hardware
(
self
):
"""
Initializes the MICOS controller
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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