Skip to content

Commit

Permalink
Merge pull request #32 from mookerji/11-c-headers
Browse files Browse the repository at this point in the history
libsbp C headers and test stubs.
  • Loading branch information
mookerji committed Mar 19, 2015
2 parents 5a4e635 + 5718dca commit a187f0e
Show file tree
Hide file tree
Showing 17 changed files with 887 additions and 2 deletions.
40 changes: 40 additions & 0 deletions c/include/libsbp/acquisition.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2015 Swift Navigation Inc.
* Contact: Fergus Noble <fergus@swift-nav.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.
*/

/*****************************************************************************
* Automatically generated from piksi/yaml/
* with generate.py at 2015-03-13 13:32:04.122183. Please do not hand edit!
*****************************************************************************/

#ifndef LIBSBP_ACQUISITION_MESSAGES_H
#define LIBSBP_ACQUISITION_MESSAGES_H

#include "common.h"


/** None
* Results of an attempted GPS signal acquisition. Contains the
* parameters of the point in the acquisition search space with the
* best signal-to-noise ratio.
*/
#define SBP_MSG_ACQ_RESULT 0x0015
typedef struct __attribute__((packed)) {
float snr; /**< SNR of best point. */
float cp; /**< Code phase. [chips] */
float cf; /**< Carrier frequency. [hz] */
u8 prn; /**< PRN identifier of the satellite signal for which
acquisition was attempted.
*/
} msg_acq_result_t;


#endif /* LIBSBP_ACQUISITION_MESSAGES_H */
50 changes: 50 additions & 0 deletions c/include/libsbp/lib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2015 Swift Navigation Inc.
* Contact: Fergus Noble <fergus@swift-nav.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.
*/

/*****************************************************************************
* Automatically generated from piksi/yaml/
* with generate.py at 2015-03-13 13:32:04.091582. Please do not hand edit!
*****************************************************************************/

#ifndef LIBSBP_LIB_MESSAGES_H
#define LIBSBP_LIB_MESSAGES_H

#include "common.h"


/** None
* Statistics on the latency of observations received from the base
* station. As observation packets are received their GPS time is
* compared to the current GPS time calculated locally by the
* receiver to give a precise measurement of the end-to-end
* communication latency in the system.
*/
typedef struct __attribute__((packed)) {
s32 avg; /**< Average latency. [ms] */
s32 lmin; /**< Minimum latency. [ms] */
s32 lmax; /**< Maximum latency. [ms] */
s32 current; /**< Smoothed estimate of the current latency. [ms] */
} latency_t;


/** None
* Carrier phase measurement in cycles represented as a 40-bit
* fixed point number with Q32.8 layout, i.e. 32-bits of whole
* cycles and 8-bits of fractional cycles.
*/
typedef struct __attribute__((packed)) {
u32 i; /**< Carrier phase whole cycles. [cycles] */
u8 f; /**< Carrier phase fractional part. [cycles / 255] */
} carrier_phase_t;


#endif /* LIBSBP_LIB_MESSAGES_H */
144 changes: 144 additions & 0 deletions c/include/libsbp/navigation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*
* Copyright (C) 2015 Swift Navigation Inc.
* Contact: Fergus Noble <fergus@swift-nav.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.
*/

/*****************************************************************************
* Automatically generated from piksi/yaml/
* with generate.py at 2015-03-13 13:32:04.124636. Please do not hand edit!
*****************************************************************************/

#ifndef LIBSBP_NAVIGATION_MESSAGES_H
#define LIBSBP_NAVIGATION_MESSAGES_H

#include "common.h"


/** GPS Time
* GPS Time.
*/
#define SBP_MSG_GPS_TIME 0x0100
typedef struct __attribute__((packed)) {
u16 wn; /**< GPS week number [weeks] */
u32 tow; /**< GPS Time of Week rounded to the nearest ms [ms] */
s32 ns; /**< Nanosecond remainder of rounded tow [ns] */
u8 flags; /**< Status flags (reserved) */
} msg_gps_time_t;


/** Dilution of Precision
* Dilution of Precision.
*/
#define SBP_MSG_DOPS 0x0206
typedef struct __attribute__((packed)) {
u32 tow; /**< GPS Time of Week [ms] */
u16 gdop; /**< Geometric Dilution of Precision [0.01] */
u16 pdop; /**< Position Dilution of Precision [0.01] */
u16 tdop; /**< Time Dilution of Precision [0.01] */
u16 hdop; /**< Horizontal Dilution of Precision [0.01] */
u16 vdop; /**< Vertical Dilution of Precision [0.01] */
} msg_dops_t;


/** Position in ECEF
* Position solution in absolute Earth Centered Earth Fixed (ECEF)
* coordinates.
*/
#define SBP_MSG_POS_ECEF 0x0200
typedef struct __attribute__((packed)) {
u32 tow; /**< GPS Time of Week [ms] */
double x; /**< ECEF X coordinate [m] */
double y; /**< ECEF Y coordinate [m] */
double z; /**< ECEF Z coordinate [m] */
u16 accuracy; /**< Position accuracy estimate [mm] */
u8 n_sats; /**< Number of satellites used in solution */
u8 flags; /**< Status flags */
} msg_pos_ecef_t;


/** Geodetic Position
* Geodetic position solution.
*/
#define SBP_MSG_POS_LLH 0x0201
typedef struct __attribute__((packed)) {
u32 tow; /**< GPS Time of Week [ms] */
double lat; /**< Latitude [deg] */
double lon; /**< Longitude [deg] */
double height; /**< Height [m] */
u16 h_accuracy; /**< Horizontal position accuracy estimate [mm] */
u16 v_accuracy; /**< Vertical position accuracy estimate [mm] */
u8 n_sats; /**< Number of satellites used in solution */
u8 flags; /**< Status flags */
} msg_pos_llh_t;


