def shapeGen():
	x, y = yield
	(x,y) = yield vibes.drawArrow([x-1, y-1], [x+1, y+1], 0.6, 'k[k]')
	(x,y) = yield vibes.drawAUV(x,y,45,2, 'k[y]')
	(x,y) = yield vibes.drawBox(x-1,x+1,y-2,y+2, "[b]")
	(x,y) = yield vibes.drawBoxesUnion([[x-1,x,y-2,y], [x-0.5,x+1,y-0.5,y+2]], "[r]")
	(x,y) = yield vibes.drawCircle(x,y,1, "g[m]")
	(x,y) = yield vibes.drawEllipse(x,y,2,1,45, color="r[darkCyan]")
	(x,y) = yield vibes.drawLine([[x-0.5, y-1], [x+1, y+0.5]], "k")
	(x,y) = yield vibes.drawPie( (x-2, y-2), (1,2.5), [20,70] , "y[cyan]")
	(x,y) = yield vibes.drawPolygon([[x-1,y-1], [x, y+1], [ x+1, y-1]], "k[orange]")
	(x,y) = yield vibes.drawRing(x,y, 1,2, '[red]')
	# (x,y) = yield vibes.drawPie( (x, y), (1,2), [0,360] , "y[cyan]")
	(x,y) = yield vibes.drawVehicle( x, y, 20, 1, "[darkBlue]")
	(x,y) = yield vibes.drawPoint( x,y, 1, "[k]")
	(x,y) = yield vibes.drawText( x,y, "Text", 1)
Exemple #2
0
def shapeGen():
    x, y = yield
    (x, y) = yield vibes.drawArrow([x - 1, y - 1], [x + 1, y + 1], 0.6, 'k[k]')
    (x, y) = yield vibes.drawAUV(x, y, 45, 2, 'k[y]')
    (x, y) = yield vibes.drawBox(x - 1, x + 1, y - 2, y + 2, "[b]")
    (x, y) = yield vibes.drawBoxesUnion(
        [[x - 1, x, y - 2, y], [x - 0.5, x + 1, y - 0.5, y + 2]], "[r]")
    (x, y) = yield vibes.drawCircle(x, y, 1, "g[m]")
    (x, y) = yield vibes.drawEllipse(x, y, 2, 1, 45, color="r[darkCyan]")
    (x, y) = yield vibes.drawLine([[x - 0.5, y - 1], [x + 1, y + 0.5]], "k")
    (x, y) = yield vibes.drawPie((x - 2, y - 2), (1, 2.5), [20, 70], "y[cyan]")
    (x,
     y) = yield vibes.drawPolygon([[x - 1, y - 1], [x, y + 1], [x + 1, y - 1]],
                                  "k[orange]")
    (x, y) = yield vibes.drawRing(x, y, 1, 2, '[red]')
    # (x,y) = yield vibes.drawPie( (x, y), (1,2), [0,360] , "y[cyan]")
    (x, y) = yield vibes.drawVehicle(x, y, 20, 1, "[darkBlue]")
    (x, y) = yield vibes.drawPoint(x, y, 1, "[k]")
    (x, y) = yield vibes.drawText(x, y, "Text", 1)
Exemple #3
0
#exmaple.py

from vibes import vibes

print(vibes.channel, vibes.current_fig)

vibes.beginDrawing()
vibes.newFigure("test")
vibes.drawBox(0,1,4,6,color='[#FF12FFA0]', figure='test')
vibes.drawText(12, 12, 'My Text', 0.1, 'b[r]')
vibes.axisAuto()
vibes.drawBox(0.5,2,4,7,color='[#00FFFF66]', figure='test')
vibes.drawBox(-1,0,-4,-6,color='r', figure='test')
vibes.drawLine([[0,0], [4,4]])
vibes.drawEllipse(3, 5, 1, 3, 45)
vibes.drawEllipse(5, 5, 3, 3, 0, angles=[30,60], color='g')

vibes.drawCircle(0, 0, 5)
vibes.drawAUV(0,0, 2, 3, color='r[yellow]')


vibes.drawPie([0,0], [3,4], [45, 90])

vibes.newGroup("Pie", figure="test", format='[cyan]')
vibes.drawPie([0,0], [5,9], [-120, -40], group="Pie")
# vibes.drawPie([0,0], [5,9], [-120, -40], "[b]")

vibes.drawPie([5,2], [1,2], [160, 220]) #, 'g[y]')

# vibes.clearGroup("Pie", figure="test")
    return w, dw

# MAIN INUTILE
if __name__ == '__main__':
    
    # np.array([-10*math.sin(t),10*math.cos(t)])
    # np.array([10*math.cos(t),10*math.sin(t)])
    # simulation
    h=0.05
    listRobots = []
    for i in range(0,1):
        listRobots.append(Robot(-4.0,45,0,0,h,i,'b'))

    vibes.beginDrawing()
    vibes.clearFigure() 
    vibes.drawLine([[-4.4,47.8],[-3.8,47.8],[-2.3,47.2],[-2,46.6],[-1.3,44.4],[-2.0,43.3],[-3.6,43.5],[-2.8,43.4]])
    
    for t in frange(0,100,h):
        time.sleep(0.1)
        #vibes.clearFigure()
        time1 = time.time()
        for rob in listRobots:
            #Draw circle of position
            # print(rob.X[0])
            # print(rob.X[1])
            vibes.drawAUV(rob.X[0], rob.X[1], 0.2, rob.theta*180/math.pi, rob.couleur)
            
            #Determine next point
            delta = 2*rob.numero*math.pi/len(listRobots)
            nextX, nextV = traj(t,delta)
            vibes.drawCircle(nextX[0],nextX[1], 0.005, 'r')
