Skip to content

Commit 6059f81

Browse files
committed
[wpimath] Remove unit suffixes from variable names
* Move units into API docs instead because suffixes make user code verbose and hard to read * Rename trackWidth to trackwidth * Make ultrasonic classes use meters instead of a mix of m, cm, mm, ft, and inches
1 parent 03f0fc4 commit 6059f81

File tree

282 files changed

+3106
-3779
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

282 files changed

+3106
-3779
lines changed

.github/workflows/tools.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -120,31 +120,31 @@ jobs:
120120
build/allOutputs/
121121
retention-days: 7
122122

123-
PathWeaver:
124-
name: "Build - PathWeaver"
125-
needs: [build-artifacts]
126-
runs-on: ubuntu-24.04
127-
steps:
128-
- uses: actions/checkout@v4
129-
with:
130-
repository: wpilibsuite/PathWeaver
131-
fetch-depth: 0
132-
- name: Patch PathWeaver to use local development
133-
run: sed -i "s/wpilibTools.deps.wpilibVersion.*/wpilibTools.deps.wpilibVersion = \'$YEAR\.424242\.+\'/" dependencies.gradle
134-
- uses: actions/download-artifact@v4
135-
with:
136-
name: MavenArtifacts
137-
- uses: actions/setup-java@v4
138-
with:
139-
java-version: 17
140-
distribution: 'temurin'
141-
- name: Move artifacts
142-
run: mkdir -p ~/releases/maven/development && cp -r edu ~/releases/maven/development
143-
- name: Build with Gradle
144-
run: ./gradlew build
145-
- uses: actions/upload-artifact@v4
146-
with:
147-
name: PathWeaver Build
148-
path: |
149-
build/allOutputs/
150-
retention-days: 7
123+
# PathWeaver:
124+
# name: "Build - PathWeaver"
125+
# needs: [build-artifacts]
126+
# runs-on: ubuntu-24.04
127+
# steps:
128+
# - uses: actions/checkout@v4
129+
# with:
130+
# repository: wpilibsuite/PathWeaver
131+
# fetch-depth: 0
132+
# - name: Patch PathWeaver to use local development
133+
# run: sed -i "s/wpilibTools.deps.wpilibVersion.*/wpilibTools.deps.wpilibVersion = \'$YEAR\.424242\.+\'/" dependencies.gradle
134+
# - uses: actions/download-artifact@v4
135+
# with:
136+
# name: MavenArtifacts
137+
# - uses: actions/setup-java@v4
138+
# with:
139+
# java-version: 17
140+
# distribution: 'temurin'
141+
# - name: Move artifacts
142+
# run: mkdir -p ~/releases/maven/development && cp -r edu ~/releases/maven/development
143+
# - name: Build with Gradle
144+
# run: ./gradlew build
145+
# - uses: actions/upload-artifact@v4
146+
# with:
147+
# name: PathWeaver Build
148+
# path: |
149+
# build/allOutputs/
150+
# retention-days: 7

cscore/src/main/java/edu/wpi/first/cscore/CameraServerJNI.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,10 +1025,10 @@ public interface LoggerFunction {
10251025
/**
10261026
* Runs main run loop with timeout.
10271027
*
1028-
* @param timeoutSeconds Timeout in seconds.
1028+
* @param timeout Timeout in seconds.
10291029
* @return 3 on timeout, 2 on signal, 1 on other.
10301030
*/
1031-
public static native int runMainRunLoopTimeout(double timeoutSeconds);
1031+
public static native int runMainRunLoopTimeout(double timeout);
10321032

10331033
/** Stops main run loop. */
10341034
public static native void stopMainRunLoop();

cscore/src/main/native/cpp/jni/CameraServerJNI.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,9 +2085,9 @@ Java_edu_wpi_first_cscore_CameraServerJNI_runMainRunLoop
20852085
*/
20862086
JNIEXPORT jint JNICALL
20872087
Java_edu_wpi_first_cscore_CameraServerJNI_runMainRunLoopTimeout
2088-
(JNIEnv*, jclass, jdouble timeoutSeconds)
2088+
(JNIEnv*, jclass, jdouble timeout)
20892089
{
2090-
return cs::RunMainRunLoopTimeout(timeoutSeconds);
2090+
return cs::RunMainRunLoopTimeout(timeout);
20912091
}
20922092

20932093
/*

cscore/src/main/native/include/cscore_runloop.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@
55
#pragma once
66

77
namespace cs {
8+
89
void RunMainRunLoop();
9-
int RunMainRunLoopTimeout(double timeoutSeconds);
10+
11+
/**
12+
* Runs main run loop with timeout.
13+
*
14+
* @param timeout Timeout in seconds.
15+
*/
16+
int RunMainRunLoopTimeout(double timeout);
17+
1018
void StopMainRunLoop();
19+
1120
} // namespace cs

