UpdateConfiguration.java
Go to the documentation of this file.
1 package grl;
2 
3 import java.lang.Runnable;
4 import java.nio.ByteBuffer;
5 
6 import org.zeromq.ZMQ;
7 
8 import com.kuka.connectivity.fastRobotInterface.FRIChannelInformation;
9 import com.kuka.connectivity.fastRobotInterface.FRIConfiguration;
10 import com.kuka.connectivity.fastRobotInterface.FRISession;
11 import com.kuka.connectivity.userInterface.smartServo.ServoMotionUtilities;
12 import com.kuka.roboticsAPI.deviceModel.LBR;
13 import com.kuka.roboticsAPI.geometricModel.PhysicalObject;
14 import com.kuka.roboticsAPI.geometricModel.Tool;
15 
16 public class UpdateConfiguration {
17 
18  private LBR _lbr;
19  private Tool _flangeAttachment;
20  private FRIConfiguration _FRIConfiguration = null;
21  public LBR get_lbr() {
22  return _lbr;
23  }
24 
25  public void set_lbr(LBR _lbr) {
26  this._lbr = _lbr;
27  }
28 
29  public Tool get_flangeAttachment() {
30  return _flangeAttachment;
31  }
32 
33  public void set_flangeAttachment(Tool _flangeAttachment) {
34  this._flangeAttachment = _flangeAttachment;
35  }
36 
37  public FRIConfiguration get_FRIConfiguration() {
38  return _FRIConfiguration;
39  }
40 
41  public void set_FRIConfiguration(FRIConfiguration _FRIConfiguration) {
42  this._FRIConfiguration = _FRIConfiguration;
43  }
44 
45  public FRISession get_FRISession() {
46  return _FRISession;
47  }
48 
49  public void set_FRISession(FRISession _FRISession) {
50  this._FRISession = _FRISession;
51  }
52 
53  private FRISession _FRISession = null;
54 
55  public UpdateConfiguration(LBR lbr, Tool flangeAttachment){
56  _lbr = lbr;
57  _flangeAttachment = flangeAttachment;
58  }
59 
60  /**
61  * Create an End effector tool
62  * @param link the Flatbuffer representing the tool
63  * @return the Kuka tool object
64  */
65  public PhysicalObject linkObjectToPhysicalObject(grl.flatbuffer.LinkObject link){
66  if(link == null) return null;
67 
68  grl.flatbuffer.Vector3d toolpos = link.pose().position();
69  grl.flatbuffer.Quaternion toolrot = link.pose().orientation();
70  grl.flatbuffer.Vector3d compos = link.inertia().pose().position();
71  grl.flatbuffer.Quaternion comrot = link.inertia().pose().orientation();
72 
73 
74  double[] translationOfTool =
75  { toolpos.x(), toolpos.y(), toolpos.z() };
76  double[] centerOfMassInMillimeter =
77  { comrot.x(), comrot.y(), comrot.z() };
78 
79  return ServoMotionUtilities.createTool(_lbr,
80  link.name(), translationOfTool,
81  link.inertia().mass(),
82  centerOfMassInMillimeter);
83  }
84 
85  /**
86  * Sets the FRI Configuration and FRI Session stored by the UpdateConfiguration object
87  * @param friConfigBuf flatbuffer containing fri settings
88  * @param controllingLaptopIPAddress
89  * @return error code true if there was a problem, success code false otherwise
90  */
91  public boolean FRIflatbufferToConfigAndSession (grl.flatbuffer.FRI friConfigBuf, String controllingLaptopIPAddress ){
92  if(friConfigBuf == null) return true;
93  // Configure and start FRI session
94  FRIConfiguration _FRIConfiguration = FRIConfiguration.createRemoteConfiguration(_lbr, controllingLaptopIPAddress);
95 
96  if(friConfigBuf !=null && friConfigBuf.sendPeriodMillisec() >0){
97  _FRIConfiguration.setSendPeriodMilliSec(friConfigBuf.sendPeriodMillisec());
98  _FRIConfiguration.setReceiveMultiplier(friConfigBuf.setReceiveMultiplier());
99  }
100 
101  _FRISession = new FRISession(_FRIConfiguration);
102 
103  return false;
104  }
105 
106 
107 }
void set_FRIConfiguration(FRIConfiguration _FRIConfiguration)
void set_flangeAttachment(Tool _flangeAttachment)
PhysicalObject linkObjectToPhysicalObject(grl.flatbuffer.LinkObject link)
UpdateConfiguration(LBR lbr, Tool flangeAttachment)
void set_FRISession(FRISession _FRISession)
FRIConfiguration get_FRIConfiguration()
boolean FRIflatbufferToConfigAndSession(grl.flatbuffer.FRI friConfigBuf, String controllingLaptopIPAddress)