Skip to content

Commit

Permalink
[gps] use libsbp as git submodule
Browse files Browse the repository at this point in the history
currently matching libswiftnav v0.15.1
  • Loading branch information
gautierhattenberger authored and fvantienen committed Sep 13, 2015
1 parent 35dab4c commit f95dea9
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 981 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Expand Up @@ -13,3 +13,6 @@
[submodule "sw/ext/libzbar"]
path = sw/ext/libzbar
url = https://github.com/paparazzi/libzbar
[submodule "sw/ext/libsbp"]
path = sw/ext/libsbp
url = https://github.com/swift-nav/libsbp.git
6 changes: 3 additions & 3 deletions conf/firmwares/subsystems/fixedwing/gps_piksi.makefile
Expand Up @@ -19,9 +19,9 @@ $(TARGET).srcs += $(SRC_SUBSYSTEMS)/gps.c
ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_piksi.h\"
ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_piksi.c

# libswiftnav
ap.CFLAGS += -I$(PAPARAZZI_SRC)/sw/ext/libswiftnav/include
ap.srcs += $(PAPARAZZI_SRC)/sw/ext/libswiftnav/src/sbp.c $(PAPARAZZI_SRC)/sw/ext/libswiftnav/src/edc.c
# libsbp
ap.CFLAGS += -I$(PAPARAZZI_SRC)/sw/ext/libsbp/c/include/libsbp
ap.srcs += $(PAPARAZZI_SRC)/sw/ext/libsbp/c/src/sbp.c $(PAPARAZZI_SRC)/sw/ext/libsbp/c/src/edc.c

sim.CFLAGS += -DUSE_GPS -DGPS_USE_LATLONG
sim.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim.h\"
Expand Down
6 changes: 3 additions & 3 deletions conf/firmwares/subsystems/rotorcraft/gps_piksi.makefile
Expand Up @@ -19,9 +19,9 @@ $(TARGET).srcs += $(SRC_SUBSYSTEMS)/gps.c
ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_piksi.h\"
ap.srcs += $(SRC_SUBSYSTEMS)/gps/gps_piksi.c

# libswiftnav
ap.CFLAGS += -I$(PAPARAZZI_SRC)/sw/ext/libswiftnav/include
ap.srcs += $(PAPARAZZI_SRC)/sw/ext/libswiftnav/src/sbp.c $(PAPARAZZI_SRC)/sw/ext/libswiftnav/src/edc.c
# libsbp
ap.CFLAGS += -I$(PAPARAZZI_SRC)/sw/ext/libsbp/c/include/libsbp
ap.srcs += $(PAPARAZZI_SRC)/sw/ext/libsbp/c/src/sbp.c $(PAPARAZZI_SRC)/sw/ext/libsbp/c/src/edc.c

nps.CFLAGS += -DUSE_GPS
nps.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim_nps.h\"
Expand Down
34 changes: 17 additions & 17 deletions sw/airborne/subsystems/gps/gps_piksi.c
Expand Up @@ -30,7 +30,7 @@
*/

