Skip to content

Commit

Permalink
Fix NAR_Robot bug, prepare for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Mason-Lam committed Jan 13, 2024
1 parent 7b38a71 commit be6fdaf
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text = auto
4 changes: 2 additions & 2 deletions 3128-Common.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "3128-common",
"version": "1.0.0",
"version": "1.0.1",
"uuid": "ae3fa5a2-78d9-47e8-921a-dba45b889445",
"frcYear": "2024",
"mavenUrls": [
Expand All @@ -12,7 +12,7 @@
{
"groupId": "com.github.Team3128",
"artifactId": "3128-common",
"version": "1.0.0"
"version": "1.0.1"
}
],
"jniDependencies": [],
Expand Down
4 changes: 2 additions & 2 deletions 3128-common.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "3128-common",
"version": "1.0.0",
"version": "1.0.1",
"uuid": "ae3fa5a2-78d9-47e8-921a-dba45b889445",
"frcYear": "2024",
"mavenUrls": [
Expand All @@ -12,7 +12,7 @@
{
"groupId": "com.github.Team3128",
"artifactId": "3128-common",
"version": "1.0.0"
"version": "1.0.1"
}
],
"jniDependencies": [],
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ plugins {
group = archivesGroup

// Sets JDK compatibility to JDK 17
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

// Configuration for build task which compiles , generates the javadoc and does the install
// of 3128-common in local maven cache.
Expand Down
2 changes: 1 addition & 1 deletion doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h1 class="title">3128-common</h1>
</div>
<div class="block"><h1>FRC Team 3128 Robot Control Program Utility Library</h1>
<p>Provides utility classes and functions for FRC robot control programs.</p>
<p>Version 1.0.0 (January 9 2024)</p></div>
<p>Version 1.0. (January 9 2024)</p></div>
<div id="all-packages-table">
<div class="caption"><span>Packages</span></div>
<div class="summary-table two-column-summary">
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LibraryVersion=1.0.0
LibraryVersion=1.0.1
archivesGroup = com.github.Team3128
archivesBaseName = 3128-common
jsonFileName = 3128-common.json
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/common/core/misc/NAR_Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.lang.reflect.Method;
import java.util.PriorityQueue;

import org.littletonrobotics.junction.LoggedRobot;
import org.littletonrobotics.junction.Logger;

import edu.wpi.first.hal.DriverStationJNI;
Expand All @@ -19,6 +20,7 @@
* @author Mason Lam
*/
public class NAR_Robot extends IterativeRobotBase {

@SuppressWarnings("MemberName")
static class Callback implements Comparable<Callback> {
public Runnable func;
Expand Down Expand Up @@ -93,26 +95,23 @@ protected NAR_Robot(double period) {
Method periodicAfterUser = null; //Method to get the periodicAfterUser method from Logger
try {
periodicBeforeUser = Logger.class.getDeclaredMethod("periodicBeforeUser");
periodicAfterUser = Logger.class.getDeclaredMethod("periodicAfterUser");
periodicAfterUser = Logger.class.getDeclaredMethod("periodicAfterUser", long.class, long.class);
} catch (NoSuchMethodException | SecurityException e) {}

periodicBeforeUser.setAccessible(true); //set the method to be accessible
periodicAfterUser.setAccessible(true); //set the method to be accessible

final Method periodicBeforeUser0 = periodicBeforeUser;
final Method periodicAfterUser0 = periodicAfterUser;

addPeriodic(()-> {
try {
long loopCycleStart = Logger.getRealTimestamp();
periodicBeforeUser0.invoke(null);
long userCodeStart = Logger.getRealTimestamp();
loopFunc();
long loopCycleEnd = Logger.getRealTimestamp();
Logger.recordOutput("LoggedRobot/FullCycleMS", (loopCycleEnd - loopCycleStart) / 1000.0);
Logger.recordOutput("LoggedRobot/LogPeriodicMS", (userCodeStart - loopCycleStart) / 1000.0);
Logger.recordOutput("LoggedRobot/UserCodeMS", (loopCycleEnd - userCodeStart) / 1000.0);

periodicAfterUser0.invoke(null);
periodicAfterUser0.invoke(null, loopCycleEnd - userCodeStart, userCodeStart - loopCycleStart);
} catch (Exception e) {}
}, period);
NotifierJNI.setNotifierName(m_notifier, "TimedRobot");
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
<body>
<h1>FRC Team 3128 Robot Control Program Utility Library</h1>
<p>Provides utility classes and functions for FRC robot control programs.</p>
<p>Version 1.0.0 (January 9 2024)</p>
<p>Version 1.0.1 (January 9 2024)</p>
</body>

0 comments on commit be6fdaf

Please sign in to comment.