Skip to content

Commit

Permalink
Merge pull request #133 from denniszollo/CRC_namespace_collision
Browse files Browse the repository at this point in the history
Crc namespace collision
  • Loading branch information
mookerji committed Apr 29, 2015
2 parents 7938750 + 682a014 commit 573d3a2
Show file tree
Hide file tree
Showing 9 changed files with 673 additions and 87 deletions.
12 changes: 6 additions & 6 deletions c/include/libsbp/observation.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ typedef struct __attribute__((packed)) {
#define SBP_MSG_EPHEMERIS 0x0046
typedef struct __attribute__((packed)) {
double tgd; /**< Group delay differential between L1 and L2 [s] */
double crs; /**< Amplitude of the sine harmonic correction term to the orbit radius [m] */
double crc; /**< Amplitude of the cosine harmonic correction term to the orbit radius [m] */
double cuc; /**< Amplitude of the cosine harmonic correction term to the argument of latitude [rad] */
double cus; /**< Amplitude of the sine harmonic correction term to the argument of latitude [rad] */
double cic; /**< Amplitude of the cosine harmonic correction term to the angle of inclination [rad] */
double cis; /**< Amplitude of the sine harmonic correction term to the angle of inclination [rad] */
double c_rs; /**< Amplitude of the sine harmonic correction term to the orbit radius [m] */
double c_rc; /**< Amplitude of the cosine harmonic correction term to the orbit radius [m] */
double c_uc; /**< Amplitude of the cosine harmonic correction term to the argument of latitude [rad] */
double c_us; /**< Amplitude of the sine harmonic correction term to the argument of latitude [rad] */
double c_ic; /**< Amplitude of the cosine harmonic correction term to the angle of inclination [rad] */
double c_is; /**< Amplitude of the sine harmonic correction term to the angle of inclination [rad] */
double dn; /**< Mean motion difference [rad/s] */
double m0; /**< Mean anomaly at reference time [radians] */
double ecc; /**< Eccentricity of satellite orbit */
Expand Down
12 changes: 6 additions & 6 deletions c/include/libsbp/tracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ typedef struct __attribute__((packed)) {
#define SBP_MSG_EPHEMERIS_OLD 0x001A
typedef struct __attribute__((packed)) {
double tgd; /**< Group delay differential between L1 and L2 [s] */
double crs; /**< Amplitude of the sine harmonic correction term to the orbit radius [m] */
double crc; /**< Amplitude of the cosine harmonic correction term to the orbit radius [m] */
double cuc; /**< Amplitude of the cosine harmonic correction term to the argument of latitude [rad] */
double cus; /**< Amplitude of the sine harmonic correction term to the argument of latitude [rad] */
double cic; /**< Amplitude of the cosine harmonic correction term to the angle of inclination [rad] */
double cis; /**< Amplitude of the sine harmonic correction term to the angle of inclination [rad] */
double c_rs; /**< Amplitude of the sine harmonic correction term to the orbit radius [m] */
double c_rc; /**< Amplitude of the cosine harmonic correction term to the orbit radius [m] */
double c_uc; /**< Amplitude of the cosine harmonic correction term to the argument of latitude [rad] */
double c_us; /**< Amplitude of the sine harmonic correction term to the argument of latitude [rad] */
double c_ic; /**< Amplitude of the cosine harmonic correction term to the angle of inclination [rad] */
double c_is; /**< Amplitude of the sine harmonic correction term to the angle of inclination [rad] */
double dn; /**< Mean motion difference [rad/s] */
double m0; /**< Mean anomaly at reference time [radians] */
double ecc; /**< Eccentricity of satellite orbit */
Expand Down
36 changes: 18 additions & 18 deletions python/sbp/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,17 +351,17 @@ class MsgEphemeris(SBP):
SBP parent object to inherit from.
tgd : double
Group delay differential between L1 and L2
crs : double
c_rs : double
Amplitude of the sine harmonic correction term to the orbit radius
crc : double
c_rc : double
Amplitude of the cosine harmonic correction term to the orbit radius
cuc : double
c_uc : double
Amplitude of the cosine harmonic correction term to the argument of latitude
cus : double
c_us : double
Amplitude of the sine harmonic correction term to the argument of latitude
cic : double
c_ic : double
Amplitude of the cosine harmonic correction term to the angle of inclination
cis : double
c_is : double
Amplitude of the sine harmonic correction term to the angle of inclination
dn : double
Mean motion difference
Expand Down Expand Up @@ -407,12 +407,12 @@ class MsgEphemeris(SBP):
"""
_parser = Struct("MsgEphemeris",
LFloat64('tgd'),
LFloat64('crs'),
LFloat64('crc'),
LFloat64('cuc'),
LFloat64('cus'),
LFloat64('cic'),
LFloat64('cis'),
LFloat64('c_rs'),
LFloat64('c_rc'),
LFloat64('c_uc'),
LFloat64('c_us'),
LFloat64('c_ic'),
LFloat64('c_is'),
LFloat64('dn'),
LFloat64('m0'),
LFloat64('ecc'),
Expand Down Expand Up @@ -442,12 +442,12 @@ def __init__(self, sbp=None, **kwargs):
self.msg_type = SBP_MSG_EPHEMERIS
self.sender = kwargs.pop('sender', 0)
self.tgd = kwargs.pop('tgd')
self.crs = kwargs.pop('crs')
self.crc = kwargs.pop('crc')
self.cuc = kwargs.pop('cuc')
self.cus = kwargs.pop('cus')
self.cic = kwargs.pop('cic')
self.cis = kwargs.pop('cis')
self.c_rs = kwargs.pop('c_rs')
self.c_rc = kwargs.pop('c_rc')
self.c_uc = kwargs.pop('c_uc')
self.c_us = kwargs.pop('c_us')
self.c_ic = kwargs.pop('c_ic')
self.c_is = kwargs.pop('c_is')
self.dn = kwargs.pop('dn')
self.m0 = kwargs.pop('m0')
self.ecc = kwargs.pop('ecc')
Expand Down
36 changes: 18 additions & 18 deletions python/sbp/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,17 @@ class MsgEphemerisOld(SBP):
SBP parent object to inherit from.
tgd : double
Group delay differential between L1 and L2
crs : double
c_rs : double
Amplitude of the sine harmonic correction term to the orbit radius
crc : double
c_rc : double
Amplitude of the cosine harmonic correction term to the orbit radius
cuc : double
c_uc : double
Amplitude of the cosine harmonic correction term to the argument of latitude
cus : double
c_us : double
Amplitude of the sine harmonic correction term to the argument of latitude
cic : double
c_ic : double
Amplitude of the cosine harmonic correction term to the angle of inclination
cis : double
c_is : double
Amplitude of the sine harmonic correction term to the angle of inclination
dn : double
Mean motion difference
Expand Down Expand Up @@ -206,12 +206,12 @@ class MsgEphemerisOld(SBP):
"""
_parser = Struct("MsgEphemerisOld",
LFloat64('tgd'),
LFloat64('crs'),
LFloat64('crc'),
LFloat64('cuc'),
LFloat64('cus'),
LFloat64('cic'),
LFloat64('cis'),
LFloat64('c_rs'),
LFloat64('c_rc'),
LFloat64('c_uc'),
LFloat64('c_us'),
LFloat64('c_ic'),
LFloat64('c_is'),
LFloat64('dn'),
LFloat64('m0'),
LFloat64('ecc'),
Expand Down Expand Up @@ -241,12 +241,12 @@ def __init__(self, sbp=None, **kwargs):
self.msg_type = SBP_MSG_EPHEMERIS_OLD
self.sender = kwargs.pop('sender', 0)
self.tgd = kwargs.pop('tgd')
self.crs = kwargs.pop('crs')
self.crc = kwargs.pop('crc')
self.cuc = kwargs.pop('cuc')
self.cus = kwargs.pop('cus')
self.cic = kwargs.pop('cic')
self.cis = kwargs.pop('cis')
self.c_rs = kwargs.pop('c_rs')
self.c_rc = kwargs.pop('c_rc')
self.c_uc = kwargs.pop('c_uc')
self.c_us = kwargs.pop('c_us')
self.c_ic = kwargs.pop('c_ic')
self.c_is = kwargs.pop('c_is')
self.dn = kwargs.pop('dn')
self.m0 = kwargs.pop('m0')
self.ecc = kwargs.pop('ecc')
Expand Down
35 changes: 10 additions & 25 deletions python/tests/sbp/build_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@
"""

import sbp
from sbp.table import _SBP_TABLE
from sbp.client.loggers.pickle_logger import PickleLogIterator
from sbp.utils import walk_json_dict
import base64
import datetime
import sbp
import warnings
import yaml

Expand All @@ -81,23 +81,6 @@ def _to_readable_dict(msg):
'payload': base64.standard_b64encode(msg.payload),
'crc': hex(msg.crc)}

def walk_json_dict(coll):
"""
Flatten a parsed SBP object into a dicts and lists, which are
compatible for YAML output.
Parameters
----------
test_map : dict
"""
if isinstance(coll, dict):
return dict((k, walk_json_dict(v)) for (k, v) in coll.iteritems())
elif hasattr(coll, '__iter__'):
return [walk_json_dict(dict(seq.items())) for seq in coll]
else:
return coll

def dump_modules_to_yaml(test_map, version):
"""
Take unit test data data from test, format as YAML, and write to
Expand Down Expand Up @@ -192,9 +175,9 @@ def get_args():
parser.add_argument("-l", "--log_file",
default=[None], nargs=1,
help="use input file to read SBP messages from.")
parser.add_argument("-j", "--json",
parser.add_argument("-p", "--pickle",
action="store_true",
help="JSON serialize SBP messages.")
help="use legacy pickle log functionality.")
parser.add_argument("-s", "--version",
default=[None], nargs=1,
help="SBP version number (e.g. 0.29).")
Expand All @@ -212,17 +195,19 @@ def main():
args = get_args()
log_datafile = args.log_file[0]
version = args.version[0]
json = args.json
pickle = args.pickle
verbose = args.verbose
if json:
assert False, "JSON formatted log input not implemented yet."
if pickle:
from sbp.client.loggers.pickle_logger import PickleLogIterator as Iterator
else:
from sbp.client.loggers.json_logger import JSONLogIterator as Iterator
if verbose:
assert False, "Verbose output not implemented yet."
# Build
num_test_cases = 5
message_table = _SBP_TABLE
test_table = dict((k, []) for (k, v) in message_table.copy().iteritems())
with PickleLogIterator(log_datafile) as log:
with Iterator(log_datafile) as log:
for delta, timestamp, msg in log.next():
try:
i = mk_readable_msg(msg)
Expand Down
Loading

0 comments on commit 573d3a2

Please sign in to comment.