Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadSpecialModules
Commits
d06ff674
Commit
d06ff674
authored
Sep 23, 2019
by
yannick legoc
Browse files
Take the middle position in Nomad3DController when the position is outside limits
parent
3ad6b1d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/controllers/nomad3d/Nomad3DController.cpp
View file @
d06ff674
...
...
@@ -153,7 +153,18 @@ void Nomad3DController::updateActualPosition(int32 i) {
writer
.
Key
(
data
.
name
.
c_str
());
// Do not apply the offset.
writer
.
Double
(
data
.
controller
->
position
()
*
data
.
coef
);
float64
position
=
data
.
controller
->
position
();
// Get the middle position if the position is outside the limits.
// This can be due to a unplugged encoder.
float64
minPosition
=
data
.
controller
->
minPosition
();
float64
maxPosition
=
data
.
controller
->
maxPosition
();
if
(
position
<
minPosition
||
position
>
maxPosition
)
{
position
=
0.5
*
(
minPosition
+
maxPosition
);
}
writer
.
Double
(
position
*
data
.
coef
);
}
// Write the virtual axis controllers.
...
...
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