Search in sources :

Example 1 with ControlAllPIDCommand

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;
}
Also used : ByteList(com.neuronrobotics.sdk.common.ByteList) PIDChannel(com.neuronrobotics.sdk.pid.PIDChannel) BowlerDatagram(com.neuronrobotics.sdk.common.BowlerDatagram) ControlAllPIDCommand(com.neuronrobotics.sdk.commands.bcs.pid.ControlAllPIDCommand)

Aggregations

ControlAllPIDCommand (com.neuronrobotics.sdk.commands.bcs.pid.ControlAllPIDCommand)1 BowlerDatagram (com.neuronrobotics.sdk.common.BowlerDatagram)1 ByteList (com.neuronrobotics.sdk.common.ByteList)1 PIDChannel (com.neuronrobotics.sdk.pid.PIDChannel)1