Topcon .theo file

Help, problems, suggestions about Waterski Homologation software
Brian
Posts: 15
Joined: Fri Nov 25, 2011 3:02 pm

Topcon .theo file

Post by Brian »

I recently had the pleasure of meeting Nigel Talamo in Indonesia. While attending to his homologation duties, he demonstrated to me how he uses the RS232 interface to upload each instrument reading from his Leica total station to Emmanuel's Homologation Program on his laptop and explained some of the workings. Inspired by what Nigel had showed me, I determined to try to connect a Topcon GTS-6A in a similar way. I have the advantage of possessing a copy of the Topcon Interface manual, which was cajoled with difficulty from a Topcon Rep some years ago. A relevant page is attached, which fully explains the format of the measurement string in slope distance mode.
I took one of the provided ".theo" files and modified it to suit the Topcon.
Like most instruments, there are a number of instrument settings which determine the form of the uploaded data string. Examples are:
There are a number of data formats; slope distance mode, horizontal distance mode, vertical and horizontal angle mode, NEZ coordinates mode and 4 others not likely to be of interest here. I usually work in slope distance mode and have developed the attached ".theo" file on that basis. Note that the horizontal distance is included in the string produced in the slope distance mode.
There is a setting which allows the user to choose whether a CR/LF sequence is output at the end of each data string. I have this switched off and have developed the attached ".theo" file on that basis.
The instrument can be set to read in metres or feet which changes the character used as a delimiter or start string for the vertical angle. I use metres and have developed the attached ".theo" file on that basis.
The instrument can be set to read angles in degrees, minutes and seconds, grads or mils. I use degrees, minutes and seconds and have developed the attached ".theo" file on that basis

In relation to the format of Emmanuel's ".theo" files, I make the following points;
The ".theo" files expects a point number. There is no point number in the Topcon string. This does not seem to be a problem.
The measurement string is sent 10 times before an error is generated at the instrument. This does not appear to upset the program. The interface manual indicates that a return sting of ASCII ACK ETX or 06h 03h will confirm the validity of the received data. Alternatively, NAK ETX or 15h 03h will denote invalid data and presumably request a re-send. I included a Return of 06h 03h in the ".theo" file. Never the less, I get 10 copies of the string followed by an error on the instrument. While annoying and requiring additional buttons to be pressed, this does not prevent the system from working.
The data order is different to the entries in the ".theo" file. I assume this does not matter if there is a unique delimiter or start string. It may matter if we have to go to position in the string to extract the horizontal angle.
In relation to the test ".theo file;
The measurement string is being read by the program using the test ".theo" file. The slope distance and vertical angle are being correctly extracted and the correct horizontal distance calculated and inserted into the correct cell.
The extraction of the horizontal angle is the main problem I need to solve. The ".theo" files expect a unique delimiter or start string for each field.The Topcon string uses "+" as a delimiter a number of times and in particular there is no unique start string for the Horizontal Angle. "+" appears at the start of slope distance, horizontal angle, horizontal distance, atmospheric correction and instrument offset. The program is finding the first "+" which occurs before the slope distance and inserting this as the horizontal angle. I need a way to identify the horizontal angle. One way could be an offset from the front of the string. Any suggestions?
It appears that I am unable to upload txt files so will include the sample data and theo file here:
;Topcon BDW 23/11/2011 for GTS-6A
[Com]
; communication parameters. Port is set by dialog from software.
; Baudrate=300 to 115200, databits(or bytesize)=8 or 7, Stopbits=1 or 2, Parity=None, Even, or Odd
;
Baudrate=1200
Databits=7
Stopbits=1
Parity=Even

[Data]
; This total station sends data like this in slope distance mode: See p5 of the interface manual for an explaination.
?+00002162m0940557+2532715d+00002156t60+14+00098
;
;
; Length represent the full length of one set of data, with all angles
; Start and end string should also be counted in length.
; if Length is variable, let it to 0 and define Start and End string
;
; Start string is used to recognize where the data starts.
; if no fix string are used, let it blank
;
; End string is used to recognize where the data ends.
; if not define, then Length should be defined: otherwise, how should I know where it stops ?
;
; Return string should be used if the theodolite needs to know that all data arrived.
;
; use {$0D} (hexadecimal) or {13} (decimal) for ascii char 13
;
Length=50
Start={$3F}
End={$03}
Return={$06}{$03}

[SlopeDistance]
; same as HorzAngle
; "?+" together make a unique start string for slope distance. It is imported correctly.
Start=?+
Length=08
Factor=1000

