Example #1
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 #2
0
                logging.error("BMP180 sensor not found")
                sys.exit(-1)
            pres = float(bmp.GetPressure()['pressure'])
            temp = float(bmp.GetTemp()['temp'])
            wet = None  # wet temperature unknown
        else:
            # met data from the net
            from webmetmeasureunit import WebMetMeasureUnit
            from webmet import WebMet
            from webiface import WebIface
            wi = WebIface("demo",
                          "http://api.openweathermap.org/data/2.5/weather",
                          "json")
            web_mu = WebMetMeasureUnit(
                msg="q=budapest&appid=13152b0308b85a39cc9a161e241ec2cf")
            web = WebMet('WebMet', web_mu, wi)
            data = web.GetPressure()
            pres = data['pressure']
            temp = data['temp']
            humi = data['humidity']
            wet = web.GetWetTemp(temp, humi)
        ts.SetAtmCorr(float(atm['lambda']), pres, temp, wet)
        logging.info(" temperature: %f air pressure: %f wet termperature: %f" %
                     (temp, pres, wet))
    r = Robot(directions, coordinates, ts, maxtry, delaytry)
    obs_out, coo_out = r.run()
    for obs in obs_out:
        dmp_wrt.WriteData(obs)
    for coo in coo_out:
        coo_wrt.WriteData(coo)
Example #3
0
                    prev_hz = measurement['hz']
                    prev_v = measurement['v']
                    continue
            else:
                if abs(last_hz.GetAngle() - measurement['hz'].GetAngle()) >= limit.GetAngle() or \
                   abs(last_v.GetAngle() - measurement['v'].GetAngle()) >= limit.GetAngle():
                    moving = True  # still moving
                continue

        #  Get each measurement data
        if 'distance' in measurement:  # Check existance of 'distance' key
            slopeDist = measurement['distance']
        if 'hz' in measurement:  # Check existence of 'hz' key
            hz = measurement['hz']
        if 'v' in measurement:  # Check existence of 'v' key
            v = measurement['v']

        # Compute relative coordinates according to the instrument origin
        if 'hz' in measurement and 'v' in measurement:
            measurement['east'] = slopeDist * math.sin(v.GetAngle()) * \
                math.sin(hz.GetAngle())
            measurement['north'] = slopeDist * math.sin(v.GetAngle()) * \
                math.cos(hz.GetAngle())
            measurement['elev'] = slopeDist * math.cos(v.GetAngle())

            # Store in file the measurements
            wrt.WriteData(measurement)
            #print(measurement)
        else:
            print("Some measurement data(s) are missing...")
Example #4
0
    points = []
    for i in range(numberOfPoints):
        raw_input("Target on %d point and press enter" % (i + 1))
        ts.Measure()
        obs = ts.GetMeasure()
        if ts.measureIface.state != ts.measureIface.IF_OK or \
           'errorCode' in obs:
            print('Start again!')
            exit(1)
        # Calculation of the directed coordinates according to the instrument's origin
        obs['east'] = obs['distance'] * math.sin(obs['v'].GetAngle()) * \
                      math.sin(obs['hz'].GetAngle())
        obs['north'] = obs['distance'] * math.sin(obs['v'].GetAngle()) * \
                       math.cos(obs['hz'].GetAngle())
        obs['elev'] = obs['distance'] * math.cos(obs['v'].GetAngle())
        wrt.WriteData(obs)
        points.append(
            obs)  # Appending the observations to the list of measured points
        #print(points[i])

    # Definition of the different planes
    if numberOfPoints == 1:  # in case of horizontal section
        plane = [0.0, 0.0, 1.0, -1 * points[0]['elev']]
    elif numberOfPoints == 2:  # in case of vertical section
        plane = [points[0]['north'] - points[1]['north'],
                 points[1]['east'] - points[0]['east'], 0,
                 points[0]['east'] * points[1]['north'] - \
                 points[1]['east'] * points[0]['north']]
    else:  # in case of arbitrary section
        plane = []
        plane.append((points[0]['north'] - points[1]['north']) * \