else: pc = -99 atr = 0 if p == 2 else 1 else: pc = GetFloat("Prism constant [mm] (-99 for none) ", pc * 1000) / 1000.0 if pc > -99: ts.SetPc(pc) #pc = -99 atr = 0 if pc == 0.00344 else 1 print(ts.GetPc()) ts.SetATR(atr) raw_input("Target on prism and press enter") if atr: res = ts.MoveRel(Angle(0), Angle(0), atr) if 'errorCode' in res or ts.measureIface.state != ts.measureIface.IF_OK: print("Cannot target on prism") ts.measureIface.state = ts.measureIface.IF_OK continue res = ts.Measure() obs = ts.GetMeasure() obs['id'] = t_id geo_wrt.WriteData(obs) coo = ts.Coords() coo['id'] = t_id if pc > -99: coo['pc'] = pc elif 'pc' in coo: del coo['pc'] coo_wrt.WriteData(coo)
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'])