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