Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,26 @@ ForEachMacros:
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
- Regex: '^<.*'
Priority: 2
SortPriority: 0
- Regex: '.*'
Priority: 3
SortPriority: 0
IncludeIsMainRegex: '([-_](test|unittest))?$'
# C standard library headers
#
# https://en.cppreference.com/w/cpp/header:
# * C compatibility headers
# * Special C compatibility headers
# * Empty C headers
# * Meaningless C headers
# * Unsupported C headers
- Regex: '^<(assert\.h|ctype\.h|errno\.h|fenv\.h|float\.h|inttypes\.h|limits\.h|locale\.h|math\.h|setjmp\.h|signal\.h|stdarg\.h|stddef\.h|stdint\.h|stdio\.h|stdlib\.h|string\.h|time\.h|uchar\.h|wchar\.h|wctype\.h|stdatomic\.h|ccomplex|complex\.h|ctgmath|tgmath\.h|ciso646|cstdalign|cstdbool|iso646\.h|stdalign\.h|stdbool\.h|stdatomic\.h|stdnoreturn\.h|threads\.h)>'
Priority: 1
# C++ standard library headers (lowercase and underscores with no .h suffix)
- Regex: '^<[a-z_]+>'
Priority: 2
# Other library headers (angle brackets)
- Regex: '^<.*'
Priority: 3
# Project headers (double quotes)
- Regex: '^".*'
Priority: 4
IncludeIsMainRegex: '(Test|_test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentGotoLabels: true
Expand Down Expand Up @@ -136,7 +143,7 @@ RawStringFormats:
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
with:
python-version: 3.11
- name: Install wpiformat
run: pip3 install wpiformat==2025.34
run: pip3 install wpiformat==2025.48
- name: Run
run: wpiformat
- name: Check output
Expand Down
30 changes: 8 additions & 22 deletions .styleguide
Original file line number Diff line number Diff line change
@@ -1,41 +1,27 @@
cppHeaderFileInclude {
\.h$
\.hpp$
\.inc$
\.inl$
}

cppSrcFileInclude {
\.cpp$
}

modifiableFileExclude {
\.jpg$
\.jpeg$
\.png$
\.gif$
\.so$
\.dll$
\.webp$
\.gif$
\.ico$
\.jpeg$
\.jpg$
\.mp4$
\.png$
\.rknn$
\.so$
\.tflite$
\.mp4$
\.ttf$
\.webp$
\.woff2$
gradlew
photon-lib/py/photonlibpy/generated/
photon-targeting/src/main/native/cpp/photon/constrained_solvepnp/generate/
photon-targeting/src/generated/
}

includeProject {
^photonLib/
}

includeOtherLibs {
^frc/
^networktables/
^units/
^wpi/
photon-targeting/src/main/native/cpp/photon/constrained_solvepnp/generate/
}
19 changes: 9 additions & 10 deletions docs/.styleguide
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@

modifiableFileExclude {
\.jpg$
\.jpeg$
\.png$
\.gif$
\.so$
\.pdf$
\.mp4$
\.dll$
\.webp$
\.gif$
\.ico$
\.jpeg$
\.jpg$
\.mp4$
\.pdf$
\.png$
\.rknn$
\.tflite$
\.so$
\.svg$
\.tflite$
\.webp$
\.woff2$
gradlew
}
5 changes: 2 additions & 3 deletions photon-lib/src/main/native/cpp/photon/PhotonCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@

#include "photon/PhotonCamera.h"

#include <hal/FRCUsageReporting.h>
#include <net/TimeSyncServer.h>

#include <stdexcept>
#include <string>
#include <string_view>
Expand All @@ -36,6 +33,8 @@
#include <frc/Errors.h>
#include <frc/RobotController.h>
#include <frc/Timer.h>
#include <hal/FRCUsageReporting.h>
#include <net/TimeSyncServer.h>
#include <opencv2/core.hpp>
#include <opencv2/core/mat.hpp>
#include <wpi/json.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

#include "photon/PhotonPoseEstimator.h"

#include <hal/FRCUsageReporting.h>

#include <cmath>
#include <iostream>
#include <limits>
Expand All @@ -41,6 +39,7 @@
#include <frc/geometry/Pose3d.h>
#include <frc/geometry/Rotation3d.h>
#include <frc/geometry/Transform3d.h>
#include <hal/FRCUsageReporting.h>
#include <opencv2/calib3d.hpp>
#include <opencv2/core/mat.hpp>
#include <opencv2/core/types.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,24 @@

#pragma once

#include <cameraserver/CameraServer.h>
#include <photon/PhotonCamera.h>
#include <photon/PhotonTargetSortMode.h>
#include <photon/estimation/CameraTargetRelation.h>
#include <photon/estimation/VisionEstimation.h>
#include <photon/networktables/NTTopicSet.h>
#include <photon/simulation/SimCameraProperties.h>
#include <photon/simulation/VideoSimUtil.h>
#include <photon/simulation/VisionTargetSim.h>

#include <algorithm>
#include <limits>
#include <string>
#include <utility>
#include <vector>

#include <cameraserver/CameraServer.h>
#include <frc/Timer.h>
#include <frc/apriltag/AprilTagFieldLayout.h>
#include <frc/apriltag/AprilTagFields.h>
#include <photon/PhotonCamera.h>
#include <photon/PhotonTargetSortMode.h>
#include <photon/estimation/CameraTargetRelation.h>
#include <photon/estimation/VisionEstimation.h>
#include <photon/networktables/NTTopicSet.h>
#include <photon/simulation/SimCameraProperties.h>
#include <photon/simulation/VideoSimUtil.h>
#include <photon/simulation/VisionTargetSim.h>
#include <units/math.h>
#include <wpi/timestamp.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

