Skip to content

Commit 62eb996

Browse files
committed
Updated TPS1000 TMC
1 parent dbba535 commit 62eb996

File tree

2 files changed

+53
-81
lines changed

2 files changed

+53
-81
lines changed

src/geocompy/data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ class INCLINATION(Enum):
10431043
PLANE = 2 # : Model inclination from previous measurements.
10441044

10451045

1046-
class MEASURE(Enum):
1046+
class MEASUREMENT(Enum):
10471047
STOP = 0 # : Stop measurement program.
10481048
DISTANCE = 1 # : Default distance measurement.
10491049
TRACK = 2 # : Track distance.
@@ -1063,10 +1063,10 @@ class EDMMODE(Enum):
10631063
UNDEFINED = 6 # : Not defined.
10641064

10651065

1066-
class FACEDEF(Enum):
1066+
class FACE(Enum):
10671067
"""Instrument view face."""
1068-
NORMAL = 0
1069-
TURN = 1
1068+
F1 = 0 # : Face left.
1069+
F2 = 1 # : Face right.
10701070

10711071

10721072
class FORMAT(Enum):

src/geocompy/tps1000/tmc.py

Lines changed: 49 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@
1515
"""
1616
from __future__ import annotations
1717

18-
from enum import Enum
19-
2018
from ..data import (
2119
Angle,
2220
Coordinate,
2321
toenum,
2422
enumparser,
25-
parsebool
23+
parsebool,
24+
INCLINATION,
25+
MEASUREMENT,
26+
EDMMODE,
27+
FACE
2628
)
2729
from ..protocols import (
2830
GeoComSubsystem,
@@ -56,40 +58,11 @@ class TPS1000TMC(GeoComSubsystem):
5658
Non-successful function termination.
5759
5860
"""
59-
class ONOFF(Enum):
60-
OFF = 0
61-
ON = 1
62-
63-
class INCLINEPRG(Enum):
64-
MEA = 0 # : Measure inclination.
65-
AUTO = 1 # : Automatic inclination handling.
66-
PLANE = 2 # : Model inclination from previous measurements.
67-
68-
class MEASUREPRG(Enum):
69-
STOP = 0 # : Stop measurement program.
70-
DEFDIST = 1 # : Default distance measurement.
71-
TRKDIST = 2 # : Track distance.
72-
CLEAR = 3 # : Clear current measurement data.
73-
SIGNAL = 4 # : Signal intensity measurement.
74-
RTRKDIST = 8 # : Rapid track distance.
75-
76-
class EDMMODE(Enum):
77-
SINGLE_STANDARD = 0, # : Standard single measurement
78-
SINGLE_EXACT = 1, # : Exact single measurement
79-
SINGLE_FAST = 2, # : Fast single measurement
80-
CONT_STANDARD = 3, # : Repeated measurement
81-
CONT_EXACT = 4, # : Repeated average measurement
82-
CONT_FAST = 5, # : Fast repeated measurement
83-
UNDEFINED = 6 # : Not defined
84-
85-
class FACEDEF(Enum):
86-
NORMAL = 0
87-
TURN = 1
8861

