Skip to main content

Position

Struct Position 

Source
pub struct Position {
Show 23 fields pub latitude_i: Option<i32>, pub longitude_i: Option<i32>, pub altitude: Option<i32>, pub time: u32, pub location_source: i32, pub altitude_source: i32, pub timestamp: u32, pub timestamp_millis_adjust: i32, pub altitude_hae: Option<i32>, pub altitude_geoidal_separation: Option<i32>, pub pdop: u32, pub hdop: u32, pub vdop: u32, pub gps_accuracy: u32, pub ground_speed: Option<u32>, pub ground_track: Option<u32>, pub fix_quality: u32, pub fix_type: u32, pub sats_in_view: u32, pub sensor_id: u32, pub next_update: u32, pub seq_number: u32, pub precision_bits: u32,
}
Expand description

A GPS Position

Fields§

§latitude_i: Option<i32>

The new preferred location encoding, multiply by 1e-7 to get degrees in floating point

§longitude_i: Option<i32>

TODO: REPLACE

§altitude: Option<i32>

In meters above MSL (but see issue #359)

§time: u32

This is usually not sent over the mesh (to save space), but it is sent from the phone so that the local device can set its time if it is sent over the mesh (because there are devices on the mesh without GPS or RTC). seconds since 1970

§location_source: i32

TODO: REPLACE

§altitude_source: i32

TODO: REPLACE

§timestamp: u32

Positional timestamp (actual timestamp of GPS solution) in integer epoch seconds

§timestamp_millis_adjust: i32

Pos. timestamp milliseconds adjustment (rarely available or required)

§altitude_hae: Option<i32>

HAE altitude in meters - can be used instead of MSL altitude

§altitude_geoidal_separation: Option<i32>

Geoidal separation in meters

§pdop: u32

Horizontal, Vertical and Position Dilution of Precision, in 1/100 units

  • PDOP is sufficient for most cases
  • for higher precision scenarios, HDOP and VDOP can be used instead, in which case PDOP becomes redundant (PDOP=sqrt(HDOP^2 + VDOP^2)) TODO: REMOVE/INTEGRATE
§hdop: u32

TODO: REPLACE

§vdop: u32

TODO: REPLACE

§gps_accuracy: u32

GPS accuracy (a hardware specific constant) in mm multiplied with DOP to calculate positional accuracy Default: “’bout three meters-ish” :)

§ground_speed: Option<u32>

Ground speed in m/s and True North TRACK in 1/100 degrees Clarification of terms:

  • “track” is the direction of motion (measured in horizontal plane)
  • “heading” is where the fuselage points (measured in horizontal plane)
  • “yaw” indicates a relative rotation about the vertical axis TODO: REMOVE/INTEGRATE
§ground_track: Option<u32>

TODO: REPLACE

§fix_quality: u32

GPS fix quality (from NMEA GxGGA statement or similar)

§fix_type: u32

GPS fix type 2D/3D (from NMEA GxGSA statement)

§sats_in_view: u32

GPS “Satellites in View” number

§sensor_id: u32

Sensor ID - in case multiple positioning sensors are being used

§next_update: u32

Estimated/expected time (in seconds) until next update:

  • if we update at fixed intervals of X seconds, use X
  • if we update at dynamic intervals (based on relative movement etc), but “AT LEAST every Y seconds”, use Y
§seq_number: u32

A sequence number, incremented with each Position message to help detect lost updates if needed

§precision_bits: u32

Indicates the bits of precision set by the sending node

Implementations§

Source§

impl Position

Source

pub fn latitude_i(&self) -> i32

Returns the value of latitude_i, or the default value if latitude_i is unset.

Source

pub fn longitude_i(&self) -> i32

Returns the value of longitude_i, or the default value if longitude_i is unset.

Source

pub fn altitude(&self) -> i32

Returns the value of altitude, or the default value if altitude is unset.

Source

pub fn location_source(&self) -> LocSource

Returns the enum value of location_source, or the default if the field is set to an invalid enum value.

Source

pub fn set_location_source(&mut self, value: LocSource)

Sets location_source to the provided enum value.

Source

pub fn altitude_source(&self) -> AltSource

Returns the enum value of altitude_source, or the default if the field is set to an invalid enum value.

Source

pub fn set_altitude_source(&mut self, value: AltSource)

Sets altitude_source to the provided enum value.

Source

pub fn altitude_hae(&self) -> i32

Returns the value of altitude_hae, or the default value if altitude_hae is unset.

Source

pub fn altitude_geoidal_separation(&self) -> i32

Returns the value of altitude_geoidal_separation, or the default value if altitude_geoidal_separation is unset.

Source

pub fn ground_speed(&self) -> u32

Returns the value of ground_speed, or the default value if ground_speed is unset.

Source

pub fn ground_track(&self) -> u32

Returns the value of ground_track, or the default value if ground_track is unset.

Trait Implementations§

Source§

impl Clone for Position

Source§

fn clone(&self) -> Position

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Position

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Position

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Position

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for Position

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Message for Position

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl PartialEq for Position

Source§

fn eq(&self, other: &Position) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Position

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Position

Source§

impl Eq for Position

Source§

impl StructuralPartialEq for Position

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,