BowlerKernel
GcodeRotory.java
Go to the documentation of this file.
1 package com.neuronrobotics.sdk.addons.kinematics.gcodebridge;
2 
3 import com.neuronrobotics.sdk.addons.kinematics.AbstractPrismaticLink;
4 import com.neuronrobotics.sdk.addons.kinematics.AbstractRotoryLink;
5 import com.neuronrobotics.sdk.addons.kinematics.LinkConfiguration;
6 
7 public class GcodeRotory extends AbstractRotoryLink implements IGCodeChannel {
8  private GcodeDevice device;
9  private String axis = "";
10  private double value =0;
11  public GcodeRotory(LinkConfiguration conf, GcodeDevice device, String linkAxis) {
12  super(conf);
13  // TODO Auto-generated constructor stub
14  this.device = device;
15  axis=linkAxis;
16  //loadCurrent();
17  }
18 
19  @Override
20  public void cacheTargetValueDevice() {
21  //value
22  }
23 
24  private void loadCurrent(){
26  }
27 
28  @Override
29  public void flushDevice(double time) {
30  loadCurrent();
31 
32  double distance = getTargetValue()-getValue();
33  if(distance !=0){
34  int feedrate = (int)Math.abs((distance/(time/60)));//mm/min
35  device.runLine("G1 "+getAxis()+""+getTargetValue()+" F"+feedrate);
36  }
37  }
38 
39  @Override
40  public void flushAllDevice(double time) {
41  device.flush(time);
42  }
43 
44  @Override
45  public double getCurrentPosition() {
46 
47  return getValue();
48  }
49 
50  public String getAxis() {
51  return axis;
52  }
53 
54  public void setAxis(String axis) {
55  this.axis = axis;
56  }
57 
58  public double getValue() {
59  return value;
60  }
61 
62  public void setValue(double value) {
63  this.value = value;
65  }
66 
67 }
GcodeRotory(LinkConfiguration conf, GcodeDevice device, String linkAxis)