Merge branch 'main' into 2027

This commit is contained in:
Peter Johnson
2025-02-20 00:26:23 -08:00
123 changed files with 4634 additions and 2291 deletions

9
.github/labeler.yml vendored
View File

@@ -51,3 +51,12 @@
'component: wpiutil':
- changed-files:
- any-glob-to-any-file: wpiutil/**
'component: wpical':
- changed-files:
- any-glob-to-any-file: wpical/**
'component: usage reporting':
- changed-files:
- any-glob-to-any-file: hal/src/generate/**
'attn: NI':
- changed-files:
- any-glob-to-any-file: hal/src/generate/**

View File

@@ -3,7 +3,7 @@
{
"aql": {
"items.find": {
"repo": "wpilib-mvn-development",
"repo": "wpilib-mvn-development-local",
"path": { "$nmatch":"*edu/wpi/first/thirdparty*" },
"$or":[
{

View File

@@ -2,6 +2,8 @@ name: Artifactory Nightly Cleanup
on:
workflow_dispatch:
schedule:
- cron: '15 2 * * *'
jobs:
wpilib-mvn-development_unused_cleanup:

View File

@@ -1,6 +1,6 @@
name: "Pull Request Labeler"
on:
- pull_request_target
- pull_request_target
jobs:
labeler:
@@ -9,4 +9,6 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
- uses: actions/labeler@v5
with:
sync-labels: true

View File

@@ -120,12 +120,6 @@ jobs:
./mpack.py clone
./mpack.py copy-src
./mpack.py format-patch
- name: Run stack_walker.py
run: |
cd upstream_utils
./stack_walker.py clone
./stack_walker.py copy-src
./stack_walker.py format-patch
- name: Run memory.py
run: |
cd upstream_utils

3
.gitignore vendored
View File

@@ -255,3 +255,6 @@ bazel_auth.rc
# ctest
/Testing/
# Meson
.meson-subproject*

View File

@@ -33,7 +33,6 @@ jQuery wpinet/src/main/native/resources/jquery-*
popper.js wpinet/src/main/native/resources/popper-*
units wpimath/src/main/native/include/units/
Eigen wpimath/src/main/native/thirdparty/eigen/include/
StackWalker wpiutil/src/main/native/windows/StackWalker.*
Team 254 Library wpimath/src/main/java/edu/wpi/first/math/spline/SplineParameterizer.java
wpimath/src/main/java/edu/wpi/first/math/trajectory/TrajectoryParameterizer.java
wpimath/src/main/native/include/frc/spline/SplineParameterizer.h
@@ -54,6 +53,7 @@ nanopb wpiutil/src/main/native/thirdparty/nanopb
protobuf wpiutil/src/main/native/thirdparty/protobuf
mrcal wpical/src/main/native/thirdparty/mrcal
libdogleg wpical/src/main/native/thirdparty/libdogleg
Simd hal/src/main/native/athena/simd
Additionally, glfw, memory, and nanopb were all modified for use in WPILib.
@@ -1025,35 +1025,6 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
defined by the Mozilla Public License, v. 2.0.
===================
StackWalker License
===================
Copyright (c) 2005-2013, Jochen Kalmbach
All rights reserved.
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 Jochen Kalmbach 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.
================
Team 254 Library
================
@@ -1702,3 +1673,29 @@ This program is free software: you can redistribute it and/or modify it under th
This program 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.
The full text of the license is available at http://www.gnu.org/licenses
============
Simd License
============
MIT License
Copyright (c) 2011-2017 Ihar Yermalayeu
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.

View File

@@ -14,14 +14,16 @@ public enum AprilTagFields {
k2023ChargedUp("2023-chargedup.json"),
/** 2024 Crescendo. */
k2024Crescendo("2024-crescendo.json"),
/** 2025 Reefscape. */
k2025Reefscape("2025-reefscape.json");
/** 2025 Reefscape Welded (see TU 12). */
k2025ReefscapeWelded("2025-reefscape-welded.json"),
/** 2025 Reefscape AndyMark (see TU 12). */
k2025ReefscapeAndyMark("2025-reefscape-andymark.json");
/** Base resource directory. */
public static final String kBaseResourceDir = "/edu/wpi/first/apriltag/";
/** Alias to the current game. */
public static final AprilTagFields kDefaultField = k2025Reefscape;
public static final AprilTagFields kDefaultField = k2025ReefscapeWelded;
/** Resource filename. */
public final String m_resourceFile;

View File

