Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/ntrip_client/ntrip_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, logerr=logging.error, logwarn=logging.warning, loginfo=loggin

def connect(self):
raise NotImplementedError("Must override connect")

def disconnect(self):
raise NotImplementedError("Must override disconnect")

Expand All @@ -56,7 +56,9 @@ def reconnect(self):
time.sleep(self.reconnect_attempt_wait_seconds)
elif self._reconnect_attempt_count >= self.reconnect_attempt_max:
self._reconnect_attempt_count = 0
raise Exception("Reconnect was attempted {} times, but never succeeded".format(self._reconnect_attempt_count))
self._logerr('Reconnect failed. Max attempts reached. Shutting down')
self.shutdown()
break
elif connect_success:
self._reconnect_attempt_count = 0
break
Expand Down
7 changes: 4 additions & 3 deletions src/ntrip_client/ntrip_ros_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def run(self):
self._rtcm_timer = rospy.Timer(rospy.Duration(0.1), self.publish_rtcm)

# Spin until we are shutdown
rospy.spin()
while not self._client._shutdown:
rospy.sleep(1)
return 0

def stop(self):
Expand Down Expand Up @@ -128,7 +129,7 @@ def subscribe_fix(self, fix: NavSatFix):
nmea_lat_direction = "S"
if fix.longitude < 0:
nmea_lon_direction = "W"

# Convert the units of the latitude and longitude
nmea_lat = NMEAParser.lat_dd_to_dmm(fix.latitude)
nmea_lon = NMEAParser.lon_dd_to_dmm(fix.longitude)
Expand Down Expand Up @@ -173,4 +174,4 @@ def _create_rtcm_msgs_rtcm_message(self, rtcm):
frame_id=self._rtcm_frame_id
),
message=rtcm
)
)