1 /* 2 * Copyright (C) 2023 The Android Open Source Project 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 package com.android.server.uwb.correction.filtering; 17 18 import androidx.annotation.NonNull; 19 import androidx.annotation.Nullable; 20 21 import com.android.server.uwb.correction.math.SphericalVector; 22 import com.android.server.uwb.correction.pose.IPoseSource; 23 24 /** 25 * Interface for a filter that operates on a UwbPosition. 26 */ 27 public interface IPositionFilter { 28 /** 29 * Adds a value to the filter. 30 * @param value The value to add to the filter. 31 * @param timeMs The time at which the UWB value was received, in ms since boot. This is 32 * used to determine the latency introduced by the filter. Note that this has no effect on the 33 * order in which the filter operates on values. 34 */ add(@onNull SphericalVector value, long timeMs)35 void add(@NonNull SphericalVector value, long timeMs); 36 37 /** 38 * Computes a predicted UWB position based on the new pose. 39 * @param timeMs The time for which the position should be computed, in ms since boot. 40 */ compute(long timeMs)41 SphericalVector compute(long timeMs); 42 43 /** 44 * Updates the filter history to account for changes to the pose. 45 * @param poseSource The pose source from which to get the latest pose. 46 */ updatePose(@ullable IPoseSource poseSource, long timeMs)47 void updatePose(@Nullable IPoseSource poseSource, long timeMs); 48 } 49