-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef81002
commit 69e5902
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GcodeRotory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |