Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ clean:
rm -f folk *.o vendor/tracy/public/TracyClient.o vendor/c11-queues/*.o
distclean: clean
make -C vendor/jimtcl distclean
make -C vendor/apriltag clean
rm -rf vendor/apriltag/build

remote-clean: sync
ssh $(FOLK_REMOTE_NODE) -- 'cd folk; make clean'
Expand All @@ -81,15 +81,24 @@ deps:
cd vendor/jimtcl && ./configure CFLAGS='-g -fno-omit-frame-pointer'; \
fi
make -C vendor/jimtcl
make -C vendor/apriltag libapriltag.so

cmake -B vendor/apriltag/build -S vendor/apriltag -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
cmake --build vendor/apriltag/build

if [ ! -f vendor/wslay/Makefile ]; then \
cd vendor/wslay && autoreconf -i && automake && autoconf && ./configure; \
fi
make -C vendor/wslay

if [ "$$(uname)" = "Darwin" ]; then \
install_name_tool -id @executable_path/vendor/apriltag/libapriltag.so vendor/apriltag/libapriltag.so; \
install_name_tool -id @executable_path/vendor/apriltag/build/libapriltag.dylib vendor/apriltag/build/libapriltag.dylib; \
cd vendor/apriltag/build && ln -sf libapriltag.dylib libapriltag.so; \
install_name_tool -id @executable_path/vendor/wslay/lib/.libs/libwslay.0.dylib vendor/wslay/lib/.libs/libwslay.0.dylib; \
fi
if [ "$$(uname)" = "Linux" ]; then \
patchelf --set-soname "$$(pwd)/vendor/apriltag/build/libapriltag.so.3" vendor/apriltag/build/libapriltag.so.3; \
patchelf --set-soname "$$(pwd)/vendor/wslay/lib/.libs/libwslay.so.0" vendor/wslay/lib/.libs/libwslay.so.0 || true; \
fi

kill-folk:
sudo systemctl stop folk
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if flashing from a Mac] -- Ubuntu doesn't have a good kernel for Pi 5)
`folk@folk-WHATEVER.local` by name, `sudo apt install avahi-daemon`
and then on your laptop: `ssh-copy-id folk@folk-WHATEVER.local`

1. Install dependencies: `sudo apt install rsync git libturbojpeg0-dev libpng-dev libdrm-dev pkg-config v4l-utils vulkan-tools libvulkan-dev libvulkan1 meson libgbm-dev glslc vulkan-validationlayers ghostscript console-data kbd psmisc zlib1g-dev libssl-dev automake libtool autoconf-archive`
1. Install dependencies: `sudo apt install rsync git cmake patchelf libturbojpeg0-dev libpng-dev libdrm-dev pkg-config v4l-utils vulkan-tools libvulkan-dev libvulkan1 meson libgbm-dev glslc vulkan-validationlayers ghostscript console-data kbd psmisc zlib1g-dev libssl-dev automake libtool autoconf-archive`

(When prompted while installing `console-data` for `Policy for
handling keymaps` type `3` (meaning `3. Keep kernel keymap`) and
Expand Down
4 changes: 2 additions & 2 deletions builtin-programs/apriltags.folk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fn makeAprilTagDetector {TAG_FAMILY QUAD_DECIMATE NTHREADS} {
$cc extend $imageLib

$cc cflags -I./vendor/apriltag
$cc endcflags ./vendor/apriltag/libapriltag.so
$cc endcflags ./vendor/apriltag/build/libapriltag.so
$cc include <apriltag.h>
$cc include <$TAG_FAMILY.h>
$cc include <math.h>
Expand All @@ -18,7 +18,7 @@ fn makeAprilTagDetector {TAG_FAMILY QUAD_DECIMATE NTHREADS} {
$cc proc detectInit {} void {
td = apriltag_detector_create();
tf = ${TAG_FAMILY}_create();
apriltag_detector_add_family_bits(td, tf, 1);
apriltag_detector_add_family_bits(td, tf, 3);
td->quad_decimate = ${QUAD_DECIMATE};
td->nthreads = ${NTHREADS};
}
Expand Down
2 changes: 1 addition & 1 deletion builtin-programs/calibrate/matlib.folk
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ $cc proc applyHomography {matd_t* H double[2] xy} Jim_Obj* {
$cc proc matdMul {matd_t* a matd_t* b} matd_t* {
return matd_multiply(a, b);
}
$cc endcflags ./vendor/apriltag/libapriltag.so
$cc endcflags ./vendor/apriltag/build/libapriltag.so
set matLib [$cc compile]
Claim the calibration matLib is $matLib

Expand Down
2 changes: 1 addition & 1 deletion builtin-programs/calibrate/refine.folk
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ set NUM_TAGS_IN_MODEL 20

set cc [C]
$cc cflags -I./vendor/cmpfit -I./vendor/apriltag -Wall -Werror
$cc endcflags ./vendor/apriltag/libapriltag.so
$cc endcflags ./vendor/apriltag/build/libapriltag.so

$cc include <math.h>
$cc include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion builtin-programs/print.folk
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ When the image library is /imageLib/ &\
set cc [C]
$cc extend $imageLib
$cc cflags -I./vendor/apriltag -Wall -Werror
$cc endcflags ./vendor/apriltag/libapriltag.so
$cc endcflags ./vendor/apriltag/build/libapriltag.so

$cc code {
#include <apriltag.h>
Expand Down
7 changes: 5 additions & 2 deletions builtin-programs/tags-to-quads.folk
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,18 @@ $cc proc rescaleAndUndistort {Intrinsics intr
out[1] = y*intr.fy + intr.cy;
}
$cc cflags -I./vendor/apriltag
$cc endcflags ./vendor/apriltag/libapriltag.so
$cc endcflags ./vendor/apriltag/build/libapriltag.so

$cc include <apriltag_pose.h>
$cc include <math.h>
$cc include <common/matd.h>
$cc include <common/homography.h>

$cc code {
#define MATD_VAR(name, nr, nc) matd_t* name = alloca(sizeof(matd_t) + ((nr)*(nc)*sizeof(double))); name->nrows = nr; name->ncols = nc;
#define MATD_VAR(name, nr, nc) \
matd_t* name = alloca(sizeof(matd_t)); \
name->data = alloca((nr)*(nc)*sizeof(double)); \
name->nrows = nr; name->ncols = nc;
}
$cc proc pseudoInverse {matd_t* a} matd_t* {
matd_svd_t usv = matd_svd(a);
Expand Down
1 change: 1 addition & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Some of these packages have been modified by us.
- `vk_mem_alloc` is from <https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/blob/e722e57c891a8fbe3cc73ca56c19dd76be242759/include/vk_mem_alloc.h>
- idiomorph is from
<https://github.com/bigskysoftware/idiomorph/blob/10224e0841d4b14bead9f6fd9ac2dfa2d030b4c7/dist/idiomorph.js>
- apriltag is from <https://github.com/AprilRobotics/apriltag/tree/c5a4fc1cc5c6edcb5929dfc3a79f167bf173f7a5>
53 changes: 53 additions & 0 deletions vendor/apriltag/.github/workflows/bloom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: bloom

on: [push, pull_request]

jobs:
build_linux:
name: "Ubuntu (${{ matrix.ros_distribution }})"

runs-on: ubuntu-latest

strategy:
matrix:
include:
- docker_image: ubuntu:20.04
ros_distribution: noetic

- docker_image: ubuntu:22.04
ros_distribution: humble

- docker_image: ubuntu:24.04
ros_distribution: jazzy

container:
image: ${{ matrix.docker_image }}

env:
DEBIAN_FRONTEND: noninteractive

steps:
- name: install core dependencies
run: |
apt update
apt install -y --no-install-recommends git ca-certificates

- uses: actions/checkout@v4

- uses: ros-tooling/setup-ros@v0.7

- name: install build tool dependencies
run: |
apt install -y --no-install-recommends devscripts equivs python3-bloom

- name: bloom
run: |
rosdep update
bloom-generate rosdebian --ros-distro ${{ matrix.ros_distribution }}
mk-build-deps
apt install -y --no-install-recommends ./ros-${{ matrix.ros_distribution }}-apriltag-build-deps_*_all.deb
dpkg-buildpackage -b

- name: install bloomed packages
run: |
apt install -y --no-install-recommends ../ros-${{ matrix.ros_distribution }}-apriltag_*.deb ../ros-${{ matrix.ros_distribution }}-apriltag-dbgsym_*.ddeb
63 changes: 37 additions & 26 deletions vendor/apriltag/.github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: CMake on multiple platforms
name: CMake

on:
push:
Expand All @@ -13,19 +11,11 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

# Set up a matrix to run the following 3 configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
#
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build_type: [Release]
c_compiler: [gcc, clang, cl]
shared_libs: ['ON', 'OFF']
include:
- os: windows-latest
c_compiler: cl
Expand All @@ -45,20 +35,18 @@ jobs:
- os: macos-latest
c_compiler: clang
cpp_compiler: clang++
- os: macos-latest
c_compiler: gcc
cpp_compiler: g++
exclude:
- os: ubuntu-latest
c_compiler: cl
- os: macos-latest
c_compiler: cl
- os: macos-latest
c_compiler: gcc

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
Expand All @@ -68,23 +56,46 @@ jobs:

- uses: ilammy/msvc-dev-cmd@v1

- uses: actions/setup-python@v5
with:
python-version: '3.10'

- run: pip install numpy

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-G Ninja
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-D CMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-D CMAKE_C_COMPILER=${{ matrix.c_compiler }}
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }}
-D BUILD_SHARED_LIBS=${{ matrix.shared_libs }}
-D BUILD_TESTING=ON
-S ${{ github.workspace }}

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

- name: Install (Windows)
if: matrix.os == 'windows-latest'
run: Start-Process -Verb RunAs -FilePath cmake "--build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target install"

- name: Install (sudo)
if: matrix.os != 'windows-latest'
run: sudo cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target install

- name: add DLL to test folder
if: matrix.os == 'windows-latest'
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
cp *apriltag.dll test/

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }}
run: |
ctest --build-config ${{ matrix.build_type }} --no-tests=error --output-on-failure --verbose

- name: Test Python Module Import
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
python3 -c "import apriltag; apriltag.apriltag(family='tag36h11')"
62 changes: 62 additions & 0 deletions vendor/apriltag/.github/workflows/cmake-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: CMake (Ubuntu)

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
version: ["20.04", "22.04", "24.04"]
c_compiler: [gcc, clang]
shared_libs: ['ON', 'OFF']
# manual selection for the latest, non-default, compilers
include:
- version: "24.04"
c_compiler: gcc-14
- version: "24.04"
c_compiler: clang-18

container:
image: ubuntu:${{ matrix.version }}

env:
DEBIAN_FRONTEND: noninteractive

steps:
- name: install dependencies
run: |
apt update
apt install -y --no-install-recommends cmake ninja-build ${{ matrix.c_compiler }}
apt install -y --no-install-recommends python3-dev python3-numpy

- uses: actions/checkout@v4

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=$GITHUB_WORKSPACE/build" >> "$GITHUB_OUTPUT"

- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-G Ninja
-D CMAKE_C_COMPILER=${{ matrix.c_compiler }}
-D CMAKE_BUILD_TYPE=Release
-D BUILD_SHARED_LIBS=${{ matrix.shared_libs }}
-D BUILD_TESTING=ON
-S $GITHUB_WORKSPACE

- name: Build & Install
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target install

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: |
ctest --no-tests=error --output-on-failure --verbose
Loading