diff --git a/README.md b/README.md index f28d7d05..9be79ff7 100644 --- a/README.md +++ b/README.md @@ -584,6 +584,11 @@ jradio has lots of built-in satellite decoders. Some of them have non standard d 58317 ru.r2cloud.jradio.kafasat.KafasatBeacon + + RANDEV + 52898 + ru.r2cloud.jradio.randev.RandevBeacon + diff --git a/src/main/java/ru/r2cloud/jradio/randev/Adcs.java b/src/main/java/ru/r2cloud/jradio/randev/Adcs.java new file mode 100644 index 00000000..9ea78d46 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/Adcs.java @@ -0,0 +1,689 @@ +package ru.r2cloud.jradio.randev; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianBitInputStream; +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class Adcs { + + private EstimationMode estimationMode; + private ControlMode controlMode; + private AdcsMode adcsMode; + private Asgp4Mode asgp4Mode; + private boolean cubecontrolSignalEnabled; + private boolean cubecontrolMotorEnabled; + private boolean cubesence1Enabled; + private boolean cubesence2Enable; + private boolean cubewheel1Enabled; + private boolean cubewheel2Enabled; + private boolean cubewheel3Enabled; + private boolean cubestarEnabled; + private boolean gpsReciverEnabled; + private boolean gpsLnaPowerEnabled; + private boolean motorDriverEnabled; + private boolean sunIsAboveLocalHorizon; + private boolean errors; + private boolean cubesence1CommError; + private boolean cubesence2CommError; + private boolean cubecontrolSignalCommError; + private boolean cubecontrolMotorCommError; + private boolean cubewheel1CommError; + private boolean cubewhee2CommError; + private boolean cubewheel3CommError; + private boolean cubestarCommError; + private boolean magnetometerRangeError; + private boolean sunsensorSramOvercurrentDetected; + private boolean sunsensor3v3OvercurrentDetected; + private boolean sunsensorBusyError; + private boolean sunsensorDetectionError; + private boolean sunsensorRangeError; + private boolean nadirSensorSramOvercurrentDetected; + private boolean nadirSensor3v3OvercurrentDetected; + private boolean nadirSensorBusyError; + private boolean nadirSensorDetectionError; + private boolean nadirSensorRangeError; + private boolean rateSensorRangeError; + private boolean wheelSpeedRangeError; + private boolean coarseSunsensorError; + private boolean startrackerMatchError; + private boolean startrackerOvercurrentDetected; + private boolean orbitParametersInvalid; + private boolean configurationInvalid; + private boolean controlModeChangeAllowed; + private boolean estimatorChangeNotAllowed; + private MagnetometerMode magnetometerMode; + private boolean modelledMeasuredMagneticFieldMissmatch; + private boolean nodeRecoveryError; + private boolean cubesense1RuntimeError; + private boolean cubesense2RuntimeError; + private boolean cubecontrolSignalRuntimeError; + private boolean cubecontrolMotorUntimeError; + private boolean cubewheel1RuntimeError; + private boolean cubewheel2RuntimeError; + private boolean cubewheel3RuntimeError; + private boolean cubestarRuntimeError; + private boolean magnetometerError; + private boolean rateSensorFailure; + private float rollDegree; + private float pitchDegree; + private float yawDegree; + private float q1; + private float q2; + private float q3; + private float xAngularRateDegreeS; + private float yAngularRateDegreeS; + private float zAngularRateDegreeS; + + public Adcs() { + // do nothing + } + + public Adcs(LittleEndianDataInputStream ldis) throws IOException { + LittleEndianBitInputStream dis = new LittleEndianBitInputStream(ldis); + estimationMode = EstimationMode.valueOfCode(dis.readUnsignedInt(4)); + controlMode = ControlMode.valueOfCode(dis.readUnsignedInt(4)); + adcsMode = AdcsMode.valueOfCode(dis.readUnsignedInt(2)); + asgp4Mode = Asgp4Mode.valueOfCode(dis.readUnsignedInt(2)); + cubecontrolSignalEnabled = dis.readBoolean(); + cubecontrolMotorEnabled = dis.readBoolean(); + cubesence1Enabled = dis.readBoolean(); + cubesence2Enable = dis.readBoolean(); + cubewheel1Enabled = dis.readBoolean(); + cubewheel2Enabled = dis.readBoolean(); + cubewheel3Enabled = dis.readBoolean(); + cubestarEnabled = dis.readBoolean(); + gpsReciverEnabled = dis.readBoolean(); + gpsLnaPowerEnabled = dis.readBoolean(); + motorDriverEnabled = dis.readBoolean(); + sunIsAboveLocalHorizon = dis.readBoolean(); + errors = dis.readBoolean(); + cubesence1CommError = dis.readBoolean(); + cubesence2CommError = dis.readBoolean(); + cubecontrolSignalCommError = dis.readBoolean(); + cubecontrolMotorCommError = dis.readBoolean(); + cubewheel1CommError = dis.readBoolean(); + cubewhee2CommError = dis.readBoolean(); + cubewheel3CommError = dis.readBoolean(); + cubestarCommError = dis.readBoolean(); + magnetometerRangeError = dis.readBoolean(); + sunsensorSramOvercurrentDetected = dis.readBoolean(); + sunsensor3v3OvercurrentDetected = dis.readBoolean(); + sunsensorBusyError = dis.readBoolean(); + sunsensorDetectionError = dis.readBoolean(); + sunsensorRangeError = dis.readBoolean(); + nadirSensorSramOvercurrentDetected = dis.readBoolean(); + nadirSensor3v3OvercurrentDetected = dis.readBoolean(); + nadirSensorBusyError = dis.readBoolean(); + nadirSensorDetectionError = dis.readBoolean(); + nadirSensorRangeError = dis.readBoolean(); + rateSensorRangeError = dis.readBoolean(); + wheelSpeedRangeError = dis.readBoolean(); + coarseSunsensorError = dis.readBoolean(); + startrackerMatchError = dis.readBoolean(); + startrackerOvercurrentDetected = dis.readBoolean(); + orbitParametersInvalid = dis.readBoolean(); + configurationInvalid = dis.readBoolean(); + controlModeChangeAllowed = dis.readBoolean(); + estimatorChangeNotAllowed = dis.readBoolean(); + magnetometerMode = MagnetometerMode.valueOfCode(dis.readUnsignedInt(2)); + modelledMeasuredMagneticFieldMissmatch = dis.readBoolean(); + nodeRecoveryError = dis.readBoolean(); + cubesense1RuntimeError = dis.readBoolean(); + cubesense2RuntimeError = dis.readBoolean(); + cubecontrolSignalRuntimeError = dis.readBoolean(); + cubecontrolMotorUntimeError = dis.readBoolean(); + cubewheel1RuntimeError = dis.readBoolean(); + cubewheel2RuntimeError = dis.readBoolean(); + cubewheel3RuntimeError = dis.readBoolean(); + cubestarRuntimeError = dis.readBoolean(); + magnetometerError = dis.readBoolean(); + rateSensorFailure = dis.readBoolean(); + rollDegree = dis.readShort() * 0.01f; + pitchDegree = dis.readShort() * 0.01f; + yawDegree = dis.readShort() * 0.01f; + q1 = dis.readShort() * 0.0001f; + q2 = dis.readShort() * 0.0001f; + q3 = dis.readShort() * 0.0001f; + xAngularRateDegreeS = dis.readShort() * 0.01f; + yAngularRateDegreeS = dis.readShort() * 0.01f; + zAngularRateDegreeS = dis.readShort() * 0.01f; + } + + public EstimationMode getEstimationMode() { + return estimationMode; + } + + public void setEstimationMode(EstimationMode estimationMode) { + this.estimationMode = estimationMode; + } + + public ControlMode getControlMode() { + return controlMode; + } + + public void setControlMode(ControlMode controlMode) { + this.controlMode = controlMode; + } + + public AdcsMode getAdcsMode() { + return adcsMode; + } + + public void setAdcsMode(AdcsMode adcsMode) { + this.adcsMode = adcsMode; + } + + public Asgp4Mode getAsgp4Mode() { + return asgp4Mode; + } + + public void setAsgp4Mode(Asgp4Mode asgp4Mode) { + this.asgp4Mode = asgp4Mode; + } + + public boolean isCubecontrolSignalEnabled() { + return cubecontrolSignalEnabled; + } + + public void setCubecontrolSignalEnabled(boolean cubecontrolSignalEnabled) { + this.cubecontrolSignalEnabled = cubecontrolSignalEnabled; + } + + public boolean isCubecontrolMotorEnabled() { + return cubecontrolMotorEnabled; + } + + public void setCubecontrolMotorEnabled(boolean cubecontrolMotorEnabled) { + this.cubecontrolMotorEnabled = cubecontrolMotorEnabled; + } + + public boolean isCubesence1Enabled() { + return cubesence1Enabled; + } + + public void setCubesence1Enabled(boolean cubesence1Enabled) { + this.cubesence1Enabled = cubesence1Enabled; + } + + public boolean isCubesence2Enable() { + return cubesence2Enable; + } + + public void setCubesence2Enable(boolean cubesence2Enable) { + this.cubesence2Enable = cubesence2Enable; + } + + public boolean isCubewheel1Enabled() { + return cubewheel1Enabled; + } + + public void setCubewheel1Enabled(boolean cubewheel1Enabled) { + this.cubewheel1Enabled = cubewheel1Enabled; + } + + public boolean isCubewheel2Enabled() { + return cubewheel2Enabled; + } + + public void setCubewheel2Enabled(boolean cubewheel2Enabled) { + this.cubewheel2Enabled = cubewheel2Enabled; + } + + public boolean isCubewheel3Enabled() { + return cubewheel3Enabled; + } + + public void setCubewheel3Enabled(boolean cubewheel3Enabled) { + this.cubewheel3Enabled = cubewheel3Enabled; + } + + public boolean isCubestarEnabled() { + return cubestarEnabled; + } + + public void setCubestarEnabled(boolean cubestarEnabled) { + this.cubestarEnabled = cubestarEnabled; + } + + public boolean isGpsReciverEnabled() { + return gpsReciverEnabled; + } + + public void setGpsReciverEnabled(boolean gpsReciverEnabled) { + this.gpsReciverEnabled = gpsReciverEnabled; + } + + public boolean isGpsLnaPowerEnabled() { + return gpsLnaPowerEnabled; + } + + public void setGpsLnaPowerEnabled(boolean gpsLnaPowerEnabled) { + this.gpsLnaPowerEnabled = gpsLnaPowerEnabled; + } + + public boolean isMotorDriverEnabled() { + return motorDriverEnabled; + } + + public void setMotorDriverEnabled(boolean motorDriverEnabled) { + this.motorDriverEnabled = motorDriverEnabled; + } + + public boolean isSunIsAboveLocalHorizon() { + return sunIsAboveLocalHorizon; + } + + public void setSunIsAboveLocalHorizon(boolean sunIsAboveLocalHorizon) { + this.sunIsAboveLocalHorizon = sunIsAboveLocalHorizon; + } + + public boolean isErrors() { + return errors; + } + + public void setErrors(boolean errors) { + this.errors = errors; + } + + public boolean isCubesence1CommError() { + return cubesence1CommError; + } + + public void setCubesence1CommError(boolean cubesence1CommError) { + this.cubesence1CommError = cubesence1CommError; + } + + public boolean isCubesence2CommError() { + return cubesence2CommError; + } + + public void setCubesence2CommError(boolean cubesence2CommError) { + this.cubesence2CommError = cubesence2CommError; + } + + public boolean isCubecontrolSignalCommError() { + return cubecontrolSignalCommError; + } + + public void setCubecontrolSignalCommError(boolean cubecontrolSignalCommError) { + this.cubecontrolSignalCommError = cubecontrolSignalCommError; + } + + public boolean isCubecontrolMotorCommError() { + return cubecontrolMotorCommError; + } + + public void setCubecontrolMotorCommError(boolean cubecontrolMotorCommError) { + this.cubecontrolMotorCommError = cubecontrolMotorCommError; + } + + public boolean isCubewheel1CommError() { + return cubewheel1CommError; + } + + public void setCubewheel1CommError(boolean cubewheel1CommError) { + this.cubewheel1CommError = cubewheel1CommError; + } + + public boolean isCubewhee2CommError() { + return cubewhee2CommError; + } + + public void setCubewhee2CommError(boolean cubewhee2CommError) { + this.cubewhee2CommError = cubewhee2CommError; + } + + public boolean isCubewheel3CommError() { + return cubewheel3CommError; + } + + public void setCubewheel3CommError(boolean cubewheel3CommError) { + this.cubewheel3CommError = cubewheel3CommError; + } + + public boolean isCubestarCommError() { + return cubestarCommError; + } + + public void setCubestarCommError(boolean cubestarCommError) { + this.cubestarCommError = cubestarCommError; + } + + public boolean isMagnetometerRangeError() { + return magnetometerRangeError; + } + + public void setMagnetometerRangeError(boolean magnetometerRangeError) { + this.magnetometerRangeError = magnetometerRangeError; + } + + public boolean isSunsensorSramOvercurrentDetected() { + return sunsensorSramOvercurrentDetected; + } + + public void setSunsensorSramOvercurrentDetected(boolean sunsensorSramOvercurrentDetected) { + this.sunsensorSramOvercurrentDetected = sunsensorSramOvercurrentDetected; + } + + public boolean isSunsensor3v3OvercurrentDetected() { + return sunsensor3v3OvercurrentDetected; + } + + public void setSunsensor3v3OvercurrentDetected(boolean sunsensor3v3OvercurrentDetected) { + this.sunsensor3v3OvercurrentDetected = sunsensor3v3OvercurrentDetected; + } + + public boolean isSunsensorBusyError() { + return sunsensorBusyError; + } + + public void setSunsensorBusyError(boolean sunsensorBusyError) { + this.sunsensorBusyError = sunsensorBusyError; + } + + public boolean isSunsensorDetectionError() { + return sunsensorDetectionError; + } + + public void setSunsensorDetectionError(boolean sunsensorDetectionError) { + this.sunsensorDetectionError = sunsensorDetectionError; + } + + public boolean isSunsensorRangeError() { + return sunsensorRangeError; + } + + public void setSunsensorRangeError(boolean sunsensorRangeError) { + this.sunsensorRangeError = sunsensorRangeError; + } + + public boolean isNadirSensorSramOvercurrentDetected() { + return nadirSensorSramOvercurrentDetected; + } + + public void setNadirSensorSramOvercurrentDetected(boolean nadirSensorSramOvercurrentDetected) { + this.nadirSensorSramOvercurrentDetected = nadirSensorSramOvercurrentDetected; + } + + public boolean isNadirSensor3v3OvercurrentDetected() { + return nadirSensor3v3OvercurrentDetected; + } + + public void setNadirSensor3v3OvercurrentDetected(boolean nadirSensor3v3OvercurrentDetected) { + this.nadirSensor3v3OvercurrentDetected = nadirSensor3v3OvercurrentDetected; + } + + public boolean isNadirSensorBusyError() { + return nadirSensorBusyError; + } + + public void setNadirSensorBusyError(boolean nadirSensorBusyError) { + this.nadirSensorBusyError = nadirSensorBusyError; + } + + public boolean isNadirSensorDetectionError() { + return nadirSensorDetectionError; + } + + public void setNadirSensorDetectionError(boolean nadirSensorDetectionError) { + this.nadirSensorDetectionError = nadirSensorDetectionError; + } + + public boolean isNadirSensorRangeError() { + return nadirSensorRangeError; + } + + public void setNadirSensorRangeError(boolean nadirSensorRangeError) { + this.nadirSensorRangeError = nadirSensorRangeError; + } + + public boolean isRateSensorRangeError() { + return rateSensorRangeError; + } + + public void setRateSensorRangeError(boolean rateSensorRangeError) { + this.rateSensorRangeError = rateSensorRangeError; + } + + public boolean isWheelSpeedRangeError() { + return wheelSpeedRangeError; + } + + public void setWheelSpeedRangeError(boolean wheelSpeedRangeError) { + this.wheelSpeedRangeError = wheelSpeedRangeError; + } + + public boolean isCoarseSunsensorError() { + return coarseSunsensorError; + } + + public void setCoarseSunsensorError(boolean coarseSunsensorError) { + this.coarseSunsensorError = coarseSunsensorError; + } + + public boolean isStartrackerMatchError() { + return startrackerMatchError; + } + + public void setStartrackerMatchError(boolean startrackerMatchError) { + this.startrackerMatchError = startrackerMatchError; + } + + public boolean isStartrackerOvercurrentDetected() { + return startrackerOvercurrentDetected; + } + + public void setStartrackerOvercurrentDetected(boolean startrackerOvercurrentDetected) { + this.startrackerOvercurrentDetected = startrackerOvercurrentDetected; + } + + public boolean isOrbitParametersInvalid() { + return orbitParametersInvalid; + } + + public void setOrbitParametersInvalid(boolean orbitParametersInvalid) { + this.orbitParametersInvalid = orbitParametersInvalid; + } + + public boolean isConfigurationInvalid() { + return configurationInvalid; + } + + public void setConfigurationInvalid(boolean configurationInvalid) { + this.configurationInvalid = configurationInvalid; + } + + public boolean isControlModeChangeAllowed() { + return controlModeChangeAllowed; + } + + public void setControlModeChangeAllowed(boolean controlModeChangeAllowed) { + this.controlModeChangeAllowed = controlModeChangeAllowed; + } + + public boolean isEstimatorChangeNotAllowed() { + return estimatorChangeNotAllowed; + } + + public void setEstimatorChangeNotAllowed(boolean estimatorChangeNotAllowed) { + this.estimatorChangeNotAllowed = estimatorChangeNotAllowed; + } + + public MagnetometerMode getMagnetometerMode() { + return magnetometerMode; + } + + public void setMagnetometerMode(MagnetometerMode magnetometerMode) { + this.magnetometerMode = magnetometerMode; + } + + public boolean isModelledMeasuredMagneticFieldMissmatch() { + return modelledMeasuredMagneticFieldMissmatch; + } + + public void setModelledMeasuredMagneticFieldMissmatch(boolean modelledMeasuredMagneticFieldMissmatch) { + this.modelledMeasuredMagneticFieldMissmatch = modelledMeasuredMagneticFieldMissmatch; + } + + public boolean isNodeRecoveryError() { + return nodeRecoveryError; + } + + public void setNodeRecoveryError(boolean nodeRecoveryError) { + this.nodeRecoveryError = nodeRecoveryError; + } + + public boolean isCubesense1RuntimeError() { + return cubesense1RuntimeError; + } + + public void setCubesense1RuntimeError(boolean cubesense1RuntimeError) { + this.cubesense1RuntimeError = cubesense1RuntimeError; + } + + public boolean isCubesense2RuntimeError() { + return cubesense2RuntimeError; + } + + public void setCubesense2RuntimeError(boolean cubesense2RuntimeError) { + this.cubesense2RuntimeError = cubesense2RuntimeError; + } + + public boolean isCubecontrolSignalRuntimeError() { + return cubecontrolSignalRuntimeError; + } + + public void setCubecontrolSignalRuntimeError(boolean cubecontrolSignalRuntimeError) { + this.cubecontrolSignalRuntimeError = cubecontrolSignalRuntimeError; + } + + public boolean isCubecontrolMotorUntimeError() { + return cubecontrolMotorUntimeError; + } + + public void setCubecontrolMotorUntimeError(boolean cubecontrolMotorUntimeError) { + this.cubecontrolMotorUntimeError = cubecontrolMotorUntimeError; + } + + public boolean isCubewheel1RuntimeError() { + return cubewheel1RuntimeError; + } + + public void setCubewheel1RuntimeError(boolean cubewheel1RuntimeError) { + this.cubewheel1RuntimeError = cubewheel1RuntimeError; + } + + public boolean isCubewheel2RuntimeError() { + return cubewheel2RuntimeError; + } + + public void setCubewheel2RuntimeError(boolean cubewheel2RuntimeError) { + this.cubewheel2RuntimeError = cubewheel2RuntimeError; + } + + public boolean isCubewheel3RuntimeError() { + return cubewheel3RuntimeError; + } + + public void setCubewheel3RuntimeError(boolean cubewheel3RuntimeError) { + this.cubewheel3RuntimeError = cubewheel3RuntimeError; + } + + public boolean isCubestarRuntimeError() { + return cubestarRuntimeError; + } + + public void setCubestarRuntimeError(boolean cubestarRuntimeError) { + this.cubestarRuntimeError = cubestarRuntimeError; + } + + public boolean isMagnetometerError() { + return magnetometerError; + } + + public void setMagnetometerError(boolean magnetometerError) { + this.magnetometerError = magnetometerError; + } + + public boolean isRateSensorFailure() { + return rateSensorFailure; + } + + public void setRateSensorFailure(boolean rateSensorFailure) { + this.rateSensorFailure = rateSensorFailure; + } + + public float getRollDegree() { + return rollDegree; + } + + public void setRollDegree(float rollDegree) { + this.rollDegree = rollDegree; + } + + public float getPitchDegree() { + return pitchDegree; + } + + public void setPitchDegree(float pitchDegree) { + this.pitchDegree = pitchDegree; + } + + public float getYawDegree() { + return yawDegree; + } + + public void setYawDegree(float yawDegree) { + this.yawDegree = yawDegree; + } + + public float getQ1() { + return q1; + } + + public void setQ1(float q1) { + this.q1 = q1; + } + + public float getQ2() { + return q2; + } + + public void setQ2(float q2) { + this.q2 = q2; + } + + public float getQ3() { + return q3; + } + + public void setQ3(float q3) { + this.q3 = q3; + } + + public float getxAngularRateDegreeS() { + return xAngularRateDegreeS; + } + + public void setxAngularRateDegreeS(float xAngularRateDegreeS) { + this.xAngularRateDegreeS = xAngularRateDegreeS; + } + + public float getyAngularRateDegreeS() { + return yAngularRateDegreeS; + } + + public void setyAngularRateDegreeS(float yAngularRateDegreeS) { + this.yAngularRateDegreeS = yAngularRateDegreeS; + } + + public float getzAngularRateDegreeS() { + return zAngularRateDegreeS; + } + + public void setzAngularRateDegreeS(float zAngularRateDegreeS) { + this.zAngularRateDegreeS = zAngularRateDegreeS; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/randev/AdcsMode.java b/src/main/java/ru/r2cloud/jradio/randev/AdcsMode.java new file mode 100644 index 00000000..7d8bc479 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/AdcsMode.java @@ -0,0 +1,22 @@ +package ru.r2cloud.jradio.randev; + +public enum AdcsMode { + + DISABLED(0), ENABLED(1), TRIGGERED(2), UNKNOWN(255); + + private final int code; + + private AdcsMode(int code) { + this.code = code; + } + + public static AdcsMode valueOfCode(int code) { + for (AdcsMode cur : values()) { + if (cur.code == code) { + return cur; + } + } + return UNKNOWN; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/randev/Asgp4Mode.java b/src/main/java/ru/r2cloud/jradio/randev/Asgp4Mode.java new file mode 100644 index 00000000..4f93b53d --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/Asgp4Mode.java @@ -0,0 +1,22 @@ +package ru.r2cloud.jradio.randev; + +public enum Asgp4Mode { + + DISABLED(0), TRIGGER(1), BACKGROUND(2), AUGMENT(3), UNKNOWN(255); + + private final int code; + + private Asgp4Mode(int code) { + this.code = code; + } + + public static Asgp4Mode valueOfCode(int code) { + for (Asgp4Mode cur : values()) { + if (cur.code == code) { + return cur; + } + } + return UNKNOWN; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/randev/CommAntenna.java b/src/main/java/ru/r2cloud/jradio/randev/CommAntenna.java new file mode 100644 index 00000000..3ca59a4b --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/CommAntenna.java @@ -0,0 +1,220 @@ +package ru.r2cloud.jradio.randev; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class CommAntenna { + + private float temperatureCelcius; + private boolean notdeployed1; + private boolean timeout1; + private boolean deploying1; + private boolean notdeployed2; + private boolean timeout2; + private boolean deploying2; + private boolean notdeployed3; + private boolean timeout3; + private boolean deploying3; + private boolean independantBurn; + private boolean notdeployed4; + private boolean timeout4; + private boolean deploying4; + private boolean armed; + private byte[] deploymentCount; + private float deploymentTime1; + private float deploymentTime2; + private float deploymentTime3; + private float deploymentTime4; + + public CommAntenna() { + // do nothing + } + + public CommAntenna(LittleEndianDataInputStream dis) throws IOException { + temperatureCelcius = -201.0f / (2.616f - 0.420f) * ((dis.readUnsignedShort() & 0x3FF) * 3.3f / 1024 - 2.100f); + int raw = dis.readUnsignedByte(); + notdeployed1 = ((raw >> 7) & 0x1) > 0; + timeout1 = ((raw >> 6) & 0x1) > 0; + deploying1 = ((raw >> 5) & 0x1) > 0; + notdeployed2 = ((raw >> 3) & 0x1) > 0; + timeout2 = ((raw >> 2) & 0x1) > 0; + deploying2 = ((raw >> 1) & 0x1) > 0; + raw = dis.readUnsignedByte(); + notdeployed3 = ((raw >> 7) & 0x1) > 0; + timeout3 = ((raw >> 6) & 0x1) > 0; + deploying3 = ((raw >> 5) & 0x1) > 0; + independantBurn = ((raw >> 4) & 0x1) > 0; + notdeployed4 = ((raw >> 3) & 0x1) > 0; + timeout4 = ((raw >> 2) & 0x1) > 0; + deploying4 = ((raw >> 1) & 0x1) > 0; + armed = (raw & 0x1) > 0; + deploymentCount = new byte[4]; + dis.readFully(deploymentCount); + deploymentTime1 = dis.readUnsignedShort() * 0.05f; + deploymentTime2 = dis.readUnsignedShort() * 0.05f; + deploymentTime3 = dis.readUnsignedShort() * 0.05f; + deploymentTime4 = dis.readUnsignedShort() * 0.05f; + } + + public float getTemperatureCelcius() { + return temperatureCelcius; + } + + public void setTemperatureCelcius(float temperatureCelcius) { + this.temperatureCelcius = temperatureCelcius; + } + + public boolean isNotdeployed1() { + return notdeployed1; + } + + public void setNotdeployed1(boolean notdeployed1) { + this.notdeployed1 = notdeployed1; + } + + public boolean isTimeout1() { + return timeout1; + } + + public void setTimeout1(boolean timeout1) { + this.timeout1 = timeout1; + } + + public boolean isDeploying1() { + return deploying1; + } + + public void setDeploying1(boolean deploying1) { + this.deploying1 = deploying1; + } + + public boolean isNotdeployed2() { + return notdeployed2; + } + + public void setNotdeployed2(boolean notdeployed2) { + this.notdeployed2 = notdeployed2; + } + + public boolean isTimeout2() { + return timeout2; + } + + public void setTimeout2(boolean timeout2) { + this.timeout2 = timeout2; + } + + public boolean isDeploying2() { + return deploying2; + } + + public void setDeploying2(boolean deploying2) { + this.deploying2 = deploying2; + } + + public boolean isNotdeployed3() { + return notdeployed3; + } + + public void setNotdeployed3(boolean notdeployed3) { + this.notdeployed3 = notdeployed3; + } + + public boolean isTimeout3() { + return timeout3; + } + + public void setTimeout3(boolean timeout3) { + this.timeout3 = timeout3; + } + + public boolean isDeploying3() { + return deploying3; + } + + public void setDeploying3(boolean deploying3) { + this.deploying3 = deploying3; + } + + public boolean isIndependantBurn() { + return independantBurn; + } + + public void setIndependantBurn(boolean independantBurn) { + this.independantBurn = independantBurn; + } + + public boolean isNotdeployed4() { + return notdeployed4; + } + + public void setNotdeployed4(boolean notdeployed4) { + this.notdeployed4 = notdeployed4; + } + + public boolean isTimeout4() { + return timeout4; + } + + public void setTimeout4(boolean timeout4) { + this.timeout4 = timeout4; + } + + public boolean isDeploying4() { + return deploying4; + } + + public void setDeploying4(boolean deploying4) { + this.deploying4 = deploying4; + } + + public boolean isArmed() { + return armed; + } + + public void setArmed(boolean armed) { + this.armed = armed; + } + + public byte[] getDeploymentCount() { + return deploymentCount; + } + + public void setDeploymentCount(byte[] deploymentCount) { + this.deploymentCount = deploymentCount; + } + + public float getDeploymentTime1() { + return deploymentTime1; + } + + public void setDeploymentTime1(float deploymentTime1) { + this.deploymentTime1 = deploymentTime1; + } + + public float getDeploymentTime2() { + return deploymentTime2; + } + + public void setDeploymentTime2(float deploymentTime2) { + this.deploymentTime2 = deploymentTime2; + } + + public float getDeploymentTime3() { + return deploymentTime3; + } + + public void setDeploymentTime3(float deploymentTime3) { + this.deploymentTime3 = deploymentTime3; + } + + public float getDeploymentTime4() { + return deploymentTime4; + } + + public void setDeploymentTime4(float deploymentTime4) { + this.deploymentTime4 = deploymentTime4; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/randev/CommRx.java b/src/main/java/ru/r2cloud/jradio/randev/CommRx.java new file mode 100644 index 00000000..1799f874 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/CommRx.java @@ -0,0 +1,107 @@ +package ru.r2cloud.jradio.randev; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class CommRx { + + private float dopplerHz; + private float rssiDbm; + private float voltageVolts; + private float totalCurrentAmpere; + private float trCurrentAmpere; + private float rxCurrentAmpere; + private float paCurrentAmpere; + private float paTempDegree; + private float osciTempDegree; + + public CommRx() { + // do nothing + } + + public CommRx(LittleEndianDataInputStream dis) throws IOException { + dopplerHz = dis.readUnsignedShort() * 13.352f - 22300; + rssiDbm = dis.readUnsignedShort() * 0.03f - 152; + voltageVolts = dis.readUnsignedShort() * 0.00488f; + totalCurrentAmpere = dis.readUnsignedShort() * 0.16643964f / 1000; + trCurrentAmpere = dis.readUnsignedShort() * 0.16643964f / 1000; + rxCurrentAmpere = dis.readUnsignedShort() * 0.16643964f / 1000; + paCurrentAmpere = dis.readUnsignedShort() * 0.16643964f / 1000; + paTempDegree = -0.07669f * dis.readUnsignedShort() + 195.6038f; + osciTempDegree = -0.07669f * dis.readUnsignedShort() + 195.6038f; + } + + public float getDopplerHz() { + return dopplerHz; + } + + public void setDopplerHz(float dopplerHz) { + this.dopplerHz = dopplerHz; + } + + public float getRssiDbm() { + return rssiDbm; + } + + public void setRssiDbm(float rssiDbm) { + this.rssiDbm = rssiDbm; + } + + public float getVoltageVolts() { + return voltageVolts; + } + + public void setVoltageVolts(float voltageVolts) { + this.voltageVolts = voltageVolts; + } + + public float getTotalCurrentAmpere() { + return totalCurrentAmpere; + } + + public void setTotalCurrentAmpere(float totalCurrentAmpere) { + this.totalCurrentAmpere = totalCurrentAmpere; + } + + public float getTrCurrentAmpere() { + return trCurrentAmpere; + } + + public void setTrCurrentAmpere(float trCurrentAmpere) { + this.trCurrentAmpere = trCurrentAmpere; + } + + public float getRxCurrentAmpere() { + return rxCurrentAmpere; + } + + public void setRxCurrentAmpere(float rxCurrentAmpere) { + this.rxCurrentAmpere = rxCurrentAmpere; + } + + public float getPaCurrentAmpere() { + return paCurrentAmpere; + } + + public void setPaCurrentAmpere(float paCurrentAmpere) { + this.paCurrentAmpere = paCurrentAmpere; + } + + public float getPaTempDegree() { + return paTempDegree; + } + + public void setPaTempDegree(float paTempDegree) { + this.paTempDegree = paTempDegree; + } + + public float getOsciTempDegree() { + return osciTempDegree; + } + + public void setOsciTempDegree(float osciTempDegree) { + this.osciTempDegree = osciTempDegree; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/randev/CommTx.java b/src/main/java/ru/r2cloud/jradio/randev/CommTx.java new file mode 100644 index 00000000..d9406480 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/CommTx.java @@ -0,0 +1,109 @@ +package ru.r2cloud.jradio.randev; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class CommTx { + + private float reflectedDb; + private float forwardDb; + private float voltageVolts; + private float totalCurrentAmpere; + private float trCurrentAmpere; + private float rxCurrentAmpere; + private float paCurrentAmpere; + private float paTempDegree; + private float osciTempDegree; + + public CommTx() { + // do nothing + } + + public CommTx(LittleEndianDataInputStream dis) throws IOException { + int raw = dis.readUnsignedShort(); + reflectedDb = raw * raw * 5.887f * 1e-5f; + raw = dis.readUnsignedShort(); + forwardDb = raw * raw * 5.887f * 1e-5f; + voltageVolts = dis.readUnsignedShort() * 0.00488f; + totalCurrentAmpere = dis.readUnsignedShort() * 0.16643964f / 1000; + trCurrentAmpere = dis.readUnsignedShort() * 0.16643964f / 1000; + rxCurrentAmpere = dis.readUnsignedShort() * 0.16643964f / 1000; + paCurrentAmpere = dis.readUnsignedShort() * 0.16643964f / 1000; + paTempDegree = -0.07669f * dis.readUnsignedShort() + 195.6038f; + osciTempDegree = -0.07669f * dis.readUnsignedShort() + 195.6038f; + } + + public float getReflectedDb() { + return reflectedDb; + } + + public void setReflectedDb(float reflectedDb) { + this.reflectedDb = reflectedDb; + } + + public float getForwardDb() { + return forwardDb; + } + + public void setForwardDb(float forwardDb) { + this.forwardDb = forwardDb; + } + + public float getVoltageVolts() { + return voltageVolts; + } + + public void setVoltageVolts(float voltageVolts) { + this.voltageVolts = voltageVolts; + } + + public float getTotalCurrentAmpere() { + return totalCurrentAmpere; + } + + public void setTotalCurrentAmpere(float totalCurrentAmpere) { + this.totalCurrentAmpere = totalCurrentAmpere; + } + + public float getTrCurrentAmpere() { + return trCurrentAmpere; + } + + public void setTrCurrentAmpere(float trCurrentAmpere) { + this.trCurrentAmpere = trCurrentAmpere; + } + + public float getRxCurrentAmpere() { + return rxCurrentAmpere; + } + + public void setRxCurrentAmpere(float rxCurrentAmpere) { + this.rxCurrentAmpere = rxCurrentAmpere; + } + + public float getPaCurrentAmpere() { + return paCurrentAmpere; + } + + public void setPaCurrentAmpere(float paCurrentAmpere) { + this.paCurrentAmpere = paCurrentAmpere; + } + + public float getPaTempDegree() { + return paTempDegree; + } + + public void setPaTempDegree(float paTempDegree) { + this.paTempDegree = paTempDegree; + } + + public float getOsciTempDegree() { + return osciTempDegree; + } + + public void setOsciTempDegree(float osciTempDegree) { + this.osciTempDegree = osciTempDegree; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/randev/ControlMode.java b/src/main/java/ru/r2cloud/jradio/randev/ControlMode.java new file mode 100644 index 00000000..db51d2be --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/ControlMode.java @@ -0,0 +1,22 @@ +package ru.r2cloud.jradio.randev; + +public enum ControlMode { + + DISABLED(0), DETUMBLING(1), Y_THOMSON(2), Y_WHEEL_MOMENTUM_STABILIZED_INITIAL(3), Y_WHEEL_MOMENTUM_STABILIZED_STEADY_STATE(4), XYZ_WHEEL(5), SUN_TRACKING(6), TARGET_TRACKING(7), VERY_FAST_DETUMBLING(8), FAST_DETUMBLING(9), USER1(10), USER2(11), RW_OFF(12), USER3(13), UNKNOWN(255); + + private final int code; + + private ControlMode(int code) { + this.code = code; + } + + public static ControlMode valueOfCode(int code) { + for (ControlMode cur : values()) { + if (cur.code == code) { + return cur; + } + } + return UNKNOWN; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/randev/Eps.java b/src/main/java/ru/r2cloud/jradio/randev/Eps.java new file mode 100644 index 00000000..a2dd2d4f --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/Eps.java @@ -0,0 +1,379 @@ +package ru.r2cloud.jradio.randev; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class Eps { + + private int epsBoardStatus; + private int epsPdmStatus; + private float epsBcrCurrentAmpere; + private float epsBcrVoltageVolts; + private float eps3v3CurrentAmpere; + private float eps5vCurrentAmpere; + private float epsBatteryCurrentAmpere; + private float epsBatteryVoltageVolts; + private float epsSw1CurrentAmpere; + private float epsSw1VoltageVolts; + private float epsSw2CurrentAmpere; + private float epsSw2VoltageVolts; + private float epsSw3VoltageVolts; + private float epsSw3CurrentAmpere; + private float epsSw4VoltageVolts; + private float epsSw4CurrentAmpere; + private float epsSw5VoltageVolts; + private float epsSw5CurrentAmpere; + private float epsSw6VoltageVolts; + private float epsSw6CurrentAmpere; + private float epsSw7VoltageVolts; + private float epsSw7CurrentAmpere; + private float epsSw8VoltageVolts; + private float epsSw8CurrentAmpere; + private float epsSw9VoltageVolts; + private float epsSw9CurrentAmpere; + private float epsTempCelcius; + private float epsBcr1VoltageVolts; + private float epsBcr2VoltageVolts; + private float epsBcr4VoltageVolts; + private float epsBcr5VoltageVolts; + private float batVoltageVolts; + private float batCurrentAmpere; + private float batTempCelcius; + private boolean batHeaterOn; + private boolean batHeateCtrlOn; + + public Eps() { + // do nothing + } + + public Eps(LittleEndianDataInputStream dis) throws IOException { + epsBoardStatus = dis.readUnsignedShort(); + epsPdmStatus = dis.readUnsignedShort(); + epsBcrCurrentAmpere = dis.readUnsignedShort() * 14.662757f; + epsBcrVoltageVolts = dis.readUnsignedShort() * 0.008993157f; + eps3v3CurrentAmpere = dis.readUnsignedShort() * 0.001327547f; + eps5vCurrentAmpere = dis.readUnsignedShort() * 0.001327547f; + epsBatteryCurrentAmpere = dis.readUnsignedShort() * 0.005237f; + epsBatteryVoltageVolts = dis.readUnsignedShort() * 0.008978f; + epsSw1CurrentAmpere = dis.readUnsignedShort() * 0.005237f; + epsSw1VoltageVolts = dis.readUnsignedShort() * 0.005865f; + epsSw2CurrentAmpere = dis.readUnsignedShort() * 0.005237f; + epsSw2VoltageVolts = dis.readUnsignedShort() * 0.004311f; + epsSw3VoltageVolts = dis.readUnsignedShort() * 0.008993f; + epsSw3CurrentAmpere = dis.readUnsignedShort() * 0.006239f; + epsSw4VoltageVolts = dis.readUnsignedShort() * 0.008993f; + epsSw4CurrentAmpere = dis.readUnsignedShort() * 0.006239f; + epsSw5VoltageVolts = dis.readUnsignedShort() * 0.005865f; + epsSw5CurrentAmpere = dis.readUnsignedShort() * 0.001328f; + epsSw6VoltageVolts = dis.readUnsignedShort() * 0.005865f; + epsSw6CurrentAmpere = dis.readUnsignedShort() * 0.001328f; + epsSw7VoltageVolts = dis.readUnsignedShort() * 0.005865f; + epsSw7CurrentAmpere = dis.readUnsignedShort() * 0.001328f; + epsSw8VoltageVolts = dis.readUnsignedShort() * 0.004311f; + epsSw8CurrentAmpere = dis.readUnsignedShort() * 0.001328f; + epsSw9VoltageVolts = dis.readUnsignedShort() * 0.004311f; + epsSw9CurrentAmpere = dis.readUnsignedShort() * 0.001328f; + epsTempCelcius = dis.readUnsignedShort() * 0.372434f - 273.15f; + epsBcr1VoltageVolts = dis.readUnsignedShort() * 0.0322581f; + epsBcr2VoltageVolts = dis.readUnsignedShort() * 0.0322581f; + epsBcr4VoltageVolts = dis.readUnsignedShort() * 0.0322581f; + epsBcr5VoltageVolts = dis.readUnsignedShort() * 0.0322581f; + batVoltageVolts = dis.readUnsignedShort() * 0.008993f; + int raw = dis.readUnsignedShort(); + batCurrentAmpere = raw < 512 ? raw * 0.014662757f : raw * 0.014662757f; + dis.skipBytes(2); + batTempCelcius = dis.readUnsignedShort() * 0.3976f - 238.57f; + batHeaterOn = dis.readUnsignedShort() < 512 ? false : true; + batHeateCtrlOn = dis.readUnsignedShort() < 1 ? false : true; + } + + public int getEpsBoardStatus() { + return epsBoardStatus; + } + + public void setEpsBoardStatus(int epsBoardStatus) { + this.epsBoardStatus = epsBoardStatus; + } + + public int getEpsPdmStatus() { + return epsPdmStatus; + } + + public void setEpsPdmStatus(int epsPdmStatus) { + this.epsPdmStatus = epsPdmStatus; + } + + public float getEpsBcrCurrentAmpere() { + return epsBcrCurrentAmpere; + } + + public void setEpsBcrCurrentAmpere(float epsBcrCurrentAmpere) { + this.epsBcrCurrentAmpere = epsBcrCurrentAmpere; + } + + public float getEpsBcrVoltageVolts() { + return epsBcrVoltageVolts; + } + + public void setEpsBcrVoltageVolts(float epsBcrVoltageVolts) { + this.epsBcrVoltageVolts = epsBcrVoltageVolts; + } + + public float getEps3v3CurrentAmpere() { + return eps3v3CurrentAmpere; + } + + public void setEps3v3CurrentAmpere(float eps3v3CurrentAmpere) { + this.eps3v3CurrentAmpere = eps3v3CurrentAmpere; + } + + public float getEps5vCurrentAmpere() { + return eps5vCurrentAmpere; + } + + public void setEps5vCurrentAmpere(float eps5vCurrentAmpere) { + this.eps5vCurrentAmpere = eps5vCurrentAmpere; + } + + public float getEpsBatteryCurrentAmpere() { + return epsBatteryCurrentAmpere; + } + + public void setEpsBatteryCurrentAmpere(float epsBatteryCurrentAmpere) { + this.epsBatteryCurrentAmpere = epsBatteryCurrentAmpere; + } + + public float getEpsBatteryVoltageVolts() { + return epsBatteryVoltageVolts; + } + + public void setEpsBatteryVoltageVolts(float epsBatteryVoltageVolts) { + this.epsBatteryVoltageVolts = epsBatteryVoltageVolts; + } + + public float getEpsSw1CurrentAmpere() { + return epsSw1CurrentAmpere; + } + + public void setEpsSw1CurrentAmpere(float epsSw1CurrentAmpere) { + this.epsSw1CurrentAmpere = epsSw1CurrentAmpere; + } + + public float getEpsSw1VoltageVolts() { + return epsSw1VoltageVolts; + } + + public void setEpsSw1VoltageVolts(float epsSw1VoltageVolts) { + this.epsSw1VoltageVolts = epsSw1VoltageVolts; + } + + public float getEpsSw2CurrentAmpere() { + return epsSw2CurrentAmpere; + } + + public void setEpsSw2CurrentAmpere(float epsSw2CurrentAmpere) { + this.epsSw2CurrentAmpere = epsSw2CurrentAmpere; + } + + public float getEpsSw2VoltageVolts() { + return epsSw2VoltageVolts; + } + + public void setEpsSw2VoltageVolts(float epsSw2VoltageVolts) { + this.epsSw2VoltageVolts = epsSw2VoltageVolts; + } + + public float getEpsSw3VoltageVolts() { + return epsSw3VoltageVolts; + } + + public void setEpsSw3VoltageVolts(float epsSw3VoltageVolts) { + this.epsSw3VoltageVolts = epsSw3VoltageVolts; + } + + public float getEpsSw3CurrentAmpere() { + return epsSw3CurrentAmpere; + } + + public void setEpsSw3CurrentAmpere(float epsSw3CurrentAmpere) { + this.epsSw3CurrentAmpere = epsSw3CurrentAmpere; + } + + public float getEpsSw4VoltageVolts() { + return epsSw4VoltageVolts; + } + + public void setEpsSw4VoltageVolts(float epsSw4VoltageVolts) { + this.epsSw4VoltageVolts = epsSw4VoltageVolts; + } + + public float getEpsSw4CurrentAmpere() { + return epsSw4CurrentAmpere; + } + + public void setEpsSw4CurrentAmpere(float epsSw4CurrentAmpere) { + this.epsSw4CurrentAmpere = epsSw4CurrentAmpere; + } + + public float getEpsSw5VoltageVolts() { + return epsSw5VoltageVolts; + } + + public void setEpsSw5VoltageVolts(float epsSw5VoltageVolts) { + this.epsSw5VoltageVolts = epsSw5VoltageVolts; + } + + public float getEpsSw5CurrentAmpere() { + return epsSw5CurrentAmpere; + } + + public void setEpsSw5CurrentAmpere(float epsSw5CurrentAmpere) { + this.epsSw5CurrentAmpere = epsSw5CurrentAmpere; + } + + public float getEpsSw6VoltageVolts() { + return epsSw6VoltageVolts; + } + + public void setEpsSw6VoltageVolts(float epsSw6VoltageVolts) { + this.epsSw6VoltageVolts = epsSw6VoltageVolts; + } + + public float getEpsSw6CurrentAmpere() { + return epsSw6CurrentAmpere; + } + + public void setEpsSw6CurrentAmpere(float epsSw6CurrentAmpere) { + this.epsSw6CurrentAmpere = epsSw6CurrentAmpere; + } + + public float getEpsSw7VoltageVolts() { + return epsSw7VoltageVolts; + } + + public void setEpsSw7VoltageVolts(float epsSw7VoltageVolts) { + this.epsSw7VoltageVolts = epsSw7VoltageVolts; + } + + public float getEpsSw7CurrentAmpere() { + return epsSw7CurrentAmpere; + } + + public void setEpsSw7CurrentAmpere(float epsSw7CurrentAmpere) { + this.epsSw7CurrentAmpere = epsSw7CurrentAmpere; + } + + public float getEpsSw8VoltageVolts() { + return epsSw8VoltageVolts; + } + + public void setEpsSw8VoltageVolts(float epsSw8VoltageVolts) { + this.epsSw8VoltageVolts = epsSw8VoltageVolts; + } + + public float getEpsSw8CurrentAmpere() { + return epsSw8CurrentAmpere; + } + + public void setEpsSw8CurrentAmpere(float epsSw8CurrentAmpere) { + this.epsSw8CurrentAmpere = epsSw8CurrentAmpere; + } + + public float getEpsSw9VoltageVolts() { + return epsSw9VoltageVolts; + } + + public void setEpsSw9VoltageVolts(float epsSw9VoltageVolts) { + this.epsSw9VoltageVolts = epsSw9VoltageVolts; + } + + public float getEpsSw9CurrentAmpere() { + return epsSw9CurrentAmpere; + } + + public void setEpsSw9CurrentAmpere(float epsSw9CurrentAmpere) { + this.epsSw9CurrentAmpere = epsSw9CurrentAmpere; + } + + public float getEpsTempCelcius() { + return epsTempCelcius; + } + + public void setEpsTempCelcius(float epsTempCelcius) { + this.epsTempCelcius = epsTempCelcius; + } + + public float getEpsBcr1VoltageVolts() { + return epsBcr1VoltageVolts; + } + + public void setEpsBcr1VoltageVolts(float epsBcr1VoltageVolts) { + this.epsBcr1VoltageVolts = epsBcr1VoltageVolts; + } + + public float getEpsBcr2VoltageVolts() { + return epsBcr2VoltageVolts; + } + + public void setEpsBcr2VoltageVolts(float epsBcr2VoltageVolts) { + this.epsBcr2VoltageVolts = epsBcr2VoltageVolts; + } + + public float getEpsBcr4VoltageVolts() { + return epsBcr4VoltageVolts; + } + + public void setEpsBcr4VoltageVolts(float epsBcr4VoltageVolts) { + this.epsBcr4VoltageVolts = epsBcr4VoltageVolts; + } + + public float getEpsBcr5VoltageVolts() { + return epsBcr5VoltageVolts; + } + + public void setEpsBcr5VoltageVolts(float epsBcr5VoltageVolts) { + this.epsBcr5VoltageVolts = epsBcr5VoltageVolts; + } + + public float getBatVoltageVolts() { + return batVoltageVolts; + } + + public void setBatVoltageVolts(float batVoltageVolts) { + this.batVoltageVolts = batVoltageVolts; + } + + public float getBatCurrentAmpere() { + return batCurrentAmpere; + } + + public void setBatCurrentAmpere(float batCurrentAmpere) { + this.batCurrentAmpere = batCurrentAmpere; + } + + public float getBatTempCelcius() { + return batTempCelcius; + } + + public void setBatTempCelcius(float batTempCelcius) { + this.batTempCelcius = batTempCelcius; + } + + public boolean isBatHeaterOn() { + return batHeaterOn; + } + + public void setBatHeaterOn(boolean batHeaterOn) { + this.batHeaterOn = batHeaterOn; + } + + public boolean isBatHeateCtrlOn() { + return batHeateCtrlOn; + } + + public void setBatHeateCtrlOn(boolean batHeateCtrlOn) { + this.batHeateCtrlOn = batHeateCtrlOn; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/randev/EstimationMode.java b/src/main/java/ru/r2cloud/jradio/randev/EstimationMode.java new file mode 100644 index 00000000..69bc561e --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/EstimationMode.java @@ -0,0 +1,22 @@ +package ru.r2cloud.jradio.randev; + +public enum EstimationMode { + + DISABLED(0), MEMS_RATE(1), MAGNETOMETER_FILTER(2), MAGNETOMETER_FILTER_PITCH(3), MAGNETOMETER_FINE_SUN_TRIAD(4), FULL_EKF(5), MEMS_GYRO_EKF(6), UNKNOWN(255); + + private final int code; + + private EstimationMode(int code) { + this.code = code; + } + + public static EstimationMode valueOfCode(int code) { + for (EstimationMode cur : values()) { + if (cur.code == code) { + return cur; + } + } + return UNKNOWN; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/randev/Hstx.java b/src/main/java/ru/r2cloud/jradio/randev/Hstx.java new file mode 100644 index 00000000..ec61d9a4 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/Hstx.java @@ -0,0 +1,97 @@ +package ru.r2cloud.jradio.randev; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class Hstx { + + private float rfOutputVolts; + private float paTemp; + private float boardTempTop; + private float boardTempBottom; + private float batCurrent; + private float batVoltage; + private float paCurrent; + private float paVoltage; + + public Hstx() { + // do nothing + } + + public Hstx(LittleEndianDataInputStream dis) throws IOException { + rfOutputVolts = dis.readUnsignedShort() * 0.001139f; + paTemp = dis.readUnsignedShort() * 0.073242f - 50; + boardTempTop = dis.readUnsignedShort() * 0.0625f; + boardTempBottom = dis.readUnsignedShort() * 0.0625f; + batCurrent = dis.readUnsignedShort() * 0.000004f; + batVoltage = dis.readUnsignedShort() * 0.004f; + paCurrent = dis.readUnsignedShort() * 0.000004f; + paVoltage = dis.readUnsignedShort() * 0.004f; + } + + public float getRfOutputVolts() { + return rfOutputVolts; + } + + public void setRfOutputVolts(float rfOutputVolts) { + this.rfOutputVolts = rfOutputVolts; + } + + public float getPaTemp() { + return paTemp; + } + + public void setPaTemp(float paTemp) { + this.paTemp = paTemp; + } + + public float getBoardTempTop() { + return boardTempTop; + } + + public void setBoardTempTop(float boardTempTop) { + this.boardTempTop = boardTempTop; + } + + public float getBoardTempBottom() { + return boardTempBottom; + } + + public void setBoardTempBottom(float boardTempBottom) { + this.boardTempBottom = boardTempBottom; + } + + public float getBatCurrent() { + return batCurrent; + } + + public void setBatCurrent(float batCurrent) { + this.batCurrent = batCurrent; + } + + public float getBatVoltage() { + return batVoltage; + } + + public void setBatVoltage(float batVoltage) { + this.batVoltage = batVoltage; + } + + public float getPaCurrent() { + return paCurrent; + } + + public void setPaCurrent(float paCurrent) { + this.paCurrent = paCurrent; + } + + public float getPaVoltage() { + return paVoltage; + } + + public void setPaVoltage(float paVoltage) { + this.paVoltage = paVoltage; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/randev/MagnetometerMode.java b/src/main/java/ru/r2cloud/jradio/randev/MagnetometerMode.java new file mode 100644 index 00000000..fa748c7a --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/MagnetometerMode.java @@ -0,0 +1,22 @@ +package ru.r2cloud.jradio.randev; + +public enum MagnetometerMode { + + MAIN_SIGNAL(0), REDUNDANT_SIGNAL(1), MAIN_MOTOR(2), NONE(3), UNKNOWN(255); + + private final int code; + + private MagnetometerMode(int code) { + this.code = code; + } + + public static MagnetometerMode valueOfCode(int code) { + for (MagnetometerMode cur : values()) { + if (cur.code == code) { + return cur; + } + } + return UNKNOWN; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/randev/Obc.java b/src/main/java/ru/r2cloud/jradio/randev/Obc.java new file mode 100644 index 00000000..ba30ad52 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/Obc.java @@ -0,0 +1,48 @@ +package ru.r2cloud.jradio.randev; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class Obc { + + private float temp1Celcius; + private float temp2Celcius; + private byte[] rawGps; + + public Obc() { + // do nothing + } + + public Obc(LittleEndianDataInputStream dis) throws IOException { + temp1Celcius = dis.readShort() * 0.1f; + temp2Celcius = dis.readShort() * 0.1f; + rawGps = new byte[6]; + dis.readFully(rawGps); + } + + public float getTemp1Celcius() { + return temp1Celcius; + } + + public void setTemp1Celcius(float temp1Celcius) { + this.temp1Celcius = temp1Celcius; + } + + public float getTemp2Celcius() { + return temp2Celcius; + } + + public void setTemp2Celcius(float temp2Celcius) { + this.temp2Celcius = temp2Celcius; + } + + public byte[] getRawGps() { + return rawGps; + } + + public void setRawGps(byte[] rawGps) { + this.rawGps = rawGps; + } + +} diff --git a/src/main/java/ru/r2cloud/jradio/randev/RandevBeacon.java b/src/main/java/ru/r2cloud/jradio/randev/RandevBeacon.java new file mode 100644 index 00000000..5cc8a9ee --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/RandevBeacon.java @@ -0,0 +1,32 @@ +package ru.r2cloud.jradio.randev; + +import java.io.DataInputStream; +import java.io.IOException; + +import ru.r2cloud.jradio.ax25.Ax25Beacon; +import ru.r2cloud.jradio.fec.ccsds.UncorrectableException; +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class RandevBeacon extends Ax25Beacon { + + private Telemetry telemetry; + + @Override + public void readBeacon(DataInputStream dis) throws IOException, UncorrectableException { + try { + telemetry = new Telemetry(new LittleEndianDataInputStream(dis)); + } catch (Exception e) { + // no way to tell which are telemetry or other types of messages + // assume EOFException means different type of message + readBeacon(dis); + } + } + + public Telemetry getTelemetry() { + return telemetry; + } + + public void setTelemetry(Telemetry telemetry) { + this.telemetry = telemetry; + } +} diff --git a/src/main/java/ru/r2cloud/jradio/randev/Telemetry.java b/src/main/java/ru/r2cloud/jradio/randev/Telemetry.java new file mode 100644 index 00000000..13df6fc4 --- /dev/null +++ b/src/main/java/ru/r2cloud/jradio/randev/Telemetry.java @@ -0,0 +1,137 @@ +package ru.r2cloud.jradio.randev; + +import java.io.IOException; + +import ru.r2cloud.jradio.util.LittleEndianDataInputStream; + +public class Telemetry { + + private int systemLeading; + private long systemTime; + private int systemMode; + private int systemWodMode; + private int systemWodCounter; + private Obc obc; + private Eps eps; + private CommRx commRx; + private CommTx commTx; + private CommAntenna commAntenna; + private Adcs adcs; + private Hstx hstx; + + public Telemetry() { + // do nothing + } + + public Telemetry(LittleEndianDataInputStream dis) throws IOException { + systemLeading = dis.readUnsignedByte(); + systemTime = dis.readUnsignedInt(); + systemMode = dis.readUnsignedByte(); + systemWodMode = dis.readUnsignedByte(); + systemWodCounter = dis.readUnsignedShort(); + obc = new Obc(dis); + eps = new Eps(dis); + commRx = new CommRx(dis); + commTx = new CommTx(dis); + commAntenna = new CommAntenna(dis); + adcs = new Adcs(dis); + hstx = new Hstx(dis); + } + + public int getSystemLeading() { + return systemLeading; + } + + public void setSystemLeading(int systemLeading) { + this.systemLeading = systemLeading; + } + + public long getSystemTime() { + return systemTime; + } + + public void setSystemTime(long systemTime) { + this.systemTime = systemTime; + } + + public int getSystemMode() { + return systemMode; + } + + public void setSystemMode(int systemMode) { + this.systemMode = systemMode; + } + + public int getSystemWodMode() { + return systemWodMode; + } + + public void setSystemWodMode(int systemWodMode) { + this.systemWodMode = systemWodMode; + } + + public int getSystemWodCounter() { + return systemWodCounter; + } + + public void setSystemWodCounter(int systemWodCounter) { + this.systemWodCounter = systemWodCounter; + } + + public Obc getObc() { + return obc; + } + + public void setObc(Obc obc) { + this.obc = obc; + } + + public Eps getEps() { + return eps; + } + + public void setEps(Eps eps) { + this.eps = eps; + } + + public CommRx getCommRx() { + return commRx; + } + + public void setCommRx(CommRx commRx) { + this.commRx = commRx; + } + + public CommTx getCommTx() { + return commTx; + } + + public void setCommTx(CommTx commTx) { + this.commTx = commTx; + } + + public CommAntenna getCommAntenna() { + return commAntenna; + } + + public void setCommAntenna(CommAntenna commAntenna) { + this.commAntenna = commAntenna; + } + + public Adcs getAdcs() { + return adcs; + } + + public void setAdcs(Adcs adcs) { + this.adcs = adcs; + } + + public Hstx getHstx() { + return hstx; + } + + public void setHstx(Hstx hstx) { + this.hstx = hstx; + } + +} diff --git a/src/test/java/ru/r2cloud/jradio/randev/RandevBeaconTest.java b/src/test/java/ru/r2cloud/jradio/randev/RandevBeaconTest.java new file mode 100644 index 00000000..b311c1e6 --- /dev/null +++ b/src/test/java/ru/r2cloud/jradio/randev/RandevBeaconTest.java @@ -0,0 +1,37 @@ +package ru.r2cloud.jradio.randev; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.MatcherAssert.assertThat; + +import org.junit.Test; + +import ru.r2cloud.jradio.AssertJson; +import ru.r2cloud.jradio.ax25.Ax25Beacon; +import ru.r2cloud.jradio.fec.ViterbiTest; + +public class RandevBeaconTest extends Ax25Beacon { + + @Test + public void testTelemetry() throws Exception { + byte[] data = ViterbiTest.hexStringToByteArray( + "82A686984040E0A4829C888AAC6103F00A3AF5A372FFFFFFFF0079007D1111111111111111121212121212121213131313131313130101010101010101020202020202020203030303030303030000000000020386000B0011000603810007035C000E03050002000200020002000200030003030800000000000300000003000303080002000200010002038A000C035B02FD0003F2F2095D06B6067F012300480249000009500954007E0044067E01210048024A0000094F0953F5F5F5F5000000020000818100004242F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F7F700800080000000000000000000000000"); + RandevBeacon result = new RandevBeacon(); + result.readBeacon(data); + AssertJson.assertObjectsEqual("RandevBeacon.json", result); + } + + @Test + public void testPojo() { + assertThat(RandevBeacon.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(Telemetry.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(Obc.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(Eps.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(CommRx.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(CommTx.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(CommAntenna.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(Adcs.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + assertThat(Hstx.class, allOf(hasValidBeanConstructor(), hasValidGettersAndSetters())); + } +} diff --git a/src/test/resources/expected/RandevBeacon.json b/src/test/resources/expected/RandevBeacon.json new file mode 100644 index 00000000..9909a7a7 --- /dev/null +++ b/src/test/resources/expected/RandevBeacon.json @@ -0,0 +1,207 @@ +{ + "telemetry": { + "systemLeading": 10, + "systemTime": 1923347770, + "systemMode": 255, + "systemWodMode": 255, + "systemWodCounter": 65535, + "obc": { + "temp1Celcius": 3097.6, + "temp2Celcius": 3200.0, + "rawGps": [ + 17, + 17, + 17, + 17, + 17, + 17 + ] + }, + "eps": { + "epsBoardStatus": 4369, + "epsPdmStatus": 4626, + "epsBcrCurrentAmpere": 67829.914, + "epsBcrVoltageVolts": 41.602345, + "eps3v3CurrentAmpere": 6.1412325, + "eps5vCurrentAmpere": 6.482412, + "epsBatteryCurrentAmpere": 25.572271, + "epsBatteryVoltageVolts": 43.839573, + "epsSw1CurrentAmpere": 25.572271, + "epsSw1VoltageVolts": 1.507305, + "epsSw2CurrentAmpere": 1.345909, + "epsSw2VoltageVolts": 1.107927, + "epsSw3VoltageVolts": 2.3112009, + "epsSw3CurrentAmpere": 3.206846, + "epsSw4VoltageVolts": 4.6224017, + "epsSw4CurrentAmpere": 3.206846, + "epsSw5VoltageVolts": 3.01461, + "epsSw5CurrentAmpere": 1.023888, + "epsSw6VoltageVolts": 4.521915, + "epsSw6CurrentAmpere": 1.023888, + "epsSw7VoltageVolts": 4.521915, + "epsSw7CurrentAmpere": 0.0, + "epsSw8VoltageVolts": 0.0, + "epsSw8CurrentAmpere": 0.679936, + "epsSw9VoltageVolts": 147.89748, + "epsSw9CurrentAmpere": 3.7396479, + "epsTempCelcius": 1347.6827, + "epsBcr1VoltageVolts": 49.548443, + "epsBcr2VoltageVolts": 1065.3883, + "epsBcr4VoltageVolts": 57.80652, + "epsBcr5VoltageVolts": 759.83954, + "batVoltageVolts": 32.23091, + "batCurrentAmpere": 18.812317, + "batTempCelcius": -34.99881, + "batHeaterOn": true, + "batHeateCtrlOn": true + }, + "commRx": { + "dopplerHz": -15463.775, + "rssiDbm": -128.96, + "voltageVolts": 3.74784, + "totalCurrentAmpere": 0.3413677, + "trCurrentAmpere": 0.0, + "rxCurrentAmpere": 0.0, + "paCurrentAmpere": 0.12782563, + "paTempDegree": 195.6038, + "osciTempDegree": 136.70589 + }, + "commTx": { + "reflectedDb": 34.72294, + "forwardDb": 247.6426, + "voltageVolts": 2.49856, + "totalCurrentAmpere": 0.085217096, + "trCurrentAmpere": 0.042608548, + "rxCurrentAmpere": 0.085217096, + "paCurrentAmpere": 5.880479, + "paTempDegree": -39.987885, + "osciTempDegree": -1591.1967 + }, + "commAntenna": { + "temperatureCelcius": 116.110886, + "notdeployed1": false, + "timeout1": false, + "deploying1": false, + "notdeployed2": false, + "timeout2": false, + "deploying2": false, + "notdeployed3": false, + "timeout3": false, + "deploying3": false, + "independantBurn": false, + "notdeployed4": false, + "timeout4": false, + "deploying4": true, + "armed": true, + "deploymentCount": [ + -14, + -14, + 9, + 93 + ], + "deploymentTime1": 2329.9001, + "deploymentTime2": 1625.9, + "deploymentTime3": 448.05002, + "deploymentTime4": 921.60004 + }, + "adcs": { + "estimationMode": "MAGNETOMETER_FILTER", + "controlMode": "DISABLED", + "adcsMode": "ENABLED", + "asgp4Mode": "BACKGROUND", + "cubecontrolSignalEnabled": false, + "cubecontrolMotorEnabled": false, + "cubesence1Enabled": true, + "cubesence2Enable": false, + "cubewheel1Enabled": false, + "cubewheel2Enabled": false, + "cubewheel3Enabled": false, + "cubestarEnabled": false, + "gpsReciverEnabled": false, + "gpsLnaPowerEnabled": false, + "motorDriverEnabled": false, + "sunIsAboveLocalHorizon": false, + "errors": false, + "cubesence1CommError": false, + "cubesence2CommError": false, + "cubecontrolSignalCommError": false, + "cubecontrolMotorCommError": false, + "cubewheel1CommError": false, + "cubewhee2CommError": false, + "cubewheel3CommError": false, + "cubestarCommError": true, + "magnetometerRangeError": false, + "sunsensorSramOvercurrentDetected": false, + "sunsensor3v3OvercurrentDetected": true, + "sunsensorBusyError": false, + "sunsensorDetectionError": false, + "sunsensorRangeError": false, + "nadirSensorSramOvercurrentDetected": false, + "nadirSensor3v3OvercurrentDetected": false, + "nadirSensorBusyError": false, + "nadirSensorDetectionError": false, + "nadirSensorRangeError": false, + "rateSensorRangeError": true, + "wheelSpeedRangeError": false, + "coarseSunsensorError": true, + "startrackerMatchError": false, + "startrackerOvercurrentDetected": true, + "orbitParametersInvalid": false, + "configurationInvalid": false, + "controlModeChangeAllowed": true, + "estimatorChangeNotAllowed": false, + "magnetometerMode": "MAIN_SIGNAL", + "modelledMeasuredMagneticFieldMissmatch": false, + "nodeRecoveryError": false, + "cubesense1RuntimeError": false, + "cubesense2RuntimeError": true, + "cubecontrolSignalRuntimeError": false, + "cubecontrolMotorUntimeError": true, + "cubewheel1RuntimeError": false, + "cubewheel2RuntimeError": true, + "cubewheel3RuntimeError": false, + "cubestarRuntimeError": false, + "magnetometerError": false, + "rateSensorFailure": false, + "rollDegree": 40.32, + "pitchDegree": -142.08, + "yawDegree": 122.24, + "q1": 0.1056, + "q2": 1.8687999, + "q3": 0.2368, + "xAngularRateDegreeS": 81.92, + "yAngularRateDegreeS": 107.21, + "zAngularRateDegreeS": -219.19 + }, + "hstx": { + "rfOutputVolts": 71.71714, + "paTemp": -32.05571, + "boardTempTop": 0.0, + "boardTempBottom": 0.125, + "batCurrent": 0.132096, + "batVoltage": 0.51600003, + "paCurrent": 0.067584, + "paVoltage": 253.19202 + } + }, + "header": { + "destinationAddress": { + "callsign": "ASCL", + "ssid": 0, + "extensionBit": 0 + }, + "sourceAddress": { + "callsign": "RANDEV", + "ssid": 0, + "extensionBit": 1 + }, + "frameType": "U", + "sendSequenceNumber": 0, + "receiveSequenceNumber": 0, + "uControlType": "UI", + "pid": 240 + }, + "beginSample": 0, + "beginMillis": 0, + "endSample": 0 +} \ No newline at end of file