[VertAngle]
; same as HorzAngle
; Mode=H if 0 on horizon, V if 0 vertical
Start=m
Length=07
Factor=10000
Mode=V

[HorzAngle]
; Start is the string to recognize HorzAngle in data.
; length is the length of the portion of string where HorzAngle should be read,
; starting right after "start"
; Factor is the division factor: if data read 1234567 for angle 123.4567, then Factor should be 10000
; The "+" at the start of the horizontal angle is not unique. It is not imported correctly.
; We need an offset or some other solution.
Start=+
Length=07
Factor=10000

[PointNumber]
; Start is the string to recognize PointNumber in data.
; length is the length of the portion of string where PointNumber should be read
; starting right after "start"
; The topcon string does not have a point number.


Horizontal and Vertical Distance Mode. (1 measurement string repeated 10 times)
R+00002157m0940433+2532714d-00000154t60+14+00013R+00002157m0940433+2532714d-000
00154t60+14+00013R+00002157m0940433+2532714d-00000154t60+14+00013R+00002157m09
40433+2532714d-00000154t60+14+00013R+00002157m0940433+2532714d-00000154t60+14+0
0013R+00002157m0940433+2532714d-00000154t60+14+00013R+00002157m0940433+2532714
d-00000154t60+14+00013R+00002157m0940433+2532714d-00000154t60+14+00013R+000021
57m0940433+2532714d-00000154t60+14+00013R+00002157m0940433+2532714d-00000154t60
+14+00013

Slope Distance Mode. (1 measurement string repeated 10 times)
?+00002162m0940557+2532715d+00002156t60+14+00098?+00002162m0940557+25
32715d+00002156t60+14+00098?+00002162m0940557+2532715d+00002156t60+14+00098?+0
0002162m0940557+2532715d+00002156t60+14+00098?+00002162m0940557+2532715d+000021
56t60+14+00098?+00002162m0940557+2532715d+00002156t60+14+00098?+00002162m09405
57+2532715d+00002156t60+14+00098?+00002162m0940557+2532715d+00002156t60+14+0009
8?+00002162m0940557+2532715d+00002156t60+14+00098?+00002162m0940557+2532715d+0
0002156t60+14+00098
Attachments
Page 5 from the interface manual
Page 5 from the interface manual
topcon2.tif (660.19 KiB) Viewed 73778 times
Brian
Posts: 15
Joined: Fri Nov 25, 2011 3:02 pm

Re: Topcon .theo file

Post by Brian »

Maybe the easiest way to solve the problem would be to allow for wildcard characters in the start string?
Brian
Posts: 15
Joined: Fri Nov 25, 2011 3:02 pm

Re: Topcon .theo file

Post by Brian »

Here is a text version of the page from the interface manual. It is easier to use the scanned image version because of formatting, but it does not appear to be downloading... you may need to cut and paste it into a fixed pitch font environment such as notepad with courier font to get the pointers to align.
Note that the "delimiter" in front of the horizontal angle can be either + or -, but that may be able to be controlled from the instrument by the way it is oriented.
Cheers
Brian

6-2. Data Format
6-2-1. The measurement data from the GTS-6
1) SD mode (ID: 3FH)

