com.neuronrobotics.sdk.addons.kinematics.AnalogRotoryLink Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-bowler Show documentation
Show all versions of java-bowler Show documentation
A command line utility for accesing the bowler framework.
package com.neuronrobotics.sdk.addons.kinematics;
import com.neuronrobotics.sdk.dyio.peripherals.AnalogInputChannel;
import com.neuronrobotics.sdk.dyio.peripherals.IAnalogInputListener;
// TODO: Auto-generated Javadoc
/**
* The Class AnalogRotoryLink.
*/
public class AnalogRotoryLink extends AbstractRotoryLink implements IAnalogInputListener{
/** The channel. */
private AnalogInputChannel channel;
/**
* Instantiates a new analog rotory link.
*
* @param c the c
* @param conf the conf
*/
public AnalogRotoryLink(AnalogInputChannel c,LinkConfiguration conf) {
super(conf);
setAnalogChannel(c);
}
/* (non-Javadoc)
* @see com.neuronrobotics.sdk.addons.kinematics.AbstractLink#cacheTargetValueDevice()
*/
@Override
public void cacheTargetValueDevice() {
//ignore, input only
}
/* (non-Javadoc)
* @see com.neuronrobotics.sdk.addons.kinematics.AbstractLink#flush(double)
*/
@Override
public void flushDevice(double time) {
//ignore, input only
}
/* (non-Javadoc)
* @see com.neuronrobotics.sdk.addons.kinematics.AbstractLink#flushAll(double)
*/
@Override
public void flushAllDevice(double time) {
//ignore, input only
}
/* (non-Javadoc)
* @see com.neuronrobotics.sdk.addons.kinematics.AbstractLink#getCurrentPosition()
*/
@Override
public double getCurrentPosition() {
int val=getChannel().getValue();
fireLinkListener(val);
return val;
}
/**
* Sets the analog channel.
*
* @param channel the new analog channel
*/
public void setAnalogChannel(AnalogInputChannel channel) {
channel.addAnalogInputListener(this);
channel.configAdvancedAsyncNotEqual(10);
//new RuntimeException().printStackTrace();
this.channel = channel;
}
/**
* Gets the channel.
*
* @return the channel
*/
public AnalogInputChannel getChannel() {
return channel;
}
/* (non-Javadoc)
* @see com.neuronrobotics.sdk.dyio.peripherals.IAnalogInputListener#onAnalogValueChange(com.neuronrobotics.sdk.dyio.peripherals.AnalogInputChannel, double)
*/
@Override
public void onAnalogValueChange(AnalogInputChannel chan, double value) {
if(chan == getChannel() ) {
fireLinkListener((int) value);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy