sidekick-sdk 0.1.0__py3-none-any.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.
sidekick_sdk/__init__.py
ADDED
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
"""Sidekick Python client.
|
|
2
|
+
|
|
3
|
+
from sidekick_sdk import Sidekick
|
|
4
|
+
|
|
5
|
+
sk = Sidekick(api_key="sk-sidekick-...")
|
|
6
|
+
|
|
7
|
+
# Roll the world forward
|
|
8
|
+
out = sk.predict(
|
|
9
|
+
model="sidekick/auto:manipulation",
|
|
10
|
+
observations=[sk.observation(image_url=url)],
|
|
11
|
+
instruction="pick up the red block",
|
|
12
|
+
horizon=16,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
# Ask what to do next
|
|
16
|
+
act = sk.act(
|
|
17
|
+
model="sidekick/auto:vla",
|
|
18
|
+
observations=[sk.observation(image_url=url)],
|
|
19
|
+
instruction="put the spoon on the towel",
|
|
20
|
+
action_space="ee_delta_6d_grip",
|
|
21
|
+
)
|
|
22
|
+
robot.execute(act.action.steps)
|
|
23
|
+
|
|
24
|
+
Designed for a control loop: the synchronous client keeps one pooled
|
|
25
|
+
connection, `stream_predict` yields frames as they arrive, and every response
|
|
26
|
+
carries `route` so you can see which model and provider actually served you.
|
|
27
|
+
"""
|
|
28
|
+
from __future__ import annotations
|
|
29
|
+
|
|
30
|
+
import base64
|
|
31
|
+
import collections
|
|
32
|
+
import json
|
|
33
|
+
import os
|
|
34
|
+
import pathlib
|
|
35
|
+
import threading
|
|
36
|
+
import time
|
|
37
|
+
from dataclasses import dataclass
|
|
38
|
+
from typing import Any, Iterator
|
|
39
|
+
|
|
40
|
+
import httpx
|
|
41
|
+
|
|
42
|
+
__all__ = ["Sidekick", "SidekickError", "UnsafeResponse", "ActionStream",
|
|
43
|
+
"Prediction", "Action", "Grounding", "Evaluation"]
|
|
44
|
+
|
|
45
|
+
__version__ = "0.1.0"
|
|
46
|
+
|
|
47
|
+
# Where the service actually is. This used to read
|
|
48
|
+
# "https://api.sidekickrobotics.com", a host that is neither the right domain
|
|
49
|
+
# nor a subdomain that resolves, so `Sidekick(api_key=...)` with no base_url
|
|
50
|
+
# failed for every developer who took the default. Overridable by environment so
|
|
51
|
+
# a customer pointing at a private deployment does not have to pass it at every
|
|
52
|
+
# construction site.
|
|
53
|
+
DEFAULT_BASE_URL = os.environ.get(
|
|
54
|
+
"SIDEKICK_ORIGIN", "https://www.sidekickrobotics.ai/api")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class SidekickError(RuntimeError):
|
|
58
|
+
def __init__(self, status: int, body: Any) -> None:
|
|
59
|
+
detail = body
|
|
60
|
+
if isinstance(body, dict):
|
|
61
|
+
detail = body.get("detail", body)
|
|
62
|
+
if isinstance(detail, dict):
|
|
63
|
+
detail = detail.get("error", detail)
|
|
64
|
+
self.status = status
|
|
65
|
+
self.body = detail
|
|
66
|
+
msg = detail.get("message") if isinstance(detail, dict) else str(detail)
|
|
67
|
+
self.code = detail.get("code") if isinstance(detail, dict) else None
|
|
68
|
+
super().__init__(f"[{status}] {msg}")
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass
|
|
72
|
+
class Prediction:
|
|
73
|
+
id: str
|
|
74
|
+
model: str
|
|
75
|
+
frames: list[dict]
|
|
76
|
+
route: dict
|
|
77
|
+
usage: dict
|
|
78
|
+
latents_url: str | None = None
|
|
79
|
+
|
|
80
|
+
def save_frames(self, directory: str | pathlib.Path, prefix: str = "frame") -> list[pathlib.Path]:
|
|
81
|
+
"""Write base64 frames to disk. Frames returned as URLs are skipped."""
|
|
82
|
+
d = pathlib.Path(directory)
|
|
83
|
+
d.mkdir(parents=True, exist_ok=True)
|
|
84
|
+
out = []
|
|
85
|
+
for i, f in enumerate(self.frames):
|
|
86
|
+
if not f.get("b64"):
|
|
87
|
+
continue
|
|
88
|
+
p = d / f"{prefix}_{i:04d}.png"
|
|
89
|
+
p.write_bytes(base64.b64decode(f["b64"]))
|
|
90
|
+
out.append(p)
|
|
91
|
+
return out
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@dataclass
|
|
95
|
+
class Action:
|
|
96
|
+
id: str
|
|
97
|
+
model: str
|
|
98
|
+
action: dict
|
|
99
|
+
route: dict
|
|
100
|
+
usage: dict
|
|
101
|
+
confidence: float | None = None
|
|
102
|
+
predicted_frames: list[dict] | None = None
|
|
103
|
+
|
|
104
|
+
@property
|
|
105
|
+
def steps(self) -> list[list[float]]:
|
|
106
|
+
return self.action["steps"]
|
|
107
|
+
|
|
108
|
+
@property
|
|
109
|
+
def space(self) -> str:
|
|
110
|
+
return self.action["space"]
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@dataclass
|
|
114
|
+
class Grounding:
|
|
115
|
+
"""Where things are, in image coordinates.
|
|
116
|
+
|
|
117
|
+
Deliberately not an Action. `points` and `boxes` are normalised 0 to 1 in
|
|
118
|
+
image space, and a caller that feeds them to an actuator is commanding
|
|
119
|
+
pixels as joint targets. Convert through your own camera model first.
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
id: str
|
|
123
|
+
model: str
|
|
124
|
+
route: dict
|
|
125
|
+
usage: dict
|
|
126
|
+
points: list[dict]
|
|
127
|
+
boxes: list[dict]
|
|
128
|
+
raw: str | None = None
|
|
129
|
+
|
|
130
|
+
def labels(self) -> list[str]:
|
|
131
|
+
seen = {p.get("label") for p in self.points} | {b.get("label") for b in self.boxes}
|
|
132
|
+
return sorted(x for x in seen if x)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@dataclass
|
|
136
|
+
class Evaluation:
|
|
137
|
+
id: str
|
|
138
|
+
model: str
|
|
139
|
+
status: str
|
|
140
|
+
scenario: str
|
|
141
|
+
results: dict | None
|
|
142
|
+
usage: dict
|
|
143
|
+
error: str | None = None
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class Sidekick:
|
|
147
|
+
def __init__(
|
|
148
|
+
self,
|
|
149
|
+
api_key: str,
|
|
150
|
+
base_url: str = DEFAULT_BASE_URL,
|
|
151
|
+
*,
|
|
152
|
+
timeout: float = 120.0,
|
|
153
|
+
max_retries: int = 2,
|
|
154
|
+
) -> None:
|
|
155
|
+
self.base_url = base_url.rstrip("/")
|
|
156
|
+
self._client = httpx.Client(
|
|
157
|
+
timeout=timeout,
|
|
158
|
+
headers={"authorization": f"Bearer {api_key}", "content-type": "application/json"},
|
|
159
|
+
transport=httpx.HTTPTransport(retries=max_retries),
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
# ------------------------------------------------------------------
|
|
163
|
+
@staticmethod
|
|
164
|
+
def observation(
|
|
165
|
+
*,
|
|
166
|
+
image_url: str | None = None,
|
|
167
|
+
image_b64: str | None = None,
|
|
168
|
+
image_path: str | pathlib.Path | None = None,
|
|
169
|
+
camera: str = "primary",
|
|
170
|
+
cameras: dict[str, str] | None = None,
|
|
171
|
+
depth_url: str | None = None,
|
|
172
|
+
proprio: list[float] | None = None,
|
|
173
|
+
tactile: list[float] | None = None,
|
|
174
|
+
intrinsics: list[float] | None = None,
|
|
175
|
+
) -> dict:
|
|
176
|
+
"""Build one observation from a URL, raw base64, a local path, or a rig.
|
|
177
|
+
|
|
178
|
+
`cameras` is the multi-view form: a mapping of camera name to URL, local
|
|
179
|
+
path or base64. It exists because the single-camera helper was a trap for
|
|
180
|
+
exactly the checkpoints most people reach for. pi0.5 on ALOHA wants four
|
|
181
|
+
named views, and a policy trained with a wrist camera second produces
|
|
182
|
+
confident nonsense if the streams are swapped, with nothing in the
|
|
183
|
+
response to say so. Names must match what the checkpoint declares.
|
|
184
|
+
|
|
185
|
+
obs = sk.observation(
|
|
186
|
+
cameras={"cam_high": "frames/high.jpg",
|
|
187
|
+
"cam_low": "frames/low.jpg",
|
|
188
|
+
"cam_left_wrist": "frames/lw.jpg",
|
|
189
|
+
"cam_right_wrist": "frames/rw.jpg"},
|
|
190
|
+
proprio=joint_positions)
|
|
191
|
+
"""
|
|
192
|
+
if cameras:
|
|
193
|
+
if image_url or image_b64 or image_path:
|
|
194
|
+
raise ValueError("pass `cameras` or a single image, not both")
|
|
195
|
+
obs = {"frames": [dict({"camera": name}, **_frame_source(v))
|
|
196
|
+
for name, v in cameras.items()]}
|
|
197
|
+
if proprio is not None:
|
|
198
|
+
obs["proprio"] = proprio
|
|
199
|
+
if tactile is not None:
|
|
200
|
+
obs["tactile"] = tactile
|
|
201
|
+
return obs
|
|
202
|
+
if image_path is not None:
|
|
203
|
+
image_b64 = base64.b64encode(pathlib.Path(image_path).read_bytes()).decode()
|
|
204
|
+
if bool(image_url) == bool(image_b64):
|
|
205
|
+
raise ValueError("provide exactly one of image_url, image_b64, "
|
|
206
|
+
"image_path or cameras")
|
|
207
|
+
obs: dict[str, Any] = {
|
|
208
|
+
"frames": [{"camera": camera, "url": image_url, "b64": image_b64,
|
|
209
|
+
"intrinsics": intrinsics}]
|
|
210
|
+
}
|
|
211
|
+
if depth_url:
|
|
212
|
+
obs["depth"] = [{"camera": camera, "url": depth_url}]
|
|
213
|
+
if proprio is not None:
|
|
214
|
+
obs["proprio"] = proprio
|
|
215
|
+
if tactile is not None:
|
|
216
|
+
obs["tactile"] = tactile
|
|
217
|
+
return obs
|
|
218
|
+
|
|
219
|
+
# ------------------------------------------------------------------
|
|
220
|
+
def _post(self, path: str, payload: dict) -> dict:
|
|
221
|
+
r = self._client.post(f"{self.base_url}{path}", json=payload)
|
|
222
|
+
if r.status_code >= 400:
|
|
223
|
+
raise SidekickError(r.status_code, _safe_json(r))
|
|
224
|
+
return r.json()
|
|
225
|
+
|
|
226
|
+
def _get(self, path: str, params: dict | None = None) -> dict:
|
|
227
|
+
r = self._client.get(f"{self.base_url}{path}", params=params)
|
|
228
|
+
if r.status_code >= 400:
|
|
229
|
+
raise SidekickError(r.status_code, _safe_json(r))
|
|
230
|
+
return r.json()
|
|
231
|
+
|
|
232
|
+
# ------------------------------------------------------------------
|
|
233
|
+
def predict(
|
|
234
|
+
self,
|
|
235
|
+
*,
|
|
236
|
+
model: str,
|
|
237
|
+
observations: list[dict],
|
|
238
|
+
actions: dict | None = None,
|
|
239
|
+
instruction: str | None = None,
|
|
240
|
+
horizon: int = 16,
|
|
241
|
+
fps: int = 10,
|
|
242
|
+
resolution: str | None = None,
|
|
243
|
+
models: list[str] | None = None,
|
|
244
|
+
preference: str | None = None,
|
|
245
|
+
provider: dict | None = None,
|
|
246
|
+
seed: int | None = None,
|
|
247
|
+
return_latents: bool = False,
|
|
248
|
+
**kwargs: Any,
|
|
249
|
+
) -> Prediction:
|
|
250
|
+
body = _clean({
|
|
251
|
+
"model": model, "models": models, "observations": observations,
|
|
252
|
+
"actions": actions, "instruction": instruction, "horizon": horizon,
|
|
253
|
+
"fps": fps, "resolution": resolution, "provider": provider or {},
|
|
254
|
+
"preference": preference, "seed": seed, "return_latents": return_latents, **kwargs,
|
|
255
|
+
})
|
|
256
|
+
d = self._post("/v1/predict", body)
|
|
257
|
+
return Prediction(id=d["id"], model=d["model"], frames=d["frames"],
|
|
258
|
+
route=d["route"], usage=d["usage"], latents_url=d.get("latents_url"))
|
|
259
|
+
|
|
260
|
+
def stream_predict(self, **kwargs: Any) -> Iterator[tuple[str, dict]]:
|
|
261
|
+
"""Yield (event, payload) as the model generates. Events: route, frame,
|
|
262
|
+
done, error, end."""
|
|
263
|
+
body = _clean({"horizon": 16, "fps": 10, "provider": {}, **kwargs})
|
|
264
|
+
with self._client.stream("POST", f"{self.base_url}/v1/predict/stream", json=body) as r:
|
|
265
|
+
if r.status_code >= 400:
|
|
266
|
+
r.read()
|
|
267
|
+
raise SidekickError(r.status_code, _safe_json(r))
|
|
268
|
+
event = None
|
|
269
|
+
for line in r.iter_lines():
|
|
270
|
+
if line.startswith("event: "):
|
|
271
|
+
event = line[7:].strip()
|
|
272
|
+
elif line.startswith("data: ") and event:
|
|
273
|
+
yield event, json.loads(line[6:])
|
|
274
|
+
if event == "end":
|
|
275
|
+
return
|
|
276
|
+
|
|
277
|
+
def act(
|
|
278
|
+
self,
|
|
279
|
+
*,
|
|
280
|
+
model: str,
|
|
281
|
+
observations: list[dict],
|
|
282
|
+
instruction: str | None = None,
|
|
283
|
+
action_space: str = "ee_delta_6d_grip",
|
|
284
|
+
horizon: int = 16,
|
|
285
|
+
goal_image: dict | None = None,
|
|
286
|
+
models: list[str] | None = None,
|
|
287
|
+
preference: str | None = None,
|
|
288
|
+
provider: dict | None = None,
|
|
289
|
+
temperature: float | None = None,
|
|
290
|
+
return_prediction: bool = False,
|
|
291
|
+
**kwargs: Any,
|
|
292
|
+
) -> Action:
|
|
293
|
+
body = _clean({
|
|
294
|
+
"model": model, "models": models, "observations": observations,
|
|
295
|
+
"instruction": instruction, "action_space": action_space,
|
|
296
|
+
"horizon": horizon, "goal_image": goal_image, "provider": provider or {},
|
|
297
|
+
"preference": preference,
|
|
298
|
+
"temperature": temperature, "return_prediction": return_prediction, **kwargs,
|
|
299
|
+
})
|
|
300
|
+
d = self._post("/v1/act", body)
|
|
301
|
+
return Action(id=d["id"], model=d["model"], action=d["action"], route=d["route"],
|
|
302
|
+
usage=d["usage"], confidence=d.get("confidence"),
|
|
303
|
+
predicted_frames=d.get("predicted_frames"))
|
|
304
|
+
|
|
305
|
+
def ground(
|
|
306
|
+
self,
|
|
307
|
+
*,
|
|
308
|
+
observations: list[dict],
|
|
309
|
+
instruction: str | None = None,
|
|
310
|
+
model: str = "sidekick/ground",
|
|
311
|
+
max_images: int = 3,
|
|
312
|
+
max_tokens: int = 1024,
|
|
313
|
+
provider: dict | None = None,
|
|
314
|
+
**kwargs: Any,
|
|
315
|
+
) -> Grounding:
|
|
316
|
+
"""Ask where things are. Points and boxes, never actions.
|
|
317
|
+
|
|
318
|
+
g = sk.ground(observations=[sk.observation(image_path="scene.jpg")],
|
|
319
|
+
instruction="point at every graspable object")
|
|
320
|
+
"""
|
|
321
|
+
d = self._post("/v1/ground", _clean({
|
|
322
|
+
"model": model, "observations": observations, "instruction": instruction,
|
|
323
|
+
"max_images": max_images, "max_tokens": max_tokens,
|
|
324
|
+
"provider": provider or {}, **kwargs,
|
|
325
|
+
}))
|
|
326
|
+
return Grounding(id=d["id"], model=d["model"], route=d["route"],
|
|
327
|
+
usage=d["usage"], points=d.get("points", []),
|
|
328
|
+
boxes=d.get("boxes", []), raw=d.get("raw"))
|
|
329
|
+
|
|
330
|
+
def evaluate(self, *, model: str, policy_endpoint: str, scenario: str,
|
|
331
|
+
episodes: int = 25, metrics: list[str] | None = None,
|
|
332
|
+
**kwargs: Any) -> Evaluation:
|
|
333
|
+
d = self._post("/v1/evaluate", _clean({
|
|
334
|
+
"model": model, "policy_endpoint": policy_endpoint, "scenario": scenario,
|
|
335
|
+
"episodes": episodes, "metrics": metrics, **kwargs,
|
|
336
|
+
}))
|
|
337
|
+
return _to_eval(d)
|
|
338
|
+
|
|
339
|
+
def evaluation(self, job_id: str) -> Evaluation:
|
|
340
|
+
return _to_eval(self._get(f"/v1/evaluate/{job_id}"))
|
|
341
|
+
|
|
342
|
+
def wait_for_evaluation(self, job_id: str, *, poll_s: float = 2.0,
|
|
343
|
+
timeout_s: float = 3600) -> Evaluation:
|
|
344
|
+
import time
|
|
345
|
+
|
|
346
|
+
deadline = time.time() + timeout_s
|
|
347
|
+
while time.time() < deadline:
|
|
348
|
+
job = self.evaluation(job_id)
|
|
349
|
+
if job.status in {"succeeded", "failed", "cancelled"}:
|
|
350
|
+
return job
|
|
351
|
+
time.sleep(poll_s)
|
|
352
|
+
raise TimeoutError(f"evaluation {job_id} did not finish in {timeout_s}s")
|
|
353
|
+
|
|
354
|
+
# ------------------------------------------------------------------
|
|
355
|
+
def models(self, **filters: Any) -> list[dict]:
|
|
356
|
+
return self._get("/v1/models", _clean(filters))["data"]
|
|
357
|
+
|
|
358
|
+
def model(self, model_id: str) -> dict:
|
|
359
|
+
return self._get(f"/v1/models/{model_id}")
|
|
360
|
+
|
|
361
|
+
def providers(self) -> list[dict]:
|
|
362
|
+
return self._get("/v1/providers")["data"]
|
|
363
|
+
|
|
364
|
+
def routes(self) -> list[dict]:
|
|
365
|
+
return self._get("/v1/routes")["data"]
|
|
366
|
+
|
|
367
|
+
def taxonomy(self) -> dict:
|
|
368
|
+
"""Every value the catalog filters accept, with counts. Call this instead
|
|
369
|
+
of hard-coding domain / family / action-space strings."""
|
|
370
|
+
return self._get("/v1/taxonomy")
|
|
371
|
+
|
|
372
|
+
def scenarios(self, *, target: str | None = None,
|
|
373
|
+
runnable: bool | None = None) -> list[dict]:
|
|
374
|
+
"""The benchmark registry: valid values for `evaluate(scenario=...)`."""
|
|
375
|
+
return self._get("/v1/scenarios", _clean({"target": target, "runnable": runnable}))["data"]
|
|
376
|
+
|
|
377
|
+
def literature(self, *, kind: str | None = None) -> list[dict]:
|
|
378
|
+
"""Surveys, position papers, theory. Catalogued, never servable."""
|
|
379
|
+
return self._get("/v1/literature", _clean({"kind": kind}))["data"]
|
|
380
|
+
|
|
381
|
+
def action_space_dims(self, space: str) -> int | None:
|
|
382
|
+
"""How many numbers one step in this action space carries."""
|
|
383
|
+
for row in self.taxonomy()["action_spaces"]:
|
|
384
|
+
if row["id"] == space:
|
|
385
|
+
return row["dims"]
|
|
386
|
+
return None
|
|
387
|
+
|
|
388
|
+
def preview_route(self, *, model: str, horizon: int = 16,
|
|
389
|
+
provider: dict | None = None, contract: str = "predict") -> list[dict]:
|
|
390
|
+
"""Dry-run the router. Free, no inference happens."""
|
|
391
|
+
body = {"model": model, "horizon": horizon, "provider": provider or {},
|
|
392
|
+
"observations": [{"frames": [{"url": "https://example.invalid/probe.png"}]}]}
|
|
393
|
+
r = self._client.post(f"{self.base_url}/v1/routes/preview",
|
|
394
|
+
params={"contract": contract}, json=body)
|
|
395
|
+
if r.status_code >= 400:
|
|
396
|
+
raise SidekickError(r.status_code, _safe_json(r))
|
|
397
|
+
return r.json()["plan"]
|
|
398
|
+
|
|
399
|
+
def usage(self, limit: int = 50) -> dict:
|
|
400
|
+
return self._get("/v1/usage", {"limit": limit})
|
|
401
|
+
|
|
402
|
+
def key(self) -> dict:
|
|
403
|
+
return self._get("/v1/key")
|
|
404
|
+
|
|
405
|
+
def stream_actions(self, **kwargs: Any) -> "ActionStream":
|
|
406
|
+
"""A buffered action stream for a control loop. See ActionStream."""
|
|
407
|
+
return ActionStream(self, **kwargs)
|
|
408
|
+
|
|
409
|
+
def close(self) -> None:
|
|
410
|
+
self._client.close()
|
|
411
|
+
|
|
412
|
+
def __enter__(self) -> "Sidekick":
|
|
413
|
+
return self
|
|
414
|
+
|
|
415
|
+
def __exit__(self, *exc: Any) -> None:
|
|
416
|
+
self.close()
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
def _clean(d: dict) -> dict:
|
|
420
|
+
return {k: v for k, v in d.items() if v is not None}
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
def _safe_json(r: httpx.Response) -> Any:
|
|
424
|
+
try:
|
|
425
|
+
return r.json()
|
|
426
|
+
except ValueError:
|
|
427
|
+
return r.text
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
def _to_eval(d: dict) -> Evaluation:
|
|
431
|
+
return Evaluation(id=d["id"], model=d["model"], status=d["status"],
|
|
432
|
+
scenario=d["scenario"], results=d.get("results"),
|
|
433
|
+
usage=d.get("usage", {}), error=d.get("error"))
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
def _frame_source(value: str) -> dict:
|
|
437
|
+
"""Turn a URL, a local path or raw base64 into a frame body.
|
|
438
|
+
|
|
439
|
+
Guessing is the point: a caller assembling a four-camera rig should not have
|
|
440
|
+
to say which of three encodings each entry is, and getting it wrong is a
|
|
441
|
+
400 rather than a type error.
|
|
442
|
+
"""
|
|
443
|
+
if value.startswith(("http://", "https://")):
|
|
444
|
+
return {"url": value}
|
|
445
|
+
p = pathlib.Path(value)
|
|
446
|
+
if p.exists():
|
|
447
|
+
return {"b64": base64.b64encode(p.read_bytes()).decode()}
|
|
448
|
+
return {"b64": value}
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
class UnsafeResponse(RuntimeError):
|
|
452
|
+
"""A response that must not reach an actuator.
|
|
453
|
+
|
|
454
|
+
Separate from SidekickError on purpose. A SidekickError means the call did
|
|
455
|
+
not succeed and you should retry or fail. This means the call succeeded and
|
|
456
|
+
the answer is wrong for this robot, which is the more dangerous case because
|
|
457
|
+
nothing about the response looks broken.
|
|
458
|
+
"""
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
class ActionStream:
|
|
462
|
+
"""A local action buffer kept full from a remote policy.
|
|
463
|
+
|
|
464
|
+
The integration problem this solves: **you cannot call a cloud API once per
|
|
465
|
+
actuation.** A control loop runs at 30 to 200 Hz, a round trip is tens of
|
|
466
|
+
milliseconds before the GPU starts, and a policy answers in several hundred.
|
|
467
|
+
Ask for one action per tick and the robot stands still.
|
|
468
|
+
|
|
469
|
+
So `/v1/act` returns a chunk of N future actions plus the `dt_ms` they were
|
|
470
|
+
planned for, and this class executes that chunk from a local buffer while
|
|
471
|
+
fetching the next one on a background thread. Two threads, and the split is
|
|
472
|
+
the whole design:
|
|
473
|
+
|
|
474
|
+
your control thread real-time, reads the buffer, never blocks
|
|
475
|
+
the policy thread does the HTTP, refills the buffer, may be slow
|
|
476
|
+
|
|
477
|
+
Usage:
|
|
478
|
+
|
|
479
|
+
stream = sk.stream_actions(
|
|
480
|
+
model="sidekick/auto:manipulation",
|
|
481
|
+
instruction="fold the towel",
|
|
482
|
+
action_space="joint_pos_14", dof=14,
|
|
483
|
+
observe=lambda: sk.observation(cameras=rig.capture(),
|
|
484
|
+
proprio=robot.joints()),
|
|
485
|
+
)
|
|
486
|
+
stream.warm_up() # while the arm is still braked
|
|
487
|
+
with stream:
|
|
488
|
+
while running:
|
|
489
|
+
step = stream.next_action()
|
|
490
|
+
if step is None:
|
|
491
|
+
robot.hold() # policy fell behind; decelerate, never repeat
|
|
492
|
+
else:
|
|
493
|
+
robot.set_joint_positions(step)
|
|
494
|
+
time.sleep(stream.dt_s)
|
|
495
|
+
|
|
496
|
+
`next_action()` returns None as a real answer, not an error. It means the
|
|
497
|
+
buffer is dry or stale and the correct response is to decelerate. A client
|
|
498
|
+
that repeats its last command instead is a client that keeps driving on a
|
|
499
|
+
world that has moved on.
|
|
500
|
+
"""
|
|
501
|
+
|
|
502
|
+
# Refetch when remaining runway drops below this multiple of measured
|
|
503
|
+
# latency. Expressed in time rather than steps because the step form is
|
|
504
|
+
# wrong in a way that looks right: "refill at 5 steps left" is 330 ms of
|
|
505
|
+
# runway against a 684 ms fetch, so the buffer empties for a third of every
|
|
506
|
+
# cycle and the arm stutters.
|
|
507
|
+
REFILL_LEAD = 1.5
|
|
508
|
+
MAX_CHUNK_AGE_S = 2.0
|
|
509
|
+
|
|
510
|
+
def __init__(self, client: "Sidekick", *, model: str, observe,
|
|
511
|
+
instruction: str | None = None,
|
|
512
|
+
action_space: str = "ee_delta_6d_grip", dof: int | None = None,
|
|
513
|
+
horizon: int = 16, preference: str = "fastest",
|
|
514
|
+
provider: dict | None = None):
|
|
515
|
+
self.sk = client
|
|
516
|
+
self.model = model
|
|
517
|
+
self.observe = observe
|
|
518
|
+
self.instruction = instruction
|
|
519
|
+
self.action_space = action_space
|
|
520
|
+
self.dof = dof
|
|
521
|
+
self.horizon = horizon
|
|
522
|
+
self.preference = preference
|
|
523
|
+
self.provider = provider or {"allow_simulated": False}
|
|
524
|
+
|
|
525
|
+
self._buffer: "collections.deque[list[float]]" = collections.deque()
|
|
526
|
+
self._lock = threading.Lock()
|
|
527
|
+
self._chunk_at = 0.0
|
|
528
|
+
self._dt_ms = 100
|
|
529
|
+
# Seeded pessimistically: an optimistic first estimate is a stall on the
|
|
530
|
+
# first cycle, before any measurement exists to correct it.
|
|
531
|
+
self._fetch_s = 1.0
|
|
532
|
+
self._stop = threading.Event()
|
|
533
|
+
self._need = threading.Event()
|
|
534
|
+
self._thread: threading.Thread | None = None
|
|
535
|
+
self.calls = 0
|
|
536
|
+
self.failures = 0
|
|
537
|
+
self.spend_usd = 0.0
|
|
538
|
+
self.last_error: str | None = None
|
|
539
|
+
|
|
540
|
+
# -- safety ----------------------------------------------------------
|
|
541
|
+
def check(self, act: "Action") -> None:
|
|
542
|
+
"""Every way a response can be well-formed and still wrong for this robot."""
|
|
543
|
+
if act.route.get("simulated"):
|
|
544
|
+
raise UnsafeResponse("route.simulated is true: placeholder output, no GPU ran")
|
|
545
|
+
if act.space != self.action_space:
|
|
546
|
+
raise UnsafeResponse(
|
|
547
|
+
f"got action space {act.space!r}, this robot is {self.action_space!r}")
|
|
548
|
+
if self.dof is not None:
|
|
549
|
+
for i, step in enumerate(act.steps):
|
|
550
|
+
if len(step) != self.dof:
|
|
551
|
+
raise UnsafeResponse(
|
|
552
|
+
f"step {i} has {len(step)} values, this robot has {self.dof} joints")
|
|
553
|
+
|
|
554
|
+
# -- the policy thread -----------------------------------------------
|
|
555
|
+
def _fetch(self) -> None:
|
|
556
|
+
started = time.monotonic()
|
|
557
|
+
act = self.sk.act(
|
|
558
|
+
model=self.model, observations=[self.observe()],
|
|
559
|
+
instruction=self.instruction, action_space=self.action_space,
|
|
560
|
+
horizon=self.horizon, preference=self.preference, provider=self.provider,
|
|
561
|
+
)
|
|
562
|
+
self.check(act)
|
|
563
|
+
elapsed = time.monotonic() - started
|
|
564
|
+
with self._lock:
|
|
565
|
+
# Append rather than replace: the steps still queued were planned
|
|
566
|
+
# from a real observation, and discarding them opens exactly the gap
|
|
567
|
+
# this class exists to close.
|
|
568
|
+
self._buffer.extend(act.steps)
|
|
569
|
+
self._chunk_at = time.monotonic()
|
|
570
|
+
self._dt_ms = act.action.get("dt_ms", self._dt_ms)
|
|
571
|
+
self._fetch_s = 0.7 * self._fetch_s + 0.3 * elapsed
|
|
572
|
+
self.calls += 1
|
|
573
|
+
self.spend_usd += act.usage.get("cost_usd", 0.0)
|
|
574
|
+
self.last_error = None
|
|
575
|
+
|
|
576
|
+
def _run(self) -> None:
|
|
577
|
+
while not self._stop.is_set():
|
|
578
|
+
if not self._need.wait(timeout=0.1):
|
|
579
|
+
continue
|
|
580
|
+
self._need.clear()
|
|
581
|
+
try:
|
|
582
|
+
self._fetch()
|
|
583
|
+
except Exception as exc: # noqa: BLE001
|
|
584
|
+
# Never clear the buffer on failure. What is left is still valid
|
|
585
|
+
# for a few hundred milliseconds, which is enough for the control
|
|
586
|
+
# thread to notice and decelerate rather than fault.
|
|
587
|
+
self.failures += 1
|
|
588
|
+
self.last_error = f"{type(exc).__name__}: {exc}"
|
|
589
|
+
|
|
590
|
+
# -- the control thread ----------------------------------------------
|
|
591
|
+
def warm_up(self, timeout_s: float = 180.0) -> None:
|
|
592
|
+
"""Fetch one chunk before the robot is enabled.
|
|
593
|
+
|
|
594
|
+
A cold serverless container loads several GB of weights. That belongs
|
|
595
|
+
here, with the arm braked, not on the first tick of a live loop.
|
|
596
|
+
"""
|
|
597
|
+
deadline = time.monotonic() + timeout_s
|
|
598
|
+
while time.monotonic() < deadline:
|
|
599
|
+
try:
|
|
600
|
+
self._fetch()
|
|
601
|
+
return
|
|
602
|
+
except Exception as exc: # noqa: BLE001
|
|
603
|
+
self.last_error = f"{type(exc).__name__}: {exc}"
|
|
604
|
+
time.sleep(2.0)
|
|
605
|
+
raise TimeoutError(f"policy did not warm in {timeout_s:g}s: {self.last_error}")
|
|
606
|
+
|
|
607
|
+
def start(self) -> "ActionStream":
|
|
608
|
+
self._thread = threading.Thread(target=self._run, daemon=True)
|
|
609
|
+
self._thread.start()
|
|
610
|
+
return self
|
|
611
|
+
|
|
612
|
+
def stop(self) -> None:
|
|
613
|
+
self._stop.set()
|
|
614
|
+
if self._thread:
|
|
615
|
+
self._thread.join(timeout=2.0)
|
|
616
|
+
|
|
617
|
+
def __enter__(self) -> "ActionStream":
|
|
618
|
+
return self.start()
|
|
619
|
+
|
|
620
|
+
def __exit__(self, *exc: Any) -> None:
|
|
621
|
+
self.stop()
|
|
622
|
+
|
|
623
|
+
@property
|
|
624
|
+
def dt_s(self) -> float:
|
|
625
|
+
return self._dt_ms / 1000.0
|
|
626
|
+
|
|
627
|
+
def next_action(self) -> list[float] | None:
|
|
628
|
+
"""One step, or None if the buffer is dry or stale. Never blocks."""
|
|
629
|
+
with self._lock:
|
|
630
|
+
if not self._buffer:
|
|
631
|
+
self._need.set()
|
|
632
|
+
return None
|
|
633
|
+
if time.monotonic() - self._chunk_at > self.MAX_CHUNK_AGE_S:
|
|
634
|
+
self._buffer.clear()
|
|
635
|
+
self._need.set()
|
|
636
|
+
return None
|
|
637
|
+
step = self._buffer.popleft()
|
|
638
|
+
runway_s = len(self._buffer) * self._dt_ms / 1000.0
|
|
639
|
+
if runway_s <= self._fetch_s * self.REFILL_LEAD:
|
|
640
|
+
self._need.set()
|
|
641
|
+
return step
|
sidekick_sdk/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sidekick-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for the Sidekick Robotics API: one endpoint for every robotics foundation model.
|
|
5
|
+
Author: Sidekick Robotics
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://www.sidekickrobotics.ai
|
|
8
|
+
Project-URL: Documentation, https://www.sidekickrobotics.ai/api
|
|
9
|
+
Project-URL: Source, https://github.com/sidekickrobo/sidekick-sdk
|
|
10
|
+
Project-URL: Issues, https://github.com/sidekickrobo/sidekick-sdk/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/sidekickrobo/sidekick-sdk/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: robotics,vla,world-model,embodied-ai,policy,inference,manipulation,control-loop
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: httpx>=0.27
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
29
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# sidekick-sdk
|
|
33
|
+
|
|
34
|
+
[](https://github.com/sidekickrobo/sidekick-sdk/actions/workflows/ci.yml)
|
|
35
|
+
[](https://pypi.org/project/sidekick-sdk/)
|
|
36
|
+
[](https://pypi.org/project/sidekick-sdk/)
|
|
37
|
+
[](LICENSE)
|
|
38
|
+
|
|
39
|
+
Python client for the [Sidekick Robotics](https://www.sidekickrobotics.ai) API:
|
|
40
|
+
one endpoint for every robotics foundation model, with routing, fallback and
|
|
41
|
+
per-request billing.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install sidekick-sdk
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**One dependency (`httpx`).** It installs on a robot control computer, or inside
|
|
48
|
+
a ROS container, without dragging a web framework along.
|
|
49
|
+
|
|
50
|
+
Get an API key at [sidekickrobotics.ai/api](https://www.sidekickrobotics.ai/api).
|
|
51
|
+
|
|
52
|
+
## Sixty seconds
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from sidekick_sdk import Sidekick
|
|
56
|
+
|
|
57
|
+
sk = Sidekick(api_key="sk-sidekick-...")
|
|
58
|
+
|
|
59
|
+
act = sk.act(
|
|
60
|
+
model="sidekick/auto:manipulation", # ask for a job, not a checkpoint
|
|
61
|
+
observations=[sk.observation(image_path="frame.jpg", proprio=joints)],
|
|
62
|
+
instruction="put the spoon on the towel",
|
|
63
|
+
action_space="joint_pos_14",
|
|
64
|
+
horizon=16,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
print(act.route["model"]) # which checkpoint actually served you
|
|
68
|
+
print(act.usage["cost_usd"]) # what it cost
|
|
69
|
+
robot.execute(act.steps)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`model` takes a router alias (`sidekick/auto:manipulation`), a concrete model
|
|
73
|
+
id, or a list via `models=[...]` in the order you want them tried. Every
|
|
74
|
+
response carries `route`, so you always know what answered and whether it fell
|
|
75
|
+
back.
|
|
76
|
+
|
|
77
|
+
## Say what you care about
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
sk.act(..., preference="fastest") # balanced | fastest | cheapest | reliable
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`fastest` orders live candidates by measured latency, `cheapest` by price,
|
|
84
|
+
`reliable` by success rate, `balanced` blends them. Add hard constraints
|
|
85
|
+
alongside it:
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
sk.act(..., provider={"max_latency_ms": 900, "allow_simulated": False})
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`allow_simulated=False` is the one to set for anything with an actuator behind
|
|
92
|
+
it. Without it a placeholder response is structurally indistinguishable from a
|
|
93
|
+
real one.
|
|
94
|
+
|
|
95
|
+
## Four contracts, on purpose
|
|
96
|
+
|
|
97
|
+
| Call | Question it answers | Returns |
|
|
98
|
+
| --- | --- | --- |
|
|
99
|
+
| `sk.predict()` | what happens next | future frames |
|
|
100
|
+
| `sk.act()` | what should I do next | an action chunk |
|
|
101
|
+
| `sk.ground()` | where is the thing | boxes, masks, points |
|
|
102
|
+
| `sk.evaluate()` | is this policy any good | a benchmark job |
|
|
103
|
+
|
|
104
|
+
They are not interchangeable, and the router will not silently serve one where
|
|
105
|
+
you asked for another.
|
|
106
|
+
|
|
107
|
+
## Control loops
|
|
108
|
+
|
|
109
|
+
The one thing that catches people: **you cannot call a cloud API once per
|
|
110
|
+
actuation.** A control loop runs at 30 to 200 Hz and a policy answers in
|
|
111
|
+
several hundred milliseconds. `/v1/act` therefore returns a *chunk* of N future
|
|
112
|
+
actions plus the `dt_ms` they were planned for; the robot executes that chunk
|
|
113
|
+
from a local buffer while the next one is fetched in the background.
|
|
114
|
+
|
|
115
|
+
`ActionStream` is that buffer, and the timing it gets right is not obvious:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
stream = sk.stream_actions(
|
|
119
|
+
model="sidekick/auto:manipulation",
|
|
120
|
+
instruction="fold the towel",
|
|
121
|
+
action_space="joint_pos_14", dof=14,
|
|
122
|
+
preference="fastest",
|
|
123
|
+
observe=lambda: sk.observation(cameras=rig.capture(), proprio=robot.joints()),
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
stream.warm_up() # cold container, arm still braked
|
|
127
|
+
with stream: # starts the background policy thread
|
|
128
|
+
while running:
|
|
129
|
+
step = stream.next_action()
|
|
130
|
+
if step is None:
|
|
131
|
+
robot.hold() # policy fell behind; decelerate, never repeat
|
|
132
|
+
else:
|
|
133
|
+
robot.set_joint_positions(step)
|
|
134
|
+
time.sleep(stream.dt_s)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Three things worth knowing about it:
|
|
138
|
+
|
|
139
|
+
- **`next_action()` never blocks and never raises.** All network work happens on
|
|
140
|
+
the policy thread. Your servo loop stays real-time.
|
|
141
|
+
- **`None` is a real answer.** The buffer is dry or the chunk is stale. Hold or
|
|
142
|
+
decelerate. Repeating the last command indefinitely is a robot acting on a
|
|
143
|
+
world that has moved on.
|
|
144
|
+
- **Refills are triggered in time, not in steps.** "Refetch when 5 steps are
|
|
145
|
+
left" sounds right and stalls: 5 steps at 66 ms is 330 ms of runway against a
|
|
146
|
+
684 ms fetch. The stream measures its own round trip and refills at 1.5x it.
|
|
147
|
+
|
|
148
|
+
`stream.check()` runs three guards on every chunk before it can reach an
|
|
149
|
+
actuator, raising `UnsafeResponse` on a simulated route, a mismatched action
|
|
150
|
+
space, or a step whose width is not this robot's DOF.
|
|
151
|
+
|
|
152
|
+
## Multi-camera rigs
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
obs = sk.observation(
|
|
156
|
+
cameras={"cam_high": "frames/high.jpg",
|
|
157
|
+
"cam_low": "frames/low.jpg",
|
|
158
|
+
"cam_left_wrist": "frames/lw.jpg",
|
|
159
|
+
"cam_right_wrist": "frames/rw.jpg"},
|
|
160
|
+
proprio=joint_positions)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Values can be URLs, local paths or base64. Camera names must match what the
|
|
164
|
+
checkpoint declares: a wrist view passed as the head view produces confident
|
|
165
|
+
nonsense, and nothing in the response says so.
|
|
166
|
+
|
|
167
|
+
## Discovery
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
sk.routes() # router aliases that are live right now
|
|
171
|
+
sk.models(domain="manipulation") # the catalog
|
|
172
|
+
sk.taxonomy() # every value the filters accept, with counts
|
|
173
|
+
sk.action_space_dims("joint_pos_14")
|
|
174
|
+
sk.preview_route(model="sidekick/auto:manipulation", contract="act") # free dry run
|
|
175
|
+
sk.usage() # your ledger
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Call `taxonomy()` instead of hard-coding domain, family or action-space strings.
|
|
179
|
+
|
|
180
|
+
## Configuration
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
Sidekick(api_key=..., base_url=..., timeout=120.0, max_retries=2)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
`base_url` defaults to `$SIDEKICK_ORIGIN`, then to the public gateway. Point it
|
|
187
|
+
at a private deployment without touching call sites.
|
|
188
|
+
|
|
189
|
+
## Errors
|
|
190
|
+
|
|
191
|
+
`SidekickError` carries `.status`, `.code` and `.body`. `UnsafeResponse` is
|
|
192
|
+
separate on purpose: a `SidekickError` means the call did not succeed and you
|
|
193
|
+
should retry; an `UnsafeResponse` means the call succeeded and the answer is
|
|
194
|
+
wrong for this robot, which is the more dangerous case because nothing about it
|
|
195
|
+
looks broken.
|
|
196
|
+
|
|
197
|
+
Full API reference: <https://www.sidekickrobotics.ai/api>
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
## Contributing
|
|
201
|
+
|
|
202
|
+
Issues and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
sidekick_sdk/__init__.py,sha256=3dd_BW1lUCoaE6l4pdCoSD4urTtB8fV7mkYC7VQbR-4,24588
|
|
2
|
+
sidekick_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
sidekick_sdk-0.1.0.dist-info/licenses/LICENSE,sha256=iItzXBHkOU2y6V4sW16TWJTouWv07Xt1Anj1jLQOlZo,11315
|
|
4
|
+
sidekick_sdk-0.1.0.dist-info/METADATA,sha256=m6WnLE9JdBYAsZ6N641JAzjsSCmYCClRVlyX4IuMtAQ,7652
|
|
5
|
+
sidekick_sdk-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
6
|
+
sidekick_sdk-0.1.0.dist-info/top_level.txt,sha256=KIcHTcBULSDubmotziXURM-zMHGQHSzs-WbAPkatXKo,13
|
|
7
|
+
sidekick_sdk-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Sidekick Robotics
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sidekick_sdk
|