Esempio n. 1
0
    def getAllCamerasFromSimulator(self, sock):
        if not self.isInitialized:  # usada para python 3.X
            # if self.isInitialized == False:  # Usada para python 2.x
            print(
                "\nNetwork must be initialized first. Please use 'initialize_network()'"
            )
            return -1

        if not self.isConnected:  # usada para python 3.X
            # if self.isConnected == False: 	# Usada para python 2.x
            print(
                "\nClient must be connected first. Please use 'connectTosimulator()'"
            )
            return -1

        print("\nGet existing cameras from simulator...")

        ##create command
        command = "GETDETAILSALLCAMERAS$"

        ##send command to server
        if sock.send(command, 0) < 0:
            print("Send failed\n")
            return -1

        ## receive ACK from server
        command = sock.recv(1028, 0)
        length = len(command)
        if length < 0:
            print("recv failed\n")
            return -1

        chars_array = command.split("#")
        global out
        out = []
        for i in range(0, len(chars_array)):
            cam = MSScam("", 0, 0, 0, 0, 0, 0, 0, 0, 0)
            stringaux = chars_array[i]
            stringaux = stringaux.split("/")
            cam.initFromDescriptorExtended(stringaux)
            cam.setStatus(True)
            out.append(cam)

        print("done!")
        return 1
Esempio n. 2
0
filereader = PropertyFileReader(cfgpath, False)
(found, value) = filereader.getProperty("SIMULATOR_IP")
if found:
    ipAddress = str(value)
(found, value) = filereader.getProperty("SIMULATOR_PORT")
if found:
    port = int(value)

# initialize client
cli = MSSclient()
cli.connectTosimulator(ipAddress, port, sock)

# create the camera
#cam = MSScam("demo2_test", 640, 480, 10, posX, posY, posZ, rotX, rotY, rotZ)

cam = MSScam("demo2_test1", 640, 480, 10, 69.7, 10.8, -80.1, 5, 8.5, 0.0)
#cam = MSScam("demo2_test2", 640, 480, 10, 63, 10, -80, 0.0, 0.0, 0.0)

# add the camera to the simulator
cam.addTosimulator(cli.sock, ipAddress, port)

# preview the camera for 10 secs
cam.preview(10)  # time in seconds

# wait 1 sec before closing this demo
time.sleep(1)  # time in seconds

# unregistering camera
cam.removeFromSimulator()

# save camera details
Esempio n. 3
0
      cfgpath)
filereader = PropertyFileReader(cfgpath, False)
(found, value) = filereader.getProperty("SIMULATOR_IP")
if found:
    ipAddress = str(value)
(found, value) = filereader.getProperty("SIMULATOR_PORT")
if found:
    port = int(value)

# initialize client
cli = MSSclient()
cli.connectTosimulator(ipAddress, port, sock)

# create the camera
# cam = MSScam("demo3_test", 640, 480, 10, 15.0, -3.0, 5.0, 20.0, 10.0, 0.0) # EPS LITE
cam = MSScam("demo3_test", 640, 480, 10, -108.5, 20.0, -31.5, 15.0, 45.0, 0.0)

# add the camera to the simulator
cam.addTosimulator(cli.sock, ipAddress, port)

# preview the camera for 10 secs
cam.preview(10)  # time in seconds

# preview the camera for 10 secs
cam.setFPS(1)
cam.preview(10)  # time in seconds

# set PNG images (lossless codec) and preview camera for 10 secs
cam.setTXRXformat(CAM_PNG)  # 0 = jpg, 1 = png,
cam.preview(10)  # time in seconds
Esempio n. 4
0
nameCapute1 = "SecuenciaAutoBus_RGB.avi"
#nameCapute1 = "AppTFM_RGB"+str(randint(0, 99))+".avi"
salida1 = cv2.VideoWriter(nameCapute1, cv2.VideoWriter_fourcc(*'XVID'), 20.0,
                          (640, 480))

