Compare commits

...

58 Commits

Author SHA1 Message Date
Thad House
fcf23fc9e9 [hal] Fix potential gamedata out of bounds read (#3983)
The size was uninitialized.  If the size is smaller than the data,
NetComm just updates the size and does not initialize the data.
2022-02-01 22:22:48 -08:00
Jan-Felix Abellera
af5ef510c5 [wpilibc] Fix REV PH pulse duration units (#3982) 2022-02-01 20:28:48 -08:00
Jan-Felix Abellera
05401e2b81 [wpilib] Write REV PH firmware version to roboRIO to display on driver station (#3977) 2022-02-01 20:27:43 -08:00
Thad House
9fde0110b6 Update to 2022 v4.0 image (#3944) 2022-01-31 23:26:05 -08:00
sciencewhiz
b03f8ddb2e [examples] fix incorrect variable in Arm Simulation Pref (#3980) 2022-01-31 22:01:31 -08:00
sciencewhiz
a26df2a022 [examples] Update ArmSimulation example to use Preferences (#3976)
This shows more real world usage then hardcoding the setpoint and PID
gains. There were no current examples using Preferences. This will also
be used to update frc-docs article for Preferences.
2022-01-31 00:17:04 -08:00
Oblarg
d68d6674e8 [examples] Armbot: rename kCos to kG (#3975) 2022-01-31 00:16:26 -08:00
sciencewhiz
a8f0f6bb90 [wpilibj] Fix ADIS16448 getRate to return rate instead of angle (#3974) 2022-01-29 20:17:57 -08:00
Thad House
dd9c92d5bf [build] Remove debug info from examples (#3971)
They take up a LOT of disk space.
2022-01-27 20:59:13 -08:00
Thad House
84df14dd70 [rtns] Fix icons (#3972) 2022-01-27 20:58:07 -08:00
sciencewhiz
560094ad92 [examples] Correct Mecanum example axes (#3955) 2022-01-27 20:57:41 -08:00
Jan-Felix Abellera
7ea1be9c01 [wpilibc] Fix typo in hardware version for REV PDH (#3969) 2022-01-27 17:54:38 -08:00
Jan-Felix Abellera
700f13bffd [wpilibj] Make methods public for Java REV PDH (#3970) 2022-01-27 17:54:14 -08:00
Jan-Felix Abellera
b6aa7c1aa9 [wpilibj] Make methods public for Java REVPH (#3968) 2022-01-27 17:53:45 -08:00
Tyler Veness
eb4d183e48 [wpimath] Fix clang-tidy bugprone-integer-division warning (#3966)
The integer conversion is deliberate.
2022-01-26 18:38:45 -08:00
Thad House
77e4e81e1e [wpilib] Add Field widget to BuiltInWidgets in shuffleboard (#3961) 2022-01-24 20:33:11 -08:00
Thad House
88f5cb6eb0 [build] Publish PDBs with C++ tools (#3960) 2022-01-24 20:32:17 -08:00
Tyler Veness
efae552f3e [wpimath] Remove DifferentialDriveKinematics include from odometry (#3958) 2022-01-24 16:02:00 -08:00
sciencewhiz
46b277421a [glass] Update Speed Controller Type name for 2022 WPILib (#3952) 2022-01-21 21:30:44 -08:00
modelmat
42908126b9 [wpilib] Add DCMotorSim (#3910) 2022-01-21 20:42:06 -08:00
Peter Johnson
a467392cbd [wpiutil] StackTrace: Add ability to override default implementation (#3951) 2022-01-21 17:22:41 -08:00
modelmat
78d0bcf49d [templates] Add SimulationInit()/SimulationPeriodic() to robot templates (#3943) 2022-01-21 16:23:46 -08:00
sciencewhiz
02a0ced9b0 [wpilib] MecanumDrive: update docs for axis to match implementation (NFC) (#3942)
Added note that implementation may change in the future, #3930.
2022-01-21 16:22:17 -08:00
shueja-personal
4ccfe1c9f2 [wpilib] Added docs clarification on units for drive class WheelSpeeds (NFC) (#3939) 2022-01-21 15:51:28 -08:00
Peter Johnson
830c0c5c2f [wpilib] MechanismLigament2d: Add getters for color and line weight (#3947)
Also add missing locking in C++.
2022-01-21 15:47:44 -08:00
Peter Johnson
5548a37465 [wpilib] PowerDistribution: Add module type getter (#3948) 2022-01-21 15:46:44 -08:00
Thad House
2f9a600de2 [hal] Fix PCM one shot (#3949) 2022-01-21 15:46:08 -08:00
Thad House
559db11a20 [myRobot] Skip deploying debug libraries for myRobot deploys (#3950) 2022-01-21 15:45:47 -08:00
Lenny Abbas
76c78e295b [examples] Reorder SwerveModules in SwerveControllerCommand example odometry update (#3934) 2022-01-21 11:04:43 -08:00
sciencewhiz
debbd5ff4b [wpilib] Improve PowerDistribution docs (NFC) (#3925)
Add docs for switchable channel.
Use PDP/PDH appropriately and clarify differences.
Fix typos.
2022-01-20 23:33:01 -08:00
Tyler Veness
841174f302 [commands] Change command vendordep JSON version number to 1.0.0 (#3938)
While the number doesn't matter, it being old is confusing a lot of
people.  We never increment the internal vendordep versions, so using a year
version number was a poor choice.

Closes #3921.
2022-01-20 23:32:02 -08:00
sciencewhiz
8c55844f91 [wpilib] Remove comment about Mecanum right side inverted (NFC) (#3929) 2022-01-18 01:00:55 -08:00
Thad House
0b990bf0f5 [hal] Fix PCM sticky faults clear function crashing (#3932)
A call to the PCM clear function was using the wrong handle passed down to the CAN layer, causing an error.
2022-01-18 00:59:51 -08:00
Thad House
104d7e2abc [hal] Don't throw exceptions in PCM JNI (#3933)
Since the CAN bus can easily become disconnected, we don't want this to crash. Instead, we just want this to report errors. This matches previous behavior.
2022-01-18 00:58:26 -08:00
Lenny Abbas
5ba69e1af1 [examples] Updated type in Java SwerveModule (#3928)
Changed turnOutput from var to double in SwerveModule. It doesn't make sense for driveOutput and turnOutput to have different types so they should both be doubles.
2022-01-17 12:20:55 -08:00
Chirag Kaushik
f3a0b5c7d7 [wpimath] Fix Java SimpleMotorFeedforward Docs (NFC) (#3926) 2022-01-17 09:59:04 -08:00
Tyler Veness
7f4265facc [wpimath] Add LinearFilter::FiniteDifference() (#3900)
This allows making more general finite difference filters, like central
finite difference. SysId uses this for acceleration filtering.
2022-01-15 20:18:11 -08:00
Tyler Veness
63d1fb3bed [wpiutil] Modify fmt to not throw on write failure (#3919)
This was causing issues with tools, as the launchers would close stdout/stderr, resulting in write failures.
2022-01-15 20:10:32 -08:00
Tyler Veness
36af6d25a5 [wpimath] Fix input vector in pose estimator docs (NFC) (#3923) 2022-01-15 20:03:39 -08:00
Thad House
8f387f7255 [wpilibj] Switch ControlWord mutex to actual reentrant mutex (#3922)
It seems like the JVM does not handle recursive calls to object monitor based locks correctly. A few bugs in the past have been reported to have caused deadlocks if this occurs. It looks like the version of Java we use is fixed, but there could be other bugs, and it seems like this area of the code isn't tested much. Based on the stacks reported in #3896, it really seems like this is occurring. So we're going to attempt to switch to explicit mutex based classes, which shouldn't have bugs like this, and we will see if that fixes the issue.
2022-01-15 15:24:06 -08:00
David Vo
792e735e08 [wpimath] Move TrajectoryGenerator::SetErrorHandler definition to .cpp (#3920)
Otherwise this function causes linking errors when used on Windows.
2022-01-15 08:58:49 -08:00
Tyler Veness
3b76de83eb [commands] Fix ProfiledPIDCommand use-after-free (#3904)
Fixes #3903.
2022-01-14 23:56:48 -08:00
PJ Reiniger
ad9f738cfa [fieldimages] Fix maven publishing (#3897) 2022-01-14 23:55:10 -08:00
modelmat
49455199e5 [examples] Use left/rightGroup.Get() for simulator inputs to fix inversions (#3908) 2022-01-14 23:54:20 -08:00
modelmat
64426502ea [wpimath] Fix arm -> flywheel typo (NFC) (#3911) 2022-01-14 23:53:45 -08:00
Tyler Veness
8cc112d196 [wpiutil] Fix wpi::array for move-only types (#3917)
Fixes #3916.
2022-01-14 23:53:12 -08:00
Tyler Veness
e78cd49861 [build] Upgrade Java formatter plugins (#3894) 2022-01-11 22:24:16 -08:00
Tyler Veness
cfb4f756d6 [build] Upgrade to shadow 7.1.2 (#3893) 2022-01-11 21:10:15 -08:00
Tyler Veness
ba0908216c [wpimath] Fix crash in KF latency compensator (#3888)
It would crash in C++ if the global measurement was sooner than all the
snapshots.

Align Java with the changes and better document computation approach.
2022-01-09 23:01:04 -08:00
Peter Johnson
a3a0334fad [build] cmake: Move fieldImages to WITH_GUI (#3885)
This will only ever be used by GUI applications, and the jar build
method it uses can misbehave in some cross-compile scenarios.
2022-01-09 20:26:54 -08:00
sciencewhiz
cf7460c3a8 [fieldImages] Add 2022 field (#3883) 2022-01-08 23:24:24 -08:00
Tyler Veness
db0fbb6448 [wpimath] Fix LQR matrix constructor overload for Q, R, and N (#3884)
It was using the continuous B matrix to compute the feedback gain
instead of the discrete B matrix.

Tests were added for the matrix constructor overloads.
2022-01-08 23:23:53 -08:00
sciencewhiz
8ac45f20bb [commands] Update Command documentation (NFC) (#3881)
Add reference to which VendorDep the class is included in.
Add missing OldCommands C++ Documentation (copied from Java).
2022-01-08 11:11:34 -08:00
Tyler Veness
b3707cca0b [wpiutil] Upgrade to fmt 8.1.1 (#3879)
The changes to PneumaticsBase.cpp were to fix errors like the following
from enum classes not being formattable:
```
allwpilib/wpilibc/src/main/native/cpp/PneumaticsBase.cpp:36:9:   required from here
allwpilib/wpiutil/src/main/native/fmtlib/include/fmt/core.h:2672:12: error: use of deleted function ‘fmt::v8::detail::fallback_formatter<T, Char, Enable>::fallback_formatter() [with T = frc::PneumaticsModuleType; Char = char; Enable = void]’
 2672 |   auto f = conditional_t<has_formatter<mapped_type, context>::value,
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2673 |                          formatter<mapped_type, char_type>,
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2674 |                          fallback_formatter<T, char_type>>();
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
2022-01-08 11:10:42 -08:00
Tyler Veness
a69ee3ece9 [wpimath] Const-qualify Twist2d scalar multiply (#3882)
Fixes #3880.
2022-01-08 11:09:29 -08:00
Drew Williams
750d9a30c9 [examples] Fix Eigen out of range error when running example (#3877)
Simple typo fix.
2022-01-08 00:15:26 -08:00
Peter Johnson
41c5b2b5ac [rtns] Add cmake build (#3866)
This needs libssh to build, so on Linux systems it's necessary to
install libssh-dev.
2022-01-08 00:14:48 -08:00
Tyler Veness
6cf3f9b28e [build] Upgrade to Gradle 7.3.3 (#3878)
This is the same version robot projects currently use.
2022-01-08 00:14:27 -08:00
274 changed files with 5521 additions and 1727 deletions

View File

@@ -145,6 +145,8 @@ if (USE_VCPKG_EIGEN)
set (EIGEN_VCPKG_REPLACE "find_package(Eigen3 CONFIG)")
endif()
find_package(LIBSSH 0.7.1)
if (WITH_FLAT_INSTALL)
set(WPIUTIL_DEP_REPLACE "include($\{SELF_DIR\}/wpiutil-config.cmake)")
set(NTCORE_DEP_REPLACE "include($\{SELF_DIR\}/ntcore-config.cmake)")
@@ -245,7 +247,6 @@ if (WITH_TESTS)
include(GoogleTest)
endif()
add_subdirectory(fieldImages)
add_subdirectory(wpiutil)
add_subdirectory(ntcore)
@@ -254,10 +255,14 @@ if (WITH_WPIMATH)
endif()
if (WITH_GUI)
add_subdirectory(fieldImages)
add_subdirectory(imgui)
add_subdirectory(wpigui)
add_subdirectory(glass)
add_subdirectory(outlineviewer)
if (LIBSSH_FOUND)
add_subdirectory(roborioteamnumbersetter)
endif()
endif()
if (WITH_WPILIB OR WITH_SIMULATION_MODULES)

View File

@@ -19,9 +19,9 @@ plugins {
id 'idea'
id 'visual-studio'
id 'net.ltgt.errorprone' version '2.0.2' apply false
id 'com.github.johnrengelman.shadow' version '7.1.1' apply false
id 'com.diffplug.spotless' version '6.0.5' apply false
id 'com.github.spotbugs' version '5.0.3' apply false
id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
id 'com.diffplug.spotless' version '6.1.2' apply false
id 'com.github.spotbugs' version '5.0.4' apply false
}
wpilibVersioning.buildServerMode = project.hasProperty('buildServer')
@@ -147,5 +147,5 @@ ext.getCurrentArch = {
}
wrapper {
gradleVersion = '7.3.2'
gradleVersion = '7.3.3'
}

View File

@@ -0,0 +1,116 @@
# - Try to find LibSSH
# Once done this will define
#
# LIBSSH_FOUND - system has LibSSH
# LIBSSH_INCLUDE_DIRS - the LibSSH include directory
# LIBSSH_LIBRARIES - link these to use LibSSH
# LIBSSH_VERSION -
#
# Author Michal Vasko <mvasko@cesnet.cz>
# Copyright (c) 2020 CESNET, z.s.p.o.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
#
include(FindPackageHandleStandardArgs)
if(LIBSSH_LIBRARIES AND LIBSSH_INCLUDE_DIRS)
# in cache already
set(LIBSSH_FOUND TRUE)
else()
find_path(LIBSSH_INCLUDE_DIR
NAMES
libssh/libssh.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
${CMAKE_INCLUDE_PATH}
${CMAKE_INSTALL_PREFIX}/include
)
find_library(LIBSSH_LIBRARY
NAMES
ssh.so
libssh.so
libssh.dylib
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
${CMAKE_LIBRARY_PATH}
${CMAKE_INSTALL_PREFIX}/lib
)
if(LIBSSH_INCLUDE_DIR AND LIBSSH_LIBRARY)
# learn libssh version
if(EXISTS ${LIBSSH_INCLUDE_DIR}/libssh/libssh_version.h)
set(LIBSSH_HEADER_PATH ${LIBSSH_INCLUDE_DIR}/libssh/libssh_version.h)
else()
set(LIBSSH_HEADER_PATH ${LIBSSH_INCLUDE_DIR}/libssh/libssh.h)
endif()
file(STRINGS ${LIBSSH_HEADER_PATH} LIBSSH_VERSION_MAJOR
REGEX "#define[ ]+LIBSSH_VERSION_MAJOR[ ]+[0-9]+")
if(NOT LIBSSH_VERSION_MAJOR)
message(STATUS "LIBSSH_VERSION_MAJOR not found, assuming libssh is too old and cannot be used!")
set(LIBSSH_INCLUDE_DIR "LIBSSH_INCLUDE_DIR-NOTFOUND")
set(LIBSSH_LIBRARY "LIBSSH_LIBRARY-NOTFOUND")
else()
string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_MAJOR ${LIBSSH_VERSION_MAJOR})
file(STRINGS ${LIBSSH_HEADER_PATH} LIBSSH_VERSION_MINOR
REGEX "#define[ ]+LIBSSH_VERSION_MINOR[ ]+[0-9]+")
string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_MINOR ${LIBSSH_VERSION_MINOR})
file(STRINGS ${LIBSSH_HEADER_PATH} LIBSSH_VERSION_PATCH
REGEX "#define[ ]+LIBSSH_VERSION_MICRO[ ]+[0-9]+")
string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_PATCH ${LIBSSH_VERSION_PATCH})
set(LIBSSH_VERSION ${LIBSSH_VERSION_MAJOR}.${LIBSSH_VERSION_MINOR}.${LIBSSH_VERSION_PATCH})
if(LIBSSH_VERSION VERSION_LESS 0.8.0)
# libssh_threads also needs to be linked for these versions
string(REPLACE "libssh.so" "libssh_threads.so"
LIBSSH_THREADS_LIBRARY
${LIBSSH_LIBRARY}
)
string(REPLACE "libssh.dylib" "libssh_threads.dylib"
LIBSSH_THREADS_LIBRARY
${LIBSSH_THREADS_LIBRARY}
)
string(REPLACE "ssh.so" "ssh_threads.so"
LIBSSH_THREADS_LIBRARY
${LIBSSH_THREADS_LIBRARY}
)
endif()
endif()
endif()
set(LIBSSH_INCLUDE_DIRS ${LIBSSH_INCLUDE_DIR})
set(LIBSSH_LIBRARIES ${LIBSSH_LIBRARY} ${LIBSSH_THREADS_LIBRARY})
mark_as_advanced(LIBSSH_INCLUDE_DIRS LIBSSH_LIBRARIES)
find_package_handle_standard_args(LibSSH FOUND_VAR LIBSSH_FOUND
REQUIRED_VARS LIBSSH_INCLUDE_DIRS LIBSSH_LIBRARIES
VERSION_VAR LIBSSH_VERSION)
endif()

View File

@@ -15,10 +15,14 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra
ext {
nativeName = 'fieldImages'
baseId = nativeName
groupId = 'edu.wpi.first.fieldImages'
devMain = "edu.wpi.first.fieldImages.DevMain"
}
apply from: "${rootDir}/shared/resources.gradle"
apply from: "${rootDir}/shared/config.gradle"
apply from: "${rootDir}/shared/java/javacommon.gradle"
def generateTask = createGenerateResourcesTask('main', 'FIELDS', 'fields', project)

View File

@@ -1,14 +1,14 @@
apply plugin: 'maven-publish'
def baseArtifactId = 'fieldImages'
def artifactGroupId = 'edu.wpi.first.fieldImages'
def zipBaseName = '_GROUP_edu_wpi_first_field_images_ID_CLS'
def baseArtifactId = project.nativeName
def artifactGroupId = project.groupId
def cppZipBaseName = "_GROUP_edu_wpi_first_fieldIimages_ID_${baseArtifactId}-cpp_CLS"
def outputsFolder = file("$project.buildDir/outputs")
task cppSourcesZip(type: Zip) {
destinationDirectory = outputsFolder
archiveBaseName = zipBaseName
archiveBaseName = cppZipBaseName
classifier = "sources"
from(licenseFile) {
@@ -25,7 +25,7 @@ task cppSourcesZip(type: Zip) {
task cppHeadersZip(type: Zip) {
destinationDirectory = outputsFolder
archiveBaseName = zipBaseName
archiveBaseName = cppZipBaseName
classifier = "headers"
from(licenseFile) {
@@ -51,7 +51,7 @@ addTaskToCopyAllOutputs(cppSourcesZip)
model {
publishing {
def wpilibCTaskList = createComponentZipTasks($.components, ['fieldImages'], zipBaseName, Zip, project, includeStandardZipFormat)
def wpilibCTaskList = createComponentZipTasks($.components, ['fieldImages'], cppZipBaseName, Zip, project, includeStandardZipFormat)
publications {
cpp(MavenPublication) {
@@ -62,7 +62,7 @@ model {
artifact cppHeadersZip
artifact cppSourcesZip
artifactId = baseArtifactId
artifactId = "${baseArtifactId}-cpp"
groupId artifactGroupId
version wpilibVersioning.version.get()
}

View File

@@ -20,4 +20,6 @@ public class FieldImages {
public static final String k2021GalacticSearchBFieldConfig =
"/edu/wpi/first/fields/2021-galacticsearchb.json";
public static final String k2021SlalomFieldConfig = "/edu/wpi/first/fields/2021-slalompath.json";
public static final String k2022RapidReactFieldConfig =
"/edu/wpi/first/fields/2022-rapidreact.json";
}

View File

@@ -0,0 +1,12 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <string_view>
namespace fields {
std::string_view GetResource_2022_rapidreact_json();
std::string_view GetResource_2022_field_png();
} // namespace fields

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@@ -0,0 +1,10 @@
{
"game": "Rapid React",
"field-image": "2022-field.png",
"field-corners": {
"top-left": [74, 50],
"bottom-right": [1774, 900]
},
"field-size": [54, 27],
"field-unit": "foot"
}

View File

@@ -130,6 +130,14 @@ model {
}
from(applicationPath)
if (binary.targetPlatform.operatingSystem.isWindows()) {
def exePath = binary.executable.file.absolutePath
exePath = exePath.substring(0, exePath.length() - 4)
def pdbPath = new File(exePath + '.pdb')
from(pdbPath)
}
into(nativeUtils.getPlatformPath(binary))
}

View File

@@ -16,7 +16,7 @@
namespace glass {
class NTSpeedControllerModel : public SpeedControllerModel {
public:
static constexpr const char* kType = "Speed Controller";
static constexpr const char* kType = "Motor Controller";
explicit NTSpeedControllerModel(std::string_view path);
NTSpeedControllerModel(NT_Inst instance, std::string_view path);

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

10
gradlew vendored
View File

@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#

View File

@@ -335,8 +335,13 @@ HAL_Bool HAL_GetCTREPCMSolenoidVoltageFault(HAL_CTREPCMHandle handle,
void HAL_ClearAllCTREPCMStickyFaults(HAL_CTREPCMHandle handle,
int32_t* status) {
auto pcm = pcmHandles->Get(handle);
if (pcm == nullptr) {
*status = HAL_HANDLE_ERROR;
return;
}
uint8_t controlData[] = {0, 0, 0, 0x80};
HAL_WriteCANPacket(handle, controlData, sizeof(controlData), Control2,
HAL_WriteCANPacket(pcm->canHandle, controlData, sizeof(controlData), Control2,
status);
}
@@ -393,7 +398,7 @@ void HAL_SetCTREPCMOneShotDuration(HAL_CTREPCMHandle handle, int32_t index,
(std::min)(static_cast<uint32_t>(durMs) / 10,
static_cast<uint32_t>(0xFF));
HAL_WriteCANPacketRepeating(pcm->canHandle, pcm->oneShot.sol10MsPerUnit, 8,
Control2, SendPeriod, status);
Control3, SendPeriod, status);
}
} // extern "C"

View File

@@ -110,10 +110,15 @@ static int32_t HAL_GetControlWordInternal(HAL_ControlWord* controlWord) {
static int32_t HAL_GetMatchInfoInternal(HAL_MatchInfo* info) {
MatchType_t matchType = MatchType_t::kMatchType_none;
info->gameSpecificMessageSize = sizeof(info->gameSpecificMessage);
int status = FRC_NetworkCommunication_getMatchInfo(
info->eventName, &matchType, &info->matchNumber, &info->replayNumber,
info->gameSpecificMessage, &info->gameSpecificMessageSize);
if (info->gameSpecificMessageSize > sizeof(info->gameSpecificMessage)) {
info->gameSpecificMessageSize = 0;
}
info->matchType = static_cast<HAL_MatchType>(matchType);
*(std::end(info->eventName) - 1) = '\0';

View File

@@ -86,6 +86,9 @@ deploy {
myRobotCpp(NativeExecutableArtifact) {
libraryDirectory = '/usr/local/frc/third-party/lib'
def excludes = getLibraryFilter().getExcludes()
excludes.add('**/*.so.debug')
excludes.add('**/*.so.*.debug')
postdeploy << { ctx ->
ctx.execute('chmod +x myRobotCpp')
}

View File

@@ -76,6 +76,14 @@ model {
}
from(applicationPath)
if (binary.targetPlatform.operatingSystem.isWindows()) {
def exePath = binary.executable.file.absolutePath
exePath = exePath.substring(0, exePath.length() - 4)
def pdbPath = new File(exePath + '.pdb')
from(pdbPath)
}
into(nativeUtils.getPlatformPath(binary))
}

View File

@@ -0,0 +1,29 @@
project(roborioteamnumbersetter)
include(CompileWarnings)
include(GenResources)
include(LinkMacOSGUI)
configure_file(src/main/generate/WPILibVersion.cpp.in WPILibVersion.cpp)
GENERATE_RESOURCES(src/main/native/resources generated/main/cpp RTNS rtns rtns_resources_src)
file(GLOB rtns_src src/main/native/cpp/*.cpp ${CMAKE_CURRENT_BINARY_DIR}/WPILibVersion.cpp)
if (WIN32)
set(rtns_rc src/main/native/win/roborioteamnumbersetter.rc)
elseif(APPLE)
set(MACOSX_BUNDLE_ICON_FILE rtns.icns)
set(APP_ICON_MACOSX src/main/native/mac/rtns.icns)
set_source_files_properties(${APP_ICON_MACOSX} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
endif()
add_executable(roborioteamnumbersetter ${rtns_src} ${rtns_resources_src} ${rtns_rc} ${APP_ICON_MACOSX})
wpilib_link_macos_gui(roborioteamnumbersetter)
target_link_libraries(roborioteamnumbersetter libglass ${LIBSSH_LIBRARIES})
target_include_directories(roborioteamnumbersetter PRIVATE ${LIBSSH_INCLUDE_DIRS})
if (WIN32)
set_target_properties(roborioteamnumbersetter PROPERTIES WIN32_EXECUTABLE YES)
elseif(APPLE)
set_target_properties(roborioteamnumbersetter PROPERTIES MACOSX_BUNDLE YES OUTPUT_NAME "roborioTeamNumberSetter")
endif()

View File

@@ -76,6 +76,14 @@ model {
}
from(applicationPath)
if (binary.targetPlatform.operatingSystem.isWindows()) {
def exePath = binary.executable.file.absolutePath
exePath = exePath.substring(0, exePath.length() - 4)
def pdbPath = new File(exePath + '.pdb')
from(pdbPath)
}
into(nativeUtils.getPlatformPath(binary))
}

View File

@@ -31,6 +31,16 @@ namespace gui = wpi::gui;
const char* GetWPILibVersion();
namespace rtns {
std::string_view GetResource_rtns_16_png();
std::string_view GetResource_rtns_32_png();
std::string_view GetResource_rtns_48_png();
std::string_view GetResource_rtns_64_png();
std::string_view GetResource_rtns_128_png();
std::string_view GetResource_rtns_256_png();
std::string_view GetResource_rtns_512_png();
} // namespace rtns
#define GLFWAPI extern "C"
GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
#define GLFW_DONT_CARE -1
@@ -240,6 +250,15 @@ void Application(std::string_view saveDir) {
gui::CreateContext();
glass::CreateContext();
// Add icons
gui::AddIcon(rtns::GetResource_rtns_16_png());
gui::AddIcon(rtns::GetResource_rtns_32_png());
gui::AddIcon(rtns::GetResource_rtns_48_png());
gui::AddIcon(rtns::GetResource_rtns_64_png());
gui::AddIcon(rtns::GetResource_rtns_128_png());
gui::AddIcon(rtns::GetResource_rtns_256_png());
gui::AddIcon(rtns::GetResource_rtns_512_png());
glass::SetStorageName("roborioteamnumbersetter");
glass::SetStorageDir(saveDir.empty() ? gui::GetPlatformSaveFileDir()
: saveDir);

View File

@@ -10,7 +10,7 @@ nativeUtils {
wpi {
configureDependencies {
wpiVersion = "-1"
niLibVersion = "2022.2.3"
niLibVersion = "2022.4.0"
opencvVersion = "4.5.2-1"
googleTestVersion = "1.9.0-5-437e100-1"
imguiVersion = "1.86-1"
@@ -21,7 +21,10 @@ nativeUtils {
nativeUtils.wpi.addWarnings()
nativeUtils.wpi.addWarningsAsErrors()
nativeUtils.wpi.addReleaseSymbolGeneration()
if (project.name != 'wpilibcExamples') {
nativeUtils.wpi.addReleaseSymbolGeneration()
}
nativeUtils.setSinglePrintPerPlatform()
nativeUtils.enableSourceLink()

View File

@@ -0,0 +1,42 @@
diff --git a/wpiutil/src/main/native/fmtlib/include/fmt/format-inl.h b/wpiutil/src/main/native/fmtlib/include/fmt/format-inl.h
index 2c51c50ae..cc89abdd3 100644
--- a/wpiutil/src/main/native/fmtlib/include/fmt/format-inl.h
+++ b/wpiutil/src/main/native/fmtlib/include/fmt/format-inl.h
@@ -92,8 +92,7 @@ FMT_FUNC void report_error(format_func func, int error_code,
// A wrapper around fwrite that throws on error.
inline void fwrite_fully(const void* ptr, size_t size, size_t count,
FILE* stream) {
- size_t written = std::fwrite(ptr, size, count, stream);
- if (written < count) FMT_THROW(system_error(errno, "cannot write to file"));
+ std::fwrite(ptr, size, count, stream);
}
#ifndef FMT_STATIC_THOUSANDS_SEPARATOR
diff --git a/wpiutil/src/main/native/fmtlib/include/fmt/xchar.h b/wpiutil/src/main/native/fmtlib/include/fmt/xchar.h
index 55825077f..9acb893fa 100644
--- a/wpiutil/src/main/native/fmtlib/include/fmt/xchar.h
+++ b/wpiutil/src/main/native/fmtlib/include/fmt/xchar.h
@@ -207,8 +207,7 @@ inline void vprint(std::FILE* f, wstring_view fmt, wformat_args args) {
wmemory_buffer buffer;
detail::vformat_to(buffer, fmt, args);
buffer.push_back(L'\0');
- if (std::fputws(buffer.data(), f) == -1)
- FMT_THROW(system_error(errno, FMT_STRING("cannot write to file")));
+ std::fputws(buffer.data(), f);
}
inline void vprint(wstring_view fmt, wformat_args args) {
diff --git a/wpiutil/src/main/native/fmtlib/src/os.cpp b/wpiutil/src/main/native/fmtlib/src/os.cpp
index 04b4dc506..4eb3e1fdd 100644
--- a/wpiutil/src/main/native/fmtlib/src/os.cpp
+++ b/wpiutil/src/main/native/fmtlib/src/os.cpp
@@ -277,8 +277,7 @@ std::size_t file::read(void* buffer, std::size_t count) {
std::size_t file::write(const void* buffer, std::size_t count) {
rwresult result = 0;
FMT_RETRY(result, FMT_POSIX_CALL(write(fd_, buffer, convert_rwcount(count))));
- if (result < 0) FMT_THROW(system_error(errno, "cannot write to file"));
- return detail::to_unsigned(result);
+ return count;
}
file file::dup(int fd) {

View File

@@ -3,11 +3,11 @@
import os
import shutil
from upstream_utils import setup_upstream_repo, comment_out_invalid_includes, walk_cwd_and_copy_if
from upstream_utils import setup_upstream_repo, comment_out_invalid_includes, walk_cwd_and_copy_if, apply_patches
def main():
root, repo = setup_upstream_repo("https://github.com/fmtlib/fmt", "8.0.1")
root, repo = setup_upstream_repo("https://github.com/fmtlib/fmt", "8.1.1")
wpiutil = os.path.join(root, "wpiutil")
# Delete old install
@@ -31,6 +31,9 @@ def main():
comment_out_invalid_includes(
f, [os.path.join(wpiutil, "src/main/native/fmtlib/include")])
apply_patches(root,
["upstream_utils/fmt-dont-throw-on-write-failure.patch"])
if __name__ == "__main__":
main()

View File

@@ -1,7 +1,7 @@
{
"fileName": "WPILibNewCommands.json",
"name": "WPILib-New-Commands",
"version": "2020.0.0",
"version": "1.0.0",
"uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266",
"mavenUrls": [],
"jsonUrl": "",

View File

@@ -14,6 +14,8 @@ import java.util.function.BooleanSupplier;
*
* <p>Commands are run synchronously from the main robot loop; no multithreading is used, unless
* specified explicitly from the command implementation.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public interface Command {
/** The initial subroutine of a command. Called once when the command is initially scheduled. */

View File

@@ -10,7 +10,11 @@ import edu.wpi.first.util.sendable.SendableRegistry;
import java.util.HashSet;
import java.util.Set;
/** A {@link Sendable} base class for {@link Command}s. */
/**
* A {@link Sendable} base class for {@link Command}s.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public abstract class CommandBase implements Sendable, Command {
protected Set<Subsystem> m_requirements = new HashSet<>();

View File

@@ -13,6 +13,8 @@ import java.util.WeakHashMap;
* A base for CommandGroups. Statically tracks commands that have been allocated to groups to ensure
* those commands are not also used independently, which can result in inconsistent command state
* and unpredictable execution.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public abstract class CommandGroupBase extends CommandBase {
private static final Set<Command> m_groupedCommands =

View File

@@ -33,6 +33,8 @@ import java.util.function.Consumer;
* synchronously from the main loop. Subsystems should be registered with the scheduler using {@link
* CommandScheduler#registerSubsystem(Subsystem...)} in order for their {@link Subsystem#periodic()}
* methods to be called and for their default commands to be scheduled.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public final class CommandScheduler implements NTSendable, AutoCloseable {
/** The Singleton Instance. */

View File

@@ -8,6 +8,8 @@ import edu.wpi.first.wpilibj.Timer;
/**
* Class that holds scheduling state for a command. Used internally by the {@link CommandScheduler}.
*
* <p>This class is provided by the NewCommands VendorDep
*/
class CommandState {
// The time since this command was initialized.

View File

@@ -21,6 +21,8 @@ import java.util.function.BooleanSupplier;
* scheduled individually.
*
* <p>As a rule, CommandGroups require the union of the requirements of their component commands.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class ConditionalCommand extends CommandBase {
private final Command m_onTrue;

View File

@@ -14,6 +14,8 @@ import java.util.function.Consumer;
* the constructor. Useful for inline definitions of complex commands - note, however, that if a
* command is beyond a certain complexity it is usually better practice to write a proper class for
* it than to inline it.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class FunctionalCommand extends CommandBase {
protected final Runnable m_onInit;

View File

@@ -10,6 +10,8 @@ import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
* A Command that runs instantly; it will initialize, execute once, and end on the same iteration of
* the scheduler. Users can either pass in a Runnable and a set of requirements, or else subclass
* this command if desired.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class InstantCommand extends CommandBase {
private final Runnable m_toRun;

View File

@@ -35,6 +35,8 @@ import java.util.function.Supplier;
*
* <p>The robot angle controller does not follow the angle given by the trajectory but rather goes
* to the angle given in the final state of the trajectory.
*
* <p>This class is provided by the NewCommands VendorDep
*/
@SuppressWarnings("MemberName")
public class MecanumControllerCommand extends CommandBase {

View File

@@ -14,6 +14,8 @@ import edu.wpi.first.wpilibj.Notifier;
* <p>WARNING: Do not use this class unless you are confident in your ability to make the executed
* code thread-safe. If you do not know what "thread-safe" means, that is a good sign that you
* should not use this class.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class NotifierCommand extends CommandBase {
protected final Notifier m_notifier;

View File

@@ -15,6 +15,8 @@ import java.util.function.DoubleSupplier;
* A command that controls an output with a {@link PIDController}. Runs forever by default - to add
* exit conditions and/or other behavior, subclass this class. The controller calculation and output
* are performed synchronously in the command's execute() method.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class PIDCommand extends CommandBase {
protected final PIDController m_controller;

View File

@@ -11,6 +11,8 @@ import edu.wpi.first.math.controller.PIDController;
/**
* A subsystem that uses a {@link PIDController} to control an output. The controller is run
* synchronously from the subsystem's periodic() method.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public abstract class PIDSubsystem extends SubsystemBase {
protected final PIDController m_controller;

View File

@@ -12,6 +12,8 @@ import java.util.Map;
* A CommandGroup that runs a set of commands in parallel, ending when the last command ends.
*
* <p>As a rule, CommandGroups require the union of the requirements of their component commands.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class ParallelCommandGroup extends CommandGroupBase {
// maps commands in this group to whether they are still running

View File

@@ -13,6 +13,8 @@ import java.util.Map;
* "deadline") ends, interrupting all other commands that are still running at that point.
*
* <p>As a rule, CommandGroups require the union of the requirements of their component commands.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class ParallelDeadlineGroup extends CommandGroupBase {
// maps commands in this group to whether they are still running

View File

@@ -13,6 +13,8 @@ import java.util.Set;
* and interrupting all the others.
*
* <p>As a rule, CommandGroups require the union of the requirements of their component commands.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class ParallelRaceGroup extends CommandGroupBase {
private final Set<Command> m_commands = new HashSet<>();

View File

@@ -14,6 +14,8 @@ import static edu.wpi.first.wpilibj2.command.CommandGroupBase.requireUngrouped;
* cannot be added to any other groups, or scheduled individually.
*
* <p>As a rule, CommandGroups require the union of the requirements of their component commands.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class PerpetualCommand extends CommandBase {
protected final Command m_command;

View File

@@ -4,7 +4,11 @@
package edu.wpi.first.wpilibj2.command;
/** A command that prints a string when initialized. */
/**
* A command that prints a string when initialized.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class PrintCommand extends InstantCommand {
/**
* Creates a new a PrintCommand.

View File

@@ -17,6 +17,8 @@ import java.util.function.Supplier;
* A command that controls an output with a {@link ProfiledPIDController}. Runs forever by default -
* to add exit conditions and/or other behavior, subclass this class. The controller calculation and
* output are performed synchronously in the command's execute() method.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class ProfiledPIDCommand extends CommandBase {
protected final ProfiledPIDController m_controller;

View File

@@ -13,6 +13,8 @@ import edu.wpi.first.math.trajectory.TrapezoidProfile;
/**
* A subsystem that uses a {@link ProfiledPIDController} to control an output. The controller is run
* synchronously from the subsystem's periodic() method.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public abstract class ProfiledPIDSubsystem extends SubsystemBase {
protected final ProfiledPIDController m_controller;

View File

@@ -10,6 +10,8 @@ import java.util.Set;
* Schedules the given commands when this command is initialized, and ends when all the commands are
* no longer scheduled. Useful for forking off from CommandGroups. If this command is interrupted,
* it will cancel all of the commands.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class ProxyScheduleCommand extends CommandBase {
private final Set<Command> m_toSchedule;

View File

@@ -29,6 +29,8 @@ import java.util.function.Supplier;
* <p>Advanced teams seeking more flexibility (for example, those who wish to use the onboard PID
* functionality of a "smart" motor controller) may use the secondary constructor that omits the PID
* and feedforward functionality, returning only the raw wheel speeds from the RAMSETE controller.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class RamseteCommand extends CommandBase {
private final Timer m_timer = new Timer();

View File

@@ -12,6 +12,8 @@ import java.util.function.BooleanSupplier;
* A command that runs a Runnable continuously. Has no end condition as-is; either subclass it or
* use {@link Command#withTimeout(double)} or {@link Command#withInterrupt(BooleanSupplier)} to give
* it one. If you only wish to execute a Runnable once, use {@link InstantCommand}.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class RunCommand extends CommandBase {
protected final Runnable m_toRun;

View File

@@ -10,6 +10,8 @@ import java.util.Set;
* Schedules the given commands when this command is initialized. Useful for forking off from
* CommandGroups. Note that if run from a CommandGroup, the group will not know about the status of
* the scheduled commands, and will treat this command as finishing instantly.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class ScheduleCommand extends CommandBase {
private final Set<Command> m_toSchedule;

View File

@@ -23,6 +23,8 @@ import java.util.function.Supplier;
* scheduled individually.
*
* <p>As a rule, CommandGroups require the union of the requirements of their component commands.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class SelectCommand extends CommandBase {
private final Map<Object, Command> m_commands;

View File

@@ -11,6 +11,8 @@ import java.util.List;
* A CommandGroups that runs a list of commands in sequence.
*
* <p>As a rule, CommandGroups require the union of the requirements of their component commands.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class SequentialCommandGroup extends CommandGroupBase {
private final List<Command> m_commands = new ArrayList<>();

View File

@@ -11,6 +11,8 @@ import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
* Useful for running and then stopping a motor, or extending and then retracting a solenoid. Has no
* end condition as-is; either subclass it or use {@link Command#withTimeout(double)} or {@link
* Command#withInterrupt(java.util.function.BooleanSupplier)} to give it one.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class StartEndCommand extends CommandBase {
protected final Runnable m_onInit;

View File

@@ -18,6 +18,8 @@ package edu.wpi.first.wpilibj2.command;
* Subsystem#periodic()} method to be called. It is recommended that this method be called from the
* constructor of users' Subsystem implementations. The {@link SubsystemBase} class offers a simple
* base for user implementations that handles this.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public interface Subsystem {
/**

View File

@@ -11,6 +11,8 @@ import edu.wpi.first.util.sendable.SendableRegistry;
/**
* A base for subsystems that handles registration in the constructor, and provides a more intuitive
* method for setting the default command.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public abstract class SubsystemBase implements Subsystem, Sendable {
/** Constructor. */

View File

@@ -28,6 +28,8 @@ import java.util.function.Supplier;
*
* <p>The robot angle controller does not follow the angle given by the trajectory but rather goes
* to the angle given in the final state of the trajectory.
*
* <p>This class is provided by the NewCommands VendorDep
*/
@SuppressWarnings("MemberName")
public class SwerveControllerCommand extends CommandBase {

View File

@@ -13,6 +13,8 @@ import java.util.function.Consumer;
/**
* A command that runs a {@link TrapezoidProfile}. Useful for smoothly controlling mechanism motion.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class TrapezoidProfileCommand extends CommandBase {
private final TrapezoidProfile m_profile;

View File

@@ -11,6 +11,8 @@ import edu.wpi.first.math.trajectory.TrapezoidProfile;
/**
* A subsystem that generates and runs trapezoidal motion profiles automatically. The user specifies
* how to use the current state of the motion profile by overriding the `useState` method.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public abstract class TrapezoidProfileSubsystem extends SubsystemBase {
private final double m_period;

View File

@@ -10,6 +10,8 @@ import edu.wpi.first.wpilibj.Timer;
/**
* A command that does nothing but takes a specified amount of time to finish. Useful for
* CommandGroups. Can also be subclassed to make a command with an internal timer.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class WaitCommand extends CommandBase {
protected Timer m_timer = new Timer();

View File

@@ -12,6 +12,8 @@ import java.util.function.BooleanSupplier;
/**
* A command that does nothing but ends after a specified match time or condition. Useful for
* CommandGroups.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class WaitUntilCommand extends CommandBase {
private final BooleanSupplier m_condition;

View File

@@ -17,6 +17,8 @@ import java.util.function.BooleanSupplier;
* <p>This class represents a subclass of Trigger that is specifically aimed at buttons on an
* operator interface as a common use case of the more generalized Trigger objects. This is a simple
* wrapper around Trigger with the method names renamed to fit the Button object use.
*
* <p>This class is provided by the OldCommands VendorDep
*/
public class Button extends Trigger {
/**

View File

@@ -7,6 +7,8 @@ package edu.wpi.first.wpilibj2.command.button;
/**
* This class is intended to be used within a program. The programmer can manually set its value.
* Also includes a setting for whether or not it should invert its value.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class InternalButton extends Button {
private boolean m_pressed;

View File

@@ -8,7 +8,11 @@ import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
import edu.wpi.first.wpilibj.GenericHID;
/** A {@link Button} that gets its state from a {@link GenericHID}. */
/**
* A {@link Button} that gets its state from a {@link GenericHID}.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class JoystickButton extends Button {
private final GenericHID m_joystick;
private final int m_buttonNumber;

View File

@@ -8,7 +8,11 @@ import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.networktables.NetworkTableInstance;
/** A {@link Button} that uses a {@link NetworkTable} boolean field. */
/**
* A {@link Button} that uses a {@link NetworkTable} boolean field.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class NetworkButton extends Button {
private final NetworkTableEntry m_entry;

View File

@@ -8,7 +8,11 @@ import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
import edu.wpi.first.wpilibj.GenericHID;
/** A {@link Button} that gets its state from a POV on a {@link GenericHID}. */
/**
* A {@link Button} that gets its state from a POV on a {@link GenericHID}.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class POVButton extends Button {
private final GenericHID m_joystick;
private final int m_angle;

View File

@@ -23,6 +23,8 @@ import java.util.function.BooleanSupplier;
* (for instance, if they want to react to the user holding a button while the robot is reading a
* certain sensor input). For this, they only have to write the {@link Trigger#get()} method to get
* the full functionality of the Trigger class.
*
* <p>This class is provided by the NewCommands VendorDep
*/
public class Trigger implements BooleanSupplier {
private final BooleanSupplier m_isActive;

View File

@@ -42,6 +42,8 @@ class ProxyScheduleCommand;
* <p>Note: ALWAYS create a subclass by extending CommandHelper<Base, Subclass>,
* or decorators will not function!
*
* This class is provided by the NewCommands VendorDep
*
* @see CommandScheduler
* @see CommandHelper
*/

View File

@@ -18,6 +18,8 @@
namespace frc2 {
/**
* A Sendable base class for Commands.
*
* This class is provided by the NewCommands VendorDep
*/
class CommandBase : public Command,
public wpi::Sendable,

View File

@@ -18,6 +18,8 @@ namespace frc2 {
* A base for CommandGroups. Statically tracks commands that have been
* allocated to groups to ensure those commands are not also used independently,
* which can result in inconsistent command state and unpredictable execution.
*
* This class is provided by the NewCommands VendorDep
*/
class CommandGroupBase : public CommandBase {
public:

View File

@@ -17,6 +17,8 @@ namespace frc2 {
*
* <p>Note: ALWAYS create a subclass by extending CommandHelper<Base, Subclass>,
* or decorators will not function!
*
* This class is provided by the NewCommands VendorDep
*/
template <typename Base, typename CRTP,
typename = std::enable_if_t<std::is_base_of_v<Command, Base>>>

View File

@@ -26,6 +26,8 @@ class Subsystem;
* commands synchronously from the main loop. Subsystems should be registered
* with the scheduler using RegisterSubsystem() in order for their Periodic()
* methods to be called and for their default commands to be scheduled.
*
* This class is provided by the NewCommands VendorDep
*/
class CommandScheduler final : public nt::NTSendable,
public wpi::SendableHelper<CommandScheduler> {

View File

@@ -10,6 +10,8 @@ namespace frc2 {
/**
* Class that holds scheduling state for a command. Used internally by the
* CommandScheduler
*
* This class is provided by the NewCommands VendorDep
*/
class CommandState final {
public:

View File

@@ -29,6 +29,8 @@ namespace frc2 {
* <p>As a rule, CommandGroups require the union of the requirements of their
* component commands.
*
* This class is provided by the NewCommands VendorDep
*
* @see ScheduleCommand
*/
class ConditionalCommand

View File

@@ -19,6 +19,8 @@ namespace frc2 {
* complex commands - note, however, that if a command is beyond a certain
* complexity it is usually better practice to write a proper class for it than
* to inline it.
*
* This class is provided by the NewCommands VendorDep
*/
class FunctionalCommand : public CommandHelper<CommandBase, FunctionalCommand> {
public:

View File

@@ -17,6 +17,8 @@ namespace frc2 {
* A Command that runs instantly; it will initialize, execute once, and end on
* the same iteration of the scheduler. Users can either pass in a Runnable and
* a set of requirements, or else subclass this command if desired.
*
* This class is provided by the NewCommands VendorDep
*/
class InstantCommand : public CommandHelper<CommandBase, InstantCommand> {
public:

View File

@@ -47,6 +47,8 @@ namespace frc2 {
* <p>The robot angle controller does not follow the angle given by
* the trajectory but rather goes to the angle given in the final state of the
* trajectory.
*
* This class is provided by the NewCommands VendorDep
*/
class MecanumControllerCommand
: public CommandHelper<CommandBase, MecanumControllerCommand> {

View File

@@ -24,6 +24,8 @@ namespace frc2 {
* <p>WARNING: Do not use this class unless you are confident in your ability to
* make the executed code thread-safe. If you do not know what "thread-safe"
* means, that is a good sign that you should not use this class.
*
* This class is provided by the NewCommands VendorDep
*/
class NotifierCommand : public CommandHelper<CommandBase, NotifierCommand> {
public:

View File

@@ -20,6 +20,8 @@ namespace frc2 {
* The controller calculation and output are performed synchronously in the
* command's execute() method.
*
* This class is provided by the NewCommands VendorDep
*
* @see PIDController
*/
class PIDCommand : public CommandHelper<CommandBase, PIDCommand> {

View File

@@ -13,6 +13,8 @@ namespace frc2 {
* A subsystem that uses a PIDController to control an output. The controller
* is run synchronously from the subsystem's periodic() method.
*
* This class is provided by the NewCommands VendorDep
*
* @see PIDController
*/
class PIDSubsystem : public SubsystemBase {

View File

@@ -23,6 +23,8 @@ namespace frc2 {
*
* <p>As a rule, CommandGroups require the union of the requirements of their
* component commands.
*
* This class is provided by the NewCommands VendorDep
*/
class ParallelCommandGroup
: public CommandHelper<CommandGroupBase, ParallelCommandGroup> {

View File

@@ -24,6 +24,8 @@ namespace frc2 {
*
* <p>As a rule, CommandGroups require the union of the requirements of their
* component commands.
*
* This class is provided by the NewCommands VendorDep
*/
class ParallelDeadlineGroup
: public CommandHelper<CommandGroupBase, ParallelDeadlineGroup> {

View File

@@ -23,6 +23,8 @@ namespace frc2 {
*
* <p>As a rule, CommandGroups require the union of the requirements of their
* component commands.
*
* This class is provided by the NewCommands VendorDep
*/
class ParallelRaceGroup
: public CommandHelper<CommandGroupBase, ParallelRaceGroup> {

View File

@@ -26,6 +26,8 @@ namespace frc2 {
*
* <p>As a rule, CommandGroups require the union of the requirements of their
* component commands.
*
* This class is provided by the NewCommands VendorDep
*/
class PerpetualCommand : public CommandHelper<CommandBase, PerpetualCommand> {
public:

View File

@@ -12,6 +12,8 @@
namespace frc2 {
/**
* A command that prints a string when initialized.
*
* This class is provided by the NewCommands VendorDep
*/
class PrintCommand : public CommandHelper<InstantCommand, PrintCommand> {
public:

View File

@@ -22,6 +22,8 @@ namespace frc2 {
* class. The controller calculation and output are performed synchronously in
* the command's execute() method.
*
* This class is provided by the NewCommands VendorDep
*
* @see ProfiledPIDController<Distance>
*/
template <class Distance>
@@ -95,7 +97,7 @@ class ProfiledPIDCommand
std::initializer_list<Subsystem*> requirements)
: ProfiledPIDCommand(
controller, measurementSource,
[&goalSource]() {
[goalSource = std::move(goalSource)]() {
return State{goalSource(), Velocity_t{0}};
},
useOutput, requirements) {}
@@ -117,7 +119,7 @@ class ProfiledPIDCommand
wpi::span<Subsystem* const> requirements = {})
: ProfiledPIDCommand(
controller, measurementSource,
[&goalSource]() {
[goalSource = std::move(goalSource)]() {
return State{goalSource(), Velocity_t{0}};
},
useOutput, requirements) {}

View File

@@ -14,6 +14,8 @@ namespace frc2 {
* A subsystem that uses a ProfiledPIDController to control an output. The
* controller is run synchronously from the subsystem's periodic() method.
*
* This class is provided by the NewCommands VendorDep
*
* @see ProfiledPIDController
*/
template <class Distance>

View File

@@ -17,6 +17,8 @@ namespace frc2 {
* all the commands are no longer scheduled. Useful for forking off from
* CommandGroups. If this command is interrupted, it will cancel all of the
* commands.
*
* This class is provided by the NewCommands VendorDep
*/
class ProxyScheduleCommand
: public CommandHelper<CommandBase, ProxyScheduleCommand> {

View File

@@ -37,6 +37,8 @@ namespace frc2 {
* secondary constructor that omits the PID and feedforward functionality,
* returning only the raw wheel speeds from the RAMSETE controller.
*
* This class is provided by the NewCommands VendorDep
*
* @see RamseteController
* @see Trajectory
*/

View File

@@ -18,6 +18,8 @@ namespace frc2 {
* either subclass it or use Command.WithTimeout() or
* Command.WithInterrupt() to give it one. If you only wish
* to execute a Runnable once, use InstantCommand.
*
* This class is provided by the NewCommands VendorDep
*/
class RunCommand : public CommandHelper<CommandBase, RunCommand> {
public:

View File

@@ -17,6 +17,8 @@ namespace frc2 {
* forking off from CommandGroups. Note that if run from a CommandGroup, the
* group will not know about the status of the scheduled commands, and will
* treat this command as finishing instantly.
*
* This class is provided by the NewCommands VendorDep
*/
class ScheduleCommand : public CommandHelper<CommandBase, ScheduleCommand> {
public:

View File

@@ -35,6 +35,8 @@ namespace frc2 {
*
* <p>As a rule, CommandGroups require the union of the requirements of their
* component commands.
*
* This class is provided by the NewCommands VendorDep
*/
template <typename Key>
class SelectCommand : public CommandHelper<CommandBase, SelectCommand<Key>> {

View File

@@ -29,6 +29,8 @@ const size_t invalid_index = std::numeric_limits<size_t>::max();
*
* <p>As a rule, CommandGroups require the union of the requirements of their
* component commands.
*
* This class is provided by the NewCommands VendorDep
*/
class SequentialCommandGroup
: public CommandHelper<CommandGroupBase, SequentialCommandGroup> {

View File

@@ -19,6 +19,8 @@ namespace frc2 {
* extending and then retracting a solenoid. Has no end condition as-is; either
* subclass it or use Command.WithTimeout() or Command.WithInterrupt() to give
* it one.
*
* This class is provided by the NewCommands VendorDep
*/
class StartEndCommand : public CommandHelper<CommandBase, StartEndCommand> {
public:

View File

@@ -29,6 +29,8 @@ class Command;
* SubsystemBase class offers a simple base for user implementations
* that handles this.
*
* This class is provided by the NewCommands VendorDep
*
* @see Command
* @see CommandScheduler
* @see SubsystemBase

View File

@@ -16,6 +16,8 @@ namespace frc2 {
/**
* A base for subsystems that handles registration in the constructor, and
* provides a more intuitive method for setting the default command.
*
* This class is provided by the NewCommands VendorDep
*/
class SubsystemBase : public Subsystem,
public wpi::Sendable,

View File

@@ -46,6 +46,8 @@ namespace frc2 {
* <p>The robot angle controller does not follow the angle given by
* the trajectory but rather goes to the angle given in the final state of the
* trajectory.
*
* This class is provided by the NewCommands VendorDep
*/
template <size_t NumModules>
class SwerveControllerCommand

View File

@@ -19,6 +19,8 @@ namespace frc2 {
* A command that runs a TrapezoidProfile. Useful for smoothly controlling
* mechanism motion.
*
* This class is provided by the NewCommands VendorDep
*
* @see TrapezoidProfile
*/
template <class Distance>

View File

@@ -14,6 +14,8 @@ namespace frc2 {
* A subsystem that generates and runs trapezoidal motion profiles
* automatically. The user specifies how to use the current state of the motion
* profile by overriding the `UseState` method.
*
* This class is provided by the NewCommands VendorDep
*/
template <class Distance>
class TrapezoidProfileSubsystem : public SubsystemBase {

View File

@@ -15,6 +15,8 @@ namespace frc2 {
* A command that does nothing but takes a specified amount of time to finish.
* Useful for CommandGroups. Can also be subclassed to make a command with an
* internal timer.
*
* This class is provided by the NewCommands VendorDep
*/
class WaitCommand : public CommandHelper<CommandBase, WaitCommand> {
public:

View File

@@ -15,6 +15,8 @@ namespace frc2 {
/**
* A command that does nothing but ends after a specified match time or
* condition. Useful for CommandGroups.
*
* This class is provided by the NewCommands VendorDep
*/
class WaitUntilCommand : public CommandHelper<CommandBase, WaitUntilCommand> {
public:

View File

@@ -18,6 +18,8 @@ class Command;
* A class used to bind command scheduling to button presses. Can be composed
* with other buttons with the operators in Trigger.
*
* This class is provided by the NewCommands VendorDep
*
* @see Trigger
*/
class Button : public Trigger {

View File

@@ -12,6 +12,8 @@ namespace frc2 {
* A class used to bind command scheduling to joystick button presses. Can be
* composed with other buttons with the operators in Trigger.
*
* This class is provided by the NewCommands VendorDep
*
* @see Trigger
*/
class JoystickButton : public Button {

View File

@@ -15,6 +15,8 @@
namespace frc2 {
/**
* A Button that uses a NetworkTable boolean field.
*
* This class is provided by the NewCommands VendorDep
*/
class NetworkButton : public Button {
public:

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