mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-06 16:58:48 +08:00
Minimal Telemetry: gps_downlink can be called from telemetry.xml
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE telemetry SYSTEM "telemetry.dtd">
|
||||
<telemetry>
|
||||
<process name="Ap">
|
||||
<mode name="default">
|
||||
<message name="ESTIMATOR" period="2." phase="0."/>
|
||||
<message name="NAVIGATION" period="2." phase="0."/>
|
||||
<message name="GPS" period="2." phase="0."/>
|
||||
|
||||
<message name="ATTITUDE" period="4." phase="1"/>
|
||||
<message name="DL_VALUE" period="4." phase="3"/>
|
||||
<message name="WP_MOVED" period="4." phase="3"/>
|
||||
|
||||
<message name="DESIRED" period="8." phase="1"/>
|
||||
<!-- Only one of the following is active at the same time: give them same time stamp -->
|
||||
<message name="SEGMENT" period="8." phase="5"/>
|
||||
<message name="CIRCLE" period="8." phase="5"/>
|
||||
<message name="SURVEY" period="8." phase="5"/>
|
||||
|
||||
<message name="ALIVE" period="16." phase="1"/>
|
||||
<message name="BAT" period="16." phase="1"/>
|
||||
<message name="CALIBRATION" period="16." phase="1"/>
|
||||
<message name="DOWNLINK" period="16." phase="5"/>
|
||||
<message name="GPS_SOL" period="16." phase="5"/>
|
||||
<message name="NAVIGATION_REF" period="16." phase="9"/>
|
||||
<message name="PPRZ_MODE" period="16." phase="9"/>
|
||||
</mode>
|
||||
</process>
|
||||
<process name="Fbw">
|
||||
<mode name="default">
|
||||
<message name="FBW_STATUS" period="16." phase="13"/>
|
||||
<message name="COMMANDS" period="16." phase="13"/>
|
||||
<message name="ACTUATORS" period="16." phase="13"/>
|
||||
</mode>
|
||||
</process>
|
||||
</telemetry>
|
||||
@@ -159,6 +159,11 @@
|
||||
#define PERIODIC_SEND_GPS() DOWNLINK_SEND_GPS(&gps_mode, &gps_utm_east, &gps_utm_north, &gps_course, &gps_alt, &gps_gspeed,&gps_climb, &gps_itow, &gps_utm_zone, &gps_nb_ovrn)
|
||||
#define PERIODIC_SEND_GPS_SOL() DOWNLINK_SEND_GPS_SOL(&gps_Pacc, &gps_Sacc, &gps_PDOP, &gps_numSV)
|
||||
#define PERIODIC_SEND_DebugChao() DOWNLINK_SEND_DebugChao(&ugear_debug1, &ugear_debug2, &ugear_debug3, &ugear_debug4, &ugear_debug5, &ugear_debug6)
|
||||
#else
|
||||
# ifdef PERIOD_GPS_0
|
||||
# include "gps.h"
|
||||
# define PERIODIC_SEND_GPS() gps_send()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_BARO_MS5534A
|
||||
|
||||
+12
-5
@@ -33,6 +33,7 @@
|
||||
#include "latlong.h"
|
||||
#include "sys_time.h"
|
||||
#include "airframe.h"
|
||||
#include "periodic.h"
|
||||
|
||||
#ifdef USE_USB_SERIAL
|
||||
#include "usb_serial.h"
|
||||
@@ -56,13 +57,19 @@ volatile uint16_t gps_msg_received_counter;
|
||||
#endif
|
||||
|
||||
void gps_downlink( void ) {
|
||||
static uint8_t _4Hz;
|
||||
_4Hz++; if (_4Hz > 3) _4Hz = 0;
|
||||
|
||||
|
||||
#if defined DOWNLINK_GPS_1Hz
|
||||
if (_4Hz == 0)
|
||||
# ifdef DOWNLINK_GPS_1Hz
|
||||
# warning "Deperecated DOWNLINK_GPS_1Hz: Please Use Telemetry xml to reduce data rate"
|
||||
# endif
|
||||
|
||||
|
||||
#ifndef PERIOD_GPS_0
|
||||
gps_send();
|
||||
#endif
|
||||
}
|
||||
|
||||
void gps_send( void ) {
|
||||
|
||||
DOWNLINK_SEND_GPS(&gps_mode, &gps_utm_east, &gps_utm_north, &gps_course, &gps_alt, &gps_gspeed,&gps_climb, &gps_itow, &gps_utm_zone, &gps_nb_ovrn);
|
||||
|
||||
static uint8_t i;
|
||||
|
||||
+2
-12
@@ -67,6 +67,7 @@ void gps_init( void );
|
||||
void gps_configure( void );
|
||||
void parse_gps_msg( void );
|
||||
void gps_downlink( void );
|
||||
void gps_send( void );
|
||||
void gps_configure_uart( void );
|
||||
|
||||
|
||||
@@ -115,24 +116,13 @@ extern struct svinfo gps_svinfos[GPS_NB_CHANNELS];
|
||||
#define GpsToggleLed() {}
|
||||
#endif
|
||||
|
||||
#define UseGpsPos(_callback) { \
|
||||
if (GpsFixValid()) { \
|
||||
last_gps_msg_t = cpu_time_sec; \
|
||||
_callback(); \
|
||||
GpsToggleLed(); \
|
||||
} \
|
||||
gps_downlink(); \
|
||||
}
|
||||
|
||||
#ifdef UGEAR
|
||||
#define UseGpsPosUgear(_callback) { \
|
||||
#define UseGpsPosNoSend(_callback) { \
|
||||
if (GpsFixValid()) { \
|
||||
last_gps_msg_t = cpu_time_sec; \
|
||||
_callback(); \
|
||||
GpsToggleLed(); \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GPS_CONFIGURE
|
||||
#define GpsParseOrConfigure() { \
|
||||
|
||||
@@ -777,18 +777,17 @@ void event_task_ap( void ) {
|
||||
if (gps_pos_available){
|
||||
//gps_downlink();
|
||||
gps_verbose_downlink = !launch;
|
||||
// UseGpsPos(estimator_update_state_gps);
|
||||
UseGpsPosUgear(estimator_update_state_gps);
|
||||
UseGpsPosNoSend(estimator_update_state_gps);
|
||||
gps_msg_received_counter = gps_msg_received_counter+1;
|
||||
#ifdef GX2
|
||||
if (gps_msg_received_counter == 1){
|
||||
gps_downlink();
|
||||
gps_send();
|
||||
gps_msg_received_counter = 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef XSENSDL
|
||||
if (gps_msg_received_counter == 25){
|
||||
gps_downlink();
|
||||
gps_send();
|
||||
gps_msg_received_counter = 0;
|
||||
}
|
||||
#endif
|
||||
@@ -814,7 +813,8 @@ void event_task_ap( void ) {
|
||||
gps_msg_received = FALSE;
|
||||
if (gps_pos_available) {
|
||||
gps_verbose_downlink = !launch;
|
||||
UseGpsPos(estimator_update_state_gps);
|
||||
UseGpsPosNoSend(estimator_update_state_gps);
|
||||
gps_downlink();
|
||||
gps_pos_available = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,9 @@ value sim_use_gps_pos(value x, value y, value z, value c, value a, value s, valu
|
||||
gps_numSV = 7;
|
||||
|
||||
gps_verbose_downlink = !launch;
|
||||
UseGpsPos(estimator_update_state_gps);
|
||||
UseGpsPosNoSend(estimator_update_state_gps);
|
||||
gps_downlink();
|
||||
|
||||
|
||||
return Val_unit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user