-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Robocubs/always-send-targets
Merge 'Always send targets'. Use as default backend strategy for tracking
- Loading branch information
Showing
13 changed files
with
276 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
#OpenCV build artifacts | ||
docker/cv2/ | ||
docker/lib/ | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FROM ubuntu:22.04 | ||
|
||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
|
||
# No interaction when installing packages | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# Note: looks like the OPi's are running 3.10.6, but the subversion for default python in ubuntu 22.04 is 3.10.12 | ||
# python3.11 isn't needed here, but I'm scared to change stuff | ||
# Install minimal prerequisites | ||
RUN apt-get update && apt-get install -y cmake g++ wget unzip build-essential apt-utils git python3.11 python3-dev python3-numpy openssh-server | ||
RUN apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libgtk-3-dev | ||
|
||
# Kick off SSH server if stuff breaks | ||
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | ||
RUN useradd -m -s /bin/bash user | ||
RUN echo "user:1701robocubs" | chpasswd | ||
EXPOSE 22 | ||
ENTRYPOINT service ssh start && bash | ||
|
||
# Download and unpack sources | ||
RUN wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip | ||
RUN wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.x.zip | ||
RUN unzip opencv.zip | ||
RUN unzip opencv_contrib.zip | ||
|
||
# Make CMAKE build dir | ||
RUN mkdir -p build | ||
WORKDIR /usr/src/app/build | ||
|
||
# Configure | ||
RUN cmake -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DWITH_GSTREAMER=ON -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.x/modules ../opencv-4.x | ||
|
||
# Build | ||
RUN cmake --build . | ||
|
||
# Do standard build and install so it's easier to grab the necessary python module | ||
RUN make | ||
RUN make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Start by building the docker image | ||
docker build --tag 'opencv_build' . | ||
|
||
# Run the container and grab the id | ||
CONTAINER_ID=$(docker run --detach 'opencv_build') | ||
|
||
# Clean any previous dirs | ||
rm -r ./cv2 | ||
rm -r ./lib | ||
|
||
# Copy the python package directory | ||
docker cp "$CONTAINER_ID":/usr/local/lib/python3.10/dist-packages/cv2/ . | ||
|
||
# Copy the built shared objects | ||
""" | ||
WARNING: This copies EVERYTHING, including the shared objects. Since we're in a docker container, | ||
there really shouldn't be anything else installed here. | ||
""" | ||
docker cp "$CONTAINER_ID":/usr/local/lib/ . | ||
|
||
# TODO: Get these automatically implemented, do not copy dirs in lib though | ||
#scp -r ./lib/ [email protected]:/usr/local/lib | ||
#scp -r ./cv2 [email protected]:/usr/local/lib/python3.10/dist-packages/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from typing import Any | ||
from wpimath.geometry import Transform3d | ||
import struct | ||
|
||
class Packet: | ||
def __init__(self): | ||
self._data: list[int] = [] | ||
|
||
def getData(self) -> list[int]: | ||
return self._data | ||
|
||
def getSize(self) -> int: | ||
return len(self._data) | ||
|
||
def _encodeGeneric(self, packFormat: str, *value: Any) -> None: | ||
self._data.extend(struct.pack(packFormat, *value)) | ||
|
||
def encode8(self, value: int) -> None: | ||
self._encodeGeneric('>b', value) | ||
return self | ||
|
||
def encode32(self, value: int) -> None: | ||
self._encodeGeneric('>l', value) | ||
return self | ||
|
||
def encodeDouble(self, value: float) -> None: | ||
self._encodeGeneric('>d', value) | ||
return self | ||
|
||
def encodeBoolean(self, value: bool) -> None: | ||
self.encode8(1 if value else 0) | ||
return self | ||
|
||
def encodeTransform(self, value: Transform3d) -> None: | ||
self.encodeDouble(value.X()) | ||
self.encodeDouble(value.Y()) | ||
self.encodeDouble(value.Z()) | ||
|
||
quaternion = value.rotation().getQuaternion() | ||
self.encodeDouble(quaternion.W()) | ||
self.encodeDouble(quaternion.X()) | ||
self.encodeDouble(quaternion.Y()) | ||
self.encodeDouble(quaternion.Z()) | ||
|
||
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.