Skip to content

Commit

Permalink
feat(cube_detector): add cube detector/tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
Preclaa committed May 5, 2023
1 parent 86e21ca commit f35f400
Show file tree
Hide file tree
Showing 174 changed files with 2,513 additions and 0 deletions.
36 changes: 36 additions & 0 deletions compose-files/fit-demo/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ services:
condition: service_started
fit-demo-kinect:
condition: service_healthy
fit-demo-cube-detector:
condition: service_healthy
fit-demo-cube-tracker:
condition: service_healthy
fit-demo-scene:
condition: service_healthy
fit-demo-calibration:
Expand All @@ -28,6 +32,8 @@ services:
- "6799:6799"
networks:
- fit-demo-kinect-network
- fit-demo-cube-detector-network
- fit-demo-cube-tracker-network
- fit-demo-scene-network
- fit-demo-project-network
- fit-demo-asset-network
Expand All @@ -42,6 +48,8 @@ services:
- ARCOR2_BUILD_URL=http://fit-demo-build:5008
- ARCOR2_CALIBRATION_URL=http://fit-demo-calibration:5014
- ARCOR2_KINECT_AZURE_URL=http://192.168.104.100:5017 # Run kinect using pants
- ARCOR2_CUBE_DETECTOR_URL=http://fit-demo-cube-detector:5020
- ARCOR2_CUBE_TRACKER_URL=http://fit-demo-cube-tracker:5021

fit-demo-build:
image: arcor2/arcor2_build:1.0.3
Expand All @@ -65,6 +73,7 @@ services:
- fit-demo-scene-network
- fit-demo-dobot-magician-network
- fit-demo-dobot-m1-network
- fit-demo-cube-tracker-network
environment:
- ARCOR2_SCENE_SERVICE_URL=http://fit-demo-scene:5013
- ARCOR2_PROJECT_PATH=/root/project
Expand All @@ -81,6 +90,31 @@ services:
environment:
- ARCOR2_KINECT_AZURE_MOCK=true

fit-demo-cube-detector:
image: arcor2/arcor2_cube_detector:0.1.0
container_name: fit-demo-cube-detector
networks:
- fit-demo-kinect-network
- fit-demo-cube-detector-network
ports:
- "5020:5020"
environment:
- ARCOR2_KINECT_AZURE_URL=http://192.168.104.100:5017
- ARCOR2_CUBE_DETECTOR_URL=http://fit-demo-cube-detector:5020

fit-demo-cube-tracker:
image: arcor2/arcor2_cube_tracker:0.1.0
container_name: fit-demo-cube-tracker
networks:
- fit-demo-cube-tracker-network
- fit-demo-cube-detector-network
- fit-demo-execution-network
ports:
- "5021:5021"
environment:
- ARCOR2_CUBE_TRACKER_URL=http://fit-demo-cube-tracker:5021
- ARCOR2_CUBE_DETECTOR_URL=http://fit-demo-cube-detector:5020

fit-demo-calibration:
image: arcor2/arcor2_calibration:1.0.0
networks:
Expand Down Expand Up @@ -214,6 +248,8 @@ networks:
fit-demo-project-network:
fit-demo-asset-network:
fit-demo-kinect-network:
fit-demo-cube-detector-network:
fit-demo-cube-tracker-network:
fit-demo-dobot-magician-network:
fit-demo-dobot-m1-network:
fit-demo-calibration-network:
5 changes: 5 additions & 0 deletions src/docker/arcor2_cube_detector/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
docker_image(
name="arcor2_cube_detector",
repository="arcor2/arcor2_cube_detector",
image_tags=["0.1.0"],
)
22 changes: 22 additions & 0 deletions src/docker/arcor2_cube_detector/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.10.10-slim-bullseye as deps
COPY src.python.arcor2_cube_detector.scripts/cube_detector.pex /binary.pex
RUN PEX_TOOLS=1 PYTHONOPTIMIZE=1 /usr/local/bin/python3.10 /binary.pex venv --scope=deps --compile /bin/app

