BowlerKernel
GcodePrismatic.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.LinkConfiguration;
5 
6 public class GcodePrismatic extends AbstractPrismaticLink implements IGCodeChannel {
7  private GcodeDevice device;
8  private String axis = "";
9  private double value =0;
11  super(conf);
12  // TODO Auto-generated constructor stub
13  this.device = device;
14  axis=linkAxis;
15  //loadCurrent();
16  }
17 
18  @Override
19  public void cacheTargetValueDevice() {
20  //value
21  }
22 
23  private void loadCurrent(){
25  }
26 
27  @Override
28  public void flushDevice(double time) {
29  loadCurrent();
30 
31  double distance = getTargetValue()-getValue();
32  if(distance !=0){
33  int feedrate = (int)Math.abs((distance/(time/60)));//mm/min
34  device.runLine("G1 "+getAxis()+""+getTargetValue()+" F"+feedrate);
35  }
36  }
37 
38  @Override
39  public void flushAllDevice(double time) {
40  device.flush(time);
41  }
42 
43  @Override
44  public double getCurrentPosition() {
45 
46  return getValue();
47  }
48 
49  public String getAxis() {
50  return axis;
51  }
52 
53  public void setAxis(String axis) {
54  this.axis = axis;
55  }
56 
57  public double getValue() {
58  return value;
59  }
60 
61  public void setValue(double value) {
62  this.value = value;
64  }
65 
66 }
GcodePrismatic(LinkConfiguration conf, GcodeDevice device, String linkAxis)