コード例 #1
0
    def handle(self):
        #mu = LeicaTPS1200()
        mu = CameraStationUnit()
        iface = SerialIface('test', '/dev/ttyUSB0')

        ts = CameraStation('test', mu, iface)
        #ts = TotalStation('test', mu, iface)

        while True:
            print('--------------')
            msg = self.request.recv(1024)

            print(msg)

            ans, file = RemoteMeasureUnit.execCmd(ts, msg)

            print(ans, '///')

            self.wfile.write(ans + b'\n')

            if file != None:
                print('???????')

                file.seek(0)
                l = 0
                aaa = file.read(1024)
                l += self.request.send(aaa)
                while aaa:
                    aaa = file.read(1024)
                    l += self.request.send(aaa)

                print('binary is sent')
コード例 #2
0
ファイル: nmea_demo.py プロジェクト: matekecskemeti/ulyxes-1
        fn = sys.argv[1]
    else:
        fn = 'test.log'
    if len(sys.argv) > 2:
        web = sys.argv[2]
    else:
        web = 'http://enfo.hu/gnss_demo/get.php'
    # file or on-line?
    if os.path.exists(fn) and os.path.isfile(fn):
        # input from file
        from localiface import LocalIface
        li = LocalIface('test', fn)
    else:
        # input from gnss receiver
        from serialiface import SerialIface
        li = SerialIface('test', fn)

    from nmeagnssunit import NmeaGnssUnit
    from httpwriter import HttpWriter
    from gnss import Gnss

    # nmea data OK?
    if li.state != li.IF_OK:
        print("input file/device?")
        exit(1)

    # nmea processing unit
    mu = NmeaGnssUnit()
    # processed data to web
    #wrt = HttpWriter(angle='DEG', url='http://localhost/gnss/get.php',
    #    filt=['longitude', 'latitude', 'altitude', 'datetime'])
コード例 #3
0
ファイル: robotplus.py プロジェクト: hanyelshafey/ulyxes
 else:
     print("Missing parameter")
     print("Usage: robotplus.py config_file")
     sys.exit(-1)
 # logging
 logging.basicConfig(format=cr.json['log_format'], filename=cr.json['log_file'], \
      filemode='a', level=cr.json['log_level'])
 # create totalstation
 mu = get_mu(cr.json['station_type'])
 if not mu:
     logging.fatal('Invalid instrument type')
     sys.exit(-1)
 if cr.json['station_type'] == 'local':
     iface = LocalIface('test', 'test_iface.txt', 'rand')
 else:
     iface = SerialIface("rs-232", cr.json['port'])
 if iface.GetState():
     logging.fatal("Serial interface error")
     sys.exit(-1)
 ts = TotalStation(cr.json['station_type'], mu, iface)
 for i in range(10):
     w = ts.GetATR() # wake up instrument
     if 'errorCode' in w or ts.measureIface.GetState():
         ts.measureIface.ClearState()
         time.sleep(10)
     else:
         break
 if 'errorCode' in w or ts.measureIface.GetState():
     logging.fatal("Instrument wake up failed")
     sys.exit(-1)
 # get meteorology data
コード例 #4
0
ファイル: nmea_demo.py プロジェクト: hanyelshafey/ulyxes
                        help='output, default stdout')
    parser.add_argument('-d',
                        '--debug',
                        action="store_true",
                        help='detailed log output to stdout')
    # get file from command line params
    args = parser.parse_args()

    if args.debug:
        logging.basicConfig(level=logging.DEBUG)
    # NMEA input interface
    if re.search('^COM[0-9][0-9]?$', args.interface) or \
        re.search('^/dev/ttyUSB[0-9]$', args.interface) or \
        re.search('^/dev/ttyS[0-9]*', args.interface):
        # serial
        li = SerialIface('test', args.interface, args.speed)
    elif re.search('^([0-9a-fA-F]{2}:){5}[0-9A-f-F]{2}$', args.interface):
        # bluetooth
        li = BluetoothIface('test', args.interface, 1)
    elif os.path.exists(args.interface) and os.path.isfile(args.interface):
        # input from file
        li = LocalIface('test', args.interface)
    else:
        print('invalid interface given')
        sys.exit(1)

    # output
    if args.output is None:
        wrt = EchoWriter(
            '', 'DEG', '.3f', '%Y-%m-%d %H:%M:%S',
            ['id', 'latitude', 'longitude', 'altitude', 'datetime'])
