pose_state.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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_STATE_H_
  17. #define CARDBOARD_SDK_SENSORS_POSE_STATE_H_
  18. #include "../util/rotation.h"
  19. #include "../util/vector.h"
  20. namespace cardboard {
  21. enum {
  22. kPoseStateFlagInvalid = 1U << 0,
  23. kPoseStateFlagInitializing = 1U << 1,
  24. kPoseStateFlagHas6DoF = 1U << 2,
  25. };
  26. // Stores a head pose pose plus derivatives. This can be used for prediction.
  27. struct PoseState {
  28. // System wall time.
  29. int64_t timestamp;
  30. // Rotation from Sensor Space to Start Space.
  31. Rotation sensor_from_start_rotation;
  32. // First derivative of the rotation.
  33. Vector3 sensor_from_start_rotation_velocity;
  34. // Current gyroscope bias in rad/s.
  35. Vector3 bias;
  36. // The position of the headset.
  37. Vector3 position = Vector3(0, 0, 0);
  38. // In the same coordinate frame as the position.
  39. Vector3 velocity = Vector3(0, 0, 0);
  40. // Flags indicating the status of the pose.
  41. uint64_t flags = 0U;
  42. };
  43. } // namespace cardboard
  44. #endif // CARDBOARD_SDK_SENSORS_POSE_STATE_H_