Skip to content

Commit 65d56a6

Browse files
committed
fix(mock_gps_node): Fix timestamps and vel_ned_valid flag
See PX4/PX4-Autopilot@5d7faef [skip ci]
1 parent 7dc8e74 commit 65d56a6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

gisnav/nodes/mock_gps_node.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,12 @@ def _generate_sensor_gps(self, lat, lon, altitude_amsl, altitude_ellipsoid, head
186186
:param timestamp: System time in microseconds
187187
"""
188188
msg = SensorGps()
189-
msg.timestamp = timestamp
190-
msg.timestamp_sample = 0
189+
msg.timestamp = int(time.time_ns() / 1e3) #timestamp
190+
msg.timestamp_sample = int(timestamp)
191191
# msg.device_id = self._generate_device_id()
192192
msg.device_id = 0
193193
msg.fix_type = 3
194-
msg.s_variance_m_s = np.nan
194+
msg.s_variance_m_s = 10.0 #np.nan
195195
msg.c_variance_rad = np.nan
196196
msg.lat = int(lat * 1e7)
197197
msg.lon = int(lon * 1e7)
@@ -205,18 +205,18 @@ def _generate_sensor_gps(self, lat, lon, altitude_amsl, altitude_ellipsoid, head
205205
msg.automatic_gain_control = 0
206206
msg.jamming_state = 0
207207
msg.jamming_indicator = 0
208-
msg.vel_m_s = np.nan
209-
msg.vel_n_m_s = np.nan
210-
msg.vel_e_m_s = np.nan
211-
msg.vel_d_m_s = np.nan
208+
msg.vel_m_s = 0. #np.nan
209+
msg.vel_n_m_s = 0. #np.nan
210+
msg.vel_e_m_s = 0. #np.nan
211+
msg.vel_d_m_s = 0. #np.nan
212212
msg.cog_rad = np.nan
213-
msg.vel_ned_valid = False
213+
msg.vel_ned_valid = True #False
214214
msg.timestamp_time_relative = 0
215215
msg.satellites_used = np.iinfo(np.uint8).max
216-
msg.time_utc_usec = int(time.time() * 1e6)
216+
msg.time_utc_usec = msg.timestamp
217217
msg.heading = heading
218-
msg.heading_offset = np.nan
219-
# msg.heading_accuracy = np.nan
218+
msg.heading_offset = 0. #np.nan
219+
msg.heading_accuracy = np.nan
220220
# msg.rtcm_injection_rate = np.nan
221221
# msg.selected_rtcm_instance = np.nan
222222

0 commit comments

Comments
 (0)