コード例 #5
0
    def GetAutoOff(self):
        """ Query auto off state

            :returns: auto off state
        """
        msg = self.measureUnit.GetAutoOffMsg()
        return self._process(msg)

    def Temperature(self):
        """ Get temperature

            :returns: internal temperature
        """
        msg = self.measureUnit.TemperatureMsg()
        return self._process(msg)


if __name__ == "__main__":
    from leicadnaunit import LeicaDnaUnit
    from digitallevel import DigitalLevel
    from serialiface import SerialIface

    mu = LeicaDnaUnit()
    iface = SerialIface('x', '/dev/ttyS0')
    dna = DigitalLevel('DNA03', mu, iface)
    dna.SetAutoOff(0)
    #print (dna.GetAutoOff())
    print(dna.Temperature())
    print(dna.Measure())
コード例 #6
0
        mu = LeicaTCRA1100()
    elif re.search('180[0-9]$', stationtype):
        from leicatca1800 import LeicaTCA1800
        mu = LeicaTCA1800()
    elif re.search('550[0-9]$', stationtype):
        from trimble5500 import Trimble5500
        mu = Trimble5500()
    else:
        print("unsupported instrument type")
        exit(1)
    if len(sys.argv) > 3:
        port = sys.argv[3]
    else:
        port = 'COM1'

    iface = SerialIface("rs-232", port)
    if otype == 'geo':
        geo_wrt = GeoWriter(dist='.4f', angle='RAD', fname=ofname+'.geo', mode='w')
        coo_wrt = GeoWriter(dist='.4f', angle='RAD', fname=ofname + '.coo', mode='w')
    else:
        geo_wrt = CsvWriter(dist='.4f', fname=ofname+'.dmp', \
            header=True, filt=['station', 'id', 'hz', 'v', 'faces'])
        coo_wrt = CsvWriter(dist='.4f', fname=ofname+'.csv', \
            header=True, filt=['id', 'east', 'north', 'elev'])
    ts = TotalStation(stationtype, mu, iface)

    # get station data
    coo = {}
    coo['id'] = raw_input("Station id: ")
    coo['east'] = float(raw_input("Station  east: "))
    coo['north'] = float(raw_input("Station north: "))
コード例 #7
0
ファイル: digitallevel.py プロジェクト: hanyelshafey/ulyxes
        return self._process(msg)

    def Temperature(self):
        """ Get temperature

            :returns: internal temperature
        """
        msg = self.measureUnit.TemperatureMsg()
        return self._process(msg)


if __name__ == "__main__":
    from leicadnaunit import LeicaDnaUnit
    from serialiface import SerialIface
    from csvwriter import CsvWriter

    mu = LeicaDnaUnit()
    iface = SerialIface('x', '/dev/ttyUSB0')
    wrt = CsvWriter(angle='DMS',
                    dist='.5f',
                    filt=['id', 'distance', 'staff', 'datetime'],
                    fname='stdout',
                    mode='a',
                    sep=';')
    dna = DigitalLevel('DNA03', mu, iface, wrt)
    dna.SetAutoOff(0)
    #print (dna.GetAutoOff())
    print(dna.Temperature())
    for i in range(10):
        dna.Measure()
