瀏覽代碼

safetydata, toolcomm etc

Martin Kunz 5 年之前
父節點
當前提交
fe828ef8d7

+ 52 - 0
src/main/java/at/acdp/urweb/sclient/SecondaryClient.java

@@ -37,6 +37,7 @@ public class SecondaryClient {
 
         int size = di.readInt(); //4
         int pType = di.readByte() & 0xff; //+1=5
+        log.info("ptype: "+pType);
         switch (pType) {
             case MessageType.ROBOT_MESSAGE:
                 readRobotMessage(di, size);
@@ -56,6 +57,25 @@ public class SecondaryClient {
             case PackageType.KINEMATICS_INFO:
                 readKinemsticsInfo(di, size);
                 break;
+            case PackageType.CONFIGURATION_DATA:
+                readConfigurationData(di, size);
+                break;
+            case PackageType.FORCE_MODE_DATA:
+                readForceModeData(di, size);
+                break;
+            case PackageType.ADDITIONAL_INFO:
+                readAdditionalInfo(di, size);
+                break;
+            case PackageType.NEEDED_FOR_CALIB_DATA:
+                skip(PackageType.NEEDED_FOR_CALIB_DATA,di, size);
+                break;
+            case PackageType.SAFETY_DATA:
+                skip(PackageType.SAFETY_DATA,di, size);
+                break;
+            case PackageType.TOOL_COMM_INFO:
+                readToolCommInfo(di, size);
+                break;
+
 
             default:
                 log.warn("unknown ptype: "+pType+", size: "+size);
@@ -64,6 +84,38 @@ public class SecondaryClient {
         }
     }
 
+    private ToolCommInfo readToolCommInfo(DataInputStream di, int size) throws IOException {
+        ToolCommInfo tci=new ToolCommInfo();
+        tci.read(di);
+        return tci;
+    }
+
+    private void skip(int pType, DataInputStream di, int size) throws IOException {
+        log.trace("skip data for package type: "+pType);
+        byte[] data=new byte[size-5];
+        di.readFully(data);
+    }
+
+
+    private AdditionalInfo readAdditionalInfo(DataInputStream di, int size) throws IOException {
+        AdditionalInfo ai=new AdditionalInfo();
+        ai.read(di, size);
+        return ai;
+
+    }
+
+    private ForceModeData readForceModeData(DataInputStream di, int size) throws IOException {
+        ForceModeData fmd=new ForceModeData();
+        fmd.read(di, size);
+        return fmd;
+    }
+
+    private ConfigurationData readConfigurationData(DataInputStream di, int size) throws IOException {
+        ConfigurationData cd=new ConfigurationData();
+        cd.read(di, size);
+        return cd;
+    }
+
     void readRobotMessage(DataInputStream di, int size) throws IOException {
         long ts = di.readLong();
         char source = (char) (di.readByte() & 0xFF);

+ 19 - 0
src/main/java/at/acdp/urweb/sclient/data/AdditionalInfo.java

@@ -0,0 +1,19 @@
+package at.acdp.urweb.sclient.data;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+
+public class AdditionalInfo {
+    public boolean freeDriveButtonPressed;
+    public boolean freeDriveButtonEnabled;
+    public boolean ioEnabledFreeDrive;
+
+
+
+    public void read(DataInputStream di, int size) throws IOException {
+        freeDriveButtonPressed=di.readBoolean();
+        freeDriveButtonEnabled=di.readBoolean();
+        ioEnabledFreeDrive=di.readBoolean();
+
+    }
+}

+ 45 - 0
src/main/java/at/acdp/urweb/sclient/data/ConfigurationData.java

@@ -0,0 +1,45 @@
+package at.acdp.urweb.sclient.data;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+
+public class ConfigurationData {
+
+    double jointMinLimit;
+    double jointMaxLimit;
+    double jointMaxSpeed;
+    double jointMaxAcceleration;
+    double vJointDefault;
+    double aJointDefault;
+    double vToolDefault;
+    double aToolDefault;
+    double eqRadius;
+    double dha;
+    double dhd;
+    double dhAlpha;
+    double dhTheta;
+    int masterboardVersion;
+    int controllerBoxType;
+    int robotType;
+    int robotSubType;
+
+    public void read(DataInputStream di, int size) throws IOException {
+        jointMinLimit = di.readDouble();
+        jointMaxAcceleration = di.readDouble();
+        jointMaxSpeed = di.readDouble();
+        jointMaxAcceleration = di.readDouble();
+        vJointDefault = di.readDouble();
+        aJointDefault = di.readDouble();
+        vToolDefault = di.readDouble();
+        aToolDefault = di.readDouble();
+        eqRadius = di.readDouble();
+        dha = di.readDouble();
+        dhd = di.readDouble();
+        dhAlpha = di.readDouble();
+        dhTheta = di.readDouble();
+        masterboardVersion = di.readInt();
+        controllerBoxType = di.readInt();
+        robotType = di.readInt();
+        robotSubType = di.readInt();
+    }
+}

+ 20 - 0
src/main/java/at/acdp/urweb/sclient/data/ForceModeData.java

@@ -0,0 +1,20 @@
+package at.acdp.urweb.sclient.data;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+
+public class ForceModeData {
+    public double x,y,z;
+    public double rx, ry, rz;
+    public double robotDexterity;
+
+    public void read(DataInputStream di, int size) throws IOException {
+        x=di.readDouble();
+        y=di.readDouble();
+        z=di.readDouble();
+        rx=di.readDouble();
+        ry=di.readDouble();
+        rz=di.readDouble();
+        robotDexterity=di.readDouble();
+    }
+}

+ 20 - 0
src/main/java/at/acdp/urweb/sclient/data/ToolCommInfo.java

@@ -0,0 +1,20 @@
+package at.acdp.urweb.sclient.data;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+
+public class ToolCommInfo {
+    public boolean toolCommunicationEnabled;
+    public int baudrate;
+    public int parity;
+    public float rxIdleChars;
+    public float txIdleChars;
+
+
+    public void read(DataInputStream di) throws IOException {
+        baudrate=di.readInt();
+        parity=di.readInt();
+        rxIdleChars=di.readFloat();
+        txIdleChars=di.readFloat();
+    }
+}