8962
def get_coordinate(
9063
self,
9164
wait: int = 5000,
92-
mode: INCLINEPRG | str = INCLINEPRG.AUTO
65+
mode: INCLINATION | str = INCLINATION.AUTO
9366
) -> GeoComResponse[tuple[Coordinate, int, Coordinate, int]]:
9467
"""
9568
RPC 2082, ``TMC_GetCoordinate``
@@ -105,8 +78,8 @@ def get_coordinate(
10578
----------
10679
wait : int, optional
10780
Wait time for EDM process [ms], by default 5000
108-
mode : INCLINEPRG | str, optional
109-
Inclination correction mode, by default INCLINEPRG.AUTO
81+
mode : INCLINATION | str, optional
82+
Inclination correction mode, by default INCLINATION.AUTO
11083
11184
Returns
11285
-------
@@ -173,7 +146,7 @@ def transform(
173146
params[7]
174147
)
175148

176-
_mode = toenum(self.INCLINEPRG, mode)
149+
_mode = toenum(INCLINATION, mode)
177150
response = self._request(
178151
2082,
179152
[wait, _mode.value],
@@ -194,7 +167,7 @@ def transform(
194167
def get_simple_mea(
195168
self,
196169
wait: int = 5000,
197-
mode: INCLINEPRG | str = INCLINEPRG.AUTO
170+
mode: INCLINATION | str = INCLINATION.AUTO
198171
) -> GeoComResponse[tuple[Angle, Angle, float]]:
199172
"""
200173
RPC 2108, ``TMC_GetSimpleMea``
@@ -210,8 +183,8 @@ def get_simple_mea(
210183
----------
211184
wait : int, optional
212185
Wait time for EDM process [ms], by default 5000
213-
mode : INCLINEPRG | str, optional
214-
Inclination correction mode, by default INCLINEPRG.AUTO
186+
mode : INCLINATION | str, optional
187+
Inclination correction mode, by default INCLINATION.AUTO
215188
216189
Returns
217190
-------
@@ -250,7 +223,7 @@ def get_simple_mea(
250223
get_angle
251224
252225
"""
253-
_mode = toenum(self.INCLINEPRG, mode)
226+
_mode = toenum(INCLINATION, mode)
254227
return self._request(
255228
2108,
256229
[wait, _mode.value],
@@ -263,12 +236,12 @@ def get_simple_mea(
263236

264237
def get_angle_incline(
265238
self,
266-
mode: INCLINEPRG | str = INCLINEPRG.AUTO
239+
mode: INCLINATION | str = INCLINATION.AUTO
267240
) -> GeoComResponse[
268241
tuple[
269242
Angle, Angle, Angle, int,
270243
Angle, Angle, Angle, int,
271-
FACEDEF
244+
FACE
272245
]
273246
]:
274247
"""
@@ -325,7 +298,7 @@ def get_angle_incline(
325298
get_simple_mea
326299
327300
"""
328-
_mode = toenum(self.INCLINEPRG, mode)
301+
_mode = toenum(INCLINATION, mode)
329302
return self._request(
330303
2003,
331304
[_mode.value],
@@ -338,13 +311,13 @@ def get_angle_incline(
338311
Angle.parse,
339312
Angle.parse,
340313
int,
341-
enumparser(self.FACEDEF)
314+
enumparser(FACE)
342315
)
343316
)
344317

345318
def get_angle(
346319
self,
347-
mode: INCLINEPRG | str = INCLINEPRG.AUTO
320+
mode: INCLINATION | str = INCLINATION.AUTO
348321
) -> GeoComResponse[tuple[Angle, Angle]]:
349322
"""
350323
RPC 2107, ``TMC_GetAngle5``
@@ -354,8 +327,8 @@ def get_angle(
354327
355328
Parameters
356329
----------
357-
mode : INCLINEPRG | str, optional
358-
Inclination correction mode, by default INCLINEPRG.AUTO
330+
mode : INCLINATION | str, optional
331+
Inclination correction mode, by default INCLINATION.AUTO
359332
360333
Returns
361334
-------
@@ -393,7 +366,7 @@ def get_angle(
393366
get_simple_mea
394367
395368
"""
396-
_mode = toenum(self.INCLINEPRG, mode)
369+
_mode = toenum(INCLINATION, mode)
397370
return self._request(
398371
2107,
399372
[_mode.value],
@@ -460,8 +433,8 @@ def quick_dist(self) -> GeoComResponse[tuple[Angle, Angle, float]]:
460433

461434
def do_measure(
462435
self,
463-
command: MEASUREPRG | str = MEASUREPRG.DEFDIST,
464-
mode: INCLINEPRG | str = INCLINEPRG.AUTO
436+
command: MEASUREMENT | str = MEASUREMENT.DISTANCE,
437+
inclination: INCLINATION | str = INCLINATION.AUTO
465438
) -> GeoComResponse[None]:
466439
"""
467440
RPC 2008, ``TMC_DoMeasure``
@@ -472,10 +445,10 @@ def do_measure(
472445
473446
Parameters
474447
----------
475-
command: MEASREPRG | str, optional
476-
Distance measurement program, by default MEASUREPRG.DEFDIST
477-
mode : INCLINEPRG | str, optional
478-
Inclination correction mode, by default INCLINEPRG.AUTO
448+
command: MEASURE | str, optional
449+
Distance measurement program, by default MEASURE.DISTANCE
450+
inclination : INCLINATION | str, optional
451+
Inclination correction mode, by default INCLINATION.AUTO
479452
480453
Returns
481454
-------
@@ -490,8 +463,8 @@ def do_measure(
490463
get_angle_incline
491464
492465
"""
493-
_cmd = toenum(self.MEASUREPRG, command)
494-
_mode = toenum(self.INCLINEPRG, mode)
466+
_cmd = toenum(MEASUREMENT, command)
467+
_mode = toenum(INCLINATION, inclination)
495468
return self._request(
496469
2008,
497470
[_cmd.value, _mode.value]
@@ -501,7 +474,7 @@ def set_hand_dist(
501474
self,
502475
distance: float,
503476
offset: float,
504-
mode: INCLINEPRG | str = INCLINEPRG.AUTO
477+
inclination: INCLINATION | str = INCLINATION.AUTO
505478
) -> GeoComResponse[None]:
506479
"""
507480
RPC 2019, ``TMC_SetHandDist``
@@ -516,8 +489,8 @@ def set_hand_dist(
516489
Slope distance to set.
517490
offset : float,
518491
Height offset.
519-
mode : INCLINEPRG | str, optional
520-
Inclination correction mode, by default INCLINEPRG.AUTO
492+
inclination : INCLINATION | str, optional
493+
Inclination correction mode, by default INCLINATION.AUTO
521494
522495
Returns
523496
-------
@@ -552,7 +525,7 @@ def set_hand_dist(
552525
if_data_inc_corr_error
553526
554527
"""
555-
_mode = toenum(self.INCLINEPRG, mode)
528+
_mode = toenum(INCLINATION, inclination)
556529
return self._request(
557530
2019,
558531
[distance, offset, _mode.value]
@@ -972,7 +945,7 @@ def set_station(
972945
[station.x, station.y, station.z, hi]
973946
)
974947

975-
def get_face(self) -> GeoComResponse[FACEDEF]:
948+
def get_face(self) -> GeoComResponse[FACE]:
976949
"""
977950
RPC 2026, ``TMC_GetFace``
978951
@@ -983,7 +956,7 @@ def get_face(self) -> GeoComResponse[FACEDEF]:
983956
-------
984957
GeoComResponse
985958
Params:
986-
- `FACEDEF`: Current face.
959+
- `FACE`: Current face.
987960
988961
See Also
989962
--------
@@ -992,7 +965,7 @@ def get_face(self) -> GeoComResponse[FACEDEF]:
992965
"""
993966
return self._request(
994967
2026,
995-
parsers=enumparser(self.FACEDEF)
968+
parsers=enumparser(FACE)
996969
)
997970

998971
def get_signal(self) -> GeoComResponse[tuple[float, int]]:
@@ -1059,7 +1032,7 @@ def get_angle_switch(
10591032
)
10601033
)
10611034

1062-
def get_incline_switch(self) -> GeoComResponse[ONOFF]:
1035+
def get_incline_switch(self) -> GeoComResponse[bool]:
10631036
"""
10641037
RPC 2007, ``TMC_GetInclineSwitch``
10651038
@@ -1069,7 +1042,7 @@ def get_incline_switch(self) -> GeoComResponse[ONOFF]:
10691042
-------
10701043
GeoComResponse
10711044
Params:
1072-
- `ONOFF`: Compensator status.
1045+
- `bool`: Compensator is enabled.
10731046
10741047
See Also
10751048
--------
@@ -1078,12 +1051,12 @@ def get_incline_switch(self) -> GeoComResponse[ONOFF]:
10781051
"""
10791052
return self._request(
10801053
2007,
1081-
parsers=enumparser(self.ONOFF)
1054+
parsers=parsebool
10821055
)
10831056

10841057
def set_incline_switch(
10851058
self,
1086-
compensator: ONOFF | str
1059+
enabled: bool
10871060
) -> GeoComResponse[None]:
10881061
"""
10891062
RPC 2006, ``TMC_SetInclineSwitch``
@@ -1092,8 +1065,8 @@ def set_incline_switch(
10921065
10931066
Parameters
10941067
----------
1095-
compensator : ONOFF | str
1096-
Compensator status to set.
1068+
enabled : bool
1069+
Compensator is enabled.
10971070
10981071
Returns
10991072
-------
@@ -1104,10 +1077,9 @@ def set_incline_switch(
11041077
get_incline_switch
11051078
11061079
"""
1107-
_corr = toenum(self.ONOFF, compensator)
11081080
return self._request(
11091081
2006,
1110-
[_corr.value]
1082+
[enabled]
11111083
)
11121084

11131085
def get_edm_mode(self) -> GeoComResponse[EDMMODE]:
@@ -1129,7 +1101,7 @@ def get_edm_mode(self) -> GeoComResponse[EDMMODE]:
11291101
"""
11301102
return self._request(
11311103
2021,
1132-
parsers=enumparser(self.EDMMODE)
1104+
parsers=enumparser(EDMMODE)
11331105
)
11341106

11351107
def set_edm_mode(
@@ -1155,7 +1127,7 @@ def set_edm_mode(
11551127
get_edm_mode
11561128
11571129
"""
1158-
_mode = toenum(self.EDMMODE, mode)
1130+
_mode = toenum(EDMMODE, mode)
11591131
return self._request(
11601132
2020,
11611133
[_mode.value]
@@ -1164,7 +1136,7 @@ def set_edm_mode(
11641136
def get_simple_coord(
11651137
self,
11661138
wait: int = 5000,
1167-
mode: INCLINEPRG | str = INCLINEPRG.AUTO
1139+
inclination: INCLINATION | str = INCLINATION.AUTO
11681140
) -> GeoComResponse[Coordinate]:
11691141
"""
11701142
RPC 2116, ``TMC_GetSimpleCoord``
@@ -1180,8 +1152,8 @@ def get_simple_coord(
11801152
----------
11811153
wait : int, optional
11821154
Wait time for EDM process [ms], by default 5000
1183-
mode : INCLINEPRG | str, optional
1184-
Inclination correction mode, by default INCLINEPRG.AUTO
1155+
inclination : INCLINATION | str, optional
1156+
Inclination correction mode, by default INCLINATION.AUTO
11851157
11861158
Returns
11871159
-------
@@ -1228,7 +1200,7 @@ def transform(
12281200
params[2]
12291201
)
12301202

1231-
_mode = toenum(self.INCLINEPRG, mode)
1203+
_mode = toenum(INCLINATION, inclination)
12321204
response = self._request(
12331205
2116,
12341206
[wait, _mode.value],

0 commit comments

Comments
 (0)