added a first simple test for Phoenix sensor / GPS data being received from a UDP stream

Change-Id: I619cef8ececa0a392c4e237ba134bbef57ded833
This commit is contained in:
Axel Uhl
2017-11-04 10:18:32 +01:00
parent 1fc741c472
commit da3fa56777
5 changed files with 156 additions and 19 deletions
@@ -177,19 +177,6 @@ public interface ExpeditionMessage extends UDPMessage {
*/
final int ID_TARG_BSP_P = 238;
/**
* Heel (inclination along the axis parallel to the boat's keel) in decimal degrees; negative values indicate heel
* to port, positive values to starboard
*/
final int ID_HEEL = 000; // TODO find out the ID of the HEEL value in the Expedition UDP stream
/**
* Trim (also called "pitch" or "nick"; the boat's inclination along the axis parallel to the water surface and
* perpendicular to the keel direction in which the boat is generally moving) in decimal degrees; negative values
* indicate that the bow is lower than the stern;
*/
final int ID_TRIM = 000; // TODO find out the ID of the TRIM value in the Expedition UDP stream
/**
* A message's checksum determines whether the package is to be considered valid.
*/
@@ -100,13 +100,14 @@ public class UDPExpeditionReceiver extends UDPReceiver<ExpeditionMessage, Expedi
* store in the {@link DeviceRegistry#getSensorFixStore() sensor fix store}.
*/
private void tryToProduceAndStoreSensorFix(ExpeditionMessage msg, ExpeditionSensorDeviceIdentifier sensorDeviceIdentifier) {
final Double heelInDegrees = msg.hasValue(ExpeditionMessage.ID_HEEL) ? msg.getValue(ExpeditionMessage.ID_HEEL) : null;
final Double trimInDegrees = msg.hasValue(ExpeditionMessage.ID_TRIM) ? msg.getValue(ExpeditionMessage.ID_TRIM) : null;
final Double[] vector = new Double[Math.max(ExpeditionExtendedSensorDataMetadata.HEEL.getColumnIndex(), ExpeditionExtendedSensorDataMetadata.TRIM.getColumnIndex())-1];
final Double heelInDegrees = msg.hasValue(ExpeditionMessage.ID_ROLL) ? msg.getValue(ExpeditionMessage.ID_ROLL) : null;
final Double trimInDegrees = msg.hasValue(ExpeditionMessage.ID_PITCH) ? msg.getValue(ExpeditionMessage.ID_PITCH) : null;
final Double[] vector = new Double[Math.max(ExpeditionExtendedSensorDataMetadata.HEEL.getColumnIndex(),
ExpeditionExtendedSensorDataMetadata.TRIM.getColumnIndex())+1];
vector[ExpeditionExtendedSensorDataMetadata.HEEL.getColumnIndex()] = heelInDegrees;
vector[ExpeditionExtendedSensorDataMetadata.TRIM.getColumnIndex()] = trimInDegrees;
final DoubleVectorFix fix = new DoubleVectorFixImpl(msg.getTimePoint(), vector);
if (fix != null) {
if (fix != null && fix.hasValidData()) {
deviceRegistry.getSensorFixStore().storeFix(sensorDeviceIdentifier, fix);
}
}