예제 #1
0
    def __init__(self, name, measureUnit, measureIface, writerUnit=None):
        '''constructor
        '''
        TotalStation.__init__(self, name, measureUnit, measureIface,
                              writerUnit)
        Camera.__init__(self, name, measureUnit, measureIface, writerUnit)
        #StepperMotor.__init__(self, stepperMotorUnit, speed, halfSteps)

        self._affinParams = None
예제 #2
0
    def __init__(self, name, measureUnit, measureIface, writerUnit = None):
        '''constructor
        '''
        TotalStation.__init__(self, name, measureUnit, measureIface, writerUnit)
        Camera.__init__(self, name, measureUnit, measureIface, writerUnit)
        #StepperMotor.__init__(self, stepperMotorUnit, speed, halfSteps)


        self._affinParams = None
예제 #3
0
 # 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
 print("Getting met data...")
 if 'met' in cr.json and cr.json['met'] is not None:
     atm = ts.GetAtmCorr()     # get current settings from ts
     if cr.json['met'].upper() == 'WEBMET':
예제 #4
0
        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: "))
    coo['elev'] = float(raw_input("Station  elev: "))
    coo_wrt.WriteData(coo)
    ih = float(raw_input("Instrument height: "))
    geo = {}
    if otype == 'geo':
        geo['station'] = coo['id']
        geo['ih'] = ih
        geo_wrt.WriteData(geo)
예제 #5
0
    if len(sys.argv) > 3:
        port = sys.argv[3]
    else:
        port = '/dev/ttyUSB0'

    #logging.getLogger().setLevel(logging.DEBUG)
    iface = SerialIface("rs-232", port)
    geo_wrt = GeoWriter(dist='.4f',
                        angle='RAD',
                        fname=ofname + '.geo',
                        mode='w')
    coo_wrt = GeoWriter(dist='.4f',
                        angle='RAD',
                        fname=ofname + '.coo',
                        mode='w')
    ts = TotalStation(stationtype, mu, iface)

    # get station data
    coo = {}
    coo['id'] = raw_input("Station id: ")
    coo['east'] = GetFloat("Station  east ")
    coo['north'] = GetFloat("Station north ")
    coo['elev'] = GetFloat("Station  elev ")
    ih = GetFloat("Instrument height ")
    coo_wrt.WriteData(coo)
    # upload station coordinates and instrument height to the instrument
    res = {'errorCode': 0}
    i = 1
    while 'errorCode' in res and i < 3:
        res = ts.SetStation(coo['east'], coo['north'], coo['elev'], ih)
        i += 1
예제 #6
0
        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()
    w = raw_input("Target on upper right corner and press Enter")
    w2 = ts.GetAngles()

    dh = (w2['hz'].GetAngle() - w1['hz'].GetAngle()) / dh_nr
    dv = (w2['v'].GetAngle() - w1['v'].GetAngle()) / dv_nr
    # measurement loops
    for i in range(dh_nr + 1):  # horizontal loop
        measdir = i % 2  # check modulo
        hz = Angle(w1['hz'].GetAngle() + i * dh, 'RAD')
예제 #7
0
        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])
    iface = SerialIface("rs-232", port)
    wrt = CsvWriter(
        angle='DMS',
        dist='.3f',
        filt=['id', 'hz', 'v', 'distance', 'east', 'north', 'elev'],
        fname='stdout',
        mode='a',
        sep=';')
    ts = TotalStation(stationtype, mu, iface)
    ts.SetEDMMode('RLSTANDARD')  # reflectorless distance measurement
    ts.Measure()  # initial measurement for startpoint
    startp = ts.GetMeasure()
    if ts.measureIface.state != ts.measureIface.IF_OK or 'errorCode' in startp:
        print 'FATAL Cannot measure startpoint'
        exit(1)

    act = Angle(0)  # actual angle from startpoint
    # height of startpoint above the horizontal axis
    height0 = math.cos(startp['v'].GetAngle()) * startp['distance']
    w = True
    try:
        ts.SetRedLaser(1)
    except:
        pass
예제 #8
0
This module file stands for sharing developement information created by mirind4(git).

