Example #1
0
        if len(cr.json['mon_list']) != len(mon_coords):
            logging.error("Not all mon points found in database")
    else:
        mon_coords = []
    # check orientation including FIX and MON points
    # generate observations for all target points, first point is the station
    print("Generating observations for targets...")
    og = ObsGen(st_coord + fix_coords + mon_coords, cr.json['station_id'], \
        cr.json['station_height'], cr.json['faces'], cr.json['directfaces'])
    observations = og.run()
    # change to face left
    if ts.GetFace()['face'] == ts.FACE_RIGHT:
        a = ts.GetAngles()
        a['hz'] = (a['hz'] + Angle(180, 'DEG')).Normalize()
        a['v'] = (Angle(360, 'DEG') - a['v']).Normalize()
        ans = ts.Move(a['hz'], a['v'], 0) # no ATR
        if 'errCode' in ans:
            logging.fatal("Rotation to face left failed %d", ans['errCode'])
            sys.exit(-1)
    # check/find orientation
    print("Orientation...")
    o = Orientation(observations, ts, cr.json['orientation_limit'])
    ans = o.Search()
    if 'errCode' in ans and cr.json['station_type'] != 'local':
        logging.fatal("Orientation failed %d", ans['errCode'])
        sys.exit(-1)

    if 'fix_list' in cr.json and cr.json['fix_list'] is not None and \
        len(fix_coords) < 2:
        logging.warning('No enough fix points for freestation')
    elif 'fix_list' in cr.json and cr.json['fix_list'] is not None and \
Example #2
0
        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')
        for j in range(dv_nr + 1):  # vertical loop
            if measdir == 0:
                # move downward at odd steps to right
                ts.Move(hz, Angle(w1['v'].GetAngle() + j * dv, 'RAD'))
            else:
                # move upward at event steps to right
                ts.Move(hz, Angle(w2['v'].GetAngle() - j * dv, 'RAD'))
            ts.Measure()
            ts.GetMeasure()
Example #3
0
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")
n = 3


for i in range(n):
    ts.Move(shz - dhz, sv - dv)
    ts.Move(shz + dhz, sv + dv)

ts.Move(shz,sv)
Example #4
0
        if not 'v' in nextp or not 'distance' in nextp or not 'hz' in nextp:
            ts.MoveRel(stepinterval, Angle(0))
            continue

        height = math.cos(nextp['v'].GetAngle()) * nextp['distance']
        index = 0
        while abs(height - height0) > tol:  # looking for right elevation
            w = True
            zenith = nextp['v'].GetAngle()
            zenith1 = math.acos(height0 / nextp['distance'])
            ts.MoveRel(Angle(0), Angle(zenith1 - zenith))
            ts.Measure()
            index += 1
            if index > maxiter or ts.measureIface.state != ts.measureIface.IF_OK:
                w = False
                ts.measureIface.state = ts.measureIface.IF_OK
                logging.warning('Missing measurement')
                break
            nextp = ts.GetMeasure()
            if not 'v' in nextp or not 'distance' in nextp:
                break
            height = math.cos(nextp['v'].GetAngle()) * nextp['distance']
        if 'distance' in nextp and w:
            coord = ts.Coords()
            res = dict(nextp.items() + coord.items())
            wrt.WriteData(res)
        ts.MoveRel(stepinterval, Angle(0))
        act += stepinterval
    # rotate back to start
    ts.Move(startp['hz'], startp['v'])
Example #5
0
    # Normalization of the plane coefficients
    norm = math.sqrt(plane[0]**2 + plane[1]**2 + plane[2]**2)
    plane = [i / norm for i in plane]

    # Checking the plane result with the observed points
    for i in range(numberOfPoints):
        planeRes = plane[0] * points[i]['east'] + \
                   plane[1] * points[i]['north'] + \
                   plane[2] * points[i]['elev'] + plane[3]
        logging.debug("Checking the distance for the first points: %d - %.3f",
                      i, planeRes)

    # Moving back to the first point
    if numberOfPoints > 1:
        ts.Move(points[0]['hz'], points[0]['v'])
    act = Angle(0)  # Actual angle from start point set to zero
    w = True
    while act.GetAngle() < arange:  # Going around a whole circle
        ts.Measure()  # Measuring distance
        if ts.measureIface.state != ts.measureIface.IF_OK:
            ts.measureIface.state = ts.measureIface.IF_OK
            ts.MoveRel(stepinterval, Angle(0))  # TODO
            continue
        nextp = ts.GetMeasure()  # Get observation data
        if ts.measureIface.state != ts.measureIface.IF_OK or \
            'hz' not in nextp or 'v' not in nextp or \
            'distance' not in nextp:
            ts.measureIface.state = ts.measureIface.IF_OK
            ts.MoveRel(stepinterval, Angle(0))  # TODO
            continue