{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE RecordWildCards #-}
module SwiftNav.SBP.Orientation
( module SwiftNav.SBP.Orientation
) where
import BasicPrelude
import Control.Lens
import Control.Monad.Loops
import Data.Binary
import Data.Binary.Get
import Data.Binary.IEEE754
import Data.Binary.Put
import Data.ByteString.Lazy hiding (ByteString)
import Data.Int
import Data.Word
import SwiftNav.SBP.TH
{-# ANN module ("HLint: ignore Use camelCase"::String) #-}
{-# ANN module ("HLint: ignore Redundant do"::String) #-}
{-# ANN module ("HLint: ignore Use newtype instead of data"::String) #-}
msgBaselineHeading :: Word16
msgBaselineHeading = 0x020F
data MsgBaselineHeading = MsgBaselineHeading
{ _msgBaselineHeading_tow :: !Word32
, _msgBaselineHeading_heading :: !Word32
, _msgBaselineHeading_n_sats :: !Word8
, _msgBaselineHeading_flags :: !Word8
} deriving ( Show, Read, Eq )
instance Binary MsgBaselineHeading where
get = do
_msgBaselineHeading_tow <- getWord32le
_msgBaselineHeading_heading <- getWord32le
_msgBaselineHeading_n_sats <- getWord8
_msgBaselineHeading_flags <- getWord8
pure MsgBaselineHeading {..}
put MsgBaselineHeading {..} = do
putWord32le _msgBaselineHeading_tow
putWord32le _msgBaselineHeading_heading
putWord8 _msgBaselineHeading_n_sats
putWord8 _msgBaselineHeading_flags
$(makeSBP 'msgBaselineHeading ''MsgBaselineHeading)
$(makeJSON "_msgBaselineHeading_" ''MsgBaselineHeading)
$(makeLenses ''MsgBaselineHeading)
msgOrientQuat :: Word16
msgOrientQuat = 0x0220
data MsgOrientQuat = MsgOrientQuat
{ _msgOrientQuat_tow :: !Word32
, _msgOrientQuat_w :: !Int32
, _msgOrientQuat_x :: !Int32
, _msgOrientQuat_y :: !Int32
, _msgOrientQuat_z :: !Int32
, _msgOrientQuat_w_accuracy :: !Float
, _msgOrientQuat_x_accuracy :: !Float
, _msgOrientQuat_y_accuracy :: !Float
, _msgOrientQuat_z_accuracy :: !Float
, _msgOrientQuat_flags :: !Word8
} deriving ( Show, Read, Eq )
instance Binary MsgOrientQuat where
get = do
_msgOrientQuat_tow <- getWord32le
_msgOrientQuat_w <- fromIntegral <$> getWord32le
_msgOrientQuat_x <- fromIntegral <$> getWord32le
_msgOrientQuat_y <- fromIntegral <$> getWord32le
_msgOrientQuat_z <- fromIntegral <$> getWord32le
_msgOrientQuat_w_accuracy <- getFloat32le
_msgOrientQuat_x_accuracy <- getFloat32le
_msgOrientQuat_y_accuracy <- getFloat32le
_msgOrientQuat_z_accuracy <- getFloat32le
_msgOrientQuat_flags <- getWord8
pure MsgOrientQuat {..}
put MsgOrientQuat {..} = do
putWord32le _msgOrientQuat_tow
putWord32le $ fromIntegral _msgOrientQuat_w
putWord32le $ fromIntegral _msgOrientQuat_x
putWord32le $ fromIntegral _msgOrientQuat_y
putWord32le $ fromIntegral _msgOrientQuat_z
putFloat32le _msgOrientQuat_w_accuracy
putFloat32le _msgOrientQuat_x_accuracy
putFloat32le _msgOrientQuat_y_accuracy
putFloat32le _msgOrientQuat_z_accuracy
putWord8 _msgOrientQuat_flags
$(makeSBP 'msgOrientQuat ''MsgOrientQuat)
$(makeJSON "_msgOrientQuat_" ''MsgOrientQuat)
$(makeLenses ''MsgOrientQuat)
msgOrientEuler :: Word16
msgOrientEuler = 0x0221
data MsgOrientEuler = MsgOrientEuler
{ _msgOrientEuler_tow :: !Word32
, _msgOrientEuler_roll :: !Int32
, _msgOrientEuler_pitch :: !Int32
, _msgOrientEuler_yaw :: !Int32
, _msgOrientEuler_roll_accuracy :: !Float
, _msgOrientEuler_pitch_accuracy :: !Float
, _msgOrientEuler_yaw_accuracy :: !Float
, _msgOrientEuler_flags :: !Word8
} deriving ( Show, Read, Eq )
instance Binary MsgOrientEuler where
get = do
_msgOrientEuler_tow <- getWord32le
_msgOrientEuler_roll <- fromIntegral <$> getWord32le
_msgOrientEuler_pitch <- fromIntegral <$> getWord32le
_msgOrientEuler_yaw <- fromIntegral <$> getWord32le
_msgOrientEuler_roll_accuracy <- getFloat32le
_msgOrientEuler_pitch_accuracy <- getFloat32le
_msgOrientEuler_yaw_accuracy <- getFloat32le
_msgOrientEuler_flags <- getWord8
pure MsgOrientEuler {..}
put MsgOrientEuler {..} = do
putWord32le _msgOrientEuler_tow
putWord32le $ fromIntegral _msgOrientEuler_roll
putWord32le $ fromIntegral _msgOrientEuler_pitch
putWord32le $ fromIntegral _msgOrientEuler_yaw
putFloat32le _msgOrientEuler_roll_accuracy
putFloat32le _msgOrientEuler_pitch_accuracy
putFloat32le _msgOrientEuler_yaw_accuracy
putWord8 _msgOrientEuler_flags
$(makeSBP 'msgOrientEuler ''MsgOrientEuler)
$(makeJSON "_msgOrientEuler_" ''MsgOrientEuler)
$(makeLenses ''MsgOrientEuler)
msgAngularRate :: Word16
msgAngularRate = 0x0222
data MsgAngularRate = MsgAngularRate
{ _msgAngularRate_tow :: !Word32
, _msgAngularRate_x :: !Int32
, _msgAngularRate_y :: !Int32
, _msgAngularRate_z :: !Int32
, _msgAngularRate_flags :: !Word8
} deriving ( Show, Read, Eq )
instance Binary MsgAngularRate where
get = do
_msgAngularRate_tow <- getWord32le
_msgAngularRate_x <- fromIntegral <$> getWord32le
_msgAngularRate_y <- fromIntegral <$> getWord32le
_msgAngularRate_z <- fromIntegral <$> getWord32le
_msgAngularRate_flags <- getWord8
pure MsgAngularRate {..}
put MsgAngularRate {..} = do
putWord32le _msgAngularRate_tow
putWord32le $ fromIntegral _msgAngularRate_x
putWord32le $ fromIntegral _msgAngularRate_y
putWord32le $ fromIntegral _msgAngularRate_z
putWord8 _msgAngularRate_flags
$(makeSBP 'msgAngularRate ''MsgAngularRate)
$(makeJSON "_msgAngularRate_" ''MsgAngularRate)
$(makeLenses ''MsgAngularRate)