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 from sparse 28 * image point correspondences in multiple 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 gyroscope 31 * data and uses a SLAM estimator. 32 * 33 * @param <R> type of re-constructor. 34 */ 35 public interface BaseSlamSparseReconstructorListener<R extends BaseSlamSparseReconstructor<?, ?, ?, ?, ?>> extends 36 BaseSparseReconstructorListener<R> { 37 38 /** 39 * Called whenever slam data notification is enabled and each time all required samples (accelerometer, 40 * gyroscope or orientation) are received in order to update SLAM system state to notify 41 * new position, velocity, acceleration, orientation and angular speed. 42 * 43 * @param reconstructor re-constructor raising this event. 44 * @param positionX x position coordinate expressed in meters (m). 45 * @param positionY y position coordinate expressed in meters (m). 46 * @param positionZ z position coordinate expressed in meters (m). 47 * @param velocityX x velocity coordinate expressed in meters per second (m/s). 48 * @param velocityY y velocity coordinate expressed in meters per second (m/s). 49 * @param velocityZ z velocity coordinate expressed in meters per second (m/s). 50 * @param accelerationX x linear acceleration coordinate expressed in meters per squared second (m/s^2). 51 * @param accelerationY y linear acceleration coordinate expressed in meters per squared second (m/s^2). 52 * @param accelerationZ z linear acceleration coordinate expressed in meters per squared second (m/s^2). 53 * @param quaternionA a component of quaternion expressing current orientation. 54 * @param quaternionB b component of quaternion expressing current orientation. 55 * @param quaternionC c component of quaternion expressing current orientation. 56 * @param quaternionD d component of quaternion expressing current orientation. 57 * @param angularSpeedX x coordinate of angular speed expressed in radians per second (rad/s). 58 * @param angularSpeedY y coordinate of angular speed expressed in radians per second (rad/s). 59 * @param angularSpeedZ z coordinate of angular speed expressed in radians per second (rad/s). 60 * @param covariance contains covariance matrix of estimated SLAM state. Matrix meaning will change 61 * depending on slam implementation. See: {@link SlamEstimator#getStateCovariance()}, 62 * {@link ConstantVelocityModelSlamEstimator#getStateCovariance()}, 63 * {@link AbsoluteOrientationSlamEstimator#getStateCovariance()} or 64 * {@link AbsoluteOrientationConstantVelocityModelSlamEstimator#getStateCovariance()}. 65 */ 66 void onSlamDataAvailable(final R reconstructor, final double positionX, final double positionY, 67 final double positionZ, final double velocityX, final double velocityY, 68 final double velocityZ, final double accelerationX, final double accelerationY, 69 final double accelerationZ, final double quaternionA, final double quaternionB, 70 final double quaternionC, final double quaternionD, final double angularSpeedX, 71 final double angularSpeedY, final double angularSpeedZ, final Matrix covariance); 72 73 /** 74 * Called whenever estimated SLAM camera notification is enabled. 75 * This method is called each time all required samples (accelerometer, gyroscope or orientation) are 76 * received in order to update SLAM system state to notify a new camera containing 77 * current intrinsic parameters, position and orientation. 78 * 79 * @param reconstructor re-constructor raising this event. 80 * @param camera current camera estimated using IMU data. This instance and its associated 81 * instances (camera center, rotation and intrinsic parameters) will be reused 82 * between consecutive calls to this method. 83 */ 84 void onSlamCameraEstimated(final R reconstructor, final PinholeCamera camera); 85 }