pose_prediction.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright 2019 Google Inc. All Rights Reserved.
  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. #ifndef CARDBOARD_SDK_SENSORS_POSE_PREDICTION_H_
  17. #define CARDBOARD_SDK_SENSORS_POSE_PREDICTION_H_
  18. #include <cstdint>
  19. #include "pose_state.h"
  20. #include "../util/rotation.h"
  21. namespace cardboard {
  22. namespace pose_prediction {
  23. // Returns a rotation matrix based on the integration of the gyroscope_value
  24. // over the timestep_s in seconds.
  25. // TODO(pfg): Document the space better here.
  26. //
  27. // @param gyroscope_value gyroscope sensor values.
  28. // @param timestep_s integration period in seconds.
  29. // @return Integration of the gyroscope value the rotation is from Start to
  30. // Sensor Space.
  31. Rotation GetRotationFromGyroscope(const Vector3& gyroscope_value, double timestep_s);
  32. // Gets a predicted pose for a given time in the future (e.g. rendering time)
  33. // based on a linear prediction model. This uses the system current state
  34. // (position, velocity, etc) from the past to extrapolate a position in the
  35. // future.
  36. //
  37. // @param requested_pose_timestamp time at which you want the pose.
  38. // @param current_state current state that stores the pose and linear model at a
  39. // given time prior to requested_pose_timestamp_ns.
  40. // @return pose from Start to Sensor Space.
  41. Rotation PredictPose(int64_t requested_pose_timestamp, const PoseState& current_state);
  42. // Equivalent to PredictPose, but for use with poses relative to Start Space
  43. // rather than sensor space.
  44. Rotation PredictPoseInv(int64_t requested_pose_timestamp, const PoseState& current_state);
  45. } // namespace pose_prediction
  46. } // namespace cardboard
  47. #endif // CARDBOARD_SDK_SENSORS_POSE_PREDICTION_H_