Skip to content

Commit

Permalink
Merge branch 'main' into rsdk-7747
Browse files Browse the repository at this point in the history
  • Loading branch information
martha-johnston authored May 31, 2024
2 parents 7e7be08 + 40103a1 commit 36e8a08
Show file tree
Hide file tree
Showing 17 changed files with 338 additions and 330 deletions.
4 changes: 2 additions & 2 deletions docs/examples/_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from viam.proto.app import (
AddRoleRequest,
AddRoleResponse,
AppServiceBase,
ChangeRoleRequest,
ChangeRoleResponse,
CheckPermissionsRequest,
Expand Down Expand Up @@ -130,6 +129,7 @@
ShareLocationResponse,
TailRobotPartLogsRequest,
TailRobotPartLogsResponse,
UnimplementedAppServiceBase,
UnshareLocationRequest,
UnshareLocationResponse,
UpdateFragmentRequest,
Expand Down Expand Up @@ -337,7 +337,7 @@ async def StreamingDataCaptureUpload(
pass


class MockApp(AppServiceBase):
class MockApp(UnimplementedAppServiceBase):
def __init__(self):
self.organization = Organization(id="id", name="name", public_namespace="public_namespace", default_region="default_region")
self.locations = [Location()]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "viam-sdk"
version = "0.21.0"
version = "0.21.1"
description = "Viam Robotics Python SDK"
authors = [ "Naveed <[email protected]>" ]
license = "Apache-2.0"
Expand Down
1 change: 1 addition & 0 deletions src/viam/components/camera/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ async def GetProperties(self, stream: Stream[GetPropertiesRequest, GetProperties
supports_pcd=properties.supports_pcd,
intrinsic_parameters=properties.intrinsic_parameters,
distortion_parameters=properties.distortion_parameters,
mime_types=properties.mime_types,
)
await stream.send_message(response)

Expand Down
4 changes: 2 additions & 2 deletions src/viam/components/motor/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
IsMovingResponse,
IsPoweredRequest,
IsPoweredResponse,
MotorServiceBase,
ResetZeroPositionRequest,
ResetZeroPositionResponse,
SetPowerRequest,
Expand All @@ -23,14 +22,15 @@
SetRPMResponse,
StopRequest,
StopResponse,
UnimplementedMotorServiceBase,
)
from viam.resource.rpc_service_base import ResourceRPCServiceBase
from viam.utils import dict_to_struct, struct_to_dict

from .motor import Motor


class MotorRPCService(MotorServiceBase, ResourceRPCServiceBase[Motor]):
class MotorRPCService(UnimplementedMotorServiceBase, ResourceRPCServiceBase[Motor]):
"""
gRPC Service for a Motor
"""
Expand Down
10 changes: 9 additions & 1 deletion src/viam/gen/app/v1/app_grpc.py

Large diffs are not rendered by default.

168 changes: 84 additions & 84 deletions src/viam/gen/app/v1/robot_pb2.py

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions src/viam/gen/app/v1/robot_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ class RobotConfig(google.protobuf.message.Message):
def overwrite_fragment_status(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___AppValidationStatus]:
...

def __init__(self, *, cloud: global___CloudConfig | None=..., remotes: collections.abc.Iterable[global___RemoteConfig] | None=..., components: collections.abc.Iterable[global___ComponentConfig] | None=..., processes: collections.abc.Iterable[global___ProcessConfig] | None=..., services: collections.abc.Iterable[global___ServiceConfig] | None=..., network: global___NetworkConfig | None=..., auth: global___AuthConfig | None=..., debug: builtins.bool | None=..., modules: collections.abc.Iterable[global___ModuleConfig] | None=..., disable_partial_start: builtins.bool | None=..., packages: collections.abc.Iterable[global___PackageConfig] | None=..., overwrite_fragment_status: collections.abc.Iterable[global___AppValidationStatus] | None=..., enable_web_profile: builtins.bool | None=...) -> None:
def __init__(self, *, cloud: global___CloudConfig | None=..., remotes: collections.abc.Iterable[global___RemoteConfig] | None=..., components: collections.abc.Iterable[global___ComponentConfig] | None=..., processes: collections.abc.Iterable[global___ProcessConfig] | None=..., services: collections.abc.Iterable[global___ServiceConfig] | None=..., network: global___NetworkConfig | None=..., auth: global___AuthConfig | None=..., debug: builtins.bool | None=..., modules: collections.abc.Iterable[global___ModuleConfig] | None=..., disable_partial_start: builtins.bool | None=..., packages: collections.abc.Iterable[global___PackageConfig] | None=..., overwrite_fragment_status: collections.abc.Iterable[global___AppValidationStatus] | None=..., enable_web_profile: builtins.bool=...) -> None:
...

def HasField(self, field_name: typing.Literal['_auth', b'_auth', '_debug', b'_debug', '_disable_partial_start', b'_disable_partial_start', '_enable_web_profile', b'_enable_web_profile', '_network', b'_network', 'auth', b'auth', 'cloud', b'cloud', 'debug', b'debug', 'disable_partial_start', b'disable_partial_start', 'enable_web_profile', b'enable_web_profile', 'network', b'network']) -> builtins.bool:
def HasField(self, field_name: typing.Literal['_auth', b'_auth', '_debug', b'_debug', '_disable_partial_start', b'_disable_partial_start', '_network', b'_network', 'auth', b'auth', 'cloud', b'cloud', 'debug', b'debug', 'disable_partial_start', b'disable_partial_start', 'network', b'network']) -> builtins.bool:
...

def ClearField(self, field_name: typing.Literal['_auth', b'_auth', '_debug', b'_debug', '_disable_partial_start', b'_disable_partial_start', '_enable_web_profile', b'_enable_web_profile', '_network', b'_network', 'auth', b'auth', 'cloud', b'cloud', 'components', b'components', 'debug', b'debug', 'disable_partial_start', b'disable_partial_start', 'enable_web_profile', b'enable_web_profile', 'modules', b'modules', 'network', b'network', 'overwrite_fragment_status', b'overwrite_fragment_status', 'packages', b'packages', 'processes', b'processes', 'remotes', b'remotes', 'services', b'services']) -> None:
def ClearField(self, field_name: typing.Literal['_auth', b'_auth', '_debug', b'_debug', '_disable_partial_start', b'_disable_partial_start', '_network', b'_network', 'auth', b'auth', 'cloud', b'cloud', 'components', b'components', 'debug', b'debug', 'disable_partial_start', b'disable_partial_start', 'enable_web_profile', b'enable_web_profile', 'modules', b'modules', 'network', b'network', 'overwrite_fragment_status', b'overwrite_fragment_status', 'packages', b'packages', 'processes', b'processes', 'remotes', b'remotes', 'services', b'services']) -> None:
...

@typing.overload
Expand All @@ -123,10 +123,6 @@ class RobotConfig(google.protobuf.message.Message):
def WhichOneof(self, oneof_group: typing.Literal['_disable_partial_start', b'_disable_partial_start']) -> typing.Literal['disable_partial_start'] | None:
...

@typing.overload
def WhichOneof(self, oneof_group: typing.Literal['_enable_web_profile', b'_enable_web_profile']) -> typing.Literal['enable_web_profile'] | None:
...

@typing.overload
def WhichOneof(self, oneof_group: typing.Literal['_network', b'_network']) -> typing.Literal['network'] | None:
...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

from PIL import Image

from viam.media.video import CameraMimeType, ViamImage

from ..viam_rgba_plugin import RGBA_FORMAT_LABEL
from ....media.video import CameraMimeType, ViamImage
from .viam_rgba_plugin import RGBA_FORMAT_LABEL

# Formats that are supported by PIL
LIBRARY_SUPPORTED_FORMATS = ["JPEG", "PNG", RGBA_FORMAT_LABEL]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@
from PIL.ImageFile import ImageFile, PyDecoder, PyEncoder, _safe_read # type: ignore -- (njooma) this exists, manually checked
from PIL.ImageFile import _save as image_save # type: ignore -- (njooma) this exists, manually checked

# Viam uses a special header prepended to raw RGBA data. The header is composed of a
# 4-byte magic number followed by a 4-byte line of the width as a uint32 number
# and another for the height. Credit to Ben Zotto for inventing this formulation
# https://bzotto.medium.com/introducing-the-rgba-bitmap-file-format-4a8a94329e2c

RGBA_MAGIC_NUMBER = bytes("RGBA", "utf-8")

RGBA_FORMAT_LABEL = "VIAM_RGBA"

RGBA_HEADER_LENGTH = 12
from ...viam_rgba import RGBA_FORMAT_LABEL, RGBA_HEADER_LENGTH, RGBA_MAGIC_NUMBER


def _accept(prefix: str):
Expand Down
10 changes: 10 additions & 0 deletions src/viam/media/viam_rgba.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Viam uses a special header prepended to raw RGBA data. The header is composed of a
# 4-byte magic number followed by a 4-byte line of the width as a uint32 number
# and another for the height. Credit to Ben Zotto for inventing this formulation
# https://bzotto.medium.com/introducing-the-rgba-bitmap-file-format-4a8a94329e2c

RGBA_MAGIC_NUMBER = bytes("RGBA", "utf-8")

RGBA_FORMAT_LABEL = "VIAM_RGBA"

RGBA_HEADER_LENGTH = 12
5 changes: 1 addition & 4 deletions src/viam/media/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
from viam.errors import NotSupportedError
from viam.proto.component.camera import Format

from .viam_rgba_plugin import RGBA_FORMAT_LABEL, RGBA_HEADER_LENGTH, RGBA_MAGIC_NUMBER

# Formats that are supported by PIL
LIBRARY_SUPPORTED_FORMATS = ["JPEG", "PNG", RGBA_FORMAT_LABEL]
from .viam_rgba import RGBA_HEADER_LENGTH, RGBA_MAGIC_NUMBER


class CameraMimeType(str, Enum):
Expand Down
Loading

0 comments on commit 36e8a08

Please sign in to comment.