Exemple #5
0
y_max = 32.

def newFigure(name):
	vibes.newFigure(name)
	vibes.setFigureProperties({'x':0, 'y':0, 'width':1024, 'height':500, 'viewbox':'equal'})
	vibes.axisLimits(x_min-offset, x_max+offset, y_min-offset, y_max+offset)
	vibes.drawBox(x_min-offset, x_max+offset, y_min-offset, y_max+offset, "white[white]")

data = np.transpose(np.vstack([depthFusionData.time/3600., depthFusionData.depth]))
data_ref = np.transpose(np.vstack([missionData.time/3600., missionData.depth]))

data_piston = np.transpose(np.vstack([pistonStateData.time/3600., pistonStateData.position*tick_to_volume*1e6]))

vibes.beginDrawing()
newFigure("Depth regulation")
vibes.drawLine(data.tolist(), "black")
vibes.drawLine(data_ref.tolist(), "red")
vibes.axisAuto()
# vibes.drawLine([[0,0.3],[4360,0.3]])
vibes.saveImage(file_directory + 'float_regulation.svg')

#######################################

y_min = -1.*tick_to_volume*1e6
y_max = 2400.*tick_to_volume*1e6
newFigure("Piston state")
vibes.drawLine(data_piston.tolist(), "black")
vibes.axisAuto()
vibes.saveImage(file_directory + 'float_regulation_piston.svg')

#######################################
Exemple #6
0
#exmaple.py

from vibes import vibes

print(vibes.channel, vibes.current_fig)

vibes.beginDrawing()
vibes.newFigure("test")
vibes.drawBox(0, 1, 4, 6, color='[#FF12FFA0]', figure='test')
vibes.drawText(12, 12, 'My Text', 0.1, 'b[r]')
vibes.axisAuto()
vibes.drawBox(0.5, 2, 4, 7, color='[#00FFFF66]', figure='test')
vibes.drawBox(-1, 0, -4, -6, color='r', figure='test')
vibes.drawLine([[0, 0], [4, 4]])
vibes.drawEllipse(3, 5, 1, 3, 45)
vibes.drawEllipse(5, 5, 3, 3, 0, angles=[30, 60], color='g')

vibes.drawCircle(0, 0, 5)
vibes.drawAUV(0, 0, 2, 3, color='r[yellow]')

vibes.drawPie([0, 0], [3, 4], [45, 90])

vibes.newGroup("Pie", figure="test", format='[cyan]')
vibes.drawPie([0, 0], [5, 9], [-120, -40], group="Pie")
# vibes.drawPie([0,0], [5,9], [-120, -40], "[b]")

vibes.drawPie([5, 2], [1, 2], [160, 220])  #, 'g[y]')

# vibes.clearGroup("Pie", figure="test")

vibes.drawPie([0, 0], [1, 2], [160, 220])  #, 'g[y]')
Exemple #7
0
from vibes import vibes
from pyIbex import PixelMap2D, CtcPixelMap, IntervalVector, Interval
from scipy import misc
import numpy as np
"""
Example : image contractor
"""

# Generate the image using vibes
# Only use for drawing
vibes.beginDrawing()
vibes.newFigure('Map')
vibes.setFigureProperties({'x': 0, 'y': 0, 'width': 500, 'height': 500})
vibes.drawCircle(4, 4, 3, '[k]')
vibes.drawLine([[-3, -1], [7, -1]], '[k]')
vibes.drawLine([[7, -1], [7, 1]], '[k]')
vibes.axisLimits(-4, 8, -4, 8)

# Read the image and extract the last layer
img = misc.imread('./img.png')[:, :, 3]
# normalize in order to have a binary image.
img = img / np.max(img)
if np.max(img) != 1:
    print("Error, img must be a binary image")

# convert img into a unsigned int64 image type
img = img.astype(np.uint64)
# vertical flip to inverse the y axis
img = np.flipud(img)

# PixelMap2D constructor takes :
from vibes import vibes
from pyIbex import PixelMap2D, CtcPixelMap, IntervalVector, Interval
from scipy import misc
import numpy as np
"""
Example : image contractor
"""

# Generate the image using vibes
# Only use for drawing
vibes.beginDrawing()
vibes.newFigure('Map')
vibes.setFigureProperties({'x': 0, 'y': 0, 'width': 500, 'height': 500})
vibes.drawCircle(4, 4, 3, '[k]')
vibes.drawLine([[-3, -1], [7, -1]], '[k]')
vibes.drawLine([[7, -1], [7, 1]], '[k]')
vibes.axisLimits(-4,8,-4,8)



# Read the image and extract the last layer 
img = misc.imread('./img.png')[:,:,3]
# normalize in order to have a binary image.
img = img/np.max(img)
if np.max(img) != 1:
	print("Error, img must be a binary image")

# convert img into a unsigned int64 image type
img = img.astype(np.uint64) 
# vertical flip to inverse the y axis
img = np.flipud(img)
Exemple #9
0
def plot_velocity_position(result):
	
	# vibes.drawLine((np.transpose(np.transpose(result)[0:2])).tolist())
	vibes.drawLine(result[:,[0,2]].tolist())