From dd4c0c0788ec2966c7cb2b0dda81fb933bae0db5 Mon Sep 17 00:00:00 2001 From: John Ingve Olsen Date: Tue, 28 Nov 2023 12:53:34 +0100 Subject: [PATCH] Bump to SDK 2.11.0-preview-1 --- README.md | 2 +- .../deployment/expected-version.txt | 2 +- .../platform-dependent/fedora-37/setup.sh | 4 +- .../platform-dependent/fedora-38/setup.sh | 4 +- .../platform-dependent/ubuntu-20.04/setup.sh | 4 +- .../platform-dependent/ubuntu-22.04/setup.sh | 4 +- .../platform-dependent/ubuntu-23.04/setup.sh | 4 +- .../platform-dependent/ubuntu-23.10/setup.sh | 4 +- continuous-integration/versions.json | 2 +- continuous-integration/windows/setup.py | 2 +- modules/zivid/camera_state.py | 245 ++++++++++++++++++ modules/zivid/settings.py | 4 + setup.py | 4 +- 13 files changed, 267 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 5d6f0beb..469f6b97 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Zivid Python is the official Python package for Zivid 3D cameras. Read more abou ### Dependencies * [Python](https://www.python.org/) version 3.7 or higher -* [Zivid SDK][zivid-download-software-url] version 2.10.1 (see [here][zivid-software-installation-url] for help) +* [Zivid SDK][zivid-download-software-url] version 2.11.0 (see [here][zivid-software-installation-url] for help) * [Compiler](doc/CompilerInstallation.md) with C++17 support *Ubuntu users must install Python headers (`apt install python3-dev`) in addition to the regular `python3` package.* diff --git a/continuous-integration/deployment/expected-version.txt b/continuous-integration/deployment/expected-version.txt index 5777c832..a2d85a56 100644 --- a/continuous-integration/deployment/expected-version.txt +++ b/continuous-integration/deployment/expected-version.txt @@ -1 +1 @@ -2.10.1.2.10.1 +2.11.0.2.11.0 diff --git a/continuous-integration/linux/platform-dependent/fedora-37/setup.sh b/continuous-integration/linux/platform-dependent/fedora-37/setup.sh index 01568d46..e4517e72 100755 --- a/continuous-integration/linux/platform-dependent/fedora-37/setup.sh +++ b/continuous-integration/linux/platform-dependent/fedora-37/setup.sh @@ -30,5 +30,5 @@ function install_www_deb { rm -r $TMP_DIR || exit $? } -install_www_deb "https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u20/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb" || exit $? -install_www_deb "https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u20/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb" || exit $? \ No newline at end of file +install_www_deb "https://downloads.zivid.com/sdk/previews/${ZIVID_SDK_EXACT_VERSION}/u20/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb" || exit $? +install_www_deb "https://downloads.zivid.com/sdk/previews/${ZIVID_SDK_EXACT_VERSION}/u20/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb" || exit $? \ No newline at end of file diff --git a/continuous-integration/linux/platform-dependent/fedora-38/setup.sh b/continuous-integration/linux/platform-dependent/fedora-38/setup.sh index 01568d46..e4517e72 100755 --- a/continuous-integration/linux/platform-dependent/fedora-38/setup.sh +++ b/continuous-integration/linux/platform-dependent/fedora-38/setup.sh @@ -30,5 +30,5 @@ function install_www_deb { rm -r $TMP_DIR || exit $? } -install_www_deb "https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u20/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb" || exit $? -install_www_deb "https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u20/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb" || exit $? \ No newline at end of file +install_www_deb "https://downloads.zivid.com/sdk/previews/${ZIVID_SDK_EXACT_VERSION}/u20/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb" || exit $? +install_www_deb "https://downloads.zivid.com/sdk/previews/${ZIVID_SDK_EXACT_VERSION}/u20/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb" || exit $? \ No newline at end of file diff --git a/continuous-integration/linux/platform-dependent/ubuntu-20.04/setup.sh b/continuous-integration/linux/platform-dependent/ubuntu-20.04/setup.sh index 5a57f69a..be165f14 100755 --- a/continuous-integration/linux/platform-dependent/ubuntu-20.04/setup.sh +++ b/continuous-integration/linux/platform-dependent/ubuntu-20.04/setup.sh @@ -36,5 +36,5 @@ function install_www_deb { rm -r $TMP_DIR || exit $? } -install_www_deb "https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u20/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb" || exit $? -install_www_deb "https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u20/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb" || exit $? \ No newline at end of file +install_www_deb "https://downloads.zivid.com/sdk/previews/${ZIVID_SDK_EXACT_VERSION}/u20/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb" || exit $? +install_www_deb "https://downloads.zivid.com/sdk/previews/${ZIVID_SDK_EXACT_VERSION}/u20/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb" || exit $? \ No newline at end of file diff --git a/continuous-integration/linux/platform-dependent/ubuntu-22.04/setup.sh b/continuous-integration/linux/platform-dependent/ubuntu-22.04/setup.sh index 5961650b..85955f0d 100755 --- a/continuous-integration/linux/platform-dependent/ubuntu-22.04/setup.sh +++ b/continuous-integration/linux/platform-dependent/ubuntu-22.04/setup.sh @@ -35,5 +35,5 @@ function install_www_deb { rm -r $TMP_DIR || exit $? } -install_www_deb "https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u22/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb" || exit $? -install_www_deb "https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u22/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb" || exit $? \ No newline at end of file +install_www_deb "https://downloads.zivid.com/sdk/previews/${ZIVID_SDK_EXACT_VERSION}/u20/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb" || exit $? +install_www_deb "https://downloads.zivid.com/sdk/previews/${ZIVID_SDK_EXACT_VERSION}/u20/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb" || exit $? \ No newline at end of file diff --git a/continuous-integration/linux/platform-dependent/ubuntu-23.04/setup.sh b/continuous-integration/linux/platform-dependent/ubuntu-23.04/setup.sh index 5f246445..ea390133 100755 --- a/continuous-integration/linux/platform-dependent/ubuntu-23.04/setup.sh +++ b/continuous-integration/linux/platform-dependent/ubuntu-23.04/setup.sh @@ -35,5 +35,5 @@ function install_www_deb { rm -r $TMP_DIR || exit $? } -install_www_deb "https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u22/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb" || exit $? -install_www_deb "https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u22/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb" || exit $? +install_www_deb "https://downloads.zivid.com/sdk/previews/${ZIVID_SDK_EXACT_VERSION}/u20/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb" || exit $? +install_www_deb "https://downloads.zivid.com/sdk/previews/${ZIVID_SDK_EXACT_VERSION}/u20/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb" || exit $? diff --git a/continuous-integration/linux/platform-dependent/ubuntu-23.10/setup.sh b/continuous-integration/linux/platform-dependent/ubuntu-23.10/setup.sh index 5f246445..ea390133 100755 --- a/continuous-integration/linux/platform-dependent/ubuntu-23.10/setup.sh +++ b/continuous-integration/linux/platform-dependent/ubuntu-23.10/setup.sh @@ -35,5 +35,5 @@ function install_www_deb { rm -r $TMP_DIR || exit $? } -install_www_deb "https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u22/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb" || exit $? -install_www_deb "https://downloads.zivid.com/sdk/releases/${ZIVID_SDK_EXACT_VERSION}/u22/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb" || exit $? +install_www_deb "https://downloads.zivid.com/sdk/previews/${ZIVID_SDK_EXACT_VERSION}/u20/zivid-telicam-driver_${ZIVID_TELICAM_EXACT_VERSION}_amd64.deb" || exit $? +install_www_deb "https://downloads.zivid.com/sdk/previews/${ZIVID_SDK_EXACT_VERSION}/u20/zivid_${ZIVID_SDK_EXACT_VERSION}_amd64.deb" || exit $? diff --git a/continuous-integration/versions.json b/continuous-integration/versions.json index 3ec47841..e013ae44 100644 --- a/continuous-integration/versions.json +++ b/continuous-integration/versions.json @@ -1,4 +1,4 @@ { - "ZIVID_SDK_EXACT_VERSION": "2.10.1+50b274e8-7", + "ZIVID_SDK_EXACT_VERSION": "2.11.0-rc-1+9df43446-1", "ZIVID_TELICAM_EXACT_VERSION": "3.0.1.1-3" } diff --git a/continuous-integration/windows/setup.py b/continuous-integration/windows/setup.py index 045afa82..c814feab 100644 --- a/continuous-integration/windows/setup.py +++ b/continuous-integration/windows/setup.py @@ -15,7 +15,7 @@ def _install_zivid_sdk(): exact_version = json.loads(versions_json)["ZIVID_SDK_EXACT_VERSION"] with tempfile.TemporaryDirectory() as temp_dir: - zivid_installer_url = f"https://downloads.zivid.com/sdk/releases/{exact_version}/windows/ZividSetup_{exact_version}.exe" + zivid_installer_url = f"https://downloads.zivid.com/sdk/previews/{exact_version}/windows/ZividSetup_{exact_version}.exe" print("Downloading {}".format(zivid_installer_url), flush=True) zivid_installer = Path(temp_dir) / "ZividSetup.exe" response = requests.get(zivid_installer_url, timeout=(25, 600)) diff --git a/modules/zivid/camera_state.py b/modules/zivid/camera_state.py index 48a00633..4916028e 100644 --- a/modules/zivid/camera_state.py +++ b/modules/zivid/camera_state.py @@ -4,6 +4,72 @@ class CameraState: + class Network: + class IPV4: + def __init__( + self, + address=_zivid.CameraState.Network.IPV4.Address().value, + ): + if isinstance(address, (str,)): + self._address = _zivid.CameraState.Network.IPV4.Address(address) + else: + raise TypeError( + "Unsupported type, expected: (str,), got {value_type}".format( + value_type=type(address) + ) + ) + + @property + def address(self): + return self._address.value + + @address.setter + def address(self, value): + if isinstance(value, (str,)): + self._address = _zivid.CameraState.Network.IPV4.Address(value) + else: + raise TypeError( + "Unsupported type, expected: str, got {value_type}".format( + value_type=type(value) + ) + ) + + def __eq__(self, other): + if self._address == other._address: + return True + return False + + def __str__(self): + return str(_to_internal_camera_state_network_ipv4(self)) + + def __init__( + self, + ipv4=None, + ): + if ipv4 is None: + ipv4 = self.IPV4() + if not isinstance(ipv4, self.IPV4): + raise TypeError("Unsupported type: {value}".format(value=type(ipv4))) + self._ipv4 = ipv4 + + @property + def ipv4(self): + return self._ipv4 + + @ipv4.setter + def ipv4(self, value): + if not isinstance(value, self.IPV4): + raise TypeError("Unsupported type {value}".format(value=type(value))) + self._ipv4 = value + + def __eq__(self, other): + if self._ipv4 == other._ipv4: + return True + return False + + def __str__(self): + return str(_to_internal_camera_state_network(self)) + class Temperature: def __init__( self, @@ -207,10 +273,53 @@ def __eq__(self, other): def __str__(self): return str(_to_internal_camera_state_temperature(self)) + class InaccessibleReason: + ipConflict = "ipConflict" + ipNotInLocalSubnet = "ipNotInLocalSubnet" + + _valid_values = { + "ipConflict": _zivid.CameraState.InaccessibleReason.ipConflict, + "ipNotInLocalSubnet": _zivid.CameraState.InaccessibleReason.ipNotInLocalSubnet, + } + + @classmethod + def valid_values(cls): + return list(cls._valid_values.keys()) + + class Status: + available = "available" + busy = "busy" + connected = "connected" + connecting = "connecting" + disappeared = "disappeared" + disconnecting = "disconnecting" + firmwareUpdateRequired = "firmwareUpdateRequired" + inaccessible = "inaccessible" + updatingFirmware = "updatingFirmware" + + _valid_values = { + "available": _zivid.CameraState.Status.available, + "busy": _zivid.CameraState.Status.busy, + "connected": _zivid.CameraState.Status.connected, + "connecting": _zivid.CameraState.Status.connecting, + "disappeared": _zivid.CameraState.Status.disappeared, + "disconnecting": _zivid.CameraState.Status.disconnecting, + "firmwareUpdateRequired": _zivid.CameraState.Status.firmwareUpdateRequired, + "inaccessible": _zivid.CameraState.Status.inaccessible, + "updatingFirmware": _zivid.CameraState.Status.updatingFirmware, + } + + @classmethod + def valid_values(cls): + return list(cls._valid_values.keys()) + def __init__( self, available=_zivid.CameraState.Available().value, connected=_zivid.CameraState.Connected().value, + inaccessible_reason=_zivid.CameraState.InaccessibleReason().value, + status=_zivid.CameraState.Status().value, + network=None, temperature=None, ): if isinstance(available, (bool,)): @@ -231,6 +340,41 @@ def __init__( ) ) + if ( + isinstance(inaccessible_reason, _zivid.CameraState.InaccessibleReason.enum) + or inaccessible_reason is None + ): + self._inaccessible_reason = _zivid.CameraState.InaccessibleReason( + inaccessible_reason + ) + elif isinstance(inaccessible_reason, str): + self._inaccessible_reason = _zivid.CameraState.InaccessibleReason( + self.InaccessibleReason._valid_values[inaccessible_reason] + ) + else: + raise TypeError( + "Unsupported type, expected: str or None, got {value_type}".format( + value_type=type(inaccessible_reason) + ) + ) + + if isinstance(status, _zivid.CameraState.Status.enum): + self._status = _zivid.CameraState.Status(status) + elif isinstance(status, str): + self._status = _zivid.CameraState.Status(self.Status._valid_values[status]) + else: + raise TypeError( + "Unsupported type, expected: str, got {value_type}".format( + value_type=type(status) + ) + ) + + if network is None: + network = self.Network() + if not isinstance(network, self.Network): + raise TypeError("Unsupported type: {value}".format(value=type(network))) + self._network = network + if temperature is None: temperature = self.Temperature() if not isinstance(temperature, self.Temperature): @@ -245,6 +389,30 @@ def available(self): def connected(self): return self._connected.value + @property + def inaccessible_reason(self): + if self._inaccessible_reason.value is None: + return None + for key, internal_value in self.InaccessibleReason._valid_values.items(): + if internal_value == self._inaccessible_reason.value: + return key + raise ValueError( + "Unsupported value {value}".format(value=self._inaccessible_reason) + ) + + @property + def status(self): + if self._status.value is None: + return None + for key, internal_value in self.Status._valid_values.items(): + if internal_value == self._status.value: + return key + raise ValueError("Unsupported value {value}".format(value=self._status)) + + @property + def network(self): + return self._network + @property def temperature(self): return self._temperature @@ -271,6 +439,43 @@ def connected(self, value): ) ) + @inaccessible_reason.setter + def inaccessible_reason(self, value): + if isinstance(value, str): + self._inaccessible_reason = _zivid.CameraState.InaccessibleReason( + self.InaccessibleReason._valid_values[value] + ) + elif ( + isinstance(value, _zivid.CameraState.InaccessibleReason.enum) + or value is None + ): + self._inaccessible_reason = _zivid.CameraState.InaccessibleReason(value) + else: + raise TypeError( + "Unsupported type, expected: str or None, got {value_type}".format( + value_type=type(value) + ) + ) + + @status.setter + def status(self, value): + if isinstance(value, str): + self._status = _zivid.CameraState.Status(self.Status._valid_values[value]) + elif isinstance(value, _zivid.CameraState.Status.enum): + self._status = _zivid.CameraState.Status(value) + else: + raise TypeError( + "Unsupported type, expected: str, got {value_type}".format( + value_type=type(value) + ) + ) + + @network.setter + def network(self, value): + if not isinstance(value, self.Network): + raise TypeError("Unsupported type {value}".format(value=type(value))) + self._network = value + @temperature.setter def temperature(self, value): if not isinstance(value, self.Temperature): @@ -288,6 +493,9 @@ def __eq__(self, other): if ( self._available == other._available and self._connected == other._connected + and self._inaccessible_reason == other._inaccessible_reason + and self._status == other._status + and self._network == other._network and self._temperature == other._temperature ): return True @@ -297,6 +505,18 @@ def __str__(self): return str(_to_internal_camera_state(self)) +def _to_camera_state_network_ipv4(internal_ipv4): + return CameraState.Network.IPV4( + address=internal_ipv4.address.value, + ) + + +def _to_camera_state_network(internal_network): + return CameraState.Network( + ipv4=_to_camera_state_network_ipv4(internal_network.ipv4), + ) + + def _to_camera_state_temperature(internal_temperature): return CameraState.Temperature( dmd=internal_temperature.dmd.value, @@ -309,12 +529,30 @@ def _to_camera_state_temperature(internal_temperature): def _to_camera_state(internal_camera_state): return CameraState( + network=_to_camera_state_network(internal_camera_state.network), temperature=_to_camera_state_temperature(internal_camera_state.temperature), available=internal_camera_state.available.value, connected=internal_camera_state.connected.value, + inaccessible_reason=internal_camera_state.inaccessible_reason.value, + status=internal_camera_state.status.value, ) +def _to_internal_camera_state_network_ipv4(ipv4): + internal_ipv4 = _zivid.CameraState.Network.IPV4() + + internal_ipv4.address = _zivid.CameraState.Network.IPV4.Address(ipv4.address) + + return internal_ipv4 + + +def _to_internal_camera_state_network(network): + internal_network = _zivid.CameraState.Network() + + internal_network.ipv4 = _to_internal_camera_state_network_ipv4(network.ipv4) + return internal_network + + def _to_internal_camera_state_temperature(temperature): internal_temperature = _zivid.CameraState.Temperature() @@ -338,7 +576,14 @@ def _to_internal_camera_state(camera_state): internal_camera_state.connected = _zivid.CameraState.Connected( camera_state.connected ) + internal_camera_state.inaccessible_reason = _zivid.CameraState.InaccessibleReason( + camera_state._inaccessible_reason.value + ) + internal_camera_state.status = _zivid.CameraState.Status(camera_state._status.value) + internal_camera_state.network = _to_internal_camera_state_network( + camera_state.network + ) internal_camera_state.temperature = _to_internal_camera_state_temperature( camera_state.temperature ) diff --git a/modules/zivid/settings.py b/modules/zivid/settings.py index 22426458..896fb0ec 100644 --- a/modules/zivid/settings.py +++ b/modules/zivid/settings.py @@ -2481,12 +2481,16 @@ def valid_values(cls): class Pixel: all = "all" blueSubsample2x2 = "blueSubsample2x2" + blueSubsample4x4 = "blueSubsample4x4" redSubsample2x2 = "redSubsample2x2" + redSubsample4x4 = "redSubsample4x4" _valid_values = { "all": _zivid.Settings.Sampling.Pixel.all, "blueSubsample2x2": _zivid.Settings.Sampling.Pixel.blueSubsample2x2, + "blueSubsample4x4": _zivid.Settings.Sampling.Pixel.blueSubsample4x4, "redSubsample2x2": _zivid.Settings.Sampling.Pixel.redSubsample2x2, + "redSubsample4x4": _zivid.Settings.Sampling.Pixel.redSubsample4x4, } @classmethod diff --git a/setup.py b/setup.py index bd757d75..ae50c687 100644 --- a/setup.py +++ b/setup.py @@ -10,11 +10,11 @@ # To be replaced by: from setuptools_scm import get_version def get_version(): - return "2.10.1" + return "2.11.0" def _zivid_sdk_version(): - return "2.10.1" + return "2.11.0" def _zivid_python_version():