Skip to content

Commit

Permalink
cibuildwheel integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavidberger committed Oct 31, 2022
1 parent 2d45e25 commit e4da388
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 21 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cmake-build-*
19 changes: 9 additions & 10 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04 ]
os: [ubuntu-20.04, windows-2019]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -33,20 +33,19 @@ jobs:
- name: Get Dependencies
run: pip install twine build

- name: Build wheel
run: |
python -m build --wheel
git status
- uses: actions/upload-artifact@v2
name: Upload
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_SKIP: "*-win32 *-manylinux_i686"

- uses: actions/upload-artifact@v3
with:
path: ${{runner.workspace}}/cnkalman/dist/*.whl
path: ./wheelhouse/*.whl

- name: Upload with twine
run: |
python -m pip install twine
python -m twine upload dist/*.whl --skip-existing
python -m twine upload wheelhouse/*.whl --skip-existing
continue-on-error: true
env:
TWINE_USERNAME: __token__
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "libs/cnmatrix"]
path = libs/cnmatrix
url = ../cnmatrix.git
[submodule "libs/pybind11"]
path = libs/pybind11
url = [email protected]:pybind/pybind11.git
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ else()
endif()

add_subdirectory(libs/cnmatrix)
add_subdirectory(libs/pybind11)
add_subdirectory(src)

set(cnkalman_root_source_dir ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
Expand Down
1 change: 1 addition & 0 deletions libs/pybind11
Submodule pybind11 added at b1bd7f
9 changes: 3 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ target_link_libraries(cnkalman cnmatrix)

install(TARGETS cnkalman DESTINATION lib)

find_package(pybind11)
if(pybind11_FOUND)
pybind11_add_module(filter cnkalman_python_bindings.cpp)
target_link_libraries(filter PUBLIC cnkalman)
install(TARGETS filter DESTINATION lib)
endif()
pybind11_add_module(filter cnkalman_python_bindings.cpp)
target_link_libraries(filter PUBLIC cnkalman)
install(TARGETS filter DESTINATION lib)
4 changes: 2 additions & 2 deletions tests/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ def run_model(kp, f):
(f.x[0], f.x[1]), cov=f.P[0:2, 0:2],
std=1, facecolor='g', alpha=0.8)


Xs = np.array(Xs)
err = np.linalg.norm(Xf - Xs.reshape(Xf.shape)) / Xf.shape[0]
print(err, math.sqrt(pError) / Xf.shape[0])

has_error = math.sqrt(pError) / Xf.shape[0] > 1e-3 or err > 1e-3


return np.array(Xs)
return Xs

f = create_filter(model)
Xs = run_model(kp, f)
Expand Down
2 changes: 1 addition & 1 deletion tests/models/BearingsOnlyTracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ def residual(a, b):
return y

EKF.update(self, z,
HJacobian=lambda x: bearings_meas_function.jacobian_of_state(x.reshape(-1), self.landmarks[idx]), residual=residual,
HJacobian=lambda x: bearings_meas_function.jacobians.state(x.reshape(-1), self.landmarks[idx]), residual=residual,
Hx=lambda x: np.array(bearings_meas_function(x.reshape(-1), self.landmarks[idx]), dtype=np.float64).reshape(-1, 1), R=R)
2 changes: 1 addition & 1 deletion tests/models/EggLandscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ def __init__(self):

def update(self, z, R):
EKF.update(self, z,
HJacobian=lambda x: predict_meas.jacobian_of_x(x.reshape(-1)),
HJacobian=lambda x: predict_meas.jacobians.x(x.reshape(-1)),
Hx=lambda x: np.array(predict_meas(x.reshape(-1)), dtype=np.float64).reshape(-1, 1), R=R)
2 changes: 1 addition & 1 deletion tests/models/RobotEKF.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def Hx(x, landmark_pos):
return BikeLandmarks.meas_function(x.reshape(-1), landmark_pos).reshape(-1,1)

def H_of(x, landmark_pos):
return BikeLandmarks.meas_function.jacobian_of_state(x.reshape(-1), landmark_pos)
return BikeLandmarks.meas_function.jacobians.state(x.reshape(-1), landmark_pos)
landmark = self.landmarks[landmark_idx]

EKF.update(self, z, HJacobian=H_of, Hx=Hx, R=R,
Expand Down

0 comments on commit e4da388

Please sign in to comment.