use of com.neuronrobotics.sdk.dyio.peripherals.CounterOutputChannel in project java-bowler by NeuronRobotics.
the class StepperPrismaticLink method setChannel.
public void setChannel(CounterOutputChannel c) {
channel = c;
channel.getChannel().setCachedMode(true);
channel.addCounterOutputListener(new ICounterOutputListener() {
@Override
public void onCounterValueChange(CounterOutputChannel source, int value) {
if (source == channel) {
fireLinkListener(value);
}
}
});
}
use of com.neuronrobotics.sdk.dyio.peripherals.CounterOutputChannel in project java-bowler by NeuronRobotics.
the class LinkFactory method getLinkLocal.
private AbstractLink getLinkLocal(LinkConfiguration c) {
if (dyio == null)
dyio = (DyIO) DeviceManager.getSpecificDevice(DyIO.class, c.getDeviceScriptingName());
if (pid == null)
pid = (IPidControlNamespace) DeviceManager.getSpecificDevice(IPidControlNamespace.class, c.getDeviceScriptingName());
AbstractLink tmp = null;
Log.info("Loading link: " + c.getName() + " type = " + c.getType() + " device= " + c.getDeviceScriptingName());
switch(c.getType()) {
case ANALOG_PRISMATIC:
if (dyio != null) {
tmp = new AnalogPrismaticLink(new AnalogInputChannel(dyio.getChannel(c.getHardwareIndex())), c);
tmp.setUseLimits(false);
}
break;
case ANALOG_ROTORY:
if (dyio != null) {
tmp = new AnalogRotoryLink(new AnalogInputChannel(dyio.getChannel(c.getHardwareIndex())), c);
tmp.setUseLimits(false);
}
break;
case PID_TOOL:
case PID:
if (pid != null) {
tmp = new PidRotoryLink(pid.getPIDChannel(c.getHardwareIndex()), c);
}
break;
case PID_PRISMATIC:
if (pid != null) {
tmp = new PidPrismaticLink(pid.getPIDChannel(c.getHardwareIndex()), c);
}
break;
case SERVO_PRISMATIC:
if (dyio != null) {
tmp = new ServoPrismaticLink(new ServoChannel(dyio.getChannel(c.getHardwareIndex())), c);
}
break;
case SERVO_ROTORY:
case SERVO_TOOL:
if (dyio != null) {
tmp = new ServoRotoryLink(new ServoChannel(dyio.getChannel(c.getHardwareIndex())), c);
}
break;
case STEPPER_PRISMATIC:
if (dyio != null) {
tmp = new StepperPrismaticLink(new CounterOutputChannel(dyio.getChannel(c.getHardwareIndex())), c);
}
break;
case STEPPER_TOOL:
case STEPPER_ROTORY:
if (dyio != null) {
tmp = new StepperRotoryLink(new CounterOutputChannel(dyio.getChannel(c.getHardwareIndex())), c);
}
break;
case DUMMY:
case VIRTUAL:
String myVirtualDevName = c.getDeviceScriptingName();
virtual = (VirtualGenericPIDDevice) DeviceManager.getSpecificDevice(VirtualGenericPIDDevice.class, myVirtualDevName);
if (virtual == null) {
virtual = new VirtualGenericPIDDevice();
DeviceManager.addConnection(virtual, myVirtualDevName);
}
tmp = new PidRotoryLink(virtual.getPIDChannel(c.getHardwareIndex()), c);
break;
}
if (tmp == null) {
String myVirtualDevName = "virtual_" + c.getDeviceScriptingName();
virtual = (VirtualGenericPIDDevice) DeviceManager.getSpecificDevice(VirtualGenericPIDDevice.class, myVirtualDevName);
if (virtual == null) {
virtual = new VirtualGenericPIDDevice();
DeviceManager.addConnection(virtual, myVirtualDevName);
}
if (!c.getType().isPrismatic()) {
tmp = new PidRotoryLink(virtual.getPIDChannel(c.getHardwareIndex()), c);
} else {
tmp = new PidPrismaticLink(virtual.getPIDChannel(c.getHardwareIndex()), c);
}
}
tmp.setLinkConfiguration(c);
links.add(tmp);
if (!getLinkConfigurations().contains(c))
getLinkConfigurations().add(c);
return tmp;
}
use of com.neuronrobotics.sdk.dyio.peripherals.CounterOutputChannel in project java-bowler by NeuronRobotics.
the class StepperRotoryLink method setChannel.
public void setChannel(CounterOutputChannel c) {
channel = c;
channel.getChannel().setCachedMode(true);
channel.addCounterOutputListener(new ICounterOutputListener() {
@Override
public void onCounterValueChange(CounterOutputChannel source, int value) {
if (source == channel) {
fireLinkListener(value);
}
}
});
}
use of com.neuronrobotics.sdk.dyio.peripherals.CounterOutputChannel in project java-bowler by NeuronRobotics.
the class CounterOutputTimedTest method main.
/**
* @param args
*/
public static void main(String[] args) {
DyIO dyio = new DyIO();
if (!ConnectionDialog.getBowlerDevice(dyio)) {
System.exit(1);
}
// Instantiate a new counter input
CounterOutputChannel stepper = new CounterOutputChannel(dyio.getChannel(21));
// Move 5 steps
stepper.SetPosition(10000, 30);
ThreadUtil.wait(30000);
stepper.SetPosition(0, 0);
dyio.disconnect();
System.exit(0);
}
use of com.neuronrobotics.sdk.dyio.peripherals.CounterOutputChannel in project java-bowler by NeuronRobotics.
the class CounterStepperTest method main.
/**
* @param args
*/
public static void main(String[] args) {
DyIO dyio = new DyIO();
if (!ConnectionDialog.getBowlerDevice(dyio)) {
System.exit(1);
}
// Instantiate a new counter input
CounterOutputChannel stepper = new CounterOutputChannel(dyio.getChannel(23));
// Loop forever printing out the satate of the button
// Move 5 steps
stepper.setValue(5);
dyio.disconnect();
System.exit(0);
}
Aggregations