Skip to content

Commit d775acc

Browse files
author
Dmitry Tatarinov
authored
Merge pull request #474 from dt-exafore/i750-add-FCN-and-d_tau
Add FCN and d_tau to MSG_EPHEMERIS_GLO
2 parents 0c1cfc1 + 7536c9d commit d775acc

File tree

7 files changed

+321
-13
lines changed

7 files changed

+321
-13
lines changed

c/include/libsbp/observation.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,35 @@ typedef struct __attribute__((packed)) {
280280
* Characteristics of words of immediate information (ephemeris parameters)"
281281
* for more details.
282282
*/
283-
#define SBP_MSG_EPHEMERIS_GLO 0x0085
283+
#define SBP_MSG_EPHEMERIS_GLO_DEP_B 0x0085
284284
typedef struct __attribute__((packed)) {
285285
ephemeris_common_content_t common; /**< Values common for all ephemeris types */
286286
double gamma; /**< Relative deviation of predicted carrier frequency from nominal */
287287
double tau; /**< Correction to the SV time [s] */
288288
double pos[3]; /**< Position of the SV at tb in PZ-90.02 coordinates system [m] */
289289
double vel[3]; /**< Velocity vector of the SV at tb in PZ-90.02 coordinates system [m/s] */
290290
double acc[3]; /**< Acceleration vector of the SV at tb in PZ-90.02 coordinates sys [m/s^2] */
291+
} msg_ephemeris_glo_dep_b_t;
292+
293+
294+
/** Satellite broadcast ephemeris for GLO
295+
*
296+
* The ephemeris message returns a set of satellite orbit
297+
* parameters that is used to calculate GLO satellite position,
298+
* velocity, and clock offset. Please see the GLO ICD 5.1 "Table 4.5
299+
* Characteristics of words of immediate information (ephemeris parameters)"
300+
* for more details.
301+
*/
302+
#define SBP_MSG_EPHEMERIS_GLO 0x0087
303+
typedef struct __attribute__((packed)) {
304+
ephemeris_common_content_t common; /**< Values common for all ephemeris types */
305+
double gamma; /**< Relative deviation of predicted carrier frequency from nominal */
306+
double tau; /**< Correction to the SV time [s] */
307+
double d_tau; /**< Equipment delay between L1 and L2 [s] */
308+
double pos[3]; /**< Position of the SV at tb in PZ-90.02 coordinates system [m] */
309+
double vel[3]; /**< Velocity vector of the SV at tb in PZ-90.02 coordinates system [m/s] */
310+
double acc[3]; /**< Acceleration vector of the SV at tb in PZ-90.02 coordinates sys [m/s^2] */
311+
u8 fcn; /**< Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid */
291312
} msg_ephemeris_glo_t;
292313

293314

haskell/src/SwiftNav/SBP/Msg.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ data SBPMsg =
7373
| SBPMsgEphemerisDepD MsgEphemerisDepD Msg
7474
| SBPMsgEphemerisGlo MsgEphemerisGlo Msg
7575
| SBPMsgEphemerisGloDepA MsgEphemerisGloDepA Msg
76+
| SBPMsgEphemerisGloDepB MsgEphemerisGloDepB Msg
7677
| SBPMsgEphemerisGps MsgEphemerisGps Msg
7778
| SBPMsgEphemerisGpsDepE MsgEphemerisGpsDepE Msg
7879
| SBPMsgEphemerisSbas MsgEphemerisSbas Msg
@@ -200,6 +201,7 @@ instance Binary SBPMsg where
200201
| _msgSBPType == msgEphemerisDepD = SBPMsgEphemerisDepD (decode (fromStrict _msgSBPPayload)) m
201202
| _msgSBPType == msgEphemerisGlo = SBPMsgEphemerisGlo (decode (fromStrict _msgSBPPayload)) m
202203
| _msgSBPType == msgEphemerisGloDepA = SBPMsgEphemerisGloDepA (decode (fromStrict _msgSBPPayload)) m
204+
| _msgSBPType == msgEphemerisGloDepB = SBPMsgEphemerisGloDepB (decode (fromStrict _msgSBPPayload)) m
203205
| _msgSBPType == msgEphemerisGps = SBPMsgEphemerisGps (decode (fromStrict _msgSBPPayload)) m
204206
| _msgSBPType == msgEphemerisGpsDepE = SBPMsgEphemerisGpsDepE (decode (fromStrict _msgSBPPayload)) m
205207
| _msgSBPType == msgEphemerisSbas = SBPMsgEphemerisSbas (decode (fromStrict _msgSBPPayload)) m
@@ -319,6 +321,7 @@ instance Binary SBPMsg where
319321
encode' (SBPMsgEphemerisDepD _ m) = put m
320322
encode' (SBPMsgEphemerisGlo _ m) = put m
321323
encode' (SBPMsgEphemerisGloDepA _ m) = put m
324+
encode' (SBPMsgEphemerisGloDepB _ m) = put m
322325
encode' (SBPMsgEphemerisGps _ m) = put m
323326
encode' (SBPMsgEphemerisGpsDepE _ m) = put m
324327
encode' (SBPMsgEphemerisSbas _ m) = put m
@@ -441,6 +444,7 @@ instance FromJSON SBPMsg where
441444
| msgType == msgEphemerisDepD = SBPMsgEphemerisDepD <$> parseJSON obj <*> parseJSON obj
442445
| msgType == msgEphemerisGlo = SBPMsgEphemerisGlo <$> parseJSON obj <*> parseJSON obj
443446
| msgType == msgEphemerisGloDepA = SBPMsgEphemerisGloDepA <$> parseJSON obj <*> parseJSON obj
447+
| msgType == msgEphemerisGloDepB = SBPMsgEphemerisGloDepB <$> parseJSON obj <*> parseJSON obj
444448
| msgType == msgEphemerisGps = SBPMsgEphemerisGps <$> parseJSON obj <*> parseJSON obj
445449
| msgType == msgEphemerisGpsDepE = SBPMsgEphemerisGpsDepE <$> parseJSON obj <*> parseJSON obj
446450
| msgType == msgEphemerisSbas = SBPMsgEphemerisSbas <$> parseJSON obj <*> parseJSON obj
@@ -565,6 +569,7 @@ instance ToJSON SBPMsg where
565569
toJSON (SBPMsgEphemerisDepD n m) = toJSON n `mergeValues` toJSON m
566570
toJSON (SBPMsgEphemerisGlo n m) = toJSON n `mergeValues` toJSON m
567571
toJSON (SBPMsgEphemerisGloDepA n m) = toJSON n `mergeValues` toJSON m
572+
toJSON (SBPMsgEphemerisGloDepB n m) = toJSON n `mergeValues` toJSON m
568573
toJSON (SBPMsgEphemerisGps n m) = toJSON n `mergeValues` toJSON m
569574
toJSON (SBPMsgEphemerisGpsDepE n m) = toJSON n `mergeValues` toJSON m
570575
toJSON (SBPMsgEphemerisSbas n m) = toJSON n `mergeValues` toJSON m
@@ -683,6 +688,7 @@ instance HasMsg SBPMsg where
683688
msg f (SBPMsgEphemerisDepD n m) = SBPMsgEphemerisDepD n <$> f m
684689
msg f (SBPMsgEphemerisGlo n m) = SBPMsgEphemerisGlo n <$> f m
685690
msg f (SBPMsgEphemerisGloDepA n m) = SBPMsgEphemerisGloDepA n <$> f m
691+
msg f (SBPMsgEphemerisGloDepB n m) = SBPMsgEphemerisGloDepB n <$> f m
686692
msg f (SBPMsgEphemerisGps n m) = SBPMsgEphemerisGps n <$> f m
687693
msg f (SBPMsgEphemerisGpsDepE n m) = SBPMsgEphemerisGpsDepE n <$> f m
688694
msg f (SBPMsgEphemerisSbas n m) = SBPMsgEphemerisSbas n <$> f m

haskell/src/SwiftNav/SBP/Observation.hs

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,58 @@ $(deriveJSON defaultOptions {fieldLabelModifier = fromMaybe "_msgEphemerisSbas_"
682682
''MsgEphemerisSbas)
683683
$(makeLenses ''MsgEphemerisSbas)
684684

685+
msgEphemerisGloDepB :: Word16
686+
msgEphemerisGloDepB = 0x0085
687+
688+
-- | SBP class for message MSG_EPHEMERIS_GLO_DEP_B (0x0085).
689+
--
690+
-- The ephemeris message returns a set of satellite orbit parameters that is
691+
-- used to calculate GLO satellite position, velocity, and clock offset. Please
692+
-- see the GLO ICD 5.1 "Table 4.5 Characteristics of words of immediate
693+
-- information (ephemeris parameters)" for more details.
694+
data MsgEphemerisGloDepB = MsgEphemerisGloDepB
695+
{ _msgEphemerisGloDepB_common :: EphemerisCommonContent
696+
-- ^ Values common for all ephemeris types
697+
, _msgEphemerisGloDepB_gamma :: Double
698+
-- ^ Relative deviation of predicted carrier frequency from nominal
699+
, _msgEphemerisGloDepB_tau :: Double
700+
-- ^ Correction to the SV time
701+
, _msgEphemerisGloDepB_pos :: [Double]
702+
-- ^ Position of the SV at tb in PZ-90.02 coordinates system
703+
, _msgEphemerisGloDepB_vel :: [Double]
704+
-- ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system
705+
, _msgEphemerisGloDepB_acc :: [Double]
706+
-- ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys
707+
} deriving ( Show, Read, Eq )
708+
709+
instance Binary MsgEphemerisGloDepB where
710+
get = do
711+
_msgEphemerisGloDepB_common <- get
712+
_msgEphemerisGloDepB_gamma <- getFloat64le
713+
_msgEphemerisGloDepB_tau <- getFloat64le
714+
_msgEphemerisGloDepB_pos <- replicateM 3 getFloat64le
715+
_msgEphemerisGloDepB_vel <- replicateM 3 getFloat64le
716+
_msgEphemerisGloDepB_acc <- replicateM 3 getFloat64le
717+
return MsgEphemerisGloDepB {..}
718+
719+
put MsgEphemerisGloDepB {..} = do
720+
put _msgEphemerisGloDepB_common
721+
putFloat64le _msgEphemerisGloDepB_gamma
722+
putFloat64le _msgEphemerisGloDepB_tau
723+
mapM_ putFloat64le _msgEphemerisGloDepB_pos
724+
mapM_ putFloat64le _msgEphemerisGloDepB_vel
725+
mapM_ putFloat64le _msgEphemerisGloDepB_acc
726+
727+
$(deriveSBP 'msgEphemerisGloDepB ''MsgEphemerisGloDepB)
728+
729+
$(deriveJSON defaultOptions {fieldLabelModifier = fromMaybe "_msgEphemerisGloDepB_" . P.stripPrefix "_msgEphemerisGloDepB_"}
730+
''MsgEphemerisGloDepB)
731+
$(makeLenses ''MsgEphemerisGloDepB)
732+
685733
msgEphemerisGlo :: Word16
686-
msgEphemerisGlo = 0x0085
734+
msgEphemerisGlo = 0x0087
687735

688-
-- | SBP class for message MSG_EPHEMERIS_GLO (0x0085).
736+
-- | SBP class for message MSG_EPHEMERIS_GLO (0x0087).
689737
--
690738
-- The ephemeris message returns a set of satellite orbit parameters that is
691739
-- used to calculate GLO satellite position, velocity, and clock offset. Please
@@ -698,31 +746,39 @@ data MsgEphemerisGlo = MsgEphemerisGlo
698746
-- ^ Relative deviation of predicted carrier frequency from nominal
699747
, _msgEphemerisGlo_tau :: Double
700748
-- ^ Correction to the SV time
749+
, _msgEphemerisGlo_d_tau :: Double
750+
-- ^ Equipment delay between L1 and L2
701751
, _msgEphemerisGlo_pos :: [Double]
702752
-- ^ Position of the SV at tb in PZ-90.02 coordinates system
703753
, _msgEphemerisGlo_vel :: [Double]
704754
-- ^ Velocity vector of the SV at tb in PZ-90.02 coordinates system
705755
, _msgEphemerisGlo_acc :: [Double]
706756
-- ^ Acceleration vector of the SV at tb in PZ-90.02 coordinates sys
757+
, _msgEphemerisGlo_fcn :: Word8
758+
-- ^ Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid
707759
} deriving ( Show, Read, Eq )
708760

709761
instance Binary MsgEphemerisGlo where
710762
get = do
711763
_msgEphemerisGlo_common <- get
712764
_msgEphemerisGlo_gamma <- getFloat64le
713765
_msgEphemerisGlo_tau <- getFloat64le
766+
_msgEphemerisGlo_d_tau <- getFloat64le
714767
_msgEphemerisGlo_pos <- replicateM 3 getFloat64le
715768
_msgEphemerisGlo_vel <- replicateM 3 getFloat64le
716769
_msgEphemerisGlo_acc <- replicateM 3 getFloat64le
770+
_msgEphemerisGlo_fcn <- getWord8
717771
return MsgEphemerisGlo {..}
718772

719773
put MsgEphemerisGlo {..} = do
720774
put _msgEphemerisGlo_common
721775
putFloat64le _msgEphemerisGlo_gamma
722776
putFloat64le _msgEphemerisGlo_tau
777+
putFloat64le _msgEphemerisGlo_d_tau
723778
mapM_ putFloat64le _msgEphemerisGlo_pos
724779
mapM_ putFloat64le _msgEphemerisGlo_vel
725780
mapM_ putFloat64le _msgEphemerisGlo_acc
781+
putWord8 _msgEphemerisGlo_fcn
726782

727783
$(deriveSBP 'msgEphemerisGlo ''MsgEphemerisGlo)
728784

javascript/sbp/observation.js

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ MsgEphemerisSbas.prototype.fieldSpec.push(['a_gf0', 'writeDoubleLE', 8]);
652652
MsgEphemerisSbas.prototype.fieldSpec.push(['a_gf1', 'writeDoubleLE', 8]);
653653

654654
/**
655-
* SBP class for message MSG_EPHEMERIS_GLO (0x0085).
655+
* SBP class for message MSG_EPHEMERIS_GLO_DEP_B (0x0085).
656656
*
657657
* The ephemeris message returns a set of satellite orbit parameters that is used
658658
* to calculate GLO satellite position, velocity, and clock offset. Please see the
@@ -669,6 +669,53 @@ MsgEphemerisSbas.prototype.fieldSpec.push(['a_gf1', 'writeDoubleLE', 8]);
669669
*
670670
* @param sbp An SBP object with a payload to be decoded.
671671
*/
672+
var MsgEphemerisGloDepB = function (sbp, fields) {
673+
SBP.call(this, sbp);
674+
this.messageType = "MSG_EPHEMERIS_GLO_DEP_B";
675+
this.fields = (fields || this.parser.parse(sbp.payload));
676+
677+
return this;
678+
};
679+
MsgEphemerisGloDepB.prototype = Object.create(SBP.prototype);
680+
MsgEphemerisGloDepB.prototype.messageType = "MSG_EPHEMERIS_GLO_DEP_B";
681+
MsgEphemerisGloDepB.prototype.msg_type = 0x0085;
682+
MsgEphemerisGloDepB.prototype.constructor = MsgEphemerisGloDepB;
683+
MsgEphemerisGloDepB.prototype.parser = new Parser()
684+
.endianess('little')
685+
.nest('common', { type: EphemerisCommonContent.prototype.parser })
686+
.doublele('gamma')
687+
.doublele('tau')
688+
.array('pos', { length: 3, type: 'doublele' })
689+
.array('vel', { length: 3, type: 'doublele' })
690+
.array('acc', { length: 3, type: 'doublele' });
691+
MsgEphemerisGloDepB.prototype.fieldSpec = [];
692+
MsgEphemerisGloDepB.prototype.fieldSpec.push(['common', EphemerisCommonContent.prototype.fieldSpec]);
693+
MsgEphemerisGloDepB.prototype.fieldSpec.push(['gamma', 'writeDoubleLE', 8]);
694+
MsgEphemerisGloDepB.prototype.fieldSpec.push(['tau', 'writeDoubleLE', 8]);
695+
MsgEphemerisGloDepB.prototype.fieldSpec.push(['pos', 'array', 'writeDoubleLE', function () { return 8; }, 3]);
696+
MsgEphemerisGloDepB.prototype.fieldSpec.push(['vel', 'array', 'writeDoubleLE', function () { return 8; }, 3]);
697+
MsgEphemerisGloDepB.prototype.fieldSpec.push(['acc', 'array', 'writeDoubleLE', function () { return 8; }, 3]);
698+
699+
/**
700+
* SBP class for message MSG_EPHEMERIS_GLO (0x0087).
701+
*
702+
* The ephemeris message returns a set of satellite orbit parameters that is used
703+
* to calculate GLO satellite position, velocity, and clock offset. Please see the
704+
* GLO ICD 5.1 "Table 4.5 Characteristics of words of immediate information
705+
* (ephemeris parameters)" for more details.
706+
*
707+
* Fields in the SBP payload (`sbp.payload`):
708+
* @field common EphemerisCommonContent Values common for all ephemeris types
709+
* @field gamma number (float, 8 bytes) Relative deviation of predicted carrier frequency from nominal
710+
* @field tau number (float, 8 bytes) Correction to the SV time
711+
* @field d_tau number (float, 8 bytes) Equipment delay between L1 and L2
712+
* @field pos array Position of the SV at tb in PZ-90.02 coordinates system
713+
* @field vel array Velocity vector of the SV at tb in PZ-90.02 coordinates system
714+
* @field acc array Acceleration vector of the SV at tb in PZ-90.02 coordinates sys
715+
* @field fcn number (unsigned 8-bit int, 1 byte) Frequency slot. FCN+8 (that is [1..14]). 0 or 0xFF for invalid
716+
*
717+
* @param sbp An SBP object with a payload to be decoded.
718+
*/
672719
var MsgEphemerisGlo = function (sbp, fields) {
673720
SBP.call(this, sbp);
674721
this.messageType = "MSG_EPHEMERIS_GLO";
@@ -678,23 +725,27 @@ var MsgEphemerisGlo = function (sbp, fields) {
678725
};
679726
MsgEphemerisGlo.prototype = Object.create(SBP.prototype);
680727
MsgEphemerisGlo.prototype.messageType = "MSG_EPHEMERIS_GLO";
681-
MsgEphemerisGlo.prototype.msg_type = 0x0085;
728+
MsgEphemerisGlo.prototype.msg_type = 0x0087;
682729
MsgEphemerisGlo.prototype.constructor = MsgEphemerisGlo;
683730
MsgEphemerisGlo.prototype.parser = new Parser()
684731
.endianess('little')
685732
.nest('common', { type: EphemerisCommonContent.prototype.parser })
686733
.doublele('gamma')
687734
.doublele('tau')
735+
.doublele('d_tau')
688736
.array('pos', { length: 3, type: 'doublele' })
689737
.array('vel', { length: 3, type: 'doublele' })
690-
.array('acc', { length: 3, type: 'doublele' });
738+
.array('acc', { length: 3, type: 'doublele' })
739+
.uint8('fcn');
691740
MsgEphemerisGlo.prototype.fieldSpec = [];
692741
MsgEphemerisGlo.prototype.fieldSpec.push(['common', EphemerisCommonContent.prototype.fieldSpec]);
693742
MsgEphemerisGlo.prototype.fieldSpec.push(['gamma', 'writeDoubleLE', 8]);
694743
MsgEphemerisGlo.prototype.fieldSpec.push(['tau', 'writeDoubleLE', 8]);
744+
MsgEphemerisGlo.prototype.fieldSpec.push(['d_tau', 'writeDoubleLE', 8]);
695745
MsgEphemerisGlo.prototype.fieldSpec.push(['pos', 'array', 'writeDoubleLE', function () { return 8; }, 3]);
696746
MsgEphemerisGlo.prototype.fieldSpec.push(['vel', 'array', 'writeDoubleLE', function () { return 8; }, 3]);
697747
MsgEphemerisGlo.prototype.fieldSpec.push(['acc', 'array', 'writeDoubleLE', function () { return 8; }, 3]);
748+
MsgEphemerisGlo.prototype.fieldSpec.push(['fcn', 'writeUInt8', 1]);
698749

699750
/**
700751
* SBP class for message MSG_EPHEMERIS_DEP_D (0x0080).
@@ -1794,7 +1845,9 @@ module.exports = {
17941845
MsgEphemerisGloDepA: MsgEphemerisGloDepA,
17951846
0x0084: MsgEphemerisSbas,
17961847
MsgEphemerisSbas: MsgEphemerisSbas,
1797-
0x0085: MsgEphemerisGlo,
1848+
0x0085: MsgEphemerisGloDepB,
1849+
MsgEphemerisGloDepB: MsgEphemerisGloDepB,
1850+
0x0087: MsgEphemerisGlo,
17981851
MsgEphemerisGlo: MsgEphemerisGlo,
17991852
0x0080: MsgEphemerisDepD,
18001853
MsgEphemerisDepD: MsgEphemerisDepD,

0 commit comments

Comments
 (0)