or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

core-parsing.mddepth-sonar.mdgps-positioning.mdindex.mdnavigation-course.mdproprietary-sentences.mdstream-processing.mdutilities.mdwind-weather.md

navigation-course.mddocs/

0

# Navigation and Course Sentences

1

2

Navigation and course sentences provide heading, bearing, waypoint, and route information for marine and land navigation systems.

3

4

## Heading Sentences

5

6

### HDG - Heading, Deviation and Variation

7

8

```python { .api }

9

class HDG(TalkerSentence):

10

"""Heading, Deviation and Variation."""

11

12

heading: str # Magnetic heading in degrees

13

deviation: str # Magnetic deviation in degrees

14

dev_dir: str # Deviation direction ('E' or 'W')

15

variation: str # Magnetic variation in degrees

16

var_dir: str # Variation direction ('E' or 'W')

17

```

18

19

### HDT - Heading True

20

21

```python { .api }

22

class HDT(TalkerSentence):

23

"""Heading True."""

24

25

heading: str # True heading in degrees

26

hdg_true: str # Always 'T' for true

27

```

28

29

### HDM - Heading, Magnetic

30

31

```python { .api }

32

class HDM(TalkerSentence):

33

"""Heading, Magnetic."""

34

35

heading: str # Magnetic heading in degrees

36

magnetic: str # Always 'M' for magnetic

37

```

38

39

## Waypoint and Bearing Sentences

40

41

### BWC - Bearing & Distance to Waypoint - Great Circle

42

43

```python { .api }

44

class BWC(TalkerSentence):

45

"""Bearing & Distance to Waypoint - Great Circle."""

46

47

timestamp: datetime.time

48

lat_next: str # Next waypoint latitude

49

lat_next_direction: str # 'N' or 'S'

50

lon_next: str # Next waypoint longitude

51

lon_next_direction: str # 'E' or 'W'

52

true_track: str # True bearing to waypoint

53

true_track_sym: str # 'T' for true

54

mag_track: str # Magnetic bearing to waypoint

55

mag_sym: str # 'M' for magnetic

56

range_next: str # Distance to waypoint

57

range_unit: str # Distance unit ('N' for nautical miles)

58

waypoint_name: str # Waypoint identifier

59

```

60

61

### WPL - Waypoint Location

62

63

```python { .api }

64

class WPL(TalkerSentence):

65

"""Waypoint Location."""

66

67

lat: str # Waypoint latitude

68

lat_dir: str # 'N' or 'S'

69

lon: str # Waypoint longitude

70

lon_dir: str # 'E' or 'W'

71

waypoint_id: str # Waypoint identifier

72

```

73

74

## Route Sentences

75

76

### RTE - Routes

77

78

```python { .api }

79

class RTE(TalkerSentence):

80

"""Routes."""

81

82

num_in_seq: str # Total number of sentences in sequence

83

sen_num: str # Sentence number

84

start_type: str # Message type ('c' = complete route, 'w' = working route)

85

active_route_id: str # Active route identifier

86

87

@property

88

def waypoint_list(self) -> List[str]:

89

"""List of waypoint identifiers in the route."""

90

91

@waypoint_list.setter

92

def waypoint_list(self, waypoints: List[str]):

93

"""Set the waypoint list."""

94

```

95

96

### Usage Examples

97

98

```python

99

import pynmea2

100

101

# Parse heading sentence

102

msg = pynmea2.parse("$HCHDG,98.3,0.6,E,12.6,W*57")

103

print(f"Magnetic heading: {msg.heading}°") # 98.3°

104

print(f"Deviation: {msg.deviation}°{msg.dev_dir}") # 0.6°E

105

print(f"Variation: {msg.variation}°{msg.var_dir}") # 12.6°W

106

107

# Parse waypoint bearing sentence

108

msg = pynmea2.parse("$GPBWC,220516,5130.02,N,00046.34,W,213.8,T,218.0,M,0004.6,N,EGLM*11")

109

print(f"Next waypoint: {msg.waypoint_name}") # EGLM

110

print(f"Distance: {msg.range_next} {msg.range_unit}") # 0004.6 N

111

print(f"True bearing: {msg.true_track}°{msg.true_track_sym}") # 213.8°T

112

113

# Parse route sentence

114

msg = pynmea2.parse("$GPRTE,2,1,c,0,PBRCPK,PBRTO,PTELGR,PPLAND,PYAMBU,PPFAIR,PWARRN,PMORTL,PLISMR*73")

115

print(f"Route sentence {msg.sen_num} of {msg.num_in_seq}") # 1 of 2

116

print(f"Route type: {msg.start_type}") # c (complete)

117

print(f"Waypoints: {msg.waypoint_list}") # ['PBRCPK', 'PBRTO', ...]

118

```