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