gps_pvt 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ba5a3a5c8364753e1f6384519a015f29459e51e17bd82eb81e398c89e80619f
4
- data.tar.gz: 565bd717bb178be9784b9b249860270b9d45e33e8af456ab1042db5d75b34c04
3
+ metadata.gz: ffde7da5c82fa8eecc03dc1fb71c630ff95d8c1b016aefe4da64b63f8ab9e928
4
+ data.tar.gz: 8a56df6b69e8f91cb888aa1135846b6db75a053bbd833e50c62bf0f4937a7157
5
5
  SHA512:
6
- metadata.gz: 1fef4a8e70a4872f17219f3f97a2ac21d0b5feb44a611d747291d842dd6939cd297426c53cbd16875ece618b610d557542f98c720177a05e95db63f9dcd788c9
7
- data.tar.gz: 60450ca6f661f0eaeb0c194caa97f4246dd723edbf2f566c5775fa91dffb621357aca7732b54fb7d27b636cb0864b2f26c40efa661fb3afde029b6a4bc985d63
6
+ metadata.gz: 2889b55a9f925b9952ac1f29900bce98d8e0ab000418d7cecdd0405a2d81b84e70659ef4da271bb924231b7dcd80d8a550937478fbdb9f63ec0b38c0ea6d3061
7
+ data.tar.gz: '08d73a274ee81613d1d44129cfbc1a9732cc886ef5ee48d3eb70113e7d700244ad5ea977abae2d3294d86ac142380c05ba7ccf6b266327f3d001f80be584b0dc'
@@ -952,6 +952,8 @@ if(std::abs(TARGET - eph.TARGET) > raw_t::sf[raw_t::SF_ ## TARGET]){break;}
952
952
  float_t sidereal_t_b_rad;
953
953
  typename Ephemeris::differential_t eq_of_motion;
954
954
 
955
+ static const float_t time_step_max_per_one_integration;
956
+
955
957
  void calculate_additional() {
956
958
  sidereal_t_b_rad = TimeProperties::date_t::Greenwich_sidereal_time_deg(
957
959
  TimeProperties::date.c_tm(),
@@ -1009,36 +1011,52 @@ if(std::abs(TARGET - eph.TARGET) > raw_t::sf[raw_t::SF_ ## TARGET]){break;}
1009
1011
  return calculate_clock_error(t_arrival_onboard - Ephemeris::t_b, pseudo_range);
1010
1012
  }
1011
1013
  /**
1012
- * Calculate constellation(t) based on constellation(t_0).
1014
+ * Calculate absolute constellation(t) based on constellation(t_0).
1013
1015
  * t_0 is a time around t_b, and is used to calculate
1014
- * an intermediate result specified with the 3rd argument.
1015
- * This method is useful to calculate constellation effectively
1016
- * by using a cache.
1017
- * @param delta_t time interval from t_0 to t
1018
- * @param pseudo_range measured pusedo_range to correct delta_t
1016
+ * @param t_step time interval from t_0 to t
1017
+ * @param times number of integration steps (assume times >=0)
1019
1018
  * @param xa_t_0 constellation(t_0)
1020
- * @param t_0_from_t_b time interval from t_b to t_0
1019
+ * @param t_0_from_t_b time interval from t_b to t_0 (= t_0 - t_b)
1021
1020
  */
1022
- constellation_t calculate_constellation(
1023
- float_t delta_t, const float_t &pseudo_range,
1021
+ constellation_t constellation_abs(
1022
+ const float_t &t_step,
1023
+ int times,
1024
1024
  const constellation_t &xa_t_0, const float_t &t_0_from_t_b) const {
1025
1025
 
1026
1026
  constellation_t res(xa_t_0);
1027
- { // time integration from t_b to t_transmit
1028
- float_t delta_t_to_transmit(delta_t - pseudo_range / light_speed);
1029
- float_t t_step_max(delta_t_to_transmit >= 0 ? 60 : -60);
1030
- int i(std::floor(delta_t_to_transmit / t_step_max));
1031
- float_t t_step_remain(delta_t_to_transmit - t_step_max * i);
1032
- float_t delta_t_itg(0); // accumulative time of integration
1033
- for(; i > 0; --i, delta_t_itg += t_step_max){
1034
- res = nextByRK4(eq_of_motion, delta_t_itg, res, t_step_max);
1035
- }
1036
- res = nextByRK4(eq_of_motion, delta_t_itg, res, t_step_remain);
1027
+ float_t delta_t_itg(t_0_from_t_b); // accumulative time of integration
1028
+ for(; times > 0; --times, delta_t_itg += t_step){
1029
+ res = nextByRK4(eq_of_motion, delta_t_itg, res, t_step);
1037
1030
  }
1031
+ return res;
1032
+ }
1033
+ /**
1034
+ * Calculate absolute constellation(t) based on constellation(t_0).
1035
+ * t_0 is a time around t_b, and is used to calculate
1036
+ * an intermediate result specified with the 2nd argument.
1037
+ * This method is useful to calculate constellation effectively
1038
+ * by using a cache.
1039
+ * @param delta_t time interval from t_0 to t
1040
+ * @param xa_t_0 constellation(t_0)
1041
+ * @param t_0_from_t_b time interval from t_b to t_0 (= t_0 - t_b)
1042
+ */
1043
+ constellation_t constellation_abs(
1044
+ const float_t &delta_t,
1045
+ const constellation_t &xa_t_0, const float_t &t_0_from_t_b) const {
1038
1046
 
1039
- static const float_t omega_E(0.7292115E-4); // Earth's rotation rate, TODO move to PZ-90.02
1040
- return res.rel_corrdinate(
1041
- sidereal_t_b_rad + (omega_E * (delta_t + t_0_from_t_b))); // transform from abs to PZ-90.02
1047
+ float_t t_step_max(delta_t >= 0
1048
+ ? time_step_max_per_one_integration
1049
+ : -time_step_max_per_one_integration);
1050
+ int n(std::floor(delta_t / t_step_max));
1051
+ float_t delta_t_steps(t_step_max * n), delta_t_remain(delta_t - delta_t_steps);
1052
+
1053
+ // To perform time integration from t_0 to (t_0 + delta_t),
1054
+ // n-times integration with t_step_max,
1055
+ // then, one-time integration with delta_t_remain are conducted.
1056
+ return constellation_abs(
1057
+ delta_t_remain, 1,
1058
+ constellation_abs(t_step_max, n, xa_t_0, t_0_from_t_b),
1059
+ t_0_from_t_b + delta_t_steps);
1042
1060
  }
1043
1061
  /**
1044
1062
  * Calculate constellation(t) based on constellation(t_b).
@@ -1046,8 +1064,14 @@ if(std::abs(TARGET - eph.TARGET) > raw_t::sf[raw_t::SF_ ## TARGET]){break;}
1046
1064
  * @param pseudo_range measured pusedo_range to correct delta_t, default is 0.
1047
1065
  */
1048
1066
  constellation_t calculate_constellation(
1049
- float_t delta_t, const float_t &pseudo_range = 0) const {
1050
- return calculate_constellation(delta_t, pseudo_range, xa_t_b, float_t(0));
1067
+ const float_t &delta_t, const float_t &pseudo_range = 0) const {
1068
+
1069
+ float_t delta_t_to_transmit(delta_t - pseudo_range / light_speed);
1070
+ constellation_t res(
1071
+ constellation_abs(delta_t_to_transmit, xa_t_b, float_t(0)));
1072
+
1073
+ return res.rel_corrdinate(
1074
+ sidereal_t_b_rad + (constellation_t::omega_E * delta_t)); // transform from abs to PZ-90.02
1051
1075
  }
1052
1076
  /**
1053
1077
  * @param t_arrival_glonass signal arrival time in glonass time scale,
@@ -1098,7 +1122,37 @@ if(std::abs(TARGET - eph.TARGET) > raw_t::sf[raw_t::SF_ ## TARGET]){break;}
1098
1122
  struct Satellite : public SatelliteProperties {
1099
1123
  public:
1100
1124
  typedef typename SatelliteProperties::Ephemeris_with_GPS_Time eph_t;
1101
- typedef typename GPS_SpaceNode<float_t>::template PropertyHistory<eph_t> eph_list_t;
1125
+
1126
+ struct eph_cached_t : public eph_t {
1127
+ mutable typename eph_t::constellation_t xa_t_0;
1128
+ mutable float_t t_0_from_t_b;
1129
+ eph_cached_t() : eph_t(), xa_t_0(eph_t::xa_t_b), t_0_from_t_b(0) {}
1130
+ eph_cached_t(const eph_t &eph) : eph_t(eph), xa_t_0(eph.xa_t_b), t_0_from_t_b(0) {}
1131
+ using eph_t::constellation;
1132
+ typename eph_t::constellation_t constellation(
1133
+ const GPS_Time<float_t> &t_arrival_gps, const float_t &pseudo_range = 0) const {
1134
+ float_t delta_t(t_arrival_gps - eph_t::t_b_gps);
1135
+ float_t delta_t_transmit_from_t_0(delta_t - pseudo_range / light_speed - t_0_from_t_b);
1136
+
1137
+ float_t t_step_max(delta_t_transmit_from_t_0 >= 0
1138
+ ? eph_t::time_step_max_per_one_integration
1139
+ : -eph_t::time_step_max_per_one_integration);
1140
+
1141
+ int big_steps(std::floor(delta_t_transmit_from_t_0 / t_step_max));
1142
+ if(big_steps > 0){ // perform integration and update cache
1143
+ xa_t_0 = eph_t::constellation_abs(t_step_max, big_steps, xa_t_0, t_0_from_t_b);
1144
+ float_t delta_t_updated(t_step_max * big_steps);
1145
+ t_0_from_t_b += delta_t_updated;
1146
+ delta_t_transmit_from_t_0 -= delta_t_updated;
1147
+ }
1148
+
1149
+ return eph_t::constellation_abs(delta_t_transmit_from_t_0, 1, xa_t_0, t_0_from_t_b)
1150
+ .rel_corrdinate(
1151
+ eph_t::sidereal_t_b_rad + (eph_t::constellation_t::omega_E * delta_t)); // transform from abs to PZ-90.02
1152
+ }
1153
+ };
1154
+
1155
+ typedef typename GPS_SpaceNode<float_t>::template PropertyHistory<eph_cached_t> eph_list_t;
1102
1156
  protected:
1103
1157
  eph_list_t eph_history;
1104
1158
  public:
@@ -1115,7 +1169,7 @@ if(std::abs(TARGET - eph.TARGET) > raw_t::sf[raw_t::SF_ ## TARGET]){break;}
1115
1169
  }
1116
1170
 
1117
1171
  void register_ephemeris(const eph_t &eph, const int &priority_delta = 1){
1118
- eph_history.add(eph, priority_delta);
1172
+ eph_history.add(eph_cached_t(eph), priority_delta);
1119
1173
  }
1120
1174
 
1121
1175
  void merge(const Satellite &another, const bool &keep_original = true){
@@ -1143,7 +1197,7 @@ if(std::abs(TARGET - eph.TARGET) > raw_t::sf[raw_t::SF_ ## TARGET]){break;}
1143
1197
  typename GPS_SpaceNode<float_t>::SatelliteProperties::constellation_t constellation(
1144
1198
  const GPS_Time<float_t> &t, const float_t &pseudo_range = 0) const {
1145
1199
  return (typename GPS_SpaceNode<float_t>::SatelliteProperties::constellation_t)(
1146
- ephemeris().constellation(t, pseudo_range));
1200
+ eph_history.current().constellation(t, pseudo_range));
1147
1201
  }
1148
1202
 
1149
1203
  typename GPS_SpaceNode<float_t>::xyz_t position(const GPS_Time<float_t> &t, const float_t &pseudo_range = 0) const {
@@ -1267,4 +1321,9 @@ typename GLONASS_SpaceNode<FloatT>::u8_t GLONASS_SpaceNode<FloatT>::SatellitePro
1267
1321
  return res;
1268
1322
  }
1269
1323
 
1324
+ template <class FloatT>
1325
+ const typename GLONASS_SpaceNode<FloatT>::float_t
1326
+ GLONASS_SpaceNode<FloatT>::SatelliteProperties::Ephemeris_with_Time
1327
+ ::time_step_max_per_one_integration = 60;
1328
+
1270
1329
  #endif /* __GLONASS_H__ */
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GPS_PVT
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gps_pvt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - fenrir(M.Naruoka)
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-17 00:00:00.000000000 Z
11
+ date: 2022-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake