zero-franky 0.1.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nick Walker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,196 @@
1
+ Metadata-Version: 2.4
2
+ Name: zero-franky
3
+ Version: 0.1.0
4
+ Summary: ZeroMQ client/server bridge for franky
5
+ Author: Nick Walker
6
+ Requires-Python: <3.13,>=3.12
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: pyzmq>=26.0.0
10
+ Requires-Dist: msgpack>=1.0.0
11
+ Requires-Dist: cloudpickle>=3.0.0
12
+ Provides-Extra: server
13
+ Requires-Dist: franky-control; extra == "server"
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
16
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
17
+ Dynamic: license-file
18
+
19
+ # zero-franky
20
+
21
+ Use `franky` from a non-realtime machine through a ZeroMQ protocol.
22
+
23
+ ```mermaid
24
+ flowchart LR
25
+ subgraph Client["client process"]
26
+ App["user code"]
27
+ LocalFranky["local franky construction objects"]
28
+ Proxy["zero-franky Robot proxy"]
29
+ end
30
+
31
+ subgraph Server["robot host process"]
32
+ Rpc["ZeroMQ RPC server"]
33
+ Builder["motion/policy builders"]
34
+ Session["tracker session policy loop"]
35
+ Handle["franky reference handle"]
36
+ RemoteFranky["real franky Robot"]
37
+ Pub["ZeroMQ state publisher"]
38
+ end
39
+
40
+ Robot["Franka robot"]
41
+
42
+ App --> LocalFranky
43
+ LocalFranky --> Proxy
44
+ App --> Proxy
45
+ Proxy -- "RPC: msgpack motion payloads" --> Rpc
46
+ Proxy -- "RPC: import ref or cloudpickle policy" --> Rpc
47
+ Rpc --> Builder
48
+ Builder --> RemoteFranky
49
+ Builder --> Session
50
+ Session -- "local update loop" --> Handle
51
+ Handle --> RemoteFranky
52
+ RemoteFranky <--> Robot
53
+ RemoteFranky --> Pub
54
+ Pub -- "SUB: robot.state" --> App
55
+ ```
56
+
57
+ ## Usage
58
+
59
+ `zero-franky` keeps the client-side construction style familiar:
60
+
61
+ ```python
62
+ from zero_franky import setup_zero_franky
63
+ from zero_franky import Robot
64
+ from franky import Affine, CartesianMotion, ReferenceType
65
+
66
+ setup_zero_franky("server-ip", 18812)
67
+
68
+ robot = Robot("192.168.100.1")
69
+ motion = CartesianMotion(Affine([0.2, 0.0, 0.0]), ReferenceType.Relative)
70
+ robot.move(motion, asynchronous=True)
71
+ robot.join_motion()
72
+ ```
73
+
74
+ `Robot` is a proxy, and real local `franky` objects like `Affine`, `CartesianMotion`, and `JointMotion` are encoded into plain msgpack payloads. The server reconstructs corresponding real `franky` objects next to the robot.
75
+
76
+ ## Server
77
+
78
+ On the robot host:
79
+
80
+ ```bash
81
+ zero-franky-server
82
+ ```
83
+
84
+ By default this binds RPC on `tcp://0.0.0.0:18812`, state PUB on `tcp://0.0.0.0:18813`, and tracker updates on `tcp://0.0.0.0:18814`.
85
+
86
+ Common overrides:
87
+
88
+ ```bash
89
+ zero-franky-server --host 192.168.1.20 --port 18812
90
+ zero-franky-server --port 19000 --no-pub
91
+ ```
92
+
93
+ The equivalent Python entry point is:
94
+
95
+ ```python
96
+ from zero_franky.zmq_server import ZmqRobotServer
97
+
98
+ ZmqRobotServer(
99
+ bind="tcp://0.0.0.0:18812",
100
+ pub_bind="tcp://0.0.0.0:18813",
101
+ tracker_bind="tcp://0.0.0.0:18814",
102
+ ).serve_forever()
103
+ ```
104
+
105
+ ## Implemented protocol
106
+
107
+ - `robot.create`
108
+ - `robot.recover_from_errors`
109
+ - `robot.move`
110
+ - `robot.join_motion`
111
+ - `robot.poll_motion`
112
+ - `robot.stop`
113
+ - `robot.get_last_teleop_state`
114
+ - `robot.start_joint_tracker`
115
+ - `robot.start_cartesian_tracker`
116
+ - `tracker.status`
117
+ - `tracker.stop`
118
+ - `tracker.set_joint_reference`
119
+ - `tracker.set_cartesian_reference`
120
+
121
+ Supported motion payloads cover position, velocity, waypoint, stop, and fixed impedance motions. Tracker motions are exposed through tracker sessions rather than serialized as ordinary motion objects.
122
+
123
+ ## Telemetry
124
+
125
+ When the server has a `pub_bind`, `RobotManager` registers a motion callback and publishes snapshots on `robot.state`.
126
+
127
+ ```python
128
+ setup_zero_franky("server-ip", 18812)
129
+ subscriber = robot.state_subscriber()
130
+ topic, state = subscriber.recv()
131
+ ```
132
+
133
+ ## Tracker Sessions
134
+
135
+ Tracker sessions are for `JointImpedanceTrackingMotion` and `CartesianImpedanceTrackingMotion`. They keep the impedance motion and reference handle on the robot host, then run a Python policy loop beside that handle. This avoids trying to servo over ZeroMQ while still letting client code define the policy.
136
+
137
+ There are two policy transports:
138
+
139
+ - `import`: send `module` + `qualname`; the server imports the policy. Use this for stable policies installed on the robot host.
140
+ - `cloudpickle`: serialize the function and send it over RPC. Use this for exploratory work on a trusted control network.
141
+
142
+ The built-in hold policies are importable:
143
+
144
+ ```python
145
+ from zero_franky.tracker_policies import hold_current_joint
146
+
147
+ session = robot.start_joint_impedance_session(
148
+ hold_current_joint,
149
+ stiffness=[10.0] * 7,
150
+ damping=[6.0] * 7,
151
+ )
152
+ ```
153
+
154
+ Or it can be shipped with `cloudpickle` for exploratory work:
155
+
156
+ ```python
157
+ def hold_here(context):
158
+ q = list(context.robot.current_joint_positions)
159
+
160
+ def step(_context):
161
+ return {"position": q, "velocity": [0.0] * 7}
162
+
163
+ return step
164
+
165
+ session = robot.start_joint_impedance_session(
166
+ hold_here,
167
+ policy_transport="cloudpickle",
168
+ stiffness=[10.0] * 7,
169
+ )
170
+ ```
171
+
172
+ `cloudpickle` policy transport executes client-provided Python on the robot host. Use it only on a trusted control network.
173
+
174
+ Cartesian sessions use the same policy shape and return an `Affine` target:
175
+
176
+ ```python
177
+ from zero_franky.tracker_policies import hold_current_cartesian
178
+
179
+ session = robot.start_cartesian_impedance_session(
180
+ hold_current_cartesian,
181
+ translational_stiffness=250.0,
182
+ rotational_stiffness=25.0,
183
+ )
184
+ ```
185
+
186
+ The policy function receives a context with `franky`, `robot`, `elapsed`, `iterations`, and `stop()`. A factory may return a step function, or the policy may act directly as the step function. Joint steps return `{"position": q, "velocity": dq, "torque_feedforward": tau}`. Cartesian steps return `{"target": affine, "target_twist": twist}`.
187
+
188
+ Sessions return a small proxy:
189
+
190
+ ```python
191
+ status = session.status()
192
+ session.set_joint_reference(q, velocity=dq)
193
+ session.stop()
194
+ ```
195
+
196
+ `set_joint_reference` and `set_cartesian_reference` are mainly useful for operator overrides or lower-rate supervision. High-rate behavior should live inside the remote policy loop.
@@ -0,0 +1,178 @@
1
+ # zero-franky
2
+
3
+ Use `franky` from a non-realtime machine through a ZeroMQ protocol.
4
+
5
+ ```mermaid
6
+ flowchart LR
7
+ subgraph Client["client process"]
8
+ App["user code"]
9
+ LocalFranky["local franky construction objects"]
10
+ Proxy["zero-franky Robot proxy"]
11
+ end
12
+
13
+ subgraph Server["robot host process"]
14
+ Rpc["ZeroMQ RPC server"]
15
+ Builder["motion/policy builders"]
16
+ Session["tracker session policy loop"]
17
+ Handle["franky reference handle"]
18
+ RemoteFranky["real franky Robot"]
19
+ Pub["ZeroMQ state publisher"]
20
+ end
21
+
22
+ Robot["Franka robot"]
23
+
24
+ App --> LocalFranky
25
+ LocalFranky --> Proxy
26
+ App --> Proxy
27
+ Proxy -- "RPC: msgpack motion payloads" --> Rpc
28
+ Proxy -- "RPC: import ref or cloudpickle policy" --> Rpc
29
+ Rpc --> Builder
30
+ Builder --> RemoteFranky
31
+ Builder --> Session
32
+ Session -- "local update loop" --> Handle
33
+ Handle --> RemoteFranky
34
+ RemoteFranky <--> Robot
35
+ RemoteFranky --> Pub
36
+ Pub -- "SUB: robot.state" --> App
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ `zero-franky` keeps the client-side construction style familiar:
42
+
43
+ ```python
44
+ from zero_franky import setup_zero_franky
45
+ from zero_franky import Robot
46
+ from franky import Affine, CartesianMotion, ReferenceType
47
+
48
+ setup_zero_franky("server-ip", 18812)
49
+
50
+ robot = Robot("192.168.100.1")
51
+ motion = CartesianMotion(Affine([0.2, 0.0, 0.0]), ReferenceType.Relative)
52
+ robot.move(motion, asynchronous=True)
53
+ robot.join_motion()
54
+ ```
55
+
56
+ `Robot` is a proxy, and real local `franky` objects like `Affine`, `CartesianMotion`, and `JointMotion` are encoded into plain msgpack payloads. The server reconstructs corresponding real `franky` objects next to the robot.
57
+
58
+ ## Server
59
+
60
+ On the robot host:
61
+
62
+ ```bash
63
+ zero-franky-server
64
+ ```
65
+
66
+ By default this binds RPC on `tcp://0.0.0.0:18812`, state PUB on `tcp://0.0.0.0:18813`, and tracker updates on `tcp://0.0.0.0:18814`.
67
+
68
+ Common overrides:
69
+
70
+ ```bash
71
+ zero-franky-server --host 192.168.1.20 --port 18812
72
+ zero-franky-server --port 19000 --no-pub
73
+ ```
74
+
75
+ The equivalent Python entry point is:
76
+
77
+ ```python
78
+ from zero_franky.zmq_server import ZmqRobotServer
79
+
80
+ ZmqRobotServer(
81
+ bind="tcp://0.0.0.0:18812",
82
+ pub_bind="tcp://0.0.0.0:18813",
83
+ tracker_bind="tcp://0.0.0.0:18814",
84
+ ).serve_forever()
85
+ ```
86
+
87
+ ## Implemented protocol
88
+
89
+ - `robot.create`
90
+ - `robot.recover_from_errors`
91
+ - `robot.move`
92
+ - `robot.join_motion`
93
+ - `robot.poll_motion`
94
+ - `robot.stop`
95
+ - `robot.get_last_teleop_state`
96
+ - `robot.start_joint_tracker`
97
+ - `robot.start_cartesian_tracker`
98
+ - `tracker.status`
99
+ - `tracker.stop`
100
+ - `tracker.set_joint_reference`
101
+ - `tracker.set_cartesian_reference`
102
+
103
+ Supported motion payloads cover position, velocity, waypoint, stop, and fixed impedance motions. Tracker motions are exposed through tracker sessions rather than serialized as ordinary motion objects.
104
+
105
+ ## Telemetry
106
+
107
+ When the server has a `pub_bind`, `RobotManager` registers a motion callback and publishes snapshots on `robot.state`.
108
+
109
+ ```python
110
+ setup_zero_franky("server-ip", 18812)
111
+ subscriber = robot.state_subscriber()
112
+ topic, state = subscriber.recv()
113
+ ```
114
+
115
+ ## Tracker Sessions
116
+
117
+ Tracker sessions are for `JointImpedanceTrackingMotion` and `CartesianImpedanceTrackingMotion`. They keep the impedance motion and reference handle on the robot host, then run a Python policy loop beside that handle. This avoids trying to servo over ZeroMQ while still letting client code define the policy.
118
+
119
+ There are two policy transports:
120
+
121
+ - `import`: send `module` + `qualname`; the server imports the policy. Use this for stable policies installed on the robot host.
122
+ - `cloudpickle`: serialize the function and send it over RPC. Use this for exploratory work on a trusted control network.
123
+
124
+ The built-in hold policies are importable:
125
+
126
+ ```python
127
+ from zero_franky.tracker_policies import hold_current_joint
128
+
129
+ session = robot.start_joint_impedance_session(
130
+ hold_current_joint,
131
+ stiffness=[10.0] * 7,
132
+ damping=[6.0] * 7,
133
+ )
134
+ ```
135
+
136
+ Or it can be shipped with `cloudpickle` for exploratory work:
137
+
138
+ ```python
139
+ def hold_here(context):
140
+ q = list(context.robot.current_joint_positions)
141
+
142
+ def step(_context):
143
+ return {"position": q, "velocity": [0.0] * 7}
144
+
145
+ return step
146
+
147
+ session = robot.start_joint_impedance_session(
148
+ hold_here,
149
+ policy_transport="cloudpickle",
150
+ stiffness=[10.0] * 7,
151
+ )
152
+ ```
153
+
154
+ `cloudpickle` policy transport executes client-provided Python on the robot host. Use it only on a trusted control network.
155
+
156
+ Cartesian sessions use the same policy shape and return an `Affine` target:
157
+
158
+ ```python
159
+ from zero_franky.tracker_policies import hold_current_cartesian
160
+
161
+ session = robot.start_cartesian_impedance_session(
162
+ hold_current_cartesian,
163
+ translational_stiffness=250.0,
164
+ rotational_stiffness=25.0,
165
+ )
166
+ ```
167
+
168
+ The policy function receives a context with `franky`, `robot`, `elapsed`, `iterations`, and `stop()`. A factory may return a step function, or the policy may act directly as the step function. Joint steps return `{"position": q, "velocity": dq, "torque_feedforward": tau}`. Cartesian steps return `{"target": affine, "target_twist": twist}`.
169
+
170
+ Sessions return a small proxy:
171
+
172
+ ```python
173
+ status = session.status()
174
+ session.set_joint_reference(q, velocity=dq)
175
+ session.stop()
176
+ ```
177
+
178
+ `set_joint_reference` and `set_cartesian_reference` are mainly useful for operator overrides or lower-rate supervision. High-rate behavior should live inside the remote policy loop.
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "zero-franky"
7
+ version = "0.1.0"
8
+ description = "ZeroMQ client/server bridge for franky"
9
+ readme = "README.md"
10
+ requires-python = ">=3.12,<3.13"
11
+ authors = [
12
+ { name = "Nick Walker" }
13
+ ]
14
+
15
+ dependencies = [
16
+ "pyzmq>=26.0.0",
17
+ "msgpack>=1.0.0",
18
+ "cloudpickle>=3.0.0"
19
+ ]
20
+
21
+ [project.scripts]
22
+ zero-franky-server = "zero_franky.server_cli:main"
23
+ zero_franky_server = "zero_franky.server_cli:main"
24
+
25
+ [project.optional-dependencies]
26
+
27
+ server = [
28
+ "franky-control"
29
+ ]
30
+
31
+ dev = [
32
+ "pytest>=7.0.0",
33
+ "pytest-cov>=4.0.0"
34
+ ]
35
+
36
+ [tool.uv.sources]
37
+ franky-control = { url = "https://github.com/nickswalker/franky/releases/download/wheels-libfranka-0.21.1/franky_control-1.1.3+impedance.libfranka.0.21.1-cp312-cp312-manylinux_2_28_x86_64.whl" }
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,4 @@
1
+ from .setup import setup_zero_franky
2
+ from .zmq_client import RobotProxy as Robot
3
+
4
+ __all__ = ["Robot", "setup_zero_franky"]