From 2d11946d98c6942d46ee1d3decfc32508fe44cbb Mon Sep 17 00:00:00 2001 From: Gold856 <117957790+Gold856@users.noreply.github.com> Date: Sun, 3 Aug 2025 14:41:25 -0400 Subject: [PATCH] [wpical] Use updated thirdparty-ceres and move resource files (#8151) --- README.md | 2 - shared/ceres.gradle | 6 +- upstream_utils/eigen.py | 9 + upstream_utils/mrcal_java.py | 3 + wpical/.styleguide | 1 + wpical/CMakeLists.txt | 7 + wpical/WPICalThirdPartyNotices.txt | 732 ++++++++++++++++++ wpical/build.gradle | 20 +- wpical/publish.gradle | 4 + .../{resources => assets}/2024-crescendo.json | 0 .../altfieldvideo/long.avi | Bin .../altfieldvideo/short.avi | Bin .../{resources => assets}/fieldvideo/long.mp4 | Bin .../fieldvideo/short.mp4 | Bin .../lifecam_1280p_10x10.vnl | 0 .../{resources => assets}/testcalibration.avi | Bin .../{resources => assets}/testcalibration.mp4 | Bin wpical/src/main/native/cpp/tagpose.cpp | 2 + .../mrcal_java/include/mrcal_wrapper.h | 2 +- wpical/src/test/native/cpp/test_calibrate.cpp | 3 +- .../thirdparty/eigen/include/Eigen/Dense | 7 + .../thirdparty/eigen/include/Eigen/StdVector | 30 + .../include/Eigen/src/StlSupport/StdVector.h | 51 ++ .../include/Eigen/src/StlSupport/details.h | 82 ++ 24 files changed, 946 insertions(+), 15 deletions(-) create mode 100644 wpical/WPICalThirdPartyNotices.txt rename wpical/src/main/native/{resources => assets}/2024-crescendo.json (100%) rename wpical/src/main/native/{resources => assets}/altfieldvideo/long.avi (100%) rename wpical/src/main/native/{resources => assets}/altfieldvideo/short.avi (100%) rename wpical/src/main/native/{resources => assets}/fieldvideo/long.mp4 (100%) rename wpical/src/main/native/{resources => assets}/fieldvideo/short.mp4 (100%) rename wpical/src/main/native/{resources => assets}/lifecam_1280p_10x10.vnl (100%) rename wpical/src/main/native/{resources => assets}/testcalibration.avi (100%) rename wpical/src/main/native/{resources => assets}/testcalibration.mp4 (100%) create mode 100644 wpimath/src/main/native/thirdparty/eigen/include/Eigen/Dense create mode 100644 wpimath/src/main/native/thirdparty/eigen/include/Eigen/StdVector create mode 100644 wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/StlSupport/StdVector.h create mode 100644 wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/StlSupport/details.h diff --git a/README.md b/README.md index 565623105f..8d267e261d 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,6 @@ Using Gradle makes building WPILib very straightforward. It only has a few depen On macOS ARM, run `softwareupdate --install-rosetta`. This is necessary to be able to use the macOS x86 roboRIO toolchain on ARM. -On linux, run `sudo apt install gfortran`. This is necessary to be able to build WPIcal on linux platforms. - ## Setup Clone the WPILib repository and follow the instructions above for installing any required tooling. The build process uses versioning information from git. Downloading the source is not sufficient to run the build. diff --git a/shared/ceres.gradle b/shared/ceres.gradle index beaaa113f3..c9a9276369 100644 --- a/shared/ceres.gradle +++ b/shared/ceres.gradle @@ -1,12 +1,14 @@ nativeUtils { nativeDependencyContainer { ceres(getNativeDependencyTypeClass('WPIStaticMavenDependency')) { - groupId = "edu.wpi.first.thirdparty.frc2024.ceres" + groupId = "edu.wpi.first.thirdparty.frc2026.ceres" artifactId = "ceres-cpp" headerClassifier = "headers" + sourceClassifier = "sources" ext = "zip" - version = '2.2-3' + version = '2.2-1' targetPlatforms.addAll(nativeUtils.wpi.platforms.desktopPlatforms) + targetPlatforms.addAll("linuxarm32", "linuxarm64") } } } diff --git a/upstream_utils/eigen.py b/upstream_utils/eigen.py index 93f68f79d5..fdd9f580f9 100755 --- a/upstream_utils/eigen.py +++ b/upstream_utils/eigen.py @@ -47,10 +47,18 @@ def eigen_inclusions(dp: Path, f: str): or "SSE" in dp.parts ) + if ( + "StlSupport" in dp.parts + and not f.endswith("StdList.h") + and not f.endswith("StdDeque.h") + ): + return True + # Include the following modules modules = [ "Cholesky", "Core", + "Dense", "Eigenvalues", "Geometry", "Householder", @@ -64,6 +72,7 @@ def eigen_inclusions(dp: Path, f: str): "SparseCore", "SparseLU", "SparseQR", + "StdVector", "misc", "plugins", ] diff --git a/upstream_utils/mrcal_java.py b/upstream_utils/mrcal_java.py index 11f3e120e9..5545411834 100755 --- a/upstream_utils/mrcal_java.py +++ b/upstream_utils/mrcal_java.py @@ -32,6 +32,9 @@ def copy_upstream_src(wpilib_root: Path): with open(f) as file: content = file.read() content = content.replace("#include ", "") + content = content.replace( + "suitesparse/cholmod_core.h", "suitesparse/cholmod.h" + ) content = content.replace( "// mrcal_point3_t *c_observations_point_pool = observations_point;", "mrcal_point3_t *c_observations_point_pool = observations_point;", diff --git a/wpical/.styleguide b/wpical/.styleguide index afaf7a1075..19766ff2c6 100644 --- a/wpical/.styleguide +++ b/wpical/.styleguide @@ -9,6 +9,7 @@ cppSrcFileInclude { } generatedFileExclude { + src/main/native/assets/ src/main/native/resources/ src/main/native/thirdparty/ src/main/native/win/wpical.ico diff --git a/wpical/CMakeLists.txt b/wpical/CMakeLists.txt index f07d52755a..185bcf036c 100644 --- a/wpical/CMakeLists.txt +++ b/wpical/CMakeLists.txt @@ -83,12 +83,17 @@ target_compile_options(wpical PRIVATE ${compile_flags}) find_package(OpenCV REQUIRED) find_package(Ceres CONFIG REQUIRED) +find_package(CHOLMOD CONFIG REQUIRED) +find_package(SuiteSparse_config CONFIG REQUIRED) + target_link_libraries( wpical apriltag ${OpenCV_LIBS} wpigui wpiutil + SuiteSparse::CHOLMOD_static + SuiteSparse::SuiteSparseConfig_static Ceres::ceres ) @@ -124,6 +129,8 @@ if(WITH_TESTS) ${OpenCV_LIBS} wpigui wpiutil + SuiteSparse::CHOLMOD_static + SuiteSparse::SuiteSparseConfig_static Ceres::ceres ) endif() diff --git a/wpical/WPICalThirdPartyNotices.txt b/wpical/WPICalThirdPartyNotices.txt new file mode 100644 index 0000000000..9c22d6d58c --- /dev/null +++ b/wpical/WPICalThirdPartyNotices.txt @@ -0,0 +1,732 @@ +============================================================================== +Copyrights and Licenses for Third Party Software Distributed with WPICal +============================================================================== +The WPICal software contains code written by third parties. The copyrights, +license, and restrictions which apply to each piece of software is included +later in this file and/or inside of the individual applicable source files. + +The disclaimer of warranty in the WPILib license above applies to all code in +WPILib, including WPICal and nothing in any of the other licenses gives +permission to use the names of FIRST nor the names of the WPILib contributors +to endorse or promote products derived from this software. + +The following pieces of software have additional or alternate copyrights, +licenses, and/or restrictions: + +Program Locations +------- --------- +AMD https://github.com/wpilibsuite/thirdparty-ceres, https://github.com/DrTimothyAldenDavis/SuiteSparse +CAMD https://github.com/wpilibsuite/thirdparty-ceres, https://github.com/DrTimothyAldenDavis/SuiteSparse +CCOLAMD https://github.com/wpilibsuite/thirdparty-ceres, https://github.com/DrTimothyAldenDavis/SuiteSparse +Ceres https://github.com/wpilibsuite/thirdparty-ceres, https://github.com/ceres-solver/ceres-solver +CHOLMOD https://github.com/wpilibsuite/thirdparty-ceres, https://github.com/DrTimothyAldenDavis/SuiteSparse +OpenBLAS (non-Mac only) https://github.com/wpilibsuite/thirdparty-ceres, https://github.com/OpenMathLib/OpenBLAS + +AMD, Copyright (c), 1996-2022, Timothy A. Davis, +Patrick R. Amestoy, and Iain S. Duff. All Rights Reserved. + +Availability: + + http://www.suitesparse.com + +------------------------------------------------------------------------------- +AMD License: BSD 3-clause: +------------------------------------------------------------------------------- + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the organizations to which the authors are + affiliated, nor the names of its contributors may be used to endorse + or promote products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. + +CAMD, Copyright (c) by Timothy A. Davis, +Yanqing Chen, +Patrick R. Amestoy, and Iain S. Duff. All Rights Reserved. +CAMD is available under alternate licenses, contact T. Davis for details. + +Availability: + + http://www.suitesparse.com + +------------------------------------------------------------------------------- +CAMD License: BSD 3-clause: +------------------------------------------------------------------------------- + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the organizations to which the authors are + affiliated, nor the names of its contributors may be used to endorse + or promote products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. + +CCOLAMD: constrained column approximate minimum degree ordering +Copyright (C) 2005-2016, Univ. of Florida. Authors: Timothy A. Davis, +Sivasankaran Rajamanickam, and Stefan Larimore. Closely based on COLAMD by +Davis, Stefan Larimore, in collaboration with Esmond Ng, and John Gilbert. +http://www.suitesparse.com + +-------------------------------------------------------------------------------- + +CCOLAMD license: BSD 3-clause: + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the organizations to which the authors are + affiliated, nor the names of its contributors may be used to endorse + or promote products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. + +Ceres Solver - A fast non-linear least squares minimizer +Copyright 2023 Google Inc. All rights reserved. +http://ceres-solver.org/ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* Neither the name of Google Inc. nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +---------------------------------------------------------------------------------------------------------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------------------------------------------------------------------------------------------------------------------------------- + +Some of the code in the examples directory derives from libmv, which is +distributed under the MIT license as described below + + +Copyright (c) 2007-2011 libmv authors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + +-------------------------------------------------------------------------------- +==> Check/License.txt <== +-------------------------------------------------------------------------------- + + CHOLMOD/Check Module. Copyright (C) 2005-2022, Timothy A. Davis CHOLMOD is + also available under other licenses; contact authors for details. + http://www.suitesparse.com + + Note that this license is for the CHOLMOD/Check module only. + All CHOLMOD modules are licensed separately. + + ---------------------------------------------------------------------------- + + This Module is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This Module is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this Module; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +-------------------------------------------------------------------------------- +==> Cholesky/License.txt <== +-------------------------------------------------------------------------------- + + CHOLMOD/Cholesky module, Copyright (C) 2005-2022, Timothy A. Davis. + CHOLMOD is also available under other licenses; contact authors for + details. http://www.suitesparse.com + + Note that this license is for the CHOLMOD/Cholesky module only. + All CHOLMOD modules are licensed separately. + + ---------------------------------------------------------------------------- + + + This Module is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This Module is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this Module; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +-------------------------------------------------------------------------------- +==> Utility/License.txt <== +-------------------------------------------------------------------------------- + + CHOLMOD/Utility Module. Copyright (C) 2023, Timothy A. Davis, All Rights + Reserved. CHOLMOD is also available under other licenses; contact authors + for details. http://www.suitesparse.com + + ---------------------------------------------------------------------------- + + This Module is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This Module is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this Module; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +-------------------------------------------------------------------------------- +==> Demo/License.txt <== +-------------------------------------------------------------------------------- + + CHOLMOD/Demo Module. Copyright (C) 2005-2022, Timothy A. Davis. CHOLMOD + is also available under other licenses; contact authors for details. + http://www.suitesparse.com + + Note that this license is for the CHOLMOD/Demo module only. + All CHOLMOD modules are licensed separately. + + + ---------------------------------------------------------------------------- + + + This Module is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This Module is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this Module; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +-------------------------------------------------------------------------------- +==> MATLAB/License.txt <== +-------------------------------------------------------------------------------- + + CHOLMOD/MATLAB Module. Copyright (C) 2005-2022, Timothy A. Davis. CHOLMOD + is also available under other licenses; contact authors for details. + MATLAB(tm) is a Registered Trademark of The MathWorks, Inc. + http://www.suitesparse.com + + Note that this license is for the CHOLMOD/MATLAB module only. + All CHOLMOD modules are licensed separately. + + ---------------------------------------------------------------------------- + + + This Module is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This Module is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this Module; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +-------------------------------------------------------------------------------- +==> MatrixOps/License.txt <== +-------------------------------------------------------------------------------- + + CHOLMOD/MatrixOps Module. Copyright (C) 2005-2022, Timothy A. Davis. + CHOLMOD is also available under other licenses; contact authors for + details. http://www.suitesparse.com + + Note that this license is for the CHOLMOD/MatrixOps module only. + All CHOLMOD modules are licensed separately. + + + ---------------------------------------------------------------------------- + + + This Module is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This Module is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this Module; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +-------------------------------------------------------------------------------- +==> Modify/License.txt <== +-------------------------------------------------------------------------------- + + CHOLMOD/Modify Module. Copyright (C) 2005-2022, Timothy A. Davis and + William W. Hager. CHOLMOD is also available under other licenses; contact + authors for details. http://www.suitesparse.com + + Note that this license is for the CHOLMOD/Modify module only. + All CHOLMOD modules are licensed separately. + + + ---------------------------------------------------------------------------- + + + This Module is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This Module is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this Module; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +-------------------------------------------------------------------------------- +==> Partition/License.txt <== +-------------------------------------------------------------------------------- + + CHOLMOD/Partition Module. + Copyright (C) 2005-2022, Univ. of Florida. Author: Timothy A. Davis + CHOLMOD is also available under other licenses; contact authors for details. + http://www.suitesparse.com + + Note that this license is for the CHOLMOD/Partition module only. + All CHOLMOD modules are licensed separately. + + + ---------------------------------------------------------------------------- + + + This Module is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This Module is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this Module; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +-------------------------------------------------------------------------------- +==> Supernodal/License.txt <== +-------------------------------------------------------------------------------- + + CHOLMOD/Supernodal Module. + Copyright (C) 2005-2022, Timothy A. Davis + CHOLMOD is also available under other licenses; contact authors for details. + http://www.suitesparse.com + + Note that this license is for the CHOLMOD/Supernodal module only. + All CHOLMOD modules are licensed separately. + + + ---------------------------------------------------------------------------- + + + This Module is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This Module is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this Module; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +-------------------------------------------------------------------------------- +==> Tcov/License.txt <== +-------------------------------------------------------------------------------- + + CHOLMOD/Tcov Module. Copyright (C) 2005-2022, Timothy A. Davis + CHOLMOD is also available under other licenses; contact authors for details. + http://www.suitesparse.com + + Note that this license is for the CHOLMOD/Tcov module only. + All CHOLMOD modules are licensed separately. + + + ---------------------------------------------------------------------------- + + + This Module is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This Module is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this Module; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +COLAMD, Copyright 1998-2022, Timothy A. Davis. http://www.suitesparse.com +http://www.suitesparse.com + +-------------------------------------------------------------------------------- + +COLAMD License: BSD 3-clause + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the organizations to which the authors are + affiliated, nor the names of its contributors may be used to endorse + or promote products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. + +Copyright (c) 2011-2014, The OpenBLAS Project +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. Neither the name of the OpenBLAS project nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/wpical/build.gradle b/wpical/build.gradle index eea250c903..0e6fa74200 100644 --- a/wpical/build.gradle +++ b/wpical/build.gradle @@ -1,6 +1,6 @@ import org.gradle.internal.os.OperatingSystem -if (project.hasProperty('onlylinuxathena') || project.hasProperty('onlylinuxarm32') || project.hasProperty('onlylinuxarm64')) { +if (project.hasProperty('onlylinuxathena')) { return; } @@ -120,7 +120,7 @@ nativeUtils.platformConfigs.each { it.cppCompiler.args.add("-fpermissive") } } -def testResources = "\"$rootDir/wpical/src/main/native/resources\"".replace("\\", "/") +def testResources = "\"$rootDir/wpical/src/main/native/assets\"".replace("\\", "/") model { components { "${nativeName}"(NativeExecutableSpec) { @@ -152,16 +152,18 @@ model { } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name.startsWith("linuxarm")) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { it.buildable = false return } + lib project: ':apriltag', library: 'apriltag', linkage: 'static' + lib project: ':wpimath', library: 'wpimath', linkage: 'static' lib project: ':wpiutil', library: 'wpiutil', linkage: 'static' lib project: ':wpigui', library: 'wpigui', linkage: 'static' lib project: ':thirdparty:imgui_suite', library: 'imguiSuite', linkage: 'static' - lib project: ':apriltag', library: 'apriltag', linkage: 'static' nativeUtils.useRequiredLibrary(it, 'ceres') nativeUtils.useRequiredLibrary(it, 'opencv_static') + it.cppCompiler.define 'OPENCV_DISABLE_EIGEN_TENSOR_SUPPORT' it.cppCompiler.define 'GLOG_USE_GLOG_EXPORT' if (it.targetPlatform.operatingSystem.isWindows()) { it.cppCompiler.define('GLOG_DEPRECATED', '__declspec(deprecated)') @@ -175,7 +177,7 @@ model { } else if (it.targetPlatform.operatingSystem.isMacOsX()) { it.linker.args << '-framework' << 'Metal' << '-framework' << 'MetalKit' << '-framework' << 'Cocoa' << '-framework' << 'IOKit' << '-framework' << 'CoreFoundation' << '-framework' << 'CoreVideo' << '-framework' << 'QuartzCore' << '-framework' << 'Accelerate' } else { - it.linker.args << '-lX11' << "-lgfortran" + it.linker.args << '-lX11' if (it.targetPlatform.name.startsWith('linuxarm')) { it.linker.args << '-lGL' } @@ -203,16 +205,18 @@ model { } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name.startsWith("linuxarm")) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { it.buildable = false return } + lib project: ':apriltag', library: 'apriltag', linkage: 'static' + lib project: ':wpimath', library: 'wpimath', linkage: 'static' lib project: ':wpiutil', library: 'wpiutil', linkage: 'static' lib project: ':wpigui', library: 'wpigui', linkage: 'static' lib project: ':thirdparty:imgui_suite', library: 'imguiSuite', linkage: 'static' - lib project: ':apriltag', library: 'apriltag', linkage: 'static' nativeUtils.useRequiredLibrary(it, 'ceres') nativeUtils.useRequiredLibrary(it, 'opencv_static') + it.cppCompiler.define 'OPENCV_DISABLE_EIGEN_TENSOR_SUPPORT' it.cppCompiler.define('PROJECT_ROOT_PATH', testResources) it.cppCompiler.define 'GLOG_USE_GLOG_EXPORT' if (it.targetPlatform.name == nativeUtils.wpi.platforms.windowsarm64) { @@ -236,7 +240,7 @@ model { } else if (it.targetPlatform.operatingSystem.isMacOsX()) { it.linker.args << '-framework' << 'Metal' << '-framework' << 'MetalKit' << '-framework' << 'Cocoa' << '-framework' << 'IOKit' << '-framework' << 'CoreFoundation' << '-framework' << 'CoreVideo' << '-framework' << 'QuartzCore' << '-framework' << 'Accelerate' } else { - it.linker.args << '-lX11' << '-lgfortran' + it.linker.args << '-lX11' if (it.targetPlatform.name.startsWith('linuxarm')) { it.linker.args << '-lGL' } diff --git a/wpical/publish.gradle b/wpical/publish.gradle index d00f47aafb..5af5956239 100644 --- a/wpical/publish.gradle +++ b/wpical/publish.gradle @@ -42,6 +42,10 @@ model { into '/' } + from(file("$rootDir/wpical/WPICalThirdPartyNotices.txt")) { + into '/' + } + if (binary.targetPlatform.operatingSystem.isWindows()) { def exePath = binary.executable.file.absolutePath exePath = exePath.substring(0, exePath.length() - 4) diff --git a/wpical/src/main/native/resources/2024-crescendo.json b/wpical/src/main/native/assets/2024-crescendo.json similarity index 100% rename from wpical/src/main/native/resources/2024-crescendo.json rename to wpical/src/main/native/assets/2024-crescendo.json diff --git a/wpical/src/main/native/resources/altfieldvideo/long.avi b/wpical/src/main/native/assets/altfieldvideo/long.avi similarity index 100% rename from wpical/src/main/native/resources/altfieldvideo/long.avi rename to wpical/src/main/native/assets/altfieldvideo/long.avi diff --git a/wpical/src/main/native/resources/altfieldvideo/short.avi b/wpical/src/main/native/assets/altfieldvideo/short.avi similarity index 100% rename from wpical/src/main/native/resources/altfieldvideo/short.avi rename to wpical/src/main/native/assets/altfieldvideo/short.avi diff --git a/wpical/src/main/native/resources/fieldvideo/long.mp4 b/wpical/src/main/native/assets/fieldvideo/long.mp4 similarity index 100% rename from wpical/src/main/native/resources/fieldvideo/long.mp4 rename to wpical/src/main/native/assets/fieldvideo/long.mp4 diff --git a/wpical/src/main/native/resources/fieldvideo/short.mp4 b/wpical/src/main/native/assets/fieldvideo/short.mp4 similarity index 100% rename from wpical/src/main/native/resources/fieldvideo/short.mp4 rename to wpical/src/main/native/assets/fieldvideo/short.mp4 diff --git a/wpical/src/main/native/resources/lifecam_1280p_10x10.vnl b/wpical/src/main/native/assets/lifecam_1280p_10x10.vnl similarity index 100% rename from wpical/src/main/native/resources/lifecam_1280p_10x10.vnl rename to wpical/src/main/native/assets/lifecam_1280p_10x10.vnl diff --git a/wpical/src/main/native/resources/testcalibration.avi b/wpical/src/main/native/assets/testcalibration.avi similarity index 100% rename from wpical/src/main/native/resources/testcalibration.avi rename to wpical/src/main/native/assets/testcalibration.avi diff --git a/wpical/src/main/native/resources/testcalibration.mp4 b/wpical/src/main/native/assets/testcalibration.mp4 similarity index 100% rename from wpical/src/main/native/resources/testcalibration.mp4 rename to wpical/src/main/native/assets/testcalibration.mp4 diff --git a/wpical/src/main/native/cpp/tagpose.cpp b/wpical/src/main/native/cpp/tagpose.cpp index 38977f0961..ec871d5651 100644 --- a/wpical/src/main/native/cpp/tagpose.cpp +++ b/wpical/src/main/native/cpp/tagpose.cpp @@ -3,7 +3,9 @@ // the WPILib BSD license file in the root directory of this project. #include +#include +WPI_IGNORE_DEPRECATED namespace tag { Pose::Pose(int tag_id, double xpos, double ypos, double zpos, double w, double x, double y, double z, double field_length_meters, diff --git a/wpical/src/main/native/thirdparty/mrcal_java/include/mrcal_wrapper.h b/wpical/src/main/native/thirdparty/mrcal_java/include/mrcal_wrapper.h index 0a36d4702d..dc7e02eb2d 100644 --- a/wpical/src/main/native/thirdparty/mrcal_java/include/mrcal_wrapper.h +++ b/wpical/src/main/native/thirdparty/mrcal_java/include/mrcal_wrapper.h @@ -24,7 +24,7 @@ extern "C" { // Seems like these people don't properly extern-c their headers either extern "C" { #include -#include +#include } // extern "C" #include diff --git a/wpical/src/test/native/cpp/test_calibrate.cpp b/wpical/src/test/native/cpp/test_calibrate.cpp index 0e48bcf018..a7837e7e17 100644 --- a/wpical/src/test/native/cpp/test_calibrate.cpp +++ b/wpical/src/test/native/cpp/test_calibrate.cpp @@ -12,8 +12,7 @@ const std::string projectRootPath = PROJECT_ROOT_PATH; const std::string calSavePath = - projectRootPath.substr(0, - projectRootPath.find("/src/main/native/resources")) + + projectRootPath.substr(0, projectRootPath.find("/src/main/native/assets")) + "/build"; cameracalibration::CameraModel cameraModel = { .intrinsic_matrix = Eigen::Matrix::Identity(), diff --git a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/Dense b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/Dense new file mode 100644 index 0000000000..5768910bd8 --- /dev/null +++ b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/Dense @@ -0,0 +1,7 @@ +#include "Core" +#include "LU" +#include "Cholesky" +#include "QR" +#include "SVD" +#include "Geometry" +#include "Eigenvalues" diff --git a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/StdVector b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/StdVector new file mode 100644 index 0000000000..711a654eab --- /dev/null +++ b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/StdVector @@ -0,0 +1,30 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// Copyright (C) 2009 Hauke Heibel +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_STDVECTOR_MODULE_H +#define EIGEN_STDVECTOR_MODULE_H + +#include "Core" +#include + +#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && \ + (EIGEN_MAX_STATIC_ALIGN_BYTES <= 16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ + +#define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) + +#else + +// IWYU pragma: begin_exports +#include "src/StlSupport/StdVector.h" +// IWYU pragma: end_exports + +#endif + +#endif // EIGEN_STDVECTOR_MODULE_H diff --git a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/StlSupport/StdVector.h b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/StlSupport/StdVector.h new file mode 100644 index 0000000000..dd538e9541 --- /dev/null +++ b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/StlSupport/StdVector.h @@ -0,0 +1,51 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// Copyright (C) 2009 Hauke Heibel +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_STDVECTOR_H +#define EIGEN_STDVECTOR_H + +#ifndef EIGEN_STDVECTOR_MODULE_H +#error "Please include Eigen/StdVector instead of including this file directly." +#endif + +#include "details.h" + +/** + * This section contains a convenience MACRO which allows an easy specialization of + * std::vector such that for data types with alignment issues the correct allocator + * is used automatically. + */ +#define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) \ + namespace std { \ + template <> \ + class vector<__VA_ARGS__, std::allocator<__VA_ARGS__> > \ + : public vector<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > { \ + typedef vector<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > vector_base; \ + \ + public: \ + typedef __VA_ARGS__ value_type; \ + typedef vector_base::allocator_type allocator_type; \ + typedef vector_base::size_type size_type; \ + typedef vector_base::iterator iterator; \ + explicit vector(const allocator_type& a = allocator_type()) : vector_base(a) {} \ + template \ + vector(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) \ + : vector_base(first, last, a) {} \ + vector(const vector& c) : vector_base(c) {} \ + explicit vector(size_type num, const value_type& val = value_type()) : vector_base(num, val) {} \ + vector(iterator start_, iterator end_) : vector_base(start_, end_) {} \ + vector& operator=(const vector& x) { \ + vector_base::operator=(x); \ + return *this; \ + } \ + }; \ + } + +#endif // EIGEN_STDVECTOR_H diff --git a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/StlSupport/details.h b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/StlSupport/details.h new file mode 100644 index 0000000000..9bc9d21074 --- /dev/null +++ b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/StlSupport/details.h @@ -0,0 +1,82 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// Copyright (C) 2009 Hauke Heibel +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_STL_DETAILS_H +#define EIGEN_STL_DETAILS_H + +#ifndef EIGEN_ALIGNED_ALLOCATOR +#define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator +#endif + +namespace Eigen { + +// This one is needed to prevent reimplementing the whole std::vector. +template +class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR { + public: + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + typedef T* pointer; + typedef const T* const_pointer; + typedef T& reference; + typedef const T& const_reference; + typedef T value_type; + + template + struct rebind { + typedef aligned_allocator_indirection other; + }; + + aligned_allocator_indirection() {} + aligned_allocator_indirection(const aligned_allocator_indirection&) : EIGEN_ALIGNED_ALLOCATOR() {} + aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR&) {} + template + aligned_allocator_indirection(const aligned_allocator_indirection&) {} + template + aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR&) {} + ~aligned_allocator_indirection() {} +}; + +#if EIGEN_COMP_MSVC + +// sometimes, MSVC detects, at compile time, that the argument x +// in std::vector::resize(size_t s,T x) won't be aligned and generate an error +// even if this function is never called. Whence this little wrapper. +#define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \ + std::conditional_t::value, T, Eigen::internal::workaround_msvc_stl_support > + +namespace internal { +template +struct workaround_msvc_stl_support : public T { + inline workaround_msvc_stl_support() : T() {} + inline workaround_msvc_stl_support(const T& other) : T(other) {} + inline operator T&() { return *static_cast(this); } + inline operator const T&() const { return *static_cast(this); } + template + inline T& operator=(const OtherT& other) { + T::operator=(other); + return *this; + } + inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other) { + T::operator=(other); + return *this; + } +}; +} // namespace internal + +#else + +#define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T + +#endif + +} // namespace Eigen + +#endif // EIGEN_STL_DETAILS_H