Total Station and GNU/Linux: Zeiss Elta R55 done!

Posted by steko on 25 February, 2008 16:04

The pySerial library is really good. Today I installed it and in half an hour I got acquainted with its class methods, even though I have little knowledge about serial ports and the like.

With some trial and error about the connection parameters, I was even able to solve the problem with non-printable characters, tweaking the bytesize of the connection.

Briefly, these are the steps I did in the interactive ipython console:

  1. >>> import serial
    >>> ser = serial.Serial('/dev/ttyUSB0', \
        baudrate=9600, bytesize=serial.SEVENBITS, timeout=0, \
        parity=serial.PARITY_NONE, rtscts=1)
    >>> ser.open()
  2. at this point, start the transfer from the device
  3. check that you have received some data:
    >>> ser.inWaiting()
    648L
    
    A non-zero result means that you have received something.
  4. I saved this value to use it with the read() method of the Serial class:
    >>> n = ser.inWaiting()
    >>> result = ser.read(n)
    
  5. The result object is a string, seeing its contents is as simple as:
    >>> print(result)
       0001 OR.COOR                                                                
       0002                   0S        X        0.000 Y         0.000 Z     0.000 
       0003                                            Om     397.0370             
       0004 POLAR                                                                  
       0005 INPUT                       th       1.500 ih        0.000             
       0006 INPUT                       th       0.000 ih        0.000 Z     0.000 
       0007                   1         X       -0.472 Y         1.576 Z     0.004 
    END                                                                            
    
    As you can see, there are no errors after the END sentence, because the serial connection is handled gracefully now. The previous attempt with cat /dev/ttyUSB0 was a bit brutal...

For now, that's all. I go back studying and maybe also writing some Python code for this Total Station. If you have got a total station and want to contribute to this project, let me know by leaving a comment here.

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.



Add comment
 You don't have GD support compiled in, we cannot create an authimage. Please activate GD Support.