@@ -133,7 +133,8 @@ namespace frc {
std::string_view GetResource_2022_rapidreact_json();
std::string_view GetResource_2023_chargedup_json();
std::string_view GetResource_2024_crescendo_json();
std::string_view GetResource_2025_reefscape_json();
std::string_view GetResource_2025_reefscape_welded_json();
std::string_view GetResource_2025_reefscape_andymark_json();
} // namespace frc
@@ -149,8 +150,11 @@ AprilTagFieldLayout AprilTagFieldLayout::LoadField(AprilTagField field) {
case AprilTagField::k2024Crescendo:
fieldString = GetResource_2024_crescendo_json();
break;
case AprilTagField::k2025Reefscape:
fieldString = GetResource_2025_reefscape_json();
case AprilTagField::k2025ReefscapeWelded:
fieldString = GetResource_2025_reefscape_welded_json();
break;
case AprilTagField::k2025ReefscapeAndyMark:
fieldString = GetResource_2025_reefscape_andymark_json();
break;
case AprilTagField::kNumFields:
throw std::invalid_argument("Invalid Field");

View File

@@ -20,10 +20,12 @@ enum class AprilTagField {
k2023ChargedUp,
/// 2024 Crescendo.
k2024Crescendo,
/// 2025 Reefscape.
k2025Reefscape,
/// 2025 Reefscape AndyMark (see TU12).
k2025ReefscapeAndyMark,
/// 2025 Reefscape Welded (see TU12).
k2025ReefscapeWelded,
/// Alias to the current game.
kDefaultField = k2025Reefscape,
kDefaultField = k2025ReefscapeWelded,
// This is a placeholder for denoting the last supported field. This should
// always be the last entry in the enum and should not be used by users

View File

@@ -0,0 +1,23 @@
ID,X,Y,Z,Z-Rotation,X-Rotation
1,656.98,24.73,58.5,126,0
2,656.98,291.9,58.5,234,0
3,452.4,316.21,51.25,270,0
4,365.2,241.44,73.54,0,30
5,365.2,75.19,73.54,0,30
6,530.49,129.97,12.13,300,0
7,546.87,158.3,12.13,0,0
8,530.49,186.63,12.13,60,0
9,497.77,186.63,12.13,120,0
10,481.39,158.3,12.13,180,0
11,497.77,129.97,12.13,240,0
12,33.91,24.73,58.5,54,0
13,33.91,291.9,58.5,306,0
14,325.68,241.44,73.54,180,30
15,325.68,75.19,73.54,180,30
16,238.49,0.42,51.25,90,0
17,160.39,129.97,12.13,240,0
18,144,158.3,12.13,180,0
19,160.39,186.63,12.13,120,0
20,193.1,186.63,12.13,60,0
21,209.49,158.3,12.13,0,0
22,193.1,129.97,12.13,300,0
1 ID X Y Z Z-Rotation X-Rotation
2 1 656.98 24.73 58.5 126 0
3 2 656.98 291.9 58.5 234 0
4 3 452.4 316.21 51.25 270 0
5 4 365.2 241.44 73.54 0 30
6 5 365.2 75.19 73.54 0 30
7 6 530.49 129.97 12.13 300 0
8 7 546.87 158.3 12.13 0 0
9 8 530.49 186.63 12.13 60 0
10 9 497.77 186.63 12.13 120 0
11 10 481.39 158.3 12.13 180 0
12 11 497.77 129.97 12.13 240 0
13 12 33.91 24.73 58.5 54 0
14 13 33.91 291.9 58.5 306 0
15 14 325.68 241.44 73.54 180 30
16 15 325.68 75.19 73.54 180 30
17 16 238.49 0.42 51.25 90 0
18 17 160.39 129.97 12.13 240 0
19 18 144 158.3 12.13 180 0
20 19 160.39 186.63 12.13 120 0
21 20 193.1 186.63 12.13 60 0
22 21 209.49 158.3 12.13 0 0
23 22 193.1 129.97 12.13 300 0

View File

@@ -0,0 +1,404 @@
{
"tags": [
{
"ID": 1,
"pose": {
"translation": {
"x": 16.687292,
"y": 0.628142,
"z": 1.4859
},
"rotation": {
"quaternion": {
"W": 0.4539904997395468,
"X": 0.0,
"Y": 0.0,
"Z": 0.8910065241883678
}
}
}
},
{
"ID": 2,
"pose": {
"translation": {
"x": 16.687292,
"y": 7.414259999999999,
"z": 1.4859
},
"rotation": {
"quaternion": {
"W": -0.45399049973954675,
"X": -0.0,
"Y": 0.0,
"Z": 0.8910065241883679
}
}
}
},
{
"ID": 3,
"pose": {
"translation": {
"x": 11.49096,
"y": 8.031733999999998,
"z": 1.30175
},
"rotation": {
"quaternion": {
"W": -0.7071067811865475,
"X": -0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 4,
"pose": {
"translation": {
"x": 9.276079999999999,
"y": 6.132575999999999,
"z": 1.8679160000000001
},
"rotation": {
"quaternion": {
"W": 0.9659258262890683,
"X": 0.0,
"Y": 0.25881904510252074,
"Z": 0.0
}
}
}
},
{
"ID": 5,
"pose": {
"translation": {
"x": 9.276079999999999,
"y": 1.9098259999999998,
"z": 1.8679160000000001
},
"rotation": {
"quaternion": {
"W": 0.9659258262890683,
"X": 0.0,
"Y": 0.25881904510252074,
"Z": 0.0
}
}
}
},
{
"ID": 6,
"pose": {
"translation": {
"x": 13.474446,
"y": 3.3012379999999997,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": -0.8660254037844387,
"X": -0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
},
{
"ID": 7,
"pose": {
"translation": {
"x": 13.890498,
"y": 4.0208200000000005,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 8,
"pose": {
"translation": {
"x": 13.474446,
"y": 4.740402,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 0.8660254037844387,
"X": 0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
},
{
"ID": 9,
"pose": {
"translation": {
"x": 12.643358,
"y": 4.740402,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 0.5000000000000001,
"X": 0.0,
"Y": 0.0,
"Z": 0.8660254037844386
}
}
}
},
{
"ID": 10,
"pose": {
"translation": {
"x": 12.227305999999999,
"y": 4.0208200000000005,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 11,
"pose": {
"translation": {
"x": 12.643358,
"y": 3.3012379999999997,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": -0.4999999999999998,
"X": -0.0,
"Y": 0.0,
"Z": 0.8660254037844387
}
}
}
},
{
"ID": 12,
"pose": {
"translation": {
"x": 0.8613139999999999,
"y": 0.628142,
"z": 1.4859
},
"rotation": {
"quaternion": {
"W": 0.8910065241883679,
"X": 0.0,
"Y": 0.0,
"Z": 0.45399049973954675
}
}
}
},
{
"ID": 13,
"pose": {
"translation": {
"x": 0.8613139999999999,
"y": 7.414259999999999,
"z": 1.4859
},
"rotation": {
"quaternion": {
"W": -0.8910065241883678,
"X": -0.0,
"Y": 0.0,
"Z": 0.45399049973954686
}
}
}
},
{
"ID": 14,
"pose": {
"translation": {
"x": 8.272272,
"y": 6.132575999999999,
"z": 1.8679160000000001
},
"rotation": {
"quaternion": {
"W": 5.914589856893349e-17,
"X": -0.25881904510252074,
"Y": 1.5848095757158825e-17,
"Z": 0.9659258262890683
}
}
}
},
{
"ID": 15,
"pose": {
"translation": {
"x": 8.272272,
"y": 1.9098259999999998,
"z": 1.8679160000000001
},
"rotation": {
"quaternion": {
"W": 5.914589856893349e-17,
"X": -0.25881904510252074,
"Y": 1.5848095757158825e-17,
"Z": 0.9659258262890683
}
}
}
},
{
"ID": 16,
"pose": {
"translation": {
"x": 6.057646,
"y": 0.010667999999999999,
"z": 1.30175
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": 0.7071067811865476
}
}
}
},
{
"ID": 17,
"pose": {
"translation": {
"x": 4.073905999999999,
"y": 3.3012379999999997,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": -0.4999999999999998,
"X": -0.0,
"Y": 0.0,
"Z": 0.8660254037844387
}
}
}
},
{
"ID": 18,
"pose": {
"translation": {
"x": 3.6576,
"y": 4.0208200000000005,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 6.123233995736766e-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 19,
"pose": {
"translation": {
"x": 4.073905999999999,
"y": 4.740402,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 0.5000000000000001,
"X": 0.0,
"Y": 0.0,
"Z": 0.8660254037844386
}
}
}
},
{
"ID": 20,
"pose": {
"translation": {
"x": 4.904739999999999,
"y": 4.740402,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 0.8660254037844387,
"X": 0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
},
{
"ID": 21,
"pose": {
"translation": {
"x": 5.321046,
"y": 4.0208200000000005,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 22,
"pose": {
"translation": {
"x": 4.904739999999999,
"y": 3.3012379999999997,
"z": 0.308102
},
"rotation": {
"quaternion": {
"W": -0.8660254037844387,
"X": -0.0,
"Y": 0.0,
"Z": 0.49999999999999994
}
}
}
}
],
"field": {
"length": 17.548,
"width": 8.042
}
}

View File

@@ -9,5 +9,5 @@ repositories {
}
}
dependencies {
implementation "edu.wpi.first:native-utils:2025.9.0"
implementation "edu.wpi.first:native-utils:2025.9.1"
}

View File

@@ -28,7 +28,7 @@ public class WPIJREArtifact extends MavenArtifact {
private boolean checkJreVersion = true;
private final String artifactLocation = "edu.wpi.first.jdk:roborio-2024:17.0.9u7-1"
private final String artifactLocation = "edu.wpi.first.jdk:roborio-2024:17.0.9u7-3"
@Inject
public WPIJREArtifact(String name, RemoteTarget target) {

View File

@@ -46,7 +46,7 @@ macro(wpilib_target_warnings target)
# Suppress warning "enumeration types with a fixed underlying type are a
# Clang extension"
if(APPLE)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-fixed-enum-extension>)
endif()

View File

@@ -68,7 +68,9 @@ public class AnnotationProcessor extends AbstractProcessor {
customLoggers.putAll(processCustomLoggers(roundEnv, customLogger));
});
// Get all root types (classes and interfaces), excluding packages and modules
roundEnv.getRootElements().stream()
.filter(e -> e instanceof TypeElement)
.filter(
e ->
processingEnv
@@ -267,12 +269,18 @@ public class AnnotationProcessor extends AbstractProcessor {
return false;
}
processingEnv
.getMessager()
.printMessage(
Diagnostic.Kind.NOTE,
"[EPILOGUE] Excluded from logs because " + type + " is not a loggable data type",
element);
var classConfig = element.getEnclosingElement().getAnnotation(Logged.class);
if (classConfig == null || classConfig.warnForNonLoggableTypes()) {
// Not loggable and not explicitly opted out of logging; print a warning message
processingEnv
.getMessager()
.printMessage(
Diagnostic.Kind.NOTE,
"[EPILOGUE] Excluded from logs because " + type + " is not a loggable data type",
element);
}
return true;
}

View File

@@ -71,6 +71,11 @@ public class LoggerGenerator {
public Naming defaultNaming() {
return Naming.USE_CODE_NAME;
}
@Override
public boolean warnForNonLoggableTypes() {
return false;
}
};
public LoggerGenerator(ProcessingEnvironment processingEnv, List<ElementHandler> handlers) {

View File

@@ -1772,7 +1772,7 @@ class AnnotationProcessorTest {
"""
package edu.wpi.first.epilogue;
@Logged
@Logged(warnForNonLoggableTypes = true)
class Example {
Throwable t;
}
@@ -1974,6 +1974,37 @@ class AnnotationProcessorTest {
assertLoggerGenerates(source, expectedRootLogger);
}
@Test
void doesNotBreakWithPackageInfo() {
String source =
"""
package example;
import edu.wpi.first.epilogue.*;
@Logged
class Example {}
""";
String packageInfo = """
package example;
""";
Compilation compilation =
javac()
.withOptions(kJavaVersionOptions)
.withProcessors(new AnnotationProcessor())
.compile(
JavaFileObjects.forSourceString("example.Example", source),
JavaFileObjects.forSourceString("example.package-info", packageInfo));
assertThat(compilation).succeeded();
compilation.generatedSourceFiles().stream()
.filter(jfo -> jfo.getName().contains("Example"))
.findFirst()
.orElseThrow(() -> new IllegalStateException("Logger file was not generated!"));
}
private void assertCompilationError(
String message, long lineNumber, long col, Diagnostic<? extends JavaFileObject> diagnostic) {
assertAll(

View File

@@ -124,4 +124,12 @@ public @interface Logged {
* for all logged fields and methods in an annotated class
*/
Naming defaultNaming() default Naming.USE_CODE_NAME;
/**
* Class-level only: if {@link #strategy()} is {@link Strategy#OPT_OUT}, this can be used to quiet
* the warnings that are printed for non-loggable fields and methods detected within the class.
*
* @return true if warnings should be printed, or false if warnings should not be printed
*/
boolean warnForNonLoggableTypes() default false;
}

View File

@@ -36,13 +36,13 @@ endif()
generate_resources(
src/main/native/resources/edu/wpi/first/fields
generated/main/cpp
${CMAKE_CURRENT_BINARY_DIR}/generated/main/cpp
FIELDS
fields
field_images_resources_src
)
add_library(fieldImages src/main/native/cpp/fields.cpp ${field_images_resources_src})
add_library(fieldImages ${field_images_resources_src} src/main/native/cpp/fields.cpp)
set_target_properties(fieldImages PROPERTIES DEBUG_POSTFIX "d")
set_property(TARGET fieldImages PROPERTY FOLDER "libraries")

View File

@@ -10,6 +10,13 @@ package edu.wpi.first.hal;
* @see "hal/AddressableLED.h"
*/
public class AddressableLEDJNI extends JNIWrapper {
public static final int COLOR_ORDER_RGB = 0;
public static final int COLOR_ORDER_RBG = 1;
public static final int COLOR_ORDER_BGR = 2;
public static final int COLOR_ORDER_BRG = 3;
public static final int COLOR_ORDER_GBR = 4;
public static final int COLOR_ORDER_GRB = 5;
/**
* Initialize Addressable LED using a PWM Digital handle.
*
@@ -27,6 +34,16 @@ public class AddressableLEDJNI extends JNIWrapper {
*/
public static native void free(int handle);
/**
* Sets the color order for the addressable LED output. The default order is GRB.
*
* <p>This will take effect on the next call to {@link #setData(int, byte[])}.
*
* @param handle the Addressable LED handle
* @param colorOrder the color order
*/
public static native void setColorOrder(int handle, int colorOrder);
/**
* Sets the length of the LED strip.
*

View File

@@ -15,6 +15,19 @@ using namespace wpi::java;
static_assert(sizeof(jbyte) * 4 == sizeof(HAL_AddressableLEDData));
static_assert(edu_wpi_first_hal_AddressableLEDJNI_COLOR_ORDER_RGB ==
HAL_ALED_RGB);
static_assert(edu_wpi_first_hal_AddressableLEDJNI_COLOR_ORDER_RBG ==
HAL_ALED_RBG);
static_assert(edu_wpi_first_hal_AddressableLEDJNI_COLOR_ORDER_BGR ==
HAL_ALED_BGR);
static_assert(edu_wpi_first_hal_AddressableLEDJNI_COLOR_ORDER_BRG ==
HAL_ALED_BRG);
static_assert(edu_wpi_first_hal_AddressableLEDJNI_COLOR_ORDER_GBR ==
HAL_ALED_GBR);
static_assert(edu_wpi_first_hal_AddressableLEDJNI_COLOR_ORDER_GRB ==
HAL_ALED_GRB);
extern "C" {
/*
* Class: edu_wpi_first_hal_AddressableLEDJNI
@@ -46,6 +59,22 @@ Java_edu_wpi_first_hal_AddressableLEDJNI_free
}
}
/*
* Class: edu_wpi_first_hal_AddressableLEDJNI
* Method: setColorOrder
* Signature: (II)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_hal_AddressableLEDJNI_setColorOrder
(JNIEnv* env, jclass, jint handle, jint colorOrder)
{
int32_t status = 0;
HAL_SetAddressableLEDColorOrder(
static_cast<HAL_AddressableLEDHandle>(handle),
static_cast<HAL_AddressableLEDColorOrder>(colorOrder), &status);
CheckStatus(env, status);
}
/*
* Class: edu_wpi_first_hal_AddressableLEDJNI
* Method: setLength

View File

@@ -36,6 +36,17 @@ HAL_AddressableLEDHandle HAL_InitializeAddressableLED(
*/
void HAL_FreeAddressableLED(HAL_AddressableLEDHandle handle);
/**
* Sets the color order for the addressable LED output. The default order is
* GRB. This will take effect on the next call to HAL_WriteAddressableLEDData().
* @param[in] handle the Addressable LED handle
* @param[in] colorOrder the color order
* @param[out] status the error code, or 0 for success
*/
void HAL_SetAddressableLEDColorOrder(HAL_AddressableLEDHandle handle,
HAL_AddressableLEDColorOrder colorOrder,
int32_t* status);
/**
* Set the Addressable LED PWM Digital port.
*

View File

@@ -4,6 +4,7 @@
#pragma once
#include <hal/Types.h>
#include <stdint.h>
/** max length of LED strip supported by FPGA. */
@@ -16,3 +17,21 @@ struct HAL_AddressableLEDData {
uint8_t r; ///< red value
uint8_t padding;
};
/**
* Order that color data is sent over the wire.
*/
HAL_ENUM(HAL_AddressableLEDColorOrder) {
HAL_ALED_RGB,
HAL_ALED_RBG,
HAL_ALED_BGR,
HAL_ALED_BRG,
HAL_ALED_GBR,
HAL_ALED_GRB
};
#ifdef __cplusplus
constexpr auto format_as(HAL_AddressableLEDColorOrder order) {
return static_cast<int32_t>(order);
}
#endif

View File

@@ -91,6 +91,10 @@ void HAL_FreeAddressableLED(HAL_AddressableLEDHandle handle) {
SimAddressableLEDData[led->index].initialized = false;
}
void HAL_SetAddressableLEDColorOrder(HAL_AddressableLEDHandle handle,
HAL_AddressableLEDColorOrder colorOrder,
int32_t* status) {}
void HAL_SetAddressableLEDOutputPort(HAL_AddressableLEDHandle handle,
HAL_DigitalHandle outputPort,
int32_t* status) {

View File

@@ -30,6 +30,13 @@ HAL_AddressableLEDHandle HAL_InitializeAddressableLED(
void HAL_FreeAddressableLED(HAL_AddressableLEDHandle handle) {}
void HAL_SetAddressableLEDColorOrder(HAL_AddressableLEDHandle handle,
HAL_AddressableLEDColorOrder colorOrder,
int32_t* status) {
*status = HAL_HANDLE_ERROR;
return;
}
void HAL_SetAddressableLEDOutputPort(HAL_AddressableLEDHandle handle,
HAL_DigitalHandle outputPort,
int32_t* status) {

View File

@@ -106,8 +106,10 @@ void Application(std::string_view saveDir) {
auto analyzer = std::make_unique<sysid::Analyzer>(storage, gLogger);
logLoader->unload.connect([ds = dataSelector.get()] { ds->Reset(); });
dataSelector->testdata = [_analyzer = analyzer.get()](auto data) {
dataSelector->testdata = [_analyzer = analyzer.get(),
ds = dataSelector.get()](auto data) {
_analyzer->m_data = data;
_analyzer->SetMissingTests(ds->m_missingTests);
_analyzer->AnalyzeData();
};

View File

@@ -10,6 +10,7 @@
#include <numbers>
#include <string>
#include <thread>
#include <vector>
#include <fmt/format.h>
#include <glass/Context.h>
@@ -251,6 +252,13 @@ void Analyzer::Display() {
}
break;
}
case AnalyzerState::kMissingTestsError: {
CreateErrorPopup(m_errorPopup, m_exception);
if (!m_errorPopup) {
m_state = AnalyzerState::kWaitingForData;
}
break;
}
case AnalyzerState::kGeneralDataError:
case AnalyzerState::kTestDurationError:
case AnalyzerState::kVelocityThresholdError: {
@@ -269,6 +277,9 @@ void Analyzer::Display() {
void Analyzer::PrepareData() {
WPI_INFO(m_logger, "{}", "Preparing data");
try {
if (m_missingTests.size() > 0) {
throw sysid::MissingTestsError{m_missingTests};
}
m_manager->PrepareData();
UpdateFeedforwardGains();
UpdateFeedbackGains();
@@ -281,6 +292,9 @@ void Analyzer::PrepareData() {
} catch (const sysid::NoDynamicDataError& e) {
m_state = AnalyzerState::kTestDurationError;
HandleError(e.what());
} catch (const sysid::MissingTestsError& e) {
m_state = AnalyzerState::kMissingTestsError;
HandleError(e.what());
} catch (const AnalysisManager::FileReadingError& e) {
m_state = AnalyzerState::kFileError;
HandleError(e.what());
@@ -324,6 +338,10 @@ void Analyzer::HandleError(std::string_view msg) {
PrepareRawGraphs();
}
void Analyzer::SetMissingTests(const std::vector<std::string>& missingTests) {
m_missingTests = missingTests;
}
void Analyzer::DisplayGraphs() {
ImGui::SetNextWindowPos(ImVec2{kDiagnosticPlotWindowPos},
ImGuiCond_FirstUseEver);

View File

@@ -6,6 +6,7 @@
#include <algorithm>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
@@ -112,6 +113,7 @@ void DataSelector::Display() {
continue;
}
WPI_INFO(m_logger, "Loaded test state {}", it2->first);
m_executedTests.insert(it2->first);
++it2;
}
if (it->second.empty()) {
@@ -133,6 +135,15 @@ void DataSelector::Display() {
return;
}
if (m_executedTests.size() < 4 && !m_testCountValidated) {
for (auto test : kValidTests) {
if (!m_executedTests.contains(test)) {
m_missingTests.push_back(test);
m_testCountValidated = true;
}
}
}
#if 0
// Test filtering
if (ImGui::BeginCombo("Test", m_selectedTest.c_str())) {

View File

@@ -4,15 +4,16 @@
#pragma once
#include <cmath>
#include <exception>
#include <functional>
#include <string>
#include <string_view>
#include <tuple>
#include <utility>
#include <vector>
#include <fmt/format.h>
#include <fmt/ranges.h>
#include <frc/filter/LinearFilter.h>
#include <units/time.h>
#include <wpi/StringMap.h>
@@ -40,7 +41,7 @@ class InvalidDataError : public std::exception {
*/
explicit InvalidDataError(std::string_view message) {
m_message = fmt::format(
"{}. Please verify that your units and data is reasonable and then "
"{} Please verify that your units and data is reasonable and then "
"adjust your velocity threshold, test duration, and/or window size to "
"try to fix this issue.",
message);
@@ -68,6 +69,25 @@ class NoQuasistaticDataError : public std::exception {
}
};
/**
* Exception for not all tests being present.
*/
class MissingTestsError : public std::exception {
public:
explicit MissingTestsError(std::vector<std::string> MissingTests)
: missingTests(std::move(MissingTests)) {
errorString = fmt::format(
"The following tests were not detected: {}. Make sure to perform all "
"four tests as described in the SysId documentation.",
fmt::join(missingTests, ", "));
}
const char* what() const noexcept override { return errorString.c_str(); }
private:
std::vector<std::string> missingTests;
std::string errorString;
};
/**
* Exception for Dynamic Data being completely removed.
*/

View File

@@ -8,6 +8,7 @@
#include <string>
#include <string_view>
#include <thread>
#include <vector>
#include <glass/View.h>
#include <implot.h>
@@ -46,6 +47,7 @@ class Analyzer : public glass::View {
kVelocityThresholdError,
kTestDurationError,
kGeneralDataError,
kMissingTestsError,
kFileError
};
/**
@@ -91,6 +93,11 @@ class Analyzer : public glass::View {
*/
void AnalyzeData();
/**
* Used by DataSelector to import any missing tests.
*/
void SetMissingTests(const std::vector<std::string>& missingTests);
private:
/**
* Kills the data preparation thread
@@ -199,6 +206,7 @@ class Analyzer : public glass::View {
// Stores the exception message.
std::string m_exception;
std::vector<std::string> m_missingTests;
bool m_calcDefaults = false;

View File

@@ -7,6 +7,7 @@
#include <functional>
#include <future>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
@@ -57,6 +58,7 @@ class DataSelector : public glass::View {
* Called when new test data is loaded.
*/
std::function<void(TestData)> testdata;
std::vector<std::string> m_missingTests;
private:
wpi::Logger& m_logger;
@@ -76,6 +78,11 @@ class DataSelector : public glass::View {
int m_selectedAnalysis = 0;
std::future<TestData> m_testdataFuture;
std::vector<std::string> m_testdataStats;
std::set<std::string> kValidTests = {"quasistatic-forward",
"quasistatic-reverse", "dynamic-forward",
"dynamic-reverse"};
std::set<std::string> m_executedTests;
bool m_testCountValidated = false;
static Tests LoadTests(const wpi::log::DataLogReaderEntry& testStateEntry);
TestData BuildTestData();

View File

@@ -1,65 +0,0 @@
#!/usr/bin/env python3
import os
import shutil
import subprocess
from upstream_utils import Lib
def crlf_to_lf():
for root, _, files in os.walk("."):
if ".git" in root:
continue
for fname in files:
filename = os.path.join(root, fname)
print(f"Converting CRLF -> LF for {filename}")
with open(filename, "rb") as f:
content = f.read()
content = content.replace(b"\r\n", b"\n")
with open(filename, "wb") as f:
f.write(content)
subprocess.check_call(["git", "add", "-A"])
subprocess.check_call(["git", "commit", "-m", "Fix line endings"])
def copy_upstream_src(wpilib_root):
wpiutil = os.path.join(wpilib_root, "wpiutil")
shutil.copy(
os.path.join("Main", "StackWalker", "StackWalker.h"),
os.path.join(wpiutil, "src/main/native/windows/StackWalker.h"),
)
shutil.copy(
os.path.join("Main", "StackWalker", "StackWalker.cpp"),
os.path.join(wpiutil, "src/main/native/windows/StackWalker.cpp"),
)
def main():
name = "stack_walker"
url = "https://github.com/JochenKalmbach/StackWalker"
tag = "5b0df7a4db8896f6b6dc45d36e383c52577e3c6b"
patch_options = {
"ignore_whitespace": True,
}
stack_walker = Lib(
name,
url,
tag,
copy_upstream_src,
patch_options,
pre_patch_hook=crlf_to_lf,
pre_patch_commits=1,
)
stack_walker.main()
if __name__ == "__main__":
main()

View File

@@ -1,21 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Thad House <thadhouse1@gmail.com>
Date: Sat, 22 Jul 2023 13:03:13 -0700
Subject: [PATCH] Add advapi pragma
---
Main/StackWalker/StackWalker.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/Main/StackWalker/StackWalker.cpp b/Main/StackWalker/StackWalker.cpp
index 89545f8612d0d099d48fcf4184a2f2a30cf8577f..b2bcbaa447c5db1a3bcc155fb317ebc8a8050e79 100644
--- a/Main/StackWalker/StackWalker.cpp
+++ b/Main/StackWalker/StackWalker.cpp
@@ -91,6 +91,7 @@
#include <new>
#pragma comment(lib, "version.lib") // for "VerQueryValue"
+#pragma comment(lib, "Advapi32.lib") // for "GetUserName"
#pragma warning(disable : 4826)
#if _MSC_VER >= 1900

View File

@@ -107,7 +107,7 @@ public class Command{{ ConsoleName }}Controller extends CommandGenericHID {
{% endfor -%}
{% for stick in sticks %}
/**
* Get the {{ stick.NameParts[1] }} axis value of {{ stick.NameParts[0] }} side of the controller.
* Get the {{ stick.NameParts[1] }} axis value of {{ stick.NameParts[0] }} side of the controller. {{ stick.PositiveDirection }} is positive.
*
* @return The axis value.
*/

View File

@@ -71,7 +71,7 @@ class Command{{ ConsoleName }}Controller : public CommandGenericHID {
{% endfor -%}
{% for stick in sticks %}
/**
* Get the {{ stick.NameParts[1] }} axis value of {{ stick.NameParts[0] }} side of the controller.
* Get the {{ stick.NameParts[1] }} axis value of {{ stick.NameParts[0] }} side of the controller. {{ stick.PositiveDirection }} is positive.
*
* @return The axis value.
*/

View File

@@ -348,7 +348,7 @@ public class CommandPS4Controller extends CommandGenericHID {
}
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -357,7 +357,7 @@ public class CommandPS4Controller extends CommandGenericHID {
}
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return The axis value.
*/
@@ -366,7 +366,7 @@ public class CommandPS4Controller extends CommandGenericHID {
}
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -375,7 +375,7 @@ public class CommandPS4Controller extends CommandGenericHID {
}
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return The axis value.
*/

View File

@@ -348,7 +348,7 @@ public class CommandPS5Controller extends CommandGenericHID {
}
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -357,7 +357,7 @@ public class CommandPS5Controller extends CommandGenericHID {
}
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return The axis value.
*/
@@ -366,7 +366,7 @@ public class CommandPS5Controller extends CommandGenericHID {
}
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -375,7 +375,7 @@ public class CommandPS5Controller extends CommandGenericHID {
}
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return The axis value.
*/

View File

@@ -370,7 +370,7 @@ public class CommandStadiaController extends CommandGenericHID {
}
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -379,7 +379,7 @@ public class CommandStadiaController extends CommandGenericHID {
}
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -388,7 +388,7 @@ public class CommandStadiaController extends CommandGenericHID {
}
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return The axis value.
*/
@@ -397,7 +397,7 @@ public class CommandStadiaController extends CommandGenericHID {
}
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return The axis value.
*/

View File

@@ -338,7 +338,7 @@ public class CommandXboxController extends CommandGenericHID {
}
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -347,7 +347,7 @@ public class CommandXboxController extends CommandGenericHID {
}
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -356,7 +356,7 @@ public class CommandXboxController extends CommandGenericHID {
}
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return The axis value.
*/
@@ -365,7 +365,7 @@ public class CommandXboxController extends CommandGenericHID {
}
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return The axis value.
*/

View File

@@ -204,28 +204,28 @@ class CommandPS4Controller : public CommandGenericHID {
.GetDefaultButtonLoop()) const;
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return The axis value.
*/
double GetLeftX() const;
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return The axis value.
*/
double GetLeftY() const;
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return The axis value.
*/
double GetRightX() const;
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return The axis value.
*/

View File

@@ -204,28 +204,28 @@ class CommandPS5Controller : public CommandGenericHID {
.GetDefaultButtonLoop()) const;
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return The axis value.
*/
double GetLeftX() const;
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return The axis value.
*/
double GetLeftY() const;
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return The axis value.
*/
double GetRightX() const;
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return The axis value.
*/

View File

@@ -216,28 +216,28 @@ class CommandStadiaController : public CommandGenericHID {
.GetDefaultButtonLoop()) const;
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return The axis value.
*/
double GetLeftX() const;
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return The axis value.
*/
double GetRightX() const;
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return The axis value.
*/
double GetLeftY() const;
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return The axis value.
*/

View File

@@ -190,28 +190,28 @@ class CommandXboxController : public CommandGenericHID {
.GetDefaultButtonLoop()) const;
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return The axis value.
*/
double GetLeftX() const;
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return The axis value.
*/
double GetRightX() const;
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return The axis value.
*/
double GetLeftY() const;
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return The axis value.
*/

View File

@@ -173,6 +173,9 @@ public class CommandJoystick extends CommandGenericHID {
/**
* Get the x position of the HID.
*
* <p>This depends on the mapping of the joystick connected to the current port. On most
* joysticks, positive is to the right.
*
* @return the x position
*/
public double getX() {
@@ -182,6 +185,9 @@ public class CommandJoystick extends CommandGenericHID {
/**
* Get the y position of the HID.
*
* <p>This depends on the mapping of the joystick connected to the current port. On most
* joysticks, positive is to the back.
*
* @return the y position
*/
public double getY() {
@@ -218,8 +224,8 @@ public class CommandJoystick extends CommandGenericHID {
}
/**
* Get the magnitude of the direction vector formed by the joystick's current position relative to
* its origin.
* Get the magnitude of the vector formed by the joystick's current position relative to its
* origin.
*
* @return The magnitude of the direction vector
*/
@@ -228,16 +234,26 @@ public class CommandJoystick extends CommandGenericHID {
}
/**
* Get the direction of the vector formed by the joystick and its origin in radians.
* Get the direction of the vector formed by the joystick and its origin in radians. 0 is forward
* and clockwise is positive. (Straight right is π/2.)
*
* @return The direction of the vector in radians
*/
public double getDirectionRadians() {
// https://docs.wpilib.org/en/stable/docs/software/basic-programming/coordinate-system.html#joystick-and-controller-coordinate-system
// A positive rotation around the X axis moves the joystick right, and a
// positive rotation around the Y axis moves the joystick backward. When
// treating them as translations, 0 radians is measured from the right
// direction, and angle increases clockwise.
//
// It's rotated 90 degrees CCW (y is negated and the arguments are reversed)
// so that 0 radians is forward.
return m_hid.getDirectionRadians();
}
/**
* Get the direction of the vector formed by the joystick and its origin in degrees.
* Get the direction of the vector formed by the joystick and its origin in degrees. 0 is forward
* and clockwise is positive. (Straight right is 90.)
*
* @return The direction of the vector in degrees
*/

View File

@@ -26,5 +26,13 @@ double CommandJoystick::GetMagnitude() const {
}
units::radian_t CommandJoystick::GetDirection() const {
// https://docs.wpilib.org/en/stable/docs/software/basic-programming/coordinate-system.html#joystick-and-controller-coordinate-system
// A positive rotation around the X axis moves the joystick right, and a
// positive rotation around the Y axis moves the joystick backward. When
// treating them as translations, 0 radians is measured from the right
// direction, and angle increases clockwise.
//
// It's rotated 90 degrees CCW (y is negated and the arguments are reversed)
// so that 0 radians is forward.
return m_hid.GetDirection();
}

View File

@@ -56,7 +56,7 @@ class CommandJoystick : public CommandGenericHID {
class Trigger Top(frc::EventLoop* loop = CommandScheduler::GetInstance()
.GetDefaultButtonLoop()) const;
/**
* Get the magnitude of the direction vector formed by the joystick's
* Get the magnitude of the vector formed by the joystick's
* current position relative to its origin.
*
* @return The magnitude of the direction vector
@@ -64,7 +64,9 @@ class CommandJoystick : public CommandGenericHID {
double GetMagnitude() const;
/**
* Get the direction of the vector formed by the joystick and its origin.
* Get the direction of the vector formed by the joystick and its origin. 0 is
* forward and clockwise is positive. (Straight right is π/2 radians or 90
* degrees.)
*
* @return The direction of the vector.
*/

View File

@@ -47,7 +47,7 @@ class {{ ConsoleName }}Controller : public GenericHID,
{{ ConsoleName }}Controller& operator=({{ ConsoleName }}Controller&&) = default;
{% for stick in sticks %}
/**
* Get the {{ stick.NameParts[1] }} axis value of {{ stick.NameParts[0] }} side of the controller.
* Get the {{ stick.NameParts[1] }} axis value of {{ stick.NameParts[0] }} side of the controller. {{ stick.PositiveDirection }} is positive.
*
* @return the axis value.
*/

View File

@@ -45,28 +45,28 @@ class PS4Controller : public GenericHID,
PS4Controller& operator=(PS4Controller&&) = default;
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetLeftX() const;
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return the axis value.
*/
double GetLeftY() const;
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetRightX() const;
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return the axis value.
*/

View File

@@ -45,28 +45,28 @@ class PS5Controller : public GenericHID,
PS5Controller& operator=(PS5Controller&&) = default;
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetLeftX() const;
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return the axis value.
*/
double GetLeftY() const;
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetRightX() const;
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return the axis value.
*/

View File

@@ -45,28 +45,28 @@ class StadiaController : public GenericHID,
StadiaController& operator=(StadiaController&&) = default;
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetLeftX() const;
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetRightX() const;
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return the axis value.
*/
double GetLeftY() const;
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return the axis value.
*/

View File

@@ -45,28 +45,28 @@ class XboxController : public GenericHID,
XboxController& operator=(XboxController&&) = default;
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetLeftX() const;
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return the axis value.
*/
double GetRightX() const;
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return the axis value.
*/
double GetLeftY() const;
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return the axis value.
*/

View File

@@ -34,6 +34,13 @@ AddressableLED::AddressableLED(int port) : m_port{port} {
HAL_ReportUsage("IO", port, "AddressableLED");
}
void AddressableLED::SetColorOrder(AddressableLED::ColorOrder order) {
int32_t status = 0;
HAL_SetAddressableLEDColorOrder(
m_handle, static_cast<HAL_AddressableLEDColorOrder>(order), &status);
FRC_CheckErrorStatus(status, "Port {} Color order {}", m_port, order);
}
void AddressableLED::SetLength(int length) {
int32_t status = 0;
HAL_SetAddressableLEDLength(m_handle, length, &status);

View File

@@ -82,17 +82,18 @@ class Alert::SendableAlerts : public nt::NTSendable,
* @return the SendableAlerts for the group
*/
static SendableAlerts& ForGroup(std::string_view group) {
// Force initialization of SendableRegistry before our magic static to
// prevent incorrect destruction order.
wpi::SendableRegistry::EnsureInitialized();
static wpi::StringMap<Alert::SendableAlerts> groups;
auto [iter, exists] = groups.try_emplace(group);
SendableAlerts& sendable = iter->second;
if (!exists) {
frc::SmartDashboard::PutData(group, &iter->second);
SendableAlerts* salert = nullptr;
try {
auto* sendable = frc::SmartDashboard::GetData(group);
salert = dynamic_cast<SendableAlerts*>(sendable);
} catch (frc::RuntimeError&) {
}
return sendable;
if (!salert) {
// this leaks if ResetSmartDashboardInstance is called, but that's fine
salert = new Alert::SendableAlerts;
frc::SmartDashboard::PutData(group, salert);
}
return *salert;
}
private:

View File

@@ -119,5 +119,13 @@ double Joystick::GetMagnitude() const {
}
units::radian_t Joystick::GetDirection() const {
// https://docs.wpilib.org/en/stable/docs/software/basic-programming/coordinate-system.html#joystick-and-controller-coordinate-system
// A positive rotation around the X axis moves the joystick right, and a
// positive rotation around the Y axis moves the joystick backward. When
// treating them as translations, 0 radians is measured from the right
// direction, and angle increases clockwise.
//
// It's rotated 90 degrees CCW (y is negated and the arguments are reversed)
// so that 0 radians is forward.
return units::radian_t{std::atan2(GetX(), -GetY())};
}

View File

@@ -24,12 +24,27 @@ namespace frc {
* By default, the timing supports WS2812B and WS2815 LEDs, but is configurable
* using SetBitTiming()
*
* Some LEDs use a different color order than the default GRB. The color order
* is configurable using SetColorOrder().
*
* <p>Only 1 LED driver is currently supported by the roboRIO. However,
* multiple LED strips can be connected in series and controlled from the
* single driver.
*/
class AddressableLED {
public:
/**
* Order that color data is sent over the wire.
*/
enum ColorOrder {
kRGB = HAL_ALED_RGB, ///< RGB order
kRBG = HAL_ALED_RBG, ///< RBG order
kBGR = HAL_ALED_BGR, ///< BGR order
kBRG = HAL_ALED_BRG, ///< BRG order
kGBR = HAL_ALED_GBR, ///< GBR order
kGRB = HAL_ALED_GRB ///< GRB order. This is the default order.
};
class LEDData : public HAL_AddressableLEDData {
public:
LEDData() : LEDData(0, 0, 0) {}
@@ -95,6 +110,15 @@ class AddressableLED {
AddressableLED(AddressableLED&&) = default;
AddressableLED& operator=(AddressableLED&&) = default;
/**
* Sets the color order for this AddressableLED. The default order is GRB.
*
* This will take effect on the next call to SetData().
*
* @param order the color order
*/
void SetColorOrder(ColorOrder order);
/**
* Sets the length of the LED strip.
*
@@ -169,4 +193,9 @@ class AddressableLED {
hal::Handle<HAL_AddressableLEDHandle, HAL_FreeAddressableLED> m_handle;
int m_port;
};
constexpr auto format_as(AddressableLED::ColorOrder order) {
return static_cast<int32_t>(order);
}
} // namespace frc

View File

@@ -148,6 +148,7 @@ class Joystick : public GenericHID {
* Get the X value of the current joystick.
*
* This depends on the mapping of the joystick connected to the current port.
* On most joysticks, positive is to the right.
*/
double GetX() const;
@@ -155,6 +156,7 @@ class Joystick : public GenericHID {
* Get the Y value of the current joystick.
*
* This depends on the mapping of the joystick connected to the current port.
* On most joysticks, positive is to the back.
*/
double GetY() const;
@@ -244,7 +246,7 @@ class Joystick : public GenericHID {
BooleanEvent Top(EventLoop* loop) const;
/**
* Get the magnitude of the direction vector formed by the joystick's
* Get the magnitude of the vector formed by the joystick's
* current position relative to its origin.
*
* @return The magnitude of the direction vector
@@ -252,7 +254,9 @@ class Joystick : public GenericHID {
double GetMagnitude() const;
/**
* Get the direction of the vector formed by the joystick and its origin.
* Get the direction of the vector formed by the joystick and its origin. 0 is
* forward and clockwise is positive. (Straight right is π/2 radians or 90
* degrees.)
*
* @return The direction of the vector.
*/

View File

@@ -52,11 +52,11 @@ class LinearSystemSim {
* @param dt The time between updates.
*/
void Update(units::second_t dt) {
// Update x. By default, this is the linear system dynamics x_k+1 = Ax_k +
// Bu_k
// Update x. By default, this is the linear system dynamics xₖ₊₁ = Ax +
// Buₖ.
m_x = UpdateX(m_x, m_u, dt);
// y = Cx + Du
// y = Cx + Du
m_y = m_plant.CalculateY(m_x, m_u);
// Add noise. If the user did not pass a noise vector to the
@@ -115,7 +115,14 @@ class LinearSystemSim {
*
* @param state The new state.
*/
void SetState(const Vectord<States>& state) { m_x = state; }
void SetState(const Vectord<States>& state) {
m_x = state;
// Update the output to reflect the new state.
//
// yₖ = Cxₖ + Duₖ
m_y = m_plant.CalculateY(m_x, m_u);
}
protected:
/**

View File

@@ -33,8 +33,7 @@ class AlertsTest : public ::testing::Test {
std::string GetGroupName() {
const ::testing::TestInfo* testInfo =
::testing::UnitTest::GetInstance()->current_test_info();
return fmt::format("{}_{}", testInfo->test_suite_name(),
testInfo->test_case_name());
return fmt::format("{}_{}", testInfo->test_suite_name(), testInfo->name());
}
template <typename... Args>
@@ -80,7 +79,16 @@ class AlertsTest : public ::testing::Test {
#define EXPECT_STATE(type, ...) \
EXPECT_EQ(GetActiveAlerts(type), (std::vector<std::string>{__VA_ARGS__}))
TEST_F(AlertsTest, SetUnset) {
TEST_F(AlertsTest, SetUnsetSingle) {
auto one = MakeAlert("one", kInfo);
EXPECT_FALSE(IsAlertActive("one", kInfo));
one.Set(true);
EXPECT_TRUE(IsAlertActive("one", kInfo));
one.Set(false);
EXPECT_FALSE(IsAlertActive("one", kInfo));
}
TEST_F(AlertsTest, SetUnsetMultiple) {
auto one = MakeAlert("one", kError);
auto two = MakeAlert("two", kInfo);
EXPECT_FALSE(IsAlertActive("one", kError));

View File

@@ -44,6 +44,15 @@ TEST(ElevatorSimTest, StateSpaceSim) {
EXPECT_NEAR(controller.GetSetpoint(), sim.GetPosition().value(), 0.2);
}
TEST(ElevatorSimTest, InitialState) {
constexpr auto startingHeight = 0.5_m;
frc::sim::ElevatorSim sim(frc::DCMotor::KrakenX60(2), 20, 8_kg, 0.1_m, 0_m,
1_m, true, startingHeight, {0.01, 0.0});
EXPECT_DOUBLE_EQ(startingHeight.value(), sim.GetPosition().value());
EXPECT_DOUBLE_EQ(0, sim.GetVelocity().value());
}
TEST(ElevatorSimTest, MinMax) {
frc::sim::ElevatorSim sim(frc::DCMotor::Vex775Pro(4), 14.67, 8_kg, 0.75_in,
0_m, 1_m, true, 0_m, {0.01});

View File

@@ -21,3 +21,12 @@ TEST(SingleJointedArmTest, Disabled) {
// The arm should swing down.
EXPECT_NEAR(sim.GetAngle().value(), -std::numbers::pi / 2, 0.01);
}
TEST(SingleJointedArmTest, InitialState) {
constexpr auto startingAngle = 45_deg;
frc::sim::SingleJointedArmSim sim(frc::DCMotor::KrakenX60(2), 125, 3_kg_sq_m,
30_in, 0_deg, 90_deg, true, startingAngle);
EXPECT_EQ(startingAngle, sim.GetAngle());
EXPECT_DOUBLE_EQ(0, sim.GetVelocity().value());
}

View File

@@ -59,28 +59,32 @@
"left",
"X"
],
"value": 0
"value": 0,
"PositiveDirection": "Right"
},
{
"NameParts": [
"right",
"X"
],
"value": 4
"value": 4,
"PositiveDirection": "Right"
},
{
"NameParts": [
"left",
"Y"
],
"value": 1
"value": 1,
"PositiveDirection": "Back"
},
{
"NameParts": [
"right",
"Y"
],
"value": 5
"value": 5,
"PositiveDirection": "Back"
}
],
"triggers": [
@@ -173,28 +177,32 @@
"left",
"X"
],
"value": 0
"value": 0,
"PositiveDirection": "Right"
},
{
"NameParts": [
"left",
"Y"
],
"value": 1
"value": 1,
"PositiveDirection": "Back"
},
{
"NameParts": [
"right",
"X"
],
"value": 2
"value": 2,
"PositiveDirection": "Right"
},
{
"NameParts": [
"right",
"Y"
],
"value": 5
"value": 5,
"PositiveDirection": "Back"
}
],
"triggers": [
@@ -287,28 +295,32 @@
"left",
"X"
],
"value": 0
"value": 0,
"PositiveDirection": "Right"
},
{
"NameParts": [
"left",
"Y"
],
"value": 1
"value": 1,
"PositiveDirection": "Back"
},
{
"NameParts": [
"right",
"X"
],
"value": 2
"value": 2,
"PositiveDirection": "Right"
},
{
"NameParts": [
"right",
"Y"
],
"value": 5
"value": 5,
"PositiveDirection": "Back"
}
],
"triggers": [
@@ -408,28 +420,32 @@
"left",
"X"
],
"value": 0
"value": 0,
"PositiveDirection": "Right"
},
{
"NameParts": [
"right",
"X"
],
"value": 3
"value": 3,
"PositiveDirection": "Right"
},
{
"NameParts": [
"left",
"Y"
],
"value": 1
"value": 1,
"PositiveDirection": "Back"
},
{
"NameParts": [
"right",
"Y"
],
"value": 4
"value": 4,
"PositiveDirection": "Back"
}
]
}

View File

@@ -62,7 +62,8 @@
"type": "object",
"required": [
"NameParts",
"value"
"value",
"PositiveDirection"
],
"properties": {
"NameParts": {
@@ -76,6 +77,10 @@
"value": {
"description": "The axis value",
"type": "integer"
},
"PositiveDirection": {
"description": "The positive direction of the axis.",
"type": "string"
}
}
}

View File

@@ -102,7 +102,7 @@ public class {{ ConsoleName }}Controller extends GenericHID implements Sendable
}
{% for stick in sticks %}
/**
* Get the {{ stick.NameParts[1] }} axis value of {{ stick.NameParts[0] }} side of the controller.
* Get the {{ stick.NameParts[1] }} axis value of {{ stick.NameParts[0] }} side of the controller. {{ stick.PositiveDirection }} is positive.
*
* @return The axis value.
*/

View File

@@ -128,7 +128,7 @@ public class PS4Controller extends GenericHID implements Sendable {
}
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -137,7 +137,7 @@ public class PS4Controller extends GenericHID implements Sendable {
}
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return The axis value.
*/
@@ -146,7 +146,7 @@ public class PS4Controller extends GenericHID implements Sendable {
}
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -155,7 +155,7 @@ public class PS4Controller extends GenericHID implements Sendable {
}
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return The axis value.
*/

View File

@@ -128,7 +128,7 @@ public class PS5Controller extends GenericHID implements Sendable {
}
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -137,7 +137,7 @@ public class PS5Controller extends GenericHID implements Sendable {
}
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return The axis value.
*/
@@ -146,7 +146,7 @@ public class PS5Controller extends GenericHID implements Sendable {
}
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -155,7 +155,7 @@ public class PS5Controller extends GenericHID implements Sendable {
}
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return The axis value.
*/

View File

@@ -126,7 +126,7 @@ public class StadiaController extends GenericHID implements Sendable {
}
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -135,7 +135,7 @@ public class StadiaController extends GenericHID implements Sendable {
}
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -144,7 +144,7 @@ public class StadiaController extends GenericHID implements Sendable {
}
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return The axis value.
*/
@@ -153,7 +153,7 @@ public class StadiaController extends GenericHID implements Sendable {
}
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return The axis value.
*/

View File

@@ -120,7 +120,7 @@ public class XboxController extends GenericHID implements Sendable {
}
/**
* Get the X axis value of left side of the controller.
* Get the X axis value of left side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -129,7 +129,7 @@ public class XboxController extends GenericHID implements Sendable {
}
/**
* Get the X axis value of right side of the controller.
* Get the X axis value of right side of the controller. Right is positive.
*
* @return The axis value.
*/
@@ -138,7 +138,7 @@ public class XboxController extends GenericHID implements Sendable {
}
/**
* Get the Y axis value of left side of the controller.
* Get the Y axis value of left side of the controller. Back is positive.
*
* @return The axis value.
*/
@@ -147,7 +147,7 @@ public class XboxController extends GenericHID implements Sendable {
}
/**
* Get the Y axis value of right side of the controller.
* Get the Y axis value of right side of the controller. Back is positive.
*
* @return The axis value.
*/

View File

@@ -11,13 +11,57 @@ import edu.wpi.first.hal.PWMJNI;
/**
* A class for driving addressable LEDs, such as WS2812B, WS2815, and NeoPixels.
*
* <p>By default, the timing supports WS2812B and WS2815 LEDs, but is configurable using
* setBitTiming()
* <p>By default, the timing supports WS2812B and WS2815 LEDs, but is configurable using {@link
* #setBitTiming(int, int, int, int)}
*
* <p>Some LEDs use a different color order than the default GRB. The color order is configurable
* using {@link #setColorOrder(ColorOrder)}.
*
* <p>Only 1 LED driver is currently supported by the roboRIO. However, multiple LED strips can be
* connected in series and controlled from the single driver.
*/
public class AddressableLED implements AutoCloseable {
/** Order that color data is sent over the wire. */
public enum ColorOrder {
/** RGB order. */
kRGB(AddressableLEDJNI.COLOR_ORDER_RGB),
/** RBG order. */
kRBG(AddressableLEDJNI.COLOR_ORDER_RBG),
/** BGR order. */
kBGR(AddressableLEDJNI.COLOR_ORDER_BGR),
/** BRG order. */
kBRG(AddressableLEDJNI.COLOR_ORDER_BRG),
/** GBR order. */
kGBR(AddressableLEDJNI.COLOR_ORDER_GBR),
/** GRB order. This is the default order. */
kGRB(AddressableLEDJNI.COLOR_ORDER_GRB);
/** The native value for this ColorOrder. */
public final int value;
ColorOrder(int value) {
this.value = value;
}
/**
* Gets a color order from an int value.
*
* @param value int value
* @return color order
*/
public ColorOrder fromValue(int value) {
return switch (value) {
case AddressableLEDJNI.COLOR_ORDER_RBG -> kRBG;
case AddressableLEDJNI.COLOR_ORDER_BGR -> kBGR;
case AddressableLEDJNI.COLOR_ORDER_BRG -> kBRG;
case AddressableLEDJNI.COLOR_ORDER_GRB -> kGRB;
case AddressableLEDJNI.COLOR_ORDER_GBR -> kGBR;
case AddressableLEDJNI.COLOR_ORDER_RGB -> kRGB;
default -> kGRB;
};
}
}
private final int m_pwmHandle;
private final int m_handle;
@@ -42,6 +86,17 @@ public class AddressableLED implements AutoCloseable {
}
}
/**
* Sets the color order for this AddressableLED. The default order is GRB.
*
* <p>This will take effect on the next call to {@link #setData(AddressableLEDBuffer)}.
*
* @param order the color order
*/
public void setColorOrder(ColorOrder order) {
AddressableLEDJNI.setColorOrder(m_handle, order.value);
}
/**
* Sets the length of the LED strip.
*

View File

@@ -178,7 +178,7 @@ public class Joystick extends GenericHID {
/**
* Get the X value of the joystick. This depends on the mapping of the joystick connected to the
* current port.
* current port. On most joysticks, positive is to the right.
*
* @return The X value of the joystick.
*/
@@ -188,7 +188,7 @@ public class Joystick extends GenericHID {
/**
* Get the Y value of the joystick. This depends on the mapping of the joystick connected to the
* current port.
* current port. On most joysticks, positive is to the back.
*
* @return The Y value of the joystick.
*/
@@ -302,8 +302,8 @@ public class Joystick extends GenericHID {
}
/**
* Get the magnitude of the direction vector formed by the joystick's current position relative to
* its origin.
* Get the magnitude of the vector formed by the joystick's current position relative to its
* origin.
*
* @return The magnitude of the direction vector
*/
@@ -312,16 +312,26 @@ public class Joystick extends GenericHID {
}
/**
* Get the direction of the vector formed by the joystick and its origin in radians.
* Get the direction of the vector formed by the joystick and its origin in radians. 0 is forward
* and clockwise is positive. (Straight right is π/2.)
*
* @return The direction of the vector in radians
*/
public double getDirectionRadians() {
// https://docs.wpilib.org/en/stable/docs/software/basic-programming/coordinate-system.html#joystick-and-controller-coordinate-system
// A positive rotation around the X axis moves the joystick right, and a
// positive rotation around the Y axis moves the joystick backward. When
// treating them as translations, 0 radians is measured from the right
// direction, and angle increases clockwise.
//
// It's rotated 90 degrees CCW (y is negated and the arguments are reversed)
// so that 0 radians is forward.
return Math.atan2(getX(), -getY());
}
/**
* Get the direction of the vector formed by the joystick and its origin in degrees.
* Get the direction of the vector formed by the joystick and its origin in degrees. 0 is forward
* and clockwise is positive. (Straight right is 90.)
*
* @return The direction of the vector in degrees
*/

View File

@@ -75,10 +75,10 @@ public class LinearSystemSim<States extends Num, Inputs extends Num, Outputs ext
* @param dt The time between updates in seconds.
*/
public void update(double dt) {
// Update X. By default, this is the linear system dynamics X = Ax + Bu
// Update x. By default, this is the linear system dynamics xₖ₊₁ = Ax + Buₖ.
m_x = updateX(m_x, m_u, dt);
// y = cx + du
// y = Cxₖ + Duₖ
m_y = m_plant.calculateY(m_x, m_u);
// Add measurement noise.
@@ -164,6 +164,11 @@ public class LinearSystemSim<States extends Num, Inputs extends Num, Outputs ext
*/
public void setState(Matrix<States, N1> state) {
m_x = state;
// Update the output to reflect the new state.
//
// yₖ = Cxₖ + Duₖ
m_y = m_plant.calculateY(m_x, m_u);
}
/**

View File

@@ -81,7 +81,18 @@ class AlertTest {
}
@Test
void setUnset() {
void setUnsetSingle() {
try (var one = makeAlert("one", AlertType.kInfo)) {
assertFalse(isAlertActive("one", AlertType.kInfo));
one.set(true);
assertTrue(isAlertActive("one", AlertType.kInfo));
one.set(false);
assertFalse(isAlertActive("one", AlertType.kInfo));
}
}
@Test
void setUnsetMultiple() {
try (var one = makeAlert("one", AlertType.kError);
var two = makeAlert("two", AlertType.kInfo)) {
assertFalse(isAlertActive("one", AlertType.kError));

View File

@@ -63,6 +63,17 @@ class ElevatorSimTest {
}
}
@Test
void testInitialState() {
double startingHeightMeters = 0.5;
var sim =
new ElevatorSim(
DCMotor.getKrakenX60(2), 20, 8.0, 0.1, 0.0, 1.0, true, startingHeightMeters, 0.01, 0.0);
assertEquals(startingHeightMeters, sim.getPosition());
assertEquals(0, sim.getVelocity());
}
@Test
void testMinMax() {
var sim =

View File

@@ -12,28 +12,46 @@ import edu.wpi.first.math.util.Units;
import org.junit.jupiter.api.Test;
class SingleJointedArmSimTest {
SingleJointedArmSim m_sim =
new SingleJointedArmSim(
DCMotor.getVex775Pro(2),
300,
3.0,
Units.inchesToMeters(30.0),
-Math.PI,
0.0,
true,
Math.PI / 2.0);
@Test
void testArmDisabled() {
SingleJointedArmSim sim =
new SingleJointedArmSim(
DCMotor.getVex775Pro(2),
300,
3.0,
Units.inchesToMeters(30.0),
-Math.PI,
0.0,
true,
Math.PI / 2.0);
// Reset Arm angle to 0
m_sim.setState(VecBuilder.fill(0.0, 0.0));
sim.setState(VecBuilder.fill(0.0, 0.0));
for (int i = 0; i < 12 / 0.02; i++) {
m_sim.setInput(0.0);
m_sim.update(0.020);
sim.setInput(0.0);
sim.update(0.020);
}
// the arm should swing down
assertEquals(-Math.PI / 2.0, m_sim.getAngle(), 0.1);
assertEquals(-Math.PI / 2.0, sim.getAngle(), 0.1);
}
@Test
void testInitialState() {
double startingAngleRads = Math.PI / 4.0;
SingleJointedArmSim sim =
new SingleJointedArmSim(
DCMotor.getKrakenX60(2),
125,
3.0,
Units.inchesToMeters(30.0),
0,
Math.PI / 2.0,
true,
startingAngleRads);
assertEquals(startingAngleRads, sim.getAngle());
assertEquals(0, sim.getVelocity());
}
}

View File

@@ -189,6 +189,12 @@ target_include_directories(
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/thirdparty/sleipnir/src>
)
install(
DIRECTORY src/generated/main/native/cpp/
DESTINATION "${include_dest}/wpimath"
FILES_MATCHING
PATTERN "*.h"
)
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/wpimath")
target_include_directories(
wpimath

View File

@@ -16,16 +16,16 @@ import edu.wpi.first.util.struct.StructSerializable;
*/
public class ArmFeedforward implements ProtobufSerializable, StructSerializable {
/** The static gain, in volts. */
private final double ks;
private double ks;
/** The gravity gain, in volts. */
private final double kg;
private double kg;
/** The velocity gain, in V/(rad/s). */
private final double kv;
private double kv;
/** The acceleration gain, in V/(rad/s²). */
private final double ka;
private double ka;
/** The period, in seconds. */
private final double m_dt;
@@ -85,6 +85,42 @@ public class ArmFeedforward implements ProtobufSerializable, StructSerializable
this(ks, kg, kv, 0);
}
/**
* Sets the static gain.
*
* @param ks The static gain in volts.
*/
public void setKs(double ks) {
this.ks = ks;
}
/**
* Sets the gravity gain.
*
* @param kg The gravity gain in volts.
*/
public void setKg(double kg) {
this.kg = kg;
}
/**
* Sets the velocity gain.
*
* @param kv The velocity gain in V/(rad/s).
*/
public void setKv(double kv) {
this.kv = kv;
}
/**
* Sets the acceleration gain.
*
* @param ka The acceleration gain in V/(rad/s²).
*/
public void setKa(double ka) {
this.ka = ka;
}
/**
* Returns the static gain in volts.
*

View File

@@ -15,16 +15,16 @@ import edu.wpi.first.util.struct.StructSerializable;
*/
public class ElevatorFeedforward implements ProtobufSerializable, StructSerializable {
/** The static gain, in volts. */
private final double ks;
private double ks;
/** The gravity gain, in volts. */
private final double kg;
private double kg;
/** The velocity gain, in V/(m/s). */
private final double kv;
private double kv;
/** The acceleration gain, in V/(m/s²). */
private final double ka;
private double ka;
/** The period, in seconds. */
private final double m_dt;
@@ -85,6 +85,42 @@ public class ElevatorFeedforward implements ProtobufSerializable, StructSerializ
this(ks, kg, kv, 0);
}
/**
* Sets the static gain.
*
* @param ks The static gain in volts.
*/
public void setKs(double ks) {
this.ks = ks;
}
/**
* Sets the gravity gain.
*
* @param kg The gravity gain in volts.
*/
public void setKg(double kg) {
this.kg = kg;
}
/**
* Sets the velocity gain.
*
* @param kv The velocity gain in V/(m/s).
*/
public void setKv(double kv) {
this.kv = kv;
}
/**
* Sets the acceleration gain.
*
* @param ka The acceleration gain in V/(m/s²).
*/
public void setKa(double ka) {
this.ka = ka;
}
/**
* Returns the static gain in volts.
*

View File

@@ -12,13 +12,13 @@ import edu.wpi.first.util.struct.StructSerializable;
/** A helper class that computes feedforward outputs for a simple permanent-magnet DC motor. */
public class SimpleMotorFeedforward implements ProtobufSerializable, StructSerializable {
/** The static gain, in volts. */
private final double ks;
private double ks;
/** The velocity gain, in V/(units/s). */
private final double kv;
private double kv;
/** The acceleration gain, in V/(units/s²). */
private final double ka;
private double ka;
/** The period, in seconds. */
private final double m_dt;
@@ -82,6 +82,33 @@ public class SimpleMotorFeedforward implements ProtobufSerializable, StructSeria
this(ks, kv, 0);
}
/**
* Sets the static gain.
*
* @param ks The static gain in volts.
*/
public void setKs(double ks) {
this.ks = ks;
}
/**
* Sets the velocity gain.
*
* @param kv The velocity gain in V/(units/s).
*/
public void setKv(double kv) {
this.kv = kv;
}
/**
* Sets the acceleration gain.
*
* @param ka The acceleration gain in V/(units/s²).
*/
public void setKa(double ka) {
this.ka = ka;
}
/**
* Returns the static gain in volts.
*

View File

@@ -90,7 +90,10 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable {
* along the y-axis, and omega * dt around the z-axis).
*
* <p>This is useful for compensating for translational skew when translating and rotating a
* swerve drivetrain.
* holonomic (swerve or mecanum) drivetrain. However, scaling down the ChassisSpeeds after
* discretizing (e.g., when desaturating swerve module speeds) rotates the direction of net motion
* in the opposite direction of rotational velocity, introducing a different translational skew
* which is not accounted for by discretization.
*
* @param dt The duration of the timestep in seconds the speeds should be applied for.
* @return Discretized ChassisSpeeds.

View File

@@ -257,6 +257,10 @@ public class SwerveDriveKinematics
* reduce all the wheel speeds to make sure that all requested module speeds are at-or-below the
* absolute threshold, while maintaining the ratio of speeds between modules.
*
* <p>Scaling down the module speeds rotates the direction of net motion in the opposite direction
* of rotational velocity, which makes discretizing the chassis speeds inaccurate because the
* discretization did not account for this translational skew.
*
* @param moduleStates Reference to array of module states. The array will be mutated with the
* normalized speeds!
* @param attainableMaxSpeed The absolute max speed in meters per second that a module can reach.
@@ -282,6 +286,10 @@ public class SwerveDriveKinematics
* reduce all the wheel speeds to make sure that all requested module speeds are at-or-below the
* absolute threshold, while maintaining the ratio of speeds between modules.
*
* <p>Scaling down the module speeds rotates the direction of net motion in the opposite direction
* of rotational velocity, which makes discretizing the chassis speeds inaccurate because the
* discretization did not account for this translational skew.
*
* @param moduleStates Reference to array of module states. The array will be mutated with the
* normalized speeds!
* @param attainableMaxSpeed The absolute max speed in meters per second that a module can reach.
@@ -300,6 +308,10 @@ public class SwerveDriveKinematics
* reduce all the wheel speeds to make sure that all requested module speeds are at-or-below the
* absolute threshold, while maintaining the ratio of speeds between modules.
*
* <p>Scaling down the module speeds rotates the direction of net motion in the opposite direction
* of rotational velocity, which makes discretizing the chassis speeds inaccurate because the
* discretization did not account for this translational skew.
*
* @param moduleStates Reference to array of module states. The array will be mutated with the
* normalized speeds!
* @param desiredChassisSpeed The desired speed of the robot
@@ -346,6 +358,10 @@ public class SwerveDriveKinematics
* reduce all the wheel speeds to make sure that all requested module speeds are at-or-below the
* absolute threshold, while maintaining the ratio of speeds between modules.
*
* <p>Scaling down the module speeds rotates the direction of net motion in the opposite direction
* of rotational velocity, which makes discretizing the chassis speeds inaccurate because the
* discretization did not account for this translational skew.
*
* @param moduleStates Reference to array of module states. The array will be mutated with the
* normalized speeds!
* @param desiredChassisSpeed The desired speed of the robot

View File

@@ -20,6 +20,13 @@ units::volt_t ArmFeedforward::Calculate(
units::unit_t<Velocity> nextVelocity) const {
using VarMat = sleipnir::VariableMatrix;
// Small kₐ values make the solver ill-conditioned
if (kA < units::unit_t<ka_unit>{1e-1}) {
auto acceleration = (nextVelocity - currentVelocity) / m_dt;
return kS * wpi::sgn(currentVelocity.value()) + kV * currentVelocity +
kA * acceleration + kG * units::math::cos(currentAngle);
}
// Arm dynamics
Matrixd<2, 2> A{{0.0, 1.0}, {0.0, -kV.value() / kA.value()}};
Matrixd<2, 1> B{{0.0}, {1.0 / kA.value()}};

View File

@@ -4,6 +4,8 @@
#pragma once
#include <cstdlib>
#include <wpi/MathExtras.h>
#include <wpi/SymbolExports.h>
@@ -242,6 +244,34 @@ class WPILIB_DLLEXPORT ArmFeedforward {
return MaxAchievableAcceleration(-maxVoltage, angle, velocity);
}
/**
* Sets the static gain.
*
* @param kS The static gain.
*/
constexpr void SetKs(units::volt_t kS) { this->kS = kS; }
/**
* Sets the gravity gain.
*
* @param kG The gravity gain.
*/
constexpr void SetKg(units::volt_t kG) { this->kG = kG; }
/**
* Sets the velocity gain.
*
* @param kV The velocity gain.
*/
constexpr void SetKv(units::unit_t<kv_unit> kV) { this->kV = kV; }
/**
* Sets the acceleration gain.
*
* @param kA The acceleration gain.
*/
constexpr void SetKa(units::unit_t<ka_unit> kA) { this->kA = kA; }
/**
* Returns the static gain.
*

View File

@@ -216,6 +216,34 @@ class ElevatorFeedforward {
return MaxAchievableAcceleration(-maxVoltage, velocity);
}
/**
* Sets the static gain.
*
* @param kS The static gain.
*/
constexpr void SetKs(units::volt_t kS) { this->kS = kS; }
/**
* Sets the gravity gain.
*
* @param kG The gravity gain.
*/
constexpr void SetKg(units::volt_t kG) { this->kG = kG; }
/**
* Sets the velocity gain.
*
* @param kV The velocity gain.
*/
constexpr void SetKv(units::unit_t<kv_unit> kV) { this->kV = kV; }
/**
* Sets the acceleration gain.
*
* @param kA The acceleration gain.
*/
constexpr void SetKa(units::unit_t<ka_unit> kA) { this->kA = kA; }
/**
* Returns the static gain.
*

View File

@@ -178,6 +178,27 @@ class SimpleMotorFeedforward {
return MaxAchievableAcceleration(-maxVoltage, velocity);
}
/**
* Sets the static gain.
*
* @param kS The static gain.
*/
constexpr void SetKs(units::volt_t kS) { this->kS = kS; }
/**
* Sets the velocity gain.
*
* @param kV The velocity gain.
*/
constexpr void SetKv(units::unit_t<kv_unit> kV) { this->kV = kV; }
/**
* Sets the acceleration gain.
*
* @param kA The acceleration gain.
*/
constexpr void SetKa(units::unit_t<ka_unit> kA) { this->kA = kA; }
/**
* Returns the static gain.
*

View File

@@ -59,7 +59,11 @@ struct WPILIB_DLLEXPORT ChassisSpeeds {
* y-axis, and omega * dt around the z-axis).
*
* This is useful for compensating for translational skew when translating and
* rotating a swerve drivetrain.
* rotating a holonomic (swerve or mecanum) drivetrain. However, scaling down
* the ChassisSpeeds after discretizing (e.g., when desaturating swerve module
* speeds) rotates the direction of net motion in the opposite direction of
* rotational velocity, introducing a different translational skew which is
* not accounted for by discretization.
*
* @param dt The duration of the timestep the speeds should be applied for.
* @return Discretized ChassisSpeeds.

View File

@@ -333,6 +333,11 @@ class SwerveDriveKinematics
* the absolute threshold, while maintaining the ratio of speeds between
* modules.
*
* Scaling down the module speeds rotates the direction of net motion in the
* opposite direction of rotational velocity, which makes discretizing the
* chassis speeds inaccurate because the discretization did not account for
* this translational skew.
*
* @param moduleStates Reference to array of module states. The array will be
* mutated with the normalized speeds!
* @param attainableMaxSpeed The absolute max speed that a module can reach.
@@ -368,6 +373,11 @@ class SwerveDriveKinematics
* the absolute threshold, while maintaining the ratio of speeds between
* modules.
*
* Scaling down the module speeds rotates the direction of net motion in the
* opposite direction of rotational velocity, which makes discretizing the
* chassis speeds inaccurate because the discretization did not account for
* this translational skew.
*
* @param moduleStates Reference to array of module states. The array will be
* mutated with the normalized speeds!
* @param desiredChassisSpeed The desired speed of the robot

View File

@@ -1759,7 +1759,7 @@ namespace units
namespace traits
{
#ifdef FOR_DOXYGEN_PURPOSOES_ONLY
#ifdef FOR_DOXYGEN_PURPOSES_ONLY
/**
* @ingroup TypeTraits
* @brief Trait for accessing the publicly defined types of `units::unit_t`

View File

@@ -123,6 +123,10 @@ cc_library(
] + ["native-srcs"],
hdrs = glob(["src/main/native/include/**/*"]),
includes = ["src/main/native/include"],
linkopts = select({
"@bazel_tools//src/conditions:linux": ["-ldl"],
"//conditions:default": [],
}),
strip_include_prefix = "src/main/native/include",
visibility = ["//visibility:public"],
deps = [

View File

@@ -270,6 +270,7 @@ void MyHttpConnection::ProcessRequest() {
}
// generate directory listing
wpi::SmallString<64> formatBuf;
fs::path indexpath = fs::path{fullpath} / "index.html";
if (qmap.Get("format", formatBuf).value_or("") == "json") {
wpi::json dirs = wpi::json::array();
wpi::json files = wpi::json::array();
@@ -288,6 +289,9 @@ void MyHttpConnection::ProcessRequest() {
200, "OK", "text/json",
wpi::json{{"dirs", std::move(dirs)}, {"files", std::move(files)}}
.dump());
} else if (fs::exists(indexpath)) {
SendFileResponse(200, "OK", GetMimeType("html"), indexpath,
"Content-Disposition: filename=\"index.html\"\r\n");
} else {
wpi::StringMap<std::string> dirs;
wpi::StringMap<std::string> files;

View File

@@ -86,11 +86,6 @@ public interface {{ helpers['type_decl'](name) }} extends Measure<{{ helpers['mt
default {{ helpers['type_usage'](name) }} divide(double divisor) {
return ({{ helpers['type_usage'](name) }}) div(divisor);
}
@Override
default {{ config[name]['divide']['Time'] or "Velocity<{}>".format(helpers['mtou'](name)) }} per(TimeUnit period) {
return div(period.of(1));
}
{% for unit in math_units -%}
{% if unit == "Dimensionless" %}
@Override
@@ -147,6 +142,15 @@ public interface {{ helpers['type_decl'](name) }} extends Measure<{{ helpers['mt
default {{ config[name]['divide'][unit] }} divide({{ unit }} divisor) {
return div(divisor);
}
@Override
default {{ config[name]['divide'][unit] }} per({{ helpers['mtou'](unit) }} divisorUnit) {
{%- if unit == "Mult<?, ?>" or unit == "Per<?, ?>" %}
return div(divisorUnit.ofNative(1));
{%- else %}
return div(divisorUnit.one());
{%- endif %}
}
{% elif unit == "Time" %}
@Override
default Velocity<{{ helpers['mtou'](name) }}> div({{ unit }} divisor) {
@@ -164,6 +168,15 @@ public interface {{ helpers['type_decl'](name) }} extends Measure<{{ helpers['mt
default Velocity<{{ helpers['mtou'](name) }}> divide({{ unit }} divisor) {
return div(divisor);
}
@Override
default Velocity<{{ helpers['mtou'](name) }}> per({{ helpers['mtou'](unit) }} divisorUnit) {
{%- if unit == "Mult<?, ?>" or unit == "Per<?, ?>" %}
return div(divisorUnit.ofNative(1));
{%- else %}
return div(divisorUnit.one());
{%- endif %}
}
{% elif unit == name %}
@Override
default Dimensionless div({{ unit }} divisor) {
@@ -181,6 +194,11 @@ public interface {{ helpers['type_decl'](name) }} extends Measure<{{ helpers['mt
default Dimensionless divide({{ unit }} divisor) {
return div(divisor);
}
@Override
default Dimensionless per({{ helpers['mtou'](unit) }} divisorUnit) {
return div(divisorUnit.one());
}
{% else %}
@Override
default Per<{{ helpers['mtou'](name) }}, {{ helpers['mtou'](unit) }}> div({{ unit }} divisor) {
@@ -198,6 +216,15 @@ public interface {{ helpers['type_decl'](name) }} extends Measure<{{ helpers['mt
default Per<{{ helpers['mtou'](name) }}, {{ helpers['mtou'](unit) }}> divide({{ unit }} divisor) {
return div(divisor);
}
@Override
default Per<{{ helpers['mtou'](name) }}, {{ helpers['mtou'](unit) }}> per({{ helpers['mtou'](unit) }} divisorUnit) {
{%- if unit == "Mult<?, ?>" or unit == "Per<?, ?>" %}
return div(divisorUnit.ofNative(1));
{%- else %}
return div(divisorUnit.one());
{%- endif %}
}
{% endif -%}
{% endif -%}
{% endfor -%}

View File

@@ -87,11 +87,6 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return (Acceleration<D>) div(divisor);
}
@Override
default Velocity<AccelerationUnit<D>> per(TimeUnit period) {
return div(period.of(1));
}
@Override
default Mult<AccelerationUnit<D>, AccelerationUnit<?>> times(Acceleration<?> multiplier) {
@@ -115,6 +110,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, AccelerationUnit<?>> per(AccelerationUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, AngleUnit> times(Angle multiplier) {
@@ -138,6 +138,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, AngleUnit> per(AngleUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, AngularAccelerationUnit> times(AngularAcceleration multiplier) {
@@ -161,6 +166,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, AngularAccelerationUnit> per(AngularAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, AngularMomentumUnit> times(AngularMomentum multiplier) {
@@ -184,6 +194,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, AngularMomentumUnit> per(AngularMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, AngularVelocityUnit> times(AngularVelocity multiplier) {
@@ -207,6 +222,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, AngularVelocityUnit> per(AngularVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, CurrentUnit> times(Current multiplier) {
@@ -230,6 +250,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, CurrentUnit> per(CurrentUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Acceleration<D> div(Dimensionless divisor) {
return (Acceleration<D>) unit().of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
@@ -275,6 +300,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, DistanceUnit> per(DistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, EnergyUnit> times(Energy multiplier) {
@@ -298,6 +328,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, EnergyUnit> per(EnergyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, ForceUnit> times(Force multiplier) {
@@ -321,6 +356,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, ForceUnit> per(ForceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, FrequencyUnit> times(Frequency multiplier) {
@@ -344,6 +384,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, FrequencyUnit> per(FrequencyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, LinearAccelerationUnit> times(LinearAcceleration multiplier) {
@@ -367,6 +412,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, LinearAccelerationUnit> per(LinearAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, LinearMomentumUnit> times(LinearMomentum multiplier) {
@@ -390,6 +440,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, LinearMomentumUnit> per(LinearMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, LinearVelocityUnit> times(LinearVelocity multiplier) {
@@ -413,6 +468,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, LinearVelocityUnit> per(LinearVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, MassUnit> times(Mass multiplier) {
@@ -436,6 +496,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, MassUnit> per(MassUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, MomentOfInertiaUnit> times(MomentOfInertia multiplier) {
@@ -459,6 +524,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, MomentOfInertiaUnit> per(MomentOfInertiaUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, MultUnit<?, ?>> times(Mult<?, ?> multiplier) {
@@ -482,6 +552,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, MultUnit<?, ?>> per(MultUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<AccelerationUnit<D>, PerUnit<?, ?>> times(Per<?, ?> multiplier) {
@@ -505,6 +580,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, PerUnit<?, ?>> per(PerUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<AccelerationUnit<D>, PowerUnit> times(Power multiplier) {
@@ -528,6 +608,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, PowerUnit> per(PowerUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, ResistanceUnit> times(Resistance multiplier) {
@@ -551,6 +636,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, ResistanceUnit> per(ResistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, TemperatureUnit> times(Temperature multiplier) {
@@ -574,6 +664,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, TemperatureUnit> per(TemperatureUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, TimeUnit> times(Time multiplier) {
@@ -597,6 +692,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Velocity<AccelerationUnit<D>> per(TimeUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, TorqueUnit> times(Torque multiplier) {
@@ -620,6 +720,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, TorqueUnit> per(TorqueUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, VelocityUnit<?>> times(Velocity<?> multiplier) {
@@ -643,6 +748,11 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, VelocityUnit<?>> per(VelocityUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AccelerationUnit<D>, VoltageUnit> times(Voltage multiplier) {
@@ -666,4 +776,9 @@ public interface Acceleration<D extends Unit> extends Measure<AccelerationUnit<D
return div(divisor);
}
@Override
default Per<AccelerationUnit<D>, VoltageUnit> per(VoltageUnit divisorUnit) {
return div(divisorUnit.one());
}
}

View File

@@ -87,11 +87,6 @@ public interface Angle extends Measure<AngleUnit> {
return (Angle) div(divisor);
}
@Override
default AngularVelocity per(TimeUnit period) {
return div(period.of(1));
}
@Override
default Mult<AngleUnit, AccelerationUnit<?>> times(Acceleration<?> multiplier) {
@@ -115,6 +110,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, AccelerationUnit<?>> per(AccelerationUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, AngleUnit> times(Angle multiplier) {
@@ -138,6 +138,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Dimensionless per(AngleUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, AngularAccelerationUnit> times(AngularAcceleration multiplier) {
@@ -161,6 +166,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, AngularAccelerationUnit> per(AngularAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, AngularMomentumUnit> times(AngularMomentum multiplier) {
@@ -184,6 +194,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, AngularMomentumUnit> per(AngularMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, AngularVelocityUnit> times(AngularVelocity multiplier) {
@@ -207,6 +222,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, AngularVelocityUnit> per(AngularVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, CurrentUnit> times(Current multiplier) {
@@ -230,6 +250,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, CurrentUnit> per(CurrentUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Angle div(Dimensionless divisor) {
return (Angle) Radians.of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
@@ -275,6 +300,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, DistanceUnit> per(DistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, EnergyUnit> times(Energy multiplier) {
@@ -298,6 +328,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, EnergyUnit> per(EnergyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, ForceUnit> times(Force multiplier) {
@@ -321,6 +356,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, ForceUnit> per(ForceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default AngularVelocity times(Frequency multiplier) {
@@ -344,6 +384,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, FrequencyUnit> per(FrequencyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, LinearAccelerationUnit> times(LinearAcceleration multiplier) {
@@ -367,6 +412,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, LinearAccelerationUnit> per(LinearAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, LinearMomentumUnit> times(LinearMomentum multiplier) {
@@ -390,6 +440,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, LinearMomentumUnit> per(LinearMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, LinearVelocityUnit> times(LinearVelocity multiplier) {
@@ -413,6 +468,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, LinearVelocityUnit> per(LinearVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, MassUnit> times(Mass multiplier) {
@@ -436,6 +496,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, MassUnit> per(MassUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, MomentOfInertiaUnit> times(MomentOfInertia multiplier) {
@@ -459,6 +524,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, MomentOfInertiaUnit> per(MomentOfInertiaUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, MultUnit<?, ?>> times(Mult<?, ?> multiplier) {
@@ -482,6 +552,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, MultUnit<?, ?>> per(MultUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<AngleUnit, PerUnit<?, ?>> times(Per<?, ?> multiplier) {
@@ -505,6 +580,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, PerUnit<?, ?>> per(PerUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<AngleUnit, PowerUnit> times(Power multiplier) {
@@ -528,6 +608,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, PowerUnit> per(PowerUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, ResistanceUnit> times(Resistance multiplier) {
@@ -551,6 +636,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, ResistanceUnit> per(ResistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, TemperatureUnit> times(Temperature multiplier) {
@@ -574,6 +664,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, TemperatureUnit> per(TemperatureUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, TimeUnit> times(Time multiplier) {
@@ -597,6 +692,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default AngularVelocity per(TimeUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, TorqueUnit> times(Torque multiplier) {
@@ -620,6 +720,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, TorqueUnit> per(TorqueUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, VelocityUnit<?>> times(Velocity<?> multiplier) {
@@ -643,6 +748,11 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, VelocityUnit<?>> per(VelocityUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngleUnit, VoltageUnit> times(Voltage multiplier) {
@@ -666,4 +776,9 @@ public interface Angle extends Measure<AngleUnit> {
return div(divisor);
}
@Override
default Per<AngleUnit, VoltageUnit> per(VoltageUnit divisorUnit) {
return div(divisorUnit.one());
}
}

View File

@@ -87,11 +87,6 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return (AngularAcceleration) div(divisor);
}
@Override
default Velocity<AngularAccelerationUnit> per(TimeUnit period) {
return div(period.of(1));
}
@Override
default Mult<AngularAccelerationUnit, AccelerationUnit<?>> times(Acceleration<?> multiplier) {
@@ -115,6 +110,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, AccelerationUnit<?>> per(AccelerationUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, AngleUnit> times(Angle multiplier) {
@@ -138,6 +138,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, AngleUnit> per(AngleUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, AngularAccelerationUnit> times(AngularAcceleration multiplier) {
@@ -161,6 +166,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Dimensionless per(AngularAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, AngularMomentumUnit> times(AngularMomentum multiplier) {
@@ -184,6 +194,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, AngularMomentumUnit> per(AngularMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, AngularVelocityUnit> times(AngularVelocity multiplier) {
@@ -207,6 +222,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, AngularVelocityUnit> per(AngularVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, CurrentUnit> times(Current multiplier) {
@@ -230,6 +250,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, CurrentUnit> per(CurrentUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default AngularAcceleration div(Dimensionless divisor) {
return (AngularAcceleration) RadiansPerSecondPerSecond.of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
@@ -275,6 +300,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, DistanceUnit> per(DistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, EnergyUnit> times(Energy multiplier) {
@@ -298,6 +328,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, EnergyUnit> per(EnergyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, ForceUnit> times(Force multiplier) {
@@ -321,6 +356,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, ForceUnit> per(ForceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, FrequencyUnit> times(Frequency multiplier) {
@@ -344,6 +384,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default AngularVelocity per(FrequencyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, LinearAccelerationUnit> times(LinearAcceleration multiplier) {
@@ -367,6 +412,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, LinearAccelerationUnit> per(LinearAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, LinearMomentumUnit> times(LinearMomentum multiplier) {
@@ -390,6 +440,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, LinearMomentumUnit> per(LinearMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, LinearVelocityUnit> times(LinearVelocity multiplier) {
@@ -413,6 +468,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, LinearVelocityUnit> per(LinearVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, MassUnit> times(Mass multiplier) {
@@ -436,6 +496,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, MassUnit> per(MassUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, MomentOfInertiaUnit> times(MomentOfInertia multiplier) {
@@ -459,6 +524,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, MomentOfInertiaUnit> per(MomentOfInertiaUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, MultUnit<?, ?>> times(Mult<?, ?> multiplier) {
@@ -482,6 +552,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, MultUnit<?, ?>> per(MultUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<AngularAccelerationUnit, PerUnit<?, ?>> times(Per<?, ?> multiplier) {
@@ -505,6 +580,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, PerUnit<?, ?>> per(PerUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<AngularAccelerationUnit, PowerUnit> times(Power multiplier) {
@@ -528,6 +608,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, PowerUnit> per(PowerUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, ResistanceUnit> times(Resistance multiplier) {
@@ -551,6 +636,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, ResistanceUnit> per(ResistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, TemperatureUnit> times(Temperature multiplier) {
@@ -574,6 +664,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, TemperatureUnit> per(TemperatureUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default AngularVelocity times(Time multiplier) {
@@ -597,6 +692,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Velocity<AngularAccelerationUnit> per(TimeUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, TorqueUnit> times(Torque multiplier) {
@@ -620,6 +720,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, TorqueUnit> per(TorqueUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, VelocityUnit<?>> times(Velocity<?> multiplier) {
@@ -643,6 +748,11 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, VelocityUnit<?>> per(VelocityUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularAccelerationUnit, VoltageUnit> times(Voltage multiplier) {
@@ -666,4 +776,9 @@ public interface AngularAcceleration extends Measure<AngularAccelerationUnit> {
return div(divisor);
}
@Override
default Per<AngularAccelerationUnit, VoltageUnit> per(VoltageUnit divisorUnit) {
return div(divisorUnit.one());
}
}

View File

@@ -87,11 +87,6 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return (AngularMomentum) div(divisor);
}
@Override
default Velocity<AngularMomentumUnit> per(TimeUnit period) {
return div(period.of(1));
}
@Override
default Mult<AngularMomentumUnit, AccelerationUnit<?>> times(Acceleration<?> multiplier) {
@@ -115,6 +110,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, AccelerationUnit<?>> per(AccelerationUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, AngleUnit> times(Angle multiplier) {
@@ -138,6 +138,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, AngleUnit> per(AngleUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, AngularAccelerationUnit> times(AngularAcceleration multiplier) {
@@ -161,6 +166,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, AngularAccelerationUnit> per(AngularAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, AngularMomentumUnit> times(AngularMomentum multiplier) {
@@ -184,6 +194,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Dimensionless per(AngularMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, AngularVelocityUnit> times(AngularVelocity multiplier) {
@@ -207,6 +222,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default MomentOfInertia per(AngularVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, CurrentUnit> times(Current multiplier) {
@@ -230,6 +250,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, CurrentUnit> per(CurrentUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default AngularMomentum div(Dimensionless divisor) {
return (AngularMomentum) KilogramMetersSquaredPerSecond.of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
@@ -275,6 +300,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, DistanceUnit> per(DistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, EnergyUnit> times(Energy multiplier) {
@@ -298,6 +328,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, EnergyUnit> per(EnergyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, ForceUnit> times(Force multiplier) {
@@ -321,6 +356,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, ForceUnit> per(ForceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, FrequencyUnit> times(Frequency multiplier) {
@@ -344,6 +384,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, FrequencyUnit> per(FrequencyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, LinearAccelerationUnit> times(LinearAcceleration multiplier) {
@@ -367,6 +412,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, LinearAccelerationUnit> per(LinearAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, LinearMomentumUnit> times(LinearMomentum multiplier) {
@@ -390,6 +440,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, LinearMomentumUnit> per(LinearMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, LinearVelocityUnit> times(LinearVelocity multiplier) {
@@ -413,6 +468,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, LinearVelocityUnit> per(LinearVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, MassUnit> times(Mass multiplier) {
@@ -436,6 +496,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, MassUnit> per(MassUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, MomentOfInertiaUnit> times(MomentOfInertia multiplier) {
@@ -459,6 +524,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, MomentOfInertiaUnit> per(MomentOfInertiaUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, MultUnit<?, ?>> times(Mult<?, ?> multiplier) {
@@ -482,6 +552,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, MultUnit<?, ?>> per(MultUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<AngularMomentumUnit, PerUnit<?, ?>> times(Per<?, ?> multiplier) {
@@ -505,6 +580,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, PerUnit<?, ?>> per(PerUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<AngularMomentumUnit, PowerUnit> times(Power multiplier) {
@@ -528,6 +608,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, PowerUnit> per(PowerUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, ResistanceUnit> times(Resistance multiplier) {
@@ -551,6 +636,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, ResistanceUnit> per(ResistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, TemperatureUnit> times(Temperature multiplier) {
@@ -574,6 +664,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, TemperatureUnit> per(TemperatureUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, TimeUnit> times(Time multiplier) {
@@ -597,6 +692,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Velocity<AngularMomentumUnit> per(TimeUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, TorqueUnit> times(Torque multiplier) {
@@ -620,6 +720,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, TorqueUnit> per(TorqueUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, VelocityUnit<?>> times(Velocity<?> multiplier) {
@@ -643,6 +748,11 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, VelocityUnit<?>> per(VelocityUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularMomentumUnit, VoltageUnit> times(Voltage multiplier) {
@@ -666,4 +776,9 @@ public interface AngularMomentum extends Measure<AngularMomentumUnit> {
return div(divisor);
}
@Override
default Per<AngularMomentumUnit, VoltageUnit> per(VoltageUnit divisorUnit) {
return div(divisorUnit.one());
}
}

View File

@@ -87,11 +87,6 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return (AngularVelocity) div(divisor);
}
@Override
default AngularAcceleration per(TimeUnit period) {
return div(period.of(1));
}
@Override
default Mult<AngularVelocityUnit, AccelerationUnit<?>> times(Acceleration<?> multiplier) {
@@ -115,6 +110,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, AccelerationUnit<?>> per(AccelerationUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, AngleUnit> times(Angle multiplier) {
@@ -138,6 +138,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, AngleUnit> per(AngleUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, AngularAccelerationUnit> times(AngularAcceleration multiplier) {
@@ -161,6 +166,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, AngularAccelerationUnit> per(AngularAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, AngularMomentumUnit> times(AngularMomentum multiplier) {
@@ -184,6 +194,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, AngularMomentumUnit> per(AngularMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, AngularVelocityUnit> times(AngularVelocity multiplier) {
@@ -207,6 +222,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Dimensionless per(AngularVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, CurrentUnit> times(Current multiplier) {
@@ -230,6 +250,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, CurrentUnit> per(CurrentUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default AngularVelocity div(Dimensionless divisor) {
return (AngularVelocity) RadiansPerSecond.of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
@@ -275,6 +300,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, DistanceUnit> per(DistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, EnergyUnit> times(Energy multiplier) {
@@ -298,6 +328,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, EnergyUnit> per(EnergyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, ForceUnit> times(Force multiplier) {
@@ -321,6 +356,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, ForceUnit> per(ForceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default AngularAcceleration times(Frequency multiplier) {
@@ -344,6 +384,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, FrequencyUnit> per(FrequencyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, LinearAccelerationUnit> times(LinearAcceleration multiplier) {
@@ -367,6 +412,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, LinearAccelerationUnit> per(LinearAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, LinearMomentumUnit> times(LinearMomentum multiplier) {
@@ -390,6 +440,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, LinearMomentumUnit> per(LinearMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, LinearVelocityUnit> times(LinearVelocity multiplier) {
@@ -413,6 +468,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, LinearVelocityUnit> per(LinearVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, MassUnit> times(Mass multiplier) {
@@ -436,6 +496,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, MassUnit> per(MassUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, MomentOfInertiaUnit> times(MomentOfInertia multiplier) {
@@ -459,6 +524,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, MomentOfInertiaUnit> per(MomentOfInertiaUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, MultUnit<?, ?>> times(Mult<?, ?> multiplier) {
@@ -482,6 +552,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, MultUnit<?, ?>> per(MultUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<AngularVelocityUnit, PerUnit<?, ?>> times(Per<?, ?> multiplier) {
@@ -505,6 +580,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, PerUnit<?, ?>> per(PerUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<AngularVelocityUnit, PowerUnit> times(Power multiplier) {
@@ -528,6 +608,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, PowerUnit> per(PowerUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, ResistanceUnit> times(Resistance multiplier) {
@@ -551,6 +636,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, ResistanceUnit> per(ResistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, TemperatureUnit> times(Temperature multiplier) {
@@ -574,6 +664,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, TemperatureUnit> per(TemperatureUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Angle times(Time multiplier) {
@@ -597,6 +692,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default AngularAcceleration per(TimeUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, TorqueUnit> times(Torque multiplier) {
@@ -620,6 +720,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, TorqueUnit> per(TorqueUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, VelocityUnit<?>> times(Velocity<?> multiplier) {
@@ -643,6 +748,11 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, VelocityUnit<?>> per(VelocityUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<AngularVelocityUnit, VoltageUnit> times(Voltage multiplier) {
@@ -665,5 +775,10 @@ public interface AngularVelocity extends Measure<AngularVelocityUnit> {
default Per<AngularVelocityUnit, VoltageUnit> divide(Voltage divisor) {
return div(divisor);
}
@Override
default Per<AngularVelocityUnit, VoltageUnit> per(VoltageUnit divisorUnit) {
return div(divisorUnit.one());
}
default Frequency asFrequency() { return Hertz.of(baseUnitMagnitude()); }
}

View File

@@ -87,11 +87,6 @@ public interface Current extends Measure<CurrentUnit> {
return (Current) div(divisor);
}
@Override
default Velocity<CurrentUnit> per(TimeUnit period) {
return div(period.of(1));
}
@Override
default Mult<CurrentUnit, AccelerationUnit<?>> times(Acceleration<?> multiplier) {
@@ -115,6 +110,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, AccelerationUnit<?>> per(AccelerationUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, AngleUnit> times(Angle multiplier) {
@@ -138,6 +138,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, AngleUnit> per(AngleUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, AngularAccelerationUnit> times(AngularAcceleration multiplier) {
@@ -161,6 +166,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, AngularAccelerationUnit> per(AngularAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, AngularMomentumUnit> times(AngularMomentum multiplier) {
@@ -184,6 +194,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, AngularMomentumUnit> per(AngularMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, AngularVelocityUnit> times(AngularVelocity multiplier) {
@@ -207,6 +222,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, AngularVelocityUnit> per(AngularVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, CurrentUnit> times(Current multiplier) {
@@ -230,6 +250,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Dimensionless per(CurrentUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Current div(Dimensionless divisor) {
return (Current) Amps.of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
@@ -275,6 +300,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, DistanceUnit> per(DistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, EnergyUnit> times(Energy multiplier) {
@@ -298,6 +328,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, EnergyUnit> per(EnergyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, ForceUnit> times(Force multiplier) {
@@ -321,6 +356,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, ForceUnit> per(ForceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, FrequencyUnit> times(Frequency multiplier) {
@@ -344,6 +384,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, FrequencyUnit> per(FrequencyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, LinearAccelerationUnit> times(LinearAcceleration multiplier) {
@@ -367,6 +412,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, LinearAccelerationUnit> per(LinearAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, LinearMomentumUnit> times(LinearMomentum multiplier) {
@@ -390,6 +440,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, LinearMomentumUnit> per(LinearMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, LinearVelocityUnit> times(LinearVelocity multiplier) {
@@ -413,6 +468,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, LinearVelocityUnit> per(LinearVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, MassUnit> times(Mass multiplier) {
@@ -436,6 +496,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, MassUnit> per(MassUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, MomentOfInertiaUnit> times(MomentOfInertia multiplier) {
@@ -459,6 +524,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, MomentOfInertiaUnit> per(MomentOfInertiaUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, MultUnit<?, ?>> times(Mult<?, ?> multiplier) {
@@ -482,6 +552,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, MultUnit<?, ?>> per(MultUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<CurrentUnit, PerUnit<?, ?>> times(Per<?, ?> multiplier) {
@@ -505,6 +580,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, PerUnit<?, ?>> per(PerUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<CurrentUnit, PowerUnit> times(Power multiplier) {
@@ -528,6 +608,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, PowerUnit> per(PowerUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Voltage times(Resistance multiplier) {
@@ -551,6 +636,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, ResistanceUnit> per(ResistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, TemperatureUnit> times(Temperature multiplier) {
@@ -574,6 +664,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, TemperatureUnit> per(TemperatureUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, TimeUnit> times(Time multiplier) {
@@ -597,6 +692,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Velocity<CurrentUnit> per(TimeUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, TorqueUnit> times(Torque multiplier) {
@@ -620,6 +720,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, TorqueUnit> per(TorqueUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<CurrentUnit, VelocityUnit<?>> times(Velocity<?> multiplier) {
@@ -643,6 +748,11 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, VelocityUnit<?>> per(VelocityUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Power times(Voltage multiplier) {
@@ -666,4 +776,9 @@ public interface Current extends Measure<CurrentUnit> {
return div(divisor);
}
@Override
default Per<CurrentUnit, VoltageUnit> per(VoltageUnit divisorUnit) {
return div(divisorUnit.one());
}
}

View File

@@ -87,11 +87,6 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return (Dimensionless) div(divisor);
}
@Override
default Frequency per(TimeUnit period) {
return div(period.of(1));
}
@Override
default Mult<DimensionlessUnit, AccelerationUnit<?>> times(Acceleration<?> multiplier) {
@@ -115,6 +110,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, AccelerationUnit<?>> per(AccelerationUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Angle times(Angle multiplier) {
@@ -138,6 +138,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, AngleUnit> per(AngleUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default AngularAcceleration times(AngularAcceleration multiplier) {
@@ -161,6 +166,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, AngularAccelerationUnit> per(AngularAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default AngularMomentum times(AngularMomentum multiplier) {
@@ -184,6 +194,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, AngularMomentumUnit> per(AngularMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default AngularVelocity times(AngularVelocity multiplier) {
@@ -207,6 +222,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, AngularVelocityUnit> per(AngularVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Current times(Current multiplier) {
@@ -230,6 +250,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, CurrentUnit> per(CurrentUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Dimensionless div(Dimensionless divisor) {
return (Dimensionless) Value.of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
@@ -275,6 +300,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, DistanceUnit> per(DistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Energy times(Energy multiplier) {
@@ -298,6 +328,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, EnergyUnit> per(EnergyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Force times(Force multiplier) {
@@ -321,6 +356,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, ForceUnit> per(ForceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Frequency times(Frequency multiplier) {
@@ -344,6 +384,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, FrequencyUnit> per(FrequencyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default LinearAcceleration times(LinearAcceleration multiplier) {
@@ -367,6 +412,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, LinearAccelerationUnit> per(LinearAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default LinearMomentum times(LinearMomentum multiplier) {
@@ -390,6 +440,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, LinearMomentumUnit> per(LinearMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default LinearVelocity times(LinearVelocity multiplier) {
@@ -413,6 +468,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, LinearVelocityUnit> per(LinearVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mass times(Mass multiplier) {
@@ -436,6 +496,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, MassUnit> per(MassUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default MomentOfInertia times(MomentOfInertia multiplier) {
@@ -459,6 +524,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, MomentOfInertiaUnit> per(MomentOfInertiaUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DimensionlessUnit, MultUnit<?, ?>> times(Mult<?, ?> multiplier) {
@@ -482,6 +552,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, MultUnit<?, ?>> per(MultUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<DimensionlessUnit, PerUnit<?, ?>> times(Per<?, ?> multiplier) {
@@ -505,6 +580,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, PerUnit<?, ?>> per(PerUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Power times(Power multiplier) {
@@ -528,6 +608,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, PowerUnit> per(PowerUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Resistance times(Resistance multiplier) {
@@ -551,6 +636,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, ResistanceUnit> per(ResistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Temperature times(Temperature multiplier) {
@@ -574,6 +664,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, TemperatureUnit> per(TemperatureUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Time times(Time multiplier) {
@@ -597,6 +692,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Frequency per(TimeUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Torque times(Torque multiplier) {
@@ -620,6 +720,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, TorqueUnit> per(TorqueUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DimensionlessUnit, VelocityUnit<?>> times(Velocity<?> multiplier) {
@@ -643,6 +748,11 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, VelocityUnit<?>> per(VelocityUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Voltage times(Voltage multiplier) {
@@ -666,4 +776,9 @@ public interface Dimensionless extends Measure<DimensionlessUnit> {
return div(divisor);
}
@Override
default Per<DimensionlessUnit, VoltageUnit> per(VoltageUnit divisorUnit) {
return div(divisorUnit.one());
}
}

View File

@@ -87,11 +87,6 @@ public interface Distance extends Measure<DistanceUnit> {
return (Distance) div(divisor);
}
@Override
default LinearVelocity per(TimeUnit period) {
return div(period.of(1));
}
@Override
default Mult<DistanceUnit, AccelerationUnit<?>> times(Acceleration<?> multiplier) {
@@ -115,6 +110,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, AccelerationUnit<?>> per(AccelerationUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, AngleUnit> times(Angle multiplier) {
@@ -138,6 +138,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, AngleUnit> per(AngleUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, AngularAccelerationUnit> times(AngularAcceleration multiplier) {
@@ -161,6 +166,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, AngularAccelerationUnit> per(AngularAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, AngularMomentumUnit> times(AngularMomentum multiplier) {
@@ -184,6 +194,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, AngularMomentumUnit> per(AngularMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, AngularVelocityUnit> times(AngularVelocity multiplier) {
@@ -207,6 +222,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, AngularVelocityUnit> per(AngularVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, CurrentUnit> times(Current multiplier) {
@@ -230,6 +250,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, CurrentUnit> per(CurrentUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Distance div(Dimensionless divisor) {
return (Distance) Meters.of(baseUnitMagnitude() / divisor.baseUnitMagnitude());
@@ -275,6 +300,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Dimensionless per(DistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, EnergyUnit> times(Energy multiplier) {
@@ -298,6 +328,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, EnergyUnit> per(EnergyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Torque times(Force multiplier) {
@@ -321,6 +356,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, ForceUnit> per(ForceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default LinearVelocity times(Frequency multiplier) {
@@ -344,6 +384,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, FrequencyUnit> per(FrequencyUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, LinearAccelerationUnit> times(LinearAcceleration multiplier) {
@@ -367,6 +412,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, LinearAccelerationUnit> per(LinearAccelerationUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, LinearMomentumUnit> times(LinearMomentum multiplier) {
@@ -390,6 +440,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, LinearMomentumUnit> per(LinearMomentumUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, LinearVelocityUnit> times(LinearVelocity multiplier) {
@@ -413,6 +468,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Time per(LinearVelocityUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, MassUnit> times(Mass multiplier) {
@@ -436,6 +496,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, MassUnit> per(MassUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, MomentOfInertiaUnit> times(MomentOfInertia multiplier) {
@@ -459,6 +524,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, MomentOfInertiaUnit> per(MomentOfInertiaUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, MultUnit<?, ?>> times(Mult<?, ?> multiplier) {
@@ -482,6 +552,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, MultUnit<?, ?>> per(MultUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<DistanceUnit, PerUnit<?, ?>> times(Per<?, ?> multiplier) {
@@ -505,6 +580,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, PerUnit<?, ?>> per(PerUnit<?, ?> divisorUnit) {
return div(divisorUnit.ofNative(1));
}
@Override
default Mult<DistanceUnit, PowerUnit> times(Power multiplier) {
@@ -528,6 +608,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, PowerUnit> per(PowerUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, ResistanceUnit> times(Resistance multiplier) {
@@ -551,6 +636,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, ResistanceUnit> per(ResistanceUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, TemperatureUnit> times(Temperature multiplier) {
@@ -574,6 +664,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, TemperatureUnit> per(TemperatureUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, TimeUnit> times(Time multiplier) {
@@ -597,6 +692,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default LinearVelocity per(TimeUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, TorqueUnit> times(Torque multiplier) {
@@ -620,6 +720,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, TorqueUnit> per(TorqueUnit divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, VelocityUnit<?>> times(Velocity<?> multiplier) {
@@ -643,6 +748,11 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, VelocityUnit<?>> per(VelocityUnit<?> divisorUnit) {
return div(divisorUnit.one());
}
@Override
default Mult<DistanceUnit, VoltageUnit> times(Voltage multiplier) {
@@ -666,4 +776,9 @@ public interface Distance extends Measure<DistanceUnit> {
return div(divisor);
}
@Override
default Per<DistanceUnit, VoltageUnit> per(VoltageUnit divisorUnit) {
return div(divisorUnit.one());
}
}

Some files were not shown because too many files have changed in this diff Show More