remotecaptury 1.0.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.
- remotecaptury-1.0.0/MANIFEST.in +4 -0
- remotecaptury-1.0.0/PKG-INFO +164 -0
- remotecaptury-1.0.0/README.md +135 -0
- remotecaptury-1.0.0/pyproject.toml +36 -0
- remotecaptury-1.0.0/remotecaptury/__init__.py +3 -0
- remotecaptury-1.0.0/remotecaptury/interface.py +65 -0
- remotecaptury-1.0.0/remotecaptury.egg-info/PKG-INFO +164 -0
- remotecaptury-1.0.0/remotecaptury.egg-info/SOURCES.txt +15 -0
- remotecaptury-1.0.0/remotecaptury.egg-info/dependency_links.txt +1 -0
- remotecaptury-1.0.0/remotecaptury.egg-info/not-zip-safe +1 -0
- remotecaptury-1.0.0/remotecaptury.egg-info/top_level.txt +2 -0
- remotecaptury-1.0.0/setup.cfg +4 -0
- remotecaptury-1.0.0/setup.py +22 -0
- remotecaptury-1.0.0/src/RemoteCaptury.cpp +3350 -0
- remotecaptury-1.0.0/src/RemoteCaptury.h +924 -0
- remotecaptury-1.0.0/src/bindings.cpp +198 -0
- remotecaptury-1.0.0/src/captury/PublicStructs.h +215 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: remotecaptury
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python wrapper for RemoteCaptury - stream motion capture data from CapturyLive
|
|
5
|
+
Author: Captury
|
|
6
|
+
Author-email: The Captury <info@thecaptury.com>
|
|
7
|
+
License: Proprietary
|
|
8
|
+
Project-URL: Homepage, https://thecaptury.com
|
|
9
|
+
Project-URL: Documentation, https://github.com/thecaptury/RemoteCaptury
|
|
10
|
+
Project-URL: Repository, https://github.com/thecaptury/RemoteCaptury
|
|
11
|
+
Keywords: mocap,motion-capture,captury,streaming
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Multimedia :: Graphics :: Capture
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: C++
|
|
26
|
+
Requires-Python: >=3.6
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
Dynamic: author
|
|
29
|
+
|
|
30
|
+
# RemoteCaptury Python Wrapper
|
|
31
|
+
|
|
32
|
+
A Pythonic wrapper for the RemoteCaptury library, providing an easy-to-use interface for streaming motion capture data from CapturyLive.
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- **Callback-based API**: Register Python callbacks for pose data and actor status changes
|
|
37
|
+
- **Pythonic Interface**: Clean, object-oriented API that feels natural in Python
|
|
38
|
+
- **Easy Installation**: Install via pip with automatic C++ extension building
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
### From Source
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
cd python
|
|
46
|
+
pip install .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Requirements
|
|
50
|
+
|
|
51
|
+
- Python 3.6+
|
|
52
|
+
- C++ compiler (g++ on Linux, MSVC on Windows)
|
|
53
|
+
- CapturyLive server running
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from remotecaptury import RemoteCaptury
|
|
59
|
+
import time
|
|
60
|
+
|
|
61
|
+
# Define callbacks
|
|
62
|
+
def on_pose(actor_id, pose):
|
|
63
|
+
print(f"Received pose for actor {actor_id}")
|
|
64
|
+
print(f" Timestamp: {pose['timestamp']}")
|
|
65
|
+
print(f" Transforms: {len(pose['transforms'])}")
|
|
66
|
+
|
|
67
|
+
def on_actor(actor_id, mode):
|
|
68
|
+
print(f"Actor {actor_id} status changed to {mode}")
|
|
69
|
+
|
|
70
|
+
# Create client and connect
|
|
71
|
+
rc = RemoteCaptury()
|
|
72
|
+
rc.connect("127.0.0.1", 2101)
|
|
73
|
+
|
|
74
|
+
# Register callbacks
|
|
75
|
+
rc.register_pose_callback(on_pose)
|
|
76
|
+
rc.register_actor_callback(on_actor)
|
|
77
|
+
|
|
78
|
+
# Start streaming
|
|
79
|
+
rc.start_streaming()
|
|
80
|
+
|
|
81
|
+
# Let it run for a while
|
|
82
|
+
time.sleep(10)
|
|
83
|
+
|
|
84
|
+
# Clean up
|
|
85
|
+
rc.stop_streaming()
|
|
86
|
+
rc.disconnect()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## API Reference
|
|
90
|
+
|
|
91
|
+
### RemoteCaptury Class
|
|
92
|
+
|
|
93
|
+
#### `connect(host, port=2101)`
|
|
94
|
+
Connect to a CapturyLive server.
|
|
95
|
+
|
|
96
|
+
**Parameters:**
|
|
97
|
+
- `host` (str): IP address or hostname of the server
|
|
98
|
+
- `port` (int): Port number (default: 2101)
|
|
99
|
+
|
|
100
|
+
**Returns:** `bool` - True if connected successfully
|
|
101
|
+
|
|
102
|
+
#### `disconnect()`
|
|
103
|
+
Disconnect from the server.
|
|
104
|
+
|
|
105
|
+
#### `start_streaming(what=1)`
|
|
106
|
+
Start streaming data from the server.
|
|
107
|
+
|
|
108
|
+
**Parameters:**
|
|
109
|
+
- `what` (int): Bitmask of what to stream (default: 1 for poses)
|
|
110
|
+
|
|
111
|
+
**Returns:** `bool` - True if streaming started successfully
|
|
112
|
+
|
|
113
|
+
#### `stop_streaming()`
|
|
114
|
+
Stop streaming data.
|
|
115
|
+
|
|
116
|
+
**Returns:** `bool` - True if streaming stopped successfully
|
|
117
|
+
|
|
118
|
+
#### `register_pose_callback(callback)`
|
|
119
|
+
Register a callback function for new pose data.
|
|
120
|
+
|
|
121
|
+
**Parameters:**
|
|
122
|
+
- `callback` (callable): Function with signature `callback(actor_id: int, pose: dict)`
|
|
123
|
+
|
|
124
|
+
The `pose` dictionary contains:
|
|
125
|
+
- `actor` (int): Actor ID
|
|
126
|
+
- `timestamp` (int): Timestamp in microseconds
|
|
127
|
+
- `transforms` (list): List of transform dictionaries, each containing:
|
|
128
|
+
- `translation` (list): [x, y, z] translation
|
|
129
|
+
- `rotation` (list): [x, y, z] Euler angles
|
|
130
|
+
- `blendShapes` (list, optional): Blend shape activations
|
|
131
|
+
|
|
132
|
+
**Returns:** `bool` - True if callback registered successfully
|
|
133
|
+
|
|
134
|
+
#### `register_actor_callback(callback)`
|
|
135
|
+
Register a callback function for actor status changes.
|
|
136
|
+
|
|
137
|
+
**Parameters:**
|
|
138
|
+
- `callback` (callable): Function with signature `callback(actor_id: int, mode: int)`
|
|
139
|
+
|
|
140
|
+
Mode values:
|
|
141
|
+
- `0`: ACTOR_SCALING
|
|
142
|
+
- `1`: ACTOR_TRACKING
|
|
143
|
+
- `2`: ACTOR_STOPPED
|
|
144
|
+
- `3`: ACTOR_DELETED
|
|
145
|
+
- `4`: ACTOR_UNKNOWN
|
|
146
|
+
|
|
147
|
+
**Returns:** `bool` - True if callback registered successfully
|
|
148
|
+
|
|
149
|
+
## Testing
|
|
150
|
+
|
|
151
|
+
A test script is included:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Make sure CapturyLive is running
|
|
155
|
+
python test_remotecaptury.py
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
See the main RemoteCaptury license.
|
|
161
|
+
|
|
162
|
+
## Contributing
|
|
163
|
+
|
|
164
|
+
This is a wrapper around the RemoteCaptury C++ library. For issues with the underlying library, please refer to the main repository.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# RemoteCaptury Python Wrapper
|
|
2
|
+
|
|
3
|
+
A Pythonic wrapper for the RemoteCaptury library, providing an easy-to-use interface for streaming motion capture data from CapturyLive.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Callback-based API**: Register Python callbacks for pose data and actor status changes
|
|
8
|
+
- **Pythonic Interface**: Clean, object-oriented API that feels natural in Python
|
|
9
|
+
- **Easy Installation**: Install via pip with automatic C++ extension building
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
### From Source
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cd python
|
|
17
|
+
pip install .
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Requirements
|
|
21
|
+
|
|
22
|
+
- Python 3.6+
|
|
23
|
+
- C++ compiler (g++ on Linux, MSVC on Windows)
|
|
24
|
+
- CapturyLive server running
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from remotecaptury import RemoteCaptury
|
|
30
|
+
import time
|
|
31
|
+
|
|
32
|
+
# Define callbacks
|
|
33
|
+
def on_pose(actor_id, pose):
|
|
34
|
+
print(f"Received pose for actor {actor_id}")
|
|
35
|
+
print(f" Timestamp: {pose['timestamp']}")
|
|
36
|
+
print(f" Transforms: {len(pose['transforms'])}")
|
|
37
|
+
|
|
38
|
+
def on_actor(actor_id, mode):
|
|
39
|
+
print(f"Actor {actor_id} status changed to {mode}")
|
|
40
|
+
|
|
41
|
+
# Create client and connect
|
|
42
|
+
rc = RemoteCaptury()
|
|
43
|
+
rc.connect("127.0.0.1", 2101)
|
|
44
|
+
|
|
45
|
+
# Register callbacks
|
|
46
|
+
rc.register_pose_callback(on_pose)
|
|
47
|
+
rc.register_actor_callback(on_actor)
|
|
48
|
+
|
|
49
|
+
# Start streaming
|
|
50
|
+
rc.start_streaming()
|
|
51
|
+
|
|
52
|
+
# Let it run for a while
|
|
53
|
+
time.sleep(10)
|
|
54
|
+
|
|
55
|
+
# Clean up
|
|
56
|
+
rc.stop_streaming()
|
|
57
|
+
rc.disconnect()
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## API Reference
|
|
61
|
+
|
|
62
|
+
### RemoteCaptury Class
|
|
63
|
+
|
|
64
|
+
#### `connect(host, port=2101)`
|
|
65
|
+
Connect to a CapturyLive server.
|
|
66
|
+
|
|
67
|
+
**Parameters:**
|
|
68
|
+
- `host` (str): IP address or hostname of the server
|
|
69
|
+
- `port` (int): Port number (default: 2101)
|
|
70
|
+
|
|
71
|
+
**Returns:** `bool` - True if connected successfully
|
|
72
|
+
|
|
73
|
+
#### `disconnect()`
|
|
74
|
+
Disconnect from the server.
|
|
75
|
+
|
|
76
|
+
#### `start_streaming(what=1)`
|
|
77
|
+
Start streaming data from the server.
|
|
78
|
+
|
|
79
|
+
**Parameters:**
|
|
80
|
+
- `what` (int): Bitmask of what to stream (default: 1 for poses)
|
|
81
|
+
|
|
82
|
+
**Returns:** `bool` - True if streaming started successfully
|
|
83
|
+
|
|
84
|
+
#### `stop_streaming()`
|
|
85
|
+
Stop streaming data.
|
|
86
|
+
|
|
87
|
+
**Returns:** `bool` - True if streaming stopped successfully
|
|
88
|
+
|
|
89
|
+
#### `register_pose_callback(callback)`
|
|
90
|
+
Register a callback function for new pose data.
|
|
91
|
+
|
|
92
|
+
**Parameters:**
|
|
93
|
+
- `callback` (callable): Function with signature `callback(actor_id: int, pose: dict)`
|
|
94
|
+
|
|
95
|
+
The `pose` dictionary contains:
|
|
96
|
+
- `actor` (int): Actor ID
|
|
97
|
+
- `timestamp` (int): Timestamp in microseconds
|
|
98
|
+
- `transforms` (list): List of transform dictionaries, each containing:
|
|
99
|
+
- `translation` (list): [x, y, z] translation
|
|
100
|
+
- `rotation` (list): [x, y, z] Euler angles
|
|
101
|
+
- `blendShapes` (list, optional): Blend shape activations
|
|
102
|
+
|
|
103
|
+
**Returns:** `bool` - True if callback registered successfully
|
|
104
|
+
|
|
105
|
+
#### `register_actor_callback(callback)`
|
|
106
|
+
Register a callback function for actor status changes.
|
|
107
|
+
|
|
108
|
+
**Parameters:**
|
|
109
|
+
- `callback` (callable): Function with signature `callback(actor_id: int, mode: int)`
|
|
110
|
+
|
|
111
|
+
Mode values:
|
|
112
|
+
- `0`: ACTOR_SCALING
|
|
113
|
+
- `1`: ACTOR_TRACKING
|
|
114
|
+
- `2`: ACTOR_STOPPED
|
|
115
|
+
- `3`: ACTOR_DELETED
|
|
116
|
+
- `4`: ACTOR_UNKNOWN
|
|
117
|
+
|
|
118
|
+
**Returns:** `bool` - True if callback registered successfully
|
|
119
|
+
|
|
120
|
+
## Testing
|
|
121
|
+
|
|
122
|
+
A test script is included:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Make sure CapturyLive is running
|
|
126
|
+
python test_remotecaptury.py
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
See the main RemoteCaptury license.
|
|
132
|
+
|
|
133
|
+
## Contributing
|
|
134
|
+
|
|
135
|
+
This is a wrapper around the RemoteCaptury C++ library. For issues with the underlying library, please refer to the main repository.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=45", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "remotecaptury"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Python wrapper for RemoteCaptury - stream motion capture data from CapturyLive"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.6"
|
|
11
|
+
license = {text = "Proprietary"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "The Captury", email = "info@thecaptury.com"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["mocap", "motion-capture", "captury", "streaming"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Topic :: Multimedia :: Graphics :: Capture",
|
|
20
|
+
"Topic :: Scientific/Engineering",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.6",
|
|
23
|
+
"Programming Language :: Python :: 3.7",
|
|
24
|
+
"Programming Language :: Python :: 3.8",
|
|
25
|
+
"Programming Language :: Python :: 3.9",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Programming Language :: Python :: 3.13",
|
|
30
|
+
"Programming Language :: C++",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://thecaptury.com"
|
|
35
|
+
Documentation = "https://github.com/thecaptury/RemoteCaptury"
|
|
36
|
+
Repository = "https://github.com/thecaptury/RemoteCaptury"
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import _remotecaptury
|
|
2
|
+
|
|
3
|
+
class RemoteCaptury:
|
|
4
|
+
"""
|
|
5
|
+
A Pythonic wrapper for the RemoteCaptury library.
|
|
6
|
+
"""
|
|
7
|
+
def __init__(self):
|
|
8
|
+
self._connected = False
|
|
9
|
+
|
|
10
|
+
def connect(self, host, port=2101):
|
|
11
|
+
"""
|
|
12
|
+
Connect to the CapturyLive server.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
host (str): The IP address or hostname of the server.
|
|
16
|
+
port (int): The port number (default: 2101).
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
bool: True if connected successfully, False otherwise.
|
|
20
|
+
"""
|
|
21
|
+
if _remotecaptury.connect(host, port):
|
|
22
|
+
self._connected = True
|
|
23
|
+
return True
|
|
24
|
+
return False
|
|
25
|
+
|
|
26
|
+
def disconnect(self):
|
|
27
|
+
"""
|
|
28
|
+
Disconnect from the CapturyLive server.
|
|
29
|
+
"""
|
|
30
|
+
if self._connected:
|
|
31
|
+
_remotecaptury.disconnect()
|
|
32
|
+
self._connected = False
|
|
33
|
+
|
|
34
|
+
def start_streaming(self, what=1):
|
|
35
|
+
"""
|
|
36
|
+
Start streaming data.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
what (int): Bitmask of what to stream (default: 1 for poses).
|
|
40
|
+
"""
|
|
41
|
+
return _remotecaptury.startStreaming(what)
|
|
42
|
+
|
|
43
|
+
def stop_streaming(self):
|
|
44
|
+
"""
|
|
45
|
+
Stop streaming data.
|
|
46
|
+
"""
|
|
47
|
+
return _remotecaptury.stopStreaming()
|
|
48
|
+
|
|
49
|
+
def register_pose_callback(self, callback):
|
|
50
|
+
"""
|
|
51
|
+
Register a callback for new pose data.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
callback (callable): A function that takes (actor_id, pose_dict).
|
|
55
|
+
"""
|
|
56
|
+
return _remotecaptury.registerPoseCallback(callback)
|
|
57
|
+
|
|
58
|
+
def register_actor_callback(self, callback):
|
|
59
|
+
"""
|
|
60
|
+
Register a callback for actor status changes.
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
callback (callable): A function that takes (actor_id, mode).
|
|
64
|
+
"""
|
|
65
|
+
return _remotecaptury.registerActorCallback(callback)
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: remotecaptury
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python wrapper for RemoteCaptury - stream motion capture data from CapturyLive
|
|
5
|
+
Author: Captury
|
|
6
|
+
Author-email: The Captury <info@thecaptury.com>
|
|
7
|
+
License: Proprietary
|
|
8
|
+
Project-URL: Homepage, https://thecaptury.com
|
|
9
|
+
Project-URL: Documentation, https://github.com/thecaptury/RemoteCaptury
|
|
10
|
+
Project-URL: Repository, https://github.com/thecaptury/RemoteCaptury
|
|
11
|
+
Keywords: mocap,motion-capture,captury,streaming
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Multimedia :: Graphics :: Capture
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: C++
|
|
26
|
+
Requires-Python: >=3.6
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
Dynamic: author
|
|
29
|
+
|
|
30
|
+
# RemoteCaptury Python Wrapper
|
|
31
|
+
|
|
32
|
+
A Pythonic wrapper for the RemoteCaptury library, providing an easy-to-use interface for streaming motion capture data from CapturyLive.
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- **Callback-based API**: Register Python callbacks for pose data and actor status changes
|
|
37
|
+
- **Pythonic Interface**: Clean, object-oriented API that feels natural in Python
|
|
38
|
+
- **Easy Installation**: Install via pip with automatic C++ extension building
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
### From Source
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
cd python
|
|
46
|
+
pip install .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Requirements
|
|
50
|
+
|
|
51
|
+
- Python 3.6+
|
|
52
|
+
- C++ compiler (g++ on Linux, MSVC on Windows)
|
|
53
|
+
- CapturyLive server running
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from remotecaptury import RemoteCaptury
|
|
59
|
+
import time
|
|
60
|
+
|
|
61
|
+
# Define callbacks
|
|
62
|
+
def on_pose(actor_id, pose):
|
|
63
|
+
print(f"Received pose for actor {actor_id}")
|
|
64
|
+
print(f" Timestamp: {pose['timestamp']}")
|
|
65
|
+
print(f" Transforms: {len(pose['transforms'])}")
|
|
66
|
+
|
|
67
|
+
def on_actor(actor_id, mode):
|
|
68
|
+
print(f"Actor {actor_id} status changed to {mode}")
|
|
69
|
+
|
|
70
|
+
# Create client and connect
|
|
71
|
+
rc = RemoteCaptury()
|
|
72
|
+
rc.connect("127.0.0.1", 2101)
|
|
73
|
+
|
|
74
|
+
# Register callbacks
|
|
75
|
+
rc.register_pose_callback(on_pose)
|
|
76
|
+
rc.register_actor_callback(on_actor)
|
|
77
|
+
|
|
78
|
+
# Start streaming
|
|
79
|
+
rc.start_streaming()
|
|
80
|
+
|
|
81
|
+
# Let it run for a while
|
|
82
|
+
time.sleep(10)
|
|
83
|
+
|
|
84
|
+
# Clean up
|
|
85
|
+
rc.stop_streaming()
|
|
86
|
+
rc.disconnect()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## API Reference
|
|
90
|
+
|
|
91
|
+
### RemoteCaptury Class
|
|
92
|
+
|
|
93
|
+
#### `connect(host, port=2101)`
|
|
94
|
+
Connect to a CapturyLive server.
|
|
95
|
+
|
|
96
|
+
**Parameters:**
|
|
97
|
+
- `host` (str): IP address or hostname of the server
|
|
98
|
+
- `port` (int): Port number (default: 2101)
|
|
99
|
+
|
|
100
|
+
**Returns:** `bool` - True if connected successfully
|
|
101
|
+
|
|
102
|
+
#### `disconnect()`
|
|
103
|
+
Disconnect from the server.
|
|
104
|
+
|
|
105
|
+
#### `start_streaming(what=1)`
|
|
106
|
+
Start streaming data from the server.
|
|
107
|
+
|
|
108
|
+
**Parameters:**
|
|
109
|
+
- `what` (int): Bitmask of what to stream (default: 1 for poses)
|
|
110
|
+
|
|
111
|
+
**Returns:** `bool` - True if streaming started successfully
|
|
112
|
+
|
|
113
|
+
#### `stop_streaming()`
|
|
114
|
+
Stop streaming data.
|
|
115
|
+
|
|
116
|
+
**Returns:** `bool` - True if streaming stopped successfully
|
|
117
|
+
|
|
118
|
+
#### `register_pose_callback(callback)`
|
|
119
|
+
Register a callback function for new pose data.
|
|
120
|
+
|
|
121
|
+
**Parameters:**
|
|
122
|
+
- `callback` (callable): Function with signature `callback(actor_id: int, pose: dict)`
|
|
123
|
+
|
|
124
|
+
The `pose` dictionary contains:
|
|
125
|
+
- `actor` (int): Actor ID
|
|
126
|
+
- `timestamp` (int): Timestamp in microseconds
|
|
127
|
+
- `transforms` (list): List of transform dictionaries, each containing:
|
|
128
|
+
- `translation` (list): [x, y, z] translation
|
|
129
|
+
- `rotation` (list): [x, y, z] Euler angles
|
|
130
|
+
- `blendShapes` (list, optional): Blend shape activations
|
|
131
|
+
|
|
132
|
+
**Returns:** `bool` - True if callback registered successfully
|
|
133
|
+
|
|
134
|
+
#### `register_actor_callback(callback)`
|
|
135
|
+
Register a callback function for actor status changes.
|
|
136
|
+
|
|
137
|
+
**Parameters:**
|
|
138
|
+
- `callback` (callable): Function with signature `callback(actor_id: int, mode: int)`
|
|
139
|
+
|
|
140
|
+
Mode values:
|
|
141
|
+
- `0`: ACTOR_SCALING
|
|
142
|
+
- `1`: ACTOR_TRACKING
|
|
143
|
+
- `2`: ACTOR_STOPPED
|
|
144
|
+
- `3`: ACTOR_DELETED
|
|
145
|
+
- `4`: ACTOR_UNKNOWN
|
|
146
|
+
|
|
147
|
+
**Returns:** `bool` - True if callback registered successfully
|
|
148
|
+
|
|
149
|
+
## Testing
|
|
150
|
+
|
|
151
|
+
A test script is included:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Make sure CapturyLive is running
|
|
155
|
+
python test_remotecaptury.py
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
See the main RemoteCaptury license.
|
|
161
|
+
|
|
162
|
+
## Contributing
|
|
163
|
+
|
|
164
|
+
This is a wrapper around the RemoteCaptury C++ library. For issues with the underlying library, please refer to the main repository.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
MANIFEST.in
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
remotecaptury/__init__.py
|
|
6
|
+
remotecaptury/interface.py
|
|
7
|
+
remotecaptury.egg-info/PKG-INFO
|
|
8
|
+
remotecaptury.egg-info/SOURCES.txt
|
|
9
|
+
remotecaptury.egg-info/dependency_links.txt
|
|
10
|
+
remotecaptury.egg-info/not-zip-safe
|
|
11
|
+
remotecaptury.egg-info/top_level.txt
|
|
12
|
+
src/RemoteCaptury.cpp
|
|
13
|
+
src/RemoteCaptury.h
|
|
14
|
+
src/bindings.cpp
|
|
15
|
+
src/captury/PublicStructs.h
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from setuptools import setup, Extension, find_packages
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
# Define the extension module
|
|
5
|
+
sources = [
|
|
6
|
+
'src/bindings.cpp',
|
|
7
|
+
'src/RemoteCaptury.cpp'
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
module1 = Extension('_remotecaptury',
|
|
11
|
+
sources=sources,
|
|
12
|
+
include_dirs=['src'],
|
|
13
|
+
extra_compile_args=['-std=c++11'],
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
setup(name='remotecaptury',
|
|
17
|
+
version='1.0.0',
|
|
18
|
+
description='Python wrapper for RemoteCaptury',
|
|
19
|
+
author='Captury',
|
|
20
|
+
packages=find_packages(),
|
|
21
|
+
ext_modules=[module1],
|
|
22
|
+
zip_safe=False)
|