cscore/src/main/native/linux/RunLoopHelpers.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ static wpi::Event& GetInstance() {
1212
}
1313

1414
namespace cs {
15+
1516
void RunMainRunLoop() {
1617
wpi::Event& event = GetInstance();
1718
wpi::WaitForObject(event.GetHandle());
1819
}
1920

20-
int RunMainRunLoopTimeout(double timeoutSeconds) {
21+
int RunMainRunLoopTimeout(double timeout) {
2122
wpi::Event& event = GetInstance();
2223
bool timedOut = false;
23-
bool signaled =
24-
wpi::WaitForObject(event.GetHandle(), timeoutSeconds, &timedOut);
24+
bool signaled = wpi::WaitForObject(event.GetHandle(), timeout, &timedOut);
2525
if (timedOut) {
2626
return 3;
2727
}
@@ -35,4 +35,5 @@ void StopMainRunLoop() {
3535
wpi::Event& event = GetInstance();
3636
event.Set();
3737
}
38+
3839
} // namespace cs

cscore/src/main/native/objcpp/RunLoopHelpers.mm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#import <Foundation/Foundation.h>
99

1010
namespace cs {
11+
1112
void RunMainRunLoop() {
1213
if (CFRunLoopGetMain() != CFRunLoopGetCurrent()) {
1314
NSLog(@"This method can only be called from the main thread");
@@ -16,15 +17,16 @@ void RunMainRunLoop() {
1617
CFRunLoopRun();
1718
}
1819

19-
int RunMainRunLoopTimeout(double timeoutSeconds) {
20+
int RunMainRunLoopTimeout(double timeout) {
2021
if (CFRunLoopGetMain() != CFRunLoopGetCurrent()) {
2122
NSLog(@"This method can only be called from the main thread");
2223
return -1;
2324
}
24-
return CFRunLoopRunInMode(kCFRunLoopDefaultMode, timeoutSeconds, false);
25+
return CFRunLoopRunInMode(kCFRunLoopDefaultMode, timeout, false);
2526
}
2627

2728
void StopMainRunLoop() {
2829
CFRunLoopStop(CFRunLoopGetMain());
2930
}
31+
3032
}

cscore/src/main/native/windows/RunLoopHelpers.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ static wpi::Event& GetInstance() {
1212
}
1313

1414
namespace cs {
15+
1516
void RunMainRunLoop() {
1617
wpi::Event& event = GetInstance();
1718
wpi::WaitForObject(event.GetHandle());
1819
}
1920

20-
int RunMainRunLoopTimeout(double timeoutSeconds) {
21+
int RunMainRunLoopTimeout(double timeout) {
2122
wpi::Event& event = GetInstance();
2223
bool timedOut = false;
23-
bool signaled =
24-
wpi::WaitForObject(event.GetHandle(), timeoutSeconds, &timedOut);
24+
bool signaled = wpi::WaitForObject(event.GetHandle(), timeout, &timedOut);
2525
if (timedOut) {
2626
return 3;
2727
}
@@ -35,4 +35,5 @@ void StopMainRunLoop() {
3535
wpi::Event& event = GetInstance();
3636
event.Set();
3737
}
38+
3839
} // namespace cs

hal/src/main/java/edu/wpi/first/hal/AddressableLEDJNI.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,29 +56,25 @@ public class AddressableLEDJNI extends JNIWrapper {
5656
* <p>By default, the driver is set up to drive WS2812Bs, so nothing needs to be set for those.
5757
*
5858
* @param handle the Addressable LED handle
59-
* @param highTime0NanoSeconds high time for 0 bit (default 400ns)
60-
* @param lowTime0NanoSeconds low time for 0 bit (default 900ns)
61-
* @param highTime1NanoSeconds high time for 1 bit (default 900ns)
62-
* @param lowTime1NanoSeconds low time for 1 bit (default 600ns)
59+
* @param highTime0 high time for 0 bit in nanoseconds (default 400 ns)
60+
* @param lowTime0 low time for 0 bit in nanoseconds (default 900 ns)
61+
* @param highTime1 high time for 1 bit in nanoseconds (default 900 ns)
62+
* @param lowTime1 low time for 1 bit in nanoseconds (default 600 ns)
6363
* @see "HAL_SetAddressableLEDBitTiming"
6464
*/
6565
public static native void setBitTiming(
66-
int handle,
67-
int highTime0NanoSeconds,
68-
int lowTime0NanoSeconds,
69-
int highTime1NanoSeconds,
70-
int lowTime1NanoSeconds);
66+
int handle, int highTime0, int lowTime0, int highTime1, int lowTime1);
7167

7268
/**
7369
* Sets the sync time.
7470
*
7571
* <p>The sync time is the time to hold output so LEDs enable. Default set for WS2812B.
7672
*
7773
* @param handle the Addressable LED handle
78-
* @param syncTimeMicroSeconds the sync time (default 280us)
74+
* @param syncTime the sync time in microseconds (default 280 μs)
7975
* @see "HAL_SetAddressableLEDSyncTime"
8076
*/
81-
public static native void setSyncTime(int handle, int syncTimeMicroSeconds);
77+
public static native void setSyncTime(int handle, int syncTime);
8278

8379
/**
8480
* Starts the output.

hal/src/main/java/edu/wpi/first/hal/DIOJNI.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ public class DIOJNI extends JNIWrapper {
8989
* going at any time.
9090
*
9191
* @param dioPortHandle the digital port handle
92-
* @param pulseLengthSeconds the active length of the pulse (in seconds)
92+
* @param pulseLength the active length of the pulse in seconds
9393
* @see "HAL_Pulse"
9494
*/
95-
public static native void pulse(int dioPortHandle, double pulseLengthSeconds);
95+
public static native void pulse(int dioPortHandle, double pulseLength);
9696

9797
/**
9898
* Generates a single digital pulse on multiple channels.
@@ -101,10 +101,10 @@ public class DIOJNI extends JNIWrapper {
101101
* any time.
102102
*
103103
* @param channelMask the channel mask
104-
* @param pulseLengthSeconds the active length of the pulse (in seconds)
104+
* @param pulseLength the active length of the pulse in seconds
105105
* @see "HAL_PulseMultiple"
106106
*/
107-
public static native void pulseMultiple(long channelMask, double pulseLengthSeconds);
107+
public static native void pulseMultiple(long channelMask, double pulseLength);
108108

109109
/**
110110
* Checks a DIO line to see if it is currently generating a pulse.

hal/src/main/java/edu/wpi/first/hal/DMAJNI.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ public class DMAJNI extends JNIWrapper {
4747
* <p>This can only be called if DMA is not started.
4848
*
4949
* @param handle the dma handle
50-
* @param periodSeconds the period to trigger in seconds
50+
* @param period the period to trigger in seconds
5151
* @see "HAL_SetDMATimedTrigger"
5252
*/
53-
public static native void setTimedTrigger(int handle, double periodSeconds);
53+
public static native void setTimedTrigger(int handle, double period);
5454

5555
/**
5656
* Sets DMA transfers to occur at a specific timed interval in FPGA cycles.
@@ -229,14 +229,13 @@ public static native int setExternalTrigger(
229229
* Reads a DMA sample from the queue.
230230
*
231231
* @param handle the dma handle
232-
* @param timeoutSeconds the time to wait for data to be queued before timing out
232+
* @param timeout the time in seconds to wait for data to be queued before timing out
233233
* @param buffer the sample object to place data into
234234
* @param sampleStore index 0-21 channelOffsets, index 22: capture size, index 23: triggerChannels
235235
* (bitflags), index 24: remaining, index 25: read status
236236
* @return timestamp of the DMA Sample
237237
*/
238-
public static native long readDMA(
239-
int handle, double timeoutSeconds, int[] buffer, int[] sampleStore);
238+
public static native long readDMA(int handle, double timeout, int[] buffer, int[] sampleStore);
240239

241240
/**
242241
* Get the sensor DMA sample.

0 commit comments

Comments
 (0)