#[repr(C)]pub struct SetCameraPoseBufferCmd {
pub camera_id: u32,
pub buffer_id: u32,
pub num_entries: u32,
pub base_time: i64,
pub time_interval: u64,
}
Expand description
Sets the “pose buffer” for the camera identified by camera_id
.
This operation can be applied to both Cameras and StereoCameras.
This will override any position and rotation set for the camera and will make it take its position and rotation from the pose buffer each frame based on the presentation time for that frame.
A pose buffer represents a ring buffer of poses for a fixed number of time
points in the future. Each entry in the buffer identified by buffer_id
is
a quaternion and a position layed out as follows:
struct Pose { // Quaternion float32 a; float32 b; float32 c; float32 d;
// Position float32 x; float32 y; float32 z;
// Reserved/Padding byte[4] reserved; }
The buffer can be thought of as a packed array of num_entries
Pose structs
and is required to be at least num_entries * sizeof(Pose) bytes.
The quaternions and positions are specified in the space of the camera’s parent node.
base_time
is a base time point expressed in nanoseconds in the
CLOCK_MONOTONIC
timebase and time_interval
is the time in nanoseconds
between entries in the buffer. base_time
must be in the past.
For a given point in time t
expressed in nanoseconds in the
CLOCK_MONOTONIC
timebase the index of the corresponding pose in
the pose buffer can be computed as follows:
index(t) = ((t - base_time) / time_interval) % num_entries
poses[index(t)] is valid for t over the time interval (t - time_interval, t] and should be expected to updated continuously without synchronization for the duration of that interval. If a single pose value is needed for multiple non-atomic operations a value should be latched and stored outside the pose buffer.
Because the poses are not protected by any synchronization primitives it is possible that when a pose is latched it will be only partially updated, and the pose being read will contain some components from the pose before it is updated and some components from the updated pose. The safety of using these “torn” poses relies on two things:
-
Sequential poses written to poses[index(t)] are very similar to each other numerically, so that if some components are taken from the first and some are taken from another the result is numerically similar to both
-
The space of positions and quaternions is locally flat at the scale of changes between sequential updates, which guarantees that two poses which are numerically similar also represent semantically similar poses (i.e. there are no discontinuities which will cause a small numerical change in the position or quaterninon to cause a large change in the encoded pose) For positions this is guaranteed because Scenic uses a Euclidean 3-space which is globally flat and for quaternions this is guaranteed because quaternions encode rotation as points on a unit 4-sphere, and spheres are locally flat. For more details on the encoding of rotations in quaterions see https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation
This commanderation is intended for late latching camera pose to support low-latency motion-tracked rendering.
Fields§
§camera_id: u32
§buffer_id: u32
§num_entries: u32
§base_time: i64
§time_interval: u64
Trait Implementations§
Source§impl Clone for SetCameraPoseBufferCmd
impl Clone for SetCameraPoseBufferCmd
Source§fn clone(&self) -> SetCameraPoseBufferCmd
fn clone(&self) -> SetCameraPoseBufferCmd
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SetCameraPoseBufferCmd
impl Debug for SetCameraPoseBufferCmd
Source§impl<D: ResourceDialect> Decode<SetCameraPoseBufferCmd, D> for SetCameraPoseBufferCmd
impl<D: ResourceDialect> Decode<SetCameraPoseBufferCmd, D> for SetCameraPoseBufferCmd
Source§impl<D: ResourceDialect> Encode<SetCameraPoseBufferCmd, D> for &SetCameraPoseBufferCmd
impl<D: ResourceDialect> Encode<SetCameraPoseBufferCmd, D> for &SetCameraPoseBufferCmd
Source§impl<D: ResourceDialect, T0: Encode<u32, D>, T1: Encode<u32, D>, T2: Encode<u32, D>, T3: Encode<i64, D>, T4: Encode<u64, D>> Encode<SetCameraPoseBufferCmd, D> for (T0, T1, T2, T3, T4)
impl<D: ResourceDialect, T0: Encode<u32, D>, T1: Encode<u32, D>, T2: Encode<u32, D>, T3: Encode<i64, D>, T4: Encode<u64, D>> Encode<SetCameraPoseBufferCmd, D> for (T0, T1, T2, T3, T4)
Source§impl Hash for SetCameraPoseBufferCmd
impl Hash for SetCameraPoseBufferCmd
Source§impl Ord for SetCameraPoseBufferCmd
impl Ord for SetCameraPoseBufferCmd
Source§fn cmp(&self, other: &SetCameraPoseBufferCmd) -> Ordering
fn cmp(&self, other: &SetCameraPoseBufferCmd) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SetCameraPoseBufferCmd
impl PartialEq for SetCameraPoseBufferCmd
Source§impl PartialOrd for SetCameraPoseBufferCmd
impl PartialOrd for SetCameraPoseBufferCmd
Source§impl TypeMarker for SetCameraPoseBufferCmd
impl TypeMarker for SetCameraPoseBufferCmd
Source§type Owned = SetCameraPoseBufferCmd
type Owned = SetCameraPoseBufferCmd
Source§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
Source§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align
.§fn encode_is_copy() -> bool
fn encode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned
to a single memcpy. Read more§fn decode_is_copy() -> bool
fn decode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned
to a single memcpy.Source§impl ValueTypeMarker for SetCameraPoseBufferCmd
impl ValueTypeMarker for SetCameraPoseBufferCmd
Source§type Borrowed<'a> = &'a SetCameraPoseBufferCmd
type Borrowed<'a> = &'a SetCameraPoseBufferCmd
Encode<Self>
type cheaply obtainable from &Self::Owned
. There are three cases: Read moreimpl Copy for SetCameraPoseBufferCmd
impl Eq for SetCameraPoseBufferCmd
impl Persistable for SetCameraPoseBufferCmd
impl StructuralPartialEq for SetCameraPoseBufferCmd
Auto Trait Implementations§
impl Freeze for SetCameraPoseBufferCmd
impl RefUnwindSafe for SetCameraPoseBufferCmd
impl Send for SetCameraPoseBufferCmd
impl Sync for SetCameraPoseBufferCmd
impl Unpin for SetCameraPoseBufferCmd
impl UnwindSafe for SetCameraPoseBufferCmd
Blanket Implementations§
§impl<T> Body for Twhere
T: Persistable,
impl<T> Body for Twhere
T: Persistable,
§type MarkerAtTopLevel = T
type MarkerAtTopLevel = T
§type MarkerInResultUnion = T
type MarkerInResultUnion = T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)