?+01178481m0852030+1203040d+01174572t15+00+25099ETX(CRLF)
| | | | | | | | | | | |
| | | | | | | | | | | |
ID SD m/f V H d/g/m HD t/*L P 0 BCC

ID : An identification character which discriminates the
kind of data (ASCII 3FH)
SD : Slope distance 1178.481m (+/-, 8 digits)
m/f : meter/feet
V : Vertical angle 85º20'30" (7 digits)
H :Horizontal angle 120º30'40" (+/-, 7 digits)
( +/- : angle turned to right (+) or left (-) )
d/g/m : degree/grad/mil
HD : Horizontal distance 1174.572m (+/-, 8 digits)
t/* : Tilt correction -- t: yes, *: no
L : EDM return signal level 15 (2 digits)
P :EDM atmospheric correction +00 ppm (+/-, 2 digits)
O : EDM instrument offset +25mm (+/-, 2 digits)
BCC : Block check character 099 (3 digits)
ETX : The ASCII character (03H) to show the end of text
CR : The optional ASCII character (ODH)
LF : The optional ASCII character (OAH)
Note l) The distance data is represented in the unit of 0.001m
or 0.005ft.. The data length is fixed 8 digits.
Note 2) The angle data is represented in the form of xxxº xx'
xx" or in the form of xxx.xxxx grad or xxxx.xxx mil.
The data length is fixed 7 digits.
Note 3) In case of coarse mode, the signal level and the
instrument offset are replaced by "**".
ex.) ?+01178481m0852030+1203040d+01174572t**+00+**096ETX(CRLF)

Page 5 Topcon GTS-6 Interface Manual
Brian
Posts: 15
Joined: Fri Nov 25, 2011 3:02 pm

Re: Topcon .theo file

Post by Brian »

OK, well the forum has scrambled the formatting of my text file above so I will leave it to see if Emmanuel can unscramble my mess :shock:
emmanuel
Site Admin
Posts: 276
Joined: Fri May 20, 2005 8:34 am
Contact:

Re: Topcon .theo file

Post by emmanuel »

Hello Brian,

I think you are the first one trying set a .theo file for a theodolite !
I will check that out and see what I can do.
I can read the attached tiff file by clicking on it.

Regards,
Emmanuel
emmanuel
Site Admin
Posts: 276
Joined: Fri May 20, 2005 8:34 am
Contact:

Re: Topcon .theo file

Post by emmanuel »

Hello Brian,

I made a small change in version 2011.05:
Now the software should read a new parameter from the .theo file in each section:
StartPos=12 specifying the start offset of value in transmitted string.
If this parameter is present in section, "Start=" is not used anymore
This should instruct the software to read the value from char 12, with given "Length".

I made a Topcon.theo file based on yours, with added StartPos parameters, which is included in setup.
If your file have the same name, copy or move it anywhere else: the setup will overwrite it.

I did NOT test it at all.
Please, test it and let me know if it works or not.

Regards,
Emmanuel
Brian
Posts: 15
Joined: Fri Nov 25, 2011 3:02 pm

Re: Topcon .theo file

Post by Brian »

Thanks heaps Emmanuel.
GTS-6A is a total station, but a little old, so not reflectorless.
Will test and advise.
Cheeers
Brian
Brian
Posts: 15
Joined: Fri Nov 25, 2011 3:02 pm

Re: Topcon .theo file

Post by Brian »

On a quick test it works perfectly!
Absolute magic.
Thanks so much!
I'll let you know how it goes when used "in anger" in the field.
cheers
Brian
emmanuel
Site Admin
Posts: 276
Joined: Fri May 20, 2005 8:34 am
Contact:

Re: Topcon .theo file

Post by emmanuel »

ok, great.
If you made some changes in the .theo file, please send me the latest one, to include it in setup.

Emmanuel
Brian
Posts: 15
Joined: Fri Nov 25, 2011 3:02 pm

Re: Topcon .theo file

Post by Brian »

I have made some minor changes to the commenting because there was some legacy comment referring to the problem with the horizontal angle that has now been solved.
Should probably add a description of the new StartPos parameter, though is is fairly self explanitory.

;Topcon BDW EL 23/11/2011 for GTS-6A. See forum discussion started 26/11/11 for more details.
[Com]
; Communication parameters. Port is set by dialog from software.
; Baudrate=300 to 115200, databits(or bytesize)=8 or 7, Stopbits=1 or 2, Parity=None, Even, or Odd
;
Baudrate=1200
Databits=7
Stopbits=1
Parity=Even

[Data]
; This total station sends data like this in slope distance mode: See p5 of the interface manual for an explanation.
; ?+00002162m0940557+2532715d+00002156t60+14+00098{$03}
; ?+[Slope dist.(8)]m[Vert.angle (7)][+/-Horiz.angle(7)]
;
;
; Length represents the full length of one set of data, with all angles
; Start and end string should also be counted in length.
; If Length is variable, set it to 0 and define Start and End string
;
; Start string is used to recognize where the data starts.
; If no fixed strings are used, leave it blank.
;
; End string is used to recognize where the data ends.
; If not define, then Length should be defined: otherwise, how should I know where it stops ?
;
; Return string should be used if the theodolite needs to know that all data arrived.
;
; use {$0D} (hexadecimal) or {13} (decimal) for ascii char 13
;
Length=50
Start={$3F}
End={$03}
Return={$06}{$03}

[SlopeDistance]
; same as HorzAngle
; "?+" together make a unique start string for slope distance. It is imported correctly using Start, but now using StartPos
; Start=?+
StartPos=3
Length=8
Factor=1000

[VertAngle]
; same as HorzAngle
; Mode=H if 0 on horizon, V if 0 vertical
;"m" makes a somewhat dubious start string for slope distance. It is imported correctly using Start,
; but it could be an "f" for feet. Now using StartPos instead.
; Start=m
StartPos=12
Length=7
Factor=10000
Mode=V

[HorzAngle]
; Start is the string to recognize HorzAngle in data.
; length is the length of the portion of string where HorzAngle should be read,
; starting right after "start"
; Factor is the division factor: if data read 1234567 for angle 123.4567, then Factor should be 10000
; The "+" at the start of the horizontal angle is not unique. It was not imported correctly until
; the StartPos parameter was introduced.
; Start=+
StartPos=20
Length=7
Factor=10000

[PointNumber]
; Start is the string to recognize PointNumber in data.
; length is the length of the portion of string where PointNumber should be read
; starting right after "start"
; The topcon string does not have a point number.

--------------------
I have been looking at resolving the error at the instrument. The manual says "The computer must send the ACK back to the GTS-6 within 0.3 sec when the data is
correctly recieved. The communication is terminated when the ACK is recieved." There is a routine for validating the BCC. The behaviour I am getting indicates
that the ACK ETX is not being recieved.
I tried padding the return string with some nulls to induce a delay with no effect. Is there any timing effect being introduced by the program that could be tweeked?

Cheers
Brian
emmanuel
Site Admin
Posts: 276
Joined: Fri May 20, 2005 8:34 am
Contact:

Re: Topcon .theo file

Post by emmanuel »

Brian wrote:I have been looking at resolving the error at the instrument. The manual says "The computer must send the ACK back to the GTS-6 within 0.3 sec when the data is
correctly recieved. The communication is terminated when the ACK is recieved." There is a routine for validating the BCC. The behaviour I am getting indicates
that the ACK ETX is not being recieved.
I tried padding the return string with some nulls to induce a delay with no effect. Is there any timing effect being introduced by the program that could be tweeked?

Cheers
Brian
The program send the return string immediately after receiving EACH data stream.
That might be the problem, as the theodolite transmit data 10 times... then return string might be sent out too soon and too oft.
Are you also sure about your Rs232c parameters ?

Emmanuel
Brian
Posts: 15
Joined: Fri Nov 25, 2011 3:02 pm

Re: Topcon .theo file

Post by Brian »

My understanding is that if the ACK is correctly recieved after the first string, then the other 9 repeats would not be sent.
With respect to the parameters, there are 2 things I'm not quite sure of:
First, the manual says on page 4 there is one start bit, 7 data bits and one stop bit. Specification of a start bit is fairly unusual in my (limited) experience, and I don't know if that is functionally equivilant to two stop bits, or for that matter 8 data bits. A setting of either 1 or 2 stop bits seems to work.
Secondly, there does not seem to be anywhere that specifies the flow contol protocol, ususally a choice of Hardware, Xon/Xoff or None. This may be significant in the timing of the return ACK.
Happy to give something a try if you have any suggestions.
I have attached a copy of the manual just in case someone wants to do something fancy.

Cheers
Brian
Attachments
Topcon GTS-6 Interface Manual.pdf
Topcon GTS-6 Interface Manual
(1.16 MiB) Downloaded 4115 times
emmanuel
Site Admin
Posts: 276
Joined: Fri May 20, 2005 8:34 am
Contact:

Re: Topcon .theo file

Post by emmanuel »

Brian wrote:My understanding is that if the ACK is correctly recieved after the first string, then the other 9 repeats would not be sent.
The return string is (or should be) sent out 10 times, if data are received 10 times.
With respect to the parameters, there are 2 things I'm not quite sure of:
First, the manual says on page 4 there is one start bit, 7 data bits and one stop bit. Specification of a start bit is fairly unusual in my (limited) experience, and I don't know if that is functionally equivilant to two stop bits, or for that matter 8 data bits. A setting of either 1 or 2 stop bits seems to work.
Secondly, there does not seem to be anywhere that specifies the flow contol protocol, ususally a choice of Hardware, Xon/Xoff or None. This may be significant in the timing of the return ACK.
Happy to give something a try if you have any suggestions.
Well, I think xon/xoff should be turned off, if it is not the case. But you could try with and without it.
And you could try different settings with 7 or 8 bits, changing parity, to see if that solve the problem.
Maybe that's a bug from my side, but it is impossible to test, as I don't have anymore a PC with Rs232c, no theodolite... nothing.

Regards,
Emmanuel
Brian
Posts: 15
Joined: Fri Nov 25, 2011 3:02 pm

Re: Topcon .theo file

Post by Brian »

OK. Thanks for the suggestion and feedback.
It is working and that is the main thing.
Regards
Brian
Post Reply