File: tnl.py

package info (click to toggle)
python-nmea2 1.19.0-3
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 420 kB
  • sloc: python: 2,948; makefile: 3
file content (122 lines) | stat: -rw-r--r-- 3,404 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# -- TRIMBLE -- #

# pylint: disable=wildcard-import,unused-wildcard-import
from ... import nmea
from ...nmea_utils import *
""" Support for proprietary messages from BD9xx recievers.
    Documentation: www.trimble.com/OEM_ReceiverHelp/v4.85/en/
"""

class TNL(nmea.ProprietarySentence):
    sentence_types = {}
    """
        Generic Trimble Message
    """
    def __new__(_cls, manufacturer, data):
        '''
            Return the correct sentence type based on the first field
        '''
        sentence_type = data[0] or data[1]
        name = manufacturer + sentence_type
        cls = _cls.sentence_types.get(name, _cls)
        return super(TNL, cls).__new__(cls)

    def __init__(self, manufacturer, data):
        self.sentence_type = data[0] or data[1]
        super(TNL, self).__init__(manufacturer, data)


class TNLAVR(TNL):
    """
        Trimble AVR Message
    """
    fields = (
        ('Empty', '_'),
        ('Sentence Type', 'type'),
        ('Timestamp', 'timestamp', timestamp),
        ('Yaw Angle', 'yaw_angle'),
        ('Yaw', 'yaw'),
        ('Tilt Angle', 'tilt_angle'),
        ('Tilt', 'tilt'),
        ('Roll Angle', 'roll_angle'),
        ('Roll', 'roll'),
        ('Baseline Range', 'baseline'),
        ('GPS Quality', 'gps_quality'),
        ('PDOP', 'pdop'),
        ('Total number of satelites in use', 'num_sats'),
    )


class TNLBPQ(TNL, LatLonFix, DatetimeFix):
    """
        Trimble BPQ Message
    """
    fields = (
        ('Empty', '_'),
        ('Sentence Type', 'type'),
        ('Timestamp', 'timestamp', timestamp),
        ("Datestamp", "datestamp", datestamp),
        ("Latitude", "lat"),
        ("Latitude Direction", "lat_dir"),
        ("Longitude", "lon"),
        ("Longitude Direction", "lon_dir"),
        ('Height Ellipsoid', 'height'),
        ('Meters', 'meters'),
        ('Mode fix type', 'mode_fix_type'),
        ('Total number of satelites in use', 'num_sats'),
    )


class TNLGGK(TNL, LatLonFix, DatetimeFix):
    """
        Trimble GGK Message
    """
    fields = (
        ('Empty', '_'),
        ('Sentence Type', 'type'),
        ('Timestamp', 'timestamp', timestamp),
        ("Datestamp", "datestamp", datestamp),
        ("Latitude", "lat"),
        ("Latitude Direction", "lat_dir"),
        ("Longitude", "lon"),
        ("Longitude Direction", "lon_dir"),
        ('GPS Quality', 'quality'),
        ('Total number of satelites in use', 'num_sats'),
        ('DOP', 'dop'),
        ('Height Ellipsoid', 'height'),
        ('Meters', 'meters'),
        ('Mode fix type', 'mode_fix_type'),
    )


class TNLVHD(TNL, DatetimeFix):
    """
        Trimble VHD Message
    """
    fields = (
        ('Empty', '_'),
        ('Sentence Type', 'type'),
        ('Timestamp', 'timestamp', timestamp),
        ("Datestamp", "datestamp", datestamp),
        ('Azimuth Angle', 'azimuth'),
        ('AzimuthTime', 'azdt'),
        ('Vertical Angle', 'vertical'),
        ('VerticalTime', 'vertdt'),
        ('Range', 'range'),
        ('RangeTime', 'rdt'),
        ('GPS Quality', 'gps_quality'),
        ('Total number of satelites in use', 'num_sats'),
        ('PDOP', 'pdop'),
    )


class TNLPJT(TNL):
    """
        Trimble PJT Message
    """
    fields = (
        ('Empty', '_'),
        ('Sentence Type', 'type'),
        ('Coordinate System', 'coord_name'),
        ('Project Name', 'project_name'),
    )