print_once_flag = False
        msg = recv_msg()
        if msg != None:
            cmd = pickle.loads(msg)
            print(cmd)
            current_task = cmd["name"]
            args = cmd["args"]
            print("Executing: " + current_task + " " + str(args))
            print_once_flag = True

    if current_task == "get_image":
        if not rgb_enabled:
            cameraRGB.enable(timestep)
            rgb_enabled = True
        else:
            np_img = np.array(cameraRGB.getImageArray(), dtype=np.uint8)
            respond("done", np_img)
            current_task = "idle"
            cameraRGB.disable()
            rgb_enabled = False

    if current_task == "get_depth":
        if not depth_enabled:
            cameraDepth.enable(timestep)
            depth_enabled = True
        else:
            np_dep = np.array(cameraDepth.getRangeImageArray())
            respond("done", np_dep)
            current_task = "idle"
            cameraDepth.disable()
            depth_enabled = False
Пример #2
0
    # get and set value for parameters.
    left7 = irLeft7.getValue()
    left6 = irLeft6.getValue()
    left5 = irLeft5.getValue()

    right0 = irRight0.getValue()
    right1 = irRight1.getValue()
    right2 = irRight2.getValue()

    gRight = gsRight.getValue()
    gLeft = gsLeft.getValue()
    gCentre = gsCentre.getValue()

    # display the components of each pixel
    image = camera.getImageArray()

    # get the colour component of the pixel x (0,40) y(5,6)
    for x in range(0, camera.getWidth()):
        for y in range(5, 6):
            # we fill our arrays with the colour values.
            red[x] = image[x][y][0]
            green[x] = image[x][y][1]
            blue[x] = image[x][y][2]

            # that illustrates arrays in the text field.
    print
    'r=' + str(red)
    print
    'g=' + str(green)
    print