FROM python:3.10.10-slim-bullseye as srcs
COPY src.python.arcor2_cube_detector.scripts/cube_detector.pex /binary.pex
RUN PEX_TOOLS=1 PYTHONOPTIMIZE=1 /usr/local/bin/python3.10 /binary.pex venv --scope=srcs --compile /bin/app

FROM python:3.10.10-slim-bullseye

# curl is for healthcheck
RUN apt-get update \
&& apt-get install -y -q --no-install-recommends libgl1-mesa-glx=20.3.5-1 libglib2.0-0=2.66.8-1 libgomp1=10.2.1-6 libusb-1.0-0=2:1.0.24-3 curl=7.74.0-1.3+deb11u7 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["/bin/app/pex"]
COPY --from=deps /bin/app /bin/app
COPY --from=srcs /bin/app /bin/app

EXPOSE 5020
HEALTHCHECK --interval=5s --start-period=60s CMD curl -f http://localhost:5020/healthz/ready || exit 1
5 changes: 5 additions & 0 deletions src/docker/arcor2_cube_tracker/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
docker_image(
name="arcor2_cube_tracker",
repository="arcor2/arcor2_cube_tracker",
image_tags=["0.1.0"],
)
22 changes: 22 additions & 0 deletions src/docker/arcor2_cube_tracker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.10.10-slim-bullseye as deps
COPY src.python.arcor2_cube_tracker.scripts/cube_tracker.pex /binary.pex
RUN PEX_TOOLS=1 PYTHONOPTIMIZE=1 /usr/local/bin/python3.10 /binary.pex venv --scope=deps --compile /bin/app

FROM python:3.10.10-slim-bullseye as srcs
COPY src.python.arcor2_cube_tracker.scripts/cube_tracker.pex /binary.pex
RUN PEX_TOOLS=1 PYTHONOPTIMIZE=1 /usr/local/bin/python3.10 /binary.pex venv --scope=srcs --compile /bin/app

FROM python:3.10.10-slim-bullseye

# curl is for healthcheck
RUN apt-get update \
&& apt-get install -y -q --no-install-recommends libgl1-mesa-glx=20.3.5-1 libglib2.0-0=2.66.8-1 libgomp1=10.2.1-6 libusb-1.0-0=2:1.0.24-3 curl=7.74.0-1.3+deb11u7 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["/bin/app/pex"]
COPY --from=deps /bin/app /bin/app
COPY --from=srcs /bin/app /bin/app

EXPOSE 5021
HEALTHCHECK --interval=5s --start-period=60s CMD curl -f http://localhost:5021/healthz/ready || exit 1
5 changes: 5 additions & 0 deletions src/python/arcor2_cube_detector/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
arcor2_python_distribution(
name="arcor2_cube_detector",
description="Cube detector",
binaries={"arcor2_cube_detector": "src/python/arcor2_cube_detector/scripts:cube_detector"},
)
3 changes: 3 additions & 0 deletions src/python/arcor2_cube_detector/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
11 changes: 11 additions & 0 deletions src/python/arcor2_cube_detector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Cube Detector Service

## Usage Instructions

- By default, the service runs on port 5020.

## Environment variables

- `ARCOR2_CUBE_DETECTOR_URL=http://0.0.0.0:5020` - by default, the service listens on port 5020.
- `ARCOR2_CUBE_DETECTOR_MOCK=1` - the service will start in a mock (simulator) mode.
- `ARCOR2_CUBE_DETECTOR_DEBUG=1` - switches logger to the `DEBUG` level.
1 change: 1 addition & 0 deletions src/python/arcor2_cube_detector/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
13 changes: 13 additions & 0 deletions src/python/arcor2_cube_detector/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os

from arcor2 import package_version

_ROOT = os.path.abspath(os.path.dirname(__file__))


def version() -> str:
return package_version(__name__)


def get_data(path: str) -> str:
return os.path.join(_ROOT, "data", path)
Loading

0 comments on commit f35f400

Please sign in to comment.