Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
bliss
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
523
Issues
523
List
Boards
Labels
Service Desk
Milestones
Jira
Jira
Merge Requests
123
Merge Requests
123
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bliss
bliss
Commits
4dfc9769
Commit
4dfc9769
authored
Feb 11, 2020
by
Cyril Guilloud
Committed by
Cyril Guilloud
Feb 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
__info__() improved
*for axis / counter / encoder *for PI E753 - comm - get_axis_info()
parent
1a770a36
Pipeline
#21196
failed with stages
in 38 minutes and 29 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
127 additions
and
75 deletions
+127
-75
bliss/common/axis.py
bliss/common/axis.py
+52
-33
bliss/common/counter.py
bliss/common/counter.py
+5
-3
bliss/common/encoder.py
bliss/common/encoder.py
+1
-6
bliss/controllers/motors/icepap/__init__.py
bliss/controllers/motors/icepap/__init__.py
+31
-12
bliss/controllers/motors/mockup.py
bliss/controllers/motors/mockup.py
+13
-8
bliss/controllers/motors/pi_e753.py
bliss/controllers/motors/pi_e753.py
+12
-4
tests/motors/test_axis.py
tests/motors/test_axis.py
+13
-9
No files found.
bliss/common/axis.py
View file @
4dfc9769
...
...
@@ -910,62 +910,81 @@ class Axis:
Return common axis information about the axis.
PLUS controller specific information.
"""
_info_string
=
""
_info_string
+=
f"axis name (R):
{
self
.
name
}
\n
"
_info_string
+=
f" state (R):
{
self
.
state
}
\n
"
_info_string
+=
f" unit (R):
{
self
.
unit
}
\n
"
_info_string
+=
f" offset (R):
{
self
.
offset
}
\n
"
_info_string
+=
f" backlash (R):
{
self
.
backlash
}
\n
"
_info_string
+=
f" sign (R):
{
self
.
sign
}
\n
"
_info_string
+=
f" steps_per_unit (R):
{
self
.
steps_per_unit
}
\n
"
_info_string
+=
(
f" tolerance (R) (to check pos. before a move):
{
self
.
tolerance
}
\n
"
)
_info_string
+=
f" motion_hooks (R):
{
self
.
motion_hooks
}
\n
"
_info_string
+=
f" dial (RW):
{
self
.
dial
:.
5
f
}
\n
"
_info_string
+=
f" position (RW):
{
self
.
position
:.
5
f
}
\n
"
_info_string
+=
f" _hw_position (R):
{
self
.
_hw_position
:.
5
f
}
\n
"
_info_string
+=
f" hw_state (R):
{
self
.
hw_state
}
\n
"
_info_string
+=
(
f" limits (RW):
{
self
.
limits
}
(config:
{
self
.
config_limits
}
)
\n
"
)
info_string
=
"AXIS:
\n
"
try
:
# Config parameters.
info_string
+=
f" name (R):
{
self
.
name
}
\n
"
info_string
+=
f" unit (R):
{
self
.
unit
}
\n
"
info_string
+=
f" offset (R):
{
self
.
offset
:.
5
f
}
\n
"
info_string
+=
f" backlash (R):
{
self
.
backlash
:.
5
f
}
\n
"
info_string
+=
f" sign (R):
{
self
.
sign
}
\n
"
info_string
+=
f" steps_per_unit (R):
{
self
.
steps_per_unit
:.
2
f
}
\n
"
info_string
+=
(
f" tolerance (R) (to check pos. before a move):
{
self
.
tolerance
}
\n
"
)
except
:
info_string
+=
"ERROR: unable to get info (config problem?)
\n
"
# To avoid error if no acceleration.
try
:
# These parameters access to the device.
_low_cfg_limit
,
_high_cfg_limit
=
self
.
config_limits
_lim
=
f"Low:
{
self
.
low_limit
:.
5
f
}
High:
{
self
.
high_limit
:.
5
f
}
"
_cfg_lim
=
f"(config Low:
{
_low_cfg_limit
:.
5
f
}
High:
{
_high_cfg_limit
:.
5
f
}
)"
info_string
+=
f" limits (RW):
{
_lim
}
{
_cfg_lim
}
\n
"
info_string
+=
f" dial (RW):
{
self
.
dial
:.
5
f
}
\n
"
info_string
+=
f" position (RW):
{
self
.
position
:.
5
f
}
\n
"
except
:
info_string
+=
"ERROR: unable to get info (communication problem?)
\n
"
try
:
info_string
+=
f" state (R):
{
self
.
state
}
\n
"
except
:
info_string
+=
f" ERROR: unable to get state (communication problem?)
\n
"
# ACCELERATION
try
:
_acc
=
self
.
acceleration
_acc_config
=
self
.
config_acceleration
_acc_time
=
self
.
acctime
_acc_time_config
=
self
.
config_acctime
_
info_string
+=
(
info_string
+=
(
f" acceleration (RW):
{
_acc
:
10.5
f
}
(config:
{
_acc_config
:
10.5
f
}
)
\n
"
)
_
info_string
+=
f" acctime (RW):
{
_acc_time
:
10.5
f
}
(config:
{
_acc_time_config
:
10.5
f
}
)
\n
"
info_string
+=
f" acctime (RW):
{
_acc_time
:
10.5
f
}
(config:
{
_acc_time_config
:
10.5
f
}
)
\n
"
except
Exception
as
e
:
_
info_string
+=
f" acceleration: None
\n
"
info_string
+=
f" acceleration: None
\n
"
#
To avoid error if no velocity.
#
VELOCITY
try
:
_vel
=
self
.
velocity
_vel_config
=
self
.
config_velocity
_
info_string
+=
(
info_string
+=
(
f" velocity (RW):
{
_vel
:
10.5
f
}
(config:
{
_vel_config
:
10.5
f
}
)
\n
"
)
except
Exception
as
e
:
_info_string
+=
f" velocity: None
\n
"
info_string
+=
f" velocity: None
\n
"
# CONTROLLER
try
:
info_string
+=
self
.
__controller
.
__info__
()
except
:
info_string
+=
f"ERROR: Unable to get info from controller
\n
"
# SPECIFIC AXIS INFO
try
:
# us
e of get_info() rather than __info__() to be able
to pass axis as param.
_info_string
+=
self
.
__controller
.
get
_info
(
self
)
# us
age of get_axis_info()
to pass axis as param.
info_string
+=
self
.
__controller
.
get_axis
_info
(
self
)
except
Exception
as
e
:
_
info_string
+=
f"
{
self
.
controller
}
\n
"
info_string
+=
f"
{
self
.
controller
}
\n
"
# ENCODER
try
:
_
info_string
+=
self
.
encoder
.
__info__
()
info_string
+=
self
.
encoder
.
__info__
()
except
Exception
as
e
:
_
info_string
+=
f" encoder: None
\n
"
info_string
+=
f" encoder: None
\n
"
return
_
info_string
return
info_string
def
sync_hard
(
self
):
"""Forces an axis synchronization with the hardware"""
...
...
bliss/common/counter.py
View file @
4dfc9769
...
...
@@ -124,11 +124,13 @@ class Counter:
def
__info__
(
self
,
counter_type
=
None
):
info_str
=
f"'
{
self
.
name
}
` counter info:
\n
"
info_str
+=
f" counter type =
{
counter_type
}
\n
"
if
counter_type
else
""
if
counter_type
==
"sampling"
:
info_str
+=
f" sampling mode =
{
self
.
mode
.
name
}
\n
"
if
self
.
mode
else
""
info_str
+=
f" fullname =
{
self
.
fullname
}
\n
"
info_str
+=
f" unit =
{
self
.
unit
}
\n
"
info_str
+=
f" shape =
{
self
.
shape
}
\n
"
info_str
+=
f" dtype =
{
self
.
dtype
}
\n
"
info_str
+=
f" conversion_function =
{
self
.
conversion_function
}
\n
"
#
info_str += f" shape = {self.shape} \n"
#
info_str += f" dtype = {self.dtype} \n"
#
info_str += f" conversion_function = {self.conversion_function} \n"
return
info_str
...
...
bliss/common/encoder.py
View file @
4dfc9769
...
...
@@ -101,10 +101,5 @@ class Encoder:
def
__info__
(
self
):
info_str
=
"ENCODER:
\n
"
info_str
+=
f" tolerance (to check pos at end of move):
{
self
.
tolerance
}
\n
"
info_str
+=
f" encoder value:
{
self
.
controller
.
read_encoder
(
self
)
}
\n
"
# only 1 read to ensure coherency.
_dial_meas_pos
=
self
.
read
()
# _user_meas_pos = ???axis.dial2user(_dial_meas_pos)
info_str
+=
f" dial_measured_position:
{
_dial_meas_pos
:
10.5
f
}
\n
"
# info_str += f" user_measured_position: {_user_meas_pos:10.5f} \n"
info_str
+=
f" dial_measured_position:
{
self
.
read
():
10.5
f
}
\n
"
return
info_str
bliss/controllers/motors/icepap/__init__.py
View file @
4dfc9769
...
...
@@ -10,6 +10,7 @@ import time
import
gevent
import
hashlib
import
functools
from
collections
import
namedtuple
from
bliss.common.greenlet_utils
import
protect_from_kill
from
bliss.config.channels
import
Cache
from
bliss.controllers.motor
import
Controller
...
...
@@ -298,7 +299,7 @@ class Icepap(Controller):
return
state
def
get_info
(
self
,
axis
):
def
get_
axis_
info
(
self
,
axis
):
pre_cmd
=
"%s:"
%
axis
.
address
# info_str = "MOTOR : %s\n" % axis.name
info_str
=
"ICEPAP:
\n
"
...
...
@@ -313,22 +314,21 @@ class Icepap(Controller):
info_str
+=
f" CLOOP:
{
_command
(
self
.
_cnx
,
pre_cmd
+
'?PCLOOP'
)
}
"
info_str
+=
f" WARNING:
{
_command
(
self
.
_cnx
,
pre_cmd
+
'?WARNING'
)
}
"
info_str
+=
f" ALARM:
{
_command
(
self
.
_cnx
,
pre_cmd
+
'?ALARM'
)
}
\n
"
info_str
+=
f"
{
self
.
read_encoder_all_types
(
axis
)
}
\n
"
if
isinstance
(
axis
,
LinkedAxis
):
info_str
+=
f"LINKED AXIS:
\n
"
info_str
+=
f"
{
self
.
get_linked_axis
()
}
\n
"
return
info_str
def
__info__
(
self
,
axis
):
"""
__info__ for CLI help
NB: <axis> is passed as argument
=> __info__ not CLI callable for icepap controller.
def
__info__
(
self
):
"""For CLI help.
"""
info_str
=
"ICEPAP AXIS:
\n
"
info_str
+=
f" address:
{
axis
.
address
}
\n
"
info_str
=
"ICEPAP CONTROLLER:
\n
"
info_str
+=
f" controller:
{
self
.
_cnx
.
_host
}
\n
"
info_str
+=
f" version:
{
_command
(
self
.
_cnx
,
'?VER'
)
}
\n
"
info_str
+=
f" status:
{
int
(
_command
(
self
.
_cnx
,
'%s:?STATUS'
%
axis
.
address
),
16
)
}
\n
"
if
isinstance
(
axis
,
LinkedAxis
):
info_str
+=
f"
{
self
.
get_linked_axis
()
}
\n
"
return
info_str
...
...
@@ -442,6 +442,25 @@ class Icepap(Controller):
value
=
_command
(
self
.
_cnx
,
"?ENC %s %d"
%
(
encoder
.
enctype
,
encoder
.
address
))
return
int
(
value
)
def
read_encoder_all_types
(
self
,
axis
):
"""Return a named-tuple of all ENC value
("ENCIN", "ABSENC", "INPOS", "MOTOR", "AXIS", "SYNC")
"""
# Create new "type" named IceEncoders.
IceEncoders
=
namedtuple
(
"IcepapEncoders"
,
"ENCIN, ABSENC, INPOS, MOTOR, AXIS, SYNC"
)
enc_names
=
[
"ENCIN"
,
"ABSENC"
,
"INPOS"
,
"MOTOR"
,
"AXIS"
,
"SYNC"
]
addr
=
axis
.
config
.
get
(
"address"
)
enc_values
=
[
_command
(
self
.
_cnx
,
f"?ENC
{
enctype
}
{
addr
}
"
)
for
enctype
in
enc_names
]
return
IceEncoders
(
*
enc_values
)
def
set_encoder
(
self
,
encoder
,
steps
):
_ackcommand
(
self
.
_cnx
,
"ENC %s %d %d"
%
(
encoder
.
enctype
,
encoder
.
address
,
steps
)
...
...
bliss/controllers/motors/mockup.py
View file @
4dfc9769
...
...
@@ -351,14 +351,19 @@ class Mockup(Controller):
motion
=
Motion
(
pos
,
target
,
vel
,
accel
,
self
.
__hw_limit
)
self
.
_axis_moves
[
axis
][
"motion"
]
=
motion
def
__info__
(
self
,
axis
):
"""Return information about Controller and Axis"""
info_string
=
f"Axis:
{
axis
.
name
}
\n
"
info_string
+=
f"Controller:
\n
"
info_string
+=
f" class:
{
self
.
__class__
}
\n
"
info_string
+=
f" name:
{
self
.
name
}
\n
"
return
info_string
def
__info__
(
self
):
"""Return information about Controller"""
info_str
=
f"Controller name:
{
self
.
name
}
\n
"
return
info_str
def
get_axis_info
(
self
,
axis
):
""" Return 'mockup'-specific info about <axis>
"""
info_str
=
"MOCKUP AXIS:
\n
"
info_str
+=
f" this axis (
{
axis
.
name
}
) is a simulation axis
\n
"
return
info_str
def
get_id
(
self
,
axis
):
return
"MOCKUP AXIS %s"
%
(
axis
.
name
)
...
...
bliss/controllers/motors/pi_e753.py
View file @
4dfc9769
...
...
@@ -369,13 +369,21 @@ class PI_E753(Controller):
"""
return
self
.
send
(
axis
,
"*IDN?"
)
def
__info__
(
self
):
info_str
=
"PI {self.model}
\n
"
info_str
+=
" address:{}
\n
"
info_str
+=
" "
def
get_axis_info
(
self
,
axis
):
"""Return Controller specific info about <axis>
"""
info_str
=
"PI INFO:
\n
"
info_str
+=
f" voltage (SVA) =
{
self
.
get_voltage
(
axis
)
}
\n
"
info_str
+=
f" output voltage (VOL) =
{
self
.
get_output_voltage
(
axis
)
}
\n
"
info_str
+=
f" closed loop =
{
self
.
get_closed_loop
(
axis
)
}
\n
"
return
info_str
def
__info__
(
self
):
info_str
=
f"PI
{
self
.
model
}
\n
"
info_str
+=
f"
{
self
.
comm
.
__info__
()
}
"
return
info_str
@
object_method
(
types_info
=
(
"None"
,
"string"
))
def
get_info
(
self
,
axis
):
return
self
.
get_hw_info
()
...
...
tests/motors/test_axis.py
View file @
4dfc9769
...
...
@@ -47,23 +47,27 @@ def test_info(robz, capsys):
assert
robz
.
controller
.
name
==
"test"
captured
=
robz
.
__info__
()
output
=
"
axis name (R): robz
\n
"
output
+=
"
state (R): READY (Axis is READY)
\n
"
output
=
"
AXIS:
\n
"
output
+=
"
name (R): robz
\n
"
output
+=
" unit (R): mm
\n
"
output
+=
" offset (R): 0.0
\n
"
output
+=
" backlash (R): 0
\n
"
output
+=
" offset (R): 0.0
0000
\n
"
output
+=
" backlash (R): 0
.00000
\n
"
output
+=
" sign (R): 1
\n
"
output
+=
" steps_per_unit (R): 10000.0
\n
"
output
+=
" steps_per_unit (R): 10000.0
0
\n
"
output
+=
" tolerance (R) (to check pos. before a move): 0.0001
\n
"
output
+=
" motion_hooks (R): []
\n
"
# output += " motion_hooks (R): []\n"
output
+=
" limits (RW): Low: -1000.00000 High: 1000000000.00000 (config Low: -1000.00000 High: 1000000000.00000)
\n
"
output
+=
" dial (RW): 0.00000
\n
"
output
+=
" position (RW): 0.00000
\n
"
output
+=
"
_hw_position (R): 0.00000
\n
"
output
+=
" hw_state (R): READY (Axis is READY)
\n
"
output
+=
" limits (RW): (-1000.0, 1000000000.0) (config: (-1000.0, 1000000000.0)
)
\n
"
output
+=
"
state (R): READY (Axis is READY)
\n
"
# output += " _hw_position (R): 0.00000
\n"
# output += " hw_state (R): READY (Axis is READY
)\n"
output
+=
" acceleration (RW): 300.00000 (config: 300.00000)
\n
"
output
+=
" acctime (RW): 0.33333 (config: 0.33333)
\n
"
output
+=
" velocity (RW): 100.00000 (config: 100.00000)
\n
"
output
+=
"Controller name: test
\n
"
output
+=
"MOCKUP AXIS:
\n
"
output
+=
" this axis (robz) is a simulation axis
\n
"
output
+=
" encoder: None
\n
"
# # output += "controller: <bliss.controllers.motors.mockup.Mockup object at 0x7f78ac843d30>\n"
...
...
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