예제 #1
0
    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
    while act.GetAngle() < maxa:  # go around the whole circle
        ts.Measure()  # measure distance0
        if ts.measureIface.state != ts.measureIface.IF_OK:
            ts.measureIface.state = ts.measureIface.IF_OK
            ts.MoveRel(stepinterval, Angle(0))
            continue
        nextp = ts.GetMeasure()  # get observation data
        if ts.measureIface.state != ts.measureIface.IF_OK:
            ts.measureIface.state = ts.measureIface.IF_OK
            ts.MoveRel(stepinterval, Angle(0))
            continue

        if not 'v' in nextp or not 'distance' in nextp or not 'hz' in nextp:
            ts.MoveRel(stepinterval, Angle(0))
            continue
예제 #2
0
    def run(self):
        """ do the observations in horizontal section """
        self.ts.Measure()  # initial measurement for startpoint
        if self.hz_start is not None:
            # rotate to start position, keeping zenith angle
            a = self.ts.GetAngles()
            self.ts.Move(self.hz_start, a['v'])
        startp = self.ts.GetMeasure()
        startp0 = None
        if self.ts.measureIface.state != self.ts.measureIface.IF_OK or 'errorCode' in startp:
            print('FATAL Cannot measure startpoint')
            return 1

        # height of startpoint above the horizontal axis
        if self.elev is None:
            height0 = ts.Coords()['elev']
        else:
            height0 = self.elev
        w = True
        try:
            self.ts.SetRedLaser(1)  # turn on red laser if possible
        except:
            pass
        act = Angle(0)  # actual angle from startpoint
        while act.GetAngle() < self.maxa:  # go around the whole circle
            self.ts.Measure()  # measure distance0
            if self.ts.measureIface.state != self.ts.measureIface.IF_OK:
                self.ts.measureIface.state = self.ts.measureIface.IF_OK
                self.ts.MoveRel(self.stepinterval, Angle(0))
                continue
            nextp = self.ts.GetMeasure()  # get observation data
            if self.ts.measureIface.state != self.ts.measureIface.IF_OK:
                # cannot measure, skip
                self.ts.measureIface.state = self.ts.measureIface.IF_OK
                self.ts.MoveRel(self.stepinterval, Angle(0))
                continue

            if 'v' not in nextp or 'distance' not in nextp or 'hz' not in nextp:
                self.ts.MoveRel(self.stepinterval, Angle(0))
                continue
            height = ts.Coords()['elev']
            index = 0
            while abs(height -
                      height0) > self.tol:  # looking for right elevation
                w = True
                zenith = nextp['v'].GetAngle()
                height_rel = nextp['distance'] * math.cos(zenith)
                hd = math.sin(zenith) * nextp['distance']
                zenith1 = math.atan(hd / (height_rel + height0 - height))
                self.ts.MoveRel(Angle(0), Angle(zenith1 - zenith))
                ans = self.ts.Measure()
                if 'errCode' in ans:
                    print('Cannot measure point')
                    break
                index += 1
                if index > self.maxiter or \
                    self.ts.measureIface.state != self.ts.measureIface.IF_OK:
                    w = False
                    self.ts.measureIface.state = self.ts.measureIface.IF_OK
                    logging.warning('Missing measurement')
                    break
                nextp = self.ts.GetMeasure()
                if 'v' not in nextp or 'distance' not in nextp:
                    break
                height = ts.Coords()['elev']
            if 'distance' in nextp and startp0 is None:
                startp0 = nextp  # store first valid point on section
            if 'distance' in nextp and w:
                coord = self.ts.Coords()
                res = dict(nextp.items() + coord.items())
                self.wrt.WriteData(res)
            self.ts.MoveRel(self.stepinterval, Angle(0))
            act += self.stepinterval
        # rotate back to start
        self.ts.Move(startp0['hz'], startp0['v'])
        return 0
예제 #3
0
        elif mode == 2:
            # aim on target with ATR without distance measurements
            ts.MoveRel(Angle(0), Angle(0), 1)
            measurement = ts.GetAngles()
        elif mode == 3:
            measurement = ts.GetAngles()  # get angles only
        elif mode == 4:
            # get distance measurement with targeting mode
            ts.Measure()
            measurement = ts.GetMeasure()
        elif mode == 5:
            # go and stop, store full measurements within the limitation
            measurement = ts.GetAngles()

            if moving:
                if abs(prev_hz.GetAngle() - measurement['hz'].GetAngle()) < limit.GetAngle() and \
                   abs(prev_v.GetAngle() - measurement['v'].GetAngle()) < limit.GetAngle():
                    n += 1
                    # store if the measured values within the angle limitation three times
                    if n <= 3:
                        continue
                    ts.Measure()
                    measurement = ts.GetMeasure()
                    moving = False  # approximately standing
                    last_hz = measurement[
                        'hz']  # direction of last stored point
                    last_v = measurement['v']
                    prev_hz = measurement[
                        'hz']  # direction of last examined point
                    prev_v = measurement['v']
                    n = 0  # start counting again if the last examind point is stored
예제 #4
0
    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
        # Calculating the coordinates of the next points
        nextp['east'] = nextp['distance'] * math.sin(nextp['v'].GetAngle()) * \
                        math.sin(nextp['hz'].GetAngle())