Skip to content

Commit

Permalink
Merge branch 'main' into obstacle-refactor-2025
Browse files Browse the repository at this point in the history
  • Loading branch information
shueja authored Sep 22, 2024
2 parents 13de3cb + acb16dc commit 746695e
Show file tree
Hide file tree
Showing 17 changed files with 108 additions and 73 deletions.
103 changes: 54 additions & 49 deletions .github/workflows/choreo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
os: macOS-14
tauri-build-flags: --target x86_64-apple-darwin -v -- --workspace

- artifact-name: macOS-arm64
- artifact-name: macOS-aarch64
os: macOS-14
tauri-build-flags: --target aarch64-apple-darwin -v -- --workspace

Expand Down Expand Up @@ -83,43 +83,34 @@ jobs:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: true

- name: Upload bundle (Windows x86)
- name: Package artifacts (Windows x86_64)
if: matrix.artifact-name == 'Windows-x86_64'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe
run: Compress-Archive -DestinationPath ${{ matrix.artifact-name }}.zip -Path target/x86_64-pc-windows-msvc/release/choreo.exe,target/x86_64-pc-windows-msvc/release/choreo-cli.exe,target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe

- name: Upload bundle (Windows ARM)
- name: Package artifacts (Windows aarch64)
if: matrix.artifact-name == 'Windows-aarch64'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: target/aarch64-pc-windows-msvc/release/bundle/nsis/*.exe
run: Compress-Archive -DestinationPath ${{ matrix.artifact-name }}.zip -Path target/aarch64-pc-windows-msvc/release/choreo.exe,target/aarch64-pc-windows-msvc/release/choreo-cli.exe,target/aarch64-pc-windows-msvc/release/bundle/nsis/*.exe

- name: Upload bundle (macOS x86)
- name: Package artifacts (macOS x86_64)
if: matrix.artifact-name == 'macOS-x86_64'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: target/x86_64-apple-darwin/release/bundle/dmg/*.dmg
run: |
zip -j ${{ matrix.artifact-name }}.zip target/x86_64-apple-darwin/release/Choreo target/x86_64-apple-darwin/release/choreo-cli target/x86_64-apple-darwin/release/bundle/dmg/*.dmg
- name: Upload bundle (macOS ARM)
if: matrix.artifact-name == 'macOS-arm64'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: target/aarch64-apple-darwin/release/bundle/dmg/*.dmg
- name: Package artifacts (macOS aarch64)
if: matrix.artifact-name == 'macOS-aarch64'
run: |
zip -j ${{ matrix.artifact-name }}.zip target/aarch64-apple-darwin/release/Choreo target/aarch64-apple-darwin/release/choreo-cli target/aarch64-apple-darwin/release/bundle/dmg/*.dmg
- name: Upload bundle (Linux)
- name: Package artifacts (Linux x86_64)
if: matrix.artifact-name == 'Linux-x86_64'
uses: actions/upload-artifact@v4
run: zip -j ${{ matrix.artifact-name }}.zip target/x86_64-unknown-linux-gnu/release/choreo target/x86_64-unknown-linux-gnu/release/choreo-cli target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb target/x86_64-unknown-linux-gnu/release/bundle/rpm/*.rpm

# Zipping manually works around upload-artifact stripping execute
# permissions from files
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: |
target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage
target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb
target/x86_64-unknown-linux-gnu/release/bundle/rpm/*.rpm
path: ${{ matrix.artifact-name }}.zip

release:
name: Create draft release
Expand All @@ -138,33 +129,47 @@ jobs:
- name: Display structure of downloaded files
run: ls -R

- name: Rename Windows x86_64 bundle
- name: Rename Windows x86_64 artifacts
working-directory: pkg/Windows-x86_64
run: mv *.exe Choreo-${{ github.ref_name }}-Windows-x86_64.exe
run: |
unzip -o Windows-x86_64.zip
mv choreo.exe Choreo-${{ github.ref_name }}-Windows-x86_64.exe
mv choreo-cli.exe Choreo-CLI-${{ github.ref_name }}-Windows-x86_64.exe
mv Choreo_*_x64-setup.exe Choreo-${{ github.ref_name }}-Windows-x86_64-setup.exe
- name: Rename Windows aarch64 bundle
- name: Rename Windows aarch64 artifacts
working-directory: pkg/Windows-aarch64
run: mv *.exe Choreo-${{ github.ref_name }}-Windows-aarch64.exe
run: |
unzip -o Windows-aarch64.zip
mv choreo.exe Choreo-${{ github.ref_name }}-Windows-aarch64.exe
mv choreo-cli.exe Choreo-CLI-${{ github.ref_name }}-Windows-aarch64.exe
mv Choreo_*_arm64-setup.exe Choreo-${{ github.ref_name }}-Windows-aarch64-setup.exe
- name: Rename macOS x86_64 bundle
- name: Rename macOS x86_64 artifacts
working-directory: pkg/macOS-x86_64
run: mv *.dmg Choreo-${{ github.ref_name }}-macOS-x86_64.dmg

- name: Rename macOS arm64 bundle
working-directory: pkg/macOS-arm64
run: mv *.dmg Choreo-${{ github.ref_name }}-macOS-arm64.dmg

- name: Rename Linux x86_64 file (.AppImage)
working-directory: pkg/Linux-x86_64/appimage
run: mv *.AppImage Choreo-${{ github.ref_name }}-Linux-x86_64.AppImage
run: |
unzip -o macOS-x86_64.zip
mv Choreo Choreo-${{ github.ref_name }}-macOS-x86_64
mv choreo-cli Choreo-CLI-${{ github.ref_name }}-macOS-x86_64
mv Choreo_*_aarch64.dmg Choreo-${{ github.ref_name }}-macOS-x86_64.dmg
- name: Rename Linux x86_64 file (.deb)
working-directory: pkg/Linux-x86_64/deb
run: mv *.deb Choreo-${{ github.ref_name }}-Linux-x86_64.deb
- name: Rename macOS aarch64 artifacts
working-directory: pkg/macOS-aarch64
run: |
unzip -o macOS-aarch64.zip
mv Choreo Choreo-${{ github.ref_name }}-macOS-aarch64
mv choreo-cli Choreo-CLI-${{ github.ref_name }}-macOS-aarch64
mv Choreo_*_aarch64.dmg Choreo-${{ github.ref_name }}-macOS-aarch64.dmg
- name: Rename Linux x86_64 file (.rpm)
working-directory: pkg/Linux-x86_64/rpm
run: mv *.rpm Choreo-${{ github.ref_name }}-Linux-x86_64.rpm
- name: Rename Linux x86_64 artifacts
working-directory: pkg/Linux-x86_64
run: |
unzip -o Linux-x86_64.zip
mv choreo Choreo-${{ github.ref_name }}-Linux-x86_64
mv choreo-cli Choreo-CLI-${{ github.ref_name }}-Linux-x86_64
mv choreo_*_amd64.AppImage Choreo-${{ github.ref_name }}-Linux-x86_64.AppImage
mv choreo_*_amd64.deb Choreo-${{ github.ref_name }}-Linux-x86_64.deb
mv choreo-*.x86_64.rpm Choreo-${{ github.ref_name }}-Linux-x86_64.rpm
- name: Display structure of renamed files
run: ls -R
Expand All @@ -173,6 +178,6 @@ jobs:
with:
name: Choreo ${{ github.ref_name }}
tag: ${{ github.ref_name }}
artifacts: "pkg/**/*.AppImage,pkg/**/*.deb,pkg/**/*.dmg,pkg/**/*.exe,pkg/**/*.rpm"
artifacts: "pkg/**/*.AppImage,pkg/**/*.deb,pkg/**/*.dmg,pkg/**/*.exe,pkg/**/*.rpm,pkg/**/Choreo,pkg/**/choreo,pkg/**/choreo-cli"
draft: true
prerelease: true
6 changes: 3 additions & 3 deletions .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
with:
python-version: 3.12