nameCapute2 = "secuenciaAutoBus_Semantica.avi"
#nameCapute2 = "AppTFM_MapaSemantico"+str(randint(0, 99))+".avi"
salida2 = cv2.VideoWriter(nameCapute2, cv2.VideoWriter_fourcc(*'XVID'), 20.0,
                          (640, 480))

# initialize client
cli = MSSclient()
cli.connectTosimulator(ipAddress, port, sock)

numcam = MSScam()
numCam = numcam.readTosimulator(cli.sock, ipAddress, port)

name = "Prueba4_SelectVideoWall_CaptureVideo" + str(randint(0, 99))
cam = MSScam(name, 640, 480)
cam.configRACamera(cli.sock, ipAddress, port)

print("Numero de camaras Disponibles " + str(numCam))

if numCam == 0:
    print("No hay camaras moviles en el simulador")
else:
    i = 0
    while i < numCam:
        print("Acceder a las camaras con el nombre: " + name + "_" + str(i))
        i += 1
Esempio n. 5
0
# display demo information in console
print("Mapa Semantico Demo 1: Doble Pantalla (2 camaras)\n")
print(" (1) Conexion como cliente en el simulador")
print(" (2) Crear 2 objetos Camera con identicas posiciones y ubicaciones ")
print(" (3) Agregar al simulador independientemente, la segunda con el comando(filtro) mapa semantico ")
print(" (4) Llamada a la funcion preview para visualizar las camaras en una VideoWall")
print(" (4) Press ESC para finalziar y desconectar el cliente")

# initialize client
cli = MSSclient()
cli.connectTosimulator(ipAddress, port, sock)

# create the camera
name = "demo1_MapaSemantico"+str(randint(0, 99))  # rand in the range 0 to 99;
cam1 = MSScam(name, 640, 480, 10, 0, 10, 0, 10, 123, 0.0)
cam1.addTosimulator(cli.sock, ipAddress, port)

# Crear la misma camara con parametros dienticos
name = "demo1_MapaSemantico"+str(randint(0, 99))  # rand in the range 0 to 99;
cam2 = MSScam(name, 640, 480, 10, 0, 10, 0, 10, 123, 0.0)
cam2.addToSimulatorMapaSemantico(cli.sock, ipAddress, port)

while True:
    vecImgs=[]

    ## cam 1
    frame1=cam1.operator()
    if isinstance(frame1,np.ndarray):
        width, height = frame1.shape[:2]
        if width>0 and height>0:
Esempio n. 6
0
print(" (1) connects the client to the simulator\n")
print(" (2) creates a camera you can you can use\n")
print(" (3) registers the camera in the simulator\n")
print(" (4) activates GUI to move the camera\n")
print(" (5) previews the camera content\n\n")

# initialize client
cli = MSSclient()
cli.connectTosimulator(ipAddress, port, sock)

# create the camera
# initialization for a specific parameters (position, rotation, TX/RX)
# cam = MSScam("demo4_test_ext", 640, 480, 20, 10.38, -6.44, 5.0, 20.0, 10.0, 0.0)
#cam = MSScam("demo4_test_ext", 640, 480, 10, 0, 0, 0, 0.0, 0.0, 0.0) # EPS LITE

cam = MSScam("demo4_test_ext", 640, 480, 10, -103.5, 10.7, -147.9, 10.0, 25.0,
             0.0)

# add the camera to the simulator
cam.addTosimulator(cli.sock, ipAddress, port)

# start GUI control of the camera
cam.GUIcontrol()

# display the coordinates
cam.print_details()

# wait 1 sec before closing this demo
time.sleep(1)  # time in seconds

# unregistering camera
cam.removeFromSimulator()
Esempio n. 7
0
                          (640, 480))

#nameCapute2 = "secuenciaVideo6_Semantica.avi"
nameCapute2 = "Video_MapaSemantico" + str(randint(0, 99)) + ".avi"
salida2 = cv2.VideoWriter(nameCapute2, cv2.VideoWriter_fourcc(*'XVID'), 20.0,
                          (640, 480))

# initialize client
cli = MSSclient()
cli.connectTosimulator(ipAddress, port, sock)

