tessl install tessl/pypi-pynmea2@1.19.0Python library for parsing and generating NMEA 0183 protocol messages used in GPS and marine navigation systems
Agent Success
Agent success rate when using this tile
77%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.12x
Baseline
Agent success rate without this tile
69%
Build a target tracking system that processes NMEA sentences to monitor and analyze tracked targets from radar or AIS systems.
Your system should parse NMEA target tracking data and provide the following capabilities:
Parse Target Position Data: Accept NMEA sentences containing target latitude and longitude information and extract the target's position in decimal degrees.
Extract Tracked Target Details: Process NMEA sentences with comprehensive tracking information including target number, distance, bearing, speed, and course.
Process Own Ship Data: Parse NMEA sentences containing vessel's own heading, course, and speed information.
Calculate Closest Point of Approach (CPA): For tracked targets, extract CPA distance and time-to-CPA from the tracking data.
Implement your solution in src/target_tracker.py with the following functions:
parse_target_position(sentence: str) -> dict: Parse a target position sentence and return a dictionary with keys: target_number, latitude, longitude, timestamp
parse_tracked_target(sentence: str) -> dict: Parse a tracked target sentence and return a dictionary with keys: target_number, distance, bearing, speed, course, cpa_distance, cpa_time
parse_own_ship(sentence: str) -> dict: Parse own ship data and return a dictionary with keys: heading, course, speed
get_closest_target(sentences: list) -> dict: Given a list of NMEA sentence strings, return the target with the smallest CPA distance, or None if no valid tracked targets exist
Python library for parsing NMEA 0183 protocol messages.
"$RATLL,01,5241.123,N,00506.456,E,TARGET1,121505.00,T,*32", the function returns a dictionary with target_number=1, latitude≈52.6854, longitude≈5.1076, and timestamp present @test"$RATTM,01,5.2,135.0,T,2.5,045.0,T,0.8,0.5,N,,T,,*4F", the function returns a dictionary with target_number=1, distance=5.2, bearing=135.0, speed=2.5, course=45.0, cpa_distance=0.8, and cpa_time=0.5 @test"$RAOSD,125.0,A,235.0,N,12.5,A,*77", the function returns a dictionary with heading=125.0, course=235.0, and speed=12.5 @test@generates
def parse_target_position(sentence: str) -> dict:
"""
Parse a target position NMEA sentence.
Args:
sentence: NMEA sentence string containing target position
Returns:
Dictionary with keys: target_number, latitude, longitude, timestamp
"""
pass
def parse_tracked_target(sentence: str) -> dict:
"""
Parse a tracked target NMEA sentence.
Args:
sentence: NMEA sentence string containing tracked target data
Returns:
Dictionary with keys: target_number, distance, bearing, speed,
course, cpa_distance, cpa_time
"""
pass
def parse_own_ship(sentence: str) -> dict:
"""
Parse own ship data NMEA sentence.
Args:
sentence: NMEA sentence string containing own ship data
Returns:
Dictionary with keys: heading, course, speed
"""
pass
def get_closest_target(sentences: list) -> dict:
"""
Find the target with the smallest CPA distance from a list of sentences.
Args:
sentences: List of NMEA sentence strings
Returns:
Dictionary with target data for closest target, or None if no valid targets
"""
pass