Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold856 committed Oct 22, 2024
1 parent b8b0bcf commit 5d4c58f
Show file tree
Hide file tree
Showing 18 changed files with 1,142 additions and 2,967 deletions.
10 changes: 9 additions & 1 deletion upstream_utils/libdogleg.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,19 @@ def copy_upstream_src(wpilib_root):
lambda dp, f: f.endswith("dogleg.h"),
os.path.join(wpical, "src/main/native/thirdparty/libdogleg/include"),
)
walk_cwd_and_copy_if(

files = walk_cwd_and_copy_if(
lambda dp, f: f.endswith("dogleg.c"),
os.path.join(wpical, "src/main/native/thirdparty/libdogleg/src"),
)

for f in files:
with open(f) as file:
content = file.read()
content = content.replace("#warning", "// #warning")
with open(f, "w") as file:
file.write(content)


def main():
name = "libdogleg"
Expand Down
31 changes: 27 additions & 4 deletions upstream_utils/mrcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import shutil

from upstream_utils import Lib, walk_cwd_and_copy_if
from upstream_utils import Lib, comment_out_invalid_includes, walk_cwd_and_copy_if


def copy_upstream_src(wpilib_root):
Expand All @@ -16,14 +16,29 @@ def copy_upstream_src(wpilib_root):
]:
shutil.rmtree(os.path.join(wpical, d), ignore_errors=True)

walk_cwd_and_copy_if(
files = walk_cwd_and_copy_if(
lambda dp, f: (f.endswith(".h") or f.endswith(".hh"))
and not f.endswith("mrcal-image.h")
and not f.endswith("stereo.h")
and not f.endswith("stereo-matching-libelas.h")
and not dp.startswith(os.path.join(".", "test")),
os.path.join(wpical, "src/main/native/thirdparty/mrcal/include"),
)
walk_cwd_and_copy_if(
for f in files:
comment_out_invalid_includes(
f,
[
os.path.join(wpical, "src/main/native/thirdparty/mrcal/include"),
os.path.join(wpical, "src/main/native/thirdparty/mrcal/generated"),
],
)
# with open(f) as file:
# content = file.read()
# content = content.replace(r"typedef struct {}", r"// typedef struct {}")
# with open(f, "w") as file:
# file.write(content)

files = walk_cwd_and_copy_if(
lambda dp, f: (f.endswith(".c") or f.endswith(".cc") or f.endswith(".pl"))
and not f.endswith("mrcal-pywrap.c")
and not f.endswith("image.c")
Expand All @@ -34,12 +49,20 @@ def copy_upstream_src(wpilib_root):
and not dp.startswith(os.path.join(".", "test")),
os.path.join(wpical, "src/main/native/thirdparty/mrcal/src"),
)
for f in files:
comment_out_invalid_includes(
f,
[
os.path.join(wpical, "src/main/native/thirdparty/mrcal/include"),
os.path.join(wpical, "src/main/native/thirdparty/mrcal/generated"),
],
)


def main():
name = "mrcal"
url = "https://github.com/dkogan/mrcal"
tag = "71c89c4e9f268a0f4fb950325e7d551986a281ec"
tag = "0d5426b5851be80dd8e51470a0784a73565a3006"

mrcal = Lib(name, url, tag, copy_upstream_src)
mrcal.main()
Expand Down
2 changes: 1 addition & 1 deletion wpical/src/main/native/thirdparty/libdogleg/src/dogleg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1812,7 +1812,7 @@ static void accum_outlierness_factor(// output
}


#warning This is a hack. The threshold should be 1.0, and the scaling should make sure that is the case. I am leaving it for now
// #warning This is a hack. The threshold should be 1.0, and the scaling should make sure that is the case. I am leaving it for now
k /= 8.;


Expand Down
Loading

0 comments on commit 5d4c58f

Please sign in to comment.