ros-streamer 0.3.0__tar.gz
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.
- ros_streamer-0.3.0/LICENSE +202 -0
- ros_streamer-0.3.0/PKG-INFO +154 -0
- ros_streamer-0.3.0/README.md +125 -0
- ros_streamer-0.3.0/pyproject.toml +99 -0
- ros_streamer-0.3.0/setup.cfg +4 -0
- ros_streamer-0.3.0/src/ros_stream_viewer/__init__.py +13 -0
- ros_streamer-0.3.0/src/ros_stream_viewer/config.py +365 -0
- ros_streamer-0.3.0/src/ros_stream_viewer/services/__init__.py +3 -0
- ros_streamer-0.3.0/src/ros_stream_viewer/services/stream_service.py +31 -0
- ros_streamer-0.3.0/src/ros_stream_viewer/services/viewer_service.py +852 -0
- ros_streamer-0.3.0/src/ros_stream_viewer/utils/__init__.py +3 -0
- ros_streamer-0.3.0/src/ros_stream_viewer/utils/logger.py +39 -0
- ros_streamer-0.3.0/src/ros_stream_viewer/utils/thread_helpper.py +96 -0
- ros_streamer-0.3.0/src/ros_stream_viewer/viewer.py +391 -0
- ros_streamer-0.3.0/src/ros_streamer.egg-info/PKG-INFO +154 -0
- ros_streamer-0.3.0/src/ros_streamer.egg-info/SOURCES.txt +25 -0
- ros_streamer-0.3.0/src/ros_streamer.egg-info/dependency_links.txt +1 -0
- ros_streamer-0.3.0/src/ros_streamer.egg-info/entry_points.txt +4 -0
- ros_streamer-0.3.0/src/ros_streamer.egg-info/requires.txt +6 -0
- ros_streamer-0.3.0/src/ros_streamer.egg-info/top_level.txt +1 -0
- ros_streamer-0.3.0/tests/test_cli.py +382 -0
- ros_streamer-0.3.0/tests/test_config.py +247 -0
- ros_streamer-0.3.0/tests/test_decode.py +208 -0
- ros_streamer-0.3.0/tests/test_logger.py +38 -0
- ros_streamer-0.3.0/tests/test_protocol_contract.py +146 -0
- ros_streamer-0.3.0/tests/test_release.py +160 -0
- ros_streamer-0.3.0/tests/test_stream_loop.py +487 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ros-streamer
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: ROS 2 카메라 이미지를 ZMQ로 스트리밍하는 뷰어 CLI (uvx로 실행 가능)
|
|
5
|
+
Author: wkqco33
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://gitlab.com/wkqco33/ros-streamer
|
|
8
|
+
Project-URL: Repository, https://gitlab.com/wkqco33/ros-streamer
|
|
9
|
+
Project-URL: Issues, https://gitlab.com/wkqco33/ros-streamer/-/issues
|
|
10
|
+
Keywords: ros2,zmq,camera,streaming,viewer,opencv
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Multimedia :: Video
|
|
19
|
+
Requires-Python: >=3.12
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: numpy>=2.0
|
|
23
|
+
Requires-Dist: opencv-python>=4.10
|
|
24
|
+
Requires-Dist: pyzmq>=27.1.0
|
|
25
|
+
Requires-Dist: wpycli>=0.3.1
|
|
26
|
+
Requires-Dist: wpyconf>=0.2.5
|
|
27
|
+
Requires-Dist: wpylog>=0.2.0
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# ros-stream-viewer
|
|
31
|
+
|
|
32
|
+
[ROS Streamer](https://gitlab.com/wkqco33/ros-streamer) 서버가 ZMQ로 발행하는
|
|
33
|
+
카메라 이미지를 구독해 화면에 표시하는 CLI입니다. ROS 설치 없이 단독 실행되며,
|
|
34
|
+
Python 3.12+ 에서 동작합니다.
|
|
35
|
+
|
|
36
|
+
```console
|
|
37
|
+
# 설치 없이 실행 (권장)
|
|
38
|
+
uvx ros-streamer stream --host <HOST> --port 5556
|
|
39
|
+
|
|
40
|
+
# 설치
|
|
41
|
+
uv tool install ros-streamer # 또는: pip install ros-streamer
|
|
42
|
+
ros-stream-viewer stream
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
> `ros-streamer`, `ros-stream-viewer`, `rviewer`는 동일한 실행 파일입니다.
|
|
46
|
+
|
|
47
|
+
## 빠른 시작
|
|
48
|
+
|
|
49
|
+
```console
|
|
50
|
+
# compressed(JPEG) 스트림 표시 (서버 base+1, 기본 5556)
|
|
51
|
+
ros-stream-viewer stream
|
|
52
|
+
|
|
53
|
+
# raw 스트림 표시 (서버 base, 기본 5555)
|
|
54
|
+
ros-stream-viewer stream --port 5555 --stream-type raw
|
|
55
|
+
|
|
56
|
+
# 창 없이 100프레임만 수신하고 JSON 요약을 stdout으로 출력 (CI/스크립트)
|
|
57
|
+
ros-stream-viewer stream --headless --max-frames 100 --json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
표시 중 단축키: `i` 정보 오버레이 토글 · `p`/Space 일시정지 · `s` PNG 스냅샷 ·
|
|
61
|
+
`v` mp4 녹화 · `f` 전체화면 · `q`/ESC 종료.
|
|
62
|
+
|
|
63
|
+
## 주요 플래그
|
|
64
|
+
|
|
65
|
+
| 플래그 | 설명 | 기본값 |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| `--host` | 서버 호스트 | `localhost` |
|
|
68
|
+
| `--port` | ZMQ 포트 (서버 규약: base=raw, base+1=compressed) | `5556` |
|
|
69
|
+
| `--stream-type` | `auto`(매직 자동 판별) / `raw` / `compressed` | `auto` |
|
|
70
|
+
| `--width`, `--height` | 헤더 없는 raw 스트림의 해상도 (헤더가 있으면 무시) | `640x480` |
|
|
71
|
+
| `--connect-timeout` | 첫 프레임 대기 시간(초). 초과 시 종료 코드 4 (`0`=무한) | `5` |
|
|
72
|
+
| `--stall-timeout` | 수신이 멈춘 것으로 경고할 임계(초, `0`=끄기) | `3` |
|
|
73
|
+
| `--max-frames`, `--duration` | N프레임/N초 후 종료 (`0`=무제한) | `0` |
|
|
74
|
+
| `--snapshot-dir` | `s`/`v` 저장 디렉터리 | 현재 디렉터리 |
|
|
75
|
+
| `--network-info` | 네트워크 정보 오버레이 (`--network-info=false`로 끔) | `true` |
|
|
76
|
+
| `--headless` | 창 없이 통계만 로그로 출력 | `false` |
|
|
77
|
+
| `--json` | 실행 요약(JSON)을 stdout으로 출력 | `false` |
|
|
78
|
+
| `-q`, `--quiet` / `-d`, `--debug` | 경고만 출력 / DEBUG 로그 출력 | - |
|
|
79
|
+
| `--config`, `--dotenv` | 설정 파일 / `.env` 경로 | - |
|
|
80
|
+
| `--log-level`, `--log-file` | 로그 레벨 / JSON Lines 로그 파일 | `INFO` / - |
|
|
81
|
+
| `--no-color` | 색상 출력 끄기 | - |
|
|
82
|
+
|
|
83
|
+
## 설정
|
|
84
|
+
|
|
85
|
+
우선순위는 **플래그 > 환경변수 > `.env` > 설정 파일 > 기본값**이며, 환경변수
|
|
86
|
+
prefix는 `ROS_STREAMER`, 중첩 키 구분자는 `__`입니다.
|
|
87
|
+
|
|
88
|
+
```console
|
|
89
|
+
ROS_STREAMER_STREAM__HOST=10.0.0.2 ROS_STREAMER_STREAM__PORT=15555 \
|
|
90
|
+
ros-stream-viewer stream
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
설정 파일(JSON/TOML/YAML)은 `--config`로 지정합니다. 지정하지 않으면
|
|
94
|
+
`.env`와 OS 설정 디렉터리(`$XDG_CONFIG_HOME/ros-streamer/config.toml`,
|
|
95
|
+
macOS는 `~/Library/Application Support`, Windows는 `%APPDATA%`)의
|
|
96
|
+
`config.{toml,yaml,yml,json}`을 자동으로 찾습니다.
|
|
97
|
+
|
|
98
|
+
```yaml
|
|
99
|
+
# viewer.yaml
|
|
100
|
+
stream:
|
|
101
|
+
host: 10.0.0.2
|
|
102
|
+
port: 5555
|
|
103
|
+
type: raw
|
|
104
|
+
connect_timeout: 5.0
|
|
105
|
+
network_info: false
|
|
106
|
+
logging:
|
|
107
|
+
level: INFO
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
불리언은 `true/false/1/0/yes/no/on/off`(대소문자 무관)만 인정합니다.
|
|
111
|
+
해석할 수 없는 값은 기본값으로, 해석됐지만 규약을 벗어난 값(포트 범위 등)은
|
|
112
|
+
종료 코드 2로 거부합니다.
|
|
113
|
+
|
|
114
|
+
## 출력과 종료 코드
|
|
115
|
+
|
|
116
|
+
결과(도움말, `--json` 요약)는 **stdout**, 로그·진행·오류는 **stderr**로
|
|
117
|
+
나갑니다.
|
|
118
|
+
|
|
119
|
+
```console
|
|
120
|
+
$ ros-stream-viewer stream --headless --max-frames 100 --json 2>/dev/null
|
|
121
|
+
{"backlog_skipped": 0, "decode_errors": 0, "dropped_frames": 0, "exit_code": 0,
|
|
122
|
+
"fps": 30.0, "frames": 100, "frames_processed": 100, "host": "localhost",
|
|
123
|
+
"latency_ms": 0.4, "port": 5556, "resolution": "640x480", "status": "ok", ...}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
| 코드 | 의미 |
|
|
127
|
+
| --- | --- |
|
|
128
|
+
| 0 | 정상 종료(사용자 종료, `--max-frames`/`--duration` 도달 포함) |
|
|
129
|
+
| 1 | 예기치 않은 시스템 오류 |
|
|
130
|
+
| 2 | 사용법/설정 오류 |
|
|
131
|
+
| 3 | 뷰어 서비스 시작 실패(ZMQ 소켓 생성/연결 실패) |
|
|
132
|
+
| 4 | 실행 중 서비스 실패(첫 프레임 타임아웃, 소켓/프로토콜 오류) |
|
|
133
|
+
|
|
134
|
+
## 요구 사항과 지원 범위
|
|
135
|
+
|
|
136
|
+
* Python **3.12 / 3.13** (CI에서 두 버전 모두 테스트)
|
|
137
|
+
* Linux/macOS/Windows. GUI 표시에는 OpenCV 창이 필요하며, 헤드리스 환경에서는
|
|
138
|
+
`--headless`를 사용하세요.
|
|
139
|
+
* 일부 Linux 배포판은 OpenCV 런타임 의존성(`libGL`)이 필요합니다:
|
|
140
|
+
`apt-get install -y libgl1 libglib2.0-0`
|
|
141
|
+
* ROS 서버 없이도 동작하며, ROS 패키지는 필요하지 않습니다.
|
|
142
|
+
|
|
143
|
+
0.x 버전은 API가 아직 안정적이지 않습니다. 하위 호환이 깨지는 변경은
|
|
144
|
+
[CHANGELOG](https://gitlab.com/wkqco33/ros-streamer/blob/master/CHANGELOG.md)에
|
|
145
|
+
기록합니다.
|
|
146
|
+
|
|
147
|
+
## 문서
|
|
148
|
+
|
|
149
|
+
* 저장소·서버 노드·프로토콜: <https://gitlab.com/wkqco33/ros-streamer#readme>
|
|
150
|
+
* 이슈/요청: <https://gitlab.com/wkqco33/ros-streamer/-/issues>
|
|
151
|
+
|
|
152
|
+
## 라이선스
|
|
153
|
+
|
|
154
|
+
Apache-2.0 ([LICENSE](https://gitlab.com/wkqco33/ros-streamer/blob/master/LICENSE)).
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# ros-stream-viewer
|
|
2
|
+
|
|
3
|
+
[ROS Streamer](https://gitlab.com/wkqco33/ros-streamer) 서버가 ZMQ로 발행하는
|
|
4
|
+
카메라 이미지를 구독해 화면에 표시하는 CLI입니다. ROS 설치 없이 단독 실행되며,
|
|
5
|
+
Python 3.12+ 에서 동작합니다.
|
|
6
|
+
|
|
7
|
+
```console
|
|
8
|
+
# 설치 없이 실행 (권장)
|
|
9
|
+
uvx ros-streamer stream --host <HOST> --port 5556
|
|
10
|
+
|
|
11
|
+
# 설치
|
|
12
|
+
uv tool install ros-streamer # 또는: pip install ros-streamer
|
|
13
|
+
ros-stream-viewer stream
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
> `ros-streamer`, `ros-stream-viewer`, `rviewer`는 동일한 실행 파일입니다.
|
|
17
|
+
|
|
18
|
+
## 빠른 시작
|
|
19
|
+
|
|
20
|
+
```console
|
|
21
|
+
# compressed(JPEG) 스트림 표시 (서버 base+1, 기본 5556)
|
|
22
|
+
ros-stream-viewer stream
|
|
23
|
+
|
|
24
|
+
# raw 스트림 표시 (서버 base, 기본 5555)
|
|
25
|
+
ros-stream-viewer stream --port 5555 --stream-type raw
|
|
26
|
+
|
|
27
|
+
# 창 없이 100프레임만 수신하고 JSON 요약을 stdout으로 출력 (CI/스크립트)
|
|
28
|
+
ros-stream-viewer stream --headless --max-frames 100 --json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
표시 중 단축키: `i` 정보 오버레이 토글 · `p`/Space 일시정지 · `s` PNG 스냅샷 ·
|
|
32
|
+
`v` mp4 녹화 · `f` 전체화면 · `q`/ESC 종료.
|
|
33
|
+
|
|
34
|
+
## 주요 플래그
|
|
35
|
+
|
|
36
|
+
| 플래그 | 설명 | 기본값 |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| `--host` | 서버 호스트 | `localhost` |
|
|
39
|
+
| `--port` | ZMQ 포트 (서버 규약: base=raw, base+1=compressed) | `5556` |
|
|
40
|
+
| `--stream-type` | `auto`(매직 자동 판별) / `raw` / `compressed` | `auto` |
|
|
41
|
+
| `--width`, `--height` | 헤더 없는 raw 스트림의 해상도 (헤더가 있으면 무시) | `640x480` |
|
|
42
|
+
| `--connect-timeout` | 첫 프레임 대기 시간(초). 초과 시 종료 코드 4 (`0`=무한) | `5` |
|
|
43
|
+
| `--stall-timeout` | 수신이 멈춘 것으로 경고할 임계(초, `0`=끄기) | `3` |
|
|
44
|
+
| `--max-frames`, `--duration` | N프레임/N초 후 종료 (`0`=무제한) | `0` |
|
|
45
|
+
| `--snapshot-dir` | `s`/`v` 저장 디렉터리 | 현재 디렉터리 |
|
|
46
|
+
| `--network-info` | 네트워크 정보 오버레이 (`--network-info=false`로 끔) | `true` |
|
|
47
|
+
| `--headless` | 창 없이 통계만 로그로 출력 | `false` |
|
|
48
|
+
| `--json` | 실행 요약(JSON)을 stdout으로 출력 | `false` |
|
|
49
|
+
| `-q`, `--quiet` / `-d`, `--debug` | 경고만 출력 / DEBUG 로그 출력 | - |
|
|
50
|
+
| `--config`, `--dotenv` | 설정 파일 / `.env` 경로 | - |
|
|
51
|
+
| `--log-level`, `--log-file` | 로그 레벨 / JSON Lines 로그 파일 | `INFO` / - |
|
|
52
|
+
| `--no-color` | 색상 출력 끄기 | - |
|
|
53
|
+
|
|
54
|
+
## 설정
|
|
55
|
+
|
|
56
|
+
우선순위는 **플래그 > 환경변수 > `.env` > 설정 파일 > 기본값**이며, 환경변수
|
|
57
|
+
prefix는 `ROS_STREAMER`, 중첩 키 구분자는 `__`입니다.
|
|
58
|
+
|
|
59
|
+
```console
|
|
60
|
+
ROS_STREAMER_STREAM__HOST=10.0.0.2 ROS_STREAMER_STREAM__PORT=15555 \
|
|
61
|
+
ros-stream-viewer stream
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
설정 파일(JSON/TOML/YAML)은 `--config`로 지정합니다. 지정하지 않으면
|
|
65
|
+
`.env`와 OS 설정 디렉터리(`$XDG_CONFIG_HOME/ros-streamer/config.toml`,
|
|
66
|
+
macOS는 `~/Library/Application Support`, Windows는 `%APPDATA%`)의
|
|
67
|
+
`config.{toml,yaml,yml,json}`을 자동으로 찾습니다.
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
# viewer.yaml
|
|
71
|
+
stream:
|
|
72
|
+
host: 10.0.0.2
|
|
73
|
+
port: 5555
|
|
74
|
+
type: raw
|
|
75
|
+
connect_timeout: 5.0
|
|
76
|
+
network_info: false
|
|
77
|
+
logging:
|
|
78
|
+
level: INFO
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
불리언은 `true/false/1/0/yes/no/on/off`(대소문자 무관)만 인정합니다.
|
|
82
|
+
해석할 수 없는 값은 기본값으로, 해석됐지만 규약을 벗어난 값(포트 범위 등)은
|
|
83
|
+
종료 코드 2로 거부합니다.
|
|
84
|
+
|
|
85
|
+
## 출력과 종료 코드
|
|
86
|
+
|
|
87
|
+
결과(도움말, `--json` 요약)는 **stdout**, 로그·진행·오류는 **stderr**로
|
|
88
|
+
나갑니다.
|
|
89
|
+
|
|
90
|
+
```console
|
|
91
|
+
$ ros-stream-viewer stream --headless --max-frames 100 --json 2>/dev/null
|
|
92
|
+
{"backlog_skipped": 0, "decode_errors": 0, "dropped_frames": 0, "exit_code": 0,
|
|
93
|
+
"fps": 30.0, "frames": 100, "frames_processed": 100, "host": "localhost",
|
|
94
|
+
"latency_ms": 0.4, "port": 5556, "resolution": "640x480", "status": "ok", ...}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
| 코드 | 의미 |
|
|
98
|
+
| --- | --- |
|
|
99
|
+
| 0 | 정상 종료(사용자 종료, `--max-frames`/`--duration` 도달 포함) |
|
|
100
|
+
| 1 | 예기치 않은 시스템 오류 |
|
|
101
|
+
| 2 | 사용법/설정 오류 |
|
|
102
|
+
| 3 | 뷰어 서비스 시작 실패(ZMQ 소켓 생성/연결 실패) |
|
|
103
|
+
| 4 | 실행 중 서비스 실패(첫 프레임 타임아웃, 소켓/프로토콜 오류) |
|
|
104
|
+
|
|
105
|
+
## 요구 사항과 지원 범위
|
|
106
|
+
|
|
107
|
+
* Python **3.12 / 3.13** (CI에서 두 버전 모두 테스트)
|
|
108
|
+
* Linux/macOS/Windows. GUI 표시에는 OpenCV 창이 필요하며, 헤드리스 환경에서는
|
|
109
|
+
`--headless`를 사용하세요.
|
|
110
|
+
* 일부 Linux 배포판은 OpenCV 런타임 의존성(`libGL`)이 필요합니다:
|
|
111
|
+
`apt-get install -y libgl1 libglib2.0-0`
|
|
112
|
+
* ROS 서버 없이도 동작하며, ROS 패키지는 필요하지 않습니다.
|
|
113
|
+
|
|
114
|
+
0.x 버전은 API가 아직 안정적이지 않습니다. 하위 호환이 깨지는 변경은
|
|
115
|
+
[CHANGELOG](https://gitlab.com/wkqco33/ros-streamer/blob/master/CHANGELOG.md)에
|
|
116
|
+
기록합니다.
|
|
117
|
+
|
|
118
|
+
## 문서
|
|
119
|
+
|
|
120
|
+
* 저장소·서버 노드·프로토콜: <https://gitlab.com/wkqco33/ros-streamer#readme>
|
|
121
|
+
* 이슈/요청: <https://gitlab.com/wkqco33/ros-streamer/-/issues>
|
|
122
|
+
|
|
123
|
+
## 라이선스
|
|
124
|
+
|
|
125
|
+
Apache-2.0 ([LICENSE](https://gitlab.com/wkqco33/ros-streamer/blob/master/LICENSE)).
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ros-streamer"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "ROS 2 카메라 이미지를 ZMQ로 스트리밍하는 뷰어 CLI (uvx로 실행 가능)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "wkqco33" }]
|
|
14
|
+
keywords = ["ros2", "zmq", "camera", "streaming", "viewer", "opencv"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Environment :: Console",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Topic :: Multimedia :: Video",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"numpy>=2.0",
|
|
27
|
+
"opencv-python>=4.10",
|
|
28
|
+
"pyzmq>=27.1.0",
|
|
29
|
+
"wpycli>=0.3.1",
|
|
30
|
+
"wpyconf>=0.2.5",
|
|
31
|
+
"wpylog>=0.2.0",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://gitlab.com/wkqco33/ros-streamer"
|
|
36
|
+
Repository = "https://gitlab.com/wkqco33/ros-streamer"
|
|
37
|
+
Issues = "https://gitlab.com/wkqco33/ros-streamer/-/issues"
|
|
38
|
+
|
|
39
|
+
[dependency-groups]
|
|
40
|
+
dev = [
|
|
41
|
+
"mypy>=1.11",
|
|
42
|
+
"pytest>=8.0",
|
|
43
|
+
"pytest-cov>=5.0",
|
|
44
|
+
"ruff>=0.6",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[project.scripts]
|
|
48
|
+
# `uvx ros-streamer ...`로 실행되도록 패키지명과 동일한 엔트리포인트를 둔다.
|
|
49
|
+
ros-streamer = "ros_stream_viewer.viewer:main"
|
|
50
|
+
ros-stream-viewer = "ros_stream_viewer.viewer:main"
|
|
51
|
+
rviewer = "ros_stream_viewer.viewer:main"
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.packages.find]
|
|
54
|
+
# src 레이아웃: 패키지는 `client/src/` 아래에 둔다(server의 colcon src 레이아웃과 대칭).
|
|
55
|
+
where = ["src"]
|
|
56
|
+
include = ["ros_stream_viewer*"]
|
|
57
|
+
|
|
58
|
+
[tool.ruff]
|
|
59
|
+
line-length = 99
|
|
60
|
+
target-version = "py312"
|
|
61
|
+
# 이 설정은 client/ 기준으로 동작한다. `make viewer-lint` 또는
|
|
62
|
+
# `uv run --directory client ruff check .` 로 실행한다.
|
|
63
|
+
exclude = [".venv", "build", "dist"]
|
|
64
|
+
|
|
65
|
+
[tool.ruff.lint]
|
|
66
|
+
select = ["E", "F", "I", "UP", "B", "SIM"]
|
|
67
|
+
|
|
68
|
+
[tool.mypy]
|
|
69
|
+
python_version = "3.12"
|
|
70
|
+
ignore_missing_imports = true
|
|
71
|
+
warn_unused_ignores = true
|
|
72
|
+
mypy_path = "src"
|
|
73
|
+
|
|
74
|
+
[tool.pytest.ini_options]
|
|
75
|
+
testpaths = ["tests"]
|
|
76
|
+
# 공용 테스트 더블은 tests/support.py로 import한다. 기본 import 모드뿐 아니라
|
|
77
|
+
# --import-mode=importlib(기반 디렉터리를 sys.path에 넣지 않음)에서도 동작하도록
|
|
78
|
+
# pythonpath로 tests 디렉터리를 명시한다. scripts는 릴리스 게이트
|
|
79
|
+
# (scripts/check_release.py)를 직접 import하기 위해 넣는다.
|
|
80
|
+
pythonpath = ["tests", "scripts"]
|
|
81
|
+
# 커버리지는 `task client:coverage`(또는 -p pytest_cov)로 별도 실행한다.
|
|
82
|
+
# PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 환경에서는 --cov가 addopts에 있으면
|
|
83
|
+
# 플러그인이 로드되지 않아 pytest가 인자를 거부하기 때문이다.
|
|
84
|
+
|
|
85
|
+
[tool.coverage.run]
|
|
86
|
+
source = ["ros_stream_viewer"]
|
|
87
|
+
|
|
88
|
+
[tool.coverage.report]
|
|
89
|
+
exclude_lines = [
|
|
90
|
+
"if TYPE_CHECKING:",
|
|
91
|
+
"pragma: no cover",
|
|
92
|
+
'^\.\.\.$',
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
[tool.pyright]
|
|
96
|
+
venvPath = "."
|
|
97
|
+
venv = ".venv"
|
|
98
|
+
pythonVersion = "3.12"
|
|
99
|
+
extraPaths = ["src", "tests", "scripts"]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""ros_stream_viewer: ZMQ 카메라 스트림 뷰어."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
# 설치된 배포 메타데이터에서 버전을 읽어 pyproject와 어긋나지 않게 한다.
|
|
9
|
+
__version__ = version("ros-streamer")
|
|
10
|
+
except PackageNotFoundError: # 소스 트리에서 직접 실행하는 경우
|
|
11
|
+
__version__ = "0.1.0"
|
|
12
|
+
|
|
13
|
+
__all__ = ["__version__"]
|