Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Benoit Rousselle
bliss
Commits
1efec405
Commit
1efec405
authored
Nov 22, 2016
by
Cyril Guilloud
Browse files
[PI E871] debug and messages
parent
f0097bb2
Changes
1
Hide whitespace changes
Inline
Side-by-side
bliss/controllers/motors/PI_E871.py
View file @
1efec405
...
...
@@ -43,10 +43,12 @@ class PI_E871(Controller):
self
.
serial
=
serial
.
Serial
(
self
.
serial_line
,
115200
,
bytesize
=
8
,
parity
=
'N'
,
stopbits
=
1
,
timeout
=
1
)
self
.
_status
=
""
_ctrl_found
=
False
try
:
self
.
serial
.
write
(
"ERR?
\n
"
)
_ans
=
self
.
serial
.
readline
()
print
"err=
%r"
%
_ans
elog
.
debug
(
"ERR? returns :
%r"
%
_ans
)
self
.
serial
.
write
(
"*IDN?
\n
"
)
_ans
=
self
.
serial
.
readline
()
print
_ans
...
...
@@ -56,20 +58,23 @@ class PI_E871(Controller):
try
:
id_pos
=
_ans
.
index
(
"E-871"
)
elog
.
info
(
"Found 871 controller"
)
_ctrl_found
=
True
except
:
elog
.
info
(
"not a 871"
)
raise
elog
.
debug
(
"not a PI E-871 controller."
)
try
:
id_pos
=
_ans
.
index
(
"E-873"
)
elog
.
info
(
"Found 873 controller"
)
_ctrl_found
=
True
except
:
elog
.
info
(
"not a 873"
)
raise
elog
.
debug
(
"not a PI E-873 controller."
)
if
id_pos
>
0
and
id_pos
<
100
:
elog
.
debug
(
"controller is responsive ID=%s"
%
_ans
)
elif
id_pos
==
0
:
elog
.
debug
(
"error : *IDN? -> %r"
%
_ans
)
raise
except
:
self
.
_status
=
"communication error : no PI E871 or E873 found on serial
\"
%s
\"
"
%
self
.
serial_line
print
self
.
_status
...
...
@@ -100,15 +105,15 @@ class PI_E871(Controller):
# Checks referencing.
_ref
=
self
.
_get_referencing
(
axis
)
if
_ref
==
0
:
print
"axis '%s' must be referenced before being movable"
%
axis
.
name
print
"
**********
axis '%s' must be referenced before being movable
**********
"
%
axis
.
name
else
:
print
"axis '%s' is referenced."
%
axis
.
name
@
object_method
(
types_info
=
(
"float"
,
"None"
))
def
custom_initialize_axis
(
self
,
axis
,
current_pos
):
"""
If axis is not referenced (after power on) Use this command to
avid to do a referencing by moving to the limits.
If axis is not referenced (after power on) Use this command to
av
o
id to do a referencing by moving to the limits.
* Activates manual referencing mode.
* Sets <current_pos> as current position.
* Synchronizes axis position.
...
...
@@ -161,7 +166,6 @@ class PI_E871(Controller):
def
set_velocity
(
self
,
axis
,
new_velocity
):
elog
.
debug
(
"set_velocity new_velocity = %f"
%
new_velocity
)
elog
.
debug
(
"NO VELOCITY FOR THIS CONTROLLER"
)
# self.send_no_ans(axis, "%d VEL %s %f" % (axis.address, axis.axis_id, new_velocity))
return
self
.
read_velocity
(
axis
)
""" ACCELERATION """
...
...
@@ -184,9 +188,13 @@ class PI_E871(Controller):
# return AxisState(("UNREFERENCED","axis need to be referenced before a motion to be possible"))
if
self
.
_get_on_target_status
(
axis
):
return
AxisState
(
"READY"
)
_state
=
AxisState
(
"READY"
)
else
:
return
AxisState
(
"MOVING"
)
_state
=
AxisState
(
"MOVING"
)
elog
.
debug
(
"in state(%s) _state=%r"
%
(
axis
.
name
,
_state
))
return
_state
""" MOVEMENTS """
def
prepare_move
(
self
,
motion
):
...
...
@@ -264,11 +272,18 @@ class PI_E871(Controller):
return
_pos
def
_get_on_target_status
(
self
,
axis
):
_ans
=
self
.
send
(
axis
,
"%d ONT?"
%
axis
.
address
)
elog
.
debug
(
"in _get_on_target_status(%s)"
%
axis
)
try
:
_ans
=
self
.
send
(
axis
,
"%d ONT?"
%
axis
.
address
)
except
:
print
"--++--+-+-+-+-+-+"
# print "_ans on target=", _ans
# "0 1 M1=1"
_ans
=
_ans
.
split
(
'='
)[
1
]
elog
.
debug
(
"in _get_on_target_status(%s) _ans=%s"
%
(
axis
,
_ans
))
if
_ans
==
"1"
:
return
True
else
:
...
...
@@ -299,7 +314,7 @@ class PI_E871(Controller):
@
object_method
(
types_info
=
(
"None"
,
"None"
))
def
reference_axis_ref_switch
(
self
,
axis
):
"""
Launches referencing of axis <axis>.
Launches referencing of axis <axis>
and waits for end of referencing
.
"""
self
.
send_no_ans
(
axis
,
"%d FRF"
%
axis
.
address
)
time
.
sleep
(
0.5
)
...
...
@@ -379,7 +394,6 @@ class PI_E871(Controller):
Raises:
?
"""
elog
.
debug
(
"cmd=%s"
%
repr
(
cmd
))
_cmd
=
cmd
+
"
\n
"
self
.
serial
.
write
(
_cmd
)
...
...
@@ -399,6 +413,7 @@ class PI_E871(Controller):
_cmd
=
cmd
+
"
\n
"
self
.
serial
.
write
(
_cmd
)
@
object_method
(
types_info
=
(
"None"
,
"str"
))
def
_get_all_params
(
self
,
axis
):
self
.
serial
.
write
(
"1 HPA?
\n
"
)
...
...
@@ -414,47 +429,47 @@ class PI_E871(Controller):
return
_txt
# result of this command:
# 0 1 The following parameters are valid:
# 0xA= 0 1 FLOAT motorcontroller step velocity maximum
# 0xB= 0 1 FLOAT motorcontroller step acceleration
# 0xC= 0 1 FLOAT motorcontroller step deceleration
# 0xE= 0 1 INT motorcontroller numerator
# 0xF= 0 1 INT motorcontroller denominator
# 0x13= 0 1 INT motorcontroller rotary stage (0=no 1=yes)
# 0x14= 0 1 INT motorcontroller has reference
# 0x15= 0 1 FLOAT motorcontroller travel range maximum
# 0x16= 0 1 FLOAT motorcontroller reference position
# 0x17= 0 1 FLOAT motorcontroller distance between reference and negative limit
# 0x18= 0 1 INT motorcontroller limit mode
# 0x1A= 0 1 INT motorcontroller has brake
# 0x2F= 0 1 FLOAT motorcontroller distance between reference and positive limit
# 0x30= 0 1 FLOAT motorcontroller travel range minimum
# 0x31= 0 1 INT motorcontroller invert reference
# 0x32= 0 1 INT motorcontroller has limits (0=limitswitchs 1=no limitswitchs)
# 0x3C= 0 1 CHAR motorcontroller stage name
# 0x40= 0 1 INT motorcontroller holding current
# 0x41= 0 1 INT motorcontroller operating current
# 0x42= 0 1 INT motorcontroller holding current delay
# 0x47= 0 1 INT motorcontroller reference travel direction
# 0x49= 0 1 FLOAT motorcontroller step velocity
# 0x4A= 0 1 FLOAT motorcontroller step acceleration maximum
# 0x4B= 0 1 FLOAT motorcontroller step deceleration maximum
# 0x50= 0 1 FLOAT motorcontroller referencing velocity
# 0x5C= 0 1 INT motorcontroller DIO as REF
# 0x5D= 0 1 INT motorcontroller DIO as NLIM
# 0x5E= 0 1 INT motorcontroller DIO as PLIM
# 0x5F= 0 1 INT motorcontroller invert DIO-NLIM
# 0x60= 0 1 INT motorcontroller invert DIO-PLIM
# 0x61= 0 1 INT motorcontroller invert joystick
# 0x63= 0 1 FLOAT motorcontroller distance between limit and hard stop
# 0x72= 0 1 INT motorcontroller macro ignore error
# 0x9A= 0 1 INT motorcontroller external sensor numerator
# 0x9B= 0 1 INT motorcontroller external sensor denominator
# 0x7000601= 0 1 CHAR motorcontroller axis unit
# 0x7000000= 0 1 FLOAT motorcontroller travel range minimum
# 0x7000001= 0 1 FLOAT motorcontroller travel range maximum
# 0 1 The following parameters are valid:
# 0xA= 0 1 FLOAT motorcontroller step velocity maximum
# 0xB= 0 1 FLOAT motorcontroller step acceleration
# 0xC= 0 1 FLOAT motorcontroller step deceleration
# 0xE= 0 1 INT motorcontroller numerator
# 0xF= 0 1 INT motorcontroller denominator
# 0x13= 0 1 INT motorcontroller rotary stage (0=no 1=yes)
# 0x14= 0 1 INT motorcontroller has reference
# 0x15= 0 1 FLOAT motorcontroller travel range maximum
# 0x16= 0 1 FLOAT motorcontroller reference position
# 0x17= 0 1 FLOAT motorcontroller distance between reference and negative limit
# 0x18= 0 1 INT motorcontroller limit mode
# 0x1A= 0 1 INT motorcontroller has brake
# 0x2F= 0 1 FLOAT motorcontroller distance between reference and positive limit
# 0x30= 0 1 FLOAT motorcontroller travel range minimum
# 0x31= 0 1 INT motorcontroller invert reference
# 0x32= 0 1 INT motorcontroller has limits (0=limitswitchs 1=no limitswitchs)
# 0x3C= 0 1 CHAR motorcontroller stage name
# 0x40= 0 1 INT motorcontroller holding current
# 0x41= 0 1 INT motorcontroller operating current
# 0x42= 0 1 INT motorcontroller holding current delay
# 0x47= 0 1 INT motorcontroller reference travel direction
# 0x49= 0 1 FLOAT motorcontroller step velocity
# 0x4A= 0 1 FLOAT motorcontroller step acceleration maximum
# 0x4B= 0 1 FLOAT motorcontroller step deceleration maximum
# 0x50= 0 1 FLOAT motorcontroller referencing velocity
# 0x5C= 0 1 INT motorcontroller DIO as REF
# 0x5D= 0 1 INT motorcontroller DIO as NLIM
# 0x5E= 0 1 INT motorcontroller DIO as PLIM
# 0x5F= 0 1 INT motorcontroller invert DIO-NLIM
# 0x60= 0 1 INT motorcontroller invert DIO-PLIM
# 0x61= 0 1 INT motorcontroller invert joystick
# 0x63= 0 1 FLOAT motorcontroller distance between limit and hard stop
# 0x72= 0 1 INT motorcontroller macro ignore error
# 0x9A= 0 1 INT motorcontroller external sensor numerator
# 0x9B= 0 1 INT motorcontroller external sensor denominator
# 0x7000601= 0 1 CHAR motorcontroller axis unit
# 0x7000000= 0 1 FLOAT motorcontroller travel range minimum
# 0x7000001= 0 1 FLOAT motorcontroller travel range maximum
# end of help
def
get_info
(
self
,
axis
):
...
...
@@ -535,14 +550,8 @@ class PI_E871(Controller):
return
_txt
return
_txt
# 873
#
#
# ###############################
# id : (c)2015 Physik Instrumente (PI) GmbH & Co. KG, E-873.1A1, 115072229, 01.09
# Firmware Ver. : 0 1 FW_DSP: V01.09
...
...
@@ -555,7 +564,7 @@ class PI_E871(Controller):
# On Target : 0 1 1=1
# SVO? : 0 1 1=1
# LIM? : 0 1 1=0
# Brake? :
# Brake? :
# ref mode (RON?) 1:FRF or F(N/P)L : 0 1 1=1
# referenced? : 0 1 1=1
# has ref switch : 0 1 1=1
...
...
@@ -586,3 +595,4 @@ class PI_E871(Controller):
# velocity for ref move : 0 1
# axis unit : 0 1 1 0X07000601=MM
# ###############################
Write
Preview
Supports
Markdown
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