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
c9f2789f
Commit
c9f2789f
authored
Jul 08, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added abort to scanning
parent
4fb1b103
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
31 deletions
+69
-31
Aberration_Calibration.java
src/main/java/Aberration_Calibration.java
+69
-31
No files found.
src/main/java/Aberration_Calibration.java
View file @
c9f2789f
...
@@ -9569,6 +9569,7 @@ if (MORE_BUTTONS) {
...
@@ -9569,6 +9569,7 @@ if (MORE_BUTTONS) {
if
(
centerMotorPos
==
null
)
centerMotorPos
=
focusingMotors
.
readElphel10364Motors
().
clone
();
if
(
centerMotorPos
==
null
)
centerMotorPos
=
focusingMotors
.
readElphel10364Motors
().
clone
();
boolean
allOK
=
true
;
boolean
allOK
=
true
;
boolean
aborted
=
false
;
long
startTime
=
System
.
nanoTime
();
long
startTime
=
System
.
nanoTime
();
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Starting scanning focus in the center, number of steps="
+
focusMeasurementParameters
.
scanNumber
+
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Starting scanning focus in the center, number of steps="
+
focusMeasurementParameters
.
scanNumber
+
", of them "
+
focusMeasurementParameters
.
scanNumberNegative
+
" in negative direction"
+
", of them "
+
focusMeasurementParameters
.
scanNumberNegative
+
" in negative direction"
+
...
@@ -9610,9 +9611,15 @@ if (MORE_BUTTONS) {
...
@@ -9610,9 +9611,15 @@ if (MORE_BUTTONS) {
// do not advance position after last measurement
// do not advance position after last measurement
if
(
numStep
<(
focusMeasurementParameters
.
scanNumber
-
1
))
for
(
int
nm
=
0
;
nm
<
3
;
nm
++)
scanPos
[
nm
]+=
focusMeasurementParameters
.
scanStep
;
if
(
numStep
<(
focusMeasurementParameters
.
scanNumber
-
1
))
for
(
int
nm
=
0
;
nm
<
3
;
nm
++)
scanPos
[
nm
]+=
focusMeasurementParameters
.
scanStep
;
scanPosLast
=
scanPos
.
clone
();
scanPosLast
=
scanPos
.
clone
();
if
(
this
.
SYNC_COMMAND
.
stopRequested
.
get
()>
0
){
aborted
=
true
;
allOK
=
false
;
System
.
out
.
println
(
"Stop requested, command aborted, returning motors to initial position"
);
break
;
}
if
(!
allOK
)
break
;
// failed
if
(!
allOK
)
break
;
// failed
}
}
if
(
focusMeasurementParameters
.
scanTiltEnable
)
{
if
(
allOK
&&
focusMeasurementParameters
.
scanTiltEnable
)
{
if
(
focusMeasurementParameters
.
scanTiltStepsX
>
1
)
{
// 0 or 1 STOPS - do not scan
if
(
focusMeasurementParameters
.
scanTiltStepsX
>
1
)
{
// 0 or 1 STOPS - do not scan
double
scanStepX
=
1.0
*
focusMeasurementParameters
.
scanTiltRangeX
/(
focusMeasurementParameters
.
scanTiltStepsX
-
1
);
double
scanStepX
=
1.0
*
focusMeasurementParameters
.
scanTiltRangeX
/(
focusMeasurementParameters
.
scanTiltStepsX
-
1
);
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Starting scanning tilt in X direction, number of stops="
+
focusMeasurementParameters
.
scanTiltStepsX
+
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Starting scanning tilt in X direction, number of stops="
+
focusMeasurementParameters
.
scanTiltStepsX
+
...
@@ -9620,9 +9627,9 @@ if (MORE_BUTTONS) {
...
@@ -9620,9 +9627,9 @@ if (MORE_BUTTONS) {
for
(
int
numStep
=
0
;
numStep
<
focusMeasurementParameters
.
scanTiltStepsX
;
numStep
++){
for
(
int
numStep
=
0
;
numStep
<
focusMeasurementParameters
.
scanTiltStepsX
;
numStep
++){
int
delta
=(
int
)
Math
.
round
(
focusMeasurementParameters
.
scanTiltRangeX
*
int
delta
=(
int
)
Math
.
round
(
focusMeasurementParameters
.
scanTiltRangeX
*
(
1.0
*
numStep
/(
focusMeasurementParameters
.
scanTiltStepsX
-
1
)
-
0.5
));
(
1.0
*
numStep
/(
focusMeasurementParameters
.
scanTiltStepsX
-
1
)
-
0.5
));
scanPos
[
0
]=
centerMotorPos
[
0
]
+
delta
;
scanPos
[
0
]=
centerMotorPos
[
0
]
-
delta
;
scanPos
[
1
]=
centerMotorPos
[
1
]-
delta
;
scanPos
[
1
]=
centerMotorPos
[
1
]-
delta
;
scanPos
[
2
]=
centerMotorPos
[
2
]+
0
;
scanPos
[
2
]=
centerMotorPos
[
2
]+
delta
;
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Scanning tilt in X direction, step#"
+(
numStep
+
1
)+
" (of "
+
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Scanning tilt in X direction, step#"
+(
numStep
+
1
)+
" (of "
+
(
focusMeasurementParameters
.
scanTiltStepsX
-
1
)+
") at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
));
(
focusMeasurementParameters
.
scanTiltStepsX
-
1
)+
") at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
));
allOK
&=
moveAndMaybeProbe
(
allOK
&=
moveAndMaybeProbe
(
...
@@ -9643,20 +9650,26 @@ if (MORE_BUTTONS) {
...
@@ -9643,20 +9650,26 @@ if (MORE_BUTTONS) {
updateStatus
,
updateStatus
,
debugLevel
,
debugLevel
,
loopDebugLevel
);
loopDebugLevel
);
if
(
this
.
SYNC_COMMAND
.
stopRequested
.
get
()>
0
){
aborted
=
true
;
allOK
=
false
;
System
.
out
.
println
(
"Stop requested, command aborted, returning motors to initial position"
);
break
;
}
if
(!
allOK
)
break
;
// failed
if
(!
allOK
)
break
;
// failed
}
}
}
}
if
(
focusMeasurementParameters
.
scanTiltStepsY
>
1
)
{
// 0 or 1 STOPS - do not scan
if
(
allOK
&&
(
focusMeasurementParameters
.
scanTiltStepsY
>
1
)
)
{
// 0 or 1 STOPS - do not scan
double
scanStepY
=
1.0
*
focusMeasurementParameters
.
scanTiltRangeY
/(
focusMeasurementParameters
.
scanTiltStepsY
-
1
);
double
scanStepY
=
1.0
*
focusMeasurementParameters
.
scanTiltRangeY
/(
focusMeasurementParameters
.
scanTiltStepsY
-
1
);
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Starting scanning tilt in Y direction, number of stops="
+
focusMeasurementParameters
.
scanTiltStepsY
+
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Starting scanning tilt in Y direction, number of stops="
+
focusMeasurementParameters
.
scanTiltStepsY
+
", step size="
+
IJ
.
d2s
(
scanStepY
,
0
));
", step size="
+
IJ
.
d2s
(
scanStepY
,
0
));
for
(
int
numStep
=
0
;
numStep
<
focusMeasurementParameters
.
scanTiltStepsY
;
numStep
++){
for
(
int
numStep
=
0
;
numStep
<
focusMeasurementParameters
.
scanTiltStepsY
;
numStep
++){
int
delta
=(
int
)
Math
.
round
(
focusMeasurementParameters
.
scanTiltRangeY
*
int
delta
=(
int
)
Math
.
round
(
focusMeasurementParameters
.
scanTiltRangeY
*
(
1.0
*
numStep
/(
focusMeasurementParameters
.
scanTiltStepsY
-
1
)
-
0.5
));
(
1.0
*
numStep
/(
focusMeasurementParameters
.
scanTiltStepsY
-
1
)
-
0.5
));
scanPos
[
0
]=
centerMotorPos
[
0
]
-
delta
;
scanPos
[
0
]=
centerMotorPos
[
0
]
+
delta
;
scanPos
[
1
]=
centerMotorPos
[
1
]-
delta
;
scanPos
[
1
]=
centerMotorPos
[
1
]-
delta
;
scanPos
[
2
]=
centerMotorPos
[
2
]+
delta
;
scanPos
[
2
]=
centerMotorPos
[
2
]+
0
;
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Scanning tilt in Y direction, step#"
+(
numStep
+
1
)+
" (of "
+
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Scanning tilt in Y direction, step#"
+(
numStep
+
1
)+
" (of "
+
(
focusMeasurementParameters
.
scanTiltStepsY
-
1
)+
") at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
));
(
focusMeasurementParameters
.
scanTiltStepsY
-
1
)+
") at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
));
allOK
&=
moveAndMaybeProbe
(
allOK
&=
moveAndMaybeProbe
(
...
@@ -9677,6 +9690,12 @@ if (MORE_BUTTONS) {
...
@@ -9677,6 +9690,12 @@ if (MORE_BUTTONS) {
updateStatus
,
updateStatus
,
debugLevel
,
debugLevel
,
loopDebugLevel
);
loopDebugLevel
);
if
(
this
.
SYNC_COMMAND
.
stopRequested
.
get
()>
0
){
aborted
=
true
;
allOK
=
false
;
System
.
out
.
println
(
"Stop requested, command aborted, returning motors to initial position"
);
break
;
}
if
(!
allOK
)
break
;
// failed
if
(!
allOK
)
break
;
// failed
}
}
...
@@ -9684,7 +9703,7 @@ if (MORE_BUTTONS) {
...
@@ -9684,7 +9703,7 @@ if (MORE_BUTTONS) {
}
}
if
(
focusMeasurementParameters
.
scanHysteresis
&&
(
scanPosLast
!=
null
)){
if
(
allOK
&&
focusMeasurementParameters
.
scanHysteresis
&&
(
scanPosLast
!=
null
)){
focusingMotors
.
moveElphel10364Motors
(
// return to last direct scan position
focusingMotors
.
moveElphel10364Motors
(
// return to last direct scan position
true
,
//boolean wait,
true
,
//boolean wait,
scanPosLast
,
scanPosLast
,
...
@@ -9718,9 +9737,27 @@ if (MORE_BUTTONS) {
...
@@ -9718,9 +9737,27 @@ if (MORE_BUTTONS) {
updateStatus
,
updateStatus
,
debugLevel
,
debugLevel
,
loopDebugLevel
);
loopDebugLevel
);
if
(
this
.
SYNC_COMMAND
.
stopRequested
.
get
()>
0
){
aborted
=
true
;
allOK
=
false
;
System
.
out
.
println
(
"Stop requested, command aborted, returning motors to initial position"
);
break
;
}
if
(!
allOK
)
break
;
// failed
if
(!
allOK
)
break
;
// failed
}
}
}
}
if
(
aborted
)
{
System
.
out
.
println
(
"Returning motors to initial position due to command aborted at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
));
focusingMotors
.
moveElphel10364Motors
(
// return to last direct scan position
true
,
//boolean wait,
centerMotorPos
,
0.0
,
//double sleep,
true
,
//boolean showStatus,
""
,
//String message,
false
);
//focusMeasurementParameters.compensateHysteresis); //boolean hysteresis)
return
null
;
}
if
(
allOK
)
{
allOK
&=
moveAndMaybeProbe
(
allOK
&=
moveAndMaybeProbe
(
true
,
true
,
centerMotorPos
,
// null OK
centerMotorPos
,
// null OK
...
@@ -9739,10 +9776,11 @@ if (MORE_BUTTONS) {
...
@@ -9739,10 +9776,11 @@ if (MORE_BUTTONS) {
updateStatus
,
updateStatus
,
debugLevel
,
debugLevel
,
loopDebugLevel
);
loopDebugLevel
);
}
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Scanning focus in the center, number of steps="
+
focusMeasurementParameters
.
scanNumber
+
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Scanning focus in the center, number of steps="
+
focusMeasurementParameters
.
scanNumber
+
", step size="
+
focusMeasurementParameters
.
scanStep
+
" finished at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
));
", step size="
+
focusMeasurementParameters
.
scanStep
+
" finished at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
)+
", allOK="
+
allOK
);
// focusMeasurementParameters.scanStep
// focusMeasurementParameters.scanStep
// focusMeasurementParameters.scanNumber
// focusMeasurementParameters.scanNumber
return
allOK
?
range:
null
;
return
allOK
?
range:
null
;
...
...
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