cleanup comments
This commit is contained in:
@@ -28,37 +28,15 @@ import ch.psi.fda.core.EngineConfiguration;
|
||||
import ch.psi.jcae.ChannelBean;
|
||||
import ch.psi.jcae.ChannelBeanFactory;
|
||||
|
||||
/**
|
||||
* This actuator sets an Channel Access channel from a start to an end value by doing discrete steps.
|
||||
* @author ebner
|
||||
*
|
||||
*/
|
||||
public class ChannelAccessFunctionActuator<T> implements Actor {
|
||||
|
||||
// Get Logger
|
||||
private static Logger logger = Logger.getLogger(ChannelAccessFunctionActuator.class.getName());
|
||||
|
||||
private boolean asynchronous = false;
|
||||
|
||||
/**
|
||||
* Start value of the actuator
|
||||
*/
|
||||
private double start;
|
||||
|
||||
/**
|
||||
* End value of the actuator
|
||||
*/
|
||||
private double end;
|
||||
|
||||
/**
|
||||
* Step size of the move
|
||||
*/
|
||||
private double stepSize;
|
||||
|
||||
/**
|
||||
* Move direction (start<end = 1, start>end = -1)
|
||||
*/
|
||||
private int direction;
|
||||
private int direction; // Move direction (start<end = 1, start>end = -1)
|
||||
|
||||
/**
|
||||
* Execution count of actuator. This variable is used to minimize the floating point
|
||||
@@ -84,14 +62,9 @@ public class ChannelAccessFunctionActuator<T> implements Actor {
|
||||
private double accuracy;
|
||||
|
||||
/**
|
||||
* Channel Access channel of the actuator
|
||||
* Move timeout
|
||||
*/
|
||||
private ChannelBean<Double> channel;
|
||||
|
||||
/**
|
||||
* Channel Access channel of the actuator
|
||||
*/
|
||||
private ChannelBean<T> doneChannel = null;
|
||||
private Long timeout;
|
||||
|
||||
private final T doneValue;
|
||||
private final long doneDelay;
|
||||
@@ -100,11 +73,8 @@ public class ChannelAccessFunctionActuator<T> implements Actor {
|
||||
private final double originalEnd;
|
||||
private final int originalDirection;
|
||||
|
||||
|
||||
/**
|
||||
* Move timeout
|
||||
*/
|
||||
private Long timeout;
|
||||
private ChannelBean<Double> channel;
|
||||
private ChannelBean<T> doneChannel = null;
|
||||
|
||||
private final Function function;
|
||||
|
||||
@@ -189,9 +159,6 @@ public class ChannelAccessFunctionActuator<T> implements Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.engine.Actor#set()
|
||||
*/
|
||||
@Override
|
||||
public void set() throws InterruptedException {
|
||||
|
||||
@@ -255,17 +222,11 @@ public class ChannelAccessFunctionActuator<T> implements Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.engine.Actor#hasNext()
|
||||
*/
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return next;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#init()
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
this.count = 0;
|
||||
@@ -282,9 +243,6 @@ public class ChannelAccessFunctionActuator<T> implements Actor {
|
||||
this.next = true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#reverse()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void reverse() {
|
||||
double oldStart = start;
|
||||
@@ -299,9 +257,6 @@ public class ChannelAccessFunctionActuator<T> implements Actor {
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#reset()
|
||||
*/
|
||||
@Override
|
||||
public void reset() {
|
||||
this.start = this.originalStart;
|
||||
@@ -309,9 +264,6 @@ public class ChannelAccessFunctionActuator<T> implements Actor {
|
||||
this.direction = this.originalDirection;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#destroy()
|
||||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
// Destroy channel
|
||||
@@ -333,18 +285,10 @@ public class ChannelAccessFunctionActuator<T> implements Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the asynchronous
|
||||
*/
|
||||
public boolean isAsynchronous() {
|
||||
return asynchronous;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param asynchronous the asynchronous to set
|
||||
*/
|
||||
public void setAsynchronous(boolean asynchronous) {
|
||||
this.asynchronous = asynchronous;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,29 +35,13 @@ import ch.psi.jcae.ChannelBeanFactory;
|
||||
*/
|
||||
public class ChannelAccessLinearActuator<T> implements Actor {
|
||||
|
||||
// Get Logger
|
||||
private static Logger logger = Logger.getLogger(ChannelAccessLinearActuator.class.getName());
|
||||
|
||||
private boolean asynchronous = false;
|
||||
|
||||
/**
|
||||
* Start value of the actuator
|
||||
*/
|
||||
private double start;
|
||||
|
||||
/**
|
||||
* End value of the actuator
|
||||
*/
|
||||
private double end;
|
||||
|
||||
/**
|
||||
* Step size of the move
|
||||
*/
|
||||
private double stepSize;
|
||||
|
||||
/**
|
||||
* Move direction (start<end = 1, start>end = -1)
|
||||
*/
|
||||
private int direction;
|
||||
|
||||
/**
|
||||
@@ -83,15 +67,7 @@ public class ChannelAccessLinearActuator<T> implements Actor {
|
||||
*/
|
||||
private double accuracy;
|
||||
|
||||
/**
|
||||
* Channel Access channel of the actuator
|
||||
*/
|
||||
private ChannelBean<Double> channel;
|
||||
|
||||
/**
|
||||
* Channel Access channel of the actuator
|
||||
*/
|
||||
private ChannelBean<T> doneChannel = null;
|
||||
|
||||
private final T doneValue;
|
||||
private final long doneDelay;
|
||||
@@ -100,12 +76,10 @@ public class ChannelAccessLinearActuator<T> implements Actor {
|
||||
private final double originalEnd;
|
||||
private final int originalDirection;
|
||||
|
||||
private Long timeout; // Set timeout
|
||||
|
||||
/**
|
||||
* Move timeout
|
||||
*/
|
||||
private Long timeout;
|
||||
|
||||
private final ChannelBean<Double> channel;
|
||||
private final ChannelBean<T> doneChannel;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -159,6 +133,7 @@ public class ChannelAccessLinearActuator<T> implements Actor {
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException("Unable to initialize actuator channel [name:"+channelName+"]",e);
|
||||
}
|
||||
|
||||
if(doneChannelName != null){
|
||||
try {
|
||||
doneChannel = ChannelBeanFactory.getFactory().createChannelBean((Class<T>) doneValue.getClass(), doneChannelName, false);
|
||||
@@ -169,11 +144,11 @@ public class ChannelAccessLinearActuator<T> implements Actor {
|
||||
throw new RuntimeException("Unable to initialize actuator channel [name:"+doneChannelName+"]",e);
|
||||
}
|
||||
}
|
||||
else{
|
||||
doneChannel=null;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.engine.Actor#set()
|
||||
*/
|
||||
@Override
|
||||
public void set() throws InterruptedException {
|
||||
|
||||
@@ -232,17 +207,11 @@ public class ChannelAccessLinearActuator<T> implements Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.engine.Actor#hasNext()
|
||||
*/
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return next;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#init()
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
this.count = 0;
|
||||
@@ -259,9 +228,6 @@ public class ChannelAccessLinearActuator<T> implements Actor {
|
||||
this.next = true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#reverse()
|
||||
*/
|
||||
@Override
|
||||
public synchronized void reverse() {
|
||||
double oldStart = start;
|
||||
@@ -276,9 +242,6 @@ public class ChannelAccessLinearActuator<T> implements Actor {
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#reset()
|
||||
*/
|
||||
@Override
|
||||
public void reset() {
|
||||
this.start = this.originalStart;
|
||||
@@ -286,9 +249,6 @@ public class ChannelAccessLinearActuator<T> implements Actor {
|
||||
this.direction = this.originalDirection;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#destroy()
|
||||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
// Destroy channel
|
||||
@@ -310,20 +270,10 @@ public class ChannelAccessLinearActuator<T> implements Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the asynchronous
|
||||
*/
|
||||
public boolean isAsynchronous() {
|
||||
return asynchronous;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param asynchronous the asynchronous to set
|
||||
*/
|
||||
public void setAsynchronous(boolean asynchronous) {
|
||||
this.asynchronous = asynchronous;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import ch.psi.jcae.ChannelBeanFactory;
|
||||
*/
|
||||
public class ChannelAccessTableActuator<T> implements Actor {
|
||||
|
||||
// Get Logger
|
||||
private static Logger logger = Logger.getLogger(ChannelAccessTableActuator.class.getName());
|
||||
|
||||
private boolean asynchronous = false;
|
||||
@@ -157,9 +156,6 @@ public class ChannelAccessTableActuator<T> implements Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.engine.Actor#set()
|
||||
*/
|
||||
@Override
|
||||
public void set() throws InterruptedException {
|
||||
|
||||
@@ -223,17 +219,11 @@ public class ChannelAccessTableActuator<T> implements Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.engine.Actor#hasNext()
|
||||
*/
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return next;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#init()
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
@@ -250,9 +240,6 @@ public class ChannelAccessTableActuator<T> implements Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#reverse()
|
||||
*/
|
||||
@Override
|
||||
public void reverse() {
|
||||
if(positiveDirection){
|
||||
@@ -263,17 +250,11 @@ public class ChannelAccessTableActuator<T> implements Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#reset()
|
||||
*/
|
||||
@Override
|
||||
public void reset() {
|
||||
this.positiveDirection = this.originalPositiveDirection;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#destroy()
|
||||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
// Destroy channel
|
||||
@@ -295,20 +276,10 @@ public class ChannelAccessTableActuator<T> implements Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the asynchronous
|
||||
*/
|
||||
public boolean isAsynchronous() {
|
||||
return asynchronous;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param asynchronous the asynchronous to set
|
||||
*/
|
||||
public void setAsynchronous(boolean asynchronous) {
|
||||
this.asynchronous = asynchronous;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ import ch.psi.fda.core.Actor;
|
||||
*/
|
||||
public class ComplexActuator implements Actor {
|
||||
|
||||
// Get Logger
|
||||
private static Logger logger = Logger.getLogger(ComplexActuator.class.getName());
|
||||
|
||||
/**
|
||||
@@ -90,9 +89,6 @@ public class ComplexActuator implements Actor {
|
||||
this.firstrun = true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#set()
|
||||
*/
|
||||
@Override
|
||||
public void set() throws InterruptedException {
|
||||
// Throw an IllegalStateException in the case that set is called although there is no next step.
|
||||
@@ -139,17 +135,11 @@ public class ComplexActuator implements Actor {
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#hasNext()
|
||||
*/
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return next;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#init()
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
@@ -191,9 +181,6 @@ public class ComplexActuator implements Actor {
|
||||
this.firstrun = true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#reverse()
|
||||
*/
|
||||
@Override
|
||||
public void reverse() {
|
||||
// Reverse all actors this actor consist of
|
||||
@@ -202,9 +189,6 @@ public class ComplexActuator implements Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#reset()
|
||||
*/
|
||||
@Override
|
||||
public void reset() {
|
||||
// Reset all actors this actor consist of
|
||||
@@ -213,31 +197,6 @@ public class ComplexActuator implements Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of actors of this ComplexActor
|
||||
* @return the actors
|
||||
*/
|
||||
public List<Actor> getActors() {
|
||||
return actors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the preActions
|
||||
*/
|
||||
public List<Action> getPreActions() {
|
||||
return preActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the postActions
|
||||
*/
|
||||
public List<Action> getPostActions() {
|
||||
return postActions;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#destroy()
|
||||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
// Destroy preActions
|
||||
@@ -255,7 +214,14 @@ public class ComplexActuator implements Actor {
|
||||
a.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<Action> getPreActions() {
|
||||
return preActions;
|
||||
}
|
||||
public List<Actor> getActors() {
|
||||
return actors;
|
||||
}
|
||||
public List<Action> getPostActions() {
|
||||
return postActions;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
|
||||
package ch.psi.fda.core.actors;
|
||||
|
||||
/**
|
||||
* @author ebner
|
||||
*
|
||||
*/
|
||||
public interface Function {
|
||||
public double calculate(double parameter);
|
||||
}
|
||||
|
||||
@@ -36,22 +36,16 @@ import ch.psi.fda.core.scripting.JythonGlobalVariable;
|
||||
*/
|
||||
public class JythonFunction implements Function {
|
||||
|
||||
// Get Logger
|
||||
private static final Logger logger = Logger.getLogger(JythonFunction.class.getName());
|
||||
|
||||
public static final String ENTRY_FUNCTION_NAME = "calculate";
|
||||
private static final String ENTRY_FUNCTION_PATTERN = "def "+ENTRY_FUNCTION_NAME+"\\((.*)\\):";
|
||||
|
||||
/**
|
||||
* Script engine of the manipulator
|
||||
*/
|
||||
private ScriptEngine engine;
|
||||
|
||||
private String additionalParameter = "";
|
||||
|
||||
|
||||
public JythonFunction(String script, Map<String, JythonGlobalVariable> map){
|
||||
// Create new script engine
|
||||
this.engine = new ScriptEngineManager().getEngineByName("python");
|
||||
|
||||
// Determine script entry function and the function parameters
|
||||
@@ -95,9 +89,6 @@ public class JythonFunction implements Function {
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.actors.Function#calculate(double)
|
||||
*/
|
||||
@Override
|
||||
public double calculate(double parameter) {
|
||||
logger.fine("Function called");
|
||||
|
||||
@@ -25,31 +25,16 @@ import ch.psi.fda.core.Actor;
|
||||
* Special actuator for the OTFLoop. This type of actor must not be used in any other
|
||||
* type of loop than OTFLoop. If it is used it will, depending on the loop, immediately stop the loop
|
||||
* as it no single step.
|
||||
* @author ebner
|
||||
*
|
||||
*/
|
||||
public class OTFActuator implements Actor {
|
||||
|
||||
/**
|
||||
* Name of the motor channel
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Channel name of the encoder;
|
||||
*/
|
||||
private final String readback;
|
||||
|
||||
private final String id;
|
||||
private final String name; // name of the motor channel
|
||||
private final String readback; // name of the encoder channel
|
||||
private double start;
|
||||
private double end;
|
||||
private final double stepSize;
|
||||
private final double integrationTime;
|
||||
|
||||
private final String id;
|
||||
|
||||
/**
|
||||
* Additional backlash for the motor
|
||||
*/
|
||||
private final double additionalBacklash;
|
||||
|
||||
|
||||
@@ -64,125 +49,57 @@ public class OTFActuator implements Actor {
|
||||
this.additionalBacklash = additionalBacklash;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#set()
|
||||
*/
|
||||
@Override
|
||||
public void set() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#hasNext()
|
||||
*/
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reverse() {
|
||||
double aend = end;
|
||||
end=start;
|
||||
start=aend;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the readback
|
||||
*/
|
||||
public String getReadback() {
|
||||
return readback;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the start
|
||||
*/
|
||||
public double getStart() {
|
||||
return start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the end
|
||||
*/
|
||||
public double getEnd() {
|
||||
return end;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the stepSize
|
||||
*/
|
||||
public double getStepSize() {
|
||||
return stepSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the integrationTime
|
||||
*/
|
||||
public double getIntegrationTime() {
|
||||
return integrationTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the additionalBacklash
|
||||
*/
|
||||
public double getAdditionalBacklash() {
|
||||
return additionalBacklash;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#init()
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
// Not implemented
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#reverse()
|
||||
*/
|
||||
@Override
|
||||
public void reverse() {
|
||||
// Not implemented
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#reset()
|
||||
*/
|
||||
@Override
|
||||
public void reset() {
|
||||
// Not implemented
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.fda.core.Actor#destroy()
|
||||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
// Nothing to be done
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param start the start to set
|
||||
*/
|
||||
public void setStart(double start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param end the end to set
|
||||
*/
|
||||
public void setEnd(double end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -579,10 +579,7 @@ public class CrlogicLoop implements ActionLoop {
|
||||
// t.start();
|
||||
|
||||
if(zigZag){
|
||||
// Swap start and end
|
||||
double aend = actuator.getEnd();
|
||||
actuator.setEnd(actuator.getStart());
|
||||
actuator.setStart(aend);
|
||||
actuator.reverse();
|
||||
}
|
||||
|
||||
synchronized(this){
|
||||
|
||||
Reference in New Issue
Block a user