luckyrobots 0.1.66__py3-none-any.whl → 0.1.72__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 +30 -12
- luckyrobots/client.py +997 -0
- luckyrobots/config/robots.yaml +231 -71
- luckyrobots/engine/__init__.py +23 -0
- luckyrobots/{utils → engine}/check_updates.py +108 -48
- luckyrobots/{utils → engine}/download.py +61 -39
- luckyrobots/engine/manager.py +427 -0
- luckyrobots/grpc/__init__.py +6 -0
- luckyrobots/grpc/generated/__init__.py +18 -0
- luckyrobots/grpc/generated/agent_pb2.py +69 -0
- luckyrobots/grpc/generated/agent_pb2_grpc.py +283 -0
- luckyrobots/grpc/generated/camera_pb2.py +47 -0
- luckyrobots/grpc/generated/camera_pb2_grpc.py +144 -0
- luckyrobots/grpc/generated/common_pb2.py +43 -0
- luckyrobots/grpc/generated/common_pb2_grpc.py +24 -0
- 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 +39 -0
- luckyrobots/grpc/generated/media_pb2_grpc.py +24 -0
- luckyrobots/grpc/generated/mujoco_pb2.py +51 -0
- luckyrobots/grpc/generated/mujoco_pb2_grpc.py +230 -0
- luckyrobots/grpc/generated/scene_pb2.py +66 -0
- luckyrobots/grpc/generated/scene_pb2_grpc.py +317 -0
- luckyrobots/grpc/generated/telemetry_pb2.py +47 -0
- luckyrobots/grpc/generated/telemetry_pb2_grpc.py +143 -0
- luckyrobots/grpc/generated/viewport_pb2.py +50 -0
- luckyrobots/grpc/generated/viewport_pb2_grpc.py +144 -0
- luckyrobots/grpc/proto/agent.proto +213 -0
- luckyrobots/grpc/proto/camera.proto +41 -0
- luckyrobots/grpc/proto/common.proto +36 -0
- luckyrobots/grpc/proto/hazel_rpc.proto +32 -0
- luckyrobots/grpc/proto/media.proto +26 -0
- luckyrobots/grpc/proto/mujoco.proto +64 -0
- luckyrobots/grpc/proto/scene.proto +104 -0
- luckyrobots/grpc/proto/telemetry.proto +43 -0
- luckyrobots/grpc/proto/viewport.proto +45 -0
- luckyrobots/luckyrobots.py +252 -0
- luckyrobots/models/__init__.py +15 -0
- luckyrobots/models/camera.py +97 -0
- luckyrobots/models/observation.py +135 -0
- luckyrobots/models/randomization.py +77 -0
- luckyrobots/{utils/helpers.py → utils.py} +75 -40
- luckyrobots-0.1.72.dist-info/METADATA +262 -0
- luckyrobots-0.1.72.dist-info/RECORD +47 -0
- {luckyrobots-0.1.66.dist-info → luckyrobots-0.1.72.dist-info}/WHEEL +1 -1
- luckyrobots/core/luckyrobots.py +0 -624
- luckyrobots/core/manager.py +0 -236
- luckyrobots/core/models.py +0 -68
- luckyrobots/core/node.py +0 -273
- luckyrobots/message/__init__.py +0 -18
- luckyrobots/message/pubsub.py +0 -145
- luckyrobots/message/srv/client.py +0 -81
- luckyrobots/message/srv/service.py +0 -135
- luckyrobots/message/srv/types.py +0 -83
- luckyrobots/message/transporter.py +0 -427
- luckyrobots/utils/event_loop.py +0 -94
- luckyrobots/utils/sim_manager.py +0 -406
- luckyrobots-0.1.66.dist-info/METADATA +0 -253
- luckyrobots-0.1.66.dist-info/RECORD +0 -24
- {luckyrobots-0.1.66.dist-info → luckyrobots-0.1.72.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
+
# source: telemetry.proto
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
6
|
+
"""Generated protocol buffer code."""
|
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
+
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'telemetry.proto'
|
|
19
|
+
)
|
|
20
|
+
# @@protoc_insertion_point(imports)
|
|
21
|
+
|
|
22
|
+
_sym_db = _symbol_database.Default()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0ftelemetry.proto\x12\thazel.rpc\"Z\n\x0fTelemetrySchema\x12\x19\n\x11observation_names\x18\x01 \x03(\t\x12\x14\n\x0c\x61\x63tion_names\x18\x02 \x03(\t\x12\n\n\x02nq\x18\x03 \x01(\r\x12\n\n\x02nu\x18\x04 \x01(\r\"\x1b\n\x19GetTelemetrySchemaRequest\"H\n\x1aGetTelemetrySchemaResponse\x12*\n\x06schema\x18\x01 \x01(\x0b\x32\x1a.hazel.rpc.TelemetrySchema\",\n\x16StreamTelemetryRequest\x12\x12\n\ntarget_fps\x18\x01 \x01(\r\"\x7f\n\x0eTelemetryFrame\x12\x14\n\x0ctimestamp_ms\x18\x01 \x01(\x04\x12\x14\n\x0c\x66rame_number\x18\x02 \x01(\r\x12\x12\n\ntask_index\x18\x03 \x01(\r\x12\x18\n\x10observation_qpos\x18\x04 \x03(\x02\x12\x13\n\x0b\x61\x63tion_ctrl\x18\x05 \x03(\x02\x32\xc8\x01\n\x10TelemetryService\x12\x61\n\x12GetTelemetrySchema\x12$.hazel.rpc.GetTelemetrySchemaRequest\x1a%.hazel.rpc.GetTelemetrySchemaResponse\x12Q\n\x0fStreamTelemetry\x12!.hazel.rpc.StreamTelemetryRequest\x1a\x19.hazel.rpc.TelemetryFrame0\x01\x42\x03\xf8\x01\x01\x62\x06proto3')
|
|
28
|
+
|
|
29
|
+
_globals = globals()
|
|
30
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
31
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'telemetry_pb2', _globals)
|
|
32
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
+
_globals['DESCRIPTOR']._serialized_options = b'\370\001\001'
|
|
35
|
+
_globals['_TELEMETRYSCHEMA']._serialized_start=30
|
|
36
|
+
_globals['_TELEMETRYSCHEMA']._serialized_end=120
|
|
37
|
+
_globals['_GETTELEMETRYSCHEMAREQUEST']._serialized_start=122
|
|
38
|
+
_globals['_GETTELEMETRYSCHEMAREQUEST']._serialized_end=149
|
|
39
|
+
_globals['_GETTELEMETRYSCHEMARESPONSE']._serialized_start=151
|
|
40
|
+
_globals['_GETTELEMETRYSCHEMARESPONSE']._serialized_end=223
|
|
41
|
+
_globals['_STREAMTELEMETRYREQUEST']._serialized_start=225
|
|
42
|
+
_globals['_STREAMTELEMETRYREQUEST']._serialized_end=269
|
|
43
|
+
_globals['_TELEMETRYFRAME']._serialized_start=271
|
|
44
|
+
_globals['_TELEMETRYFRAME']._serialized_end=398
|
|
45
|
+
_globals['_TELEMETRYSERVICE']._serialized_start=401
|
|
46
|
+
_globals['_TELEMETRYSERVICE']._serialized_end=601
|
|
47
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
from . import telemetry_pb2 as telemetry__pb2
|
|
7
|
+
|
|
8
|
+
GRPC_GENERATED_VERSION = '1.76.0'
|
|
9
|
+
GRPC_VERSION = grpc.__version__
|
|
10
|
+
_version_not_supported = False
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
from grpc._utilities import first_version_is_lower
|
|
14
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
15
|
+
except ImportError:
|
|
16
|
+
_version_not_supported = True
|
|
17
|
+
|
|
18
|
+
if _version_not_supported:
|
|
19
|
+
raise RuntimeError(
|
|
20
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
21
|
+
+ ' but the generated code in telemetry_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}.'
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class TelemetryServiceStub(object):
|
|
29
|
+
"""Stream-only service intended for external tools (plotting, training logs, debugging).
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
def __init__(self, channel):
|
|
33
|
+
"""Constructor.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
channel: A grpc.Channel.
|
|
37
|
+
"""
|
|
38
|
+
self.GetTelemetrySchema = channel.unary_unary(
|
|
39
|
+
'/hazel.rpc.TelemetryService/GetTelemetrySchema',
|
|
40
|
+
request_serializer=telemetry__pb2.GetTelemetrySchemaRequest.SerializeToString,
|
|
41
|
+
response_deserializer=telemetry__pb2.GetTelemetrySchemaResponse.FromString,
|
|
42
|
+
_registered_method=True)
|
|
43
|
+
self.StreamTelemetry = channel.unary_stream(
|
|
44
|
+
'/hazel.rpc.TelemetryService/StreamTelemetry',
|
|
45
|
+
request_serializer=telemetry__pb2.StreamTelemetryRequest.SerializeToString,
|
|
46
|
+
response_deserializer=telemetry__pb2.TelemetryFrame.FromString,
|
|
47
|
+
_registered_method=True)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class TelemetryServiceServicer(object):
|
|
51
|
+
"""Stream-only service intended for external tools (plotting, training logs, debugging).
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
def GetTelemetrySchema(self, request, context):
|
|
55
|
+
"""Missing associated documentation comment in .proto file."""
|
|
56
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
57
|
+
context.set_details('Method not implemented!')
|
|
58
|
+
raise NotImplementedError('Method not implemented!')
|
|
59
|
+
|
|
60
|
+
def StreamTelemetry(self, request, context):
|
|
61
|
+
"""Missing associated documentation comment in .proto file."""
|
|
62
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
63
|
+
context.set_details('Method not implemented!')
|
|
64
|
+
raise NotImplementedError('Method not implemented!')
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def add_TelemetryServiceServicer_to_server(servicer, server):
|
|
68
|
+
rpc_method_handlers = {
|
|
69
|
+
'GetTelemetrySchema': grpc.unary_unary_rpc_method_handler(
|
|
70
|
+
servicer.GetTelemetrySchema,
|
|
71
|
+
request_deserializer=telemetry__pb2.GetTelemetrySchemaRequest.FromString,
|
|
72
|
+
response_serializer=telemetry__pb2.GetTelemetrySchemaResponse.SerializeToString,
|
|
73
|
+
),
|
|
74
|
+
'StreamTelemetry': grpc.unary_stream_rpc_method_handler(
|
|
75
|
+
servicer.StreamTelemetry,
|
|
76
|
+
request_deserializer=telemetry__pb2.StreamTelemetryRequest.FromString,
|
|
77
|
+
response_serializer=telemetry__pb2.TelemetryFrame.SerializeToString,
|
|
78
|
+
),
|
|
79
|
+
}
|
|
80
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
81
|
+
'hazel.rpc.TelemetryService', rpc_method_handlers)
|
|
82
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
83
|
+
server.add_registered_method_handlers('hazel.rpc.TelemetryService', rpc_method_handlers)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# This class is part of an EXPERIMENTAL API.
|
|
87
|
+
class TelemetryService(object):
|
|
88
|
+
"""Stream-only service intended for external tools (plotting, training logs, debugging).
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
@staticmethod
|
|
92
|
+
def GetTelemetrySchema(request,
|
|
93
|
+
target,
|
|
94
|
+
options=(),
|
|
95
|
+
channel_credentials=None,
|
|
96
|
+
call_credentials=None,
|
|
97
|
+
insecure=False,
|
|
98
|
+
compression=None,
|
|
99
|
+
wait_for_ready=None,
|
|
100
|
+
timeout=None,
|
|
101
|
+
metadata=None):
|
|
102
|
+
return grpc.experimental.unary_unary(
|
|
103
|
+
request,
|
|
104
|
+
target,
|
|
105
|
+
'/hazel.rpc.TelemetryService/GetTelemetrySchema',
|
|
106
|
+
telemetry__pb2.GetTelemetrySchemaRequest.SerializeToString,
|
|
107
|
+
telemetry__pb2.GetTelemetrySchemaResponse.FromString,
|
|
108
|
+
options,
|
|
109
|
+
channel_credentials,
|
|
110
|
+
insecure,
|
|
111
|
+
call_credentials,
|
|
112
|
+
compression,
|
|
113
|
+
wait_for_ready,
|
|
114
|
+
timeout,
|
|
115
|
+
metadata,
|
|
116
|
+
_registered_method=True)
|
|
117
|
+
|
|
118
|
+
@staticmethod
|
|
119
|
+
def StreamTelemetry(request,
|
|
120
|
+
target,
|
|
121
|
+
options=(),
|
|
122
|
+
channel_credentials=None,
|
|
123
|
+
call_credentials=None,
|
|
124
|
+
insecure=False,
|
|
125
|
+
compression=None,
|
|
126
|
+
wait_for_ready=None,
|
|
127
|
+
timeout=None,
|
|
128
|
+
metadata=None):
|
|
129
|
+
return grpc.experimental.unary_stream(
|
|
130
|
+
request,
|
|
131
|
+
target,
|
|
132
|
+
'/hazel.rpc.TelemetryService/StreamTelemetry',
|
|
133
|
+
telemetry__pb2.StreamTelemetryRequest.SerializeToString,
|
|
134
|
+
telemetry__pb2.TelemetryFrame.FromString,
|
|
135
|
+
options,
|
|
136
|
+
channel_credentials,
|
|
137
|
+
insecure,
|
|
138
|
+
call_credentials,
|
|
139
|
+
compression,
|
|
140
|
+
wait_for_ready,
|
|
141
|
+
timeout,
|
|
142
|
+
metadata,
|
|
143
|
+
_registered_method=True)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
+
# source: viewport.proto
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
6
|
+
"""Generated protocol buffer code."""
|
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
+
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'viewport.proto'
|
|
19
|
+
)
|
|
20
|
+
# @@protoc_insertion_point(imports)
|
|
21
|
+
|
|
22
|
+
_sym_db = _symbol_database.Default()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
from . import media_pb2 as media__pb2
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eviewport.proto\x12\thazel.rpc\x1a\x0bmedia.proto\"v\n\x1aStartViewportStreamRequest\x12\x15\n\rviewport_name\x18\x01 \x01(\t\x12\x12\n\ntarget_fps\x18\x02 \x01(\r\x12\r\n\x05width\x18\x03 \x01(\r\x12\x0e\n\x06height\x18\x04 \x01(\r\x12\x0e\n\x06\x66ormat\x18\x05 \x01(\t\"l\n\x14ViewportStreamConfig\x12\x11\n\tstreaming\x18\x01 \x01(\x08\x12\x15\n\rviewport_name\x18\x02 \x01(\t\x12\x0b\n\x03\x66ps\x18\x03 \x01(\r\x12\r\n\x05width\x18\x04 \x01(\r\x12\x0e\n\x06height\x18\x05 \x01(\r\"\x1b\n\x19StopViewportStreamRequest\"-\n\x1aStopViewportStreamResponse\x12\x0f\n\x07success\x18\x01 \x01(\x08\"\x18\n\x16GetViewportInfoRequest\"o\n\x17GetViewportInfoResponse\x12\x1b\n\x13\x61vailable_viewports\x18\x01 \x03(\t\x12\x37\n\x0e\x63urrent_config\x18\x02 \x01(\x0b\x32\x1f.hazel.rpc.ViewportStreamConfig2\xbd\x01\n\x0fViewportService\x12X\n\x0fGetViewportInfo\x12!.hazel.rpc.GetViewportInfoRequest\x1a\".hazel.rpc.GetViewportInfoResponse\x12P\n\x0eStreamViewport\x12%.hazel.rpc.StartViewportStreamRequest\x1a\x15.hazel.rpc.ImageFrame0\x01\x42\x03\xf8\x01\x01\x62\x06proto3')
|
|
29
|
+
|
|
30
|
+
_globals = globals()
|
|
31
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
32
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'viewport_pb2', _globals)
|
|
33
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
34
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
35
|
+
_globals['DESCRIPTOR']._serialized_options = b'\370\001\001'
|
|
36
|
+
_globals['_STARTVIEWPORTSTREAMREQUEST']._serialized_start=42
|
|
37
|
+
_globals['_STARTVIEWPORTSTREAMREQUEST']._serialized_end=160
|
|
38
|
+
_globals['_VIEWPORTSTREAMCONFIG']._serialized_start=162
|
|
39
|
+
_globals['_VIEWPORTSTREAMCONFIG']._serialized_end=270
|
|
40
|
+
_globals['_STOPVIEWPORTSTREAMREQUEST']._serialized_start=272
|
|
41
|
+
_globals['_STOPVIEWPORTSTREAMREQUEST']._serialized_end=299
|
|
42
|
+
_globals['_STOPVIEWPORTSTREAMRESPONSE']._serialized_start=301
|
|
43
|
+
_globals['_STOPVIEWPORTSTREAMRESPONSE']._serialized_end=346
|
|
44
|
+
_globals['_GETVIEWPORTINFOREQUEST']._serialized_start=348
|
|
45
|
+
_globals['_GETVIEWPORTINFOREQUEST']._serialized_end=372
|
|
46
|
+
_globals['_GETVIEWPORTINFORESPONSE']._serialized_start=374
|
|
47
|
+
_globals['_GETVIEWPORTINFORESPONSE']._serialized_end=485
|
|
48
|
+
_globals['_VIEWPORTSERVICE']._serialized_start=488
|
|
49
|
+
_globals['_VIEWPORTSERVICE']._serialized_end=677
|
|
50
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
from . import media_pb2 as media__pb2
|
|
7
|
+
from . import viewport_pb2 as viewport__pb2
|
|
8
|
+
|
|
9
|
+
GRPC_GENERATED_VERSION = '1.76.0'
|
|
10
|
+
GRPC_VERSION = grpc.__version__
|
|
11
|
+
_version_not_supported = False
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
from grpc._utilities import first_version_is_lower
|
|
15
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
16
|
+
except ImportError:
|
|
17
|
+
_version_not_supported = True
|
|
18
|
+
|
|
19
|
+
if _version_not_supported:
|
|
20
|
+
raise RuntimeError(
|
|
21
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
22
|
+
+ ' but the generated code in viewport_pb2_grpc.py depends on'
|
|
23
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
24
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
25
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class ViewportServiceStub(object):
|
|
30
|
+
"""Streams pixels from a named viewport (useful for external visualization / training input).
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
def __init__(self, channel):
|
|
34
|
+
"""Constructor.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
channel: A grpc.Channel.
|
|
38
|
+
"""
|
|
39
|
+
self.GetViewportInfo = channel.unary_unary(
|
|
40
|
+
'/hazel.rpc.ViewportService/GetViewportInfo',
|
|
41
|
+
request_serializer=viewport__pb2.GetViewportInfoRequest.SerializeToString,
|
|
42
|
+
response_deserializer=viewport__pb2.GetViewportInfoResponse.FromString,
|
|
43
|
+
_registered_method=True)
|
|
44
|
+
self.StreamViewport = channel.unary_stream(
|
|
45
|
+
'/hazel.rpc.ViewportService/StreamViewport',
|
|
46
|
+
request_serializer=viewport__pb2.StartViewportStreamRequest.SerializeToString,
|
|
47
|
+
response_deserializer=media__pb2.ImageFrame.FromString,
|
|
48
|
+
_registered_method=True)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class ViewportServiceServicer(object):
|
|
52
|
+
"""Streams pixels from a named viewport (useful for external visualization / training input).
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
def GetViewportInfo(self, request, context):
|
|
56
|
+
"""Missing associated documentation comment in .proto file."""
|
|
57
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
58
|
+
context.set_details('Method not implemented!')
|
|
59
|
+
raise NotImplementedError('Method not implemented!')
|
|
60
|
+
|
|
61
|
+
def StreamViewport(self, request, context):
|
|
62
|
+
"""Missing associated documentation comment in .proto file."""
|
|
63
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
64
|
+
context.set_details('Method not implemented!')
|
|
65
|
+
raise NotImplementedError('Method not implemented!')
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def add_ViewportServiceServicer_to_server(servicer, server):
|
|
69
|
+
rpc_method_handlers = {
|
|
70
|
+
'GetViewportInfo': grpc.unary_unary_rpc_method_handler(
|
|
71
|
+
servicer.GetViewportInfo,
|
|
72
|
+
request_deserializer=viewport__pb2.GetViewportInfoRequest.FromString,
|
|
73
|
+
response_serializer=viewport__pb2.GetViewportInfoResponse.SerializeToString,
|
|
74
|
+
),
|
|
75
|
+
'StreamViewport': grpc.unary_stream_rpc_method_handler(
|
|
76
|
+
servicer.StreamViewport,
|
|
77
|
+
request_deserializer=viewport__pb2.StartViewportStreamRequest.FromString,
|
|
78
|
+
response_serializer=media__pb2.ImageFrame.SerializeToString,
|
|
79
|
+
),
|
|
80
|
+
}
|
|
81
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
82
|
+
'hazel.rpc.ViewportService', rpc_method_handlers)
|
|
83
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
84
|
+
server.add_registered_method_handlers('hazel.rpc.ViewportService', rpc_method_handlers)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# This class is part of an EXPERIMENTAL API.
|
|
88
|
+
class ViewportService(object):
|
|
89
|
+
"""Streams pixels from a named viewport (useful for external visualization / training input).
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
@staticmethod
|
|
93
|
+
def GetViewportInfo(request,
|
|
94
|
+
target,
|
|
95
|
+
options=(),
|
|
96
|
+
channel_credentials=None,
|
|
97
|
+
call_credentials=None,
|
|
98
|
+
insecure=False,
|
|
99
|
+
compression=None,
|
|
100
|
+
wait_for_ready=None,
|
|
101
|
+
timeout=None,
|
|
102
|
+
metadata=None):
|
|
103
|
+
return grpc.experimental.unary_unary(
|
|
104
|
+
request,
|
|
105
|
+
target,
|
|
106
|
+
'/hazel.rpc.ViewportService/GetViewportInfo',
|
|
107
|
+
viewport__pb2.GetViewportInfoRequest.SerializeToString,
|
|
108
|
+
viewport__pb2.GetViewportInfoResponse.FromString,
|
|
109
|
+
options,
|
|
110
|
+
channel_credentials,
|
|
111
|
+
insecure,
|
|
112
|
+
call_credentials,
|
|
113
|
+
compression,
|
|
114
|
+
wait_for_ready,
|
|
115
|
+
timeout,
|
|
116
|
+
metadata,
|
|
117
|
+
_registered_method=True)
|
|
118
|
+
|
|
119
|
+
@staticmethod
|
|
120
|
+
def StreamViewport(request,
|
|
121
|
+
target,
|
|
122
|
+
options=(),
|
|
123
|
+
channel_credentials=None,
|
|
124
|
+
call_credentials=None,
|
|
125
|
+
insecure=False,
|
|
126
|
+
compression=None,
|
|
127
|
+
wait_for_ready=None,
|
|
128
|
+
timeout=None,
|
|
129
|
+
metadata=None):
|
|
130
|
+
return grpc.experimental.unary_stream(
|
|
131
|
+
request,
|
|
132
|
+
target,
|
|
133
|
+
'/hazel.rpc.ViewportService/StreamViewport',
|
|
134
|
+
viewport__pb2.StartViewportStreamRequest.SerializeToString,
|
|
135
|
+
media__pb2.ImageFrame.FromString,
|
|
136
|
+
options,
|
|
137
|
+
channel_credentials,
|
|
138
|
+
insecure,
|
|
139
|
+
call_credentials,
|
|
140
|
+
compression,
|
|
141
|
+
wait_for_ready,
|
|
142
|
+
timeout,
|
|
143
|
+
metadata,
|
|
144
|
+
_registered_method=True)
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
// Agent + observation service definitions for the LuckyEngine / Hazel ScriptCore gRPC API (v1).
|
|
4
|
+
|
|
5
|
+
package hazel.rpc;
|
|
6
|
+
|
|
7
|
+
option cc_enable_arenas = true;
|
|
8
|
+
|
|
9
|
+
import "common.proto";
|
|
10
|
+
import "media.proto";
|
|
11
|
+
import "mujoco.proto";
|
|
12
|
+
import "telemetry.proto";
|
|
13
|
+
|
|
14
|
+
// Schema for an RL-style agent. `*_names` are informative; sizes are authoritative.
|
|
15
|
+
message AgentSchema {
|
|
16
|
+
string agent_name = 1;
|
|
17
|
+
repeated string observation_names = 2;
|
|
18
|
+
repeated string action_names = 3;
|
|
19
|
+
uint32 observation_size = 4;
|
|
20
|
+
uint32 action_size = 5;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
message GetAgentSchemaRequest {
|
|
24
|
+
// Agent logical name. Convention in this repo is `agent_0`, `agent_1`, ...
|
|
25
|
+
// Empty typically means "default agent".
|
|
26
|
+
string agent_name = 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
message GetAgentSchemaResponse {
|
|
30
|
+
AgentSchema schema = 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
message StreamAgentRequest {
|
|
34
|
+
// Agent logical name. If empty, server may fall back to a default agent.
|
|
35
|
+
string agent_name = 1;
|
|
36
|
+
// Client hint: desired update rate. Server may clamp.
|
|
37
|
+
uint32 target_fps = 2;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Domain randomization configuration for physics parameters.
|
|
41
|
+
// All range fields are [min, max] pairs. Empty ranges mean "use defaults".
|
|
42
|
+
message DomainRandomizationConfig {
|
|
43
|
+
// Initial state randomization
|
|
44
|
+
repeated float pose_position_noise = 1; // [x, y, z] position noise std
|
|
45
|
+
float pose_orientation_noise = 2; // Orientation noise std (radians)
|
|
46
|
+
float joint_position_noise = 3; // Joint position noise std
|
|
47
|
+
float joint_velocity_noise = 4; // Joint velocity noise std
|
|
48
|
+
|
|
49
|
+
// Physics parameters (all [min, max] ranges)
|
|
50
|
+
repeated float friction_range = 5; // Surface friction coefficient
|
|
51
|
+
repeated float restitution_range = 6; // Bounce/restitution coefficient
|
|
52
|
+
repeated float mass_scale_range = 7; // Body mass multiplier
|
|
53
|
+
repeated float com_offset_range = 8; // Center of mass offset
|
|
54
|
+
|
|
55
|
+
// Motor/actuator randomization
|
|
56
|
+
repeated float motor_strength_range = 9; // Motor strength multiplier
|
|
57
|
+
repeated float motor_offset_range = 10; // Motor position offset
|
|
58
|
+
|
|
59
|
+
// External disturbances
|
|
60
|
+
repeated float push_interval_range = 11; // Time between pushes [min, max]
|
|
61
|
+
repeated float push_velocity_range = 12; // Push velocity magnitude [min, max]
|
|
62
|
+
|
|
63
|
+
// Terrain configuration
|
|
64
|
+
string terrain_type = 13; // Terrain type identifier
|
|
65
|
+
float terrain_difficulty = 14; // Terrain difficulty level
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
message ResetAgentRequest {
|
|
69
|
+
// Agent logical name. Convention in this repo is `agent_0`, `agent_1`, ...
|
|
70
|
+
// Empty typically means "default agent" (agent_0).
|
|
71
|
+
string agent_name = 1;
|
|
72
|
+
|
|
73
|
+
// Optional domain randomization config for this reset.
|
|
74
|
+
// If not provided, use defaults or keep previous values.
|
|
75
|
+
DomainRandomizationConfig dr_config = 2;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
message ResetAgentResponse {
|
|
79
|
+
bool success = 1;
|
|
80
|
+
string message = 2;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Agent observation stream frame.
|
|
84
|
+
// This stream is server->client; external actions are currently sent via MujocoService.SendControl.
|
|
85
|
+
message AgentFrame {
|
|
86
|
+
// Wall-clock timestamp in milliseconds (set by server on outgoing frames)
|
|
87
|
+
uint64 timestamp_ms = 1;
|
|
88
|
+
// Monotonic frame counter (set by server on outgoing frames)
|
|
89
|
+
uint32 frame_number = 2;
|
|
90
|
+
|
|
91
|
+
// Flat observation vector for this frame, as defined by the Agent's ObservationSpec.
|
|
92
|
+
repeated float observations = 3;
|
|
93
|
+
|
|
94
|
+
// Flat action vector for this frame.
|
|
95
|
+
// For frames sent from the client to the server, this carries the actions that
|
|
96
|
+
// should be applied for the next simulation step.
|
|
97
|
+
// For frames sent from the server to the client, this typically mirrors the last
|
|
98
|
+
// applied actions for debugging/telemetry.
|
|
99
|
+
repeated float actions = 4;
|
|
100
|
+
|
|
101
|
+
// Optional agent identifier, used when multiplexing multiple agents over a single
|
|
102
|
+
// stream. If empty, the server may fall back to a default agent.
|
|
103
|
+
string agent_name = 5;
|
|
104
|
+
|
|
105
|
+
// Optional target FPS hint requested by the client. The server may clamp or ignore
|
|
106
|
+
// this value depending on simulation timing constraints.
|
|
107
|
+
uint32 target_fps = 6;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// =============================================================================
|
|
111
|
+
// Observation RPC (single-shot snapshot)
|
|
112
|
+
// =============================================================================
|
|
113
|
+
|
|
114
|
+
// Single-shot camera snapshot request (mirrors StreamCameraRequest without fps).
|
|
115
|
+
message GetCameraFrameRequest {
|
|
116
|
+
oneof identifier {
|
|
117
|
+
EntityId id = 1;
|
|
118
|
+
string name = 2;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
uint32 width = 3; // Desired width (0 = native)
|
|
122
|
+
uint32 height = 4; // Desired height (0 = native)
|
|
123
|
+
string format = 5; // "raw", "jpeg" (default: raw)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Single-shot viewport snapshot request (mirrors StartViewportStreamRequest without fps).
|
|
127
|
+
message GetViewportFrameRequest {
|
|
128
|
+
string viewport_name = 1;
|
|
129
|
+
uint32 width = 2; // Desired width (0 = native)
|
|
130
|
+
uint32 height = 3; // Desired height (0 = native)
|
|
131
|
+
string format = 4; // "raw", "jpeg" (default: raw)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Request a unified observation snapshot. The server decides the exact meaning of
|
|
135
|
+
// "observation" based on the active scene/agent configuration and the fields selected here.
|
|
136
|
+
message GetObservationRequest {
|
|
137
|
+
// Target robot (used for MujocoService-style state and external actions).
|
|
138
|
+
string robot_name = 1;
|
|
139
|
+
|
|
140
|
+
// Target agent (used for RL-style flattened observation vectors). Empty means default agent.
|
|
141
|
+
string agent_name = 2;
|
|
142
|
+
|
|
143
|
+
// Include components in the response (server may ignore unsupported fields).
|
|
144
|
+
bool include_joint_state = 3;
|
|
145
|
+
bool include_agent_frame = 4;
|
|
146
|
+
bool include_telemetry = 5;
|
|
147
|
+
|
|
148
|
+
// Optional image snapshots.
|
|
149
|
+
repeated GetCameraFrameRequest cameras = 6;
|
|
150
|
+
repeated GetViewportFrameRequest viewports = 7;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
message GetObservationResponse {
|
|
154
|
+
bool success = 1;
|
|
155
|
+
string message = 2;
|
|
156
|
+
|
|
157
|
+
// Timestamp/frame_number are best-effort; server may use whichever timing source is available.
|
|
158
|
+
uint64 timestamp_ms = 3;
|
|
159
|
+
uint32 frame_number = 4;
|
|
160
|
+
|
|
161
|
+
// Optional components.
|
|
162
|
+
JointState joint_state = 5;
|
|
163
|
+
AgentFrame agent_frame = 6;
|
|
164
|
+
TelemetryFrame telemetry = 7;
|
|
165
|
+
|
|
166
|
+
repeated NamedImageFrame camera_frames = 8;
|
|
167
|
+
repeated NamedImageFrame viewport_frames = 9;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// =============================================================================
|
|
171
|
+
// Step RPC (synchronous RL step)
|
|
172
|
+
// =============================================================================
|
|
173
|
+
|
|
174
|
+
// Request to step the simulation with the provided action.
|
|
175
|
+
// This is the recommended interface for RL training - it combines
|
|
176
|
+
// SendControl + physics step + GetObservation into a single RPC.
|
|
177
|
+
message StepRequest {
|
|
178
|
+
// Agent logical name. Empty means default agent.
|
|
179
|
+
string agent_name = 1;
|
|
180
|
+
// Action vector to apply for this step.
|
|
181
|
+
repeated float actions = 2;
|
|
182
|
+
// Optional timeout in milliseconds. 0 means use server default.
|
|
183
|
+
uint32 timeout_ms = 3;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
message StepResponse {
|
|
187
|
+
bool success = 1;
|
|
188
|
+
string message = 2;
|
|
189
|
+
// Observation after the physics step completed.
|
|
190
|
+
AgentFrame observation = 3;
|
|
191
|
+
// Time taken for the physics step in microseconds (for profiling).
|
|
192
|
+
uint64 physics_step_duration_us = 4;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Per-agent RL-style observation streaming (training / inference clients consume this).
|
|
196
|
+
service AgentService {
|
|
197
|
+
rpc GetAgentSchema(GetAgentSchemaRequest) returns (GetAgentSchemaResponse);
|
|
198
|
+
// Single-shot observation snapshot (unified observation surface).
|
|
199
|
+
rpc GetObservation(GetObservationRequest) returns (GetObservationResponse);
|
|
200
|
+
// Server-streaming observations (and optional action echo) for a single agent.
|
|
201
|
+
//
|
|
202
|
+
// The client specifies which agent to stream via StreamAgentRequest and may
|
|
203
|
+
// provide a target FPS hint. Actions are currently sent via MujocoService
|
|
204
|
+
// (SendControl); AgentFrame.actions is primarily used for telemetry.
|
|
205
|
+
rpc StreamAgent(StreamAgentRequest) returns (stream AgentFrame);
|
|
206
|
+
// Reset a specific agent (full reset: clear buffers, reset state, resample commands, apply MuJoCo state).
|
|
207
|
+
// Useful for multi-env RL where individual agents need to be reset without resetting the entire scene.
|
|
208
|
+
rpc ResetAgent(ResetAgentRequest) returns (ResetAgentResponse);
|
|
209
|
+
// Synchronous RL step: apply action, wait for physics, return observation.
|
|
210
|
+
// This is the recommended interface for RL training as it eliminates
|
|
211
|
+
// one network round-trip compared to separate SendControl + GetObservation.
|
|
212
|
+
rpc Step(StepRequest) returns (StepResponse);
|
|
213
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
// Camera service definitions for the LuckyEngine / Hazel ScriptCore gRPC API (v1).
|
|
4
|
+
|
|
5
|
+
package hazel.rpc;
|
|
6
|
+
|
|
7
|
+
option cc_enable_arenas = true;
|
|
8
|
+
|
|
9
|
+
import "common.proto";
|
|
10
|
+
import "media.proto";
|
|
11
|
+
|
|
12
|
+
// Camera list entry. `id` matches an entity ID in the scene.
|
|
13
|
+
message CameraInfo {
|
|
14
|
+
EntityId id = 1;
|
|
15
|
+
string name = 2;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
message ListCamerasRequest {}
|
|
19
|
+
|
|
20
|
+
message ListCamerasResponse {
|
|
21
|
+
repeated CameraInfo cameras = 1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Start a camera stream by `id` or `name`.
|
|
25
|
+
message StreamCameraRequest {
|
|
26
|
+
oneof identifier {
|
|
27
|
+
EntityId id = 1;
|
|
28
|
+
string name = 2;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
uint32 target_fps = 3; // Desired frames per second
|
|
32
|
+
uint32 width = 4; // Desired width (0 = native)
|
|
33
|
+
uint32 height = 5; // Desired height (0 = native)
|
|
34
|
+
string format = 6; // "raw", "jpeg" (default: raw)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Streams pixels from a camera entity (useful for external perception / debugging).
|
|
38
|
+
service CameraService {
|
|
39
|
+
rpc ListCameras(ListCamerasRequest) returns (ListCamerasResponse);
|
|
40
|
+
rpc StreamCamera(StreamCameraRequest) returns (stream ImageFrame);
|
|
41
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
// Common/shared types for the LuckyEngine / Hazel ScriptCore gRPC API (v1).
|
|
4
|
+
//
|
|
5
|
+
// Compatibility note:
|
|
6
|
+
// - Avoid renumbering existing field tags (the `= N` numbers). Add new fields with new tags instead.
|
|
7
|
+
|
|
8
|
+
package hazel.rpc;
|
|
9
|
+
|
|
10
|
+
option cc_enable_arenas = true;
|
|
11
|
+
|
|
12
|
+
// Stable entity identifier (maps to engine UUID / entity ID depending on context).
|
|
13
|
+
message EntityId {
|
|
14
|
+
uint64 id = 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Basic math types for scene transforms.
|
|
18
|
+
message Vec3 {
|
|
19
|
+
float x = 1;
|
|
20
|
+
float y = 2;
|
|
21
|
+
float z = 3;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
message Quat {
|
|
25
|
+
float x = 1;
|
|
26
|
+
float y = 2;
|
|
27
|
+
float z = 3;
|
|
28
|
+
float w = 4;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// World-space transform. Interpretation matches the engine's transform component.
|
|
32
|
+
message Transform {
|
|
33
|
+
Vec3 position = 1;
|
|
34
|
+
Quat rotation = 2;
|
|
35
|
+
Vec3 scale = 3;
|
|
36
|
+
}
|