Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Commit 27a6eff

Browse files
Pyreach sync 20220711
1 parent 75062b2 commit 27a6eff

32 files changed

+16101
-1002
lines changed

pyreach/color_camera.py

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@
1414

1515
"""Interface for interacting with a color camera device."""
1616

17-
from typing import Optional, Callable
17+
import dataclasses
18+
from typing import Callable, Optional
1819

1920
import numpy as np
2021

21-
from pyreach import calibration
2222
from pyreach import core
23+
from pyreach.calibration import CalibrationCamera
2324

2425

26+
@dataclasses.dataclass(frozen=True)
2527
class ColorFrame:
2628
"""A single color camera frame taken at a specific time.
2729
@@ -32,42 +34,20 @@ class ColorFrame:
3234
device_name: The JSON device name string.
3335
color_image: A color image as a (DX,DY,3) array of uint8's.
3436
calibration: The calibration when the image is captured.
35-
37+
camera_t_origin: The camera pose with respect to the origin.
3638
"""
3739

38-
@property
39-
def time(self) -> float:
40-
"""Return timestamp of the ColorFrame."""
41-
raise NotImplementedError
42-
43-
@property
44-
def sequence(self) -> int:
45-
"""Sequence number of the ColorFrame."""
46-
raise NotImplementedError
47-
48-
@property
49-
def device_type(self) -> str:
50-
"""Return the Reach device type."""
51-
raise NotImplementedError
52-
53-
@property
54-
def device_name(self) -> str:
55-
"""Return the Reach device name."""
56-
raise NotImplementedError
57-
58-
@property
59-
def color_image(self) -> np.ndarray:
60-
"""Return the color image as a (DX,DY,3)."""
61-
raise NotImplementedError
62-
63-
@property
64-
def calibration(self) -> Optional[calibration.Calibration]:
65-
"""Return the Calibration for the ColorFrame."""
66-
raise NotImplementedError
40+
time: float
41+
sequence: int
42+
device_type: str
43+
device_name: str
44+
color_image: np.ndarray
45+
calibration: Optional[CalibrationCamera]
46+
camera_t_origin: Optional[core.Pose]
6747

6848
def pose(self) -> Optional[core.Pose]:
6949
"""Return the pose of the camera when the image is taken."""
70-
raise NotImplementedError
50+
return self.camera_t_origin
7151

7252

7353
class ColorCamera(object):

pyreach/common/proto_gen/calibration_config_pb2.py

Lines changed: 1186 additions & 0 deletions
Large diffs are not rendered by default.

pyreach/common/proto_gen/calibration_config_pb2.pyi

