use of com.neuronrobotics.sdk.commands.bcs.pid.ControlAllPIDCommand in project java-bowler by NeuronRobotics.
the class LegacyPidNamespaceImp method GetAllPIDPosition.
@Override
public int[] GetAllPIDPosition() {
Log.debug("Getting All PID Positions");
BowlerDatagram b = getDevice().send(new ControlAllPIDCommand());
ByteList data = b.getData();
int[] back = new int[data.size() / 4];
for (int i = 0; i < back.length; i++) {
int start = i * 4;
byte[] tmp = data.getBytes(start, 4);
back[i] = ByteList.convertToInt(tmp, true);
}
if (back.length != getNumberOfChannels()) {
lastPacketTime = new long[back.length];
for (int i = 0; i < back.length; i++) {
PIDChannel c = new PIDChannel(this, i);
c.setCachedTargetValue(back[i]);
getChannels().add(c);
}
}
return back;
}
Aggregations