Search in sources :

Example 1 with IPIDEventListener

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

the class AbstractKinematicsNR method runHome.

private void runHome(PIDChannel joint, int tps) {
    IPIDEventListener listen = new IPIDEventListener() {

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

        @Override
        public void onPIDLimitEvent(PIDLimitEvent e) {
            // short circut the waiting loop
            homeTime = 0;
            Log.debug("Homing PID Limit event " + e);
        }

        @Override
        public void onPIDEvent(PIDEvent e) {
            homeTime = System.currentTimeMillis();
        }
    };
    joint.addPIDEventListener(listen);
    homeTime = System.currentTimeMillis();
    joint.SetPIDSetPoint(tps, 0);
    Log.info("Homing output to value: " + tps);
    while ((System.currentTimeMillis() < homeTime + 3000)) {
        ThreadUtil.wait(100);
    }
    joint.removePIDEventListener(listen);
}
Also used : PIDLimitEvent(com.neuronrobotics.sdk.pid.PIDLimitEvent) IPIDEventListener(com.neuronrobotics.sdk.pid.IPIDEventListener) PIDEvent(com.neuronrobotics.sdk.pid.PIDEvent)

Example 2 with IPIDEventListener

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

the class VirtualPuckBot method init.

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

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

        public void onPIDLimitEvent(PIDLimitEvent e) {
        }

        public void onPIDEvent(PIDEvent e) {
            world.updateMap();
        }
    });
    setPIDChanels(controller.getPIDChannel(0), controller.getPIDChannel(1));
}
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 3 with IPIDEventListener

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

the class PidPrismaticLink method setPIDChannel.

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

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

        @Override
        public void onPIDLimitEvent(PIDLimitEvent e) {
        }

        @Override
        public void onPIDEvent(PIDEvent 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 4 with IPIDEventListener

use of com.neuronrobotics.sdk.pid.IPIDEventListener 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 5 with IPIDEventListener

use of com.neuronrobotics.sdk.pid.IPIDEventListener 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)

Aggregations

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