Have camera settings read in from Python file on Raspberry Pi

This year our team wants to get the FMS alliance value and send it over to our Raspberry PI with wpilibpi to determine which ball color to track, meaning it can’t just be preloaded in the “Custom Properties Json” in the Vision Settings tab.

    with open('/boot/frc.json') as f:
        cameraConfig = json.load(f)
        camera = cameraConfig['cameras'][0]
        print('CameraConfig: ', cameraConfig)
    cs = CameraServer.getInstance()
    cameraSettings = cs.startAutomaticCapture()


    res_width = camera['width']
    res_height = camera['height']
    cameraConfig['pixel format'] = 'mjpeg'
    cameraConfig['FPS'] = 120
    cameraConfig['height'] = 480
    cameraConfig['width'] = 640
    cameraConfig['brightness'] = 10
    cameraConfig['exposure'] = 5
    cameraConfig['contrast'] = 10
    cameraConfig['saturation'] = 10
    cameraConfig['hue'] = 10

Doing this sets pixel format, fps, height, width, brightness, and exposure correctly, but contrast, saturation, and hue aren’t. Does anyone have any ideas why? My camera does have values for those other settings that can be set, but they just won’t change. In the ‘source JSON config’ the values for the ones that work do change as well.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.