forked from wpilibsuite/allwpilib
-
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.
Add mrcal, libdogleg, and mrcal-java
- Loading branch information
Showing
38 changed files
with
24,021 additions
and
34 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
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
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,39 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import shutil | ||
|
||
from upstream_utils import Lib, walk_cwd_and_copy_if | ||
|
||
|
||
def copy_upstream_src(wpilib_root): | ||
wpical = os.path.join(wpilib_root, "wpical") | ||
|
||
# Delete old install | ||
for d in [ | ||
"src/main/native/thirdparty/libdogleg/src", | ||
"src/main/native/thirdparty/libdogleg/include", | ||
]: | ||
shutil.rmtree(os.path.join(wpical, d), ignore_errors=True) | ||
|
||
walk_cwd_and_copy_if( | ||
lambda dp, f: f.endswith("dogleg.h"), | ||
os.path.join(wpical, "src/main/native/thirdparty/libdogleg/include"), | ||
) | ||
walk_cwd_and_copy_if( | ||
lambda dp, f: f.endswith("dogleg.c"), | ||
os.path.join(wpical, "src/main/native/thirdparty/libdogleg/src"), | ||
) | ||
|
||
|
||
def main(): | ||
name = "libdogleg" | ||
url = "https://github.com/dkogan/libdogleg" | ||
tag = "c971ea43088d286a3683c1039b9a85f761f7df15" | ||
|
||
libdogleg = Lib(name, url, tag, copy_upstream_src) | ||
libdogleg.main() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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,49 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import shutil | ||
|
||
from upstream_utils import Lib, walk_cwd_and_copy_if | ||
|
||
|
||
def copy_upstream_src(wpilib_root): | ||
wpical = os.path.join(wpilib_root, "wpical") | ||
|
||
# Delete old install | ||
for d in [ | ||
"src/main/native/thirdparty/mrcal/src", | ||
"src/main/native/thirdparty/mrcal/include", | ||
]: | ||
shutil.rmtree(os.path.join(wpical, d), ignore_errors=True) | ||
|
||
walk_cwd_and_copy_if( | ||
lambda dp, f: (f.endswith(".h") or f.endswith(".hh")) | ||
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( | ||
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") | ||
and not f.endswith("stereo.c") | ||
and not f.endswith("stereo-matching-libelas.cc") | ||
and not f.endswith("uncertainty.c") | ||
and not dp.startswith(os.path.join(".", "doc")) | ||
and not dp.startswith(os.path.join(".", "test")), | ||
os.path.join(wpical, "src/main/native/thirdparty/mrcal/src"), | ||
) | ||
|
||
|
||
def main(): | ||
name = "mrcal" | ||
url = "https://github.com/dkogan/mrcal" | ||
tag = "71c89c4e9f268a0f4fb950325e7d551986a281ec" | ||
|
||
mrcal = Lib(name, url, tag, copy_upstream_src) | ||
mrcal.main() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import shutil | ||
|
||
from upstream_utils import Lib, walk_cwd_and_copy_if | ||
|
||
|
||
def copy_upstream_src(wpilib_root): | ||
wpical = os.path.join(wpilib_root, "wpical") | ||
|
||
# Delete old install | ||
for d in [ | ||
"src/main/native/thirdparty/mrcal_java/src", | ||
"src/main/native/thirdparty/mrcal_java/include", | ||
]: | ||
shutil.rmtree(os.path.join(wpical, d), ignore_errors=True) | ||
|
||
os.chdir("src") | ||
walk_cwd_and_copy_if( | ||
lambda dp, f: f.endswith("mrcal_wrapper.h"), | ||
os.path.join(wpical, "src/main/native/thirdparty/mrcal_java/include"), | ||
) | ||
walk_cwd_and_copy_if( | ||
lambda dp, f: f.endswith("mrcal_wrapper.cpp"), | ||
os.path.join(wpical, "src/main/native/thirdparty/mrcal_java/src"), | ||
) | ||
|
||
|
||
def main(): | ||
name = "mrcal-java" | ||
url = "https://github.com/PhotonVision/mrcal-java" | ||
tag = "d05b8ff0df95eafaf4321b5242882b28aaf23061" | ||
|
||
mrcal_java = Lib(name, url, tag, copy_upstream_src) | ||
mrcal_java.main() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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 |
---|---|---|
@@ -1,30 +1,30 @@ | ||
{ | ||
"avg_reprojection_error": 0.4013144307258122, | ||
"camera_matrix": [ | ||
1767.289258236593, | ||
0.0, | ||
989.375282791521, | ||
0.0, | ||
1762.888503314327, | ||
540.8313845443114, | ||
0.0, | ||
0.0, | ||
1.0 | ||
], | ||
"distortion_coefficients": [ | ||
0.3860266675089004, | ||
-2.563775891333845, | ||
-0.0011477914008921702, | ||
0.0017287037946633974, | ||
5.69767996193624, | ||
0.03549071109208592, | ||
0.11781261237320696, | ||
-0.22713730056480883, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.0 | ||
] | ||
"avg_reprojection_error": 0.4013144307258122, | ||
"camera_matrix": [ | ||
1767.289258236593, | ||
0.0, | ||
989.375282791521, | ||
0.0, | ||
1762.888503314327, | ||
540.8313845443114, | ||
0.0, | ||
0.0, | ||
1.0 | ||
], | ||
"distortion_coefficients": [ | ||
0.3860266675089004, | ||
-2.563775891333845, | ||
-0.0011477914008921702, | ||
0.0017287037946633974, | ||
5.69767996193624, | ||
0.03549071109208592, | ||
0.11781261237320696, | ||
-0.22713730056480883, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.0 | ||
] | ||
} |
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,32 @@ | ||
#!/usr/bin/env python3 | ||
import argparse | ||
import subprocess | ||
import sys | ||
from pathlib import Path | ||
|
||
|
||
def main(argv): | ||
script_path = Path(__file__).resolve() | ||
dirname = script_path.parent | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"--output_directory", | ||
help="Optional. If set, will output the generated files to this directory, otherwise it will use a path relative to the script", | ||
default=dirname / "src/main/native/thirdparty/mrcal/generated/", | ||
type=Path, | ||
) | ||
args = parser.parse_args(argv) | ||
|
||
args.output_directory.mkdir(parents=True, exist_ok=True) | ||
result = subprocess.run( | ||
f"{dirname}/src/main/native/thirdparty/mrcal/src/minimath/minimath_generate.pl", | ||
capture_output=True, | ||
) | ||
(args.output_directory / "minimath_generated.h").write_text( | ||
str(result.stdout, encoding="UTF8") | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main(sys.argv[1:]) |
Oops, something went wrong.