Class BaseSlamPairedViewsSparseReconstructor<D extends BaseCalibrationData,C extends BaseSlamPairedViewsSparseReconstructorConfiguration<D,C>,R extends BaseSlamPairedViewsSparseReconstructor<D,C,R,L,S>,L extends BaseSlamPairedViewsSparseReconstructorListener<R>,S extends BaseSlamEstimator<D>>

java.lang.Object
com.irurueta.ar.sfm.BasePairedViewsSparseReconstructor<C,R,L>
com.irurueta.ar.sfm.BaseSlamPairedViewsSparseReconstructor<D,C,R,L,S>
Direct Known Subclasses:
BaseAbsoluteOrientationSlamPairedViewsSparseReconstructor, ConstantVelocityModelSlamPairedViewsSparseReconstructor, SlamPairedViewsSparseReconstructor

public abstract class BaseSlamPairedViewsSparseReconstructor<D extends BaseCalibrationData,C extends BaseSlamPairedViewsSparseReconstructorConfiguration<D,C>,R extends BaseSlamPairedViewsSparseReconstructor<D,C,R,L,S>,L extends BaseSlamPairedViewsSparseReconstructorListener<R>,S extends BaseSlamEstimator<D>> extends BasePairedViewsSparseReconstructor<C,R,L>
  • Field Details

    • slamEstimator

      protected S extends BaseSlamEstimator<D> slamEstimator
      Slam estimator to estimate position, speed, orientation using accelerometer and gyroscope data.
    • slamPosition

      private final com.irurueta.geometry.InhomogeneousPoint3D slamPosition
      Position estimated by means of SLAM. It is reused each time it is notified.
    • invEuclideanCameraRotation

      private com.irurueta.geometry.Rotation3D invEuclideanCameraRotation
      Inverse Euclidean camera rotation. This is reused for memory efficiency.
    • slamCamera

      private final com.irurueta.geometry.PinholeCamera slamCamera
      Camera estimated by means of SLAM. It is reused each time it is notified.
    • slamRotation

      private final com.irurueta.geometry.Quaternion slamRotation
      Camera rotation estimated by means of SLAM. It is reused each time it is notified.
    • lastTimestamp

      private long lastTimestamp
      Last SLAM timestamp.
    • lastViewPairTimestamp

      private long lastViewPairTimestamp
      Last view pair SLAM timestamp.
  • Constructor Details

    • BaseSlamPairedViewsSparseReconstructor

      protected BaseSlamPairedViewsSparseReconstructor(C configuration, L listener)
      Constructor.
      Parameters:
      configuration - configuration for this re-constructor.
      listener - listener in charge of handling events.
      Throws:
      NullPointerException - if listener or configuration is not provided.
  • Method Details

    • updateAccelerometerSample

      public void updateAccelerometerSample(long timestamp, float accelerationX, float accelerationY, float accelerationZ)
      Provides a new accelerometer sample to update SLAM estimation. This method must be called whenever the accelerometer sensor receives new data. If re-constructor is not running, calling this method has no effect.
      Parameters:
      timestamp - timestamp of accelerometer sample since epoch time and expressed in nanoseconds.
      accelerationX - linear acceleration along x-axis expressed in meters per squared second (m/s^2).
      accelerationY - linear acceleration along y-axis expressed in meters per squared second (m/s^2).
      accelerationZ - linear acceleration along z-axis expressed in meters per squared second (m/s^2).
    • updateAccelerometerSample

      public void updateAccelerometerSample(long timestamp, float[] data)
      Provides a new accelerometer sample to update SLAM estimation. This method must be called whenever the accelerometer sensor receives new data. If re-constructor is not running, calling this method has no effect.
      Parameters:
      timestamp - timestamp of accelerometer sample since epoch time and expressed in nanoseconds.
      data - array containing x,y,z components of linear acceleration expressed in meters per squared second (m/s^2).
      Throws:
      IllegalArgumentException - if provided array does not have length 3.
    • updateGyroscopeSample

      public void updateGyroscopeSample(long timestamp, float angularSpeedX, float angularSpeedY, float angularSpeedZ)
      Provides a new gyroscope sample to update SLAM estimation. If re-constructor is not running, calling this method has no effect.
      Parameters:
      timestamp - timestamp of gyroscope sample since epoch time and expressed in nanoseconds.
      angularSpeedX - angular speed of rotation along x-axis expressed in radians per second (rad/s).
      angularSpeedY - angular speed of rotation along y-axis expressed in radians per second (rad/s).
      angularSpeedZ - angular speed of rotation along z-axis expressed in radians per second (rad/s).
    • updateGyroscopeSample

      public void updateGyroscopeSample(long timestamp, float[] data)
      Provides a new gyroscope sample to update SLAM estimation. If re-constructor is not running, calling this method has no effect.
      Parameters:
      timestamp - timestamp of gyroscope sample since epoch time and expressed in nanoseconds.
      data - angular speed of rotation along x,y,z axes expressed in radians per second (rad/s).
      Throws:
      IllegalArgumentException - if provided array does not have length 3.
    • reset

      public void reset()
      Resets this instance so that a reconstruction can be started from the beginning without cancelling current one.
      Overrides:
      reset in class BasePairedViewsSparseReconstructor<C extends BaseSlamPairedViewsSparseReconstructorConfiguration<D,C>,R extends BaseSlamPairedViewsSparseReconstructor<D,C,R,L,S>,L extends BaseSlamPairedViewsSparseReconstructorListener<R>>
    • hasAbsoluteOrientation

      protected boolean hasAbsoluteOrientation()
      Indicates whether implementations of a re-constructor uses absolute orientation or not.
      Specified by:
      hasAbsoluteOrientation in class BasePairedViewsSparseReconstructor<C extends BaseSlamPairedViewsSparseReconstructorConfiguration<D,C>,R extends BaseSlamPairedViewsSparseReconstructor<D,C,R,L,S>,L extends BaseSlamPairedViewsSparseReconstructorListener<R>>
      Returns:
      true if absolute orientation is used, false, otherwise.
    • setUpCalibrationData

      protected void setUpCalibrationData()
      Configures calibration data on SLAM estimator if available.
    • setUpSlamEstimatorListener

      protected void setUpSlamEstimatorListener()
      Configures listener of SLAM estimator
    • transformPairOfCamerasAndPoints

      protected boolean transformPairOfCamerasAndPoints(boolean isInitialPairOfViews, boolean hasAbsoluteOrientation)
      Transforms metric cameras on current pair of views so that they are referred to last kept location and rotation and upgrades cameras from metric stratum to Euclidean stratum.
      Overrides:
      transformPairOfCamerasAndPoints in class BasePairedViewsSparseReconstructor<C extends BaseSlamPairedViewsSparseReconstructorConfiguration<D,C>,R extends BaseSlamPairedViewsSparseReconstructor<D,C,R,L,S>,L extends BaseSlamPairedViewsSparseReconstructorListener<R>>
      Parameters:
      isInitialPairOfViews - true if initial pair of views is being processed, false otherwise.
      hasAbsoluteOrientation - true if absolute orientation is required, false otherwise.
      Returns:
      true if cameras were successfully transformed.
    • estimateCurrentScale

      private double estimateCurrentScale()
      Estimates current scale using SLAM data.
      Returns:
      estimated scale.
    • notifySlamStateIfNeeded

      private void notifySlamStateIfNeeded()
      Notifies SLAM state if notification is enabled at configuration time.
    • notifySlamCameraIfNeeded

      private void notifySlamCameraIfNeeded()
      Notifies estimated camera by means of SLAM if notification is enabled at configuration time and intrinsics are already available.