DeviceOrientation.Builder

public static final class DeviceOrientation.Builder extends Object

A builder for DeviceOrientation.

Public Constructor Summary

Builder(float[] attitude, float headingDegrees, float headingErrorDegrees, long elapsedRealtimeNs)
Constructs a new builder with required fields values.
Builder(DeviceOrientation src)
Constructs a new builder with values copied from the given DeviceOrientation.

Public Method Summary

DeviceOrientation
build()
Builds a new DeviceOrientation.
DeviceOrientation.Builder
clearConservativeHeadingErrorDegrees()
Resets the estimated conservative heading error (in degrees) in the reported heading of the device.
DeviceOrientation.Builder
setAttitude(float[] attitude)
Sets the attitude of the device.
DeviceOrientation.Builder
setConservativeHeadingErrorDegrees(float conservativeHeadingErrorDegrees)
Sets the conservative heading error (in degrees) in the reported heading (in the range [0, 180]).
DeviceOrientation.Builder
setElapsedRealtimeNs(long elapsedRealtimeNs)
Sets the time (in nanoseconds) when this device orientation is estimated, in elapsed real-time since system boot.
DeviceOrientation.Builder
setHeadingDegrees(float headingDegrees)
Sets the estimated heading of the device in degrees between [0, 360).
DeviceOrientation.Builder
setHeadingErrorDegrees(float headingErrorDegrees)
Sets the estimated error in the reported heading of the device in degrees (in the range [0, 180]).

Inherited Method Summary

Public Constructors

public Builder (float[] attitude, float headingDegrees, float headingErrorDegrees, long elapsedRealtimeNs)

Constructs a new builder with required fields values.

public Builder (DeviceOrientation src)

Constructs a new builder with values copied from the given DeviceOrientation.

Public Methods

public DeviceOrientation build ()

Builds a new DeviceOrientation.

public DeviceOrientation.Builder clearConservativeHeadingErrorDegrees ()

Resets the estimated conservative heading error (in degrees) in the reported heading of the device.

public DeviceOrientation.Builder setAttitude (float[] attitude)

Sets the attitude of the device. For more details see DeviceOrientation.getAttitude()

Parameters
attitude float array of length 4 and corresponding to a quaternion in the order (x, y, z, w).
Throws
IllegalArgumentException if attitude doesn't contain 4 items or contains a NaN.

public DeviceOrientation.Builder setConservativeHeadingErrorDegrees (float conservativeHeadingErrorDegrees)

Sets the conservative heading error (in degrees) in the reported heading (in the range [0, 180]).

Throws
IllegalArgumentException if conservativeHeadingErrorDegrees is out of the allowed range

public DeviceOrientation.Builder setElapsedRealtimeNs (long elapsedRealtimeNs)

Sets the time (in nanoseconds) when this device orientation is estimated, in elapsed real-time since system boot.

Throws
IllegalArgumentException if elapsedRealtimeNs is less than zero

public DeviceOrientation.Builder setHeadingDegrees (float headingDegrees)

Sets the estimated heading of the device in degrees between [0, 360). For further explanation see DeviceOrientation.getHeadingDegrees()

Throws
IllegalArgumentException if headingDegrees is out of the allowed range

public DeviceOrientation.Builder setHeadingErrorDegrees (float headingErrorDegrees)

Sets the estimated error in the reported heading of the device in degrees (in the range [0, 180]). For further explanation see DeviceOrientation.getHeadingErrorDegrees().

Throws
IllegalArgumentException if headingErrorDegrees is out of the allowed range