/** Baseline in ECEF
* Baseline in Earth Centered Earth Fixed (ECEF) coordinates.
*/
#define SBP_MSG_BASELINE_ECEF 0x0202
typedef struct __attribute__((packed)) {
u32 tow; /**< GPS Time of Week [ms] */
s32 x; /**< Baseline ECEF X coordinate [mm] */
s32 y; /**< Baseline ECEF Y coordinate [mm] */
s32 z; /**< Baseline ECEF Z coordinate [mm] */
u16 accuracy; /**< Position accuracy estimate [mm] */
u8 n_sats; /**< Number of satellites used in solution */
u8 flags; /**< Status flags */
} msg_baseline_ecef_t;


/** Baseline in NED
* Baseline in local North East Down (NED) coordinates.
*/
#define SBP_MSG_BASELINE_NED 0x0203
typedef struct __attribute__((packed)) {
u32 tow; /**< GPS Time of Week [ms] */
s32 n; /**< Baseline North coordinate [mm] */
s32 e; /**< Baseline East coordinate [mm] */
s32 d; /**< Baseline Down coordinate [mm] */
u16 h_accuracy; /**< Horizontal position accuracy estimate [mm] */
u16 v_accuracy; /**< Vertical position accuracy estimate [mm] */
u8 n_sats; /**< Number of satellites used in solution */
u8 flags; /**< Status flags */
} msg_baseline_ned_t;


/** Velocity in ECEF
* Velocity in Earth Centered Earth Fixed (ECEF) coordinates.
*/
#define SBP_MSG_VEL_ECEF 0x0204
typedef struct __attribute__((packed)) {
u32 tow; /**< GPS Time of Week [ms] */
s32 x; /**< Velocity ECEF X coordinate [mm/s] */
s32 y; /**< Velocity ECEF Y coordinate [mm/s] */
s32 z; /**< Velocity ECEF Z coordinate [mm/s] */
u16 accuracy; /**< Velocity accuracy estimate [mm/s] */
u8 n_sats; /**< Number of satellites used in solution */
u8 flags; /**< Status flags (reserved) */
} msg_vel_ecef_t;


/** Velocity in NED
* Velocity in local North East Down (NED) coordinates.
*/
#define SBP_MSG_VEL_NED 0x0205
typedef struct __attribute__((packed)) {
u32 tow; /**< GPS Time of Week [ms] */
s32 n; /**< Velocity North coordinate [mm/s] */
s32 e; /**< Velocity East coordinate [mm/s] */
s32 d; /**< Velocity Down coordinate [mm/s] */
u16 h_accuracy; /**< Horizontal velocity accuracy estimate [mm/s] */
u16 v_accuracy; /**< Vertical velocity accuracy estimate [mm/s] */
u8 n_sats; /**< Number of satellites used in solution */
u8 flags; /**< Status flags (reserved) */
} msg_vel_ned_t;


#endif /* LIBSBP_NAVIGATION_MESSAGES_H */
78 changes: 78 additions & 0 deletions c/include/libsbp/observation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright (C) 2015 Swift Navigation Inc.
* Contact: Fergus Noble <fergus@swift-nav.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.
*/

/*****************************************************************************
* Automatically generated from piksi/yaml/
* with generate.py at 2015-03-13 13:32:04.128822. Please do not hand edit!
*****************************************************************************/

#ifndef LIBSBP_OBSERVATION_MESSAGES_H
#define LIBSBP_OBSERVATION_MESSAGES_H

#include "common.h"
#include "lib.h"


/** None
* GPS time, defined as the number of milliseconds since the
* beginning of the week on the Saturday/Sunday transition.
*/
typedef struct __attribute__((packed)) {
u32 tow; /**< Milliseconds since start of GPS week [ms] */
u16 wn; /**< GPS week number [week] */
} gps_time_t;


/** None
*/
typedef struct __attribute__((packed)) {
gps_time_t t; /**< GPS time of this observation. */
u8 n_obs; /**< Total number of observations. First nibble is the size
of the sequence (n), second nibble is the zero-indexed
counter (ith packet of n)
*/
} observation_header_t;


/** None
*/
typedef struct __attribute__((packed)) {
u32 P; /**< Pseudorange observation. [cm] */
carrier_phase_t L; /**< Carrier phase observation. */
u8 cn0; /**< Carrier-to-Noise density [dB Hz] */
u16 lock; /**< Lock indicator. This value changes whenever a satellite
signal has lost and regained lock, indicating that the
carrier phase ambiguity may have changed. There is no
significance to the value of the lock indicator.
*/
u8 prn; /**< PRN identifier of the satellite signal */
} packed_obs_content_t;


#define SBP_MSG_OBS 0x0045
typedef struct __attribute__((packed)) {
observation_header_t header; /**< Header of a GPS observation message */
packed_obs_content_t obs[0]; /**< Observations */
} msg_obs_t;


#define SBP_MSG_BASE_POS 0x0044
typedef struct __attribute__((packed)) {
double lat; /**< Latitude [deg] */
double lon; /**< Longitude [deg] */
double height; /**< Height [m] */
} msg_base_pos_t;


#endif /* LIBSBP_OBSERVATION_MESSAGES_H */
Loading

0 comments on commit a187f0e

Please sign in to comment.