Lines changed: 570 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 295 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,295 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# -*- coding: utf-8 -*-
16+
# Generated by the protocol buffer compiler. DO NOT EDIT!
17+
# source: fiducial_pattern.proto
18+
19+
from google.protobuf import descriptor as _descriptor
20+
from google.protobuf import message as _message
21+
from google.protobuf import reflection as _reflection
22+
from google.protobuf import symbol_database as _symbol_database
23+
# @@protoc_insertion_point(imports)
24+
25+
_sym_db = _symbol_database.Default()
26+
27+
28+
import pyreach.common.proto_gen.vector_pb2 as vector__pb2
29+
30+
31+
DESCRIPTOR = _descriptor.FileDescriptor(
32+
name='fiducial_pattern.proto',
33+
package='robotics.messages',
34+
syntax='proto3',
35+
serialized_options=None,
36+
create_key=_descriptor._internal_create_key,
37+
serialized_pb=b'\n\x16\x66iducial_pattern.proto\x12\x11robotics.messages\x1a\x0cvector.proto\"\x94\x02\n\x15\x41prilTagPatternConfig\x12\x46\n\ntag_family\x18\x01 \x01(\x0e\x32\x32.robotics.messages.AprilTagPatternConfig.TagFamily\x12\x0b\n\x03ids\x18\x02 \x03(\x05\x12\x1b\n\x13square_spacing_bits\x18\x04 \x01(\r\x12\x1d\n\x15intertag_black_square\x18\x05 \x01(\x08\"j\n\tTagFamily\x12\x1a\n\x16UNSPECIFIED_TAG_FAMILY\x10\x00\x12\x0b\n\x07TAG16H5\x10\x01\x12\x0b\n\x07TAG25H7\x10\x02\x12\x0b\n\x07TAG25H9\x10\x03\x12\x0c\n\x08TAG36H10\x10\x04\x12\x0c\n\x08TAG36H11\x10\x05\"\x19\n\x17\x43hessboardPatternConfig\"\xe1\x02\n\x15\x46iducialPatternConfig\x12\x0c\n\x04rows\x18\x01 \x01(\r\x12\x0c\n\x04\x63ols\x18\x02 \x01(\r\x12\x18\n\x0emeters_per_bit\x18\x03 \x01(\x01H\x00\x12\x18\n\x0epixels_per_bit\x18\x04 \x01(\rH\x00\x12O\n\x19\x63hessboard_pattern_config\x18\x05 \x01(\x0b\x32*.robotics.messages.ChessboardPatternConfigH\x01\x12L\n\x18\x61pril_tag_pattern_config\x18\x06 \x01(\x0b\x32(.robotics.messages.AprilTagPatternConfigH\x01\x12+\n\x06offset\x18\x07 \x01(\x0b\x32\x1b.robotics.messages.Vector3dB\x11\n\x0f\x62it_sizing_typeB\x19\n\x17pattern_specific_configb\x06proto3'
38+
,
39+
dependencies=[vector__pb2.DESCRIPTOR,])
40+
41+
42+
43+
_APRILTAGPATTERNCONFIG_TAGFAMILY = _descriptor.EnumDescriptor(
44+
name='TagFamily',
45+
full_name='robotics.messages.AprilTagPatternConfig.TagFamily',
46+
filename=None,
47+
file=DESCRIPTOR,
48+
create_key=_descriptor._internal_create_key,
49+
values=[
50+
_descriptor.EnumValueDescriptor(
51+
name='UNSPECIFIED_TAG_FAMILY', index=0, number=0,
52+
serialized_options=None,
53+
type=None,
54+
create_key=_descriptor._internal_create_key),
55+
_descriptor.EnumValueDescriptor(
56+
name='TAG16H5', index=1, number=1,
57+
serialized_options=None,
58+
type=None,
59+
create_key=_descriptor._internal_create_key),
60+
_descriptor.EnumValueDescriptor(
61+
name='TAG25H7', index=2, number=2,
62+
serialized_options=None,
63+
type=None,
64+
create_key=_descriptor._internal_create_key),
65+
_descriptor.EnumValueDescriptor(
66+
name='TAG25H9', index=3, number=3,
67+
serialized_options=None,
68+
type=None,
69+
create_key=_descriptor._internal_create_key),
70+
_descriptor.EnumValueDescriptor(
71+
name='TAG36H10', index=4, number=4,
72+
serialized_options=None,
73+
type=None,
74+
create_key=_descriptor._internal_create_key),
75+
_descriptor.EnumValueDescriptor(
76+
name='TAG36H11', index=5, number=5,
77+
serialized_options=None,
78+
type=None,
79+
create_key=_descriptor._internal_create_key),
80+
],
81+
containing_type=None,
82+
serialized_options=None,
83+
serialized_start=230,
84+
serialized_end=336,
85+
)
86+
_sym_db.RegisterEnumDescriptor(_APRILTAGPATTERNCONFIG_TAGFAMILY)
87+
88+
89+
_APRILTAGPATTERNCONFIG = _descriptor.Descriptor(
90+
name='AprilTagPatternConfig',
91+
full_name='robotics.messages.AprilTagPatternConfig',
92+
filename=None,
93+
file=DESCRIPTOR,
94+
containing_type=None,
95+
create_key=_descriptor._internal_create_key,
96+
fields=[
97+
_descriptor.FieldDescriptor(
98+
name='tag_family', full_name='robotics.messages.AprilTagPatternConfig.tag_family', index=0,
99+
number=1, type=14, cpp_type=8, label=1,
100+
has_default_value=False, default_value=0,
101+
message_type=None, enum_type=None, containing_type=None,
102+
is_extension=False, extension_scope=None,
103+
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
104+
_descriptor.FieldDescriptor(
105+
name='ids', full_name='robotics.messages.AprilTagPatternConfig.ids', index=1,
106+
number=2, type=5, cpp_type=1, label=3,
107+
has_default_value=False, default_value=[],
108+
message_type=None, enum_type=None, containing_type=None,
109+
is_extension=False, extension_scope=None,
110+
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
111+
_descriptor.FieldDescriptor(
112+
name='square_spacing_bits', full_name='robotics.messages.AprilTagPatternConfig.square_spacing_bits', index=2,
113+
number=4, type=13, cpp_type=3, label=1,
114+
has_default_value=False, default_value=0,
115+
message_type=None, enum_type=None, containing_type=None,
116+
is_extension=False, extension_scope=None,
117+
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
118+
_descriptor.FieldDescriptor(
119+
name='intertag_black_square', full_name='robotics.messages.AprilTagPatternConfig.intertag_black_square', index=3,
120+
number=5, type=8, cpp_type=7, label=1,
121+
has_default_value=False, default_value=False,
122+
message_type=None, enum_type=None, containing_type=None,
123+
is_extension=False, extension_scope=None,
124+
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
125+
],
126+
extensions=[
127+
],
128+
nested_types=[],
129+
enum_types=[
130+
_APRILTAGPATTERNCONFIG_TAGFAMILY,
131+
],
132+
serialized_options=None,
133+
is_extendable=False,
134+
syntax='proto3',
135+
extension_ranges=[],
136+
oneofs=[
137+
],
138+
serialized_start=60,
139+
serialized_end=336,
140+
)
141+
142+
143+
_CHESSBOARDPATTERNCONFIG = _descriptor.Descriptor(
144+
name='ChessboardPatternConfig',
145+
full_name='robotics.messages.ChessboardPatternConfig',
146+
filename=None,
147+
file=DESCRIPTOR,
148+
containing_type=None,
149+
create_key=_descriptor._internal_create_key,
150+
fields=[
151+
],
152+
extensions=[
153+
],
154+
nested_types=[],
155+
enum_types=[
156+
],
157+
serialized_options=None,
158+
is_extendable=False,
159+
syntax='proto3',
160+
extension_ranges=[],
161+
oneofs=[
162+
],
163+
serialized_start=338,
164+
serialized_end=363,
165+
)
166+
167+
168+
_FIDUCIALPATTERNCONFIG = _descriptor.Descriptor(
169+
name='FiducialPatternConfig',
170+
full_name='robotics.messages.FiducialPatternConfig',
171+
filename=None,
172+
file=DESCRIPTOR,
173+
containing_type=None,
174+
create_key=_descriptor._internal_create_key,
175+
fields=[
176+
_descriptor.FieldDescriptor(
177+
name='rows', full_name='robotics.messages.FiducialPatternConfig.rows', index=0,
178+
number=1, type=13, cpp_type=3, label=1,
179+
has_default_value=False, default_value=0,
180+
message_type=None, enum_type=None, containing_type=None,
181+
is_extension=False, extension_scope=None,
182+
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
183+
_descriptor.FieldDescriptor(
184+
name='cols', full_name='robotics.messages.FiducialPatternConfig.cols', index=1,
185+
number=2, type=13, cpp_type=3, label=1,
186+
has_default_value=False, default_value=0,
187+
message_type=None, enum_type=None, containing_type=None,
188+
is_extension=False, extension_scope=None,
189+
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
190+
_descriptor.FieldDescriptor(
191+
name='meters_per_bit', full_name='robotics.messages.FiducialPatternConfig.meters_per_bit', index=2,
192+
number=3, type=1, cpp_type=5, label=1,
193+
has_default_value=False, default_value=float(0),
194+
message_type=None, enum_type=None, containing_type=None,
195+
is_extension=False, extension_scope=None,
196+
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
197+
_descriptor.FieldDescriptor(
198+
name='pixels_per_bit', full_name='robotics.messages.FiducialPatternConfig.pixels_per_bit', index=3,
199+
number=4, type=13, cpp_type=3, label=1,
200+
has_default_value=False, default_value=0,
201+
message_type=None, enum_type=None, containing_type=None,
202+
is_extension=False, extension_scope=None,
203+
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
204+
_descriptor.FieldDescriptor(
205+
name='chessboard_pattern_config', full_name='robotics.messages.FiducialPatternConfig.chessboard_pattern_config', index=4,
206+
number=5, type=11, cpp_type=10, label=1,
207+
has_default_value=False, default_value=None,
208+
message_type=None, enum_type=None, containing_type=None,
209+
is_extension=False, extension_scope=None,
210+
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
211+
_descriptor.FieldDescriptor(
212+
name='april_tag_pattern_config', full_name='robotics.messages.FiducialPatternConfig.april_tag_pattern_config', index=5,
213+
number=6, type=11, cpp_type=10, label=1,
214+
has_default_value=False, default_value=None,
215+
message_type=None, enum_type=None, containing_type=None,
216+
is_extension=False, extension_scope=None,
217+
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
218+
_descriptor.FieldDescriptor(
219+
name='offset', full_name='robotics.messages.FiducialPatternConfig.offset', index=6,
220+
number=7, type=11, cpp_type=10, label=1,
221+
has_default_value=False, default_value=None,
222+
message_type=None, enum_type=None, containing_type=None,
223+
is_extension=False, extension_scope=None,
224+
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
225+
],
226+
extensions=[
227+
],
228+
nested_types=[],
229+
enum_types=[
230+
],
231+
serialized_options=None,
232+
is_extendable=False,
233+
syntax='proto3',
234+
extension_ranges=[],
235+
oneofs=[
236+
_descriptor.OneofDescriptor(
237+
name='bit_sizing_type', full_name='robotics.messages.FiducialPatternConfig.bit_sizing_type',
238+
index=0, containing_type=None,
239+
create_key=_descriptor._internal_create_key,
240+
fields=[]),
241+
_descriptor.OneofDescriptor(
242+
name='pattern_specific_config', full_name='robotics.messages.FiducialPatternConfig.pattern_specific_config',
243+
index=1, containing_type=None,
244+
create_key=_descriptor._internal_create_key,
245+
fields=[]),
246+
],
247+
serialized_start=366,
248+
serialized_end=719,
249+
)
250+
251+
_APRILTAGPATTERNCONFIG.fields_by_name['tag_family'].enum_type = _APRILTAGPATTERNCONFIG_TAGFAMILY
252+
_APRILTAGPATTERNCONFIG_TAGFAMILY.containing_type = _APRILTAGPATTERNCONFIG
253+
_FIDUCIALPATTERNCONFIG.fields_by_name['chessboard_pattern_config'].message_type = _CHESSBOARDPATTERNCONFIG
254+
_FIDUCIALPATTERNCONFIG.fields_by_name['april_tag_pattern_config'].message_type = _APRILTAGPATTERNCONFIG
255+
_FIDUCIALPATTERNCONFIG.fields_by_name['offset'].message_type = vector__pb2._VECTOR3D
256+
_FIDUCIALPATTERNCONFIG.oneofs_by_name['bit_sizing_type'].fields.append(
257+
_FIDUCIALPATTERNCONFIG.fields_by_name['meters_per_bit'])
258+
_FIDUCIALPATTERNCONFIG.fields_by_name['meters_per_bit'].containing_oneof = _FIDUCIALPATTERNCONFIG.oneofs_by_name['bit_sizing_type']
259+
_FIDUCIALPATTERNCONFIG.oneofs_by_name['bit_sizing_type'].fields.append(
260+
_FIDUCIALPATTERNCONFIG.fields_by_name['pixels_per_bit'])
261+
_FIDUCIALPATTERNCONFIG.fields_by_name['pixels_per_bit'].containing_oneof = _FIDUCIALPATTERNCONFIG.oneofs_by_name['bit_sizing_type']
262+
_FIDUCIALPATTERNCONFIG.oneofs_by_name['pattern_specific_config'].fields.append(
263+
_FIDUCIALPATTERNCONFIG.fields_by_name['chessboard_pattern_config'])
264+
_FIDUCIALPATTERNCONFIG.fields_by_name['chessboard_pattern_config'].containing_oneof = _FIDUCIALPATTERNCONFIG.oneofs_by_name['pattern_specific_config']
265+
_FIDUCIALPATTERNCONFIG.oneofs_by_name['pattern_specific_config'].fields.append(
266+
_FIDUCIALPATTERNCONFIG.fields_by_name['april_tag_pattern_config'])
267+
_FIDUCIALPATTERNCONFIG.fields_by_name['april_tag_pattern_config'].containing_oneof = _FIDUCIALPATTERNCONFIG.oneofs_by_name['pattern_specific_config']
268+
DESCRIPTOR.message_types_by_name['AprilTagPatternConfig'] = _APRILTAGPATTERNCONFIG
269+
DESCRIPTOR.message_types_by_name['ChessboardPatternConfig'] = _CHESSBOARDPATTERNCONFIG
270+
DESCRIPTOR.message_types_by_name['FiducialPatternConfig'] = _FIDUCIALPATTERNCONFIG
271+
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
272+
273+
AprilTagPatternConfig = _reflection.GeneratedProtocolMessageType('AprilTagPatternConfig', (_message.Message,), {
274+
'DESCRIPTOR' : _APRILTAGPATTERNCONFIG,
275+
'__module__' : 'fiducial_pattern_pb2'
276+
# @@protoc_insertion_point(class_scope:robotics.messages.AprilTagPatternConfig)
277+
})
278+
_sym_db.RegisterMessage(AprilTagPatternConfig)
279+
280+
ChessboardPatternConfig = _reflection.GeneratedProtocolMessageType('ChessboardPatternConfig', (_message.Message,), {
281+
'DESCRIPTOR' : _CHESSBOARDPATTERNCONFIG,
282+
'__module__' : 'fiducial_pattern_pb2'
283+
# @@protoc_insertion_point(class_scope:robotics.messages.ChessboardPatternConfig)
284+
})
285+
_sym_db.RegisterMessage(ChessboardPatternConfig)
286+
287+
FiducialPatternConfig = _reflection.GeneratedProtocolMessageType('FiducialPatternConfig', (_message.Message,), {
288+
'DESCRIPTOR' : _FIDUCIALPATTERNCONFIG,
289+
'__module__' : 'fiducial_pattern_pb2'
290+
# @@protoc_insertion_point(class_scope:robotics.messages.FiducialPatternConfig)
291+
})
292+
_sym_db.RegisterMessage(FiducialPatternConfig)
293+
294+
295+
# @@protoc_insertion_point(module_scope)

0 commit comments

Comments
 (0)