"""

import sys
import logging

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

from totalstation import TotalStation
from localiface import LocalIface
from leicatcra1100 import LeicaTCRA1100
from leicatps1200 import LeicaTPS1200
from trimble5500 import Trimble5500

logging.getLogger().setLevel(logging.WARNING)

if __name__ == "__main__":
    stationtype1 = '1200'
    iface = LocalIface('local1')

    mu = LeicaTPS1200()

    totalStat1 = TotalStation(stationtype1, mu, iface)

    print('\n')
    print('Using __str__ and __repr__ representation:')
    print('Result of __str__: ', str(totalStat1))
    print('Result of __repr__: ', repr(totalStat1))
예제 #9
0
    if ifname[-4:] != '.dmp' and ifname[-4:] != '.geo':
        ifname += '.geo'
    if ifname[-4:] == '.geo':
        g = GeoReader(fname=ifname)
    else:
        g = CsvReader(fname=ifname)
    data = g.Load()
    stationtype = '1100'
    if len(sys.argv) > 2:
        stationtype = sys.argv[2]
    port = '/dev/ttyUSB0'
    if len(sys.argv) > 3:
        port = sys.argv[3]
    if re.search('120[0-9]$', stationtype):
        from leicatps1200 import LeicaTPS1200
        mu = LeicaTPS1200()
    elif re.search('110[0-9]$', stationtype):
        from leicatcra1100 import LeicaTCRA1100
        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()

    iface = SerialIface("rs-232", port)
    ts = TotalStation(stationtype, mu, iface)
    o = Orientation(data, ts)
    print(o.Search())
예제 #10
0
                           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:
        wrt = EchoWriter()

    ts = TotalStation("Leica", mu, iface)
    slopeDist = 0
    if edm not in mu.edmModes:
        edm = 'FAST'
    ts.SetEDMMode(edm)
    # initialize instrument and variables
    if mode > 0:
        ts.SetLock(0)
        ts.SetATR(1)
        ts.MoveRel(Angle(0), Angle(0), 1)
        ts.Measure()
        measurement = ts.GetMeasure()
        if 'distance' in measurement:
            slopeDist = measurement['distance']

        if mode in (3, 4, 5):
예제 #11
0
    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)
    if isinstance(mu, Trimble5500):
        print(
            "Please change to reflectorless EDM mode (MNU 722 from keyboard)")
        print("and turn on red laser (MNU 741 from keyboard) and press enter!")
        raw_input()
    else:
        ts.SetEDMMode('RLSTANDARD')  # reflectorless distance measurement
    if levels is not None and len(levels) > 0:
        for i in levels:
            h_sec = HorizontalSection(ts, wrt, i, hz_start, stepinterval, maxa,
                                      maxiter, tol)
            h_sec.run()
    else:
        h_sec = HorizontalSection(ts,
                                  wrt,
예제 #12
0
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)
sv = Angle(90, "DEG")
예제 #13
0
     mu = LeicaTPS1200()
 elif re.search('110[0-9]$', stationtype):
     from leicatcra1100 import LeicaTCRA1100
     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 "Invalid instrument type: " + stationtype
     sys.exit()
 # interface to the totalstation
 iface = SerialIface("rs-232", port)
 ts = TotalStation(stationtype, mu, iface)
 if ts.measureIface.state != ts.measureIface.IF_OK:
     print "no serial communication"
     exit(-1)  # no serial communication available
 ts.GetATR()  # wake up instrument
 #ts.SwitchOn(1) TODO              # wake up instrument
 # met sensor
 if not met is None:
     atm = ts.GetAtmCorr()  # get current settings from ts
     if met == 'BMP180':
         from bmp180measureunit import BMP180MeasureUnit
         from i2ciface import I2CIface
         from bmp180 import BMP180
         # bmp180 sensor
         bmp_mu = BMP180MeasureUnit()
         i2c = I2CIface(None, 0x77)
예제 #14
0
        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)

    # Direction of the points to defining the plane
    points = []
    for i in range(numberOfPoints):
        raw_input("Target on %d point and press enter" % (i + 1))
        ts.Measure()
        obs = ts.GetMeasure()