#pragma once

#include <photon/estimation/OpenCVHelp.h>

#include <algorithm>
#include <random>
#include <string>
Expand All @@ -37,6 +35,7 @@
#include <frc/MathUtil.h>
#include <frc/geometry/Rotation2d.h>
#include <frc/geometry/Translation3d.h>
#include <photon/estimation/OpenCVHelp.h>
#include <units/frequency.h>
#include <units/time.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@

#pragma once

#include <cscore_cv.h>

#include <algorithm>
#include <numeric>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

#include <cscore_cv.h>
#include <frc/apriltag/AprilTag.h>
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
Expand Down
11 changes: 5 additions & 6 deletions photon-lib/src/test/native/cpp/PhotonCameraTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,19 @@
* SOFTWARE.
*/

#include <string>
#include <vector>

#include <fmt/ranges.h>
#include <frc/smartdashboard/SmartDashboard.h>
#include <gtest/gtest.h>
#include <hal/HAL.h>
#include <net/TimeSyncClient.h>
#include <net/TimeSyncServer.h>
#include <networktables/NetworkTableInstance.h>
#include <photon/PhotonCamera.h>
#include <photon/simulation/PhotonCameraSim.h>

#include <string>
#include <vector>

#include <frc/smartdashboard/SmartDashboard.h>
#include <networktables/NetworkTableInstance.h>

TEST(TimeSyncProtocolTest, Smoketest) {
using namespace wpi::tsp;
using namespace std::chrono_literals;
Expand Down
5 changes: 3 additions & 2 deletions photon-lib/src/test/native/cpp/PhotonPoseEstimatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* SOFTWARE.
*/

#include "photon/PhotonPoseEstimator.h"

#include <map>
#include <utility>
#include <vector>
Expand All @@ -30,13 +32,12 @@
#include <frc/geometry/Pose3d.h>
#include <frc/geometry/Rotation3d.h>
#include <frc/geometry/Transform3d.h>
#include <gtest/gtest.h>
#include <units/angle.h>
#include <units/length.h>
#include <wpi/SmallVector.h>

#include "gtest/gtest.h"
#include "photon/PhotonCamera.h"
#include "photon/PhotonPoseEstimator.h"
#include "photon/dataflow/structures/Packet.h"
#include "photon/simulation/PhotonCameraSim.h"
#include "photon/simulation/SimCameraProperties.h"
Expand Down
3 changes: 2 additions & 1 deletion photon-lib/src/test/native/cpp/PhotonUtilsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
* SOFTWARE.
*/

#include "gtest/gtest.h"
#include "photon/PhotonUtils.h"

#include <gtest/gtest.h>

TEST(PhotonUtilsTest, Include) {}
3 changes: 2 additions & 1 deletion photon-lib/src/test/native/cpp/VersionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@

#include <iostream>

#include <gtest/gtest.h>

#include "PhotonVersion.h"
#include "gtest/gtest.h"

TEST(VersionTest, PrintVersion) {
std::cout << photon::PhotonVersion::versionString << std::endl;
Expand Down
5 changes: 3 additions & 2 deletions photon-lib/src/test/native/cpp/VisionSystemSimTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@
* SOFTWARE.
*/

#include "photon/simulation/VisionSystemSim.h"

#include <chrono>
#include <thread>
#include <tuple>
#include <vector>

#include <gtest/gtest.h>
#include <wpi/deprecated.h>

#include "gtest/gtest.h"
#include "photon/PhotonUtils.h"
#include "photon/simulation/VisionSystemSim.h"

// Ignore GetLatestResult warnings
WPI_IGNORE_DEPRECATED
Expand Down
5 changes: 2 additions & 3 deletions photon-targeting/src/main/native/cpp/net/TimeSyncClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

#include "net/TimeSyncClient.h"

#include <wpinet/UDPClient.h>
#include <wpinet/uv/util.h>

#include <atomic>
#include <chrono>
#include <cstdlib>
Expand All @@ -33,6 +30,8 @@
#include <wpi/Logger.h>
#include <wpi/print.h>
#include <wpi/struct/Struct.h>
#include <wpinet/UDPClient.h>
#include <wpinet/uv/util.h>

#include "ntcore_cpp.h"

Expand Down
5 changes: 2 additions & 3 deletions photon-targeting/src/main/native/cpp/net/TimeSyncServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

#include "net/TimeSyncServer.h"

#include <wpinet/UDPClient.h>
#include <wpinet/uv/util.h>

#include <atomic>
#include <chrono>
#include <cstdlib>
Expand All @@ -32,6 +29,8 @@
#include <wpi/Logger.h>
#include <wpi/print.h>
#include <wpi/struct/Struct.h>
#include <wpinet/UDPClient.h>
#include <wpinet/uv/util.h>

#include "ntcore_cpp.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

#include "photon/constrained_solvepnp/wrap/casadi_wrapper.h"

#include <fmt/core.h>

#include <chrono>
#include <cstdio>
#include <iostream>
Expand All @@ -28,6 +26,7 @@
#include <Eigen/Cholesky>
#include <Eigen/Core>
#include <Eigen/LU>
#include <fmt/core.h>
#include <frc/fmt/Eigen.h>
#include <wpi/timestamp.h>

Expand Down
Loading
Loading