- run: pip3 install wpiformat==2024.40
- run: pip3 install wpiformat==2024.41

- run: pnpm run fmt

Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
with:
python-version: 3.12

- run: pip3 install wpiformat==2024.40
- run: pip3 install wpiformat==2024.41

- name: Create compile_commands.json
working-directory: choreolib
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
echo "CXX=clang++" >> $GITHUB_ENV
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
- run: pip3 install wpiformat==2024.40
- run: pip3 install wpiformat==2024.41

- name: Create compile_commands.json
run: cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=YES
Expand Down
10 changes: 5 additions & 5 deletions choreolib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ plugins {
repositories {
mavenCentral()
}
if (project.hasProperty('releaseMode')) {
wpilibRepositories.addAllReleaseRepositories(project)
} else {
wpilibRepositories.addAllDevelopmentRepositories(project)
}
// if (project.hasProperty('releaseMode')) {
wpilibRepositories.addAllReleaseRepositories(project)
// } else {
// wpilibRepositories.addAllDevelopmentRepositories(project)
// }

// Apply C++ configuration
apply from: 'config.gradle'
Expand Down
3 changes: 3 additions & 0 deletions choreolib/src/main/native/cpp/choreo/lib/Choreo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
#include "choreo/lib/Choreo.h"

#include <filesystem>
#include <memory>
#include <numbers>
#include <regex>
#include <string>
#include <vector>

#include <fmt/format.h>
#include <frc/DriverStation.h>
Expand Down
2 changes: 2 additions & 0 deletions choreolib/src/main/native/cpp/choreo/lib/ChoreoTrajectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "choreo/lib/ChoreoTrajectory.h"

#include <vector>

#include <units/math.h>
#include <wpi/json.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "choreo/lib/ChoreoTrajectoryState.h"

#include <algorithm>
#include <functional>
#include <numbers>

#include <frc/geometry/Twist2d.h>
Expand Down
6 changes: 3 additions & 3 deletions rename-sidecar.cjs → copy-sidecar.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ if (fs.existsSync(oldPathNative)) {
exit(1);
}

fs.rename(path, newPath, (err) => {
fs.copyFile(path, newPath, (err) => {
if (err) {
console.error(`Error renaming ${path} to ${newPath}: ${err}`);
console.error(`Error copying ${path} to ${newPath}: ${err}`);
exit(1);
}
console.log(`Renamed ${path} to ${newPath}`);
console.log(`Copied ${path} to ${newPath}`);
});
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"build": {
"beforeDevCommand": "vite",
"beforeBuildCommand": "vite build",
"beforeBundleCommand": "node rename-sidecar.cjs choreo-cli ./target",
"beforeBundleCommand": "node copy-sidecar.cjs choreo-cli ./target",
"devPath": "http://localhost:1420",
"distDir": "../dist",
"withGlobalTauri": false
Expand Down
6 changes: 5 additions & 1 deletion src/document/ExpressionStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,11 @@ export const ExpressionStore = types
if (value !== undefined) {
self.setValue(value);
}
}
},
// do this calculation when setting up the reaction
// so value is populated (default is false but this causes issues
// when restoring ExpressionStores out of undo history)
{ fireImmediately: true }
);
},
beforeDestroy: () => {
Expand Down
6 changes: 6 additions & 0 deletions src/document/PathListStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ export const PathListStore = types
} else {
path.params.addConstraint("StopPoint", "first");
path.params.addConstraint("StopPoint", "last");
path.params.addConstraint("KeepInRectangle", "first", "last", {
x: ["0 m", 0.0],
y: ["0 m", 0.0],
w: ["16.54 m", 16.54],
h: ["8.21 m", 8.21]
});
}