#include <sbp.h>
#include <sbp_messages.h>
#include <navigation.h>
#include "subsystems/gps.h"
#include "subsystems/abi.h"
#include "mcu_periph/uart.h"
Expand Down Expand Up @@ -90,7 +90,7 @@ static void sbp_pos_ecef_callback(uint16_t sender_id __attribute__((unused)),
return;
}
#endif
sbp_pos_ecef_t pos_ecef = *(sbp_pos_ecef_t *)msg;
msg_pos_ecef_t pos_ecef = *(msg_pos_ecef_t *)msg;
gps.ecef_pos.x = (int32_t)(pos_ecef.x * 100.0);
gps.ecef_pos.y = (int32_t)(pos_ecef.y * 100.0);
gps.ecef_pos.z = (int32_t)(pos_ecef.z * 100.0);
Expand All @@ -106,7 +106,7 @@ static void sbp_baseline_ecef_callback(uint16_t sender_id __attribute__((unused)
uint8_t msg[],
void *context __attribute__((unused)))
{
sbp_baseline_ecef_t baseline_ecef = *(sbp_baseline_ecef_t *)msg;
msg_baseline_ecef_t baseline_ecef = *(msg_baseline_ecef_t *)msg;
gps.ecef_pos.x = (int32_t)(baseline_ecef.x / 10);
gps.ecef_pos.y = (int32_t)(baseline_ecef.y / 10);
gps.ecef_pos.z = (int32_t)(baseline_ecef.z / 10);
Expand All @@ -127,7 +127,7 @@ static void sbp_vel_ecef_callback(uint16_t sender_id __attribute__((unused)),
uint8_t msg[],
void *context __attribute__((unused)))
{
sbp_vel_ecef_t vel_ecef = *(sbp_vel_ecef_t *)msg;
msg_vel_ecef_t vel_ecef = *(msg_vel_ecef_t *)msg;
gps.ecef_vel.x = (int32_t)(vel_ecef.x / 10);
gps.ecef_vel.y = (int32_t)(vel_ecef.y / 10);
gps.ecef_vel.z = (int32_t)(vel_ecef.z / 10);
Expand All @@ -153,7 +153,7 @@ static void sbp_pos_llh_callback(uint16_t sender_id __attribute__((unused)),
uint8_t msg[],
void *context __attribute__((unused)))
{
sbp_pos_llh_t pos_llh = *(sbp_pos_llh_t *)msg;
msg_pos_llh_t pos_llh = *(msg_pos_llh_t *)msg;
gps.lla_pos.lat = (int32_t)(pos_llh.lat * 1e7);
gps.lla_pos.lon = (int32_t)(pos_llh.lon * 1e7);
int32_t alt = (int32_t)(pos_llh.height * 1000.);
Expand Down Expand Up @@ -194,7 +194,7 @@ static void sbp_pos_llh_callback(uint16_t sender_id __attribute__((unused)),
// uint8_t msg[],
// void *context __attribute__((unused)))
//{
// sbp_baseline_ned_t baseline_ned = *(sbp_baseline_ned_t *)msg;
// msg_baseline_ned_t baseline_ned = *(sbp_baseline_ned_t *)msg;
//}
//#endif

Expand All @@ -203,7 +203,7 @@ static void sbp_vel_ned_callback(uint16_t sender_id __attribute__((unused)),
uint8_t msg[],
void *context __attribute__((unused)))
{
sbp_vel_ned_t vel_ned = *(sbp_vel_ned_t *)msg;
msg_vel_ned_t vel_ned = *(msg_vel_ned_t *)msg;
gps.ned_vel.x = (int32_t)(vel_ned.n / 10);
gps.ned_vel.y = (int32_t)(vel_ned.e / 10);
gps.ned_vel.z = (int32_t)(vel_ned.d / 10);
Expand All @@ -218,7 +218,7 @@ static void sbp_dops_callback(uint16_t sender_id __attribute__((unused)),
uint8_t msg[],
void *context __attribute__((unused)))
{
sbp_dops_t dops = *(sbp_dops_t *)msg;
msg_dops_t dops = *(msg_dops_t *)msg;
gps.pdop = dops.pdop;
}

Expand All @@ -227,7 +227,7 @@ static void sbp_gps_time_callback(uint16_t sender_id __attribute__((unused)),
uint8_t msg[],
void *context __attribute__((unused)))
{
sbp_gps_time_t gps_time = *(sbp_gps_time_t *)msg;
msg_gps_time_t gps_time = *(msg_gps_time_t *)msg;
gps.week = gps_time.wn;
gps.tow = gps_time.tow;
}
Expand All @@ -240,17 +240,17 @@ void gps_impl_init(void)
/* Setup SBP nodes */
sbp_state_init(&sbp_state);
/* Register a node and callback, and associate them with a specific message ID. */
sbp_register_callback(&sbp_state, SBP_POS_ECEF, &sbp_pos_ecef_callback, NULL, &pos_ecef_node);
sbp_register_callback(&sbp_state, SBP_VEL_ECEF, &sbp_vel_ecef_callback, NULL, &vel_ecef_node);
sbp_register_callback(&sbp_state, SBP_POS_LLH, &sbp_pos_llh_callback, NULL, &pos_llh_node);
sbp_register_callback(&sbp_state, SBP_VEL_NED, &sbp_vel_ned_callback, NULL, &vel_ned_node);
sbp_register_callback(&sbp_state, SBP_DOPS, &sbp_dops_callback, NULL, &dops_node);
sbp_register_callback(&sbp_state, SBP_GPS_TIME, &sbp_gps_time_callback, NULL, &gps_time_node);
sbp_register_callback(&sbp_state, SBP_MSG_POS_ECEF, &sbp_pos_ecef_callback, NULL, &pos_ecef_node);
sbp_register_callback(&sbp_state, SBP_MSG_VEL_ECEF, &sbp_vel_ecef_callback, NULL, &vel_ecef_node);
sbp_register_callback(&sbp_state, SBP_MSG_POS_LLH, &sbp_pos_llh_callback, NULL, &pos_llh_node);
sbp_register_callback(&sbp_state, SBP_MSG_VEL_NED, &sbp_vel_ned_callback, NULL, &vel_ned_node);
sbp_register_callback(&sbp_state, SBP_MSG_DOPS, &sbp_dops_callback, NULL, &dops_node);
sbp_register_callback(&sbp_state, SBP_MSG_GPS_TIME, &sbp_gps_time_callback, NULL, &gps_time_node);
#if USE_PIKSI_BASELINE_ECEF
sbp_register_callback(&sbp_state, SBP_BASELINE_ECEF, &sbp_baseline_ecef_callback, NULL, &baseline_ecef_node);
sbp_register_callback(&sbp_state, SBP_MSG_BASELINE_ECEF, &sbp_baseline_ecef_callback, NULL, &baseline_ecef_node);
#endif
//#if USE_PIKSI_BASELINE_NED
// sbp_register_callback(&sbp_state, SBP_BASELINE_NED, &sbp_baseline_ned_callback, NULL, &baseline_ned_node);
// sbp_register_callback(&sbp_state, SBP_MSG_BASELINE_NED, &sbp_baseline_ned_callback, NULL, &baseline_ned_node);
//#endif
}

Expand Down
1 change: 1 addition & 0 deletions sw/ext/libsbp
Submodule libsbp added at b0773d
57 changes: 0 additions & 57 deletions sw/ext/libswiftnav/include/common.h

This file was deleted.

21 changes: 0 additions & 21 deletions sw/ext/libswiftnav/include/edc.h

This file was deleted.

84 changes: 0 additions & 84 deletions sw/ext/libswiftnav/include/sbp.h

This file was deleted.

0 comments on commit f95dea9

Please sign in to comment.