Skip to content

Commit

Permalink
Merge branch 'main' into xrp-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson authored Sep 8, 2024
2 parents ccf2f46 + 0cab7b5 commit fbba10d
Show file tree
Hide file tree
Showing 6 changed files with 301 additions and 262 deletions.
2 changes: 1 addition & 1 deletion docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ doxygen {

// Save space by excluding protobuf and eigen
exclude 'Eigen/**'

exclude 'unsupported/**'
exclude 'google/protobuf/**'

exclude '**/.clang-tidy'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,25 @@ public static boolean shouldLog(Logged.Importance importance) {
for (TypeElement mainRobotClass : mainRobotClasses) {
String robotClassName = mainRobotClass.getQualifiedName().toString();

out.println();
out.print(
"""
/**
* Updates Epilogue. This must be called periodically in order for Epilogue to record
* new values. Alternatively, {@code bind()} can be used to update at an offset from
* the main robot loop.
*/
""");
out.println(" public static void update(" + robotClassName + " robot) {");
out.println(" long start = System.nanoTime();");
out.println(
" "
+ StringUtils.loggerFieldName(mainRobotClass)
+ ".tryUpdate(config.dataLogger.getSubLogger(config.root), robot, config.errorHandler);");
out.println(
" config.dataLogger.log(\"Epilogue/Stats/Last Run\", (System.nanoTime() - start) / 1e6);");
out.println(" }");

out.println();
out.print(
"""
Expand All @@ -161,13 +180,7 @@ public static boolean shouldLog(Logged.Importance importance) {
out.println(" }");
out.println();
out.println(" robot.addPeriodic(() -> {");
out.println(" long start = System.nanoTime();");
out.println(
" "
+ StringUtils.loggerFieldName(mainRobotClass)
+ ".tryUpdate(config.dataLogger.getSubLogger(config.root), robot, config.errorHandler);");
out.println(
" config.dataLogger.log(\"Epilogue/Stats/Last Run\", (System.nanoTime() - start) / 1e6);");
out.println(" update(robot);");
out.println(
" }, config.loggingPeriod.in(Seconds), config.loggingPeriodOffset.in(Seconds));");
out.println(" }");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,17 @@ public static boolean shouldLog(Logged.Importance importance) {
return importance.compareTo(config.minimumImportance) >= 0;
}
/**
* Updates Epilogue. This must be called periodically in order for Epilogue to record
* new values. Alternatively, {@code bind()} can be used to update at an offset from
* the main robot loop.
*/
public static void update(edu.wpi.first.epilogue.Example robot) {
long start = System.nanoTime();
exampleLogger.tryUpdate(config.dataLogger.getSubLogger(config.root), robot, config.errorHandler);
config.dataLogger.log(\"Epilogue/Stats/Last Run\", (System.nanoTime() - start) / 1e6);
}
/**
* Binds Epilogue updates to a timed robot's update period. Log calls will be made at the
* same update rate as the robot's loop function, but will be offset by a full phase
Expand All @@ -164,9 +175,7 @@ public static void bind(edu.wpi.first.epilogue.Example robot) {
}
robot.addPeriodic(() -> {
long start = System.nanoTime();
exampleLogger.tryUpdate(config.dataLogger.getSubLogger(config.root), robot, config.errorHandler);
config.dataLogger.log(\"Epilogue/Stats/Last Run\", (System.nanoTime() - start) / 1e6);
update(robot);
}, config.loggingPeriod.in(Seconds), config.loggingPeriodOffset.in(Seconds));
}
}
Expand Down Expand Up @@ -218,6 +227,17 @@ public static boolean shouldLog(Logged.Importance importance) {
return importance.compareTo(config.minimumImportance) >= 0;
}
/**
* Updates Epilogue. This must be called periodically in order for Epilogue to record
* new values. Alternatively, {@code bind()} can be used to update at an offset from
* the main robot loop.
*/
public static void update(edu.wpi.first.epilogue.AlphaBot robot) {
long start = System.nanoTime();
alphaBotLogger.tryUpdate(config.dataLogger.getSubLogger(config.root), robot, config.errorHandler);
config.dataLogger.log(\"Epilogue/Stats/Last Run\", (System.nanoTime() - start) / 1e6);
}
/**
* Binds Epilogue updates to a timed robot's update period. Log calls will be made at the
* same update rate as the robot's loop function, but will be offset by a full phase
Expand All @@ -235,12 +255,21 @@ public static void bind(edu.wpi.first.epilogue.AlphaBot robot) {
}
robot.addPeriodic(() -> {
long start = System.nanoTime();
alphaBotLogger.tryUpdate(config.dataLogger.getSubLogger(config.root), robot, config.errorHandler);
config.dataLogger.log(\"Epilogue/Stats/Last Run\", (System.nanoTime() - start) / 1e6);
update(robot);
}, config.loggingPeriod.in(Seconds), config.loggingPeriodOffset.in(Seconds));
}
/**
* Updates Epilogue. This must be called periodically in order for Epilogue to record
* new values. Alternatively, {@code bind()} can be used to update at an offset from
* the main robot loop.
*/
public static void update(edu.wpi.first.epilogue.BetaBot robot) {
long start = System.nanoTime();
betaBotLogger.tryUpdate(config.dataLogger.getSubLogger(config.root), robot, config.errorHandler);
config.dataLogger.log(\"Epilogue/Stats/Last Run\", (System.nanoTime() - start) / 1e6);
}
/**
* Binds Epilogue updates to a timed robot's update period. Log calls will be made at the
* same update rate as the robot's loop function, but will be offset by a full phase
Expand All @@ -258,9 +287,7 @@ public static void bind(edu.wpi.first.epilogue.BetaBot robot) {
}
robot.addPeriodic(() -> {
long start = System.nanoTime();
betaBotLogger.tryUpdate(config.dataLogger.getSubLogger(config.root), robot, config.errorHandler);
config.dataLogger.log("Epilogue/Stats/Last Run", (System.nanoTime() - start) / 1e6);
update(robot);
}, config.loggingPeriod.in(Seconds), config.loggingPeriodOffset.in(Seconds));
}
}
Expand Down
4 changes: 3 additions & 1 deletion upstream_utils/expected.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ def copy_upstream_src(wpilib_root):
)
shutil.copyfile("include/tl/expected.hpp", dest_filename)

# Rename namespace from tl to wpi
# Rename namespace from tl to wpi, and detail to detail_expected
with open(dest_filename) as f:
content = f.read()
content = content.replace("namespace tl", "namespace wpi")
content = content.replace("tl::", "wpi::")
content = content.replace("TL_", "WPI_")
content = content.replace("namespace detail", "namespace detail_expected")
content = content.replace("detail::", "detail_expected::")
with open(dest_filename, "w") as f:
f.write(content)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ private double mapSensorRange(double pos) {
/**
* Get the encoder value.
*
* <p>By default, this will not count rollovers. If that behavior is necessary, call
* configureRolloverCounting(true).
*
* @return the encoder value
* @return the encoder value scaled by the full range input
*/
public double get() {
if (m_simPosition != null) {
Expand Down
Loading

0 comments on commit fbba10d

Please sign in to comment.