if (self.paths.size === 1 || select) {
Expand Down
4 changes: 2 additions & 2 deletions trajoptlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ set(BUILD_EXAMPLES OFF)
fetchcontent_declare(
Sleipnir
GIT_REPOSITORY https://github.com/SleipnirGroup/Sleipnir.git
# main on 2024-09-07
GIT_TAG 6672fd9a2adf710ac5cb0edbaf36bb46b1e4815d
# main on 2024-09-18
GIT_TAG 8bbce85252bc351c5aacb0de9f50fa31b8b9e1ae
PATCH_COMMAND
git apply ${CMAKE_CURRENT_SOURCE_DIR}/cmake/0001-Downgrade-to-C-20.patch
UPDATE_DISCONNECTED 1
Expand Down
3 changes: 2 additions & 1 deletion trajoptlib/cmake/0001-Downgrade-to-C-20.patch
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ diff --git a/include/sleipnir/util/Print.hpp b/include/sleipnir/util/Print.hpp
index 339320bce6d017ca85025060ba445b2f025bb225..fcf2e69bfb5a081cd915bdded3caa80cd9c38518 100644
--- a/include/sleipnir/util/Print.hpp
+++ b/include/sleipnir/util/Print.hpp
@@ -2,52 +2,53 @@
@@ -2,53 +2,54 @@

#pragma once

#include <cstdio>
-#include <print>
#include <system_error>
#include <utility>
Expand Down
3 changes: 3 additions & 0 deletions trajoptlib/src/DifferentialTrajectoryGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

#include "trajopt/DifferentialTrajectoryGenerator.hpp"

#include <algorithm>
#include <cmath>
#include <ranges>
#include <utility>
#include <vector>

#include <sleipnir/autodiff/Variable.hpp>
#include <sleipnir/optimization/SolverExitCondition.hpp>
Expand Down
2 changes: 2 additions & 0 deletions trajoptlib/src/RustFFI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <algorithm>
#include <cstddef>
#include <memory>
#include <utility>
#include <vector>

#include "trajopt/constraint/AngularVelocityMaxMagnitudeConstraint.hpp"
Expand Down
15 changes: 15 additions & 0 deletions trajoptlib/src/RustFFI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,27 @@

#include <cstddef>
#include <memory>
#include <string>

#include <rust/cxx.h>
#include <sleipnir/optimization/SolverExitCondition.hpp>

#include "trajopt/DifferentialTrajectoryGenerator.hpp"
#include "trajopt/SwerveTrajectoryGenerator.hpp"

// override cxx try/catch so it catches thrown integers/exit conditions
namespace rust::behavior {
template <typename Try, typename Fail>
static void trycatch(Try&& func, Fail&& fail) noexcept try {
func();
} catch (const std::exception& e) {
fail(e.what());
} catch (const sleipnir::SolverExitCondition& e) {
// TODO: Use std::to_underlying() from C++23
fail(std::to_string(static_cast<uint8_t>(e)));
}
} // namespace rust::behavior

namespace trajopt::rsffi {

struct SwerveTrajectory;
Expand Down
1 change: 1 addition & 0 deletions trajoptlib/src/SwerveTrajectoryGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <chrono>
#include <ranges>
#include <utility>
#include <vector>

#include <sleipnir/optimization/OptimizationProblem.hpp>
#include <sleipnir/optimization/SolverExitCondition.hpp>
Expand Down
8 changes: 0 additions & 8 deletions update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
from pathlib import Path
from typing import Literal

REQUIREMENTS = ["json", "tomlkit"]

try:
import json
import tomlkit
except ImportError:
raise ImportError(f"Please install the following packages: {REQUIREMENTS}")


@dataclass(frozen=True, slots=True)
class VersionLocation:
Expand Down

0 comments on commit 746695e

Please # to comment.