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
b0545a98
Commit
b0545a98
authored
May 10, 2021
by
Matias Guijarro
Committed by
Cyril Guilloud
May 10, 2021
Browse files
Resolve "user message"
parent
028e3d7f
Changes
3
Hide whitespace changes
Inline
Side-by-side
bliss/common/axis.py
View file @
b0545a98
...
...
@@ -1268,7 +1268,7 @@ class Axis(Scannable):
@
velocity
.
setter
@
lazy_init
def
velocity
(
self
,
new_velocity
):
# Write -> Converts into motor units to change velocity of axis.
"
# Write -> Converts into motor units to change velocity of axis.
new_velocity
=
float
(
new_velocity
)
# accepts both float or numpy array of 1 element
...
...
@@ -1296,6 +1296,9 @@ class Axis(Scannable):
f
"Controller velocity (
{
_user_vel
}
) is different from set velocity (
{
new_velocity
}
)"
,
)
curr_vel
=
self
.
settings
.
get
(
"velocity"
)
if
curr_vel
!=
_user_vel
:
user_print
(
f
"'
{
self
.
name
}
` velocity changed from
{
curr_vel
}
to
{
_user_vel
}
"
)
self
.
settings
.
set
(
"velocity"
,
_user_vel
)
return
_user_vel
...
...
@@ -1494,6 +1497,11 @@ class Axis(Scannable):
self
.
__controller
.
set_acceleration
(
self
,
new_acc
*
abs
(
self
.
steps_per_unit
))
_ctrl_acc
=
self
.
__controller
.
read_acceleration
(
self
)
_acceleration
=
_ctrl_acc
/
abs
(
self
.
steps_per_unit
)
curr_acc
=
self
.
settings
.
get
(
"acceleration"
)
if
curr_acc
!=
_acceleration
:
user_print
(
f
"'
{
self
.
name
}
` acceleration changed from
{
curr_acc
}
to
{
_acceleration
}
"
)
self
.
settings
.
set
(
"acceleration"
,
_acceleration
)
return
_acceleration
...
...
doc/docs/bliss_motion_control_basics.md
View file @
b0545a98
...
...
@@ -66,6 +66,7 @@ DEMO [11]: mot1.velocity ⏎ # to READ the velocity
Out
[
11
]:
1.25
DEMO
[
12
]:
mot1
.
velocity
=
3.0
⏎
# to SET a new velocity
'mot1` velocity changed from 1.25 to 3.0
DEMO [13]:
DEMO [14]: mot1.velocity ⏎
...
...
@@ -128,7 +129,8 @@ position in user units. The dial position is accessible through the
The
**user position**
derives from the dial, following the formula
defined below:
`velocity_low_limit`
and
`velocity_high_limit`
are optional velocity limit defined in the configuration.
`velocity_low_limit`
and
`velocity_high_limit`
are optional velocity limit
defined in the configuration.
```
user_position = (sign * dial_position) + offset```
...
...
@@ -179,7 +181,6 @@ Thus:
* when acceleration is changed, acctime is updated
* when acctime is changed, acceleration is updated.
```
python
DEMO [17]: mot1.acceleration ⏎
Out [17]: 10.0
...
...
@@ -188,16 +189,18 @@ DEMO [18]: mot1.acctime ⏎
Out [18]: 0.4
DEMO [19]: mot1.acceleration=20 ⏎
'mot1
` acceleration changed from 10.0 to 20.0
DEMO [20]: mot1.acctime ⏎
Out [20]: 0.2
DEMO [21]: mot1.acctime=1 ⏎
'mot1`
acceleration changed from 20.0 to 4.0
DEMO [22]: mot1.acceleration ⏎
Out [22]: 4.0
```
### limits
Read-Write - float - from config and persistant in memory
...
...
tests/motors/test_axis_messages.py
View file @
b0545a98
...
...
@@ -35,6 +35,22 @@ def test_axis_stdout(roby, capsys, log_shell_mode):
==
"'roby` position reset from 0.0 to 2.0 (sign: 1, offset: 1.0)
\n
'roby` dial position reset from 1.0 to 2.0
\n
"
)
vel
=
roby
.
velocity
roby
.
velocity
=
vel
+
1
assert
(
capsys
.
readouterr
().
out
==
f
"'roby` velocity changed from
{
vel
}
to
{
roby
.
velocity
}
\n
"
)
acc
=
roby
.
acceleration
roby
.
acceleration
=
acc
+
1
assert
(
capsys
.
readouterr
().
out
==
f
"'roby` acceleration changed from
{
acc
}
to
{
roby
.
acceleration
}
\n
"
)
def
test_axis_stdout2
(
roby
,
bad_motor
,
capsys
,
log_shell_mode
):
"""Ensure "Moving..." and "...stopped at..." messages are present.
...
...
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