LinearFingerprintPositionEstimator3D.java
/*
* Copyright (C) 2018 Alberto Irurueta Carro (alberto@irurueta.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.irurueta.navigation.indoor.fingerprint;
import com.irurueta.geometry.InhomogeneousPoint3D;
import com.irurueta.geometry.Point3D;
import com.irurueta.navigation.indoor.RadioSource;
import com.irurueta.navigation.indoor.RadioSourceLocated;
import com.irurueta.navigation.indoor.RssiFingerprint;
import com.irurueta.navigation.indoor.RssiFingerprintLocated;
import com.irurueta.navigation.indoor.RssiReading;
import java.util.List;
/**
* 2D position estimator based on located fingerprints containing only RSSI readings and
* having as well prior knowledge of the location of radio sources associated to those
* readings.
* This implementation uses a first-order Taylor approximation over provided located
* fingerprints to determine an approximate position for a non-located fingerprint.
*/
public class LinearFingerprintPositionEstimator3D extends LinearFingerprintPositionEstimator<Point3D> {
/**
* Constructor.
*/
public LinearFingerprintPositionEstimator3D() {
}
/**
* Constructor.
*
* @param listener listener in charge of handling events.
*/
public LinearFingerprintPositionEstimator3D(final FingerprintPositionEstimatorListener<Point3D> listener) {
super(listener);
}
/**
* Constructor.
*
* @param locatedFingerprints located fingerprints containing RSSI readings.
* @param fingerprint fingerprint containing readings at an unknown location
* for provided located fingerprints.
* @param sources located radio sources.
* @throws IllegalArgumentException if provided non located fingerprint is null,
* located fingerprints value is null or there are not enough fingerprints or
* readings within provided fingerprints (for 3D position estimation 3 located
* total readings are required among all fingerprints).
*/
public LinearFingerprintPositionEstimator3D(
final List<? extends RssiFingerprintLocated<? extends RadioSource,
? extends RssiReading<? extends RadioSource>, Point3D>> locatedFingerprints,
final RssiFingerprint<? extends RadioSource,
? extends RssiReading<? extends RadioSource>> fingerprint,
final List<? extends RadioSourceLocated<Point3D>> sources) {
super(locatedFingerprints, fingerprint, sources);
}
/**
* Constructor.
*
* @param locatedFingerprints located fingerprints containing RSSI readings.
* @param fingerprint fingerprint containing readings at an unknown location
* for provided located fingerprints.
* @param sources located radio sources.
* @param listener listener in charge of handling events.
* @throws IllegalArgumentException if provided non located fingerprint is null,
* located fingerprints value is null or there are not enough fingerprints or
* readings within provided fingerprints (for 3D position estimation 3 located
* total readings are required among all fingerprints).
*/
public LinearFingerprintPositionEstimator3D(
final List<? extends RssiFingerprintLocated<? extends RadioSource,
? extends RssiReading<? extends RadioSource>, Point3D>> locatedFingerprints,
final RssiFingerprint<? extends RadioSource,
? extends RssiReading<? extends RadioSource>> fingerprint,
final List<? extends RadioSourceLocated<Point3D>> sources,
final FingerprintPositionEstimatorListener<Point3D> listener) {
super(locatedFingerprints, fingerprint, sources, listener);
}
/**
* Gets number of dimensions of points.
*
* @return number of dimensions of points.
*/
@Override
public int getNumberOfDimensions() {
return Point3D.POINT3D_INHOMOGENEOUS_COORDINATES_LENGTH;
}
/**
* Gets estimated position or null if not available yet.
*
* @return estimated position or null.
*/
@Override
public Point3D getEstimatedPosition() {
if (estimatedPositionCoordinates == null) {
return null;
}
final var result = new InhomogeneousPoint3D();
getEstimatedPosition(result);
return result;
}
}