Commit d2be09fb authored by Andrey Filippov's avatar Andrey Filippov

optimizing goniometer moves

parent f54815de
......@@ -2610,6 +2610,15 @@ public class CalibrationHardwareInterface {
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(
int motorNumber,
AtomicInteger stopRequested, // or null
......
......@@ -475,7 +475,9 @@ horizontal axis:
int axialMotorPosition,
AtomicInteger stopRequested, // or null
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);
boolean OK= this.goniometerParameters.goniometerMotors.moveMotorSetETA(axialMotor, axialMotorPosition);
if (!OK) {
......@@ -491,7 +493,11 @@ horizontal axis:
IJ.showMessage("Error",msg);
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) {
String msg="Could not set motor "+(tiltMotor+1)+" to move to "+tiltMotorPosition+" - may be out of limit";
System.out.println("Error: "+msg);
......@@ -505,6 +511,7 @@ horizontal axis:
IJ.showMessage("Error",msg);
return false;
}
}
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment