1 /* 2 * Copyright (C) 2017 Alberto Irurueta Carro (alberto@irurueta.com) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.irurueta.ar.sfm; 18 19 import com.irurueta.algebra.Matrix; 20 import com.irurueta.ar.slam.AbsoluteOrientationConstantVelocityModelSlamEstimator; 21 import com.irurueta.ar.slam.AbsoluteOrientationSlamEstimator; 22 import com.irurueta.ar.slam.ConstantVelocityModelSlamEstimator; 23 import com.irurueta.ar.slam.SlamEstimator; 24 import com.irurueta.geometry.PinholeCamera; 25 26 /** 27 * Listener to retrieve and store required data to compute a 3D reconstruction 28 * from sparse image point correspondences in two views. 29 * Implementations of this interface also notify when cameras are estimated due to 30 * received IMU (Inertial Measurement Unit) data, which contains accelerometer and 31 * gyroscope data and uses a SLAM estimator. 32 * 33 * @param <R> type of re-constructor. 34 */ 35 public interface BaseSlamTwoViewsSparseReconstructorListener< 36 R extends BaseSlamTwoViewsSparseReconstructor<?, ?, ?, ?, ?>> 37 extends BaseTwoViewsSparseReconstructorListener<R> { 38 39 /** 40 * Called whenever slam data notification is enabled and each time all required samples (accelerometer, 41 * gyroscope or orientation) are received in order to update SLAM system state to notify 42 * new position, velocity, acceleration, orientation and angular speed. 43 * 44 * @param reconstructor re-constructor raising this event. 45 * @param positionX x position coordinate expressed in meters (m). 46 * @param positionY y position coordinate expressed in meters (m). 47 * @param positionZ z position coordinate expressed in meters (m). 48 * @param velocityX x velocity coordinate expressed in meters per second (m/s). 49 * @param velocityY y velocity coordinate expressed in meters per second (m/s). 50 * @param velocityZ z velocity coordinate expressed in meters per second (m/s). 51 * @param accelerationX x linear acceleration coordinate expressed in meters per squared second (m/s^2). 52 * @param accelerationY y linear acceleration coordinate expressed in meters per squared second (m/s^2). 53 * @param accelerationZ z linear acceleration coordinate expressed in meters per squared second (m/s^2). 54 * @param quaternionA a component of quaternion expressing current orientation. 55 * @param quaternionB b component of quaternion expressing current orientation. 56 * @param quaternionC c component of quaternion expressing current orientation. 57 * @param quaternionD d component of quaternion expressing current orientation. 58 * @param angularSpeedX x coordinate of angular speed expressed in radians per second (rad/s). 59 * @param angularSpeedY y coordinate of angular speed expressed in radians per second (rad/s). 60 * @param angularSpeedZ z coordinate of angular speed expressed in radians per second (rad/s). 61 * @param covariance contains covariance matrix of estimated SLAM state. Matrix meaning will change 62 * depending on slam implementation. See: {@link SlamEstimator#getStateCovariance()}, 63 * {@link ConstantVelocityModelSlamEstimator#getStateCovariance()}, 64 * {@link AbsoluteOrientationSlamEstimator#getStateCovariance()} or 65 * {@link AbsoluteOrientationConstantVelocityModelSlamEstimator#getStateCovariance()}. 66 */ 67 void onSlamDataAvailable(final R reconstructor, final double positionX, final double positionY, 68 final double positionZ, final double velocityX, final double velocityY, 69 final double velocityZ, final double accelerationX, final double accelerationY, 70 final double accelerationZ, final double quaternionA, final double quaternionB, 71 final double quaternionC, final double quaternionD, final double angularSpeedX, 72 final double angularSpeedY, final double angularSpeedZ, final Matrix covariance); 73 74 /** 75 * Called whenever estimated SLAM camera notification is enabled. 76 * This method is called each time all required samples (accelerometer, gyroscope or orientation) are 77 * received in order to update SLAM system state to notify a new camera containing 78 * current intrinsic parameters, position and orientation. 79 * This method will only be called when using essential method for scene reconstruction and 80 * initial intrinsic parameters are known. 81 * 82 * @param reconstructor re-constructor raising this event. 83 * @param camera current camera estimated using IMU data. This instance and its associated 84 * instances (camera center, rotation and intrinsic parameters) will be reused 85 * between consecutive calls to this method. 86 */ 87 void onSlamCameraEstimated(final R reconstructor, final PinholeCamera camera); 88 }