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);
}
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));
}
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;
}
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));
}
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;
}
Aggregations