luckyrobots 0.1.70__py3-none-any.whl → 0.1.71__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- luckyrobots/__init__.py +8 -1
- luckyrobots/client.py +98 -4
- luckyrobots/grpc/generated/agent_pb2.py +36 -32
- luckyrobots/grpc/generated/agent_pb2_grpc.py +110 -128
- luckyrobots/grpc/generated/camera_pb2.py +20 -18
- luckyrobots/grpc/generated/camera_pb2_grpc.py +62 -73
- luckyrobots/grpc/generated/common_pb2.py +20 -16
- luckyrobots/grpc/generated/common_pb2_grpc.py +7 -10
- luckyrobots/grpc/generated/hazel_rpc_pb2.py +43 -0
- luckyrobots/grpc/generated/hazel_rpc_pb2_grpc.py +24 -0
- luckyrobots/grpc/generated/media_pb2.py +16 -12
- luckyrobots/grpc/generated/media_pb2_grpc.py +7 -10
- luckyrobots/grpc/generated/mujoco_pb2.py +28 -24
- luckyrobots/grpc/generated/mujoco_pb2_grpc.py +110 -128
- luckyrobots/grpc/generated/scene_pb2.py +30 -28
- luckyrobots/grpc/generated/scene_pb2_grpc.py +108 -127
- luckyrobots/grpc/generated/telemetry_pb2.py +24 -20
- luckyrobots/grpc/generated/telemetry_pb2_grpc.py +62 -73
- luckyrobots/grpc/generated/viewport_pb2.py +24 -22
- luckyrobots/grpc/generated/viewport_pb2_grpc.py +62 -73
- luckyrobots/grpc/proto/agent.proto +33 -1
- luckyrobots/grpc/proto/camera.proto +1 -1
- luckyrobots/grpc/proto/common.proto +1 -1
- luckyrobots/grpc/proto/hazel_rpc.proto +1 -1
- luckyrobots/grpc/proto/media.proto +1 -1
- luckyrobots/grpc/proto/mujoco.proto +1 -1
- luckyrobots/grpc/proto/scene.proto +1 -1
- luckyrobots/grpc/proto/telemetry.proto +1 -1
- luckyrobots/grpc/proto/viewport.proto +1 -1
- luckyrobots/luckyrobots.py +11 -2
- luckyrobots/models/__init__.py +2 -0
- luckyrobots/models/randomization.py +77 -0
- {luckyrobots-0.1.70.dist-info → luckyrobots-0.1.71.dist-info}/METADATA +1 -1
- luckyrobots-0.1.71.dist-info/RECORD +47 -0
- luckyrobots-0.1.70.dist-info/RECORD +0 -44
- {luckyrobots-0.1.70.dist-info → luckyrobots-0.1.71.dist-info}/WHEEL +0 -0
- {luckyrobots-0.1.70.dist-info → luckyrobots-0.1.71.dist-info}/licenses/LICENSE +0 -0
luckyrobots/__init__.py
CHANGED
|
@@ -7,7 +7,13 @@ simulation environment via gRPC.
|
|
|
7
7
|
|
|
8
8
|
from .luckyrobots import LuckyRobots
|
|
9
9
|
from .client import LuckyEngineClient, GrpcConnectionError, BenchmarkResult
|
|
10
|
-
from .models import
|
|
10
|
+
from .models import (
|
|
11
|
+
ObservationResponse,
|
|
12
|
+
StateSnapshot,
|
|
13
|
+
CameraData,
|
|
14
|
+
CameraShape,
|
|
15
|
+
DomainRandomizationConfig,
|
|
16
|
+
)
|
|
11
17
|
from .utils import FPS
|
|
12
18
|
from .engine import check_updates
|
|
13
19
|
|
|
@@ -24,6 +30,7 @@ __all__ = [
|
|
|
24
30
|
"StateSnapshot",
|
|
25
31
|
"CameraData",
|
|
26
32
|
"CameraShape",
|
|
33
|
+
"DomainRandomizationConfig",
|
|
27
34
|
# Utilities
|
|
28
35
|
"FPS",
|
|
29
36
|
"check_updates",
|
luckyrobots/client.py
CHANGED
|
@@ -38,7 +38,7 @@ except Exception as e: # pragma: no cover
|
|
|
38
38
|
) from e
|
|
39
39
|
|
|
40
40
|
# Import Pydantic models for type-checked responses
|
|
41
|
-
from .models import ObservationResponse, StateSnapshot
|
|
41
|
+
from .models import ObservationResponse, StateSnapshot, DomainRandomizationConfig
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
class GrpcConnectionError(Exception):
|
|
@@ -150,7 +150,7 @@ class LuckyEngineClient:
|
|
|
150
150
|
self._viewport = viewport_pb2_grpc.ViewportServiceStub(self._channel)
|
|
151
151
|
self._camera = camera_pb2_grpc.CameraServiceStub(self._channel)
|
|
152
152
|
|
|
153
|
-
logger.info(f"
|
|
153
|
+
logger.info(f"Channel opened to {target} (server not verified yet)")
|
|
154
154
|
|
|
155
155
|
def close(self) -> None:
|
|
156
156
|
"""Close the gRPC channel."""
|
|
@@ -221,6 +221,7 @@ class LuckyEngineClient:
|
|
|
221
221
|
pass
|
|
222
222
|
|
|
223
223
|
if self.health_check(timeout=10.0):
|
|
224
|
+
logger.info(f"Connected to LuckyEngine gRPC server at {self.host}:{self.port}")
|
|
224
225
|
return True
|
|
225
226
|
|
|
226
227
|
time.sleep(poll_interval)
|
|
@@ -595,7 +596,12 @@ class LuckyEngineClient:
|
|
|
595
596
|
),
|
|
596
597
|
)
|
|
597
598
|
|
|
598
|
-
def reset_agent(
|
|
599
|
+
def reset_agent(
|
|
600
|
+
self,
|
|
601
|
+
agent_name: str = "",
|
|
602
|
+
randomization_cfg: Optional[Any] = None,
|
|
603
|
+
timeout: Optional[float] = None,
|
|
604
|
+
):
|
|
599
605
|
"""
|
|
600
606
|
Reset a specific agent (full reset: clear buffers, reset state, resample commands, apply MuJoCo state).
|
|
601
607
|
|
|
@@ -604,17 +610,105 @@ class LuckyEngineClient:
|
|
|
604
610
|
Args:
|
|
605
611
|
agent_name: Agent logical name. Convention is `agent_0`, `agent_1`, ...
|
|
606
612
|
Empty string means "default agent" (agent_0).
|
|
613
|
+
randomization_cfg: Optional domain randomization config for this reset.
|
|
607
614
|
timeout: Timeout in seconds (uses default if None).
|
|
608
615
|
|
|
609
616
|
Returns:
|
|
610
617
|
ResetAgentResponse with success and message fields.
|
|
611
618
|
"""
|
|
612
619
|
timeout = timeout or self.timeout
|
|
620
|
+
|
|
621
|
+
# Build request with optional randomization config
|
|
622
|
+
request_kwargs = {"agent_name": agent_name}
|
|
623
|
+
|
|
624
|
+
if randomization_cfg is not None:
|
|
625
|
+
randomization_proto = self._randomization_to_proto(randomization_cfg)
|
|
626
|
+
request_kwargs["dr_config"] = randomization_proto
|
|
627
|
+
|
|
613
628
|
return self.agent.ResetAgent(
|
|
614
|
-
self.pb.agent.ResetAgentRequest(
|
|
629
|
+
self.pb.agent.ResetAgentRequest(**request_kwargs),
|
|
615
630
|
timeout=timeout,
|
|
616
631
|
)
|
|
617
632
|
|
|
633
|
+
def _randomization_to_proto(self, randomization_cfg: Any):
|
|
634
|
+
"""Convert domain randomization config to proto message.
|
|
635
|
+
|
|
636
|
+
Accepts any object with randomization config fields (DomainRandomizationConfig,
|
|
637
|
+
PhysicsDRCfg from luckylab, or similar).
|
|
638
|
+
"""
|
|
639
|
+
proto_kwargs = {}
|
|
640
|
+
|
|
641
|
+
# Helper to get attribute value, checking for None
|
|
642
|
+
def get_val(name: str, default=None):
|
|
643
|
+
val = getattr(randomization_cfg, name, default)
|
|
644
|
+
# Handle both None and empty tuples/lists
|
|
645
|
+
if val is None or (isinstance(val, (tuple, list)) and len(val) == 0):
|
|
646
|
+
return None
|
|
647
|
+
return val
|
|
648
|
+
|
|
649
|
+
# Initial state randomization
|
|
650
|
+
pose_pos = get_val("pose_position_noise")
|
|
651
|
+
if pose_pos is not None:
|
|
652
|
+
proto_kwargs["pose_position_noise"] = list(pose_pos)
|
|
653
|
+
|
|
654
|
+
pose_ori = get_val("pose_orientation_noise")
|
|
655
|
+
if pose_ori is not None and pose_ori != 0.0:
|
|
656
|
+
proto_kwargs["pose_orientation_noise"] = pose_ori
|
|
657
|
+
|
|
658
|
+
joint_pos = get_val("joint_position_noise")
|
|
659
|
+
if joint_pos is not None and joint_pos != 0.0:
|
|
660
|
+
proto_kwargs["joint_position_noise"] = joint_pos
|
|
661
|
+
|
|
662
|
+
joint_vel = get_val("joint_velocity_noise")
|
|
663
|
+
if joint_vel is not None and joint_vel != 0.0:
|
|
664
|
+
proto_kwargs["joint_velocity_noise"] = joint_vel
|
|
665
|
+
|
|
666
|
+
# Physics parameters (ranges)
|
|
667
|
+
friction = get_val("friction_range")
|
|
668
|
+
if friction is not None:
|
|
669
|
+
proto_kwargs["friction_range"] = list(friction)
|
|
670
|
+
|
|
671
|
+
restitution = get_val("restitution_range")
|
|
672
|
+
if restitution is not None:
|
|
673
|
+
proto_kwargs["restitution_range"] = list(restitution)
|
|
674
|
+
|
|
675
|
+
mass_scale = get_val("mass_scale_range")
|
|
676
|
+
if mass_scale is not None:
|
|
677
|
+
proto_kwargs["mass_scale_range"] = list(mass_scale)
|
|
678
|
+
|
|
679
|
+
com_offset = get_val("com_offset_range")
|
|
680
|
+
if com_offset is not None:
|
|
681
|
+
proto_kwargs["com_offset_range"] = list(com_offset)
|
|
682
|
+
|
|
683
|
+
# Motor/actuator
|
|
684
|
+
motor_strength = get_val("motor_strength_range")
|
|
685
|
+
if motor_strength is not None:
|
|
686
|
+
proto_kwargs["motor_strength_range"] = list(motor_strength)
|
|
687
|
+
|
|
688
|
+
motor_offset = get_val("motor_offset_range")
|
|
689
|
+
if motor_offset is not None:
|
|
690
|
+
proto_kwargs["motor_offset_range"] = list(motor_offset)
|
|
691
|
+
|
|
692
|
+
# External disturbances
|
|
693
|
+
push_interval = get_val("push_interval_range")
|
|
694
|
+
if push_interval is not None:
|
|
695
|
+
proto_kwargs["push_interval_range"] = list(push_interval)
|
|
696
|
+
|
|
697
|
+
push_velocity = get_val("push_velocity_range")
|
|
698
|
+
if push_velocity is not None:
|
|
699
|
+
proto_kwargs["push_velocity_range"] = list(push_velocity)
|
|
700
|
+
|
|
701
|
+
# Terrain
|
|
702
|
+
terrain_type = get_val("terrain_type")
|
|
703
|
+
if terrain_type is not None and terrain_type != "":
|
|
704
|
+
proto_kwargs["terrain_type"] = terrain_type
|
|
705
|
+
|
|
706
|
+
terrain_diff = get_val("terrain_difficulty")
|
|
707
|
+
if terrain_diff is not None and terrain_diff != 0.0:
|
|
708
|
+
proto_kwargs["terrain_difficulty"] = terrain_diff
|
|
709
|
+
|
|
710
|
+
return self.pb.agent.DomainRandomizationConfig(**proto_kwargs)
|
|
711
|
+
|
|
618
712
|
def stream_telemetry(self, target_fps: int = 30):
|
|
619
713
|
"""
|
|
620
714
|
Start streaming telemetry data. [PLACEHOLDER - not confirmed working]
|
|
@@ -9,9 +9,13 @@ from google.protobuf import descriptor_pool as _descriptor_pool
|
|
|
9
9
|
from google.protobuf import runtime_version as _runtime_version
|
|
10
10
|
from google.protobuf import symbol_database as _symbol_database
|
|
11
11
|
from google.protobuf.internal import builder as _builder
|
|
12
|
-
|
|
13
12
|
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
14
|
-
_runtime_version.Domain.PUBLIC,
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'agent.proto'
|
|
15
19
|
)
|
|
16
20
|
# @@protoc_insertion_point(imports)
|
|
17
21
|
|
|
@@ -24,38 +28,38 @@ from . import mujoco_pb2 as mujoco__pb2
|
|
|
24
28
|
from . import telemetry_pb2 as telemetry__pb2
|
|
25
29
|
|
|
26
30
|
|
|
27
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
|
|
28
|
-
b'\n\x0b\x61gent.proto\x12\x0chazel.rpc.v1\x1a\x0c\x63ommon.proto\x1a\x0bmedia.proto\x1a\x0cmujoco.proto\x1a\x0ftelemetry.proto"\x81\x01\n\x0b\x41gentSchema\x12\x12\n\nagent_name\x18\x01 \x01(\t\x12\x19\n\x11observation_names\x18\x02 \x03(\t\x12\x14\n\x0c\x61\x63tion_names\x18\x03 \x03(\t\x12\x18\n\x10observation_size\x18\x04 \x01(\r\x12\x13\n\x0b\x61\x63tion_size\x18\x05 \x01(\r"+\n\x15GetAgentSchemaRequest\x12\x12\n\nagent_name\x18\x01 \x01(\t"C\n\x16GetAgentSchemaResponse\x12)\n\x06schema\x18\x01 \x01(\x0b\x32\x19.hazel.rpc.v1.AgentSchema"<\n\x12StreamAgentRequest\x12\x12\n\nagent_name\x18\x01 \x01(\t\x12\x12\n\ntarget_fps\x18\x02 \x01(\r"\'\n\x11ResetAgentRequest\x12\x12\n\nagent_name\x18\x01 \x01(\t"6\n\x12ResetAgentResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t"\x87\x01\n\nAgentFrame\x12\x14\n\x0ctimestamp_ms\x18\x01 \x01(\x04\x12\x14\n\x0c\x66rame_number\x18\x02 \x01(\r\x12\x14\n\x0cobservations\x18\x03 \x03(\x02\x12\x0f\n\x07\x61\x63tions\x18\x04 \x03(\x02\x12\x12\n\nagent_name\x18\x05 \x01(\t\x12\x12\n\ntarget_fps\x18\x06 \x01(\r"\x8a\x01\n\x15GetCameraFrameRequest\x12$\n\x02id\x18\x01 \x01(\x0b\x32\x16.hazel.rpc.v1.EntityIdH\x00\x12\x0e\n\x04name\x18\x02 \x01(\tH\x00\x12\r\n\x05width\x18\x03 \x01(\r\x12\x0e\n\x06height\x18\x04 \x01(\r\x12\x0e\n\x06\x66ormat\x18\x05 \x01(\tB\x0c\n\nidentifier"_\n\x17GetViewportFrameRequest\x12\x15\n\rviewport_name\x18\x01 \x01(\t\x12\r\n\x05width\x18\x02 \x01(\r\x12\x0e\n\x06height\x18\x03 \x01(\r\x12\x0e\n\x06\x66ormat\x18\x04 \x01(\t"\x84\x02\n\x15GetObservationRequest\x12\x12\n\nrobot_name\x18\x01 \x01(\t\x12\x12\n\nagent_name\x18\x02 \x01(\t\x12\x1b\n\x13include_joint_state\x18\x03 \x01(\x08\x12\x1b\n\x13include_agent_frame\x18\x04 \x01(\x08\x12\x19\n\x11include_telemetry\x18\x05 \x01(\x08\x12\x34\n\x07\x63\x61meras\x18\x06 \x03(\x0b\x32#.hazel.rpc.v1.GetCameraFrameRequest\x12\x38\n\tviewports\x18\x07 \x03(\x0b\x32%.hazel.rpc.v1.GetViewportFrameRequest"\xe3\x02\n\x16GetObservationResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x14\n\x0ctimestamp_ms\x18\x03 \x01(\x04\x12\x14\n\x0c\x66rame_number\x18\x04 \x01(\r\x12-\n\x0bjoint_state\x18\x05 \x01(\x0b\x32\x18.hazel.rpc.v1.JointState\x12-\n\x0b\x61gent_frame\x18\x06 \x01(\x0b\x32\x18.hazel.rpc.v1.AgentFrame\x12/\n\ttelemetry\x18\x07 \x01(\x0b\x32\x1c.hazel.rpc.v1.TelemetryFrame\x12\x34\n\rcamera_frames\x18\x08 \x03(\x0b\x32\x1d.hazel.rpc.v1.NamedImageFrame\x12\x36\n\x0fviewport_frames\x18\t \x03(\x0b\x32\x1d.hazel.rpc.v1.NamedImageFrame2\xe6\x02\n\x0c\x41gentService\x12[\n\x0eGetAgentSchema\x12#.hazel.rpc.v1.GetAgentSchemaRequest\x1a$.hazel.rpc.v1.GetAgentSchemaResponse\x12[\n\x0eGetObservation\x12#.hazel.rpc.v1.GetObservationRequest\x1a$.hazel.rpc.v1.GetObservationResponse\x12K\n\x0bStreamAgent\x12 .hazel.rpc.v1.StreamAgentRequest\x1a\x18.hazel.rpc.v1.AgentFrame0\x01\x12O\n\nResetAgent\x12\x1f.hazel.rpc.v1.ResetAgentRequest\x1a .hazel.rpc.v1.ResetAgentResponseB\x03\xf8\x01\x01\x62\x06proto3'
|
|
29
|
-
)
|
|
31
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0b\x61gent.proto\x12\thazel.rpc\x1a\x0c\x63ommon.proto\x1a\x0bmedia.proto\x1a\x0cmujoco.proto\x1a\x0ftelemetry.proto\"\x81\x01\n\x0b\x41gentSchema\x12\x12\n\nagent_name\x18\x01 \x01(\t\x12\x19\n\x11observation_names\x18\x02 \x03(\t\x12\x14\n\x0c\x61\x63tion_names\x18\x03 \x03(\t\x12\x18\n\x10observation_size\x18\x04 \x01(\r\x12\x13\n\x0b\x61\x63tion_size\x18\x05 \x01(\r\"+\n\x15GetAgentSchemaRequest\x12\x12\n\nagent_name\x18\x01 \x01(\t\"@\n\x16GetAgentSchemaResponse\x12&\n\x06schema\x18\x01 \x01(\x0b\x32\x16.hazel.rpc.AgentSchema\"<\n\x12StreamAgentRequest\x12\x12\n\nagent_name\x18\x01 \x01(\t\x12\x12\n\ntarget_fps\x18\x02 \x01(\r\"\xa1\x03\n\x19\x44omainRandomizationConfig\x12\x1b\n\x13pose_position_noise\x18\x01 \x03(\x02\x12\x1e\n\x16pose_orientation_noise\x18\x02 \x01(\x02\x12\x1c\n\x14joint_position_noise\x18\x03 \x01(\x02\x12\x1c\n\x14joint_velocity_noise\x18\x04 \x01(\x02\x12\x16\n\x0e\x66riction_range\x18\x05 \x03(\x02\x12\x19\n\x11restitution_range\x18\x06 \x03(\x02\x12\x18\n\x10mass_scale_range\x18\x07 \x03(\x02\x12\x18\n\x10\x63om_offset_range\x18\x08 \x03(\x02\x12\x1c\n\x14motor_strength_range\x18\t \x03(\x02\x12\x1a\n\x12motor_offset_range\x18\n \x03(\x02\x12\x1b\n\x13push_interval_range\x18\x0b \x03(\x02\x12\x1b\n\x13push_velocity_range\x18\x0c \x03(\x02\x12\x14\n\x0cterrain_type\x18\r \x01(\t\x12\x1a\n\x12terrain_difficulty\x18\x0e \x01(\x02\"`\n\x11ResetAgentRequest\x12\x12\n\nagent_name\x18\x01 \x01(\t\x12\x37\n\tdr_config\x18\x02 \x01(\x0b\x32$.hazel.rpc.DomainRandomizationConfig\"6\n\x12ResetAgentResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t\"\x87\x01\n\nAgentFrame\x12\x14\n\x0ctimestamp_ms\x18\x01 \x01(\x04\x12\x14\n\x0c\x66rame_number\x18\x02 \x01(\r\x12\x14\n\x0cobservations\x18\x03 \x03(\x02\x12\x0f\n\x07\x61\x63tions\x18\x04 \x03(\x02\x12\x12\n\nagent_name\x18\x05 \x01(\t\x12\x12\n\ntarget_fps\x18\x06 \x01(\r\"\x87\x01\n\x15GetCameraFrameRequest\x12!\n\x02id\x18\x01 \x01(\x0b\x32\x13.hazel.rpc.EntityIdH\x00\x12\x0e\n\x04name\x18\x02 \x01(\tH\x00\x12\r\n\x05width\x18\x03 \x01(\r\x12\x0e\n\x06height\x18\x04 \x01(\r\x12\x0e\n\x06\x66ormat\x18\x05 \x01(\tB\x0c\n\nidentifier\"_\n\x17GetViewportFrameRequest\x12\x15\n\rviewport_name\x18\x01 \x01(\t\x12\r\n\x05width\x18\x02 \x01(\r\x12\x0e\n\x06height\x18\x03 \x01(\r\x12\x0e\n\x06\x66ormat\x18\x04 \x01(\t\"\xfe\x01\n\x15GetObservationRequest\x12\x12\n\nrobot_name\x18\x01 \x01(\t\x12\x12\n\nagent_name\x18\x02 \x01(\t\x12\x1b\n\x13include_joint_state\x18\x03 \x01(\x08\x12\x1b\n\x13include_agent_frame\x18\x04 \x01(\x08\x12\x19\n\x11include_telemetry\x18\x05 \x01(\x08\x12\x31\n\x07\x63\x61meras\x18\x06 \x03(\x0b\x32 .hazel.rpc.GetCameraFrameRequest\x12\x35\n\tviewports\x18\x07 \x03(\x0b\x32\".hazel.rpc.GetViewportFrameRequest\"\xd4\x02\n\x16GetObservationResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x14\n\x0ctimestamp_ms\x18\x03 \x01(\x04\x12\x14\n\x0c\x66rame_number\x18\x04 \x01(\r\x12*\n\x0bjoint_state\x18\x05 \x01(\x0b\x32\x15.hazel.rpc.JointState\x12*\n\x0b\x61gent_frame\x18\x06 \x01(\x0b\x32\x15.hazel.rpc.AgentFrame\x12,\n\ttelemetry\x18\x07 \x01(\x0b\x32\x19.hazel.rpc.TelemetryFrame\x12\x31\n\rcamera_frames\x18\x08 \x03(\x0b\x32\x1a.hazel.rpc.NamedImageFrame\x12\x33\n\x0fviewport_frames\x18\t \x03(\x0b\x32\x1a.hazel.rpc.NamedImageFrame2\xce\x02\n\x0c\x41gentService\x12U\n\x0eGetAgentSchema\x12 .hazel.rpc.GetAgentSchemaRequest\x1a!.hazel.rpc.GetAgentSchemaResponse\x12U\n\x0eGetObservation\x12 .hazel.rpc.GetObservationRequest\x1a!.hazel.rpc.GetObservationResponse\x12\x45\n\x0bStreamAgent\x12\x1d.hazel.rpc.StreamAgentRequest\x1a\x15.hazel.rpc.AgentFrame0\x01\x12I\n\nResetAgent\x12\x1c.hazel.rpc.ResetAgentRequest\x1a\x1d.hazel.rpc.ResetAgentResponseB\x03\xf8\x01\x01\x62\x06proto3')
|
|
30
32
|
|
|
31
33
|
_globals = globals()
|
|
32
34
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
33
|
-
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR,
|
|
35
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'agent_pb2', _globals)
|
|
34
36
|
if not _descriptor._USE_C_DESCRIPTORS:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
37
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
38
|
+
_globals['DESCRIPTOR']._serialized_options = b'\370\001\001'
|
|
39
|
+
_globals['_AGENTSCHEMA']._serialized_start=85
|
|
40
|
+
_globals['_AGENTSCHEMA']._serialized_end=214
|
|
41
|
+
_globals['_GETAGENTSCHEMAREQUEST']._serialized_start=216
|
|
42
|
+
_globals['_GETAGENTSCHEMAREQUEST']._serialized_end=259
|
|
43
|
+
_globals['_GETAGENTSCHEMARESPONSE']._serialized_start=261
|
|
44
|
+
_globals['_GETAGENTSCHEMARESPONSE']._serialized_end=325
|
|
45
|
+
_globals['_STREAMAGENTREQUEST']._serialized_start=327
|
|
46
|
+
_globals['_STREAMAGENTREQUEST']._serialized_end=387
|
|
47
|
+
_globals['_DOMAINRANDOMIZATIONCONFIG']._serialized_start=390
|
|
48
|
+
_globals['_DOMAINRANDOMIZATIONCONFIG']._serialized_end=807
|
|
49
|
+
_globals['_RESETAGENTREQUEST']._serialized_start=809
|
|
50
|
+
_globals['_RESETAGENTREQUEST']._serialized_end=905
|
|
51
|
+
_globals['_RESETAGENTRESPONSE']._serialized_start=907
|
|
52
|
+
_globals['_RESETAGENTRESPONSE']._serialized_end=961
|
|
53
|
+
_globals['_AGENTFRAME']._serialized_start=964
|
|
54
|
+
_globals['_AGENTFRAME']._serialized_end=1099
|
|
55
|
+
_globals['_GETCAMERAFRAMEREQUEST']._serialized_start=1102
|
|
56
|
+
_globals['_GETCAMERAFRAMEREQUEST']._serialized_end=1237
|
|
57
|
+
_globals['_GETVIEWPORTFRAMEREQUEST']._serialized_start=1239
|
|
58
|
+
_globals['_GETVIEWPORTFRAMEREQUEST']._serialized_end=1334
|
|
59
|
+
_globals['_GETOBSERVATIONREQUEST']._serialized_start=1337
|
|
60
|
+
_globals['_GETOBSERVATIONREQUEST']._serialized_end=1591
|
|
61
|
+
_globals['_GETOBSERVATIONRESPONSE']._serialized_start=1594
|
|
62
|
+
_globals['_GETOBSERVATIONRESPONSE']._serialized_end=1934
|
|
63
|
+
_globals['_AGENTSERVICE']._serialized_start=1937
|
|
64
|
+
_globals['_AGENTSERVICE']._serialized_end=2271
|
|
61
65
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -5,31 +5,29 @@ import warnings
|
|
|
5
5
|
|
|
6
6
|
from . import agent_pb2 as agent__pb2
|
|
7
7
|
|
|
8
|
-
GRPC_GENERATED_VERSION =
|
|
8
|
+
GRPC_GENERATED_VERSION = '1.76.0'
|
|
9
9
|
GRPC_VERSION = grpc.__version__
|
|
10
10
|
_version_not_supported = False
|
|
11
11
|
|
|
12
12
|
try:
|
|
13
13
|
from grpc._utilities import first_version_is_lower
|
|
14
|
-
|
|
15
|
-
_version_not_supported = first_version_is_lower(
|
|
16
|
-
GRPC_VERSION, GRPC_GENERATED_VERSION
|
|
17
|
-
)
|
|
14
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
18
15
|
except ImportError:
|
|
19
16
|
_version_not_supported = True
|
|
20
17
|
|
|
21
18
|
if _version_not_supported:
|
|
22
19
|
raise RuntimeError(
|
|
23
|
-
f
|
|
24
|
-
+
|
|
25
|
-
+ f
|
|
26
|
-
+ f
|
|
27
|
-
+ f
|
|
20
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
21
|
+
+ ' but the generated code in agent_pb2_grpc.py depends on'
|
|
22
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
23
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
24
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
28
25
|
)
|
|
29
26
|
|
|
30
27
|
|
|
31
28
|
class AgentServiceStub(object):
|
|
32
|
-
"""Per-agent RL-style observation streaming (training / inference clients consume this).
|
|
29
|
+
"""Per-agent RL-style observation streaming (training / inference clients consume this).
|
|
30
|
+
"""
|
|
33
31
|
|
|
34
32
|
def __init__(self, channel):
|
|
35
33
|
"""Constructor.
|
|
@@ -38,45 +36,43 @@ class AgentServiceStub(object):
|
|
|
38
36
|
channel: A grpc.Channel.
|
|
39
37
|
"""
|
|
40
38
|
self.GetAgentSchema = channel.unary_unary(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
)
|
|
39
|
+
'/hazel.rpc.AgentService/GetAgentSchema',
|
|
40
|
+
request_serializer=agent__pb2.GetAgentSchemaRequest.SerializeToString,
|
|
41
|
+
response_deserializer=agent__pb2.GetAgentSchemaResponse.FromString,
|
|
42
|
+
_registered_method=True)
|
|
46
43
|
self.GetObservation = channel.unary_unary(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
)
|
|
44
|
+
'/hazel.rpc.AgentService/GetObservation',
|
|
45
|
+
request_serializer=agent__pb2.GetObservationRequest.SerializeToString,
|
|
46
|
+
response_deserializer=agent__pb2.GetObservationResponse.FromString,
|
|
47
|
+
_registered_method=True)
|
|
52
48
|
self.StreamAgent = channel.unary_stream(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
)
|
|
49
|
+
'/hazel.rpc.AgentService/StreamAgent',
|
|
50
|
+
request_serializer=agent__pb2.StreamAgentRequest.SerializeToString,
|
|
51
|
+
response_deserializer=agent__pb2.AgentFrame.FromString,
|
|
52
|
+
_registered_method=True)
|
|
58
53
|
self.ResetAgent = channel.unary_unary(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
)
|
|
54
|
+
'/hazel.rpc.AgentService/ResetAgent',
|
|
55
|
+
request_serializer=agent__pb2.ResetAgentRequest.SerializeToString,
|
|
56
|
+
response_deserializer=agent__pb2.ResetAgentResponse.FromString,
|
|
57
|
+
_registered_method=True)
|
|
64
58
|
|
|
65
59
|
|
|
66
60
|
class AgentServiceServicer(object):
|
|
67
|
-
"""Per-agent RL-style observation streaming (training / inference clients consume this).
|
|
61
|
+
"""Per-agent RL-style observation streaming (training / inference clients consume this).
|
|
62
|
+
"""
|
|
68
63
|
|
|
69
64
|
def GetAgentSchema(self, request, context):
|
|
70
65
|
"""Missing associated documentation comment in .proto file."""
|
|
71
66
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
72
|
-
context.set_details(
|
|
73
|
-
raise NotImplementedError(
|
|
67
|
+
context.set_details('Method not implemented!')
|
|
68
|
+
raise NotImplementedError('Method not implemented!')
|
|
74
69
|
|
|
75
70
|
def GetObservation(self, request, context):
|
|
76
|
-
"""Single-shot observation snapshot (unified observation surface).
|
|
71
|
+
"""Single-shot observation snapshot (unified observation surface).
|
|
72
|
+
"""
|
|
77
73
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
78
|
-
context.set_details(
|
|
79
|
-
raise NotImplementedError(
|
|
74
|
+
context.set_details('Method not implemented!')
|
|
75
|
+
raise NotImplementedError('Method not implemented!')
|
|
80
76
|
|
|
81
77
|
def StreamAgent(self, request, context):
|
|
82
78
|
"""Server-streaming observations (and optional action echo) for a single agent.
|
|
@@ -86,71 +82,67 @@ class AgentServiceServicer(object):
|
|
|
86
82
|
(SendControl); AgentFrame.actions is primarily used for telemetry.
|
|
87
83
|
"""
|
|
88
84
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
89
|
-
context.set_details(
|
|
90
|
-
raise NotImplementedError(
|
|
85
|
+
context.set_details('Method not implemented!')
|
|
86
|
+
raise NotImplementedError('Method not implemented!')
|
|
91
87
|
|
|
92
88
|
def ResetAgent(self, request, context):
|
|
93
89
|
"""Reset a specific agent (full reset: clear buffers, reset state, resample commands, apply MuJoCo state).
|
|
94
90
|
Useful for multi-env RL where individual agents need to be reset without resetting the entire scene.
|
|
95
91
|
"""
|
|
96
92
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
97
|
-
context.set_details(
|
|
98
|
-
raise NotImplementedError(
|
|
93
|
+
context.set_details('Method not implemented!')
|
|
94
|
+
raise NotImplementedError('Method not implemented!')
|
|
99
95
|
|
|
100
96
|
|
|
101
97
|
def add_AgentServiceServicer_to_server(servicer, server):
|
|
102
98
|
rpc_method_handlers = {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
99
|
+
'GetAgentSchema': grpc.unary_unary_rpc_method_handler(
|
|
100
|
+
servicer.GetAgentSchema,
|
|
101
|
+
request_deserializer=agent__pb2.GetAgentSchemaRequest.FromString,
|
|
102
|
+
response_serializer=agent__pb2.GetAgentSchemaResponse.SerializeToString,
|
|
103
|
+
),
|
|
104
|
+
'GetObservation': grpc.unary_unary_rpc_method_handler(
|
|
105
|
+
servicer.GetObservation,
|
|
106
|
+
request_deserializer=agent__pb2.GetObservationRequest.FromString,
|
|
107
|
+
response_serializer=agent__pb2.GetObservationResponse.SerializeToString,
|
|
108
|
+
),
|
|
109
|
+
'StreamAgent': grpc.unary_stream_rpc_method_handler(
|
|
110
|
+
servicer.StreamAgent,
|
|
111
|
+
request_deserializer=agent__pb2.StreamAgentRequest.FromString,
|
|
112
|
+
response_serializer=agent__pb2.AgentFrame.SerializeToString,
|
|
113
|
+
),
|
|
114
|
+
'ResetAgent': grpc.unary_unary_rpc_method_handler(
|
|
115
|
+
servicer.ResetAgent,
|
|
116
|
+
request_deserializer=agent__pb2.ResetAgentRequest.FromString,
|
|
117
|
+
response_serializer=agent__pb2.ResetAgentResponse.SerializeToString,
|
|
118
|
+
),
|
|
123
119
|
}
|
|
124
120
|
generic_handler = grpc.method_handlers_generic_handler(
|
|
125
|
-
|
|
126
|
-
)
|
|
121
|
+
'hazel.rpc.AgentService', rpc_method_handlers)
|
|
127
122
|
server.add_generic_rpc_handlers((generic_handler,))
|
|
128
|
-
server.add_registered_method_handlers(
|
|
129
|
-
"hazel.rpc.v1.AgentService", rpc_method_handlers
|
|
130
|
-
)
|
|
123
|
+
server.add_registered_method_handlers('hazel.rpc.AgentService', rpc_method_handlers)
|
|
131
124
|
|
|
132
125
|
|
|
133
|
-
# This class is part of an EXPERIMENTAL API.
|
|
126
|
+
# This class is part of an EXPERIMENTAL API.
|
|
134
127
|
class AgentService(object):
|
|
135
|
-
"""Per-agent RL-style observation streaming (training / inference clients consume this).
|
|
128
|
+
"""Per-agent RL-style observation streaming (training / inference clients consume this).
|
|
129
|
+
"""
|
|
136
130
|
|
|
137
131
|
@staticmethod
|
|
138
|
-
def GetAgentSchema(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
metadata=None,
|
|
149
|
-
):
|
|
132
|
+
def GetAgentSchema(request,
|
|
133
|
+
target,
|
|
134
|
+
options=(),
|
|
135
|
+
channel_credentials=None,
|
|
136
|
+
call_credentials=None,
|
|
137
|
+
insecure=False,
|
|
138
|
+
compression=None,
|
|
139
|
+
wait_for_ready=None,
|
|
140
|
+
timeout=None,
|
|
141
|
+
metadata=None):
|
|
150
142
|
return grpc.experimental.unary_unary(
|
|
151
143
|
request,
|
|
152
144
|
target,
|
|
153
|
-
|
|
145
|
+
'/hazel.rpc.AgentService/GetAgentSchema',
|
|
154
146
|
agent__pb2.GetAgentSchemaRequest.SerializeToString,
|
|
155
147
|
agent__pb2.GetAgentSchemaResponse.FromString,
|
|
156
148
|
options,
|
|
@@ -161,26 +153,23 @@ class AgentService(object):
|
|
|
161
153
|
wait_for_ready,
|
|
162
154
|
timeout,
|
|
163
155
|
metadata,
|
|
164
|
-
_registered_method=True
|
|
165
|
-
)
|
|
156
|
+
_registered_method=True)
|
|
166
157
|
|
|
167
158
|
@staticmethod
|
|
168
|
-
def GetObservation(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
metadata=None,
|
|
179
|
-
):
|
|
159
|
+
def GetObservation(request,
|
|
160
|
+
target,
|
|
161
|
+
options=(),
|
|
162
|
+
channel_credentials=None,
|
|
163
|
+
call_credentials=None,
|
|
164
|
+
insecure=False,
|
|
165
|
+
compression=None,
|
|
166
|
+
wait_for_ready=None,
|
|
167
|
+
timeout=None,
|
|
168
|
+
metadata=None):
|
|
180
169
|
return grpc.experimental.unary_unary(
|
|
181
170
|
request,
|
|
182
171
|
target,
|
|
183
|
-
|
|
172
|
+
'/hazel.rpc.AgentService/GetObservation',
|
|
184
173
|
agent__pb2.GetObservationRequest.SerializeToString,
|
|
185
174
|
agent__pb2.GetObservationResponse.FromString,
|
|
186
175
|
options,
|
|
@@ -191,26 +180,23 @@ class AgentService(object):
|
|
|
191
180
|
wait_for_ready,
|
|
192
181
|
timeout,
|
|
193
182
|
metadata,
|
|
194
|
-
_registered_method=True
|
|
195
|
-
)
|
|
183
|
+
_registered_method=True)
|
|
196
184
|
|
|
197
185
|
@staticmethod
|
|
198
|
-
def StreamAgent(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
metadata=None,
|
|
209
|
-
):
|
|
186
|
+
def StreamAgent(request,
|
|
187
|
+
target,
|
|
188
|
+
options=(),
|
|
189
|
+
channel_credentials=None,
|
|
190
|
+
call_credentials=None,
|
|
191
|
+
insecure=False,
|
|
192
|
+
compression=None,
|
|
193
|
+
wait_for_ready=None,
|
|
194
|
+
timeout=None,
|
|
195
|
+
metadata=None):
|
|
210
196
|
return grpc.experimental.unary_stream(
|
|
211
197
|
request,
|
|
212
198
|
target,
|
|
213
|
-
|
|
199
|
+
'/hazel.rpc.AgentService/StreamAgent',
|
|
214
200
|
agent__pb2.StreamAgentRequest.SerializeToString,
|
|
215
201
|
agent__pb2.AgentFrame.FromString,
|
|
216
202
|
options,
|
|
@@ -221,26 +207,23 @@ class AgentService(object):
|
|
|
221
207
|
wait_for_ready,
|
|
222
208
|
timeout,
|
|
223
209
|
metadata,
|
|
224
|
-
_registered_method=True
|
|
225
|
-
)
|
|
210
|
+
_registered_method=True)
|
|
226
211
|
|
|
227
212
|
@staticmethod
|
|
228
|
-
def ResetAgent(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
metadata=None,
|
|
239
|
-
):
|
|
213
|
+
def ResetAgent(request,
|
|
214
|
+
target,
|
|
215
|
+
options=(),
|
|
216
|
+
channel_credentials=None,
|
|
217
|
+
call_credentials=None,
|
|
218
|
+
insecure=False,
|
|
219
|
+
compression=None,
|
|
220
|
+
wait_for_ready=None,
|
|
221
|
+
timeout=None,
|
|
222
|
+
metadata=None):
|
|
240
223
|
return grpc.experimental.unary_unary(
|
|
241
224
|
request,
|
|
242
225
|
target,
|
|
243
|
-
|
|
226
|
+
'/hazel.rpc.AgentService/ResetAgent',
|
|
244
227
|
agent__pb2.ResetAgentRequest.SerializeToString,
|
|
245
228
|
agent__pb2.ResetAgentResponse.FromString,
|
|
246
229
|
options,
|
|
@@ -251,5 +234,4 @@ class AgentService(object):
|
|
|
251
234
|
wait_for_ready,
|
|
252
235
|
timeout,
|
|
253
236
|
metadata,
|
|
254
|
-
_registered_method=True
|
|
255
|
-
)
|
|
237
|
+
_registered_method=True)
|