-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
528 lines (486 loc) · 11.4 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
x-vol-cogip: &vol-cogip
"./cogip:/src/cogip"
x-vol-run: &vol-run
"run:/var/run/cogip"
x-vol-pts: &vol-pts
"/dev/pts:/dev/pts"
x-vol-vscode: &vol-vscode
"vscode:/root/.vscode-server"
x-volumes-common: &volumes-common
volumes:
- *vol-run
- *vol-pts
- *vol-vscode
- "build_cache:/src/build"
x-extra-hosts-common: &extra-hosts-common
extra_hosts:
host.docker.internal: host-gateway
x-watch-pyproject: &watch-pyproject
path: ./pyproject.toml
action: sync+restart
target: /src/pyproject.toml
x-watch-python: &watch-python
path: ./cogip
action: sync
target: /src/cogip
x-watch-cpp: &watch-cpp
path: ./cogip/cpp
action: sync+restart
target: /src/cogip
x-watch-all: &watch-all
develop:
watch:
- *watch-pyproject
- *watch-python
- *watch-cpp
x-build-console: &build-console
build:
context: .
target: cogip-console
x-build-gui: &build-gui
build:
context: .
target: cogip-gui
x-build-firmware: &build-firmware
build:
context: .
target: cogip-firmware
working_dir: /cogip-tools/submodules/mcu-firmware
volumes:
- *vol-run
- *vol-pts
- *vol-vscode
- ".:/cogip-tools"
command:
- /bin/sh
- -x
- -c
- make -C applications/$${FIRMWARE_APP} -j$$(nproc) BOARD=$${FIRMWARE_BOARD}
x-socat: &socat
<<: *build-console
volumes:
- *vol-run
- *vol-pts
command:
- /bin/sh
- -x
- -c
- |
socat -d pty,raw,echo=0,link=/var/run/cogip/ptySTM32-$${ROBOT_ID} pty,raw,echo=0,link=/var/run/cogip/ptyRPI-$${ROBOT_ID} &
sleep infinity
x-firmware: &firmware
<<: *build-firmware
network_mode: "host"
environment: &env-firmware
FIRMWARE_BOARD: ${FIRMWARE_BOARD:-cogip-native}
stdin_open: true
tty: true
command:
- /bin/sh
- -x
- -c
- applications/$${FIRMWARE_APP}/bin/$${FIRMWARE_BOARD}/$${FIRMWARE_APP}.elf $${FIRMWARE_OPTIONS}
x-robot: &robot
<<: [*build-console, *volumes-common, *extra-hosts-common, *watch-all]
network_mode: "host"
cap_add:
- SYS_PTRACE
environment: &env-robot
SERVER_DEBUG:
SERVER_RELOAD:
PLANNER_DEBUG:
PLANNER_RELOAD:
PLANNER_ROBOT_WIDTH:
PLANNER_ROBOT_LENGTH:
PLANNER_OBSTACLE_RADIUS:
PLANNER_OBSTACLE_BB_MARGIN:
PLANNER_OBSTACLE_BB_VERTICES:
PLANNER_OBSTACLE_SENDER_INTERVAL:
PLANNER_PATH_REFRESH_INTERVAL:
COPILOT_RELOAD:
COPILOT_DEBUG:
DETECTOR_RELOAD:
DETECTOR_DEBUG:
DETECTOR_UART_PORT:
DETECTOR_UART_SPEED:
DETECTOR_MIN_DISTANCE:
DETECTOR_MAX_DISTANCE:
DETECTOR_BEACON_RADIUS:
DETECTOR_REFRESH_INTERVAL:
DETECTOR_EMULATION: 1
command:
- /bin/sh
- -x
- -c
- |
uv sync --frozen --reinstall-package cogip-tools -C build-dir=/src/build/$${ROBOT_ID}
uv run cogip-server &
wait-for-it -t 0 localhost:809$${ROBOT_ID}
uv run cogip-planner &
uv run cogip-copilot --can-channel vcan0 -b 500000 -B 1000000 &
uv run cogip-detector &
uv run cogip-dashboard &
sleep infinity
stop_signal: SIGKILL
x-pami: &pami
<<: [*build-console, *volumes-common, *extra-hosts-common, *watch-all]
network_mode: "host"
cap_add:
- SYS_PTRACE
environment: &env-pami
SERVER_DEBUG:
SERVER_RELOAD:
PLANNER_DEBUG:
PLANNER_RELOAD:
PLANNER_ROBOT_LENGTH: 212
PLANNER_ROBOT_WIDTH: 140
PLANNER_OBSTACLE_RADIUS:
PLANNER_OBSTACLE_BB_MARGIN:
PLANNER_OBSTACLE_BB_VERTICES: 6
PLANNER_OBSTACLE_SENDER_INTERVAL:
PLANNER_PATH_REFRESH_INTERVAL:
COPILOT_PAMI_RELOAD:
COPILOT_PAMI_DEBUG:
DETECTOR_PAMI_TOF_BUS:
DETECTOR_PAMI_TOF_ADDRESS:
DETECTOR_PAMI_MIN_DISTANCE:
DETECTOR_PAMI_MAX_DISTANCE:
DETECTOR_PAMI_REFRESH_INTERVAL:
DETECTOR_PAMI_RELOAD:
DETECTOR_PAMI_DEBUG:
command:
- /bin/sh
- -x
- -c
- |
uv sync --frozen --reinstall-package cogip-tools -C build-dir=/src/build/$${ROBOT_ID}
uv run cogip-server &
wait-for-it -t 0 localhost:809$${ROBOT_ID}
uv run cogip-planner &
uv run cogip-copilot-pami --serial-port /var/run/cogip/ptyRPI-$${ROBOT_ID} &
uv run cogip-detector-pami &
uv run cogip-dashboard &
sleep infinity
x-monitor: &monitor
<< : [*build-gui, *extra-hosts-common]
network_mode: "host"
environment: &env-monitor
DISPLAY:
QTWEBENGINE_DISABLE_SANDBOX: 1
XDG_RUNTIME_DIR:
command:
- /bin/sh
- -x
- -c
- |
wait-for-it -t 0 $${COGIP_SOCKETIO_SERVER_HOST}:$${COGIP_SOCKETIO_SERVER_PORT}
uv run cogip-monitor http://$${COGIP_SOCKETIO_SERVER_HOST}:$${COGIP_SOCKETIO_SERVER_PORT} &
sleep infinity
working_dir: /src
volumes:
- *vol-cogip
- *vol-vscode
- "./assets:/src/assets"
- "/tmp/.X11-unix/:/tmp/.X11-unix/"
- "/dev/dri/:/dev/dri/"
- "$XDG_RUNTIME_DIR:$XDG_RUNTIME_DIR"
services:
beacon:
<<: [*build-console, *extra-hosts-common]
hostname: beacon
network_mode: "host"
ports:
- "8080:8080"
- "8090:8090"
environment:
SERVER_BEACON_MAX_ROBOTS: 4
SERVER_BEACON_RELOAD:
SERVER_BEACON_DEBUG:
volumes:
- *vol-vscode
- "./records:/var/tmp/cogip"
develop:
watch:
- *watch-pyproject
- *watch-python
command:
- /bin/sh
- -x
- -c
- |
uv run cogip-server-beacon &
uv run cogip-dashboard-beacon &
sleep infinity
profiles:
- beacon
socat2:
<< : *socat
hostname: socat2
environment:
ROBOT_ID: 2
profiles:
- robot2
socat3:
<< : *socat
hostname: socat3
environment:
ROBOT_ID: 3
profiles:
- robot3
socat4:
<< : *socat
hostname: socat4
environment:
ROBOT_ID: 4
profiles:
- robot4
make-firmware-motion-control:
<<: *build-firmware
environment:
<< : *env-firmware
FIRMWARE_APP: cup2024-robot-motion-control
command:
- /bin/sh
- -x
- -c
- make -C applications/$${FIRMWARE_APP} -j$$(nproc) BOARD=$${FIRMWARE_BOARD}
profiles:
- robot1
make-firmware-actuators:
<<: *build-firmware
environment:
<< : *env-firmware
FIRMWARE_APP: cup2024-robot-actuators
command:
- /bin/sh
- -x
- -c
- make -C applications/$${FIRMWARE_APP} -j$$(nproc) BOARD=$${FIRMWARE_BOARD}
profiles:
- robot1
make-firmware-motors:
<<: *build-firmware
environment:
<< : *env-firmware
FIRMWARE_APP: cup2024-robot-motors
command:
- /bin/sh
- -x
- -c
- make -C applications/$${FIRMWARE_APP} -j$$(nproc) BOARD=$${FIRMWARE_BOARD}
profiles:
- robot1
make-firmware-pami:
<<: *build-firmware
environment: &env-firmware-pami
<< : *env-firmware
FIRMWARE_APP: cup2024-pami
command:
- /bin/sh
- -x
- -c
- make -C applications/$${FIRMWARE_APP} -j$$(nproc) BOARD=$${FIRMWARE_BOARD}
profiles:
- robot2
- robot3
- robot4
firmware1-motion-control:
<< : *firmware
hostname: firmware1-motion-control
environment:
<< : *env-firmware
FIRMWARE_APP: cup2024-robot-motion-control
depends_on:
make-firmware-motion-control:
condition: service_completed_successfully
profiles:
- robot1
# firmware1-actuators:
# << : *firmware
# hostname: firmware1-actuators
# environment:
# << : *env-firmware
# FIRMWARE_APP: cup2024-robot-actuators
# depends_on:
# make-firmware-actuators:
# condition: service_completed_successfully
# profiles:
# - robot1
# firmware1-motors:
# << : *firmware
# hostname: firmware1-motors
# environment:
# << : *env-firmware
# FIRMWARE_APP: cup2024-robot-motors
# depends_on:
# make-firmware-motors:
# condition: service_completed_successfully
# profiles:
# - robot1
firmware2:
<< : *firmware
hostname: firmware2
environment:
<< : *env-firmware-pami
ROBOT_ID: 2
FIRMWARE_OPTIONS: -c /dev/null -c /var/run/cogip/ptySTM32-2
depends_on:
make-firmware-pami:
condition: service_completed_successfully
socat2:
condition: service_started
profiles:
- robot2
firmware3:
<< : *firmware
hostname: firmware3
environment:
<< : *env-firmware-pami
ROBOT_ID: 3
FIRMWARE_OPTIONS: -c /dev/null -c /var/run/cogip/ptySTM32-3
depends_on:
make-firmware-pami:
condition: service_completed_successfully
socat3:
condition: service_started
profiles:
- robot3
firmware4:
<< : *firmware
hostname: firmware4
environment:
<< : *env-firmware-pami
ROBOT_ID: 4
FIRMWARE_OPTIONS: -c /dev/null -c /var/run/cogip/ptySTM32-4
depends_on:
make-firmware-pami:
condition: service_completed_successfully
socat4:
condition: service_started
profiles:
- robot4
robot1:
<< : *robot
hostname: robot1
ports:
- "8081:8081"
- "8091:8091"
environment:
<< : *env-robot
ROBOT_ID: 1
profiles:
- robot1
robot2:
<< : *pami
hostname: robot2
ports:
- "8082:8082"
- "8092:8092"
environment:
<< : *env-pami
ROBOT_ID: 2
depends_on:
- socat2
profiles:
- robot2
robot3:
<< : *pami
hostname: robot3
ports:
- "8083:8083"
- "8093:8093"
environment:
<< : *env-pami
ROBOT_ID: 3
depends_on:
- socat3
profiles:
- robot3
robot4:
<< : *pami
hostname: robot4
ports:
- "8084:8084"
- "8094:8094"
environment:
<< : *env-pami
ROBOT_ID: 4
depends_on:
- socat4
profiles:
- robot4
monitor1:
<< : *monitor
hostname: monitor1
environment:
<< : *env-monitor
COGIP_SOCKETIO_SERVER_HOST: robot1
COGIP_SOCKETIO_SERVER_PORT: 8091
COGIP_SOCKETIO_SERVER_URL: http://robot1:8091
depends_on:
- robot1
profiles:
- monitor1
monitor2:
<< : *monitor
hostname: monitor2
environment:
<< : *env-monitor
COGIP_SOCKETIO_SERVER_HOST: robot2
COGIP_SOCKETIO_SERVER_PORT: 8092
COGIP_SOCKETIO_SERVER_URL: http://robot2:8092
depends_on:
- robot2
profiles:
- monitor2
monitor3:
<< : *monitor
hostname: monitor2
environment:
<< : *env-monitor
COGIP_SOCKETIO_SERVER_HOST: robot3
COGIP_SOCKETIO_SERVER_PORT: 8093
COGIP_SOCKETIO_SERVER_URL: http://robot3:8093
depends_on:
- robot3
profiles:
- monitor3
monitor4:
<< : *monitor
hostname: monitor4
environment:
<< : *env-monitor
COGIP_SOCKETIO_SERVER_HOST: robot4
COGIP_SOCKETIO_SERVER_PORT: 8094
COGIP_SOCKETIO_SERVER_URL: http://robot4:8094
depends_on:
- robot4
profiles:
- monitor4
build_wheel:
build:
context: .
target: uv_base
platform: "linux/arm64"
command:
- /bin/sh
- -x
- -c
- |
uv build --wheel -C build-dir=/src/build/wheel
chown ${UID:-1000}:${GID:-1000} dist/*_aarch64.whl
volumes:
- "./cogip:/src/cogip"
- "./.python-version:/src/.python-version"
- "./pyproject.toml:/src/pyproject.toml"
- "./uv.lock:/src/uv.lock"
- "./dist:/src/dist"
- "./LICENSE:/src/LICENSE"
- "./.gitignore:/src/.gitignore"
- "build_cache:/src/build/wheel"
profiles:
- build_wheel
volumes:
vscode:
run:
build_cache: