Example #1
0
    def test_Set2(self):

        vibes.beginDrawing()
        vibes.newFigure("set-sep")

        f = Function("x", "y", "x^2+(y+1)^2 - 4")
        set = Set(f, CmpOp.LEQ, 0.2)
        to_vibes = ToVibes(5)
        set.visit(to_vibes)

        vibes.endDrawing()
Example #2
0
	def test_Set2(self):

		vibes.beginDrawing ();
		vibes.newFigure("set-sep");
	
		f = Function("x", "y", "x^2+(y+1)^2 - 4")
		set = Set(f,CmpOp.LEQ, 0.2)
		to_vibes = ToVibes(5)
		set.visit(to_vibes);
	
		vibes.endDrawing();
Example #3
0
	def test_Paving2(self):
		P = IntervalVector(2, [-4, 4])
		A = Paving(P,YES);
		# B = Paving(P,BoolInterval(YES));
		f = Function("x", "y", "x^2 + y^2 - 4")
		# pdc = PdcFwdBwd(f, CmpOp.LEQ)
		pdc = myPdc()

		A.Sivia(pdc,op_And,0.3);
		vibes.beginDrawing()
		vibes.newFigure('Test')
		A.visit(ToVibes(10))
		vibes.endDrawing()
Example #4
0
    def test_Paving2(self):
        P = IntervalVector(2, [-4, 4])
        A = Paving(P, YES)
        # B = Paving(P,BoolInterval(YES));
        f = Function("x", "y", "x^2 + y^2 - 4")
        # pdc = PdcFwdBwd(f, CmpOp.LEQ)
        pdc = myPdc()

        A.Sivia(pdc, op_And, 0.3)
        vibes.beginDrawing()
        vibes.newFigure('Test')
        A.visit(ToVibes(10))
        vibes.endDrawing()
Example #5
0
    def test_Set3(self):

        fx = Function("x", "y", "(x^2-[64,81],y^2-[64,81])")
        sepx = SepFwdBwd(fx, CmpOp.LEQ)
        set = Set(2)
        sepx.contract(set, 8.0)

        vibes.beginDrawing()
        vibes.newFigure("set-example")

        to_vibes = ToVibes(5)
        set.visit(to_vibes)

        vibes.endDrawing()
        set.save("set-example")
Example #6
0
	def test_Set3(self):
		
	
		fx = Function("x","y","(x^2-[64,81],y^2-[64,81])");
		sepx = SepFwdBwd(fx,CmpOp.LEQ);
		set = Set(2);
		sepx.contract(set,8.0);

		vibes.beginDrawing ();
		vibes.newFigure("set-example");
	
		to_vibes = ToVibes(5)
		set.visit(to_vibes);
	
		vibes.endDrawing();
		set.save("set-example");
Example #7
0
	def test_Paving3(self):
		P = IntervalVector(2, [-4, 4])
		pdc = myPdc()
		A = Paving(P,YES);
		A.Sivia(pdc,op_And,0.3);
		
		vibes.beginDrawing()
		vibes.newFigure("test3")
		# P = IntervalVector(2, [-4, -3.9])
		A.visit(ToVibes(10))
		vibes.drawBox(P[0][0], P[0][1], P[1][0], P[1][1], 'r')

		print(P)
		A.ctcOutside(P)
		print(P)
		vibes.drawBox(P[0][0], P[0][1], P[1][0], P[1][1], 'g')
Example #8
0
    def test_Paving3(self):
        P = IntervalVector(2, [-4, 4])
        pdc = myPdc()
        A = Paving(P, YES)
        A.Sivia(pdc, op_And, 0.3)

        vibes.beginDrawing()
        vibes.newFigure("test3")
        # P = IntervalVector(2, [-4, -3.9])
        A.visit(ToVibes(10))
        vibes.drawBox(P[0][0], P[0][1], P[1][0], P[1][1], 'r')

        print(P)
        A.ctcOutside(P)
        print(P)
        vibes.drawBox(P[0][0], P[0][1], P[1][0], P[1][1], 'g')
Example #9
0
                  (y / 500)**2)) + 6 * np.exp(-((x + 600) / 300)**2 -
                                              ((y - 400) / 300)**2) - 20

plt.subplot(121)
cont = plt.contour(x, y, h, 10)
plt.clabel(cont, inline=1, fontsize=8)
plt.axis('equal')

h0 = -17
dh = 0.3
### generate the slice image for an altitude h0 ###
hBin = ((h < h0 + dh) * (h > h0 - dh)).astype(int)

plt.subplot(122)
plt.imshow(hBin, extent=[-1000, 1000, -1000, 1000], origin='lower')
plt.title("h0 = " + str(h0) + ", dh = " + str(dh))
plt.show()

### create the contractor associated with the slice
hBin = np.flipud(
    hBin)  # flip the slice (the origin for an image is the top-left corner)
hOut = hBin.cumsum(0).cumsum(1)  # compute the integral image
ctc = CtcRaster(hOut.T, -1000, 1000, 4, -4)

### results on Vibes ###
vibes.beginDrawing()
vibes.newFigure('CtcImage')
P = IntervalVector(2, [-1000, 1000])
pySIVIA(P, ctc, 30)
vibes.axisEqual()
    t_old = m[0][0][0] 
 
    # SIVIA test for Gascogne Golf
    img = cv2.imread('Gascogne2.png',0) #Read the image of the Gascogne Golf in the gray color
    retval, img_bin = cv2.threshold(img, 254, 1, cv2.THRESH_BINARY_INV) #Binarisation of the image
    imgIntegral = cv2.integral(img_bin) #Calcul of the integral of the image
    j_max,i_max=imgIntegral.shape #Dimension of the image
    pdcGascogne = ImageToBoxes(imgIntegral,i0,j0,echellePixel) #Creation of an object of the class PavageGascogne    
    
    #Area of calcul / First box for SIVIA algorithm
    X0=IntervalVector([[-i0*echellePixel, (-i0+i_max-1)*echellePixel], [(j0-j_max+1)*echellePixel, j0*echellePixel]]) 

    imgOut=np.zeros((j_max, i_max),dtype="uint8")

    #Definition of the draw window:
    vibes.beginDrawing()
    vibes.newFigure('Robotique')
    vibes.setFigureProperties(dict(x=600, y=200, width=j_max, height=i_max))
    vibes.axisLimits(X0[0].lb(),X0[0].ub(),X0[1].lb(),X0[1].ub())
    
    #Loop
    for i in range(100):
        
        for r in range(nbsRobots):
            m[r][0] = Interval(position[i][r][1]).inflate(PositionIncertitude) #x
            m[r][1] = Interval(position[i][r][2]).inflate(PositionIncertitude) #y
        t = m[i][0][0]
        
        #SIVIA test for Robots secure area whith incertitude
        pdcRobots = IncertitudeRobots(m,r**2)