Skip to content

Commit

Permalink
adding a rotory link #26
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed May 14, 2016
1 parent ef81002 commit 69e5902
Showing 1 changed file with 67 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.neuronrobotics.sdk.addons.kinematics.gcodebridge;

import com.neuronrobotics.sdk.addons.kinematics.AbstractPrismaticLink;
import com.neuronrobotics.sdk.addons.kinematics.AbstractRotoryLink;
import com.neuronrobotics.sdk.addons.kinematics.LinkConfiguration;

public class GcodeRotory extends AbstractRotoryLink implements IGCodeChannel {
private GcodeDevice device;
private String axis = "";
private double value =0;
public GcodeRotory(LinkConfiguration conf, GcodeDevice device, String linkAxis) {
super(conf);
// TODO Auto-generated constructor stub
this.device = device;
axis=linkAxis;
loadCurrent();
}

@Override
public void cacheTargetValueDevice() {
//value
}

private void loadCurrent(){
device.loadCurrent();
}

@Override
public void flushDevice(double time) {
loadCurrent();

double distance = getTargetValue()-getValue();
if(distance !=0){
int feedrate = (int)Math.abs((distance/(time/60)));//mm/min
device.runLine("G1 "+getAxis()+""+getTargetValue()+" F"+feedrate);
}
}

@Override
public void flushAllDevice(double time) {
device.flush(time);
}

@Override
public double getCurrentPosition() {

return getValue();
}

public String getAxis() {
return axis;
}

public void setAxis(String axis) {
this.axis = axis;
}

public double getValue() {
return value;
}

public void setValue(double value) {
this.value = value;
fireLinkListener( value);
}

}

0 comments on commit 69e5902

Please sign in to comment.