# create the camera
name = "demo1_MapaSemantico" + str(randint(0,
                                           99))  # rand in the range 0 to 99;
# cam1 = MSScam(name, 640, 480, 10, 0, 10, 0, 10, 123, 0.0) # cam = MSScam("demo2_test", 640, 480, 10, posX, posY, posZ, rotX, rotY, rotZ)
cam1 = MSScam(name, 640, 480, 10, -136, 2, 66, 0, 90, 0.0)
#cam1 = MSScam(name, 640, 480, 10, 26, 2, -13, 0, 270, 0.0)
cam1.addTosimulator(cli.sock, ipAddress, port)

# Crear la misma camara con parametros dienticos
name = "demo1_MapaSemantico" + str(randint(0,
                                           99))  # rand in the range 0 to 99;
# cam2 = MSScam(name, 640, 480, 10, 0, 10, 0, 10, 123, 0.0)
cam2 = MSScam(name, 640, 480, 10, -136, 2, 66, 0, 90, 0.0)
#cam2 = MSScam(name, 640, 480, 10, 26, 2, -13, 0, 270, 0.0)
cam2.addToSimulatorMapaSemantico(cli.sock, ipAddress, port)

while True:
    vecImgs = []

    ## cam 1
Esempio n. 8
0
## display demo information in console
print("DEMO: VIDEO WALL\n")
print("This demo test basic functionality:\n")
print(" (1) connects the client to the simulator\n")
print(" (2) creates 6 cameras\n")
print(" (3) registers the cameras in the simulator\n")
print(" (4) previews the cameras in a video wall\n")

##initialize client
cli = MSSclient()
cli.connectTosimulator(ipAddress, port, sock)

##create camera 1
name = "demo1_test" + str(randint(0, 999))  ## rand in the range 0 to 999;
#cam1 = MSScam(name, 320, 240, 10, -8.7, -6.13, 5.96, 10.0, 50.0, 0.0) # EPS LITE
cam1 = MSScam(name, 320, 240, 10, 1, 15, 0, 10, 115, 0.0)
cam1.addTosimulator(cli.sock, ipAddress, port)

## create camera 2
name = "demo1_test" + str(randint(0, 999))  ## rand in the range 0 to 999;
# cam2 = MSScam(name, 320, 240, 10, -11.38, -5.8, 27.0, 20.0, 90.0, 0.0) # EPS LITE
cam2 = MSScam(name, 320, 240, 10, -100.5, 30.0, -41.5, 15.0, 45.0, 0.0)
cam2.addTosimulator(cli.sock, ipAddress, port)

## create camera 3
name = "demo1_test" + str(randint(0, 999))  ## rand in the range 0 to 999;
# cam3 = MSScam(name, 320, 240, 10, 10.70, -6.42, 38.85, 10.0, 180.0, 0.0) # EPS LITE
cam3 = MSScam(name, 320, 240, 10, 27.77, 6.1, -117.35, 0, 1.0, 0.0)
cam3.addTosimulator(cli.sock, ipAddress, port)

## create camera 4
Esempio n. 9
0
print("This demo test basic functionality:\n")
print(" (1) connects the client to the simulator\n")
print(" (2) createS a camera you can you can use\n")
print(" (3) user the GUI to position the camera in the simulator\n")
print(" (4) registers the camera in the simulator\n")
print(" (5) previews\n")
print(" (6) previews the camera content\n\n")

# initialize client
cli = MSSclient()
cli.connectTosimulator(ipAddress, port, sock)

# create the camera	+str(randint(0,100))

cam = MSScam(
    "demo5_test_2", 640, 480,
    10)  # initialization for a specific parameters (position, rotation, TX/RX)

# start GUI control of the camera
cam.GUIinsert(cli.sock)

# add the camera to the simulator
cam.addTosimulator(cli.sock, ipAddress, port)
cam.preview(10)

# display the coordinates
# cam.print_details()

# wait 1 sec before closing this demo
time.sleep(1)  # time in seconds