Search in sources :

Example 6 with PIDEvent

use of com.neuronrobotics.sdk.pid.PIDEvent in project java-bowler by NeuronRobotics.

the class VirtualAckermanBot method init.

private void init(VirtualWorld w, int botStartX, int botStartY) {
    world = w;
    world.addRobot(this, botStartX, botStartY);
    controller = new VirtualGenericPIDDevice(getMaxTicksPerSecond());
    controller.addPIDEventListener(new IPIDEventListener() {

        public void onPIDReset(int group, int currentValue) {
        }

        public void onPIDLimitEvent(PIDLimitEvent e) {
        }

        public void onPIDEvent(PIDEvent e) {
            world.updateMap();
        }
    });
    setPIDChanel(controller.getPIDChannel(0));
}
Also used : PIDLimitEvent(com.neuronrobotics.sdk.pid.PIDLimitEvent) IPIDEventListener(com.neuronrobotics.sdk.pid.IPIDEventListener) VirtualGenericPIDDevice(com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice) PIDEvent(com.neuronrobotics.sdk.pid.PIDEvent)

Example 7 with PIDEvent

use of com.neuronrobotics.sdk.pid.PIDEvent in project java-bowler by NeuronRobotics.

the class PidRotoryLink method setPIDChannel.

public void setPIDChannel(PIDChannel channel) {
    channel.addPIDEventListener(new IPIDEventListener() {

        @Override
        public void onPIDReset(int group, int currentValue) {
            fireLinkListener(currentValue);
        }

        @Override
        public void onPIDLimitEvent(PIDLimitEvent e) {
            fireLinkLimitEvent(e);
        }

        @Override
        public void onPIDEvent(PIDEvent e) {
            // Log.debug("\nRotory Link Async<<"+e);
            fireLinkListener(e.getValue());
        }
    });
    this.channel = channel;
}
Also used : PIDLimitEvent(com.neuronrobotics.sdk.pid.PIDLimitEvent) IPIDEventListener(com.neuronrobotics.sdk.pid.IPIDEventListener) PIDEvent(com.neuronrobotics.sdk.pid.PIDEvent)

Example 8 with PIDEvent

use of com.neuronrobotics.sdk.pid.PIDEvent in project java-bowler by NeuronRobotics.

the class LegacyPidNamespaceImp method onAsyncResponse.

public void onAsyncResponse(BowlerDatagram data) {
    // Log.debug("\nPID ASYNC<<"+data);
    if (data.getRPC().contains("_pid")) {
        PIDEvent e = new PIDEvent(data);
        firePIDEvent(e);
    }
    if (data.getRPC().contains("apid")) {
        int[] pos = new int[getNumberOfChannels()];
        for (int i = 0; i < getNumberOfChannels(); i++) {
            pos[i] = ByteList.convertToInt(data.getData().getBytes(i * 4, 4), true);
            PIDEvent e = new PIDEvent(i, pos[i], System.currentTimeMillis(), 0);
            firePIDEvent(e);
        }
    }
    if (data.getRPC().contains("pidl")) {
        firePIDLimitEvent(new PIDLimitEvent(data));
    }
}
Also used : PIDLimitEvent(com.neuronrobotics.sdk.pid.PIDLimitEvent) PIDEvent(com.neuronrobotics.sdk.pid.PIDEvent)

Aggregations

PIDEvent (com.neuronrobotics.sdk.pid.PIDEvent)8 PIDLimitEvent (com.neuronrobotics.sdk.pid.PIDLimitEvent)7 IPIDEventListener (com.neuronrobotics.sdk.pid.IPIDEventListener)5 VirtualGenericPIDDevice (com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice)2