pub use msg_angular_rate::MsgAngularRate;
pub use msg_baseline_heading::MsgBaselineHeading;
pub use msg_orient_euler::MsgOrientEuler;
pub use msg_orient_quat::MsgOrientQuat;
pub mod msg_angular_rate {
#![allow(unused_imports)]
use super::*;
use crate::messages::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Debug, PartialEq, Clone)]
pub struct MsgAngularRate {
#[cfg_attr(feature = "serde", serde(skip_serializing, alias = "sender"))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename = "tow"))]
pub tow: u32,
#[cfg_attr(feature = "serde", serde(rename = "x"))]
pub x: i32,
#[cfg_attr(feature = "serde", serde(rename = "y"))]
pub y: i32,
#[cfg_attr(feature = "serde", serde(rename = "z"))]
pub z: i32,
#[cfg_attr(feature = "serde", serde(rename = "flags"))]
pub flags: u8,
}
impl MsgAngularRate {
pub fn ins_navigation_mode(&self) -> Result<InsNavigationMode, u8> {
get_bit_range!(self.flags, u8, u8, 2, 0).try_into()
}
pub fn set_ins_navigation_mode(&mut self, ins_navigation_mode: InsNavigationMode) {
set_bit_range!(&mut self.flags, ins_navigation_mode, u8, u8, 2, 0);
}
}
impl ConcreteMessage for MsgAngularRate {
const MESSAGE_TYPE: u16 = 546;
const MESSAGE_NAME: &'static str = "MSG_ANGULAR_RATE";
}
impl SbpMessage for MsgAngularRate {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> Option<u16> {
Some(<Self as ConcreteMessage>::MESSAGE_TYPE)
}
fn sender_id(&self) -> Option<u16> {
self.sender_id
}
fn set_sender_id(&mut self, new_id: u16) {
self.sender_id = Some(new_id);
}
fn encoded_len(&self) -> usize {
WireFormat::len(self) + crate::HEADER_LEN + crate::CRC_LEN
}
fn is_valid(&self) -> bool {
true
}
fn into_valid_msg(self) -> Result<Self, crate::messages::invalid::Invalid> {
Ok(self)
}
#[cfg(feature = "swiftnav")]
fn gps_time(&self) -> Option<std::result::Result<time::MessageTime, time::GpsTimeError>> {
let tow_s = (self.tow as f64) / 1000.0;
let gps_time = match time::GpsTime::new(0, tow_s) {
Ok(gps_time) => gps_time.tow(),
Err(e) => return Some(Err(e.into())),
};
Some(Ok(time::MessageTime::Rover(gps_time.into())))
}
}
impl FriendlyName for MsgAngularRate {
fn friendly_name() -> &'static str {
"ANGULAR RATE"
}
}
impl TryFrom<Sbp> for MsgAngularRate {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgAngularRate(m) => Ok(m),
_ => Err(TryFromSbpError(msg)),
}
}
}
impl WireFormat for MsgAngularRate {
const MIN_LEN: usize = <u32 as WireFormat>::MIN_LEN
+ <i32 as WireFormat>::MIN_LEN
+ <i32 as WireFormat>::MIN_LEN
+ <i32 as WireFormat>::MIN_LEN
+ <u8 as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.tow)
+ WireFormat::len(&self.x)
+ WireFormat::len(&self.y)
+ WireFormat::len(&self.z)
+ WireFormat::len(&self.flags)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.tow, buf);
WireFormat::write(&self.x, buf);
WireFormat::write(&self.y, buf);
WireFormat::write(&self.z, buf);
WireFormat::write(&self.flags, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgAngularRate {
sender_id: None,
tow: WireFormat::parse_unchecked(buf),
x: WireFormat::parse_unchecked(buf),
y: WireFormat::parse_unchecked(buf),
z: WireFormat::parse_unchecked(buf),
flags: WireFormat::parse_unchecked(buf),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum InsNavigationMode {
Invalid = 0,
Valid = 1,
}
impl std::fmt::Display for InsNavigationMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
InsNavigationMode::Invalid => f.write_str("Invalid"),
InsNavigationMode::Valid => f.write_str("Valid"),
}
}
}
impl TryFrom<u8> for InsNavigationMode {
type Error = u8;
fn try_from(i: u8) -> Result<Self, u8> {
match i {
0 => Ok(InsNavigationMode::Invalid),
1 => Ok(InsNavigationMode::Valid),
i => Err(i),
}
}
}
}
pub mod msg_baseline_heading {
#![allow(unused_imports)]
use super::*;
use crate::messages::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Debug, PartialEq, Clone)]
pub struct MsgBaselineHeading {
#[cfg_attr(feature = "serde", serde(skip_serializing, alias = "sender"))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename = "tow"))]
pub tow: u32,
#[cfg_attr(feature = "serde", serde(rename = "heading"))]
pub heading: u32,
#[cfg_attr(feature = "serde", serde(rename = "n_sats"))]
pub n_sats: u8,
#[cfg_attr(feature = "serde", serde(rename = "flags"))]
pub flags: u8,
}
impl MsgBaselineHeading {
pub fn fix_mode(&self) -> Result<FixMode, u8> {
get_bit_range!(self.flags, u8, u8, 2, 0).try_into()
}
pub fn set_fix_mode(&mut self, fix_mode: FixMode) {
set_bit_range!(&mut self.flags, fix_mode, u8, u8, 2, 0);
}
}
impl ConcreteMessage for MsgBaselineHeading {
const MESSAGE_TYPE: u16 = 527;
const MESSAGE_NAME: &'static str = "MSG_BASELINE_HEADING";
}
impl SbpMessage for MsgBaselineHeading {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> Option<u16> {
Some(<Self as ConcreteMessage>::MESSAGE_TYPE)
}
fn sender_id(&self) -> Option<u16> {
self.sender_id
}
fn set_sender_id(&mut self, new_id: u16) {
self.sender_id = Some(new_id);
}
fn encoded_len(&self) -> usize {
WireFormat::len(self) + crate::HEADER_LEN + crate::CRC_LEN
}
fn is_valid(&self) -> bool {
true
}
fn into_valid_msg(self) -> Result<Self, crate::messages::invalid::Invalid> {
Ok(self)
}
#[cfg(feature = "swiftnav")]
fn gps_time(&self) -> Option<std::result::Result<time::MessageTime, time::GpsTimeError>> {
let tow_s = (self.tow as f64) / 1000.0;
let gps_time = match time::GpsTime::new(0, tow_s) {
Ok(gps_time) => gps_time.tow(),
Err(e) => return Some(Err(e.into())),
};
Some(Ok(time::MessageTime::Rover(gps_time.into())))
}
}
impl FriendlyName for MsgBaselineHeading {
fn friendly_name() -> &'static str {
"BASELINE HEADING"
}
}
impl TryFrom<Sbp> for MsgBaselineHeading {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgBaselineHeading(m) => Ok(m),
_ => Err(TryFromSbpError(msg)),
}
}
}
impl WireFormat for MsgBaselineHeading {
const MIN_LEN: usize = <u32 as WireFormat>::MIN_LEN
+ <u32 as WireFormat>::MIN_LEN
+ <u8 as WireFormat>::MIN_LEN
+ <u8 as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.tow)
+ WireFormat::len(&self.heading)
+ WireFormat::len(&self.n_sats)
+ WireFormat::len(&self.flags)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.tow, buf);
WireFormat::write(&self.heading, buf);
WireFormat::write(&self.n_sats, buf);
WireFormat::write(&self.flags, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgBaselineHeading {
sender_id: None,
tow: WireFormat::parse_unchecked(buf),
heading: WireFormat::parse_unchecked(buf),
n_sats: WireFormat::parse_unchecked(buf),
flags: WireFormat::parse_unchecked(buf),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum FixMode {
Invalid = 0,
DifferentialGnss = 2,
FloatRtk = 3,
FixedRtk = 4,
}
impl std::fmt::Display for FixMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
FixMode::Invalid => f.write_str("Invalid"),
FixMode::DifferentialGnss => f.write_str("Differential GNSS (DGNSS)"),
FixMode::FloatRtk => f.write_str("Float RTK"),
FixMode::FixedRtk => f.write_str("Fixed RTK"),
}
}
}
impl TryFrom<u8> for FixMode {
type Error = u8;
fn try_from(i: u8) -> Result<Self, u8> {
match i {
0 => Ok(FixMode::Invalid),
2 => Ok(FixMode::DifferentialGnss),
3 => Ok(FixMode::FloatRtk),
4 => Ok(FixMode::FixedRtk),
i => Err(i),
}
}
}
}
pub mod msg_orient_euler {
#![allow(unused_imports)]
use super::*;
use crate::messages::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Debug, PartialEq, Clone)]
pub struct MsgOrientEuler {
#[cfg_attr(feature = "serde", serde(skip_serializing, alias = "sender"))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename = "tow"))]
pub tow: u32,
#[cfg_attr(feature = "serde", serde(rename = "roll"))]
pub roll: i32,
#[cfg_attr(feature = "serde", serde(rename = "pitch"))]
pub pitch: i32,
#[cfg_attr(feature = "serde", serde(rename = "yaw"))]
pub yaw: i32,
#[cfg_attr(feature = "serde", serde(rename = "roll_accuracy"))]
pub roll_accuracy: f32,
#[cfg_attr(feature = "serde", serde(rename = "pitch_accuracy"))]
pub pitch_accuracy: f32,
#[cfg_attr(feature = "serde", serde(rename = "yaw_accuracy"))]
pub yaw_accuracy: f32,
#[cfg_attr(feature = "serde", serde(rename = "flags"))]
pub flags: u8,
}
impl MsgOrientEuler {
pub fn ins_navigation_mode(&self) -> Result<InsNavigationMode, u8> {
get_bit_range!(self.flags, u8, u8, 2, 0).try_into()
}
pub fn set_ins_navigation_mode(&mut self, ins_navigation_mode: InsNavigationMode) {
set_bit_range!(&mut self.flags, ins_navigation_mode, u8, u8, 2, 0);
}
}
impl ConcreteMessage for MsgOrientEuler {
const MESSAGE_TYPE: u16 = 545;
const MESSAGE_NAME: &'static str = "MSG_ORIENT_EULER";
}
impl SbpMessage for MsgOrientEuler {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> Option<u16> {
Some(<Self as ConcreteMessage>::MESSAGE_TYPE)
}
fn sender_id(&self) -> Option<u16> {
self.sender_id
}
fn set_sender_id(&mut self, new_id: u16) {
self.sender_id = Some(new_id);
}
fn encoded_len(&self) -> usize {
WireFormat::len(self) + crate::HEADER_LEN + crate::CRC_LEN
}
fn is_valid(&self) -> bool {
true
}
fn into_valid_msg(self) -> Result<Self, crate::messages::invalid::Invalid> {
Ok(self)
}
#[cfg(feature = "swiftnav")]
fn gps_time(&self) -> Option<std::result::Result<time::MessageTime, time::GpsTimeError>> {
let tow_s = (self.tow as f64) / 1000.0;
let gps_time = match time::GpsTime::new(0, tow_s) {
Ok(gps_time) => gps_time.tow(),
Err(e) => return Some(Err(e.into())),
};
Some(Ok(time::MessageTime::Rover(gps_time.into())))
}
}
impl FriendlyName for MsgOrientEuler {
fn friendly_name() -> &'static str {
"ORIENT EULER"
}
}
impl TryFrom<Sbp> for MsgOrientEuler {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgOrientEuler(m) => Ok(m),
_ => Err(TryFromSbpError(msg)),
}
}
}
impl WireFormat for MsgOrientEuler {
const MIN_LEN: usize = <u32 as WireFormat>::MIN_LEN
+ <i32 as WireFormat>::MIN_LEN
+ <i32 as WireFormat>::MIN_LEN
+ <i32 as WireFormat>::MIN_LEN
+ <f32 as WireFormat>::MIN_LEN
+ <f32 as WireFormat>::MIN_LEN
+ <f32 as WireFormat>::MIN_LEN
+ <u8 as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.tow)
+ WireFormat::len(&self.roll)
+ WireFormat::len(&self.pitch)
+ WireFormat::len(&self.yaw)
+ WireFormat::len(&self.roll_accuracy)
+ WireFormat::len(&self.pitch_accuracy)
+ WireFormat::len(&self.yaw_accuracy)
+ WireFormat::len(&self.flags)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.tow, buf);
WireFormat::write(&self.roll, buf);
WireFormat::write(&self.pitch, buf);
WireFormat::write(&self.yaw, buf);
WireFormat::write(&self.roll_accuracy, buf);
WireFormat::write(&self.pitch_accuracy, buf);
WireFormat::write(&self.yaw_accuracy, buf);
WireFormat::write(&self.flags, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgOrientEuler {
sender_id: None,
tow: WireFormat::parse_unchecked(buf),
roll: WireFormat::parse_unchecked(buf),
pitch: WireFormat::parse_unchecked(buf),
yaw: WireFormat::parse_unchecked(buf),
roll_accuracy: WireFormat::parse_unchecked(buf),
pitch_accuracy: WireFormat::parse_unchecked(buf),
yaw_accuracy: WireFormat::parse_unchecked(buf),
flags: WireFormat::parse_unchecked(buf),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum InsNavigationMode {
Invalid = 0,
Valid = 1,
}
impl std::fmt::Display for InsNavigationMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
InsNavigationMode::Invalid => f.write_str("Invalid"),
InsNavigationMode::Valid => f.write_str("Valid"),
}
}
}
impl TryFrom<u8> for InsNavigationMode {
type Error = u8;
fn try_from(i: u8) -> Result<Self, u8> {
match i {
0 => Ok(InsNavigationMode::Invalid),
1 => Ok(InsNavigationMode::Valid),
i => Err(i),
}
}
}
}
pub mod msg_orient_quat {
#![allow(unused_imports)]
use super::*;
use crate::messages::lib::*;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Debug, PartialEq, Clone)]
pub struct MsgOrientQuat {
#[cfg_attr(feature = "serde", serde(skip_serializing, alias = "sender"))]
pub sender_id: Option<u16>,
#[cfg_attr(feature = "serde", serde(rename = "tow"))]
pub tow: u32,
#[cfg_attr(feature = "serde", serde(rename = "w"))]
pub w: i32,
#[cfg_attr(feature = "serde", serde(rename = "x"))]
pub x: i32,
#[cfg_attr(feature = "serde", serde(rename = "y"))]
pub y: i32,
#[cfg_attr(feature = "serde", serde(rename = "z"))]
pub z: i32,
#[cfg_attr(feature = "serde", serde(rename = "w_accuracy"))]
pub w_accuracy: f32,
#[cfg_attr(feature = "serde", serde(rename = "x_accuracy"))]
pub x_accuracy: f32,
#[cfg_attr(feature = "serde", serde(rename = "y_accuracy"))]
pub y_accuracy: f32,
#[cfg_attr(feature = "serde", serde(rename = "z_accuracy"))]
pub z_accuracy: f32,
#[cfg_attr(feature = "serde", serde(rename = "flags"))]
pub flags: u8,
}
impl MsgOrientQuat {
pub fn ins_navigation_mode(&self) -> Result<InsNavigationMode, u8> {
get_bit_range!(self.flags, u8, u8, 2, 0).try_into()
}
pub fn set_ins_navigation_mode(&mut self, ins_navigation_mode: InsNavigationMode) {
set_bit_range!(&mut self.flags, ins_navigation_mode, u8, u8, 2, 0);
}
}
impl ConcreteMessage for MsgOrientQuat {
const MESSAGE_TYPE: u16 = 544;
const MESSAGE_NAME: &'static str = "MSG_ORIENT_QUAT";
}
impl SbpMessage for MsgOrientQuat {
fn message_name(&self) -> &'static str {
<Self as ConcreteMessage>::MESSAGE_NAME
}
fn message_type(&self) -> Option<u16> {
Some(<Self as ConcreteMessage>::MESSAGE_TYPE)
}
fn sender_id(&self) -> Option<u16> {
self.sender_id
}
fn set_sender_id(&mut self, new_id: u16) {
self.sender_id = Some(new_id);
}
fn encoded_len(&self) -> usize {
WireFormat::len(self) + crate::HEADER_LEN + crate::CRC_LEN
}
fn is_valid(&self) -> bool {
true
}
fn into_valid_msg(self) -> Result<Self, crate::messages::invalid::Invalid> {
Ok(self)
}
#[cfg(feature = "swiftnav")]
fn gps_time(&self) -> Option<std::result::Result<time::MessageTime, time::GpsTimeError>> {
let tow_s = (self.tow as f64) / 1000.0;
let gps_time = match time::GpsTime::new(0, tow_s) {
Ok(gps_time) => gps_time.tow(),
Err(e) => return Some(Err(e.into())),
};
Some(Ok(time::MessageTime::Rover(gps_time.into())))
}
}
impl FriendlyName for MsgOrientQuat {
fn friendly_name() -> &'static str {
"ORIENT QUAT"
}
}
impl TryFrom<Sbp> for MsgOrientQuat {
type Error = TryFromSbpError;
fn try_from(msg: Sbp) -> Result<Self, Self::Error> {
match msg {
Sbp::MsgOrientQuat(m) => Ok(m),
_ => Err(TryFromSbpError(msg)),
}
}
}
impl WireFormat for MsgOrientQuat {
const MIN_LEN: usize = <u32 as WireFormat>::MIN_LEN
+ <i32 as WireFormat>::MIN_LEN
+ <i32 as WireFormat>::MIN_LEN
+ <i32 as WireFormat>::MIN_LEN
+ <i32 as WireFormat>::MIN_LEN
+ <f32 as WireFormat>::MIN_LEN
+ <f32 as WireFormat>::MIN_LEN
+ <f32 as WireFormat>::MIN_LEN
+ <f32 as WireFormat>::MIN_LEN
+ <u8 as WireFormat>::MIN_LEN;
fn len(&self) -> usize {
WireFormat::len(&self.tow)
+ WireFormat::len(&self.w)
+ WireFormat::len(&self.x)
+ WireFormat::len(&self.y)
+ WireFormat::len(&self.z)
+ WireFormat::len(&self.w_accuracy)
+ WireFormat::len(&self.x_accuracy)
+ WireFormat::len(&self.y_accuracy)
+ WireFormat::len(&self.z_accuracy)
+ WireFormat::len(&self.flags)
}
fn write<B: BufMut>(&self, buf: &mut B) {
WireFormat::write(&self.tow, buf);
WireFormat::write(&self.w, buf);
WireFormat::write(&self.x, buf);
WireFormat::write(&self.y, buf);
WireFormat::write(&self.z, buf);
WireFormat::write(&self.w_accuracy, buf);
WireFormat::write(&self.x_accuracy, buf);
WireFormat::write(&self.y_accuracy, buf);
WireFormat::write(&self.z_accuracy, buf);
WireFormat::write(&self.flags, buf);
}
fn parse_unchecked<B: Buf>(buf: &mut B) -> Self {
MsgOrientQuat {
sender_id: None,
tow: WireFormat::parse_unchecked(buf),
w: WireFormat::parse_unchecked(buf),
x: WireFormat::parse_unchecked(buf),
y: WireFormat::parse_unchecked(buf),
z: WireFormat::parse_unchecked(buf),
w_accuracy: WireFormat::parse_unchecked(buf),
x_accuracy: WireFormat::parse_unchecked(buf),
y_accuracy: WireFormat::parse_unchecked(buf),
z_accuracy: WireFormat::parse_unchecked(buf),
flags: WireFormat::parse_unchecked(buf),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum InsNavigationMode {
Invalid = 0,
Valid = 1,
}
impl std::fmt::Display for InsNavigationMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
InsNavigationMode::Invalid => f.write_str("Invalid"),
InsNavigationMode::Valid => f.write_str("Valid"),
}
}
}
impl TryFrom<u8> for InsNavigationMode {
type Error = u8;
fn try_from(i: u8) -> Result<Self, u8> {
match i {
0 => Ok(InsNavigationMode::Invalid),
1 => Ok(InsNavigationMode::Valid),
i => Err(i),
}
}
}
}