コード例 #8
0
        from leicatps1200 import LeicaTPS1200
        mu = LeicaTPS1200()
    elif re.search('110[0-9]$', stationtype):
        from leicatcra1100 import LeicaTCRA1100
        mu = LeicaTCRA1100()
    elif re.search('550[0-9]$', stationtype):
        from trimble5500 import Trimble5500
        mu = Trimble5500()
    else:
        print "unsupported instrument type"
        #sys.exit(1)
    # set port
    port = 'COM5'
    if len(sys.argv) > 4:
        port = sys.argv[4]
    iface = SerialIface("test", port)
    # set output file name
    fn = 'measmtrx.txt'
    if len(sys.argv) > 5:
        fn = sys.argv[5]
    # write out measurements
    wrt = FileWriter(angle='DEG', dist='.3f', fname=fn)
    if wrt.GetState() != wrt.WR_OK:
        sys.exit(-1)  # open error
    ts = TotalStation(stationtype, mu, iface, wrt)
    ts.SetATR(0)  # turn ATR off
    ts.SetEDMMode('RLSTANDARD')  # reflectorless distance measurement
    ts.SetRedLaser(1)  # turn red laser on

    w = raw_input("Target on lower left corner and press Enter")
    w1 = ts.GetAngles()
コード例 #9
0
    mode = 4  # lock with distance measurement
    if len(sys.argv) > 2:
        try:
            mode = int(sys.argv[2])
        except ValueError:
            mode = 4
    # EDM mode
    edm = 'FAST'
    if len(sys.argv) > 3:
        edm = sys.argv[3]
    # Serial port
    com = '/dev/ttyUSB0'
    if len(sys.argv) > 4:
        com = sys.argv[4]
    if re.search('^COM[0-9]+', com) or re.search('^/dev/.*tty', com):
        iface = SerialIface("rs-232", com)
    else:
        iface = LocalIface("testIface",
                           com)  # Local iface for testing the module

    # Writer
    if len(sys.argv) > 5:
        wrt = CsvWriter(
            angle='GON',
            dist='.3f',
            dt='%Y-%m-%d %H:%M:%S',
            filt=['id', 'hz', 'v', 'distance', 'east', 'north', 'elev'],
            fname=sys.argv[5],
            mode='a',
            sep=';')
    else:
コード例 #10
0
ファイル: totalstation.py プロジェクト: GRSEB9S/ulyxes
        logging.error(" Getangles failed")
        return None

    def MoveRel(self, hz_rel, v_rel, atr=0):
        """ Rotate the instrument relative to actual direction

            :param hz_rel: relative horizontal rotation (Angle)
            :param v_rel: relative zenith rotation (Angle)
            :param atr: 0/1 atr on/off
        """
        #get the actual direction
        msg = self.measureUnit.GetAnglesMsg()
        res = self._process(msg)
        if 'hz' in res and 'v' in res:
            return self.Move(res['hz'] + hz_rel, res['v'] + v_rel, atr)
        return None

if __name__ == "__main__":
    from leicatps1200 import LeicaTPS1200
    from serialiface import SerialIface
    from echowriter import EchoWriter
    logging.getLogger().setLevel(logging.DEBUG)
    mu = LeicaTPS1200()
    iface = SerialIface("rs-232", "/dev/ttyS0")
    wrt = EchoWriter()
    ts = TotalStation("Leica", mu, iface, wrt)
    ts.SetEDMMode(5)
    ts.Move(Angle(90, 'DEG'), Angle(85, 'DEG'))
    ts.Measure()
    print (ts.GetMeasure())
コード例 #11
0
"""

import re
import sys

sys.path.append('../pyapi')

if __name__ == '__main__':
    # Choose between serial or bluetooth communication
    if len(sys.argv) > 1:
        cm = sys.argv[1]
    else:
        cm = '/dev/ttyUSB0'
    if re.search('COM[0-9]$', cm) or '/dev/ttyUSB0' == cm:
        from serialiface import SerialIface
        iface = SerialIface('test', cm)
    else:
        from bluetoothiface import BluetoothIface
        iface = BluetoothIface('test', cm, 1)

    #from localiface import LocalIface
    #iface = LocalIface('test', 'output.nmea')
    from nmeagnssunit import NmeaGnssUnit
    from filewriter import FileWriter
    from gnss import Gnss

    #Making measurement unit
    mu = NmeaGnssUnit()

    #Writer unit creating
    if len(sys.argv) > 2:
コード例 #12
0
            tol = float(sys.argv[5])
        maxiter = 10  # number of iterations to find point on horizontal plan
        if len(sys.argv) > 6:
            maxiter = int(sys.argv[6])
        wrt = CsvWriter(
            angle='DMS',
            dist='.3f',
            filt=['id', 'east', 'north', 'elev', 'hz', 'v', 'distance'],
            fname='stdout',
            mode='a',
            sep=';')
        if len(sys.argv) > 7:
            levels = [float(a) for a in sys.argv[7:]]
        else:
            levels = None
    iface = SerialIface("rs-232", port)
    if iface.state != iface.IF_OK:
        print("serial error")
        exit(1)
    if re.search('120[0-9]$', stationtype):
        mu = LeicaTPS1200()
    elif re.search('110[0-9]$', stationtype):
        mu = LeicaTCRA1100()
    elif re.search('550[0-9]$', stationtype):
        mu = Trimble5500()
        iface.eomRead = b'>'
    else:
        print("unsupported instrument type")
        exit(1)

    ts = TotalStation(stationtype, mu, iface)
コード例 #13
0
ファイル: yesno.py プロジェクト: hanyelshafey/ulyxes
Sample application to nod by the totalstation

"""

