Home
User Manual - TPI - Leica Geosystems
Contents
1. 0 52 Sample 3 viwvicichshtavershmadsmanindchesvbsbsieysinaciwielaaeuebent 52 Console application ccccsecceeceeeeeeeeeeeeees 52 ENE 53 Queuing Traffic JAMS orrororrornrrernnrrrnnnennnn 54 KI 1000 JE 54 3 C Interface 56 vi e Contents User Manual emScon TPI Metrology Division Seica Geosystems Class Interface eee 56 GE SE e E TE 56 SAMIS A EE 57 Sample 4 SpPeECIfICS ccccecceeeceeeeeeeeeteeeeeeees 57 Class TOP Command S savne 58 Receiving Data Sample 4 rrrarernnoranonnrnnarnnnrnnnnnnn 61 CESAPIReceive class Sample 9 cccceeeeeee 61 CESAPIReceive Class Description 62 OCC OU gt eantaisieseenaeoaent 62 Single Point Measure Data Sample 64 KE EG SEE 64 UP 65 Receiving Data Sample 9 rrrarrnarnnannnnrnnarnnnrnnnnnnn 66 ActiveX Component Sample 12 rrurrarnnarnnnenunnnnr 66 RENE EE 67 Keyboard Interface Limitation rrrrrrnrnnennne 68 SIMPE T aaea 68 4 COM Interface 69 High level Interface ccccsseseeeseeeeeeeeeees 69 aliere 0 od OW RE 69 COM vs Low Level Programming 0c00008 71 Registering COM Objects cccccccceeeeeeeeeeeees 12 Visual Basic client nrnnrnnnnnnrnnennnnnennnnnnnnnnne 73 Sample 5 Tutorial rrrrrrarrnrernrrarrnrrrarnnnennnannnennnn 73 Implementing Synchronous Commands Tf Implementing Asynchronous Commands 19
2. The essential methods of the camera OCX are e StartLivelmage e StopLivelmage To alter the default frame rate 15 sec the following methods are used 116 e Chapter 5 e Command Description User Manual emScon TPI Metrology Division Orient To Gravity Procedure Related Command Seica Geosystems e FrameRateStepUp e FrameRateStepDown The following event VideoClick is used void VideoClick double deltaHz double deltavt long posX long posyY long flags This event occurs when clicking on the image with the mouse The event parameters are as follows e DeltaHz deltaVt The angles that can be passed to the MoveHV command in order to move the tracker to the clicked position e PosX posY The pixel values of the clicked position within the image coordinate system top left 0 0 e The flags parameter can be used to figure out which modifier keys are pressed during the click The flags parameter is the same as provided by the OnLButtonDown standard message r See Microsoft MFC documentation for details e Server address and Port number must be passed as properties e An RGB triplet can be passed to alter the color of the crosshair This function is used to measure the tilt of the tracker s primary z axis standing axis with respect to the vertical This can be used to orient the measurement network to gravity The tilt is specified by two angular components about the tracker s in
3. Geosystems A client routine is required which can use the basic functionality provided r See Procedure Measurement on page 126 Procedure The procedure requires the following three Preparation setups 1 Two measurements on a straight line 2 One measurement set on a vertical line 3 One measurement plus or minus 90 to the vertical line Measurements on a l 1 The two measurements must be taken on a Straight Line straight line ray at the same level as the as the Tilting mirror of the Tracker Point A lt 0 5 m and Point B within 5 10 m Measurements on a 2 i i All 3 measurements should be taken in a Vertical Line vertical line 1 Mid point 0 at Tracker head height 2 Upper measurement at 40 deg 3 Lower measurement at 40 deg q During measurements the Birdbath should not point in the direction of measurement 124 e Chapter 5 e Command Description User Manual emScon TPI Metrology Division Measurement 90 to the Vertical Line Geosystems 40 aie TICE G s 3 Setup the tripod at 90 as shown in the graphic below The Tracker is setup such that it can turn to the 90 position without running into stop User Manual emScon TPI Chapter 5 e Command Description e 125 Seica Geosystems Procedure Measurement Metrology Division Set up the tracker F See Integration in Application Software on page 15 for d
4. Geosystems Receiving Data Sample 9 ActiveX Component Sample 12 Metrology Division e Before leaving the application make sure that the TS is set to Stationary Measurements Single point measurement Failure to do so may have unexpected effects upon starting another client q Reboot the Tracker Server in such cases This Sample an EmsyCPPApiConsole client with the CESAPIReceive class in the C TPI implements a safe data reading thread in order to handle clustered and or scattered answer packets correctly in case of a data traffic jam LE See explanations in Sample 3 on page 52 on the multithreaded console application based on WinSocket API vi See also explanations in Sample 4 on page 57 on using a Receiver class similar to CESAPIReceive q This Sample is a minimal single source file and easy to understand in spite of being a multithreaded application T Set the IP address to the actual TS address before building the application This ReflectorCtl sample provides an ActiveX component comprising the most common reflector commands This control skips building up a lookup table for ID Name mapping querying all the defined reflectors from the system and providing the appropriate user interface controls 66 e Chapter 3 e C Interface User Manual emScon TPI Metrology Division Seica Geosystems The Sample contains full source code Visual C and has a compiled com
5. If the user enters x the loop is stopped the TCP IP connection is closed and the application terminates q The TcpIpConnect function is straightforward up to the call of connect Call WSAStartup After connecting call WSAEventSelect which takes the following parameters e A socket handle that has been created before as a global variable e Anevent of type WSAEVENT as a global variable This variable must be initialized with the return value of a WSACreateEvent call e A flags parameter FD READ is passed indicating an interest in data arrival events a realistic application would have to also trap FD_CLOSE events Chapter 2 e C Interface e 53 Seica Geosystems Queuing Traffic Jams Remarks Metrology Division 5 Calling this function will cause the TCP IP framework to signal the passed event whenever data has arrived at the socket 6 The DataRecvThread has an infinite loop with the following statement WaitForSingleObject g_hSocketEvent INFINITE 7 This is a blocking call and causes the loop to stop until the event is signalled to be read The blocking by the WaitForSingleObject is released and the loop passes on 8 Reset the event before available data is read into a buffer 9 Call a function ProcessData that does the interpretation of the buffer There are no provisions to handle traffic jams on the network A real application needs to make provisions to ha
6. User Manual emScon TPI Chapter 6 e Mathematics e 129 Seica Geosystems Transformation Types Metrology Division dilation The accuracy of the nominal and actual points is propagated to the transformation parameters and the transformed points The transformation is a similarity map either given in its forward form T x t Rx s or as an inverse Tlx R slx t with e t 3D translation vector e R 3 3 rotation matrix e s scale These seven parameters are determined such that T actual nominal residual for all points with small residuals in the weighted least squares sense The transformation can be interpreted as a coordinate system with its origin at t and the axes given by the columns of R In terms of the Euler angles In terms of the Euler angles Q K the rotation matrix assumes the form cos K cos sin K cos sin sin K cos Q cos K sin sin Q cos K cos Q sin K sin sin Q cos sin Q sin K sin Q2 cos K sin cos Q cos K sin Q sin K sin cos Q cos cos Q The current implementation fails if 7 2 Asa workaround an arbitrary pre rotation can be applied to one of the point sets Usually transformations are calculated for two purposes e Orientation Fig I amp Fig 2 Alignment of a tracker with respect to a world coordinate system WCS The world coordinate system is either defined at a principal 130 e Chapter 6 e Mathematics User Manual emS
7. Out of a total of 15 parameters which affect the trueness of the tracker geometry the most User Manual emScon TPI Chapter 5 e Command Description e 119 Seica Geosystems Intermediate vs Full Compensation Setup Metrology Division significant changes are affected by these three parameters He See emScon manuals for more information e Transit axis tilt 1 e Mirror tilt c e Vertical index error j Intermediate Compensation refreshes these three parameters by taking a small number of Two face measurements If the result is accepted it updates only these three parameters and takes over the rest of the overall 15 parameters from the last Full Compensation It is a simpler and faster procedure than a Full Compensation Intermediate Compensations do not replace Full Compensations Regular intermediate compensations extend the interval at which full compensations need to be carried out A recommended setup is shown below with a network of fixed targets Based on a given drive library the laser tracker measures the target points automatically and calculates the Intermediate Compensation results approx 2m approx 2m High Horizontal Two face measurements in the vertical plane q The automated Intermediate Compensation routine requires that all target locations are fitted 120 e Chapter 5 e Command Description User Manual emScon TPI Metrology Division Area Required Procedure Requirem
8. The unavailability of LTControl structures prevents masking the data With the byte layout of the data blocks the appropriate bytes can be extracted manually and assigned to basic data types This is not convenient and exceeds the typical Excel programmer s expertise Even with VB although structs are available masking data is not that easy as in C By providing some helper functions data blocks can be copied to appropriate struct parameters instead pointer type casts This allows extracting information of interest from data blocks of type ES DT MultiMeasResullt ES DT MultiMeasResult2 and ES DT Multi6DMeasResult A VB VBA implementation with comments of the ContinuousPointMeasDataReady event handler that demonstrates usage of these functions reads as follows User Manual emScon TPI Chapter 4 e COM Interface e 101 Seica Geosystems 102 Chapter 4 e COM Interface ContinuousPointGetAt Continuous6DDataGetAt may have an impact on performance They have Metrology Division Private Sub LtSync_ContinuousPointMeasDataReady _ ByVal resultsTotal As Long ByVal bytesTotal As Long a continuous point meas packet came in Note that in case of continuous measurements due to multiple points variable size of packet only of results and packet size are passed in which both are not really needed here So we first must GET the data then retrieve information out of the go
9. case ES DT SingleMeasResult SingleMeasResultT pData SingleMeasResultT ptr ASSERT pData gt measMode ES MM Stationary TODO do something with data break case ES DT ReflectorPosResult Not implemented break case ES DT Command break nothing to do default Beep 100 100 all other data currently unhandled switch ProcessData F For further details refer to the sample source code q Limitations for high frequency continuous measurements like loss of data may occur due to hardware LAN PC performance limitations Tests have shown that under good conditions 90 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Known Bugs in ATL Event Sink Implementation Queues and Scattered Data Seica Geosystems LAN PC Client program design the LT Control is able to handle the maximum data rate of 1000 points per second even through the event notification mechanism which might have slightly less performance than the message methods Low performance of Dispatch Interfaces There are currently two known bugs confirmed by Microsoft in VC 6 0 concerning event handlers e Q237771 Events Fail in ATL Containers when Enum Used as Event Parameter e Q241810 DispEventImpl Event Handlers May Give Strange Values Apply one of the workarounds provided in MSDN and in Sample 7 file DataArrived h for a practical application of
10. emScon Tracker Programming Interface i i p User Manual Geosystems F ee eee ee ee ee User Manual emScon TPI Metrology Division Sica Metrology Division Geosystems Preface q These are original instructions and part of the product Keep for future reference and pass on to subsequent holder user of product Read instructions before setting up and operating the hard and software The emScon TPI reference manual and the emScon TPI user manual should always be used together This reference manual contains information protected by copyright and subject to change without notice No part of this reference manual may be reproduced in any form without prior and written consent from Leica Geosystems AG Leica Geosystems AG shall not be responsible for technical or editorial errors or omissions Product names are trademarks or registered trademarks of their respective companies The software described herein is furnished under license and non disclosure agreement and may be used only in accordance with the terms of the sales agreement Leica Geosystems AG Feedback Your feedback is important as we strive to improve the quality of our documentation We request you to make specific comments as to where you envisage scope for improvement Please use the following E Mail address to send in suggestions documentation metrology leica geosystems com Software and version emScon TPL1 5 Manual r
11. return MultiMeasResultT pData MultiMeasResultT vt parray gt pvData ASSERT pData gt lNumberOfResults resultsTotal m pLTConnect gt GetData amp vt for int i 0 i lt pData gt lNumberOfResults i s Format _T 71f 71f T71 pData gt data i dVall pData gt data i dval2 pData gt data i dval3 this is application dependent May differ in your app m pMainWnd gt m edit Result SetWindowText s for OnContinuousPointMeasDataReady e On using a Windows message notification method LTC NM WM Notify it looks quite similar However with the event method there is a unique event function for just receiving continuous results With message notify methods all types of data packets come in through the the same message handler The data must be interpreted with a switch statement This is done in the Process Data function T Use of the CESAPIRecetve class of the C interface is another possibility e The following implementation demonstrates receiving not only data of continuous measurements but also any kind of data 88 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Seica Geosystems LRESULT CCPPClientDlg OnNotifyMsg WPARAM wParam LPARAM lParam CString sS VARIANT vt VariantInit amp vt m pLTConnect gt GetData amp vt wParam msg ID cookie ProcessData vt parray gt pvData wParam retur
12. unique The error message multiple solutions is returned In this case more fixed nominals or parameter constraints are needed to pick a unique solution AddNominalPoint 1 2 3 Fixed Fixed Fixed AddNominalPoint 2 3 4 Fixed Fixed Fixed 0 AddNominalPoint 0 4 2 Fixed Fixed Fixed 0 SetInputParams 0 0 0 0 0 0 1 Unknown Unknown Unknown Unknown Unknown Unknown Unknown In this example redundancy 3 noPoints 7 2 User Manual emScon TPI Chapter 6 e Mathematics e 137 Sica Metrology Division Geosystems S AddNominalPoint 1 1 0 Fixed Fixed Fixed 0 0 0 Pure Dilation AddNominalPoint 1 1 0 Fixed Fixed Fixed 0 0 0 AddNominalPoint 1 1 0 Fixed Fixed Fixed 0 0 0 AddNominalPoint 1 1 0 Fixed Fixed Fixed 0 0 0 aAddActualPoint 1 1 1 1 0 0 001 0 001 0 001 0 0 0 AddActu lPoint l t 1 1 0 0 001 0 001 0 001 0 0 0 aAddActualPoint 1 1 1 1 0O 0 001 0 001 0 001 0 0 0 aAddActualPoint 1 1 1 1 0 0 001 0 001 0 001 0 0 0 setinputParams 0 0 0 0 0 0 1 Unknown Unknown Unknown Unknown Unknown Unknown Fixed In this example the desired transformation is the identity with parameters 0 0 0 0 0 0 1 The length of all residuals is 0 1V2 Their covariance matrix is 10 0 0 covar 0 10 0 0 0 10 The weight matrix is 10 0 0 weight 0 10 0 0 0 10 Thus 2 RSS 4 10 0 1V2 80000 redundancy 12
13. Access on page 97 The essential difference between a VB client and an Excel client is that the Excel sheet takes the User Manual emScon TPI Chapter 4 e COM Interface e 103 Seica Geosystems Sample 11 GetStilllmage Asynchronous interface Metrology Division role of a VB Form That is data input output goes through cells This LtcWin32Client sample demonstrates the GetStilllmage command which requires a camera mounted on the tracker The application skips the physical disk bitmap file The bitmap file contents is read directly into memory buffers and shown on screen This also allows a simple full size scaling option Before application start the system settings flag Has Video Camera must be enabled This sample implements the more complex from programmer s point of view asynchronous interface The complexity comes from the fact that the programmer has to perform the task of synchronizing because command calls are non blocking This is required for data that is non synchronous for example continuous measurements not in this application however F See implementation of synchronous command for GetStillImage in Remarks on page 105 q This sample uses a different method than the relatively complex connection point interface in Sample 7 The connection point interface is a solution when using Visual Basic VBA This is a pure Win32 application and does not use the MFC library This
14. Catching Events and Messages 068 79 Extended Synchronous Functions 05 81 KE SE 82 C Console Application arranrannnnennnnnennnvnnenn 83 SIDC JE pananee nies 83 C Windows MFC Application 84 SG GT EE aetna 84 Source Code DeSCription ccceccseeeeeeeeees 85 Handling Data Arrival Continuous Measurements KN 86 Methods to Catch Packets ccccseceeeeeees 86 Known Bugs in ATL Event Sink Implementation91 Queues and Scattered Data rrrrrrernnnennanennnnner 91 Problem Solution rarrnrrnnrnarenervannnnrnannnnennnnne 92 Cause of Data LOSS rarrranrnanrnnrnnnrnnnrvanenannnnnr 95 Reading Data Blocks with Visual Basic 95 VBA Macro Language Support Excel Word AS enere E A 97 User defined Types the Differences between Visual Basic and VBAQ7 cccccceeeseeeeeeeees 98 CONCIUSION cccccceeceeeceeeeeeeeeeeeeeeeeseeeeeeeeeees 100 Continuous measurements and VBA 65 100 User Manual emScon TPI Contents e vii Sica Metrology Division Geosystems MESKN Ds 101 Scripting Language Support rarrrnrnannnnrnnnnnnennre 103 Excel Control for Tracker Server 0 0 103 SANDE Lave 103 Sample 11 GetStilll mage rrarrnanrnanrnnnnnnrvnnnnnn 104 Asynchronous interface rrrurrnnrnnnrnanevanennre 104 Remarks rrnrnnnnnnnnnnnnnnnvnnnnnnnnnnnnnnvnnnnennnenennnnenene
15. User Manual emScon TPI Chapter 4 e COM Interface e 83 Seica Geosystems Sample 7 ATL COM Message Notifications Metrology Division C Windows MFC Application The LtcCPPClient provides a dialog based MFC C application It uses the synchronous interface but also implements an event sink to catch asynchronous answers continuous measurements and error events Programmers need to be familiar with ATL COM in order to understand the event sink implementation F Refer to a COM book for further details The LtcCPPCIient covers all essential initial steps for a successful system start and accurate results with some disabled code which demonstrates all other variants of notification methods which may be more familiar to programmers than event handling r See comments in source code The disadvantages of message notifications are e The result parameters cannot be received directly e There are only general messages for all types of answers e Usually only the size of a data block is passed with the message e The data block must be first read with GetData except for WM_COPYDATA and then interpreted Interpretation is done with a switch statement with the ProcessData sample code F See Handling Data Arrival Continuous Measurements on page 86 84 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Seica Geosystems This sample also shows one of the featu
16. methods and properties for the respective object Typing a blank or opening bracket behind a method name gives IntelliSense support for all the method s parameters Similar support is available in VC In order to create a command packet the structures defined in the ES_C_API_Def h file need to be translated to Visual Basic Visual Basic uses four 4 Byte alignments by default and a VB long is necessary for a C init A VB integer is only two 2 Bytes and therefore relates to a C short Doubles are eight 8 Bytes in both C and VB To implement the Init Tracker command the following subset of enum translations is provided Enum members VC start with zero 0 as default Explicit values need to be assigned since only subsets of the original C enum types are translated only as far as needed 48 e Chapter 2 e C Interface User Manual emScon TPI Metrology Division Step 4 Implementing the Init Tracker Command User Manual emScon TPI Seica Geosystems Enum ES DataType ES DT Command ES DT Error End Enum Enum ES Command ES C Initialize 7 End Enum Enum ES ResultStatus ES ES AlL1OK ES RS NotImplemented 2 End Enum Further we need the following struct translations Private Type PacketHeaderT lPacketLength As Long type As ES_DataType End Type Private Type BasicCommandCT packetHeader As PacketHeaderT command As ES Command End Type Private Type BasicCo
17. 105 5 Command Description 107 Special Functions nrrannnnvnnnnnnnnnnnnnnnennunnnenne 107 Get Reflectors Command arnununnnnnnnnnnnnnnnnnnnnne 107 Related Commands ccccececeececeeeeeeeeeeeess 107 Comments eee 107 Still Image Command rronrnanennnnnnnnnnrnnannnannnnnnnn 110 Related COMMAMNAS cccececeseceeeecececeeeeeenenees 110 Feide sec asecee ce cacecatecnecente secede hecececseesetesccs 110 Application of GetStilllmage C C 110 COMP BF ow atacacansseqnantsananachoanenanteantesiesernenees 114 Live Image display cccccsecceeceeeceeceeseeesens 115 Live Image Control LTVideo2 0cx 66 115 Registering LTVide02 0CX rrrrrnarnnrrnnrrnarnnnn 115 Development Platforms cccceeeeseeeeeees 116 Server ACCIeSS cccceceeeecececececeaeeeaeaeaeaeaeas 116 Events Methods ccecececececeeeeeeeeeeeeeeeeeeaes 116 Orient To Gravity Procedure rrarrrarrnnnnnnrnnnnnnn 117 Related Command runnnnnnnnnnnnnnnnnnnnnnnnnnenenennn 117 Comments ccccceeececececececececeeeaeaeaeaeaeaeaeaeas 118 Transformation Procedure ccceseeeeeeeess 118 Related Commands ccccececeececeeeeeeeeeeeess 118 Comments 0 ccceeecececececececececeaeaeaeaeaeaeaeaeas 119 Automated Intermediate Compensation 119 Tracker G OMEUTY ccccecceeeceeeseeeeeeeaeeeaees 119 Intermediate vs Full Com
18. 6 6 80000 varianceF actor 13333 3 AddNominalPoint 1 Fixed Fixed Approx 0 3 2 1 Alignment AddNominalPoint 2 3 4 Fixed Fixed Fixed 0 AddNominalPoint 0 Approx Fixed Approx SetInputParams 0 0 0 0 0 0 1 Unknown Unknown Unknown Unknown Unknown Unknown Fixed This is a minimum configuration since redundancy 6 6 0 The approximate coordinates are necessary to select a unique solution from the 8 possible solutions This fact can be easily observed in the following example 138 e Chapter 6 e Mathematics User Manual emScon TPI Metrology Division Box Corner Orientation Using Nivel20 measurements Seica Geosystems AddNominalPoint 0 0 0 Fixed Fixed Fixed 0 0 0 AddNominalPoint 1 0 0 Unknown Fixed Fixed 0 0 0 AddNominalPoint 1 1 0 Unknown Unknown Fixed 0 0 0 Here each of the Euler angles can be 0 or n The scale must be fixed in 3 2 1 situations Otherwise the solution 1s undetermined The corner of a box is defined by three mutually perpendicular planes Each plane contains two measured points Only the nominal coordinate defining the plane is exactly known AddNominalPoint 0 1 1 Fixed Approx Approx 0 0 0 AddNominalPoint 0 2 2 Fixed Approx Approx 0 0 0 AddNominalPoint 1 0 1 Approx Fixed Approx 0 0 0 AddNominalPoint 1 0 2 Approx Fixed Approx 0 0 0 AddNominalPoint 1 1 0 Approx Approx Fixed 0
19. COM Interface User Manual emScon TPI Metrology Division User Manual emScon TPI Leica Geosystems LTC_NM_Event as first parameter This setting allows catching the continuous measurement packets through the event mechanism This is especially convenient for Visual Basic Use one of the Windows Messages notification methods Fi See Sample 7 on page 84 as shown disabled in the code These may be methods preferred with VC clients especially if the programmer is not familiar on setting up event sinks On the other hand receiving Windows messages within VB application is permissible The MultiMeasResultT structure only covers the first item of the array The rest of the INumberOfResults 1 array elements are padded to the packet without gaps Continuous measurement packets mostly contain more than one measurement value Iteration through an array of measurements is necessary A code fragment on how to process a continuous measurement packet using the event mechanism is shown below This is a client implementation stripped down and altered from sample 7 of the ContinuousPointMeasDataReady event which exists for both ILTCommandSyncEvents and _ILTCommandAsyncEvents interfaces Chapter 4 e COM Interface e 87 Sica Metrology Division Geosystems void __stdcall OnContinuousPointDataReady long resultsTotal long bytesTotal CString VARIANT vt VariantInit amp vt if m_pLTConnect NULL
20. Client Applications Implements a lightweight C TPI client application with no graphical interface variant overhead or MFC or ATL This sample fits into a single file with 350 lines of code including comments and empty lines and compiles into a 48KB executable file q This sample implements only Initialize Tracker and Start Measurement for single points and requires events threads and Winsock API functions This EmsyCApiConsoleClient is not presented as a tutorial The VC AppWizard or a text editor can be used to create a Console Application skeleton and to implement the C standard entry function int main int argc char argv Add all the source code save the file c or cpp extension and invoke the C compiler from the command line 52 e Chapter 2 e C Interface User Manual emScon TPI Metrology Division Seica Geosystems Comments These comments refer to the file EmsyCApiConsoleClient cpp The following include files are required Oo Windows h need not be included include lt stdio h gt standard C input output include lt Winsock2 h gt win32 socket stuff User Manual emScon TPI 1 The main function first does a TCP IP connection by calling the function TcpIpConnect starts the Data Receiver thread and enters an endless User Interface loop This loop looks for user input of one of the two TPI commands 1 for Initialize Tracker and m for Start Measure
21. Commands 2 Deriving a class for sending commands Key difference to Sample 1 1 Create a new class named for example CESCppClientApiCommand which is derived from the base class CESAPICommand and add to project This gives a new file pair EsCppClientApiCommand h cpp 2 The core of this class declaration reads as follows 58 e Chapter 3 e C Interface User Manual emScon TPI Metrology Division Seica Geosystems define ES USE EMSCON NAMESPACE include ES CPP _ API Def h class CMSWinsockControl class CESCppClientApiCommand public EmScon CESAPICommand public CESCppClientApiCommand virtual CESCppClientApiCommand m_pWinSockCtrl pwinSockCtrl protected CMSWinsockControl m pWinSockCtrl COleVariant PackIntoVariant void pData UINT sizeOfData void SetSocketPtr CMSWinsockControl pWinSockCtrl bool SendPacket void pPacketStart long lPacketSize virtual override F 3 For programming convenience the class has a member variable pointing to the Winsock control including an initialization function The Variant packing helper has been designed as a protected member function of this class Fk See Sample 1 Tutorial on page 30 for more information Winsock Control 3 Based on the Winsock control the implementation of SendPacket reads as follows q This function is dependent on MSWinSockCtrl SendPacket function and connect disconnec
22. Computation 135 Transformation Parameters c eceeeeeee 135 Transformed Points and Residuals 135 SIU ere 136 2 10 9 EE 137 Standard Case with 3 Points rarnnnrnrnennnnnne 137 Pure Dilation rarannnnnnnnnnnnnnnnnnnnennnnnnnennenenene 138 3 2 1 Alignment rranrnnrnnrrnnrnnnrnnvnnrnnnnnnnnnnnnne 138 Box NM 139 Orientation Using Nivel20 measurements 139 7 Appendix 140 TPI File Listing rrnnnnnnrnnennnnnennnnnnnnnennnnnnnnnnnnen 140 Programming Interface Defining Files 140 User Manual emScon TPI Contents e ix Metrology Division Seica Geosystems 1 Introduction Hardware Programming Environment TCP IP Communication Prerequisites The tracker programming interface TPI supports the following laser trackers e LT300 e LT500 amp LTD500 e LT600 amp LTD600 e LTD700 e LT800 amp LTD800 This manual notation samples tutorials is based on Microsoft Visual Studio 6 0 VC 6 0 Visual Basic 6 0 running on Microsoft Windows 98 NT 2000 For Unicode applications install VC with Unicode libraries custom installation Linker runtime errors such as mfc42u lib mfc42ud lib or mfc42u dll missing indicate that VC was installed without Unicode support TCP IP communication functions are not part of the TPI and have to be provided except when using the high level TPI The TCP IP API functions
23. Geosystems A successful Intermediate Compensation procedure returns the following information e Total RMS e Max Deviation e Error bit filed with the information of warnings and errors An intermediate compensation is recommended when the maximum deviation is lt 0 0012 deg 13 With the command SetCompensation the new calculated compensation can be activated A field check is a control process of the Compensation parameters It checks the condition of the Leica Tracker with respect to predefined parameters It does not however provide for compensatory corrections If the tracker is used in a stationary position conduct the field check on a weekly basis If the field check results show no change over a period of six weeks carry out field checks at least once a month If the tracker has been moved always carry out a field check before taking measurements q Compensations and field checks must be carried out in normal working conditions under which the measurements are taken Two face measurements with 4 to 5 reflector positions distributed over the whole object range will indicate whether the Tracker compensation is within specifications To achieve a 2 sigma accuracy 95 of the measurements must be within the specification The Tracker Server Programming Interface does not have a specific two face measurement mode User Manual emScon TPI Chapter 5 e Command Description e 123 Sica Metrology Division
24. True evaluates to 1 Always test the variable directly or against Not False 82 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Seica Geosystems Obj Sync GetContinuousDistanceModeParamsEx dataout Example i dataout bUseRegion Then MsgBox bUseRegion is True End If or If Not dataout bUseRegion False Then MsgBox bUseRegion is True End If are both correct However the following would evaluate to a wrong result If dataout bUseRegion True Then MsgBox bUseRegion is True No message even flag true End If C Console Application Sample 6 This is only a test demo application made up of one source file function it should be easy to understand without further comments e The LicConsoleClient provides a minimal Tracker Server application based on the LTControl COM component e Itis designed as a so called Console Application and consists of only about 15 lines of code to direct the tracker to a certain point and measure it e Set the hard coded values IP address coordinates for the Tracker Server Synchronous Calls This type of application only handles pure synchronous calls Receiving Windows messages is not possible for a console application Implementing an event sink is possible but requires some advanced programming knowledge q Include files from the C or C TPI are not required TPI information is provided by importing LTControl tlb
25. applications more efficient ways to extract continuous measurements exist User Manual emScon TPI Metrology Division Scripting Language Support Sample 8 Seica Geosystems VBA applications depending on data processing may not have enough performance when using continuous high data rates Always run compiled versions In special cases the incoming results need to be buffered Use of values instead of symbols in Visual Basic avoids the problem of typing incorrect enum symbols which cause errors difficult to detect q A complete tlh file is automatically generated when importing LTControl tlb into a VC project Pure scripting languages VBS Visual Basic Script JavaScript etc are currently not supported by the LTControl COM component This would require Dispatch interfaces rather than custom interfaces Combinations of Dispatch and custom interfaces dual interfaces have the same disadvantage as Dispatch lack of performance Excel Control for Tracker Server This sample works only with Excel 2000 and consists of an Excel sheet with a VBA macro LtcExcel Tracker server client VBA programming with Excel 97 Office 97 is not recommended The variant LtcExcelWithImage2 xls is an extended version of the LicExcel xls application and includes Still Video Image support This feature requires the tracker being equipped with a video camera See VBA Macro Language Support Excel Word
26. are initialized with the properties of LTConnect 2 Inthe Form_Load function connect to Tracker Server and select the desired notification method 3 If ConnectEmbeddedSystem has succeeded no exception thrown an LTCommand object has been created 4 Initialize the pointers by calling Set ObjSync ObjConnect ILTCommandSync Set ObjAsync ObjConnect ILTCommandAsync 5 Do not reference ObjConnect ILTCommandSync OR ObjConnect ILTCommandAsync before the ObjConnectConnectEmbeddedSystem call User Manual emScon TPI Chapter 4 e COM Interface e 75 Sica Metrology Division Geosystems 6 The COM methods throw exceptions in case of failure The Form_Load subroutine shown below also shows how to handle them try catch for Visual Basic 7 Add an error handler as shown below in every handler function that deals with the COM objects Do not use a global error handler Unhandled exceptions will lead to program abort 8 The initial code for every Tracker Server Visual Basic client has to be as shown below except the SelectNotificationMethod 9 Use the Form Load subroutine as template code for other VB TPI clients 10 Set the IP address of the Tracker Server Private Sub Form Load On Error GoTo ErrorHandler ObjConnect ConnectEmbeddedSystem 127 34 8 161 700 This call may have different parameters in another project ObjConnect SelectNotificationMethod LTC_NM Event 0 0 NEVER FORGET THIS Not
27. controls and assigning shortcuts to dialog controls Error handling Errors should be handled exhaustively Provisions should be made for all possible errors Error messages should be defined as resources instead of hard coded strings Implement exception handling where it applies try catch Make provisions for network traffic jams and receiving buffers of constant size When the buffer is completely filled upon a read operation it is very likely that part of the last packet will be distributed over the buffer boundary That is part of the packet will not become available before the next Read call q The buffer size variant array is allocated dynamically in this sample r See Queues and Scattered Data on page 91 for details Using the MSWinsock control is very convenient together with VC ClassWizard etc A problem however may be its performance COM interface and Variant copy An MSWinsock based application may not be able to carry high frequency continuous measurements For such high Chapter 2 e C Interface e 45 Seica Geosystems Essential code Build Sample 1 TCP IP address Sample 2 Tutorial TCP IP Step 1 Adding a Winsock Control and Designing a Form Metrology Division performance applications use of low level C C TPI is recommended in combination with a high performance TCP IP communication library e All essential code is concentrated in only two files EmsyCApi
28. disk file can be skipped and a memory mapped file can be used instead OR With the file structure of the Bitmap file the bitmap information can be extracted from the data block and used directly with GDI functions In the code above it was assumed that pData contained a complete GetStilllmageRT structure with complete file data padded Chapter 5 e Command Description e 111 Seica Geosystems WinSock2 API MFC CasyncSocket COM TPI within C C Metrology Division e Using WinSock2 API or MFC CasyncSocket to read directly from the socket must consider the implications of large file data e Since the file data is relatively big 70 KB it is very unlikely that it will arrive as one single data block over TCP IP e Provisions must be made to repeat reading data until the data packet is complete e A technique to achieve this is shown in the OnMessageReceived code sample F See Queues and Scattered Data on page 91 r See also receiver thread in Receiving Data Sample 9 on page 66 When using the COM TPI within a C C application the results of the LTControls GetStilllmage synchronous function can be assumed to be complete See related code extract below When receiving Stilllmage data asynchronously Event Handler MessageHandler the difference is that the data will not be provided directly through a parameter So ILTConnect GetData must be used first q Note the Variant type parameter of
29. e 33 Seica Geosystems Metrology Division 3 Add the following 7 pushbuttons and the related message handlers to the dialog template q In order to correspond with the Sample 1 source code the following names are recommended Button Caption Button ID Name of Message handler DC BUTTON on puttonconne Disconnect IDC BUTTON OnButtonDiscon DISCONNECT nect INIT Laser Pointer IDC BUTTON OnButtonPointl POINTLASER laser Find Reflector IDC BUTTON OnButtonFindre FINDREFLECT flector Set Reflector IDC BUTTON OnButtonSetrefl SETREFLECTO ector Start Meas IDC BUTTON OnButtonStartm STARTMEAS eas 4 Add two Statics and relate them to appropriate member variables type Control Member variable name IDC STATIC STATUS m staticStatus 5 Eliminate the captions of these Statics 6 Check the sunken property to make then visible Their size should permit three 3 34 e Chapter 2 e C Interface User Manual emScon TPI Metrology Division Seica Geosystems coordinate values Result or a three 3 digit number Status A label static may be added with caption Status in front of the status field No member variable need be added and no change of the ID is necessary 7 The dialog template should now look as follows Connect rit Trackes Set Bellecto Start Meas Dkconnecd Laser Pointer Find Reflector l 8 Status Step 5 The EmsyCApiC
30. for ease of handling q Note the statements to display return status numbers 0 OK non zero errors and measurement results to the appropriate static controls of the dialog 42 e Chapter 2 e C Interface User Manual emScon TPI Metrology Division User Manual emScon TPI Seica Geosystems bool CEmsyCApiClientDlg ProcessData CString sStatus s ProcessData is a parser for the incoming data When ProcessData is being called we can assume that complete m_vtData parray gt pvData points to a valid and answer block just an array of bytes Next we must mask this data block with BasicCommandRT in order to figure out type Once the type for example ES _ DT SingleMeasResult is known we can mask it with the appropriate structure e g SingleMeasResultT mask arrived data with RT structure in order to figure out type status PacketHeaderT pData switch PacketHeaderT m vtData parray gt pvData pData gt type case ES DT Command command type answer arrived break BasicCommandRT pData2 BasicCommandRT m vtData parray gt pvData switch pData2 gt command FI here you may treat answers individually as needed Within this sample we just do a general handling for all command answers Thus the switch pData gt command block could be entirely omitted It is just here for documentation p
31. indices will range from 0 to 2 when the three names are entered in a control list box in the order shown above A lookup table is therefore required to match the index values to the reflector IDs Such a lookup table is shown below Index ID 0 1 2 q The call to SetReflector must pass the reflector ID not the list box index A frequent source of a programming error The reflector name is always in Unicode format irrespective of whether the application is in Unicode or ANSI q Names in C C applications may have to be converted accordingly User Manual emScon TPI Chapter 5 e Command Description e 109 Seica Geosystems Still Image Command Related Commands Preconditions Application of GetStilllmage C C Metrology Division r See Sample 7 on page 84 which implements reflector handling with a list box It uses a MFC Map as a lookup table Simpler solutions exist with just an integer array r See also Sample 7 on page 84 or Receiving Data Sample 9 on page 66 on how to interpret reflector names in Unicode format correctly For trackers equipped with an Overview Camera the GetStilllmage command takes an image and delivers it as a file image data block e GetStilllmage e SetCameraParams e GetCameraParams e StilllmageGetFile COM not in C e WriteDiskFile COM only q These commands are available on all TPI levels C C COM Set GetCameraParameters is not explain
32. measurement accuracy A change of 1 C causes a measurement difference of Ippm A change of 3 5mbar causes a measurement difference of Ippm User Manual emScon TPI Metrology Division Set Reflector Set Temperature Range Definition Definition Select a specific reflector Definition The laser s mode of operation depends on external temperature Select one of the following temperature ranges corresponding to your application Low 5 20 C Medium 10 30 C High 30 40 C User Manual emScon TPI Seica Geosystems Comment Change environmental parameters when significant changes take place Default values 20 0 C 1013 3mbar Comment A wrong reflector results in a wrong initial IFM distance e g when using the Go Birdbath command This has a direct influence on the absolute positioning accuracy of the measurement network ADM measurements are inaccurate due to the different reflector constants Tooling ball reflector TBR 5 310 mm Cat eye 59 114 mm Comment The Laser Startup Mode is set by default to medium 10 30 C When the external temperature exceeds this range the system tries to stabilize the interferometer During this process 10 20 minutes no measurements can be taken Green LED on the Chapter 1 e Introduction e 19 Seica Geosystems Station Parameters Transformation Parameters Definition Definition The station
33. one of the workarounds provided When the Tracker Server delivers more data through the TCP IP network than the client is able to process it results in traffic jams Although the TCP IP network buffers such data up to the configured buffer size single data packets will be queued That is there are no more gaps between the data packets When the client is notified from the TCP IP communication framework that data has arrived it has to react to this notification by a Read call depending on your communication tools this can be recv GetData CAsyncSocket Receive etc These read functions are not able to recognize packet boundaries Read functions read all data that is currently available In practice the data will be read in one read cycle limited to a certain buffer size User Manual emScon TPI Chapter 4 e COM Interface e 91 Seica Geosystems Problem Solution Metrology Division q These might be several combined packets or only a fraction of a trailing packet 1 Provide a sufficient read buffer and read all that is currently pending The client application parses the data block into packets using the header information and size of each packet With a fragmented last packet the next read cycle is started and the two fragments from the previous and the current reading are assembled together This is probably the most efficient method since it minimizes the number of reading interrupts However
34. parameters describes the translation and rotation of the tracker station in a coordinate system X Y Z Omega Phi Kappa Definition A transformation describes a change into another coordinate system which is different from the tracker coordinate system It has the following parameters X Y Z Omega Phi and Kappa and scale factor information 20 e Chapter 1 e Introduction Metrology Division Comment tracker blinks Switch mode to low or high Comment In case the station parameters are not set explicitly TPI will set the parameters as follows X 0 Y 0 Z 0 Omega 0 Phi 0 Kappa 0 Comment The object coordinate system is located in the measured object which may correspond to the coordinate system of the design Either a controlled orientation or a transformation can create the object coordinate system Data is created in the object coordinate system if the transformation parameters are applied to the TPI In case these parameters are not set the TPI will deliver the data based on the tracker coordinate system X 0 Y 0 Z 0 Omega 0 Phi 0 Kappa 0 Scale 1 Fi See Mathematics on page 129 for more User Manual emScon TPI Metrology Division Coordinate Definition System Type Selects the coordinate system type RHR LHR X LHR Y LHR Z CCW CCC SCW SCC User Manual emScon TPI Seica Geosystems Comments The TPI delivers the data in the current coordinate
35. result in large point residuals RMS Maxdev and variance factor To fix some or all components of the translation vector the coordinate type must be Cartesian The command Call Transformation returns a structure Call TransformationRT containing the seven parameters of the transformation translation Euler angles and scale together with their standard deviations The standard deviation of a fixed parameter is zero 0 The command GetTransformedPoints returns a list of structures each containing a transformed point together with its covariance matrix and the three coordinates of the residual vector User Manual emScon TPI Chapter 6 e Mathematics e 135 Seica Geosystems Statistics RMS of Residuals Maximum Deviation Weighted Residual Square Sum Metrology Division residual nominal transformed The covariance matrix of the residual is obtained by adding those of the nominal and the transformed point The command CallTransformation also returns the e RMS of residuals e Maximal deviation e Variance factor The RMS of residuals is defined as gt residual i i l nokEquations RMS where the number of equations is the number of fixed or weighted nominal coordinates Only those components of the residual vector corresponding to a fixed or weighted nominal coordinate are taken into account The maximum deviation is defined as maxDev max residual i 1 n Only fixed and weig
36. server is set to stationary when triggering this command and the laser beam is attached to a reflector The result as a synchronous answer can be shown directly in a message box only x y and z are shown 78 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Implementing Asynchronous Commands Catching Events and Messages Seica Geosystems Private Sub StartMeas Click Dim x As Double Dim y As Double Dim z As Double Dim d As Double d is a dummy variable Dim b As Boolean On Error GoTo ErrorHandler ObjSync MeasureStationaryPoint x y Zz qd d d d d d d d d qd d d d d O MsgBox x amp CStr amp y amp CStr amp Z Exit Sub ErrorHandler MsgBox Err Description End Sub q If this command was an asynchronous call it would not be possible to display the result within this function A result display is performed in the appropriate asynchronous answer handler Y For other calls refer to Sample 5 source code Visual Basic with IntelliSense provides support for the available functions of an interface with the function parameters 1 Add a button named InitAsync caption Init Tracker async The command handler should be completed with the following code Private Sub InitAsync_Click On Error GoTo ErrorHandler ObjAsync Initialize Exit Sub ErrorHandler MsgBox Err Description End Sub In contrast to the synchro
37. server using the TCP IP SendData function or whatever this function is called Depending on the TCP IP communication library used the data packet may need to be packed into a Variant vrtData variable followed by a SendData vrtData call Alternatively a Send function takes the address and size of the data packet variable Send amp data sizeof data The SendData function does not wait for the Tracker Server tracker to complete the requested action SendData will return immediately On completion of the requested action the tracker server sends an answer to the client Depending on the command it may take a few seconds between sending the command and receiving an answer This requires some type of notification or callback mechanism That is as soon as data arrives from the Tracker Server some sort of event needs to trigger a ReadData procedure in the client application Depending on the TCP IP communication this notification could be a Windows Message an Event or a Callback Function q This type of communication is asynchronous User Manual emScon TPI Chapter 2 e C Interface e 25 Seica Geosystems Asynchronous 9 Communication Metrology Division From the programmer s point of view asynchronous communication is much more difficult to handle than synchronous communication The programmer must ensure not to send anew command until the answer of the previous one has returned commands mi
38. staticStatus SetWindowText sStatus break case Todo add other answer cases default return false break switch pData gt type return true ProceessData q Single points can be measured and displayed in the dialog Set Reflector followed by a Find Reflector must be called before a measurement is triggered The application must have provisions to prevent pressing another button before an answer has arrived Some commands may be queued An answer has arrived when the status code is displayed The command is OK when code is zero 0 The Tutorial sample does not fully handle these errors r If the code is a number refer to the Tracker Software reference manual This sample demonstrates the C TPI together with C clients and an MFC using Windows application Writing in C is still an option for non Windows or non Win32 applications Further issues to be considered in a real application User Manual emScon TPI Metrology Division Interface Design Error Handling Network Traffic Jams MSWinsock Control User Manual emScon TPI Seica Geosystems User interface design Grayed out controls depending on context Lock buttons in a situation when it is not appropriate to press them Graying out all buttons during the time gap between commands sent and answer received is recommended for asynchronous communication Other design issues include proper TAB order of the
39. system type By default the tracker system will work in the right handed rectangular coordinate system RHR type 3D rectangular coordinates are defined by 3 mutually perpendicular axes X Y and Z given in the order X Y Z Since the axes can be arranged in two different ways right and left handed systems are defined according to the convention illustrated in a simple 2D case Cylindrical Clockwise CCW Cylindrical Counter Clockwise CCC In a cylindrical system the X and Y values are expressed in terms of a radial distance offset from the Z axis and a horizontal angle of rotation The Z coordinate remains the same Spherical Clockwise SCW Spherical Counter Clockwise SCC Chapter 1 e Introduction e 21 Seica Geosystems Definition 22 e Chapter 1 e Introduction Metrology Division Comments In a spherical system a point is located by a distance and two angles instead of the 3 coordinate values along the rectangular axes For axes labeled XYZ with Z vertical the point is located by its distance from the origin horizontal angle in the XY plane and zenith angle measured from the Z axis User Manual emScon TPI Metrology Division Seica Geosystems 2 C Interface Introduction TCP IP Connection Sending Commands Low level programming Before designing the client application refer to the ES C API Def h file The C TPI is a pure collection of enumeration types
40. the fileData Fk See Application of GetStilllmage C C on page 110 112 e Chapter 5 e Command Description User Manual emScon TPI Metrology Division GetStilllmage Synchronous Leica Geosystems void CCPPClientDlg OnButtonStillImage HRESULT hr 0 long 1FileSize VARIANT vt Variantinit ev lt try if hr m pLTCommandSync gt GetStillImage ES SI Bitmap amp lFileSize amp vt S_OK ASSERT vt parray gt rgsabound 0 cElements unsigned long 1FileSize FILE pFile NULL write file to current runtime location if pFile fopen image bmp wb NULL long lWritten fwrite vt parray gt pvData 1 1FileSize pFile if lWritten 1FileSize AfxMessageBox _T File could not be written n fclose pFile Display the image using MSPaint but first close previous instance HWND hWnd FindWindow _T MSPaintApp NULL if hWnd paint is already running close first SendMessage hWnd WM_SYSCOMMAND SC CLOSE 0 WinExec mspaint exe image bmp SW SHOWNOACTIVATE if if catch com error amp e Beep 4000 100 AfxMessageBox LPCTSTR e Description VariantClear amp vt Avoid memory leak User Manual emScon TPI Chapter 5 e Command Description e 113 Sica Metrology Division Geosystems GetStilllmage void __stdcall OnStillImageDataReady ES StillImageFileType Asynchronous image
41. the application form default name Winsock1 q Do not change the default name Right mouse click the Winsock control icon on the form Select Properties Enter the IP address or hostname of the Tracker Server in the RemoteHost field and the port number 700 to RemotePort Leave the other settings as they are Add three buttons to Form Winsock1 Connect Disconnect and Init Tracker Add a sunken label named AnswerStatus The form reads as follows Double click the Connect button This adds a handler and switches the focus directly to the appropriate source location Insert one line of code Winsock1 Private Sub Connect Click Winsockl Connect End Sub IP Address 2 User Manual emScon TPI If IP address and port number have not been passed through the properties Chapter 2 e C Interface e 47 Seica Geosystems Winsock Step 3 Translate the C enums and Structs to VB Metrology Division vi See Point 7 Step 1 Adding a Winsock Control and Designing a Form on page 46 Use the Connect call to insert address and port number of the Tracker Server Winsock1 Connect 193 8 34 133 700 4 Double click the Disconnect button on the form and complete the handler as follows Private Sub Commandl Click Winsockl Close AnswerStatus Caption Just for cosmetics End Sub 5 Entering Winsock1 As soon as dot is entered a dropdown list offers all available
42. to be read is passed as a parameter to OnDataArrivalWinsock1 handler An OnDataArrivalWinsock1 call requires the Winsock control s GetData function m winSockCtrl GetData amp m vtData vtType vtMaxlen GetData Function 5 The address of a variant must be passed as first parameter since the data is delivered as a variant To avoid frequent allocation deallocation and initialization of an automatic local Variant variable a Variant member variable is defined in the dialog class User Manual emScon TPI Chapter 2 e C Interface e 39 Sica Metrology Division Geosystems 6 Add the following declaration to the CEmsyCApiClientDlg class protected or private in the EmsyCApiClientDlg h file 7 Initialize this variable once to the dialog class constructor Upon receiving data the application may crash without initialized m_vtData VariantInit amp m vtData 8 To maintain modularity implement data reading GetData in the OnDataArrivalWinsock1 function and implement a separate processing parsing member function named Process Data 9 The OnDataArrivalWinsock1 implementation reads as follows 40 e Chapter 2 e C Interface User Manual emScon TPI Metrology Division Seica Geosystems void RR bytesTotal TRACE OnDataArrival n m vtData output parameter variant as member var Note m_vtData must be initialized with VariantInit see constructor VARIANT vtType vtTy
43. tracker server upon Form Load and disconnects upon Form Unload It is presumed that how to add buttons and their related command handler skeletons are known r See Sample 2 Tutorial on page 46 1 User Manual emScon TPI Add a button named InitSync caption Init Tracker sync The command handler should be completed with the following code Chapter 4 e COM Interface e 77 Sica Metrology Division Geosystems Private Sub InitSync_Click On Error GoTo ErrorHandler Obi Sync Initialize Exit Sub ErrorHandler MsgBox Err Description End Sub 2 Since this is a synchronous call e ObjSync Initialize will not return before the tracker has finished initializing e The Exit Sub statement will not be reached until initialization is finished A real application would at least display an hourglass cursor while the program resides in the InitSync function e The error handler is implemented in every single handler otherwise the application will terminate in case of an error unhanded exception 3 Saving the pointer variables ObjSync and ObjAsync and making direct calls such as Obj Connect ILTCommandSync initialize will not work with the VB compiler because ObjSync ObjAsync are not real pointers The Set ObjSync ObjConnect ILTCommandSync statement is a Querylnterface 4 Add another Button Handler Measure Single Point and implement the handler as shown below It is presumed the tracker
44. was intended in order to make everything as transparent and lightweight as possible The implemented bitmap file reading algorithm is not intended for general purpose other than the simple b w camera image format currently provided 104 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Seica Geosystems Remarks When designing a client application using the LTControl COM component either the synchronous or the asynchronous command interface must be used User Manual emScon TPI With the asynchronous interface and the events notification that is calling SelectNotificationMethod with LTC_NM_Event an Event Sink must be implemented In VB this is done by defining the WithEvents keyword but in C this is a bit more complicated In addition the appropriate event handlers must be implemented q With any other notification mechanism the event sink is not required and the WithEvents keyword must be removed Implement Windows message handlers and not event handlers in this case With the synchronous interface some answers remain asynchronous by their nature continuous measurement packets Reflector Positions and error answers these may partly occur non command related for example beam broken With synchronous commands events or notifications must still be caught See former paragraph Any other notification mechanism does not need an event sink and the WithEvents keyword must
45. 0 0 AddNominalPoint 2 2 0 Approx Approx Fixed 0 0 0 This is also a minimum configuration with redundancy 6 6 0 provided the scale is fixed Suppose the horizontal angles w and g have been obtained from a Nivel20 measurement To complete the orientation of the station use a number of reference points with SetInputParams 0 0 0 omega phi 0 1 Unknown Unknown Unknown Fixed Fixed Unknown Fixed User Manual emScon TPI Chapter 6 e Mathematics e 139 Seica Geosystems Industrial Measurement Systems 7 Appendix Programming Interface Defining Files TPI File Listing The files ES C API Def h ES CPP API Def h LTControl dll tlb as well as all the sample projects are an integral part of the SDK e ES C API Def h e ES CPP API Def h e Enum h e LTControl dll Unicode version for WinNT 2000 XP e LTControl dll ANSI version for Win98 ME e LTControl tlb q The ES C API Def h file may currently be distributed in two parts that is with a sub include file named enum h If only one file is being distributed and no tinclude enum h statement is included in ES C API Def h it can be assumed that enum h has been directly merged with the API include file q Sample files are no longer listed here See Samples folder on the SDK distribution medium 140 e Chapter 7 e Appendix User Manual emScon TPI
46. 1E10 Approximately known coordinates are used to calculate an initial approximation In a minimum configuration the solution would be ambiguous without this additional information Fk See Examples on page 137 134 e Chapter 6 e Mathematics User Manual emScon TPI Metrology Division Actual Points Parameter Constraints Output of Transformation Computation Transformation Parameters Transformed Points and Residuals Seica Geosystems Actual poa are added in the following form The number and order of actuals must agree with that of the nominals The parameters are typically obtained from a single point measurement The unit settings and transformation parameters must be the same for the measurement and for adding the actuals If any of the seven 7 transformation parameters is known a priori its value can be fixed in the same way as for the nominal coordinates Frequently the scale is fixed to be 1 and the other parameters are free as in the following example SetInputParams 0 0 0 0 0 0 1 ES_UnknownStdDev ES UnknownStdDev ES UnknownStdDev ES UnknownStdDev ES UnknownStdDev ES UnknownStdDev ES FixedStdDev The values of unknown parameters can be set arbitrarily In the current implementation constraints are not used to reduce the required number of known nominal coordinates Constraints are not taken into account for the initial approximation Erroneous constraints usually
47. 2 If LTControl dll is located in the C WINNT system32 directory call Regsvr32 C WINNT system32 LTControl dll from the Start Run menu of the explorer task bar q The LTControl dll does not depend on any other custom DLL it can be registered anywhere The Windows system directory is the common location 3 A message box appears confirming registration Registering of LTControl dll succeeded 4 A message such as Error Load Library failed error 0x0000007e most likely indicates that the PC lacks a correct ATL dll installation missing wrong version or not registered In this case first install ATL dll as described below After that repeat registering of LTControl dll 1 Copy Atl dll from ES SDK Lib directory to Windows system system32 directory OR to LTControl dll directory 72 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Sample 5 Tutorial ATL Type COM object Seica Geosystems Unicode version for WinNT Win2000 ANSI version for Win9x Win ME See properties of ATL dll for operating systems supported 2 Register Atl dll Regsvr32 exe lt path gt Atl dll 3 Repeat registration of LTControl dll Visual Basic client The use of the LT Control provides the right tool to build a VB Tracker Server client LtcVBClient In contrast to the VB application in Sample 2 with the Tracker Server low level interface which was not recommended q For the ap
48. C Interface User Manual emScon TPI Metrology Division Receiving Data Sample 4 CESAPIReceive class Sample 9 User Manual emScon TPI Chapter 3 e C Interface e 61 Seica Geosystems CEmsyCApiClientDlg OnButtonLaserpointer PointLaserCT data data packetInfo packetHeader type ES DT Command data packetInfo packetHeader 1PacketSize sizeof data data packetInfo command ES C PointLaser data dVall 1 342 data dVal2 2 09 data dVals 0 5 COleVariant vrtData PackIntoVariant amp data sizeof data m winSockCtrl SendData vrtData catch TRACE _T MSWinSockCtrl Error PointLaser n This Sample requires a client implemented CDataReceive class which implements a limited reception of command answers as needed by the Sample The CESAPIReceive class which is provided in Sample 9 can be used to replace the CdataReceive and thereby discard two application files q This replacement is to be treated only as an exercise for users It is not recommended to implement your own receiver class as part of the client application Wa See file ES_CPP_API_Def h for an example of CESAPIReceive class Fi See file DataReceive h cpp for an example of CDataReceive class This Sample EmsyCPPApiConsoleClient with a CESAP IReceive class demonstrates Sending and Receiving features of the C TPI among other features This Sample is a simple console application and has no GUI or Wins
49. COleVariant PackIntoVariant void pData UINT sizeOfData BYTE pByteArr new BYTE sizeOfData memcpy pByteArr pData sizeOfData CByteArray byteArr for UINT i 0 i lt sizeOfData i byteArr Add pByteArr 1 delete pByteArr COleVariant vrt byteArr return vrt Tracker Initialization The application should now be able to initialize the tracker 1 Run the application and immediately click the Init Tracker button 2 An error message reads MSWinSockCtrl Exception Initialize n the message specified in the OnButtonInit catch part The User Manual emScon TPI Chapter 2 e C Interface e 37 Seica Geosystems Hard Coded data Step 7 Receiving Data Metrology Division Winsock control threw an exception because it was not connected before 3 Press the Connect button then the Init Tracker button again amp Only one single Connect at a time is possible Pressing the Connect button more than once without a Disconnect in between will get an error message although the connection is still OK 4 Implement the remaining Handlers OnButtonPointlaser OnButtonFindreflector OnButtonSetreflector OnButtonStartmeas Refer to Sample 1 code Some of these functions include hard coded data for example coordinates for OnButtonPointlaser Invoking this command just toggles the beam between two locations This is not of practical use but for demonstration The coord
50. CancelDisplay As Boolean Beep Beep on error received MsgBox Winsock Error amp Number End Sub Running the kand 5 Set the IP Address before compiling and application running the application E See Sample 2 folder in SDK for complete source code Remarks This application can be extended to a full featured Tracker Server controller It shows that the TPI is both language and platform independent pure TCP IP Languages such as Pascal or Java can be used to build clients based on the C TPI directly q The use of languages other than C C for using the low level TPI is not recommended or supported q The Winsock control may not be efficient enough when dealing with 1000 points second from a continuous measurement stream Structures Structures are convenient for this purpose and in principle pure Byte arrays would also do User Manual emScon TPI Chapter 2 e C Interface e 51 Seica Geosystems COM interface Sample 13 LT BUI Launch Sample 3 Console application Metrology Division which would lead to more complex initialization and interpretation A COM interface can be used with virtually any programming language without the hassle of translating the packet structures and Enums See COM Interface on page 69 This sample is a BUI launcher which is to be used in the application to launch the emScon BUI Fi Refer to the documentation with the SDK for details Winsock 2 0
51. Chapter 2 e C Interface Select menu Project gt Add to Project gt Components and Controls Change to Registered ActiveXControl folder User Manual e emScon TPI Metrology Division Seica Geosystems Select Microsoft Winsock Control version 6 Click Insert Click OK Reregister MSWinsck ocx if Microsoft Winsock control version 6 0 is not available in the list of Registered ActiveX controls Use Regsvr32 exe utility Reinstall VC if file cannot be found 6 Dialog box Confirm Classes appears Check item CMSWinsockControl Leave proposed class and file names unchanged Click OK Close Components and Controls Gallery dialog Two files MSWinsockControl h and MSWinsockControl cpp have been generated as a wrapper class to the OCX s COM Interface and inserted in the project No changes are to be made to these files Only a few of the many functions of MSWinsockControl are required by the application Step 3 Create a Knowledge about placing controls on dialog Winsock Controls Instance boxes with the Dialog Box editor is presumed The Controls palette the window from which buttons edit fields etc are dragged to the dialog template is padded with a new icon at the bottom two small computers are shown Its tool tip info reads MS Winsock control version 6 0 User Manual emScon TPI 1 Create one such control in the dialog Activate the resource editor and the dialog t
52. ChientDlg cpp and EmsyCApiClientDlg h apart from the generated wrapper classes for the OCX which reside in mswinsockcontrol cpp h To build Sample 1 from the files in the SDK open EmsyCApiClient dsw with VC and choose Build or click F7 e Change the hard coded TCP IP default address 192 168 0 1 according to the Tracker Server s address Visual Basic Client Application The ES C API Def h cannot be directly included in Visual Basic or Pascal Java etc applications It needs to be translated to other languages syntax with the risk of errors typing errors different structure byte alignment different sizes of basic data types etc q The use of languages other than C C for using the low level TPI is not recommended or supported This sample serves primarily to enable a better understanding of the TPI principles It has functions limited to connecting to the tracker initializing and disconnecting TCP IP communication uses MSWinsck ocx 1 Launch Visual Basic 6 0 Select File gt New Project gt Standard exe Click OK 46 e Chapter 2 e C Interface User Manual emScon TPI Metrology Division Step 2 Connect to 1 the Tracker Server pA Seica Geosystems Save the form as EmsyVBClient frm and the project as EmsyVBClient vbp Select Menu Project gt Components or Ctrl T In dialog list box check Microsoft Winsock Control 6 Click OK Place an instance of the Winsock control icon in
53. FileType long fileSize long bytesTotal ASSERT m_bUseAsync VARIANT vt VariantInit amp vt m_pLTConnect gt GetData amp vt ASSERT vt parray gt rgsabound 0 cElements unsigned long bytesTotal GetStillImageRT pData GetStillImageRT vt parray gt pvData ASSERT pData gt 1lFileSize fileSize Do something with the file for example write out to a disk file like shown in code above VariantClear amp vt Avoid Memory leak COM VB A Neither type casts nor writing binary files are common tasks in VisualBasic In order to achieve the same Stilllmage features from VB A some convenience Functions have been added to the COM TPI StilllmageGetFile and WriteDiskFile This is an extract from an Excel application The image is displayed in an Image dialog control named Imagel1 Private Sub GetStillImage Click On Error GoTo ErrorHBandler Dim fileData As Variant Dim size As Long ObjSync GetStillImage ES SI Bitmap size fileData ObjConnect WriteDiskFile fileData C Temp img bmp Now load picture into sheet Imagel Picture LoadPicture C Temp img bmp Exit Sub ErrorHandler MsgBox Err Description End Sub Event handler Within an event handler the file data structure must be extracted first since GetData delivers the complete data packet including header information A similar helper function is required in VB since no casting to GetStilllmageRT is available Fi See Continuous measur
54. HeaderSize if lReady SOCKET_ERROR if WSAGetLastError WSAEWOULDBLOCK Sleep 50 busy try later else Beep 1000 100 not able to get header else if return true non fatal only a peek try next time if pHeader PacketHeaderT szRecvBuf bOK bOK amp amp lReady nHeaderSize amp amp pHeader gt 1PacketSize gt nHeaderSize amp amp pHeader gt 1PacketSize lt RECV BUFFER SIZE amp amp pHeader gt type gt ES DT Command amp amp pHeader gt type lt ES DT ReflectorPosResult if bOK do nCounter if lBytesRead gt 0 l1BytesReadTotal 1BytesRead 1Missing pHeader gt lPacketSize lBytesReadTotal 1BytesRead recv SOCKET wParam szRecvBuf l1BytesReadTotal 1Missing 0 if lBytesRead SOCKET ERROR if WSAGetLastError WSAEWOULDBLOCK Sleep 50 busy try later continue else Beep 1000 100 Chapter 4 e COM Interface e 93 Sica Metrology Division Geosystems F ff at if nNCounter gt 64 emergency exit if lBytesReadTotal lt 0 ATLTRACE T not able to read data return true nothing read can leave safely if else bOK false break if ATLTRACE _T Loop BytesRead ld BytesReadTotal ld PacketSize ld Missing ld n 1lBytesRead 1BytesReadTotal lBytesRead pHeader gt lPacketSize 1Missing lBytesRead while lBytesRead lt 1Mis
55. In addition unstable conditions such as vibrations and rapid temperature changes make it necessary for more measurements to be taken The following combinations are examples e Fight measurements in 4 pairs high and low separated by approx 90 e Twelve measurements in 4 groups of 3 each high low horizontal separated by approx 90 e ClearDrivePointList e AddDrivePoint e CallIntermediateCompensation e SetCompensation Current emScon system settings such as units coordinate system and coordinate type are taken over when emScon interprets point input driver point values All points in the drive library must be known within 2mm 0 0787 in tolerance otherwise this will cause an error in the measurements The settings such as units coordinate system and coordinate system type must correspond to the input data Ensure that the settings describe the environment of the driver points before they are uploaded to the server One of the first actions of the automated compensation algorithm is to check the geometry of the used driver points If the target setup fits the requirements as described above then the process continues with the measurements otherwise it will abort 122 e Chapter 5 e Command Description User Manual emScon TPI Metrology Division Compensation Results Compensation Intervals Two Face Field Check Periodicity Field check two face Measurement Client Routine Seica
56. Initialize mt packetInfo packetHeader type ES DT Command This code block should be rather put into a subroutine Dim bt As Byte ReDim bt LenB mt As Byte Dim vtdata As Variant CopyMemory bt 0 mt LenB mt vtdata bt Winsockl SendData vtdata Finally send the data Sub 7 An Initialize Tracker can now be invoked however no answers can be received Select the Winsock1 object in the code editor for Form1 top left drop down list 2 Select DataArrival and Error to create the bodies of these two handlers out of the Winsock control top right drop down box 3 Call GetData which delivers the result in a Variant Copy the variant into a variable of type InitializeRT 50 e Chapter 2 e C Interface User Manual emScon TPI Metrology Division Seica Geosystems Private Sub Winsockl DataArrival ByVal bytesTotal As Long Dim vta Dim mt As InitializeRT Dim bt As Byte Winsockl GetData vta vbArray vbByte LenB mt bt vta CopyMemory mt bt 0 LenB mt Beep Beep on Answer received If mt packetiInfto status ES ES AlLIOK Then AnswerStatus Caption AIL1OK Else AnswerStatus Caption Unknown Error End If End Sub 4 Implement the error handler q Refer to comments in the source file Private Sub Winsockl_Error ByVal Number As Integer _ Description As String ByVal _ Scode As Long ByVal Source As _ String ByVal HelpFile As String ByVal HelpContext As _ Long
57. InputParams CallTransformation 118 e Chapter 5 e Command Description User Manual emScon TPI Metrology Division Comments EmScon System Settings Automated Intermediate Compensation Tracker Geometry Seica Geosystems e GetTransformedPoints The command CallTransformation displays a transformation carried out with Set GetTransformationParams Before doing a CallTransformation both point lists nominal and actual must be prepared They must contain the same number of elements The system settings of emScon units coordinate type and coordinate system must reflect the current input data Point input values nominal actual are interpreted by emScon based on the current emScon system settings e Additional parameters can be set by using the SetTransformationInputParams command For example to fix or weigh certain parameters e After a successful calculation additional results in terms of transformed points and residuals can be retrieved optionally by using Get TransformedPoints q None of the 7 calculated transformation parameters received as output from CallTransformation are automatically applied to the system This must be done explicitly by calling SetTransformationParams See Mathematics on page 129 for mathematical description The Intermediate Compensation is a simple and fast procedure to perform a fully automated intermediate compensation where the tracker is in a fixed installation
58. Long eee GetData data E tp VarType data type we expect a Byte arryay f If tp vbArray vbByte Then Byte Array SZ UBound data 1 index is zero based bytesTotal sz Then MsgBox sz display of bytes received Else MsgBox CStr Unexpected size amp sz amp CStr expected amp bytesTotal End If End If End Sub q It is not necessary to read data here with GetData Answers may be filtered out and only those data packets of interest can be read With TCP IP data must be read at socket level see previous samples otherwise no notification will arrive again The principles shown here also apply to message handlers if one of the message notification mechanisms is selected r See Answers from Tracker Server on page 25 on how to mask evaluate incoming data blocks VBA Macro The LTControl COM component can also be used Language Support with VBA Visual Basic for Applications the Excel Word built in Macro language of MS Excel Word and Access Access with the exception that structs and enums are not fully supported with VBA that comes with Office 97 Ex functions that take struct parameters cannot be used VBA that comes with Office 2000 no longer has such limitations q It is highly recommended to use Office 2000 or higher for Tracker Server VBA Programming Office 97 Excel 97 Word 97 apart from a User Manual emScon TPI Chapter 4 e COM Interface e 97
59. Replace the Winsock control by some other TCP IP communication API as an exercise User Manual emScon TPI Metrology Division GUI Design User Manual emScon TPI Seica Geosystems If the Winsock 2 0 API is used it is recommended to use the WSAAsyncSelect function rather than the WSAEventSelect for data receiving q In a Windows framework using messages is simpler than using events and threads Use of MFC CAsyncSocket on the other hand requires no such consideration CAsyncSocket provides a message handler for data receiving by default The function Laser Pointer toggles the location of the laser beam between two hard coded positions This is not of real practical use The Toggle Speed toggles the continuous measurement speed from 1 second to 100 second To change speed during a continuous measurement the measurement must be stopped before the speed is reset q The Stop Meas command is not valid in single measurement mode Inactive buttons are not grayed out The user must wait for arrival of the answer from the previous command before sending a new command Radio buttons or list boxes are recommended to implement Multi Meas Mode continuous and Single Meas mode stationary mode rather than simple push buttons The parameters for Pointer Laser need to be entered in fields in a dialog The present design has not considered this aspect Chapter 3 e C Interface e 65 Seica
60. Sica Metrology Division Geosystems missing UDT contain some bugs that make development of Tracker Server clients virtually impossible as soon as events are involved This bug leads to a completely corrupted file upon file saving after an event has arrived For this reason Excel samples delivered with the TPI SDK are in Excel 2000 format They may run with Excel 97 but may be destroyed as soon as any changes are saved Always maintain a safe read only copy The following remarks only apply to Office 97 programming Office 2000 VBA behaves as ordinary VB User defined Types the As e Both allow defining user defined structs between Visual Basic locally However those structs exported by eng VERNET the LTControl such as PacketHeaderT SingleMeasResultT are only recognized from within Visual Basic VBA claims an error Automation type not supported if declaring for example a variable like e Enums are not supported by VBA97 The compiler does not know the keyword Enum User defined enums cannot be defined locally although this works with ordinary Visual Basic It is also not possible to use enum type variables that are exported by the LTControl Declaration as follows are not possible in VBA97 e When implementing an EventHandler that has enum type parameters in Visual Basic will read as follows only function header shown 98 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Seica Ge
61. ace e This component is primarily designed for Limitation mouse control and does not work properly with a keyboard interface E g use of arrow keys in VB F See VC VBA VB documentation for general information on ActiveX controls and how to include them in applications Sample 10 This Sample keasytracker is an EmScon client application developed on SUSE 7 2 Linux KDE by a third party provider It has been published according to GNU General Public License GPL q For further details see README file in the Sample 10 project folder 68 e Chapter 3 e C Interface User Manual emScon TPI Metrology Division Seica Geosystems 4 COM Interface High level Interface Introduction Unlike the C and C TPI the COM TPI is a DLL library and not an include file This DLL provides an easy to use programming interface for the Tracker Server This makes it suitable for programmers with minimal programming expertise to design simple tracker applications The interface consists of a COM object It is designed as an ATL DLL COM server and a LTControl dll as part of the tracker server SDK with a built in TCP IP communication The LTControl COM object DLL is based on the tracker server C TPI the Win32 Sockets 2 0 API and VC ATL The LTControl dll is in a sense a tracker server C client allowing design of such a control q The programmer is not required to deal with TCP IP communication libraries or system
62. ackward compatibility will be provided in that existing packets information structure are neither changed nor removed In practice this generally means that the default case in switch statements should always be treated as neutral no action 12 e Chapter 1 e Introduction User Manual emScon TPI Metrology Division Example Solution Backward Compatibility v1 0 1 1 Seica Geosystems The enum ES_SystemStatusChange in v1 2 contains only two members enum ES SystemStatusChange ES_SSC_DistanceSet ES SSC LaserWarmedUp by A future programming statement as follows would cause an Unexpected Status message with future emScon upgrades Switch status case ES SSC DistanceSet MessageBox ADM Distance re established break case ES SSC LaserWarmedUp MessageBox Laser is now ready break default MessageBox Unexpected Status break WRONG Ignore the default case with no default entry tag or one that just has an effect to debug versions default No action at all break or default no effect to retail versions TRACE Unexpected Status ASSERT false break A minor change to version 1 2 may cause backward compatibility problems in rare cases if all of the following conditions apply e Application is based on LTControl COM Interface e EmScon server and LTControl have been upgraded there is no problem if only the s
63. and data structures The data structures reflect the architecture of the data packets byte arrays sent and received over the TCP IP network between the Application Processor and the Tracker Server q No functions or procedures are defined q Since C is an extension of C a C compiler can also be used for C programming 1 Establish a TCP IP connection to the tracker server This is typically achieved by invoking a Connect function of the TCP IP communication library or toolbox This function will take the IP address or its related hostname of your Tracker Server 2 Set the TCP IP Port Number to 700 for the Tracker Server 3 Call a SendData function from the TCP IP communication library or toolbox Function name may differ This function typically takes a pointer to a data packet and probably the size of it unless the packet is wrapped User Manual emScon TPI Chapter 2 e C Interface e 23 Sica Metrology Division Geosystems into a structure that knows its size implicitly for example a Variant structure 4 The architecture of the packets TPI protocol is defined by the data structures in the ES C API Def h file Fk See the Reference Manual for a detailed description of these structures Code Sequence 5 For invoking a GoPosition command Assign appropriate initialization values For example assign an ES_Command and an ES_C_GoPosition to a GoPositionCT struct variable q The compiler will not
64. and will be discussed later 5 The application must declare what notification mechanism to use Do this with the statement shown below Without calling this function in the initialization part of the 80 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Extended Synchronous Functions Seica Geosystems application no notification mechanism will be activated when dealing with synchronous commands exclusively r See remarks on continuous measurement in Handling Data Arrival Continuous Measurements on page 86 6 As soon as the WithEvents keyword is declared the ObjAsync object or whatever the variable is called is listed in the top left list box of the Form s source code window q Remove WithEvents and save the code the list entry will vanish 7 It ObjAsync is selected in the list box a list of all available event handlers is shown in the right drop down list 8 Select to generate the handler framework Selecting ErrorEvent will generate a function named ObjAsync_ErrorEvent 9 Complete this function with a message box to read as follows Private Sub ObjSync_ErrorEvent ByVal command As LTCONTROLLib ES Command ByVal status As LTCONTROLLib ES ResultStatus MsgBox command amp CStr amp status End Sub 1 This event handler will now be called for example on a Beam Broken Event ObjSync MeasurStationaryPoint has 18 basic data type parame
65. be removed In this case do not implement event handlers appropriate Windows message handlers must be implemented instead Using both interfaces in the same LTConnect instance although possible usually makes Chapter 4 e COM Interface e 105 Sica Metrology Division Geosystems no sense and partly leads to duplicate answers e On multi tracker multi tracker server systems create a separate instance of LTConnect for each tracker e Do not test explicitly against the VB keyword True if using the Get lt FunctionName gt Ex methods of the LTControl for those commands returning Boolean data within their result structure This is because the Boolean member in these structures if true is one 1 However the VB keyword True evaluates to 1 Always test the variable directly or against Not False obj Sync GetCont inuousDistanceModeParamsEx dataout If dataout bUseRegion Then MsgBox bUseRegion is True End If Example or If Not dataout bUseRegion False Then MsgBox bUseRegion is True End If are both correct However the following would evaluate to a wrong result If dataout bUseRegion True Then MsgBox bUseRegion is True No message even flag true End If 106 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Seica Geosystems 5 Command Description Get Reflectors Command Related Commands Comments iTotalReflectors Spec
66. con TPI Metrology Division User Manual emScon TPI Seica Geosystems station or at an object as a CAD coordinate system In Orientation the reference points are given in a world coordinate system while the actual point coordinates refer to the tracker s coordinate system Transformation Fig 3 Creation of an object coordinate system also called UCS user coordinate system to view the actual point coordinates with respect to an object coordinate system The reference points are given in the object coordinate system and the measurements in the world coordinate system WCS Orientation Active station Principal station Orientation Chapter 6 e Mathematics e 131 Sica Metrology Division Geosystems Object coordinate system Active station Transformation vs Transformation and orientation are inverse to Orientation l each other as mappings For orientation alignment the world coordinate system WCS is the reference for the creation of an object coordinate system the object is the reference The transformation which is downloaded to emScon will be a transformation from to a world coordinate system to from an object coordinate system Orientation To orient a station use SetTransformationInputParams ES TR AsOrientation The transformation has the form nominal t R actual s residual Setting the calculated transformation parameters as orientation parameters an
67. d remeasurement of the reference points yields actual coordinates approximately equal to the nominal coordinates Transformation To calculate transformation parameters use SetTransformationInputParams ES TR AsTransformation In this case the transformation has the form nominal sR actual t residual 132 e Chapter 6 e Mathematics User Manual emScon TPI Metrology Division Point Accuracy Seica Geosystems which is inverse to the one in the orientation case Setting the calculated transformation parameters and remeasurement also yields actual coordinates approximately equal to the nominal coordinates Each nominal point measured point transformed point or residual vector has accuracy information stored in a symmetric 3 by 3 covariance matrix 2 stdDev covar covaf i 2 covarianceMatrix covar stdDev covar 2 covar covar stdDev Its eigenvectors and eigenvalues define the error ellipsoid If the covariance matrix is diagonal the axes of the error ellipsoid are parallel to the coordinate axes In correlations covar p satisfy stdDev stdDev 18p 51 All statistical points and 3D vectors can be represented in the following non redundant form consisting of 9 values Coord1 Coord2 Coord3 StdDev1 StdDev2 StdDev3 Covar12 Covar13 Covar23 This format is used throughout the emScon TPI For continuous measurements the a priori covariance matrix of a p
68. detect if for example an ES_DT_SingleMeasResult as type or an ES_C_SwitchLaser as command is assigned to a GoPositionCT variable Inappropriate initialization values cause the command to fail GoPositionCT data declare packet variable data packetInfo packetHeader type ES DT Command data packetInfo packetHeader 1PacketSize sizeof data data packetInfo command ES C GoPosition data dVall 1 879 data dVal2 2 011 data Nals 0 551 data bUseaDM FALSE Initialization Macros 6 To avoid such errors which may happen through copy paste errors and are difficult to trace itis recommended to use initialization macros for correct assignment of type size and command values An INITStopMeasurement macro for example requires two statements the parameter declaration and the parameter initialization macro call The StopMeasurement has no additional command parameters If there are any these can be incorporated into the macro 24 e Chapter 2 e C Interface User Manual emScon TPI Metrology Division Seica Geosystems StopMeasurementCT cmdStop declaration INITStopMeasurement cmdStop initialization C Initialization C offers a much more elegant way for initialization the constructor approach which eases the initialization issues Answers from Tracker Server r See C Interface on page 56 for details 7 After initialization of the data variable send it to the tracker
69. dlers 36 Tracker Initialization 3 Hard Coded dat errannnnrnnrrannnrrnannnnrnrnannnnennee 38 Step 7 Receiving Data rrrnnnrnnnenanrnannnnnnnnne 38 FUNCION BOT sesecccarcctceatneaenencacaeacaaxcquseataeneadauan 39 GetData Function rrrrrrurrnrrnrrnrnnrvnrvnrnnnenveneene 39 PICS Ed 41 Asynchronous Communication arrrurrannnnnnnre 44 Remarks eisunsutwinivedciatsas chaspiceciaininesbereiaciwaniessiwors 44 Interface Design rrnnnrnnnenannvannnannnnrnnnrnnnnnnnne 45 ETT AN 45 Network Traffic Jams rrrarnnrrarrarvarnnrnnnenvenenn 45 MSWinsock Control rrrrrnrnnnnnrnnerrernnrnnrnnrnnsnn 45 ENO see cistyisieacavneseasannivecauiteendawateienenensien 46 UNG SaO I ereo 46 TEPPE Leer 46 Visual Basic Client Application 008 46 Sample 2 TOO siccnicrnscavaccuaneatngntagndaadasubesanneaans 46 Step 1 Adding a Winsock Control and Designing FONN a Ea 46 Step 2 Connect to the Tracker Server 47 IP Address ciicsivneivicicasinabisicanssanacdertivardeaviwerieares 47 Me 48 Step 3 Translate the C enums and Structs to VB EE E 48 Step 4 Implementing the Init Tracker Command EEE tet ge gene E EEA 49 Step 5 Implementing Answer Data Receiving 50 Running the application cccecseeseeeeeeeees 51 KE LE JE 51 SUCO rn 51 COM IMENICE irriparre aaneen ATENE 52 Sample 13 LT BUI Launch rrurnannnnonarnnnonernannnn 52 Winsock 2 0 Client Applications
70. e In real applications there is usually only one of these Set ObjSync ObjConnect ILTCommandSync Set ObjAsync ObjConnect ILTCommandAsync Exit Sub ErrorHandler MsgBox Err Description End Exit application when connection fails End Sub q The End statement in the error case exits the application when connection to the tracker server has failed 11 Disconnect the Tracker Server in Form_Unload Implement the following handler 76 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Synchronous Asynchro nous Interface Implementing Synchronous Commands Seica Geosystems Private Sub Form_Unload Cancel As Integer Obj Connect DisconnectEmbeddedSystem End Sub r See chapter COM Interface in the Reference Manual for an explanation of the function ObjConnect SelectNotificationMethod LTC NM Event 0 0 Differences between the synchronous and asynchronous interface The functions of the synchronous interface do not return before the task is completed while the asynchronous functions do so see C C TPD In general programming with synchronous functions is much easier Handling Data Arrival Events or Notifications is not required except in some special cases Use of either synchronous or asynchronous objects depends on the application q Use of both is not recommended Running the application in the current state implicitly connects and initializes the
71. e The code fragment below demonstrates this with the GetUnits command and shows part of the handling of a single measurement answer 28 e Chapter 2 e C Interface User Manual emScon TPI Metrology Division Seica Geosystems Switch pData gt type case ES DT Command command type answer arrived BasicCommandRT pData2 BasicCommandRT byteArr if something went wrong no need to continue if pData2 gt status ES_RS_A110K TODO evaluate and handle the error return false switch pData2 gt command case ES C Initialize case ES C PointLaser case ES C FindReflector break case ES C GetUnits GetUnitsRT pData3 GetUnitsRT byteArr Diagnostics check whether packet size as expected in debug mode only ASSERT pData3 gt packetInfo packetHeader lPacketSize sizeof GetUnitsRT now you can access Unit specific data pData3 gt unitsSettings lenUnitType pData3 gt unitsSettings tempUnitType break case XXX Todo add other command type evaluations break default break break case ES _ DT SingleMeasResult single meas result type answer has arrived SingleMeasResultT pData4 SingleMeasResultT byteArr if pData4 gt packetInfo status ES RS A110K return false break Todo add further case statements for remaining packet types e Declaring variables within case statements which are suitable f
72. ed here further Fi See Reference Manual for details The following preconditions have to be fulfilled e Camera mounted on tracker e System settings Has video flag activated e Tracker must be in camera view command ActivateCameraView The application of GetStilllmage is explained below using code fragments 110 e Chapter 5 e Command Description User Manual emScon TPI Metrology Division Seica Geosystems q GetStilllmage must be called with the parameter ES_SI_Bitmap The parameter ES_SI_Jpeg is not supported yet User Manual emScon TPI The answer to a successfully executed GetStilllmage command results in a GetStilllmageRT data structure Apart from the common header information this structure echoes the file type imageFiletype ES_SI_Bitmap the size of the file IFileSize and the first Byte of the file cFileStart The following code accesses the core file data and writes it to a physical disk file assume pData contains the data block received to a GetStillImage ES SI Bitmap command long 1FileSize GetStillImageRT pData gt 1FileSize char cFileStart GetStillImageRT pData gt cFileStart FILE pFile NULL if pFil fopen C Temp img bmp wb NULL long lWritten fwrite amp cFileStart 1 1FileSize pFile if lWritten 1FileSize printf File could not be written n else printf wrote d bytes n Iiritten fclose pFile The
73. elease June 2003 Manual order number None ii e Preface User Manual emScon TPI Metrology Division feica Geosystems Preface Contact Leica Geosystems AG Metrology Division Moenchmattweg 5 5035 Unterentfelden Switzerland Phone 41 62 737 67 67 Fax 41 62 737 68 34 www leica geosystems com ims index htm User Manual emScon TPI Preface e iii Metrology Division Seica Geosystems Contents 1 Introduction 11 Frere La 11 AV 11 Programming Environment cccceceeeeeeeeeeees 11 TCP IP Communication rurrnrnnrnnrnnrnnnnnnnnvenenneene 11 Version Compatibility arornnrrnnenanrnannnnnnnnrnnnnnnn 12 Future Compatibility rronrranenanrnanrnnrnnnnnnnnnnn 12 Backward Compatibility rarorerrrnrrnnrnnnrnnnnnen 12 ANNO COG gt assis tesasecnntgnad EE 14 EIPOP 0 AO 15 Interface Design rrrnnrrnnrrvanevannnannnnrnnernnsnnnenn 15 Hard Coded Information n se 15 Integration in Application Software 15 Initial Steps annannnnennnnnnnnnnnnnnnnnnnnnnnnnnnnennnnnunnnen 16 Essential STEN Lae 16 Command Sequence rmrssnrsnrssevsrrssranerssrssensrnne 16 General information rarxanvnnennnnnnnnnennnnnnnnnnnnenn 18 Initialize Laser Tracker 18 Current Temperature and Pressure 006 18 Set Reflector rrrrnrrnnnnnunnnnnnnnnnnnunnnnnnnvnnnnnenseneenen 19 Set Temperature Range rrarnnannnnnnnnrnnnennnennnnnnnn 19 Station Pa
74. ements and VBA on 114 e Chapter 5 e Command Description User Manual emScon TPI Metrology Division Seica Geosystems page 100 for similar method using Continuous DataGet Header Info Private Sub ObjAsync_StilliImageDataReady ByVal imageFileType As LTCONTROLLib ES StillImageFileType ByVal fileSize As Long ByVal bytesTotal As Long Dim fsize as Long dummy ObjConnect GetData data Get whole packet incl header retrieve out size and file data ObjConnect StillImageGetFile data fsize file ObjConnect WriteDiskFile file img bmp Now load picture into sheet Imagel Picture LoadPicture img bmp End Sub q Although designed for use with VB StilllmageGetFile and WriteDiskFile can also be used in LTControl based C applications mage SNEK TOSO Click positions on the Image are currently written out to Excel cells These values can be used to calculate relative tracker movement angles call MovekelativeHV to direct the tracker there and then request a new Image Private Sub Imagel_MouseDown ByVal Button As Integer ByVal Shift As Integer ByVal X As Single ByVal Y As Single Beep ws Cells 2 2 Value ws Cells 3 2 Value ws Cells 5 2 Value End Sub Live Image display The live camera display from the Overview Live Image Control Camera can be implemented into user LTVideo2 ocx applications by using an ActiveX control LTVideo2 ocx See SDK lib directory ANSI Unicode subdirectories Register
75. emplate In the Controls toolbox click the Winsock icon Draw a rectangle on the dialog The icon should now appear as a 32x32 pixel icon Place icon out of the way where it does not Chapter 2 e C Interface e 31 Sica Metrology Division Geosystems disturb other controls This icon will be invisible in the real dialog 3 Right click to look at the properties ID IDC WINSOCKI Do not change the ID 4 Click Control TAB of the property box Add an empty string to Remote Host field This prevents an exception when running the application 5 Do not change any remaining properties No Remote host ID or port This information will be added later 6 Add member variable of type CMSWinsockControl see MSWinsockControl h file for class definition Manually Continue with step 7 With Class Wizard Continue with step 9 7 Add following declaration manually to the applications dialog class CEmsyCApiClientDIg 8 Create the control explicitly or make a correct entry to the DoDataExchange function 9 Let the ClassWizard do the work Call it from the View menu or press Cirl W 10 Activate the Member Variables TAB 11 Select IDC_WINSOCK1 in the list Click Add Variable button Name the variable m winSockCtrl 12 Click OK close the Class Wizard window Step 4 User Controls The MSWinsock control s functions take all string on the Dialo er and data parameters as Variants 32 e Chapte
76. en Data will be lost in such situations e The network is not fast enough e The client PC is not powerful enough e The application is not able to process data fast enough e The application is not designed appropriately amp The client application can still buffer incoming data for example in a FIFO list taking the data packets as list elements This approach can be chosen if the performance constraint is caused by intensive data processing The Winsock API offers certain tuning functions These allow for example to alter internal network buffers Increasing the receive buffer with setsockopt for example may increase data throughput significantly define SOCKET READ BUFFER_SIZE 256 1024 256 KB buffer int nBufSize int nVarSize better style SOCKET READ BUFFER SIZE sizeof nBufSize it s 4 byte but sizeof is nRet setsockopt m_sock SOL SOCKET SO RCVBUF char amp nBufSize nVarSize ATLASSERT nRet SOCKET ERROR r See documentation on setsockopt for further details Arrival data reading with C as shown in Handling Data Arrival Continuous Measurements can also be ported to VB Events for VB are used here with unique events for almost every type of arrival data especially when using the asynchronous interface Most of these User Manual emScon TPI Chapter 4 e COM Interface e 95 Sica Metrology Division Geosystems pass their results through basic da
77. ents Minimum Measurements Seica Geosystems with reflectors recommended 0 5 Tooling Ball or Corner Cube before the routine is started Make sure that no one walks around the area during the whole Compensation procedure Vibration can affect the measurement and walking through the beam causes the signal to break If a measurement fails the system automatically repeats the measurement to achieve a successful measurement a maximum of three times The automated Intermediate Compensation can only be started when the Leica Tracker system is ready to measure Fk See Integration in Application Software on page 15 For the initial setup it is required that the locations of the fixed targets are measured manually These locations provide the information for the driver points e Six Two Face measurements in two groups of 3 each e Each group of 3 points is in an approximate vertical line e Minimum distance from the tracker is 2m e The high and low measurements should be more than 30 from the horizontal e The groups should have a horizontal angle separation of about 180 i e all measurements should lie approximately in the same vertical plane A minimum of 4 measurements is required mathematically More measurements reduce the User Manual emScon TPI Chapter 5 e Command Description e 121 Seica Geosystems Related Commands Comments Settings Metrology Division influence of errors
78. erver is upgraded but the client still uses vl x LTControl e One of MeasureStationaryPoint MeasureStationaryP ointEx methods is used User Manual emScon TPI Chapter 1 e Introduction e 13 Seica Geosystems Solution Sample Code Metrology Division e The Measurement mode before calling these functions was one of the Continuous modes i e not explicitly set to Stationary e In this case vl x emScon versions implicitly changed to Stationary This is no longer the case in v1 2 There will be an error message that it is not possible to make a stationary point measurement while not being in stationary mode If this situation should occur to your v1 x emScon client try the following workaround 1 A compatibility switch is required in order to make v1 2 LTControl behave the same as VI x 2 Place file LTControl ini in Windows directory e g C WinNT 3 Make following entry Settings V1BackwardCompatibility 1 q Do not forget to delete this file or to set the Entry to 0 if the backward compatibility behavior is no longer wanted It is recommended to change applications to new v1 2 behavior as soon as changes are made to the client software The samples tutorials show the principles of TPI programming However the sample applications may not be of real practical use in the specific TPI commands they implement q In a practical application in order to get accurate results it is c
79. etails Set the coordinate system type to spherical clock wise SCW TPI command SetCoordinateSystemType Set the Stationary Measurement Mode TPI command SetMeasurementMode Set the Stationary measurement parameter Meas lime to 10000ms TPI command SetStationaryModeParams Attach the reflector to the target location Point the tracker to the target location TPI command e g GoPostion This is only possible when the coordinates of the point are known within 2mm otherwise track the reflector manually from the Bird bath Execute the Stationary Measurement in Face I and save it TPI command StartMeasurement Execute the command Change Face which puts the Laser Tracker from Face I to Face II q The pointing to a fixed reflector position from a station should be the same in both faces TPI command ChangeFace Execute the Stationary Measurement in Face II and save it TPI command StartMeasurement 10 Execute the command Change face which puts the Laser Tracker from Face II to Face 126 e Chapter 5 e Command Description User Manual emScon TPI Metrology Division Procedure Calculation Example Tolerances Seica Geosystems I TPI command ChangeFace 11 Repeat the steps 5 10 for all target locations Devv vertical angle Face I vertical angle Face II Devn horizontal angle Face I horizontal angle Face II Both measurements are in Face I represe
80. g OnButtonDisconnect try m winSockCtrl Close catch AfxMessageBox _T Failed to close connection n Build the application and connect disconnect to the Tracker Server The netstat exe Windows tool checks whether the connection was established correctly Step 6 Implementing 1 Implement the remaining command a Tandiot handlers for the commands Buttons that have been previously added Select the appropriate command structure as defined in the ES_C_API_Def h file and initialize it 36 e Chapter 2 e C Interface User Manual emScon TPI Metrology Division Seica Geosystems 2 Sample Initialize Tracker command handler void CEmsyCApiClientDlg OnButtonInit clear status field just cosmetics m_staticStatus SetWindowText _T try InitializecT data data packetInfo packetHeader type ES DT Command data packetInfo packetHeader 1PacketSize sizeof data data packetInfo command ES C Initialize COleVariant variantData PackIntoVariant amp data sizeof data m winSockCtrl SendData variantData catch AfxMessageBox _T MSWinSockCtrl Exception Initialize n q PackIntoVariant helper function is necessary due to the Variant type parameters of MSWinsock The PackIntoVariant needs to be defined in the application code for example locally in the EmsyCApiClientDlg cpp file PackIntoVariant requires lt atlbase h gt
81. g Data Arrival Continuous Measurements Methods to Catch Packets Metrology Division e The application is based on LTC_NM_Event notification selection By changing the parameter of SelectNotificationMethod in CCPPCIientDlg OnInitDialog all variants are prepared a different notification method can be activated However there is only an incomplete implementation of ProcessData for these alternate methods reflector processing for example is not yet complete e Only the LTC NM Event notification method is fully implemented in this sample However data transfer works with message methods One or the other methods can be activated for test reasons a good exercise would be to complete the missing implementation Only the last call of SelectNotificationMethod is effective there should be only one call to this function F See Handling Data Arrival Continuous Measurements on page 86 for details on obtaining data in general and continuous measurements in particular Continuous measurement streams are always handled asynchronous That is even if only a LTCommandSync is implemented through which the Start Measurement command may be invoked the continuous measurement packets will arrive asynchronously q A continuous measurement may last very long It is not suitable to block execution all the time e Provide a LTCommandSync object with a call to SelectNotificationMethod with 86 e Chapter 4 e
82. ght be queued under certain circumstances DataArrived 10 All TCP IP communication libraries toolkits Notification DataArrived Notification 11 Queue contain either a DataArrived notification or a similar function which is called by the framework each time data has arrived Depending on the toolkit e The function may directly return a Variant type parameter that contains the data e The function may deliver the data within a byte array e The function returns the size of the data packet that is ready to be read In this case the DataArrived function subsequently calls a ReadData function immediately in order to get the data into a local byte array If a traffic jam occurs on the incoming TCP IP line i e if incoming data is being queued a ReadData call will read all the currently available data with no notification for each individual packet Many packets may be queued and only one DataArrived notification might be issued This means that the byteArr buffer will contain more than one packet This may occur on high frequency continuous measurement streams The application has to make provisions to 26 e Chapter 2 e C Interface User Manual emScon TPI Metrology Division Seica Geosystems correctly treat such cases The IPacketSize value is most convenient when parsing the byteArr bufter If the byteArr buffer is completely filled with data it is likely that the last packet in the byteA
83. he client application is expecting Unrequired 62 e Chapter 3 e C Interface User Manual emScon TPI Metrology Division User Manual emScon TPI class CEmsyCPPApiClientDlg public CDialog public CDataReceive 5 The dialog class must therefore implement Seica Geosystems data will just be ignored and the virtual function of CDataReceive will be called with no effect These functions are empty apart from a Trace statement for developing purposes Using a CDataReceive class CESAPIReceive class allows hiding the awkward data arrival switch statement from the main code In other words The arrival data parsing function becomes a member function of CESAPIReceive and is therefore completely hidden from the client applications This sample does not exclusively derive a class from CDataReceive The dialog class inherits from CDialog and CDataReceive multiple inheritance This is appropriate because the dialog class comprises the OnDataArrivalWinsock1 arrival data notification handler which has to call ProcessData r See Class for Commands on page 58 for the appropriate declaration EmsyCPPApiCient m E Irit Tracker Find Reflector Toggle Speed 1 Point Laser Single Meas Model Slat Meas Set Reflector Muli Meas Mede Stop Mess 8 GalL the CDataReceive virtual function overrides Chapter 3 e C Interface e 63 Seica Geo
84. he Laser Tracker 5 Measurement mode stationary continuous time 6 Get reflectors 7 Set reflector 8 Go bird bath 9 Station parameters 10 Transformation parameters 11 Coordinate system type RHR LHR Seica Geosystems ES C SetEnvironmentPa rams ES_C Initialize ES C SetMeasurementM ode ES C GetReflectors ES C SetReflector ES C GoBirdBath ES C SetStationOrientati onParams ES C SetTransformation Params ES C SetCoordinateSyst emType User Manual emScon TPI Chapter 1 e Introduction e 17 Seica Geosystems Metrology Division General information Provides an overview of the parameters and their implications Initialize Laser Definition Tracker Initialize encoders and internal components Current Definition Temperature and Set index of refraction Pressure 18 e Chapter 1 e Introduction Comment This command has to be performed every time you set up a new Leica Tracker system station It is strongly recommended to use this function 2 3 times a day to initialize encoders and its internal components This is important due to thermal expansion of the tracker hardware which has a direct influence on the measurements Comment With the input of the environmental temperature pressure and humidity the system calculates the light refraction index of the interferometer IFM and the absolute distance meter ADM These parameters have a direct influence on the
85. hted nominals are taken into account The transformation algorithm determines the values of the transformation parameters to minimize the target function weighted residual square sum RSS gt residual weightMatrix residual i The weight matrix is the inverse of the covariance matrix of the residual Both matrices are scalars for constraints The term in the weighted least 136 e Chapter 6 e Mathematics User Manual emScon TPI Metrology Division Variance factor Redundancy Examples Standard Case with 3 Points Seica Geosystems squares sense refers to the fact that RSS is the target function of the minimization algorithm The variance factor mean error takes the accuracy of the input into account RSS varianceF actor redundancy The variance factor is dimensionless i e it does not depend on the length or angle units The value of the variance factor may vary considerably depending on the accuracy of the input and the model error i e the size of the residuals If the residuals are systematically bigger than the standard deviations of the actuals the variance factor exceeds 1 Otherwise it is less than 1 Fk See Examples on page 137 The redundancy is an integer defined as redundancy noEquations noParameters In a minimum configuration the redundancy is zero 0 and the variance factor is set to one 1 If the redundancy is negative the solution is non
86. ial Functions Some of the commands procedures which have been referred to in this manual are described in detail with some background information The GetReflectors command is often misinterpreted GetReflectors is used to ask the Tracker Server which reflectors are currently defined and to get the relation between reflector names and reflector Ds e SetReflector e GetReflector GetReflectors causes as many GetReflectorsRT data packets to arrive as reflectors are defined in the tracker database Each one of these packets contains the following information struct GetReflectorsRT struct BasicCommandRT packetInfo int iTotalReflectors int iInternalReflectorId enum ES_TargetType targetType double dSurfaceOffset short cReflectorName 32 Unicode of Reflector data packets of the following iTotalReflectors is just for programmers convenience e Names the number of reflectors known to the system and has the same value in every packet User Manual emScon TPI Chapter 5 e Command Description e 107 Seica Geosystems Metrology Division Provides information on arrival of the first packet as to how many packets are still outstanding Counts the incoming packets to know when the last one has arrived linternalReflectorid cRe The commands ilnternalReflectorId and flectorName cReflectorName provide important information for the user interface programmer List index The reflect
87. inates may need to be changed to reflect your environment It is recommended that a reflector is placed somewhere with approximate coordinates specified in one of the OnButtonrPointlaser toggle positions It is also assumed that a reflector with ID 1 exists as set in OnButtonSetreflector 1 Change the ID as required In order to receive data the events sent out by the Winsock control need to be caught as soon as arriving data is signalled by the framework by an Event 1 Display the ClassWizard dialog choose the Message Maps TAB and select the 38 e Chapter 2 e C Interface User Manual emScon TPI Metrology Division Seica Geosystems IDC_WINSOCK1 item in the Object IDs table q Ensure the dialog class in the class name list box is selected The Messages list shows all events the Winsock control is able to send 2 Select DataArrival press Add Function and confirm the name OnDataArrivalWinsock1 Finish the ClassWizard with OK 3 Searching all project files by arrival shows that the class wizard has inserted code in 3 locations e Function declaration in the header files message map section e Anentry in the implementation files EVENTSINK map e Anempty function body void Function Body CEmsyCApiClientDlg OnDataArrivalWinsockl long bytesTotal TODO Add your control notification handler code here 4 If a Data Arrived event happens the number of bytes that are ready
88. ing LTVideo2 ocx is an ActiveX type COM object and LTVideo2 ocx pa requires registration on the Application Processor From the command line perform the following command User Manual emScon TPI Chapter 5 e Command Description e 115 Seica Geosystems ANSI Unicode Version Development Platforms LTVideo2 tlb Server Address Events Methods Metrology Division Regsvr32 lt Path gt LTVideo2 ocx where lt path gt depends on the location of the file typically C WINNT System32 Use the Ansi version for Win98 ME platforms and the Unicode version for WinNT 2000 r See Version info of LTVideo2 ocx for details under File Properties gt Version TAB For Visual Basic or Office the ActiveX controls must be added as a reference For VC a wrapper class is generated using Add to Project Components gt Controls gt Controls type library from Visual Studio LTVideo2 tlb is the related type library delivered for convenience LTVideo2 ocx contains all type information required LTVideo2 ocx has a property server address which must be set according to your server address The port number is 5001 Any changes to the port number must also be done on the server side The size must have a width height proportion of 4 3 The image must be started stopped by invoking the method Start StopLivelmage F See Microsoft documentation for further information on how to use ActiveX controls in general
89. it is also the most complex one in terms of data parsing Read only the header to determine the size of the first pending packet The rest of the packet is estimated by reading packetSize header Size bytes Variant method Peek instead of Read the header without removing data from the socket With known size read as many bytes as indicated by packetSize See code sample below The sample code demonstrates a method to ensure complete packets if data blocks arrive scattered and to avoid data congestion traffic jams It is based on Winsock 2 0 API functions 92 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division User Manual emScon TPI Seica Geosystems LRESULT CMsgSink OnMessageReceived UINT uMsg WPARAM wParam LPARAM lParam BOOL amp bHandled The read buffer is kept static for performance reasons In a real application better make it a member variable of CMsgSink static char szRecvBuf RECV BUFFER SIZE bool bOK true long IRe e dy 0 int mnCounter 0 long lMissing 0 long 1BytesRead 0 long 1BytesReadTotal 0 int nHeaderSize sizeof PacketHeaderT PacketHeaderT pHeader NULL ATLTRACE T CMsgSink OnMessageReceived lu lu n wParam lParam if WSAGETSELECTEVENT lParam FD READ Just peek the header do not remove data from queue lReady recv SOCKET wParam szRecvBuf nHeaderSize MSG PEEK if lReady lt n
90. lientDlg cpp h should now contain Connect Disconnect TCP IP Handlers skeleton code for all push button handlers generated by the ClassWizard 1 Implement the OnButtonConnect and OnButtonDisconnect handlers 2 Include atlbase h to know CComBSTR and ES_C_API_Def h Add these files to the project with Menu Project gt Add to Project gt Files 3 The essential OnButtonConnect code reads as follows fragment only User Manual emScon TPI Chapter 2 e C Interface e 35 Sica Metrology Division Geosystems VARIANT vRemoteHostName VariantInit amp vRemoteHostName Ge VT BSTR CComBSTR bstr T 192 168 0 1 hostname or IP adress vRemoteHostName bstrVal bstr VARIANT vRemoteHostPort VariantInit amp vRemoteHostPort vRemoteHostPort vt VIT I4 Ge 700 port 700 reserved f r ES CComBSTR ensures allocating and freeing the string So far all was Variant preparation Do connect call now m_winSockCtrl Connect vRemoteHostName vRemoteHostPort q When MSWinsock control throws exceptions on failure use try f catch statements r See Sample 1 Tutorial on page 30 for the complete implementation of the OnButtonConnect function with useful comments 4 The essential code of the OnButtonDisconnect handler m_winSockCtrl Close 5 To trap MSWinsock errors the entire implementation of OnButtonDisconnect is shown here void CEmsyCApiClientDl
91. lowing code User Manual emScon TPI Chapter 4 e COM Interface e 99 Seica Geosystems Conclusion Continuous measurements and VBA Metrology Division might be typical example ErrorEvent in VBA Private Sub CommandSync_ErrorEvent ByVal command As Long _ ByVal status As Long If command ES C Initialize Then do something End If If status ES RS NoTPFound Then do something q Use extreme caution while typing the symbols with VBA 97 No IntelliSense support is available e There is no problem with enums and VBA97 It is just a potential error source due to missing type checking e Structs unless locally defined are not supported in VBA97 LTControl offers an alternative to these functions offering no significant restriction on using VBA97 e None of the event functions has struct parameters and have therefore no restriction with VBA97 both synchronous and asynchronous interface Events of continuous measurements do not directly pass the data Vix See Handling Data Arrival Continuous Measurements on page 86 for details Handling continuous measurements within VBA requires care Events can be subscribed with the WithEvent keyword and pending data can be read with GetData as shown in r See Reading Data Blocks with on page 95 for details 100 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Masking Data Seica Geosystems
92. mmandRT packetHeader As PacketHeaderT command As ES Command status As ES ResultStatus End Type Private Type InitializeCT packetInfo As BasicCommandCT End Type Private Type InitializeRT packetInfo As BasicCommandRT End Type q See also detailed comments in the VB source code File EmsyVBClient frm 1 Create the function body for the command handler with a double click to the InitTracker button 2 Declare a variable of InitializeCT and the ES_C_Initialize and ES_DT_Command tags filled in 3 Send the data packet over the TCP IP network 4 The InitializeCT variable has to be copied to a Variant The SendData function of the Winsock control takes a Variant parameter Chapter 2 e C Interface e 49 Seica Geosystems Init Tracker handler Step 5 Implementing Answer Data Receiving Metrology Division 5 Borrow the function CopyMemory from the Win32 API Declare this function in the declaration part of the form Private Declare Sub CopyMemory Lib kernel32 Alias _ RtlMoveMemory pDest As Any pSource As Any _ ByVal ByteLen As Long 6 If InitializeCT variable is named mt The sequence to copy mt into a variant reads as follows Dim bt As Byte ReDim bt LenB mt As Byte Dim vtdata As Variant CopyMemory bt 0 mt LenB mt vtdata bt Private Sub Init Click AnswerStatus Caption Just for cosmetics Dim mt As InitializeCT mt packetInfo command ES C
93. n true return non zero if msg handled e Activating this function calls SelectNotificationMethod with the following parameters cookie must be in the valid range for a user defined message m pLTConnect gt SelectNotificationMethod LTC NM WM Notify long m_hWnd MY_NOTIFY_MSG e The message ID which also acts as a cookie here is defined as define MY_NOTIFY_MSG WM_USER 99 e Entry in the message map must exist as follows ON_MESSAGE MY_NOTIFY_MSG OnNotifyMsg e Provide the ProcessData subroutine q Not every type of data packet is fully implemented User Manual emScon TPI Chapter 4 e COM Interface e 89 Sica Metrology Division Geosystems void CCPPClientDlg ProcessData void ptr int nCookie CString s s2 PacketHeaderT pHeader PacketHeaderT ptr Switch pHeader gt type case ES DT MultiMeasResult most frequent ones on top MultiMeasResultT pData MultiMeasResultT ptr for int i 0 i lt pData gt lNumberOfResults i s Format _T Slf lf 1 pData gt data i dvall pData gt data i dVal2 pData gt data i dVal3 do something with data application dependent m_staticContMeas SetWindowText s for break case ES DT Error ErrorResponseT pCmdData ErrorResponseT ptr s Format _T error command d status d n pCmdData gt command pCmdData gt status AfxMessageBox s break
94. ndle such situations with a packet size transmitted in the header of each packet The Winsock function setsockopt may be used to tune TCP IP transmission rate by increasing buffer sizes Fi See Win32 documentation for more information about Winsock API especially the WSA function threads and events Fi See Receiving Data Sample 9 on page 66 for a more sophisticated data receiving thread W See also Queues and Scattered Data on page 91 and comments in source code This sample can easily be ported to non Win32 platforms Unix Linux and Mac 54 e Chapter 2 e C Interface User Manual emScon TPI Metrology Division Windows application Winsock API Seica Geosystems q Creating a console application requires the use of the WSAEventSelect function with events and threads For Windows applications the WSAAsyncSelect function is more appropriate It issues Window messages instead of events and is simpler to handle No separate thread is required the window message loop takes this part Vi See Win32 documentation on WSAAsyncSelect The Winsock API functions are more efficient than the Winsock OCX control The use of a MFC library permits a very convenient class wrapper around the Winsock API q Refer to the CAsyncSocket and CSocket classes in C Windows MFC Application on page 84 for details User Manual emScon TPI Chapter 2 e C Interface e 55 Seica Geosystems Metrol
95. nous initialize function this one does not stop at the Initialize function Exit Sub is reached immediately When tracker initialization is done a notification or event is sent 2 For asynchronous commands the answers must be handled by some event mechanism This could be Events Windows Messages User Manual emScon TPI Chapter 4 e COM Interface e 79 Sica Metrology Division Geosystems custom window bound registered WM COPYDATA For Visual Basic Events are the right choice The event mechanism is provided by the _ILTCommandAsyncEvents interface which is a subsidiary of ILTCommandAsync To activate this mechanism for a Visual Basic application provide the keyword WithEvents upon the declaration When no requirements for catching events exists omit the WithEvents keywords in order to save overhead 3 When no requirement for catching events exists omit the WithEvents keywords in order to save overhead 4 When no requirement for catching events exists omit the WithEvents keywords in order to save overhead q The synchronous interface has an event interface _ILTCommandSyncEvents It is used for continuous measurements and unsolicited error messages which cannot be handled synchronous by their nature q Events are one of the notification methods of the LT Control When using Windows messages for asynchronous notifications the keyword WithEvents is invalid Windows messages are appropriate for VC clients
96. ntation Face II measurements are represented in Face I Devvt 90 7289893 90 7287338 0 0003 Deg Devn 269 9877001 269 9879985 0 0003 Deg The recommended tolerances of the deviations are Vertical angle 13cc 0 0012 Deg Horizontal angle 13cc 0 0012 Deg T When the tolerance is exceeded an Intermediate Compensation is recommended User Manual emScon TPI Chapter 5 e Command Description e 127 Metrology Division Seica Geosystems 6 Mathematics Transformation Introduction It is a mapping of a set of points called actuals or measurements to an equal number of points called nominals or reference The transformation parameters consists of the following e scaling e rotation e translation Computation of a point to point transformation should not be confused with applying a given transformation In mathematical terms the computation of a transformation is a nonlinear weighted least squares problem It is solved through a Newton iteration linearization consisting of the following steps 1 An initial approximation is calculated ignoring the accuracy statistics of the input 2 The initial approximation is improved iteratively until a certain accuracy goal is achieved Transformation A transformation is described numerically by Parameters three 3 translation three 3 rotation and one 1 scale parameter The scale is typically close to 1 e g when describing a temperature dependent
97. ock Control Variants overhead Seica Geosystems CESAPIReceive Class Description Procedure Metrology Division q Functions OnDataArrivalWinsock1 and ProcessData can be copied from Sample 1 with minor extensions to the switch statement of ProcessData F See also Receiving Data Sample 9 on page 66 for more information The following describes the class CESAPIReceive r See file ES CPP API Def h This class is represented by the file pair DataReceive cpp h CDataReceive is a native class i e it is not derived from some other base class ProcessData is designed as a member function of the class It takes the data as it comes from the TCP IP network and is the switch statement for arrival data interpretation Results are not written directly from the switch statement to the user interface virtual function is called for each type of arriving data These virtual functions pass the data through their command type dependent parameter to the calling function q The interpretation of incoming data in this switch statement is implemented only as far as needed for this sample which is not the case for CESAPIReceive 1 Derive a class from CdataReceive 2 Call the ProcessData function of the class derived where the data comes in from the network only at one location in the OnDataArival notification handler The derived class must implement only virtual functions for answer packet types t
98. of a particular COM object e The LTConnect object needs to be created with New F Refer to a COM book for further details 1 To access its interfaces an object variable of type LTConnect is needed in the declaration part of the VB application 2 Declare an object for each one of the remaining types Dim WithEvents ObjAsync As LTCommandAsync Dim WithEvents ObjSync As LTCommandSync 3 Provide either a synchronous or an asynchronous interface q Declaring both as done here for demonstration purposes will result in some duplicate data arrivals 74 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Seica Geosystems 4 The two objects ObjSync and ObjAsync cannot be created with New the VB compiler does not even allow this q This is also by design of the COM component where these two objects have been designed as Noncreatable the object instances are created in the LT Control s control scope and not locally in the application 5 The keyword WithEvents makes the application recognize event notifications LTCommand Objects An LTConnect object is always required whereas only one of the LTCommandSync or LTCommandAsync objects is required Depending on the selected notification mechanism LTCommandAsync or LTCommandSync is to be declared with without event support WithEvents keyword 1 The non createable LTCommandSync and LTCommandAsync act like pointers The pointers
99. of your operating system O5 can also be used Keywords under VC include Win32 Sockets API or if using MFC CAsyncSocket and CSocket Visual Studio contains a TCP IP communication library User Manual emScon TPI Chapter 1 e Introduction e 11 Seica Geosystems Version Compatibility Future Compatibility Backward Compatibility Metrology Division MSWinsck ocx as an ActiveX control COM object Applications with ActiveX controls must be Windows based i e with a graphical user interface GUI Console applications are not suitable for ActiveX controls The use of a static TCP IP library for example Win32 Sockets API or a TCP IP communication DLL enables console DOS applications Console applications have the advantage of comprising minimal overhead and are often single source file applications The sample codes have examples of both GUI applications with MSWinsck ocx as the TCP IP communication library with VC and DOS applications F See also the Reference Manual This is a very important issue in order to prevent client application software adjustments upon future emScon server software upgrades The coming versions of emScon will include new data over the TCP IP connection such as new packet types status messages and new error messages The existing applications will be valid in future emScon versions with one important caveat r See Backward Compatibility on page 12 for details B
100. ogy Division 3 C Interface Class design Platform Independent TCP IP Class Interface The C interface does not provide any additional functions for the Tracker Server It builds upon the C interface and is made up of one include file ES CPP API Def h with the ES C API Def h as its basis The C interface implements two classes CESAPICommand and CESAPIReceive apart from wrapper classes for each data structure from C TPI CESAPICommand handles sending commands from the client application to the TS and CESAPIReceive allows easy receiving and parsing of data sent by the TS to the client application q The advantage of a class design is the availability of constructors to perform struct initialization A Tracker Server C interface is preferable to a C low level interface if a C compiler is available a See the Reference Manual for more information Tracker Server client programming remains plattorm independent since C compilers are available for virtually every platform This chapter does not touch TCP IP issues This sample uses the MSWinsock OCX tor communication as in Sample 1 amp 2 56 e Chapter 3 e C Interface User Manual emScon TPI Metrology Division SendPacket ReceiveData Sample 4 Sample 4 specifics Application Framework Seica Geosystems The class CESAPICommand contains a pure virtual function SendPacket which must be overwritten This approach allows convenien
101. oint measurement is calculated according to the tracker accuracy For single point measurements stationary sphere center and circle center the a posteriori or repeatability covariance is calculated from the actual statistical variation of the many measurements In the spherical tracker coordinate system the a priori covariance matrix is diagonal Conversion to Cartesian coordinates results in a full matrix User Manual emScon TPI Chapter 6 e Mathematics e 133 Seica Geosystems Input of Transformation Computation Nominal Points Metrology Division Transformation to other coordinate systems again transforms the covariance matrix Maximal consistency is achieved by using the full matrix However at any stage the standard deviations i e the square roots of the diagonal entries provide sufficient condensed information on the accuracy of the respective triple The covariance matrix of nominal points is diagonal However if measured points are used as reference a full matrix may apply to nominal points as well Nominal points are added as shown in the The parameters listed are the three coordinates together with their standard deviations and covariances We recommend use of the following predefined standard deviations Coordinate Symbol Value accuracy Fixed exactly ES_FixedStdDev known Unknown free ES UnknownsSt 1E35 dDev Approx ES_ApproxStdD 1E15 reasonable ev Weighted 1 gt 0 lt
102. or masking data require curly brackets around a particular case block Otherwise the compiler will claim e If then else can be used instead of switch statements However switches are more efficient User Manual emScon TPI Chapter 2 e C Interface e 29 Seica Geosystems Sample 1 Tutorial Step 1 Creating an Application Framework using AppWizard Step 2 Import the Winsock Control Metrology Division e Frequent items should be treated at the top of a switch statement for example multi measurement results not covered above C Client Applications The EmsyCApiClient sample is presented in tutorial form based on Visual C v6 0 it uses MSWinsck ocx for TCP IP communication The application is given a dialog box look and feel q An OCX control requires a dialog Windows based application with VARIANT data types 1 oe N 2 Launch Microsoft Visual C Visual Studio Select File gt New gt Projects 2 3 4 Select MFC AppWizard exe from list Type EmsyCApiClient in the Project Name field Click OK Select Dialog based Click Next Uncheck AboutBox Check 3D controls and ActiveX Controls Click Next Select optional No thank you under Would you like to generate source file comments Leave other settings unchanged Do not change any file names 10 Click Finish Click OK on last pane 11 Compile the application 12 Run the application 1 2 30 e
103. or name is a string value in Unicode which is see on the user interface of the application software This reflector name is an alias for the reflector ID and cannot be resolved by the system The system can internally only deal with reflector IDs which are integer numbers The commands take return a reflector ID as a parameter It is crucial to provide the correct reflector ID to SetReflector q Passing the ID of an unintended but existing reflector will cause wrong measurement results Programmers often fill all reflector names in a list box When the user selects one of the reflectors shown in the list box a SetReflector command is carried out q Hence the need for a lookup table It is not correct to use the index of the list box as a reflector ID This is because the reflector IDs are arbitrary in sequence and may contain gaps 108 e Chapter 5 e Command Description User Manual emScon TPI Metrology Division Lookup Table Reflector Name Unicode Format Leica Geosystems e The programmer must not assume that the reflector IDs are a sequence of 1 n without any gaps Although most systems may deliver reflectors with sequential reflector IDs starting from 0 with no gaps q This may not be presumed Every system behaves differently e GetReflectors may deliver for example 3 reflectors with the following Names and IDs Name ID CCR 75mm 7 CCR 1 5in TBR 0 5in The list box
104. osystems Private Sub CommandSync_ErrorEvent _ ByVal command As LTCONTROLLib ES_ Command _ ByVal status As LTCONTROLLib ES ResultStatus e When doing the same in VBA9 it will read as follows Private Sub CommandSync ErrorEvent ByVal command As Long _ ByVal status As Long e Visual Basic keeps the enum type information and recognizes the parameters with their correct enum types while VBA just passes them as long parameters However the symbols of the enum values are correctly recognized although not checked by the compiler for correct typing which can lead to errors which are difficult to find This problem is not specific to VBA it also exists in VB There are two different situations where enums and their value symbols affect the interface e Method takes enum type parameters for example call Set MeasurementMode the same way for both VB and VBA ICommandSync SetMeasurementMode ES MM ContinuousDistance e ES MM ContinuousDistance will be correctly recognized as having the value 2 see enum definition e Correct typing of values VB as well as the VBA interpreter will not recognize typing errors in enum symbols here However both VB and VBA provide IntelliSense providing for a selection from a list rather than having to type them in e Event handlers as we have seen above pass enums as long values in VBA The incoming values can be tested against enum symbols In an event handler the fol
105. pe vt VT_I2 vtType iVal VT_ARRAY VT_UI1 pass expected result type through iVal pass packet length through 1Val long parameter VARIANT vtMaxlen vtMaxlen vt VT I4 vtMaxlen 1Val bytesTotal cry read data from socket into variant m winSockCtrl GetData amp m vtData vtType vtMaxlen catch AfxMessageBox T MSWinSockCtrl Exception GetData n check if all data has arrived just diagnostics if m_vtData parray gt rgsabound gt cElements unsigned long bytesTotal now data can be processed if ProcessData Beep 200 100 else ASSERT false will only raise in debug mode ProcessData To implement ProcessData parse incoming data as described earlier in this document The implementation of ProcessData as a member function does not require passing data as a parameter The m_vtData member variable can be directly accessed 10 Mask the data buffer byte array with a PacketHeaderT struct to identify the packet type 11 Depending on the packet type use the appropriate Sub mask BasicCommandRT SingleMeasResultT etc q This simple application handles only a few packet types commands and the ProcessData function remains compact For applications that User Manual emScon TPI Chapter 2 e C Interface e 41 Sica Metrology Division Geosystems implement virtually all Tracker Server answers the parsing code must be split into smaller functions
106. pensation 120 CULO PEPEPEPE T E T EE 120 Area Required rrarrnnnnnrnnrnannannnnvnnnnnvnnnnnnnnnnnnnn 121 Procedure accepted ceo ceed ceeds 121 Related Commands ccccececeeeeceeeeeeeeeeeess 122 Comments 0 ccceeecececececececeeeaeaeaeaeaeaeaeaeaeas 122 Two Face Field Check rannnnnnnnnnnnnnnnnnnnnnnnnnnne 123 FPO CC EE 123 Field check two face Measurement 123 Client Routine ararnnnnnvnnnvnvnvnvnvnvnnnnnvnnnnnenennn 123 Procedure Preparation rrarnannannnnnnnnnnnnnnnn 124 Procedure Measurement 0cceceeeeeeeees 126 Procedure Calculation cccccceseeeeeeeeeee 127 6 Mathematics 129 TransformatiOn xaxsnnannnnnnnnununnnnnnnnnnnnnnvennnnnnnn 129 Nod vr 129 viii e Contents User Manual emScon TPI Metrology Division eica Geosystems Transformation Parameters ararnnnnnnnnnnnnnnnnnnne 129 Transformation TYP S ccccccsccceeeeeeeeeeeeeeeeees 130 Transformation vs Orientation 132 Orientation 0 0 0 ee cececececeeaeeeeeeeeeaeavaeaeavaeaeaeas 132 Transformation cccceececececeeecececececececeeeees 132 Pl Urs 133 Input of Transformation Computation 134 Nominal Points c ccceceeeeceeeeeceeeeeeeeeeeeees 134 Actual POints rarnnnnnnnnnnnnnnnnnnnnnnnennnennnnnnnnene 135 Parameter Constraints rrrnnnnnnrnnnnnnnnnnnnnvnnn 135 Output of Transformation
107. plication framework and for initializing COM objects The LTControl dll must be correctly registered before proceeding Vic See LTControl dll Installation on page 72 for details 1 Launch Visual Basic 6 0 choose from menu File gt New Project gt Standard exe Click OK 2 Save the form as LtcVBCIient frm and the project as LtcVBClient vbp 3 Choose menu Project gt References 4 In the dialog list box check the entry LTControl 1 2 Type Library Click OK q Ensure file path at the bottom of the dialog matches the control s registration location browse for the correct location using the References dialog The LTControl dll is not an ActiveX OCX control It is a general ATL type COM object which can User Manual emScon TPI Chapter 4 e COM Interface e 73 Seica Geosystems Differences between LTConnect amp ILTConnect Accessing Interfaces Metrology Division be used in non window based applications It will also support for example pure C clients console applications q It is not possible to place an LTControl instance to the VB Form as MSWinsck ocx requires it Differences between object LTConnect and the related interface ILTConnect e In VB clients interfaces are not dealt with directly as objects are e The keyword New in the declaration of LTConnect creates this object within the client application e Local or remote object creation in the COM server depends on the design
108. ponent Reflector ocx which allows use without a Visual C compiler q No support for this ActiveX component is provided Remarks User Manual emScon TPI The Reflector ocx control must be registered before it can be used Only one instance of such a control can be instantiated per Form Dialog box The properties ServerAddress and PortNumber can be specified at Form Dialog design time However this only makes sense if these parameters are constant The more common way is to set these properties programmatically Call the method Initialize atter having set the properties and not before the client application has successfully connected to the same address port This lets the client application instead of the Reflector ocx handle any connecting problems The client application must ignore answers from commands triggered by the Reflector ocx Get Reflectors GetReflector and SetReflector Do not implement an Error Event handler for Reflector ocx The control has a built in handler Visual Basic does not allow it it causes a compiler error If correctly applied the component should never fire an error event Chapter 3 e C Interface e 67 Sica Metrology Division Geosystems e Here is a code sequence for a VB application Typically executed in Form Load e Itis assumed that the client application has already successfully connected to the same address port before these calls Keyboard Interf
109. programming interfaces The high level TPI supports both synchronous and asynchronous methods COM objects expose interfaces described by a Type Library which is implicitly included in the DLL A pure Type Library LTControl tlb is also available although not really needed This High level interface does not provide any additional functions in terms of Tracker Server controlling User Manual emScon TPI Chapter 4 e COM Interface e 69 Sica Metrology Division Geosystems functions LTControl is strictly based on the C TPI with a high level convenient programming interface Vi See chapter COM Interface in the Reference Manual TPI for more information on the interfaces provided q COM interfaces work well together with Visual Basic and other programming languages on the Win32 platform unlike the low level interface Vi See Sample 2 Tutorial on page 46 70 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division feica Geosystems COM vs Low Advantages Disadvantages Level No include file to deal A DLL ATL COM Programming with therefore no component Its source translation required of C code is not public structs and enums to VB syntax No TCP IP library or Is limited to Win32 function needs to be plattorms provided All these functions are built in Only the IP address of the tracker server needs to be provided The high level interface Due to the COM offers bo
110. r 2 e C Interface User Manual emScon TPI Metrology Division InitDialog Handler Connect Disconnect Handlers Seica Geosystems Use of Variants packing unpacking before sending receiving data is necessary due to the Variant parameters of the MSWinsck ocx Send Receive functions Use of an alternative TCP IP library with C or C Interface or the native TCP IP communication functions of the operating system enable design of non Win32 based or non Windows e g console applications Apple OS Linux etc applications These will not require Win32 specific Variants Fi See Sample 3 on page 52 or Receiving Data Sample 9 on page 66 for details r See Sample 4 on page 57 for explanation of the InitDialog handler with the implicit Connect function and close with WM DESTROY The ClassWizard s Message Maps TAB can be used to add push buttons to dialog templates and to attach appropriate message handlers to them together with Static and Edit controls to dialogs with member variables Fk See Sample 1 Tutorial on page 30 for explicit Connect and Disconnect handlers bound to appropriate push buttons with all required controls added to the dialog template Wi Refer to VC Scribble tutorial for information on dialog box design 1 Remove the OK button and the TODO label from the dialog template 2 Replace the caption of the Cancel button with Exit User Manual emScon TPI Chapter 2 e C Interface
111. rameters rrarnurnarnarvnrvnrvnrvnnvnrenenneenenn 20 Transformation Parameters cercen 20 Coordinate System Type rrunnnrnnnrnanenannnnnnnnnnnnre 21 2 C interface 23 Low level programming axrnnnnnnnnnnnnnnnnnnnnnnnunnne 23 Introduction rrnrvarvnrrernrvnrvurnernennavnnnuenennennsnuenene 23 TCP IP Connection rrarvnvrnnrnnrvnrvnnvnnvnnennennenne 23 Sending Commands arrranerannnannnnrnnrrvanenanennne 23 COdS SUN nn 24 Initialization Macros arrurnnrnnvnnnnrnernnvnnnnavneneenn 24 C 45 0 ieira rens 25 Answers from Tracker Server ccce 25 Asynchronous Communication 000066 26 DataArrived Notification ccccccccceeeeeeeeees 26 PacketHeader Code cccccccseeceeeeeeteeeeeenees 2 Command Subtype Switch rrrerrarnnrrrnrrnnrnnnr 28 C Client Applications ccccccsscseesseseeeeeeeeees 30 User Manual emScon TPI Contents e v Sica Metrology Division Geosystems Sample 1 Tutorial cccsrsencccsansaarsanvsasverseqmeneonemannens 30 Step 1 Creating an Application Framework using MNA 30 Step 2 Import the Winsock Control 30 Step 3 Create a Winsock Controls Instance 31 Step 4 User Controls on the Dialog 32 InitDialog Handler rarrnnrnnrrrarerarorarnnnnnnnnen 33 Connect Disconnect Handlers rrrarrnnrnnnnnnr 33 Step 5 Connect Disconnect TCP IP Handlers 35 Step 6 Implementing Command Han
112. res not shown so far How to retrieve the reflectors known to the system It also demonstrates continuous measurements W View the source code for details Note that this code contains a relatively big overhead needed for user interface issues The Tracker Server specific part is not that dominant Source Code 5 Description User Manual emScon TPI Information that is displayed in list boxes such as units CS type is automatically read from the Tracker Server upon startup What is seen has been actually selected Changing the items of one list box automatically creates a Set for the newly selected item On changing units CS type etc some dependent information may vanish from the related edit fields to ensure consistency This is due to the paradigm What you see is selected Do a Get to recover it which can also be done by the application On setting new values the Set command is automatically followed by a Get two beep sounds The Get is not required only for testing and demonstration purpose Reflectors are read upon client startup Can be heard by characteristic beeps They must be selected in the reflectors list box q The GetReflectors button is only required in emergency cases If the client starts before the Tracker Server is ready and the client dialog shows up but is not able to read the reflectors yet Chapter 4 e COM Interface e 85 Seica Geosystems Handlin
113. rr is incomplete The packet fragment needs to be saved and padded to complete upon the subsequent read call F See Queues and Scattered Data on page 91 for details 12 Assuming a received data block has been read into a byte buffer named byteArr In order to interpret the data a mask is required This requires knowledge of the type of data packet enum ES_DataType A typical PacketHeader interpreting code is as follows PacketHeader Code PacketHeaderT pData PacketHeaderT byteArr 13 Access the type and the size of the packet can be with The packet size is only for convenience Sizeof type also returns the packet size q This redundancy may be used for consistency checks and is helpful when using programming languages other than C that lack the sizeof operator The packet size is reliable on received packets When sending packets to the Tracker Server it is recommended to initialize the IPacketSize variable correctly although the Tracker Server ignores it This approach has been chosen to reduce possible programming errors User Manual emScon TPI Chapter 2 e C Interface e 27 Sica Metrology Division Geosystems Command Subtype 14 Command type answers require a switch Switch statement to distinguish the command subtype Non data returning commands can all be treated the same and are handled in the default switch statement All other command answers need to be masked with the appropriate result structur
114. rucial to implement all the steps as listed under Initial steps 14 e Chapter 1 e Introduction User Manual emScon TPI Metrology Division Error Handling Interface Design Hard Coded Information Seica Geosystems r See Integration in Application Software on page 15 for details The number of files and overhead has been kept to a minimum Code generated from wizards such as recompiled headers icon res2 includes and cosmetic functions have been stripped off Following the tutorial instructions may result in some blown up code compared with the samples bundled with this manual SDK However the essential code remains the same W See also the numerous comments in the sample source files r See Appendix on page 140 for a complete list of sample source files The samples do not always implement complete error handling and may need to be run through the debugger The user interface design is kept at a minimum level for example unavailable buttons are not erayed out Such items are general issues of Windows programming The samples contain some hard coded information IP address coordinate values that must be adapted to the local environment Integration in Application Software The emScon graphical user interface emScon Base User Interface emScon BUI provides a browser based access from the Application Processor Access over the browser requires the IP address of the emScon Tracker Ser
115. sing if lBytesRead gt 0 1lBytesReadTotal 1BytesRead if bOK bOK amp amp lBytesRead 1Missing amp amp 1BytesReadTotal lt RECV BUFFER SIZE if bOK ProcessReceivedData is assumed to take one single complete data packet It contains a switch statement to evaluate the packet we have seen this method several times in this manual samples if lBytesReadTotal pHeader gt lPacketSize ProcessReceivedData szRecvBuf lBytesReadTotal if else bOK false LE 10K make sure socket is cleaned up on data jam in order to recover ordinary data receiving nCounter 1BytesRead recv SOCKET wParam szRecvBuf RECV BUFFER SIZE 0 ATLTRACE T Recover in loop n while 1BytesRead gt 0 amp amp nCounter lt 128 ATLTRACE _T Unexpected data fatal error n Beep 250 10 data lost else return bOK true when message handled OnMessageReceived This code ensures that only complete packets are processed However the client may still not be fast enough to process all the incoming data The 94 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Cause of Data Loss Reading Data Blocks with Visual Basic Seica Geosystems TCP IP framework will buffer data up to a limit If such limits are reached arbitrary data may arrive The above function has limited recovery ability in case this should happ
116. systems Single Point Measure Data Sample Remarks 64 e Chapter 3 e C Interface Metrology Division void CEmsyCPPApiClientDlg OnSingleMeasurementAnswer SingleMeasResultT pSingleMeas CString s sStatus Do something with the data format it s Formati T X 61f Y 6lf Z 6lf n pSingleMeas gt dvall pSingleMeas gt dVal2 pSingleMeas gt dVal3 m staticResult SetWindowText s then display it Zi also display return status sStatus Format _T d pSingleMeas gt packetInfo status m staticStatus SetWindowText sStatus if pSingleMeas gt packetInfo status ES RS A110K Beep 100 100 command failed 6 The data is delivered through a pointer to a SingleMeasResultT struct function parameter This function neither needs to perform any DataRead nor any ProcessData interpretation q It solely uses the data just display it This function uses a pointer argument while the OnCommandAnswer function has been designed to take a reference argument see comment in code This constellation is used to demonstrate the two possibilities The actual class should consistently use one or the other method q References should be preferred to pointers whenever possible in C programming Vix See the many comments in the sample source code Change the IP address and hard coded numbers coordinates for PointLaser command in the sample code as required
117. t Send command functions q Dealing with C data structures for sending commands is no longer required as they are completely hidden In order to select the data the application is interested in CESAPIReceive offers a method ReceiveData which is called on data arrival events as well as numerous virtual member functions All class member functions are defined inline Neither a library nor a cpp file is required One single include file suffices The C interface is fully transparent with complete source code provided This sample is not a tutorial as the implementation process is essentially the same as Samplel Sample 4 specific differences will be highlighted 1 Creating an application framework and user interface 1 Name the project EmsyCPPApiClient 2 Do not add explicit Connect Disconnect buttons 3 Implement the TCP IP connection code to the InitDialog function and use the WM_DESTROY handler to close the connection q Not a key difference It performs the connection disconnection automatically User Manual emScon TPI Chapter 3 e C Interface e 57 Sica Metrology Division Geosystems Fk See EmsyCPPApiClientDlg cpp h files for details 4 More buttons and appropriate handlers are added with the Class Wizard The dialog template reads as follows Point Laser Single Mess Model Start Meat SetReliector Mu Meas Mode Class for
118. t code changes if some other TCP IP communication Winsock API CAsyncSocket or a third party library is used User Manual emScon TPI Chapter 3 e C Interface e 59 Sica Metrology Division Geosystems bool CESCppClientApiCommand SendPacket void pPacketStart long lPacketSize try COleVariant variantData PackIntoVariant pPacketStart lPacketSize if m pWinSockCtrl m pWinSockCtrl gt SendData variantData else ASSERT VALID m pWwinSockCtrl pointer valid Catch TRACE _T MSWinSockCtrl Exception SendData n return false return true h 1 In the dialog class CEmsyCPPApiClientDlg declare an instance of type CESCppClientApiCommand private CESCppClientApiCommand m EsApiCommand 2 The implementation of the command handlers dialog buttons reads as follows void CEmsyCPPApiClientDlg OnButtonStartmeas if m_EsApiCommand StartMeasurement TRACE _T StartMeasurement failed n 3 OR void CEmsyCPPApiClientDlg OnButtonPointlaser if m EsApiCommand PointLaser 1 342 2 09 0 5 TRACE T PointLaser failed n q Textual Error messages directed to debug window using TRACE statements are not sufficient for an end user application C TPI Source code 4 The same function designed with C with a code reduction of about 80 instead of C reads as follows LE See Sample 1 Tutorial on page 30 60 e Chapter 3 e
119. ta type parameters r See Handling Data Arrival Continuous Measurements on page 86 q Message notification methods with VB are not demonstrated here However there are some exceptions where the data must be retrieved explicitly upon an incoming event These types of events can be identified by the DataReady term in their names The continuous measurement events are among these The code below shows an implementation of the ContinuousPointMeasDataReady event handler It does not demonstrate the processing of the data received This handler does some diagnostics checks whether the size of read data complies with the passed parameter If OK the size is displayed otherwise an error message is shown By calling the ObjConnectGetData function the arrived data that caused the event is being read into a local buffer The application interprets and processes the data In order to get the measurement values loop through the array and interpret the array elements with MeasValueT not shown here q VB may not be the right choice to process high rate continuous measurements especially when running the interpreter The VB project must be compiled first 96 e Chapter 4 e COM Interface User Manual emScon TPI Metrology Division Seica Geosystems Private Sub ObjAsync_ContinuousPointMeasDataReady _ ByVal resultsTotal As Long ByVal bytesTotal As Long Dim data As Variant Dim tp As VbVarType Dim sz As
120. ternal x and y axes CallOrientToGravity User Manual emScon TPI Chapter 5 e Command Description e 117 Seica Geosystems Metrology Division Comments e This command is only available in combination with a Nivel20 Inclination Sensor e Executing this command drives the tracker head to 4 different positions on the xy plane e Taking Nivel20 measurement samples e In addition the station inclination parameters Ix and ly are calculated and returned as result parameters Executing this command does not implicitly apply any orientation values to the system In order to activate the station orientation to gravity the two result values Ix and ly must be explicitly set with the command SetStationOrientationParams Rotation angles rotl and rot2 Fi See Mathematics on page 129 for mathematical description Transformation This procedure matches a measured set of points Procedure to a given set of nominal points by using a least squares best fit method The procedure calculates the 7 parameters x y z omega phi kappa scale which describe the transformation filter to be applied to the measured points in order to represent these in the coordinate system defined by the nominal points Related Commands ClearTransformationNominalPointList ClearTransformationActualPointList AddTransformationNominalPoint AddTransformationActualPoint SetTransformationInputParams GetTransformation
121. ters Basic data type parameters are a requirement in order to use these functions from VBA Excel Access q For programming languages supporting user defined data types VC Visual Basic having a function with only one struct parameter User Manual emScon TPI Chapter 4 e COM Interface e 81 Seica Geosystems Remark Metrology Division would be more convenient LTControl offers a collection of such extended functions F See Reference Manual for details One of these functions is implemented in the sample MeasureStationaryPointEx Private Sub StartMeasEx Click Dim result As SingleMeasResultT On Error GoTo ErrorHandler ObjSync MeasureStationaryPointEx result display the result MsgBox result packetInfo status amp CStr amp result packetInfo packetHeader Type amp _ CStr amp result dVall amp CStr amp result dVal2 amp CStr amp result dVal3 Exit Sub ErrorHandler MsgBox Err Description End Sub The data type SingleMeasResultT from the C TPI is transparent through the COM interface The VB application knows this type through its reference to the LTControl Do not test explicitly against the VB keyword True if using the Get lt FunctionName gt Ex methods of the LTControl for those commands returning Boolean data within their result structure This is because the Boolean member in these structures if true are 1 However the VB keyword
122. th synchronous interface the and asynchronous performance may be communication support affected There are wide varieties Since TCP IP of notification methods communication is built for arrival data when in there are no tuning using asynchronous possibilities communication Supports various The component needs to programming languages be registered on the client Easy to use due to PC support of IntelliSense for Microsoft Visual and Office programming tools Interfaces and All interfaces of the LTControl including their Notification Methods methods and properties are listed in the Reference Manual F See chapter COM Interface in the Reference Manual for more information on the interfaces provided User Manual emScon TPI Chapter 4 e COM Interface e 71 Seica Geosystems LTControl COM Viewer Registering COM Objects LTControl dil Installation ATL dilI Installation Metrology Division In order to get detailed information about the Interfaces including data types properties methods and events exposed by a COM object a COM viewer may be used Visual Studio offers such a viewer The OLE COM Object Viewer can be launched from the Tools menu of VC File gt View Type Lib gt LTControl dll or LTControl tlb COM objects must be registered on the application PC before they can be used 1 Register LTControl dll on the client PC both developer and customer PCs
123. tten block since we are doing function calls to a COM object LtConnect that can throw exceptions we need an error handler Note we would not require an error handler in the other Event Handlers LtSync_ReflectorsData LtSync_ReflectorPositionData because usually no COM functions are called there subsequently On Error GoTo ErrorHandler 1 Get the data Dim data As Variant LtConnect GetData data 2 Get header info Calling this function is optional the only thing we need here is numResults However it s the same as resultsTotal passed to the functions Dim numResults As Long Dim measMode As Long Dim temperture As Double Dim pressure As Double Dim humidity As Double LtConnect ContinuousDataGetHeaderInfo data numResults _ measMode temperture pressure humidity since we have numResults twice from different paths lets check them for compliance If Not numResults resultsTotal Then MsgBox Fatal Error unexpected discrepancy End If since we know how many results we can loop over the index Note that index runs form 0 to numResults 1 For index 0 To numResults 1 data and index are input parameters rest output LtConnect ContinuousPointGetAt data index status _ timel time dVall dVal2 dVal3 TODO do something with each result here Next Exit Sub ErrorHandler MsgBox Err Description End Sub been primarily designed for use with VB A For C
124. urposes case ES C Initialize case ES C PointLaser case ES C FindReflector case ES C StartMeasurement case ESC SetReflector common error handling for all commands display error status In a real program we would have to map these codes to text strings describing the error sStatus Format T d pData2 gt status m staticStatus SetWindowText sStatus handle error if pData2 gt status ES_RS_A110K return false break TODO add further cases as other commands become implemented See file ES C APT Def h for further commands and related answer structures default return false switch pData gt command case ES DT SingleMeasResult A has arrived so mask it with SingleMeasResultT structure single meas result type answer SingleMeasResultT pData3 SingleMeasResultT m_vtData parray gt pvData if something went wrong there is no reason to continue if pData3 gt packetInfo status ES RS AI1OK Chapter 2 e C Interface e 43 Seica Geosystems Asynchronous Communication Remarks 44 e Chapter 2 e C Interface Metrology Division return false Do something with the data display it s Format _T X 31f Y 31f Z 31lf n pData3 gt dVall pData3 gt dVal2 pData3 gt dVal3 m staticResult SetWindowText s sStatus Format _T d pData3 gt packetInfo status also display return status m
125. ver The BUI includes User Manual emScon TPI Chapter 1 e Introduction e 15 Seica Geosystems Essential Steps Command Sequence Metrology Division e A Toolbar for sensor control and display of results and their statistics e Web pages providing access for sensor and server settings Integration of the application software running on the Application Processor with the emScon BUI is explained in Sample 13 r See the emScon Reference Manual for BUI details Initial steps A client application must carry out all steps upon startup Omitting some of these steps will prevent the tracker from measuring or lead to inaccurate results Inaccurate results are difficult to detect q Setting correct environment parameters temperature pressure or configuring the system for automatic environment parameter reading is crucial q The environment parameter setting needs to be done before tracker initialization r Sample 7 implements all essential steps Other samples are not exhaustive and show programming principles only E See also Leica Tracker Training Manual Steps TPI command 1 Establish TCP IP Depends upon TCP IP connection communication See different samples 2 Set units length ES_C_SetUnits angle temperature and pressure 16 e Chapter 1 e Introduction User Manual emScon TPI Metrology Division 3 Set current environmental temperature pressure and humidity 4 Initialize t
Download Pdf Manuals
Related Search
Related Contents
【D505・D707】超ワイドバンド受信用アンテナ Ici et ailleurs réunis pour mieux se comprendre 1/2 Les médicaments vendus sans ordonnance, tout comme ceux SC OPTICAM 2300292_02 Trap_0_1.ap CHAMPÚ-LOCIÓN BIOTRATANTE CABELLO OSCURO Scala InfoChannel Network Manager User`s Guide BHS 6014 Accelnet Micro Panel User Manual Copyright © All rights reserved.
Failed to retrieve file