Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
d2be09fb
Commit
d2be09fb
authored
Oct 20, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimizing goniometer moves
parent
f54815de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
CalibrationHardwareInterface.java
src/main/java/CalibrationHardwareInterface.java
+9
-0
Goniometer.java
src/main/java/Goniometer.java
+11
-4
No files found.
src/main/java/CalibrationHardwareInterface.java
View file @
d2be09fb
...
@@ -2609,6 +2609,15 @@ public class CalibrationHardwareInterface {
...
@@ -2609,6 +2609,15 @@ public class CalibrationHardwareInterface {
nanoETA
=
System
.
nanoTime
()+((
long
)(
1
E9
*(
Math
.
abs
(
this
.
targetPosition
[
motorNumber
]-
this
.
curpos
[
motorNumber
])*(
this
.
coefficientETA
/
this
.
stepsPerSecond
))));
nanoETA
=
System
.
nanoTime
()+((
long
)(
1
E9
*(
Math
.
abs
(
this
.
targetPosition
[
motorNumber
]-
this
.
curpos
[
motorNumber
])*(
this
.
coefficientETA
/
this
.
stepsPerSecond
))));
return
true
;
return
true
;
}
}
public
boolean
[]
checkGotTarget
(){
updateMotorsPosition
(
0
);
// no wait here
boolean
[]
result
=
new
boolean
[
this
.
curpos
.
length
];
for
(
int
motorNumber
=
0
;
motorNumber
<
result
.
length
;
motorNumber
++){
result
[
motorNumber
]=
Math
.
abs
(
this
.
targetPosition
[
motorNumber
]-
this
.
curpos
[
motorNumber
])<
this
.
motorTolerance
;
}
return
result
;
}
public
boolean
waitMotor
(
public
boolean
waitMotor
(
int
motorNumber
,
int
motorNumber
,
...
...
src/main/java/Goniometer.java
View file @
d2be09fb
...
@@ -473,9 +473,11 @@ horizontal axis:
...
@@ -473,9 +473,11 @@ horizontal axis:
int
axialMotor
,
int
axialMotor
,
int
tiltMotorPosition
,
int
tiltMotorPosition
,
int
axialMotorPosition
,
int
axialMotorPosition
,
AtomicInteger
stopRequested
,
// or null
AtomicInteger
stopRequested
,
// or null
boolean
updateStatus
){
boolean
updateStatus
){
String
status
=
"Moving axial motor to "
+
axialMotorPosition
+
"..."
;
String
status
;
if
(!
this
.
goniometerParameters
.
goniometerMotors
.
checkGotTarget
()[
axialMotor
])
{
status
=
"Moving axial motor to "
+
axialMotorPosition
+
"..."
;
if
(
updateStatus
)
IJ
.
showStatus
(
status
);
if
(
updateStatus
)
IJ
.
showStatus
(
status
);
boolean
OK
=
this
.
goniometerParameters
.
goniometerMotors
.
moveMotorSetETA
(
axialMotor
,
axialMotorPosition
);
boolean
OK
=
this
.
goniometerParameters
.
goniometerMotors
.
moveMotorSetETA
(
axialMotor
,
axialMotorPosition
);
if
(!
OK
)
{
if
(!
OK
)
{
...
@@ -491,7 +493,11 @@ horizontal axis:
...
@@ -491,7 +493,11 @@ horizontal axis:
IJ
.
showMessage
(
"Error"
,
msg
);
IJ
.
showMessage
(
"Error"
,
msg
);
return
false
;
return
false
;
}
}
OK
=
this
.
goniometerParameters
.
goniometerMotors
.
moveMotorSetETA
(
tiltMotor
,
tiltMotorPosition
);
}
if
(!
this
.
goniometerParameters
.
goniometerMotors
.
checkGotTarget
()[
tiltMotor
])
{
status
=
"Moving tilt motor to "
+
tiltMotorPosition
+
"..."
;
if
(
updateStatus
)
IJ
.
showStatus
(
status
);
boolean
OK
=
this
.
goniometerParameters
.
goniometerMotors
.
moveMotorSetETA
(
tiltMotor
,
tiltMotorPosition
);
if
(!
OK
)
{
if
(!
OK
)
{
String
msg
=
"Could not set motor "
+(
tiltMotor
+
1
)+
" to move to "
+
tiltMotorPosition
+
" - may be out of limit"
;
String
msg
=
"Could not set motor "
+(
tiltMotor
+
1
)+
" to move to "
+
tiltMotorPosition
+
" - may be out of limit"
;
System
.
out
.
println
(
"Error: "
+
msg
);
System
.
out
.
println
(
"Error: "
+
msg
);
...
@@ -505,7 +511,8 @@ horizontal axis:
...
@@ -505,7 +511,8 @@ horizontal axis:
IJ
.
showMessage
(
"Error"
,
msg
);
IJ
.
showMessage
(
"Error"
,
msg
);
return
false
;
return
false
;
}
}
return
true
;
}
return
true
;
}
}
...
...
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