from sys import argv, path

path.append('../pyapi/')

from angle import Angle
from leicatca1800 import LeicaTCA1800
from serialiface import SerialIface
from totalstation import TotalStation

mu = LeicaTCA1800()
si = SerialIface("si", "/dev/ttyUSB0")
ts = TotalStation("yes", mu, si)

if len(argv) < 2:
    yes = 1
else:
    yes = int(argv[1])

if yes:
    dhz = Angle(0)
    dv = Angle(30, "DEG")
else:
    dhz = Angle(30, "DEG")
    dv = Angle(0)

shz = Angle(0)
コード例 #14
0
ファイル: section.py プロジェクト: hanyelshafey/ulyxes
    if len(sys.argv) > 4:
        numberOfPoints = int(sys.argv[4])
    else:
        numberOfPoints = 2
    tol = 0.01
    if len(sys.argv) > 5:
        tol = float(sys.argv[5])
    # Number of iterations to find point on the chosen plane
    maxiter = 10
    if len(sys.argv) > 6:
        maxiter = int(sys.argv[6])
    arange = PI2
    if len(sys.argv) > 7:
        arange = float(sys.argv[7]) / 360.0 * PI2
    iface = SerialIface("rs-232", port)  ## eomRead='\n'
    wrt = CsvWriter(angle='DMS',
                    dist='.3f',
                    filt=['id', 'east', 'north', 'elev'],
                    fname='section.txt',
                    mode='w',
                    sep=';')
    ts = TotalStation(stationtype, mu, iface)
    if isinstance(mu, Trimble5500):
        print("Set Trimble 550x to direct reflex (MNU 722)")
        raw_input()
    else:
        ts.SetATR(0)  # ATR mode off
        ts.SetLock(0)  # Lock mode off
        ts.SetEDMMode("RLSTANDARD")  # Reflectorless distance measurement
        ts.SetRedLaser(1)
コード例 #15
0
ファイル: horizsection.py プロジェクト: zsiki/ulyxes
        else:
            maxa = PI2
        tol = 0.01
        if len(sys.argv) > 5:
            tol = float(sys.argv[5])
        maxiter = 10    # number of iterations to find point on horizontal plan
        if len(sys.argv) > 6:
            maxiter = int(sys.argv[6])
        wrt = CsvWriter(angle='DMS', dist='.3f',
            filt=['id', 'east', 'north', 'elev', 'hz', 'v', 'distance'],
            fname='stdout', mode='a', sep=';')
        if len(sys.argv) > 7:
            levels = [float(a) for a in sys.argv[7:]]
        else:
            levels = None
    iface = SerialIface("rs-232", port)
    if iface.state != iface.IF_OK:
        print("serial error")
        exit(1)
    if re.search('120[0-9]$', stationtype):
        mu = LeicaTPS1200()
    elif re.search('110[0-9]$', stationtype):
        mu = LeicaTCRA1100()
    elif re.search('550[0-9]$', stationtype):
        mu = Trimble5500()
        iface.eomRead = b'>'
    else:
        print("unsupported instrument type")
        exit(1)

    ts = TotalStation(stationtype, mu, iface)