// Actuators
List<IActuator> actuatorsList;
List<String> actuatorsNamesList;
String[] actuatorsNamesArray;
IDimensionEnergy dimension = config.getDimensionX();
actuatorsList = dimension.getActuatorsList();
actuatorsNamesList = new ArrayList<String>(actuatorsList.size());
for (IActuator actuator : actuatorsList) {
if (actuator.isEnabled()) {
actuatorsNamesList.add(actuator.getName());
}
}
actuatorsNamesArray = actuatorsNamesList.toArray(new String[actuatorsNamesList
.size()]);
setAttribute("actuators", actuatorsNamesArray);
// Dimensions
// Tango exchanges trajectories as double arrays that contains the positions, in
// order,
// actuator after actuator, range after range, of the trajectories of all the
// actuators.
// There is one such array per dimension.
double[] allActuatorsPositionsArray;
double initialValue;
// Contains the positions in order, range after range, of the trajectories of an
// actuator.
List<Double> actuatorPositionsList;
// Contains the positions in order, actuator after actuator, range after range, of
// the trajectories of all the actuators.
List<Double> allActuatorsPositionsList;
// The list of integrations times.
List<Double> integrationsTimesList;
double[] integrationsTimesArray;
// The list of speeds.
List<Double> speedList = new ArrayList<Double>();
double[] speedArray;
// The number of points, which is the total steps numbers + 1 per range.
int totalStepsNumber;
// The actuators used for this dimension
List<IActuator> dimensionActuatorsList;
// Dimension.
// Initial computations.
dimensionActuatorsList = dimension.getActuatorsList();
// The positions, sorted as Tango expect them.
allActuatorsPositionsList = new ArrayList<Double>();
// The number of enabled actuators.
int enabledActuatorsNumber = 0;
// The positions must be sorted by actuator, so we loop over the actuators.
for (IActuator actuator : dimensionActuatorsList) {
if (actuator.isEnabled()) {
initialValue = ActuatorConnector.getData(actuator);
actuatorPositionsList = new ArrayList<Double>();
// For each actuators, the positions must be sorted by range.
for (ITrajectory trajectory : findActuatorTrajectories(dimension, actuator)) {
actuatorPositionsList.addAll(TrajectoryCalculator
.calculateLinearTrajectoriesPosition(
(ITrajectoryEnergy) trajectory, initialValue));
// The speeds must be sorted in the same order, so we read them here.
speedList.add(trajectory.getSpeed());
}
allActuatorsPositionsList.addAll(actuatorPositionsList);
++enabledActuatorsNumber;
}
}
// Integration Time and steps number.
config.getDimensionX().getRangesEnergyList().get(0).getIntegrationTime();
integrationsTimesList = new ArrayList<Double>();
int stepsNumber;
int index;
double integrationTime;
totalStepsNumber = 0;
for (IRangeEnergy range : dimension.getRangesEnergyList()) {
stepsNumber = range.getStepsNumber();
integrationTime = range.getIntegrationTime();
for (index = 0; index < stepsNumber + 1; ++index) {
integrationsTimesList.add(integrationTime);
}