franky-control 1.0.2__cp311-cp311-manylinux_2_28_x86_64.whl → 1.1.0__cp311-cp311-manylinux_2_28_x86_64.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.
- franky/__init__.py +7 -2
- franky/_franky.cpython-311-x86_64-linux-gnu.so +0 -0
- franky/motion.py +8 -3
- franky/reaction.py +19 -8
- franky/robot_web_session.py +140 -51
- {franky_control-1.0.2.dist-info → franky_control-1.1.0.dist-info}/METADATA +127 -17
- franky_control-1.1.0.dist-info/RECORD +27 -0
- {franky_control-1.0.2.dist-info → franky_control-1.1.0.dist-info}/WHEEL +1 -1
- {franky_control-1.0.2.dist-info → franky_control-1.1.0.dist-info}/licenses/LICENSE +1 -1
- franky_control.libs/{libPocoFoundation-7333b9fc.so.95 → libPocoFoundation-91a48101.so.95} +0 -0
- franky_control.libs/{libPocoNet-007a41b7.so.95 → libPocoNet-9e586dc9.so.95} +0 -0
- franky_control.libs/libfranka-92ddaf43.so.0.15.0 +0 -0
- franky_control.libs/{libpinocchio_default-7b0164b0.so.3.1.0 → libpinocchio_default-53a889f9.so.3.1.0} +0 -0
- franky_control.libs/{libpinocchio_parsers-50abb87c.so.3.1.0 → libpinocchio_parsers-a0902fb5.so.3.1.0} +0 -0
- franky_control-1.0.2.dist-info/RECORD +0 -27
- {franky_control-1.0.2.dist-info → franky_control-1.1.0.dist-info}/top_level.txt +0 -0
franky/__init__.py
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
from .robot import Robot
|
2
|
-
from .robot_web_session import
|
2
|
+
from .robot_web_session import (
|
3
|
+
RobotWebSession,
|
4
|
+
RobotWebSessionError,
|
5
|
+
FrankaAPIError,
|
6
|
+
TakeControlTimeoutError,
|
7
|
+
)
|
3
8
|
from .reaction import (
|
4
9
|
Reaction,
|
5
10
|
TorqueReaction,
|
6
11
|
JointVelocityReaction,
|
7
12
|
JointPositionReaction,
|
8
13
|
CartesianVelocityReaction,
|
9
|
-
CartesianPoseReaction
|
14
|
+
CartesianPoseReaction,
|
10
15
|
)
|
11
16
|
from .motion import Motion
|
12
17
|
from ._franky import *
|
Binary file
|
franky/motion.py
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
from typing import Union
|
2
2
|
|
3
|
-
from ._franky import
|
4
|
-
|
3
|
+
from ._franky import (
|
4
|
+
BaseCartesianPoseMotion,
|
5
|
+
BaseCartesianVelocityMotion,
|
6
|
+
BaseJointPositionMotion,
|
7
|
+
BaseJointVelocityMotion,
|
8
|
+
BaseTorqueMotion,
|
9
|
+
)
|
5
10
|
|
6
11
|
Motion = Union[
|
7
12
|
BaseCartesianPoseMotion,
|
8
13
|
BaseCartesianVelocityMotion,
|
9
14
|
BaseJointPositionMotion,
|
10
15
|
BaseJointVelocityMotion,
|
11
|
-
BaseTorqueMotion
|
16
|
+
BaseTorqueMotion,
|
12
17
|
]
|
franky/reaction.py
CHANGED
@@ -1,10 +1,16 @@
|
|
1
|
-
from ._franky import
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
from ._franky import (
|
2
|
+
Condition,
|
3
|
+
BaseCartesianPoseMotion,
|
4
|
+
BaseCartesianVelocityMotion,
|
5
|
+
BaseJointPositionMotion,
|
6
|
+
BaseJointVelocityMotion,
|
7
|
+
BaseTorqueMotion,
|
8
|
+
CartesianPoseReaction as _CartesianPoseReaction,
|
9
|
+
CartesianVelocityReaction as _CartesianVelocityReaction,
|
10
|
+
JointPositionReaction as _JointPositionReaction,
|
11
|
+
JointVelocityReaction as _JointVelocityReaction,
|
12
|
+
TorqueReaction as _TorqueReaction,
|
13
|
+
)
|
8
14
|
|
9
15
|
from .motion import Motion
|
10
16
|
|
@@ -40,4 +46,9 @@ class TorqueReaction(_TorqueReaction, Reaction):
|
|
40
46
|
|
41
47
|
|
42
48
|
_REACTION_TYPES = [
|
43
|
-
CartesianPoseReaction,
|
49
|
+
CartesianPoseReaction,
|
50
|
+
CartesianVelocityReaction,
|
51
|
+
JointPositionReaction,
|
52
|
+
JointVelocityReaction,
|
53
|
+
TorqueReaction,
|
54
|
+
]
|
franky/robot_web_session.py
CHANGED
@@ -7,22 +7,37 @@ import time
|
|
7
7
|
import urllib.parse
|
8
8
|
from http.client import HTTPSConnection, HTTPResponse
|
9
9
|
from typing import Dict, Optional, Any, Literal
|
10
|
-
from urllib.error import HTTPError
|
11
10
|
|
12
11
|
|
13
|
-
class
|
14
|
-
|
12
|
+
class RobotWebSessionError(Exception):
|
13
|
+
pass
|
14
|
+
|
15
|
+
|
16
|
+
class FrankaAPIError(RobotWebSessionError):
|
17
|
+
def __init__(
|
18
|
+
self,
|
19
|
+
target: str,
|
20
|
+
http_code: int,
|
21
|
+
http_reason: str,
|
22
|
+
headers: Dict[str, str],
|
23
|
+
message: str,
|
24
|
+
):
|
15
25
|
super().__init__(
|
16
|
-
f"Franka API returned error {http_code} ({http_reason}) when accessing end-point {target}: {message}"
|
26
|
+
f"Franka API returned error {http_code} ({http_reason}) when accessing end-point {target}: {message}"
|
27
|
+
)
|
17
28
|
self.target = target
|
18
29
|
self.http_code = http_code
|
19
30
|
self.headers = headers
|
20
31
|
self.message = message
|
21
32
|
|
22
33
|
|
34
|
+
class TakeControlTimeoutError(RobotWebSessionError):
|
35
|
+
pass
|
36
|
+
|
37
|
+
|
23
38
|
class RobotWebSession:
|
24
|
-
def __init__(self,
|
25
|
-
self.
|
39
|
+
def __init__(self, hostname: str, username: str, password: str):
|
40
|
+
self.__hostname = hostname
|
26
41
|
self.__username = username
|
27
42
|
self.__password = password
|
28
43
|
|
@@ -33,24 +48,45 @@ class RobotWebSession:
|
|
33
48
|
|
34
49
|
@staticmethod
|
35
50
|
def __encode_password(user: str, password: str) -> str:
|
36
|
-
bs = ",".join(
|
51
|
+
bs = ",".join(
|
52
|
+
[
|
53
|
+
str(b)
|
54
|
+
for b in hashlib.sha256(
|
55
|
+
(password + "#" + user + "@franka").encode("utf-8")
|
56
|
+
).digest()
|
57
|
+
]
|
58
|
+
)
|
37
59
|
return base64.encodebytes(bs.encode("utf-8")).decode("utf-8")
|
38
60
|
|
39
|
-
def _send_api_request(
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
61
|
+
def _send_api_request(
|
62
|
+
self,
|
63
|
+
target: str,
|
64
|
+
headers: Optional[Dict[str, str]] = None,
|
65
|
+
body: Optional[Any] = None,
|
66
|
+
method: Literal["GET", "POST", "DELETE"] = "POST",
|
67
|
+
):
|
68
|
+
_headers = {"Cookie": f"authorization={self.__token}"}
|
44
69
|
if headers is not None:
|
45
70
|
_headers.update(headers)
|
46
71
|
self.__client.request(method, target, headers=_headers, body=body)
|
47
72
|
res: HTTPResponse = self.__client.getresponse()
|
48
73
|
if res.getcode() != 200:
|
49
|
-
raise FrankaAPIError(
|
74
|
+
raise FrankaAPIError(
|
75
|
+
target,
|
76
|
+
res.getcode(),
|
77
|
+
res.reason,
|
78
|
+
dict(res.headers),
|
79
|
+
res.read().decode("utf-8"),
|
80
|
+
)
|
50
81
|
return res.read()
|
51
82
|
|
52
|
-
def send_api_request(
|
53
|
-
|
83
|
+
def send_api_request(
|
84
|
+
self,
|
85
|
+
target: str,
|
86
|
+
headers: Optional[Dict[str, str]] = None,
|
87
|
+
body: Optional[Any] = None,
|
88
|
+
method: Literal["GET", "POST", "DELETE"] = "POST",
|
89
|
+
):
|
54
90
|
last_error = None
|
55
91
|
for i in range(3):
|
56
92
|
try:
|
@@ -59,28 +95,38 @@ class RobotWebSession:
|
|
59
95
|
last_error = ex
|
60
96
|
raise last_error
|
61
97
|
|
62
|
-
def send_control_api_request(
|
63
|
-
|
64
|
-
|
98
|
+
def send_control_api_request(
|
99
|
+
self,
|
100
|
+
target: str,
|
101
|
+
headers: Optional[Dict[str, str]] = None,
|
102
|
+
body: Optional[Any] = None,
|
103
|
+
method: Literal["GET", "POST", "DELETE"] = "POST",
|
104
|
+
):
|
65
105
|
if headers is None:
|
66
106
|
headers = {}
|
67
107
|
self.__check_control_token()
|
68
|
-
_headers = {
|
69
|
-
"X-Control-Token": self.__control_token
|
70
|
-
}
|
108
|
+
_headers = {"X-Control-Token": self.__control_token}
|
71
109
|
_headers.update(headers)
|
72
110
|
return self.send_api_request(target, headers=_headers, method=method, body=body)
|
73
111
|
|
74
|
-
def open(self):
|
112
|
+
def open(self, timeout: float = 30.0):
|
75
113
|
if self.is_open:
|
76
114
|
raise RuntimeError("Session is already open.")
|
77
|
-
self.__client = HTTPSConnection(
|
115
|
+
self.__client = HTTPSConnection(
|
116
|
+
self.__hostname, timeout=timeout, context=ssl._create_unverified_context()
|
117
|
+
)
|
78
118
|
self.__client.connect()
|
79
119
|
payload = json.dumps(
|
80
|
-
{
|
120
|
+
{
|
121
|
+
"login": self.__username,
|
122
|
+
"password": self.__encode_password(self.__username, self.__password),
|
123
|
+
}
|
124
|
+
)
|
81
125
|
self.__token = self.send_api_request(
|
82
|
-
"/admin/api/login",
|
83
|
-
|
126
|
+
"/admin/api/login",
|
127
|
+
headers={"content-type": "application/json"},
|
128
|
+
body=payload,
|
129
|
+
).decode("utf-8")
|
84
130
|
return self
|
85
131
|
|
86
132
|
def close(self):
|
@@ -92,82 +138,125 @@ class RobotWebSession:
|
|
92
138
|
self.__client.close()
|
93
139
|
|
94
140
|
def __enter__(self):
|
95
|
-
self.open()
|
141
|
+
return self.open()
|
96
142
|
|
97
143
|
def __exit__(self, type, value, traceback):
|
98
144
|
self.close()
|
99
145
|
|
100
146
|
def __check_control_token(self):
|
101
147
|
if self.__control_token is None:
|
102
|
-
raise RuntimeError(
|
148
|
+
raise RuntimeError(
|
149
|
+
"Client does not have control. Call take_control() first."
|
150
|
+
)
|
103
151
|
|
104
|
-
def take_control(self, wait_timeout: float =
|
105
|
-
if self.
|
152
|
+
def take_control(self, wait_timeout: float = 30.0, force: bool = False):
|
153
|
+
if not self.has_control():
|
106
154
|
res = self.send_api_request(
|
107
|
-
"/admin/api/control-token/request
|
108
|
-
|
155
|
+
f"/admin/api/control-token/request{'?force' if force else ''}",
|
156
|
+
headers={"content-type": "application/json"},
|
157
|
+
body=json.dumps({"requestedBy": self.__username}),
|
158
|
+
)
|
159
|
+
if force:
|
160
|
+
print(
|
161
|
+
"Forcibly taking control: "
|
162
|
+
f"Please physically take control by pressing the top button on the FR3 within {wait_timeout}s!"
|
163
|
+
)
|
109
164
|
response_dict = json.loads(res)
|
110
165
|
self.__control_token = response_dict["token"]
|
111
166
|
self.__control_token_id = response_dict["id"]
|
112
167
|
# One should probably use websockets here but that would introduce another dependency
|
113
168
|
start = time.time()
|
114
|
-
|
115
|
-
|
116
|
-
|
169
|
+
has_control = self.has_control()
|
170
|
+
while time.time() - start < wait_timeout and not has_control:
|
171
|
+
time.sleep(max(0.0, min(1.0, wait_timeout - (time.time() - start))))
|
172
|
+
has_control = self.has_control()
|
173
|
+
if not has_control:
|
174
|
+
raise TakeControlTimeoutError(
|
175
|
+
f"Timed out waiting for control to be granted after {wait_timeout}s."
|
176
|
+
)
|
117
177
|
|
118
178
|
def release_control(self):
|
119
179
|
if self.__control_token is not None:
|
120
180
|
self.send_control_api_request(
|
121
|
-
"/admin/api/control-token",
|
122
|
-
|
181
|
+
"/admin/api/control-token",
|
182
|
+
headers={"content-type": "application/json"},
|
183
|
+
method="DELETE",
|
184
|
+
body=json.dumps({"token": self.__control_token}),
|
185
|
+
)
|
123
186
|
self.__control_token = None
|
124
187
|
self.__control_token_id = None
|
125
188
|
|
126
189
|
def enable_fci(self):
|
127
190
|
self.send_control_api_request(
|
128
|
-
"/desk/api/system/fci",
|
129
|
-
|
191
|
+
"/desk/api/system/fci",
|
192
|
+
headers={"content-type": "application/x-www-form-urlencoded"},
|
193
|
+
body=f"token={urllib.parse.quote(base64.b64encode(self.__control_token.encode('ascii')))}",
|
194
|
+
)
|
130
195
|
|
131
196
|
def has_control(self):
|
132
197
|
if self.__control_token_id is not None:
|
133
198
|
status = self.get_system_status()
|
134
199
|
active_token = status["controlToken"]["activeToken"]
|
135
|
-
return
|
200
|
+
return (
|
201
|
+
active_token is not None
|
202
|
+
and active_token["id"] == self.__control_token_id
|
203
|
+
)
|
136
204
|
return False
|
137
205
|
|
138
206
|
def start_task(self, task: str):
|
139
207
|
self.send_api_request(
|
140
|
-
"/desk/api/execution",
|
141
|
-
|
208
|
+
"/desk/api/execution",
|
209
|
+
headers={"content-type": "application/x-www-form-urlencoded"},
|
210
|
+
body=f"id={task}",
|
211
|
+
)
|
142
212
|
|
143
213
|
def unlock_brakes(self):
|
144
214
|
self.send_control_api_request(
|
145
|
-
"/desk/api/joints/unlock",
|
215
|
+
"/desk/api/joints/unlock",
|
216
|
+
headers={"content-type": "application/x-www-form-urlencoded"},
|
217
|
+
)
|
146
218
|
|
147
219
|
def lock_brakes(self):
|
148
220
|
self.send_control_api_request(
|
149
|
-
"/desk/api/joints/lock",
|
221
|
+
"/desk/api/joints/lock",
|
222
|
+
headers={"content-type": "application/x-www-form-urlencoded"},
|
223
|
+
)
|
150
224
|
|
151
225
|
def set_mode_programming(self):
|
152
226
|
self.send_control_api_request(
|
153
|
-
"/desk/api/operating-mode/programming",
|
227
|
+
"/desk/api/operating-mode/programming",
|
228
|
+
headers={"content-type": "application/x-www-form-urlencoded"},
|
229
|
+
)
|
154
230
|
|
155
231
|
def set_mode_execution(self):
|
156
232
|
self.send_control_api_request(
|
157
|
-
"/desk/api/operating-mode/execution",
|
233
|
+
"/desk/api/operating-mode/execution",
|
234
|
+
headers={"content-type": "application/x-www-form-urlencoded"},
|
235
|
+
)
|
158
236
|
|
159
237
|
def get_system_status(self):
|
160
|
-
return json.loads(
|
238
|
+
return json.loads(
|
239
|
+
self.send_api_request("/admin/api/system-status", method="GET").decode(
|
240
|
+
"utf-8"
|
241
|
+
)
|
242
|
+
)
|
161
243
|
|
162
244
|
def execute_self_test(self):
|
163
245
|
if self.get_system_status()["safety"]["recoverableErrors"]["td2Timeout"]:
|
164
246
|
self.send_control_api_request(
|
165
|
-
"/admin/api/safety/recoverable-safety-errors/acknowledge?error_id=TD2Timeout"
|
166
|
-
|
167
|
-
|
247
|
+
"/admin/api/safety/recoverable-safety-errors/acknowledge?error_id=TD2Timeout"
|
248
|
+
)
|
249
|
+
response = json.loads(
|
250
|
+
self.send_control_api_request(
|
251
|
+
"/admin/api/safety/td2-tests/execute",
|
252
|
+
headers={"content-type": "application/json"},
|
253
|
+
).decode("utf-8")
|
254
|
+
)
|
168
255
|
assert response["code"] == "SuccessResponse"
|
169
256
|
time.sleep(0.5)
|
170
|
-
while
|
257
|
+
while (
|
258
|
+
self.get_system_status()["safety"]["safetyControllerStatus"] == "SelfTest"
|
259
|
+
):
|
171
260
|
time.sleep(0.5)
|
172
261
|
|
173
262
|
@property
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: franky-control
|
3
|
-
Version: 1.0
|
3
|
+
Version: 1.1.0
|
4
4
|
Summary: High-level control library for Franka robots.
|
5
5
|
Home-page: https://github.com/TimSchneider42/franky
|
6
6
|
Author: Tim Schneider
|
@@ -76,25 +76,25 @@ at [https://timschneider42.github.io/franky/](https://timschneider42.github.io/f
|
|
76
76
|
|
77
77
|
## 🚀 Features
|
78
78
|
|
79
|
-
- **Control your Franka robot directly from Python in just a few lines!**
|
79
|
+
- **Control your Franka robot directly from Python in just a few lines!**
|
80
80
|
No more endless hours setting up ROS, juggling packages, or untangling dependencies. Just `pip install` — no ROS at all.
|
81
81
|
|
82
|
-
- **[Four control modes](#motion-types)**: [Cartesian position](#cartesian-position-control), [Cartesian velocity](#cartesian-velocity-control), [Joint position](#joint-position-control), [Joint velocity](#joint-velocity-control)
|
82
|
+
- **[Four control modes](#motion-types)**: [Cartesian position](#cartesian-position-control), [Cartesian velocity](#cartesian-velocity-control), [Joint position](#joint-position-control), [Joint velocity](#joint-velocity-control)
|
83
83
|
Franky uses [Ruckig](https://github.com/pantor/ruckig) to generate smooth, time-optimal trajectories while respecting velocity, acceleration, and jerk limits.
|
84
84
|
|
85
85
|
- **[Real-time control from Python and C++](#real-time-motions)**
|
86
86
|
Need to change the target while the robot’s moving? No problem. Franky re-plans trajectories on the fly so that you can preempt motions anytime.
|
87
87
|
|
88
|
-
- **[Reactive behavior](#-real-time-reactions)**
|
88
|
+
- **[Reactive behavior](#-real-time-reactions)**
|
89
89
|
Robots don’t always go according to plan. Franky lets you define reactions to unexpected events—like contact with the environment — so you can change course in real-time.
|
90
90
|
|
91
|
-
- **[Motion and reaction callbacks](#motion-callbacks)**
|
91
|
+
- **[Motion and reaction callbacks](#motion-callbacks)**
|
92
92
|
Want to monitor what’s happening under the hood? Add callbacks to your motions and reactions. They won’t block the control thread and are super handy for debugging or logging.
|
93
93
|
|
94
|
-
- **Things are moving too fast? [Tune the robot's dynamics to your needs](#-robot)**
|
94
|
+
- **Things are moving too fast? [Tune the robot's dynamics to your needs](#-robot)**
|
95
95
|
Adjust max velocity, acceleration, and jerk to match your setup or task. Fine control for smooth, safe operation.
|
96
96
|
|
97
|
-
- **Full Python access to the libfranka API**
|
97
|
+
- **Full Python access to the libfranka API**
|
98
98
|
Want to tweak impedance, read the robot state, set force thresholds, or mess with the Jacobian? Go for it. If libfranka supports it, chances are Franky does, too.
|
99
99
|
|
100
100
|
## 📖 Python Quickstart Guide
|
@@ -274,6 +274,32 @@ docker compose run --rm franky-build run-tests # To run the tests
|
|
274
274
|
docker compose run --rm franky-build build-wheels # To build wheels for all supported python versions
|
275
275
|
```
|
276
276
|
|
277
|
+
### Can I use CUDA jointly with Franky?
|
278
|
+
|
279
|
+
Yes. However, you need to set `IGNORE_PREEMPT_RT_PRESENCE=1` during the installation and all subsequent updates of the CUDA drivers on the real-time kernel.
|
280
|
+
|
281
|
+
First, make sure that you have rebooted your system after installing the real-time kernel.
|
282
|
+
Then, add `IGNORE_PREEMPT_RT_PRESENCE=1` to `/etc/environment`, call `export IGNORE_PREEMPT_RT_PRESENCE=1` to also set it in the current session and follow the instructions of Nvidia to install CUDA on your system.
|
283
|
+
|
284
|
+
If you are on Ubuntu, you can also use [this](tools/install_cuda_realtime.bash) script to install CUDA on your real-time system:
|
285
|
+
```bash
|
286
|
+
# Download the script
|
287
|
+
wget https://raw.githubusercontent.com/timschneider42/franky/master/tools/install_cuda_realtime.bash
|
288
|
+
|
289
|
+
# Inspect the script to ensure it does what you expect
|
290
|
+
|
291
|
+
# Make it executable
|
292
|
+
chmod +x install_cuda_realtime.bash
|
293
|
+
|
294
|
+
# Execute the script
|
295
|
+
./install_cuda_realtime.bash
|
296
|
+
```
|
297
|
+
|
298
|
+
Alternatively, if you are a cowboy and do not care about security, you can also use this one-liner to directly call the script without checking it:
|
299
|
+
```bash
|
300
|
+
bash <(wget -qO- https://raw.githubusercontent.com/timschneider42/franky/master/tools/install_cuda_realtime.bash)
|
301
|
+
```
|
302
|
+
|
277
303
|
## 📚 Tutorial
|
278
304
|
|
279
305
|
Franky comes with both a C++ and Python API that differ only regarding real-time capability.
|
@@ -311,6 +337,8 @@ motion = CartesianMotion(Affine([0.2, 0.0, 0.0]), ReferenceType.Relative)
|
|
311
337
|
robot.move(motion)
|
312
338
|
```
|
313
339
|
|
340
|
+
Before executing any code, make sure that you have enabled the Franka Control Interface (FCI) in the Franka UI web interface.
|
341
|
+
|
314
342
|
Furthermore, we will introduce methods for geometric calculations, for moving the robot according to different motion
|
315
343
|
types, how to implement real-time reactions and changing waypoints in real time as well as controlling the gripper.
|
316
344
|
|
@@ -384,7 +412,7 @@ The robot state can be retrieved by accessing the following properties:
|
|
384
412
|
obtained
|
385
413
|
from [franka::RobotState::O_T_EE](https://frankaemika.github.io/libfranka/structfranka_1_1RobotState.html#a193781d47722b32925e0ea7ac415f442)
|
386
414
|
and [franka::RobotState::O_dP_EE_c](https://frankaemika.github.io/libfranka/structfranka_1_1RobotState.html#a4be112bd1a9a7d777a67aea4a18a8dcc).
|
387
|
-
* `
|
415
|
+
* `current_joint_state`: Object of type `franky.JointState`, which contains the joint positions and velocities
|
388
416
|
obtained
|
389
417
|
from [franka::RobotState::q](https://frankaemika.github.io/libfranka/structfranka_1_1RobotState.html#ade3335d1ac2f6c44741a916d565f7091)
|
390
418
|
and [franka::RobotState::dq](https://frankaemika.github.io/libfranka/structfranka_1_1RobotState.html#a706045af1b176049e9e56df755325bd2).
|
@@ -430,8 +458,7 @@ and [Model](https://timschneider42.github.io/franky/classfranky_1_1_model.html)
|
|
430
458
|
|
431
459
|
### <a id="motion-types" /> 🏃♂️ Motion Types
|
432
460
|
|
433
|
-
Franky currently supports four different impedance control modes: **joint position control**, **joint velocity control
|
434
|
-
**, **cartesian position control**, and **cartesian velocity control**.
|
461
|
+
Franky currently supports four different impedance control modes: **joint position control**, **joint velocity control**, **cartesian position control**, and **cartesian velocity control**.
|
435
462
|
Each of these control modes is invoked by passing the robot an appropriate _Motion_ object.
|
436
463
|
|
437
464
|
In the following, we provide a brief example for each motion type implemented by Franky in Python.
|
@@ -467,9 +494,9 @@ m_jp3 = JointWaypointMotion([
|
|
467
494
|
JointWaypoint([0.1, 0.4, 0.3, -1.4, -0.3, 1.7, 0.9])
|
468
495
|
])
|
469
496
|
|
470
|
-
# Stop the robot in joint position control mode. The difference of JointStopMotion to other stop motions such as
|
471
|
-
# CartesianStopMotion is that # JointStopMotion # stops the robot in joint position control mode while
|
472
|
-
# CartesianStopMotion stops it in cartesian pose control mode. The difference becomes relevant when asynchronous move
|
497
|
+
# Stop the robot in joint position control mode. The difference of JointStopMotion to other stop motions such as
|
498
|
+
# CartesianStopMotion is that # JointStopMotion # stops the robot in joint position control mode while
|
499
|
+
# CartesianStopMotion stops it in cartesian pose control mode. The difference becomes relevant when asynchronous move
|
473
500
|
# commands are being sent or reactions are being used(see below).
|
474
501
|
m_jp4 = JointStopMotion()
|
475
502
|
```
|
@@ -549,7 +576,7 @@ m_cv1 = CartesianVelocityMotion(Twist([0.2, -0.1, 0.1], [0.1, -0.1, 0.2]))
|
|
549
576
|
m_cv2 = CartesianVelocityMotion(RobotVelocity(Twist([0.2, -0.1, 0.1], [0.1, -0.1, 0.2]), elbow_velocity=-0.2))
|
550
577
|
|
551
578
|
# Cartesian velocity motions also support multiple waypoints. Unlike in cartesian position control, a cartesian velocity
|
552
|
-
# waypoint is a target velocity to be reached. This particular example first accelerates the end-effector, holds the
|
579
|
+
# waypoint is a target velocity to be reached. This particular example first accelerates the end-effector, holds the
|
553
580
|
# velocity for 1s, then # reverses direction for 2s, reverses direction again for 1s, and finally stops. It is important
|
554
581
|
# not to forget to stop # the robot at the end of such a sequence, as it will otherwise throw an error.
|
555
582
|
m_cv4 = CartesianVelocityWaypointMotion([
|
@@ -592,7 +619,7 @@ robot.relative_dynamics_factor = RelativeDynamicsFactor(0.05, 0.1, 0.15)
|
|
592
619
|
|
593
620
|
robot.move(m_jp1)
|
594
621
|
|
595
|
-
# We can also set a relative dynamics factor in the move command. It will be multiplied with the other relative
|
622
|
+
# We can also set a relative dynamics factor in the move command. It will be multiplied with the other relative
|
596
623
|
# dynamics factors (robot and motion if present).
|
597
624
|
robot.move(m_jp2, relative_dynamics_factor=0.8)
|
598
625
|
```
|
@@ -717,7 +744,7 @@ motion
|
|
717
744
|
}),
|
718
745
|
[](const franka::RobotState& state, double rel_time, double abs_time) {
|
719
746
|
// Lambda reaction motion generator
|
720
|
-
// (we are just returning a stop motion, but there could be arbitrary
|
747
|
+
// (we are just returning a stop motion, but there could be arbitrary
|
721
748
|
// logic here for generating reaction motions)
|
722
749
|
return StopMotion<franka::CartesianPose>();
|
723
750
|
})
|
@@ -762,7 +789,7 @@ The next time `Robot.join_motion` or `Robot.move` are called, they will throw th
|
|
762
789
|
Hence, after an asynchronous motion has finished, make sure to call `Robot.join_motion` to ensure being notified of any
|
763
790
|
exceptions that occurred during the motion.
|
764
791
|
|
765
|
-
### Gripper
|
792
|
+
### <a id="gripper" /> 👌 Gripper
|
766
793
|
|
767
794
|
In the `franky::Gripper` class, the default gripper force and gripper speed can be set.
|
768
795
|
Then, additionally to the libfranka commands, the following helper methods can be used:
|
@@ -837,6 +864,80 @@ else:
|
|
837
864
|
print("Gripper motion timed out.")
|
838
865
|
```
|
839
866
|
|
867
|
+
### Accessing the Web Interface API
|
868
|
+
|
869
|
+
For Franka robots, control happens via the Franka Control Interface (FCI), which has to be enabled through the Franka UI in the robot's web interface.
|
870
|
+
The Franka UI also provides methods for locking and unlocking the brakes, setting the execution mode, and executing the safety self-test.
|
871
|
+
However, sometimes you may want to access these methods programmatically, e.g. for automatically unlocking the brakes before starting a motion, or automatically executing the self-test after 24h of continuous execution.
|
872
|
+
|
873
|
+
For that reason, Franky provides a `RobotWebSession` class that allows you to access the web interface API of the robot.
|
874
|
+
Note that directly accessing the web interface API is not officially supported and documented by Franka.
|
875
|
+
Hence, use this feature at your own risk.
|
876
|
+
|
877
|
+
A typical automated workflow could look like this:
|
878
|
+
|
879
|
+
```python
|
880
|
+
import franky
|
881
|
+
|
882
|
+
with franky.RobotWebSession("172.16.0.2", "username", "password") as robot_web_session:
|
883
|
+
# First take control
|
884
|
+
try:
|
885
|
+
# Try taking control. The session currently holding control has to release it in order for this session to gain
|
886
|
+
# control. In the web interface, a notification will show prompting the user to release control. If the other
|
887
|
+
# session is another franky.RobotWebSession, then the `release_control` method can be called on the other
|
888
|
+
# session to release control.
|
889
|
+
robot_web_session.take_control(wait_timeout=10.0)
|
890
|
+
except franky.TakeControlTimeoutError:
|
891
|
+
# If nothing happens for 10s, we try to take control forcefully. This is particularly useful if the session
|
892
|
+
# holding control is dead. Taking control by force requires the user to manually push the blue button close to
|
893
|
+
# the robot's wrist.
|
894
|
+
robot_web_session.take_control(wait_timeout=30.0, force=True)
|
895
|
+
|
896
|
+
# Unlock the brakes
|
897
|
+
robot_web_session.unlock_brakes()
|
898
|
+
|
899
|
+
# Enable the FCI
|
900
|
+
robot_web_session.enable_fci()
|
901
|
+
|
902
|
+
# Create a franky.Robot instance and do whatever you want
|
903
|
+
...
|
904
|
+
|
905
|
+
# Disable the FCI
|
906
|
+
robot_web_session.disable_fci()
|
907
|
+
|
908
|
+
# Lock brakes
|
909
|
+
robot_web_session.lock_brakes()
|
910
|
+
```
|
911
|
+
|
912
|
+
In case you are running the robot for longer than 24h you will have noticed that you have to do a safety self-test every 24h.
|
913
|
+
`RobotWebSession` allows to automate this task as well:
|
914
|
+
|
915
|
+
```python
|
916
|
+
import time
|
917
|
+
import franky
|
918
|
+
|
919
|
+
with franky.RobotWebSession("172.16.0.2", "username", "password") as robot_web_session:
|
920
|
+
# Execute self-test if the time until self-test is less than 5 minutes.
|
921
|
+
if robot_web_session.get_system_status()["safety"]["timeToTd2"] < 300:
|
922
|
+
robot_web_session.disable_fci()
|
923
|
+
robot_web_session.lock_brakes()
|
924
|
+
time.sleep(1.0)
|
925
|
+
|
926
|
+
robot_web_session.execute_self_test()
|
927
|
+
|
928
|
+
robot_web_session.unlock_brakes()
|
929
|
+
robot_web_session.enable_fci()
|
930
|
+
time.sleep(1.0)
|
931
|
+
|
932
|
+
# Recreate your franky.Robot instance as the FCI has been disabled and re-enabled
|
933
|
+
...
|
934
|
+
```
|
935
|
+
|
936
|
+
`robot_web_session.get_system_status()` contains more information than just the time until self-test, such as the current execution mode, whether the brakes are locked, whether the FCI is enabled, and more.
|
937
|
+
|
938
|
+
If you want to call other API functions, you can use the `RobotWebSession.send_api_request` and `RobotWebSession.send_control_api_request` methods.
|
939
|
+
See [robot_web_session.py](franky/robot_web_session.py) for an example of how to use these methods.
|
940
|
+
|
840
941
|
## 🛠️ Development
|
841
942
|
|
842
943
|
Franky is currently tested against following versions
|
@@ -879,3 +980,12 @@ Aside of bug fixes and general performance improvements, Franky provides the fol
|
|
879
980
|
* Franky supports [joint velocity control](#joint-velocity-control)
|
880
981
|
and [cartesian velocity control](#cartesian-velocity-control)
|
881
982
|
* The dynamics limits are not hard-coded anymore but can be [set for each robot instance](#-robot).
|
983
|
+
|
984
|
+
## Contributing
|
985
|
+
|
986
|
+
If you wish to contribute to this project, you are welcome to create a pull request.
|
987
|
+
Please run the [pre-commit](https://pre-commit.com/) hooks before submitting your pull request.
|
988
|
+
To install the pre-commit hooks, run:
|
989
|
+
|
990
|
+
1. [Install pre-commit](https://pre-commit.com/#install)
|
991
|
+
2. Install the Git hooks by running `pre-commit install` or, alternatively, run `pre-commit run --all-files manually.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
franky/__init__.py,sha256=57BsmUytdeqMrhHglwvxMS6CgpAEVPw0KJge8_UTzEA,378
|
2
|
+
franky/_franky.cpython-311-x86_64-linux-gnu.so,sha256=7jslhTigzzdyiN2uXKw74Q8sqJcc-GDuB9FkNlgQjl4,3079945
|
3
|
+
franky/_franky.pyi,sha256=odBnBaM2qGN4mUa8WvFN5SL9aszPgDTsZj5Jb9UkFHk,60047
|
4
|
+
franky/motion.py,sha256=TWsx2Ba9iYG9e-OxpuYZlVn1wdzKS-Zvz6ayHT_HYXQ,354
|
5
|
+
franky/reaction.py,sha256=cBuHAMek9yH-9Zmwfa0dzz2t5G_1SQEWXNdW7mhhCI8,1519
|
6
|
+
franky/robot.py,sha256=NaTNh4PaJshbz44eibvLCMt6O_Ak7TRVjhUR6AGay9A,236
|
7
|
+
franky/robot_web_session.py,sha256=rYpnUe4b8xj5JjCYxNRZ0uYz8lL2qfxKglcImFDw24Y,9070
|
8
|
+
franky_control.libs/libPocoFoundation-91a48101.so.95,sha256=ayW6qwws-4x4I7Ee3WK4LRRAyaQuTvbGuEBTkjZy7CU,3273833
|
9
|
+
franky_control.libs/libPocoNet-9e586dc9.so.95,sha256=KQ6mL1nO9NlXzpp7NcBAKLxC9vjzNd_l9Jy8ldXlotU,2504833
|
10
|
+
franky_control.libs/libboost_filesystem-38deced9.so.1.66.0,sha256=-thu-LYmEDUKnOhQw3njV9C58dVZV12pn_6-KoqDCeI,145241
|
11
|
+
franky_control.libs/libboost_serialization-3aa46b41.so.1.66.0,sha256=KpSA9K4iakzd-Mvv5JvPSqxJyMYsVkcIXrUbSlAkiIo,316673
|
12
|
+
franky_control.libs/libboost_system-69a6c43e.so.1.66.0,sha256=sd_lA0coUWXm-bluxkOkNrzrxFSAXYDphjPDwBekik8,22905
|
13
|
+
franky_control.libs/libconsole_bridge-def124d9.so.0.3,sha256=Eg1wJzVIRG5GQhyr59_qdYgnmhto0orU0j8HW2A0JIg,27297
|
14
|
+
franky_control.libs/libfmt-8375f6bf.so.6.2.1,sha256=Z8D_NYG4rsuwMIYP3KfNB95w7vnsPaV5XLm2EnWd9Fk,327441
|
15
|
+
franky_control.libs/libfranka-92ddaf43.so.0.15.0,sha256=pVavBW1460_MHqwSDTbwkE5vUfGTOi2PnZjSVQRvwOY,1145681
|
16
|
+
franky_control.libs/libpinocchio_default-53a889f9.so.3.1.0,sha256=1us8TU8dwRDiCeB-sUnSx2w_Czcr7E-QC21VVO_ht0g,9255841
|
17
|
+
franky_control.libs/libpinocchio_parsers-a0902fb5.so.3.1.0,sha256=hsF6GO3VBJu034O1PxRlQSTyGmFKaEdO1_lN7Z3bbgM,713129
|
18
|
+
franky_control.libs/libtinyxml-435d1f53.so.0.2.6.2,sha256=BGSkG-zXEYTuGquHhydNow2ufOetDZpEP7MbBZyf6hA,120209
|
19
|
+
franky_control.libs/liburdfdom_model-9e7b5a88.so.1.0,sha256=c4cAZ09SHlu-dpMZmwsxC8Ydklm8RzEANxvdJHeh4Ho,187561
|
20
|
+
franky_control.libs/liburdfdom_model_state-741cbb83.so.1.0,sha256=NvqLfm2u-YlCihr5GRoUGL6iJMLRHm-RFEmR0he5csM,59105
|
21
|
+
franky_control.libs/liburdfdom_sensor-5dbb5bb4.so.1.0,sha256=udrHZ0oYFTf9qwr8hm8rSrBKZDkd1L5yy5tyh10D018,51777
|
22
|
+
franky_control.libs/liburdfdom_world-bd943329.so.1.0,sha256=ja9WE45nXtAGUoLpg1T1Hte8BZLldj_WNf9cL3H1RPk,187561
|
23
|
+
franky_control-1.1.0.dist-info/METADATA,sha256=O0HKEVVI_VNuEOVFEocwKNl_9oUXK3EssjRIdvLxnHM,40320
|
24
|
+
franky_control-1.1.0.dist-info/WHEEL,sha256=6oVDzR3b5EMqojPhxKaF1gMfdgju1hqo31zpMLY6LFY,113
|
25
|
+
franky_control-1.1.0.dist-info/top_level.txt,sha256=LdDKRvHTODs6ll6Ow5b-gmWqt4NJffHxL83MRTCv_Ag,22
|
26
|
+
franky_control-1.1.0.dist-info/RECORD,,
|
27
|
+
franky_control-1.1.0.dist-info/licenses/LICENSE,sha256=2n6rt7r999OuXp8iOqW9we7ORaxWncIbOwN1ILRGR2g,7651
|
@@ -162,4 +162,4 @@ General Public License ever published by the Free Software Foundation.
|
|
162
162
|
whether future versions of the GNU Lesser General Public License shall
|
163
163
|
apply, that proxy's public statement of acceptance of any version is
|
164
164
|
permanent authorization for you to choose that version for the
|
165
|
-
Library.
|
165
|
+
Library.
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,27 +0,0 @@
|
|
1
|
-
franky/__init__.py,sha256=lmRG8cc4eX-0gZgCkxxVCOrmuUEGJsppWl7DDURib-Y,293
|
2
|
-
franky/_franky.cpython-311-x86_64-linux-gnu.so,sha256=YZ1gnRLQ1umNJZusIPY53NyiPbAyQdD8iuUI-Bsul3c,3079945
|
3
|
-
franky/_franky.pyi,sha256=odBnBaM2qGN4mUa8WvFN5SL9aszPgDTsZj5Jb9UkFHk,60047
|
4
|
-
franky/motion.py,sha256=EZmZPvu2r4YBhcokV1PFh8s8NmiwOUERvct3Zz629C8,334
|
5
|
-
franky/reaction.py,sha256=gDD7kVc_7Et2NwMmCB4Hcd12aK0eygJVqXzZ9Dzw0_M,1488
|
6
|
-
franky/robot.py,sha256=NaTNh4PaJshbz44eibvLCMt6O_Ak7TRVjhUR6AGay9A,236
|
7
|
-
franky/robot_web_session.py,sha256=zOTAqDF4PbZLqJFr3RcuBwfWRSEMiw0Eag1stk3GWKE,7622
|
8
|
-
franky_control.libs/libPocoFoundation-7333b9fc.so.95,sha256=uWvz8wEhtptpIfCJH1nPOe5YC8I-ErEPjDn1uLJO6jo,3273833
|
9
|
-
franky_control.libs/libPocoNet-007a41b7.so.95,sha256=ID59zS7O1bSBlCF9MZOHyy6n0AcfbLgfHJbSn5QZB60,2504833
|
10
|
-
franky_control.libs/libboost_filesystem-38deced9.so.1.66.0,sha256=-thu-LYmEDUKnOhQw3njV9C58dVZV12pn_6-KoqDCeI,145241
|
11
|
-
franky_control.libs/libboost_serialization-3aa46b41.so.1.66.0,sha256=KpSA9K4iakzd-Mvv5JvPSqxJyMYsVkcIXrUbSlAkiIo,316673
|
12
|
-
franky_control.libs/libboost_system-69a6c43e.so.1.66.0,sha256=sd_lA0coUWXm-bluxkOkNrzrxFSAXYDphjPDwBekik8,22905
|
13
|
-
franky_control.libs/libconsole_bridge-def124d9.so.0.3,sha256=Eg1wJzVIRG5GQhyr59_qdYgnmhto0orU0j8HW2A0JIg,27297
|
14
|
-
franky_control.libs/libfmt-8375f6bf.so.6.2.1,sha256=Z8D_NYG4rsuwMIYP3KfNB95w7vnsPaV5XLm2EnWd9Fk,327441
|
15
|
-
franky_control.libs/libfranka-92ddaf43.so.0.15.0,sha256=lGXhCXAtQnDYzJpz2Jf6tOhBN-0CSaTmVxs9I1p7afo,1145681
|
16
|
-
franky_control.libs/libpinocchio_default-7b0164b0.so.3.1.0,sha256=vHyDT_5YG6YigVJsdaSnC6FApzePbWbRn2gji5rwZtM,9255841
|
17
|
-
franky_control.libs/libpinocchio_parsers-50abb87c.so.3.1.0,sha256=46UjCQRT010QVmWFwfddGHr3knuBw3Xcsc09Bw5aLIM,713129
|
18
|
-
franky_control.libs/libtinyxml-435d1f53.so.0.2.6.2,sha256=BGSkG-zXEYTuGquHhydNow2ufOetDZpEP7MbBZyf6hA,120209
|
19
|
-
franky_control.libs/liburdfdom_model-9e7b5a88.so.1.0,sha256=c4cAZ09SHlu-dpMZmwsxC8Ydklm8RzEANxvdJHeh4Ho,187561
|
20
|
-
franky_control.libs/liburdfdom_model_state-741cbb83.so.1.0,sha256=NvqLfm2u-YlCihr5GRoUGL6iJMLRHm-RFEmR0he5csM,59105
|
21
|
-
franky_control.libs/liburdfdom_sensor-5dbb5bb4.so.1.0,sha256=udrHZ0oYFTf9qwr8hm8rSrBKZDkd1L5yy5tyh10D018,51777
|
22
|
-
franky_control.libs/liburdfdom_world-bd943329.so.1.0,sha256=ja9WE45nXtAGUoLpg1T1Hte8BZLldj_WNf9cL3H1RPk,187561
|
23
|
-
franky_control-1.0.2.dist-info/METADATA,sha256=1gnubmBB-s5sz4OwqTP2hsLiArGIB1cl6b0C4ekISFQ,35135
|
24
|
-
franky_control-1.0.2.dist-info/WHEEL,sha256=mR6vY3-vl5IpMjFV4DDKsdJOfc91y70knyCOrzoDusA,113
|
25
|
-
franky_control-1.0.2.dist-info/top_level.txt,sha256=LdDKRvHTODs6ll6Ow5b-gmWqt4NJffHxL83MRTCv_Ag,22
|
26
|
-
franky_control-1.0.2.dist-info/RECORD,,
|
27
|
-
franky_control-1.0.2.dist-info/licenses/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
|
File without changes
|