Search in sources :

Example 1 with PIDLimitEvent

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

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

the class PidNamespaceImp method onAsyncResponse.

@Override
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)

Example 3 with PIDLimitEvent

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

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

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

Aggregations

PIDLimitEvent (com.neuronrobotics.sdk.pid.PIDLimitEvent)8 PIDEvent (com.neuronrobotics.sdk.pid.PIDEvent)7 IPIDEventListener (com.neuronrobotics.sdk.pid.IPIDEventListener)5 VirtualGenericPIDDevice (com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice)2 AbstractLink (com.neuronrobotics.sdk.addons.kinematics.AbstractLink)1 DHParameterKinematics (com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics)1 ILinkListener (com.neuronrobotics.sdk.addons.kinematics.ILinkListener)1 LinkConfiguration (com.neuronrobotics.sdk.addons.kinematics.LinkConfiguration)1 CSG (eu.mihosoft.vrl.v3d.CSG)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)1 InvalidRemoteException (org.eclipse.jgit.api.errors.InvalidRemoteException)1 TransportException (org.eclipse.jgit.api.errors.TransportException)1