From ffb9e8716196389cadf8b73f6488c5f5229b3381 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 12 Jul 2015 12:33:26 +0200 Subject: [PATCH] Converted satellite_info topic to generated topic --- msg/satellite_info.msg | 9 +++++++++ src/drivers/gps/ashtech.cpp | 2 +- src/drivers/gps/ashtech.h | 14 +++++++------- src/drivers/gps/ubx.cpp | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 msg/satellite_info.msg diff --git a/msg/satellite_info.msg b/msg/satellite_info.msg new file mode 100644 index 0000000000..24cb03facc --- /dev/null +++ b/msg/satellite_info.msg @@ -0,0 +1,9 @@ +uint8 SAT_INFO_MAX_SATELLITES = 20 + +uint64 timestamp # Timestamp of satellite info +uint8 count # Number of satellites in satellite info +uint8[20] svid # Space vehicle ID [1..255], see scheme below +uint8[20] used # 0: Satellite not used, 1: used for navigation +uint8[20] elevation # Elevation (0: right on top of receiver, 90: on the horizon) of satellite +uint8[20] azimuth # Direction of satellite, 0: 0 deg, 255: 360 deg. +uint8[20] snr # dBHz, Signal to noise ratio of satellite C/N0, range 0..99, zero when not tracking this satellite. diff --git a/src/drivers/gps/ashtech.cpp b/src/drivers/gps/ashtech.cpp index c881344923..eca775745f 100644 --- a/src/drivers/gps/ashtech.cpp +++ b/src/drivers/gps/ashtech.cpp @@ -472,7 +472,7 @@ int ASHTECH::handle_message(int len) if (this_msg_num == all_msg_num) { end = tot_sv_visible - (this_msg_num - 1) * 4; _gps_position->satellites_used = tot_sv_visible; - _satellite_info->count = SAT_INFO_MAX_SATELLITES; + _satellite_info->count = satellite_info_s::SAT_INFO_MAX_SATELLITES; _satellite_info->timestamp = hrt_absolute_time(); } diff --git a/src/drivers/gps/ashtech.h b/src/drivers/gps/ashtech.h index 6ba522b9c5..e7b9e40328 100644 --- a/src/drivers/gps/ashtech.h +++ b/src/drivers/gps/ashtech.h @@ -42,10 +42,10 @@ #ifndef RECV_BUFFER_SIZE #define RECV_BUFFER_SIZE 512 - -#define SAT_INFO_MAX_SATELLITES 20 #endif +#include + class ASHTECH : public GPS_Helper { @@ -70,11 +70,11 @@ class ASHTECH : public GPS_Helper bool _gsv_in_progress; /**< Indicates that gsv data parsing is in progress */ /* int _satellites_count; **< Number of satellites info parsed. */ uint8_t count; /**< Number of satellites in satellite info */ - uint8_t svid[SAT_INFO_MAX_SATELLITES]; /**< Space vehicle ID [1..255], see scheme below */ - uint8_t used[SAT_INFO_MAX_SATELLITES]; /**< 0: Satellite not used, 1: used for navigation */ - uint8_t elevation[SAT_INFO_MAX_SATELLITES]; /**< Elevation (0: right on top of receiver, 90: on the horizon) of satellite */ - uint8_t azimuth[SAT_INFO_MAX_SATELLITES]; /**< Direction of satellite, 0: 0 deg, 255: 360 deg. */ - uint8_t snr[SAT_INFO_MAX_SATELLITES]; /**< dBHz, Signal to noise ratio of satellite C/N0, range 0..99, zero when not tracking this satellite. */ + uint8_t svid[satellite_info_s::SAT_INFO_MAX_SATELLITES]; /**< Space vehicle ID [1..255], see scheme below */ + uint8_t used[satellite_info_s::SAT_INFO_MAX_SATELLITES]; /**< 0: Satellite not used, 1: used for navigation */ + uint8_t elevation[satellite_info_s::SAT_INFO_MAX_SATELLITES]; /**< Elevation (0: right on top of receiver, 90: on the horizon) of satellite */ + uint8_t azimuth[satellite_info_s::SAT_INFO_MAX_SATELLITES]; /**< Direction of satellite, 0: 0 deg, 255: 360 deg. */ + uint8_t snr[satellite_info_s::SAT_INFO_MAX_SATELLITES]; /**< dBHz, Signal to noise ratio of satellite C/N0, range 0..99, zero when not tracking this satellite. */ public: ASHTECH(const int &fd, struct vehicle_gps_position_s *gps_position, struct satellite_info_s *satellite_info); diff --git a/src/drivers/gps/ubx.cpp b/src/drivers/gps/ubx.cpp index 81b580892b..a7247a262d 100644 --- a/src/drivers/gps/ubx.cpp +++ b/src/drivers/gps/ubx.cpp @@ -627,7 +627,7 @@ UBX::payload_rx_add_nav_svinfo(const uint8_t b) } else { if (_rx_payload_index == sizeof(ubx_payload_rx_nav_svinfo_part1_t)) { // Part 1 complete: decode Part 1 buffer - _satellite_info->count = MIN(_buf.payload_rx_nav_svinfo_part1.numCh, SAT_INFO_MAX_SATELLITES); + _satellite_info->count = MIN(_buf.payload_rx_nav_svinfo_part1.numCh, satellite_info_s::SAT_INFO_MAX_SATELLITES); UBX_TRACE_SVINFO("SVINFO len %u numCh %u\n", (unsigned)_rx_payload_length, (unsigned)_buf.payload_rx_nav_svinfo_part1.numCh); } if (_rx_payload_index < sizeof(ubx_payload_rx_nav_svinfo_part1_t) + _satellite_info->count * sizeof(ubx_payload_rx_nav_svinfo_part2_t)) {