Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SSR-225] Add Satellite APC message #902

Merged
merged 2 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions c/include/libsbp/cpp/message_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,12 @@ struct MessageTraits<msg_ssr_gridded_correction_t> {
};


template<>
struct MessageTraits<msg_ssr_satellite_apc_t> {
static constexpr u16 id = 1540;
};


template<>
struct MessageTraits<msg_osr_t> {
static constexpr u16 id = 1600;
Expand Down
6 changes: 3 additions & 3 deletions c/include/libsbp/linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ of the list being 2 NULL terminators in a row.
typedef struct SBP_ATTR_PACKED {
u8 index; /**< sequence of this status message, values from 0-9 */
u16 pid; /**< the PID of the process */
u8 pcpu; /**< percent of cpu used, expressed as a fraction of 256 */
u8 pcpu; /**< percent of CPU used, expressed as a fraction of 256 */
u32 time; /**< timestamp of message, refer to flags field for how to interpret */
u8 flags; /**< flags */
char tname[15]; /**< fixed length string representing the thread name */
Expand Down Expand Up @@ -260,8 +260,8 @@ typedef struct SBP_ATTR_PACKED {

typedef struct SBP_ATTR_PACKED {
u16 mem_total; /**< total system memory, in MiB */
u8 pcpu; /**< percent of total cpu currently utilized */
u8 pmem; /**< percent of total memory currently utilized */
u8 pcpu; /**< percent of CPU used, expressed as a fraction of 256 */
u8 pmem; /**< percent of memory used, expressed as a fraction of 256 */
u16 procs_starting; /**< number of processes that started during collection phase */
u16 procs_stopping; /**< number of processes that stopped during collection phase */
u16 pid_count; /**< the count of processes on the system */
Expand Down
2 changes: 1 addition & 1 deletion c/include/libsbp/observation.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/** \defgroup observation Observation
*
* * Satellite observation messages from the device.
* * Satellite observation messages from the device. The SBP sender ID of 0 indicates remote observations from a GNSS base station, correction network, or Skylark, Swift's cloud GNSS correction product.
* \{ */

#ifndef LIBSBP_OBSERVATION_MESSAGES_H
Expand Down
27 changes: 27 additions & 0 deletions c/include/libsbp/ssr.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,33 @@ note the definition of the bits is inverted.
} msg_ssr_tile_definition_t;


/** Antenna phase center correction.
*
* Contains phase center offset and elevation variation corrections for one
* signal on a satellite.
*/

typedef struct SBP_ATTR_PACKED {
sbp_gnss_signal_t sid; /**< GNSS signal identifier (16 bit) */
u8 sat_info; /**< Additional satellite information */
u16 svn; /**< Satellite Code, as defined by IGS. Typically the space vehicle number. */
s16 pco[3]; /**< Mean phase center offset, X Y and Z axises. See IGS ANTEX file
format description for coordinate system definition.
[1 mm] */
s8 pcv[21]; /**< Elevation dependent phase center variations. First element is 0
degrees separation from the Z axis, subsequent elements represent
elevation variations in 1 degree increments.
[1 mm] */
} satellite_apc_t;


#define SBP_MSG_SSR_SATELLITE_APC 0x0604

typedef struct SBP_ATTR_PACKED {
satellite_apc_t apc[0]; /**< Satellite antenna phase center corrections */
} msg_ssr_satellite_apc_t;


#define SBP_MSG_SSR_ORBIT_CLOCK_DEP_A 0x05DC

typedef struct SBP_ATTR_PACKED {
Expand Down
Binary file modified docs/sbp.pdf
Binary file not shown.
6 changes: 3 additions & 3 deletions haskell/src/SwiftNav/SBP/Linux.hs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ data MsgLinuxCpuState = MsgLinuxCpuState
, _msgLinuxCpuState_pid :: !Word16
-- ^ the PID of the process
, _msgLinuxCpuState_pcpu :: !Word8
-- ^ percent of cpu used, expressed as a fraction of 256
-- ^ percent of CPU used, expressed as a fraction of 256
, _msgLinuxCpuState_time :: !Word32
-- ^ timestamp of message, refer to flags field for how to interpret
, _msgLinuxCpuState_flags :: !Word8
Expand Down Expand Up @@ -473,9 +473,9 @@ data MsgLinuxSysState = MsgLinuxSysState
{ _msgLinuxSysState_mem_total :: !Word16
-- ^ total system memory, in MiB
, _msgLinuxSysState_pcpu :: !Word8
-- ^ percent of total cpu currently utilized
-- ^ percent of CPU used, expressed as a fraction of 256
, _msgLinuxSysState_pmem :: !Word8
-- ^ percent of total memory currently utilized
-- ^ percent of memory used, expressed as a fraction of 256
, _msgLinuxSysState_procs_starting :: !Word16
-- ^ number of processes that started during collection phase
, _msgLinuxSysState_procs_stopping :: !Word16
Expand Down
6 changes: 6 additions & 0 deletions haskell/src/SwiftNav/SBP/Msg.hs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ data SBPMsg =
| SBPMsgSsrOrbitClock MsgSsrOrbitClock Msg
| SBPMsgSsrOrbitClockDepA MsgSsrOrbitClockDepA Msg
| SBPMsgSsrPhaseBiases MsgSsrPhaseBiases Msg
| SBPMsgSsrSatelliteApc MsgSsrSatelliteApc Msg
| SBPMsgSsrStecCorrection MsgSsrStecCorrection Msg
| SBPMsgSsrStecCorrectionDepA MsgSsrStecCorrectionDepA Msg
| SBPMsgSsrTileDefinition MsgSsrTileDefinition Msg
Expand Down Expand Up @@ -427,6 +428,7 @@ instance Binary SBPMsg where
| _msgSBPType == msgSsrOrbitClock = SBPMsgSsrOrbitClock (decode (fromStrict (unBytes _msgSBPPayload))) m
| _msgSBPType == msgSsrOrbitClockDepA = SBPMsgSsrOrbitClockDepA (decode (fromStrict (unBytes _msgSBPPayload))) m
| _msgSBPType == msgSsrPhaseBiases = SBPMsgSsrPhaseBiases (decode (fromStrict (unBytes _msgSBPPayload))) m
| _msgSBPType == msgSsrSatelliteApc = SBPMsgSsrSatelliteApc (decode (fromStrict (unBytes _msgSBPPayload))) m
| _msgSBPType == msgSsrStecCorrection = SBPMsgSsrStecCorrection (decode (fromStrict (unBytes _msgSBPPayload))) m
| _msgSBPType == msgSsrStecCorrectionDepA = SBPMsgSsrStecCorrectionDepA (decode (fromStrict (unBytes _msgSBPPayload))) m
| _msgSBPType == msgSsrTileDefinition = SBPMsgSsrTileDefinition (decode (fromStrict (unBytes _msgSBPPayload))) m
Expand Down Expand Up @@ -630,6 +632,7 @@ instance Binary SBPMsg where
encoder (SBPMsgSsrOrbitClock _ m) = put m
encoder (SBPMsgSsrOrbitClockDepA _ m) = put m
encoder (SBPMsgSsrPhaseBiases _ m) = put m
encoder (SBPMsgSsrSatelliteApc _ m) = put m
encoder (SBPMsgSsrStecCorrection _ m) = put m
encoder (SBPMsgSsrStecCorrectionDepA _ m) = put m
encoder (SBPMsgSsrTileDefinition _ m) = put m
Expand Down Expand Up @@ -837,6 +840,7 @@ instance FromJSON SBPMsg where
| msgType == msgSsrOrbitClock = SBPMsgSsrOrbitClock <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
| msgType == msgSsrOrbitClockDepA = SBPMsgSsrOrbitClockDepA <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
| msgType == msgSsrPhaseBiases = SBPMsgSsrPhaseBiases <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
| msgType == msgSsrSatelliteApc = SBPMsgSsrSatelliteApc <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
| msgType == msgSsrStecCorrection = SBPMsgSsrStecCorrection <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
| msgType == msgSsrStecCorrectionDepA = SBPMsgSsrStecCorrectionDepA <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
| msgType == msgSsrTileDefinition = SBPMsgSsrTileDefinition <$> pure (decode (fromStrict (unBytes payload))) <*> parseJSON obj
Expand Down Expand Up @@ -1045,6 +1049,7 @@ instance ToJSON SBPMsg where
toJSON (SBPMsgSsrOrbitClock n m) = toJSON n <<>> toJSON m
toJSON (SBPMsgSsrOrbitClockDepA n m) = toJSON n <<>> toJSON m
toJSON (SBPMsgSsrPhaseBiases n m) = toJSON n <<>> toJSON m
toJSON (SBPMsgSsrSatelliteApc n m) = toJSON n <<>> toJSON m
toJSON (SBPMsgSsrStecCorrection n m) = toJSON n <<>> toJSON m
toJSON (SBPMsgSsrStecCorrectionDepA n m) = toJSON n <<>> toJSON m
toJSON (SBPMsgSsrTileDefinition n m) = toJSON n <<>> toJSON m
Expand Down Expand Up @@ -1247,6 +1252,7 @@ instance HasMsg SBPMsg where
msg f (SBPMsgSsrOrbitClock n m) = SBPMsgSsrOrbitClock n <$> f m
msg f (SBPMsgSsrOrbitClockDepA n m) = SBPMsgSsrOrbitClockDepA n <$> f m
msg f (SBPMsgSsrPhaseBiases n m) = SBPMsgSsrPhaseBiases n <$> f m
msg f (SBPMsgSsrSatelliteApc n m) = SBPMsgSsrSatelliteApc n <$> f m
msg f (SBPMsgSsrStecCorrection n m) = SBPMsgSsrStecCorrection n <$> f m
msg f (SBPMsgSsrStecCorrectionDepA n m) = SBPMsgSsrStecCorrectionDepA n <$> f m
msg f (SBPMsgSsrTileDefinition n m) = SBPMsgSsrTileDefinition n <$> f m
Expand Down
4 changes: 3 additions & 1 deletion haskell/src/SwiftNav/SBP/Observation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
-- Stability: experimental
-- Portability: portable
--
-- \<Satellite observation messages from the device.\>
-- \<Satellite observation messages from the device. The SBP sender ID of 0
-- indicates remote observations from a GNSS base station, correction network,
-- or Skylark, Swift's cloud GNSS correction product.\>

module SwiftNav.SBP.Observation
( module SwiftNav.SBP.Observation
Expand Down
59 changes: 59 additions & 0 deletions haskell/src/SwiftNav/SBP/Ssr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,65 @@ $(makeSBP 'msgSsrTileDefinition ''MsgSsrTileDefinition)
$(makeJSON "_msgSsrTileDefinition_" ''MsgSsrTileDefinition)
$(makeLenses ''MsgSsrTileDefinition)

-- | SatelliteAPC.
--
-- Contains phase center offset and elevation variation corrections for one
-- signal on a satellite.
data SatelliteAPC = SatelliteAPC
{ _satelliteAPC_sid :: !GnssSignal
-- ^ GNSS signal identifier (16 bit)
, _satelliteAPC_sat_info :: !Word8
-- ^ Additional satellite information
, _satelliteAPC_svn :: !Word16
-- ^ Satellite Code, as defined by IGS. Typically the space vehicle number.
, _satelliteAPC_pco :: ![Int16]
-- ^ Mean phase center offset, X Y and Z axises. See IGS ANTEX file format
-- description for coordinate system definition.
, _satelliteAPC_pcv :: ![Int8]
-- ^ Elevation dependent phase center variations. First element is 0 degrees
-- separation from the Z axis, subsequent elements represent elevation
-- variations in 1 degree increments.
} deriving ( Show, Read, Eq )

instance Binary SatelliteAPC where
get = do
_satelliteAPC_sid <- get
_satelliteAPC_sat_info <- getWord8
_satelliteAPC_svn <- getWord16le
_satelliteAPC_pco <- replicateM 3 (fromIntegral <$> getWord16le)
_satelliteAPC_pcv <- replicateM 21 (fromIntegral <$> getWord8)
pure SatelliteAPC {..}

put SatelliteAPC {..} = do
put _satelliteAPC_sid
putWord8 _satelliteAPC_sat_info
putWord16le _satelliteAPC_svn
mapM_ (putWord16le . fromIntegral) _satelliteAPC_pco
mapM_ (putWord8 . fromIntegral) _satelliteAPC_pcv

$(makeJSON "_satelliteAPC_" ''SatelliteAPC)
$(makeLenses ''SatelliteAPC)

msgSsrSatelliteApc :: Word16
msgSsrSatelliteApc = 0x0604

data MsgSsrSatelliteApc = MsgSsrSatelliteApc
{ _msgSsrSatelliteApc_apc :: ![SatelliteAPC]
-- ^ Satellite antenna phase center corrections
} deriving ( Show, Read, Eq )

instance Binary MsgSsrSatelliteApc where
get = do
_msgSsrSatelliteApc_apc <- whileM (not <$> isEmpty) get
pure MsgSsrSatelliteApc {..}

put MsgSsrSatelliteApc {..} = do
mapM_ put _msgSsrSatelliteApc_apc

$(makeSBP 'msgSsrSatelliteApc ''MsgSsrSatelliteApc)
$(makeJSON "_msgSsrSatelliteApc_" ''MsgSsrSatelliteApc)
$(makeLenses ''MsgSsrSatelliteApc)

msgSsrOrbitClockDepA :: Word16
msgSsrOrbitClockDepA = 0x05DC

Expand Down
3 changes: 3 additions & 0 deletions java/src/com/swiftnav/sbp/client/MessageTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
import com.swiftnav.sbp.ssr.MsgSsrStecCorrection;
import com.swiftnav.sbp.ssr.MsgSsrGriddedCorrection;
import com.swiftnav.sbp.ssr.MsgSsrTileDefinition;
import com.swiftnav.sbp.ssr.MsgSsrSatelliteApc;
import com.swiftnav.sbp.ssr.MsgSsrOrbitClockDepA;
import com.swiftnav.sbp.ssr.MsgSsrStecCorrectionDepA;
import com.swiftnav.sbp.ssr.MsgSsrGriddedCorrectionNoStdDepA;
Expand Down Expand Up @@ -559,6 +560,8 @@ static SBPMessage dispatch(SBPMessage msg) throws SBPBinaryException {
return new MsgSsrGriddedCorrection(msg);
case MsgSsrTileDefinition.TYPE:
return new MsgSsrTileDefinition(msg);
case MsgSsrSatelliteApc.TYPE:
return new MsgSsrSatelliteApc(msg);
case MsgSsrOrbitClockDepA.TYPE:
return new MsgSsrOrbitClockDepA(msg);
case MsgSsrStecCorrectionDepA.TYPE:
Expand Down
2 changes: 1 addition & 1 deletion java/src/com/swiftnav/sbp/linux/MsgLinuxCpuState.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class MsgLinuxCpuState extends SBPMessage {
/** the PID of the process */
public int pid;

/** percent of cpu used, expressed as a fraction of 256 */
/** percent of CPU used, expressed as a fraction of 256 */
public int pcpu;

/** timestamp of message, refer to flags field for how to interpret */
Expand Down
4 changes: 2 additions & 2 deletions java/src/com/swiftnav/sbp/linux/MsgLinuxSysState.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public class MsgLinuxSysState extends SBPMessage {
/** total system memory, in MiB */
public int mem_total;

/** percent of total cpu currently utilized */
/** percent of CPU used, expressed as a fraction of 256 */
public int pcpu;

/** percent of total memory currently utilized */
/** percent of memory used, expressed as a fraction of 256 */
public int pmem;

/** number of processes that started during collection phase */
Expand Down
59 changes: 59 additions & 0 deletions java/src/com/swiftnav/sbp/ssr/MsgSsrSatelliteApc.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright (C) 2015-2018 Swift Navigation Inc.
* Contact: https://support.swiftnav.com
*
* This source is subject to the license found in the file 'LICENSE' which must
* be be distributed together with this source. All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
*/

package com.swiftnav.sbp.ssr;

import java.math.BigInteger;

import com.swiftnav.sbp.SBPMessage;
import com.swiftnav.sbp.SBPBinaryException;
import com.swiftnav.sbp.SBPStruct;
import com.swiftnav.sbp.gnss.*;

import org.json.JSONObject;
import org.json.JSONArray;



public class MsgSsrSatelliteApc extends SBPMessage {
public static final int TYPE = 0x0604;


/** Satellite antenna phase center corrections */
public SatelliteAPC[] apc;


public MsgSsrSatelliteApc (int sender) { super(sender, TYPE); }
public MsgSsrSatelliteApc () { super(TYPE); }
public MsgSsrSatelliteApc (SBPMessage msg) throws SBPBinaryException {
super(msg);
assert msg.type != TYPE;
}

@Override
protected void parse(Parser parser) throws SBPBinaryException {
/* Parse fields from binary */
apc = parser.getArray(SatelliteAPC.class);
}

@Override
protected void build(Builder builder) {
builder.putArray(apc);
}

@Override
public JSONObject toJSON() {
JSONObject obj = super.toJSON();
obj.put("apc", SBPStruct.toJSONArray(apc));
return obj;
}
}
Loading