Skip to content

Commit

Permalink
Merge branch 'logdebug' into indigo-devel
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepurvis committed Jul 28, 2014
2 parents 06b83be + 5eb1835 commit 42b15df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/libnmea_navsat_driver/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def __init__(self):
# nmea_string
def add_sentence(self, nmea_string, frame_id, timestamp=None):
if not check_nmea_checksum(nmea_string):
rospy.logwarn("Received a sentence with an invalid checksum. \
Sentence was: %s" % nmea_string)
rospy.logwarn("Received a sentence with an invalid checksum. " +
"Sentence was: %s" % repr(nmea_string))
return False

parsed_sentence = libnmea_navsat_driver.parser.parse_nmea_sentence(nmea_string)
Expand Down
9 changes: 6 additions & 3 deletions src/libnmea_navsat_driver/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import time
import calendar
import math
import logging
logger = logging.getLogger('rosout')

def safe_float(field):
try:
Expand Down Expand Up @@ -110,16 +112,17 @@ def convert_deg_to_rads(degs):
def parse_nmea_sentence(nmea_sentence):
# Check for a valid nmea sentence
if not re.match('^\$GP.*\*[0-9A-Fa-f]{2}$', nmea_sentence):
#print "Regex didn't match"
logger.debug("Regex didn't match, sentence not valid NMEA? Sentence was: %s"
% repr(nmea_sentence))
return False
fields = [field.strip(',') for field in nmea_sentence.split(',')]

# Ignore the $ and talker ID portions (e.g. GP)
sentence_type = fields[0][3:]

if not sentence_type in parse_maps:
#print sentence_type
#print "Sentence type not in parse map"
logger.debug("Sentence type %s not in parse map, ignoring."
% repr(sentence_type))
return False

parse_map = parse_maps[sentence_type]
Expand Down

0 comments on commit 42b15df

Please sign in to comment.