mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Fix typos with cspell (#6972)
This commit is contained in:
@@ -176,7 +176,7 @@ After that, run `cmake --build .` to create your JAR file. To execute the JAR fi
|
||||
|
||||
## Using vendordeps
|
||||
|
||||
Vendordeps are not included as part of the `wpilib` CMake package. However, if you want to use a vendordep, you need to use `find_package(VENDORDEP)`, where `VENDORDEP` is the name of the vendordep (case-sensitive), like `xrpVendordep` or `romiVenderdep`. Note that wpilibNewCommands, while a vendordep in normal robot projects, is not built as a vendordep in CMake, and is instead included as part of the `wpilib` CMake package. After you used `find_package`, you can reference the vendordep library like normal, either by using `target_link_libraries` for C++ or `add_jar` for Java.
|
||||
Vendordeps are not included as part of the `wpilib` CMake package. However, if you want to use a vendordep, you need to use `find_package(VENDORDEP)`, where `VENDORDEP` is the name of the vendordep (case-sensitive), like `xrpVendordep` or `romiVendordep`. Note that wpilibNewCommands, while a vendordep in normal robot projects, is not built as a vendordep in CMake, and is instead included as part of the `wpilib` CMake package. After you used `find_package`, you can reference the vendordep library like normal, either by using `target_link_libraries` for C++ or `add_jar` for Java.
|
||||
|
||||
## Troubleshooting
|
||||
Below are some common issues that are run into when building.
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* An event listener. This calls back to a desigated callback function when an event matching the
|
||||
* An event listener. This calls back to a designated callback function when an event matching the
|
||||
* specified mask is generated by the library.
|
||||
*/
|
||||
public class VideoListener implements AutoCloseable {
|
||||
|
||||
@@ -230,7 +230,7 @@ inline void CvSource::PutFrame(cv::Mat& image) {
|
||||
int channels = finalImage.channels();
|
||||
VideoMode::PixelFormat format;
|
||||
if (channels == 1) {
|
||||
// 1 channel is assumed Graysacle
|
||||
// 1 channel is assumed Grayscale
|
||||
format = VideoMode::PixelFormat::kGray;
|
||||
} else if (channels == 2) {
|
||||
// 2 channels is assumed YUYV
|
||||
|
||||
@@ -524,7 +524,7 @@ class VideoCamera : public VideoSource {
|
||||
void SetWhiteBalanceManual(int value);
|
||||
|
||||
/**
|
||||
* Set the exposure to auto aperature.
|
||||
* Set the exposure to auto aperture.
|
||||
*/
|
||||
void SetExposureAuto();
|
||||
|
||||
@@ -1148,7 +1148,7 @@ class VideoEvent : public RawEvent {
|
||||
};
|
||||
|
||||
/**
|
||||
* An event listener. This calls back to a desigated callback function when
|
||||
* An event listener. This calls back to a designated callback function when
|
||||
* an event matching the specified mask is generated by the library.
|
||||
*/
|
||||
class VideoListener {
|
||||
|
||||
@@ -7,7 +7,7 @@ package edu.wpi.first.hal;
|
||||
/**
|
||||
* Addressable LED HAL JNI Methods.
|
||||
*
|
||||
* @see "hal/AdressableLED.h"
|
||||
* @see "hal/AddressableLED.h"
|
||||
*/
|
||||
public class AddressableLEDJNI extends JNIWrapper {
|
||||
/**
|
||||
|
||||
@@ -111,7 +111,7 @@ public class AnalogGyroJNI extends JNIWrapper {
|
||||
* <p>Can be used to not repeat a calibration but reconstruct the gyro object.
|
||||
*
|
||||
* @param handle the gyro handle
|
||||
* @return the gryo offset
|
||||
* @return the gyro offset
|
||||
* @see "HAL_GetAnalogGyroOffset"
|
||||
*/
|
||||
public static native double getAnalogGyroOffset(int handle);
|
||||
|
||||
@@ -514,7 +514,7 @@ public class AnalogJNI extends JNIWrapper {
|
||||
public static native boolean getAnalogTriggerOutput(int analogTriggerHandle, int type);
|
||||
|
||||
/**
|
||||
* Get the FPGA index for the AnlogTrigger.
|
||||
* Get the FPGA index for the AnalogTrigger.
|
||||
*
|
||||
* @param analogTriggerHandle the trigger handle
|
||||
* @return the FPGA index
|
||||
|
||||
@@ -243,7 +243,7 @@ public class DriverStationJNI extends JNIWrapper {
|
||||
* @param rawAxesArray all joystick axes as int
|
||||
* @param povsArray all povs
|
||||
* @param buttonsAndMetadata array of long joystick axes count, long joystick povs count, long
|
||||
* jostick buttons count, long joystick buttons values
|
||||
* joystick buttons count, long joystick buttons values
|
||||
* @see "HAL_GetAllJoystickData"
|
||||
*/
|
||||
public static native void getAllJoystickData(
|
||||
|
||||
@@ -27,7 +27,7 @@ public class REVPHJNI extends JNIWrapper {
|
||||
*
|
||||
* @param module the CAN ID to initialize
|
||||
* @return the created PH handle
|
||||
* @see "HAL_InitializeREVP"
|
||||
* @see "HAL_InitializeREVPH"
|
||||
*/
|
||||
public static native int initialize(int module);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
package edu.wpi.first.hal.util;
|
||||
|
||||
/**
|
||||
* Exception indicating that the resource is already allocated This is meant to be thrown by the
|
||||
* Exception indicating that the resource is already allocated. This is meant to be thrown by the
|
||||
* resource class.
|
||||
*/
|
||||
public class CheckedAllocationException extends Exception {
|
||||
|
||||
@@ -159,8 +159,8 @@ void HAL_SetDMAPause(HAL_DMAHandle handle, HAL_Bool pause, int32_t* status) {
|
||||
|
||||
void HAL_SetDMATimedTrigger(HAL_DMAHandle handle, double seconds,
|
||||
int32_t* status) {
|
||||
constexpr double baseMultipler = kSystemClockTicksPerMicrosecond * 1000000;
|
||||
uint32_t cycles = static_cast<uint32_t>(baseMultipler * seconds);
|
||||
constexpr double baseMultiplier = kSystemClockTicksPerMicrosecond * 1000000;
|
||||
uint32_t cycles = static_cast<uint32_t>(baseMultiplier * seconds);
|
||||
HAL_SetDMATimedTriggerCycles(handle, cycles, status);
|
||||
}
|
||||
|
||||
@@ -564,7 +564,7 @@ int32_t HAL_SetDMAExternalTrigger(HAL_DMAHandle handle,
|
||||
if (!success) {
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
hal::SetLastError(status,
|
||||
"Digital Source unabled to be mapped properly. Likely "
|
||||
"Digital Source unable to be mapped properly. Likely "
|
||||
"invalid handle passed.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace detail {
|
||||
wpi::mutex& UnsafeGetDIOMutex() {
|
||||
return digitalDIOMutex;
|
||||
}
|
||||
tDIO* UnsafeGetDigialSystem() {
|
||||
tDIO* UnsafeGetDigitalSystem() {
|
||||
return digitalSystem.get();
|
||||
}
|
||||
int32_t ComputeDigitalMask(HAL_DigitalHandle handle, int32_t* status) {
|
||||
|
||||
@@ -479,7 +479,7 @@ HAL_Bool HAL_GetSystemTimeValid(int32_t* status) {
|
||||
static bool killExistingProgram(int timeout, int mode) {
|
||||
// Kill any previous robot programs
|
||||
std::fstream fs;
|
||||
// By making this both in/out, it won't give us an error if it doesnt exist
|
||||
// By making this both in/out, it won't give us an error if it doesn't exist
|
||||
fs.open("/var/lock/frc.pid", std::fstream::in | std::fstream::out);
|
||||
if (fs.bad()) {
|
||||
return false;
|
||||
|
||||
@@ -18,7 +18,7 @@ DEFINE_CAPI(double, X, 0)
|
||||
DEFINE_CAPI(double, Y, 0)
|
||||
DEFINE_CAPI(double, Z, 0)
|
||||
|
||||
void HALSIM_RegisterSPIAccelerometerAllCallbcaks(int32_t index,
|
||||
void HALSIM_RegisterSPIAccelerometerAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {}
|
||||
|
||||
@@ -129,7 +129,7 @@ double HAL_GetAnalogGyroRate(HAL_GyroHandle handle, int32_t* status);
|
||||
*
|
||||
* @param[in] handle the gyro handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return the gryo offset
|
||||
* @return the gyro offset
|
||||
*/
|
||||
double HAL_GetAnalogGyroOffset(HAL_GyroHandle handle, int32_t* status);
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ HAL_Bool HAL_GetAnalogTriggerOutput(HAL_AnalogTriggerHandle analogTriggerHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Get the FPGA index for the AnlogTrigger.
|
||||
* Get the FPGA index for the AnalogTrigger.
|
||||
*
|
||||
* @param[in] analogTriggerHandle the trigger handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
|
||||
@@ -57,7 +57,7 @@ struct DIOSetProxy {
|
||||
};
|
||||
namespace detail {
|
||||
wpi::mutex& UnsafeGetDIOMutex();
|
||||
tDIO* UnsafeGetDigialSystem();
|
||||
tDIO* UnsafeGetDigitalSystem();
|
||||
int32_t ComputeDigitalMask(HAL_DigitalHandle handle, int32_t* status);
|
||||
} // namespace detail
|
||||
|
||||
@@ -81,7 +81,7 @@ void UnsafeManipulateDIO(HAL_DigitalHandle handle, int32_t* status,
|
||||
return;
|
||||
}
|
||||
wpi::mutex& dioMutex = detail::UnsafeGetDIOMutex();
|
||||
tDIO* dSys = detail::UnsafeGetDigialSystem();
|
||||
tDIO* dSys = detail::UnsafeGetDigitalSystem();
|
||||
auto mask = detail::ComputeDigitalMask(handle, status);
|
||||
if (*status != 0) {
|
||||
return;
|
||||
|
||||
@@ -50,7 +50,7 @@ void HALSIM_CancelSPIAccelerometerZCallback(int32_t index, int32_t uid);
|
||||
double HALSIM_GetSPIAccelerometerZ(int32_t index);
|
||||
void HALSIM_SetSPIAccelerometerZ(int32_t index, double z);
|
||||
|
||||
void HALSIM_RegisterSPIAccelerometerAllCallbcaks(int32_t index,
|
||||
void HALSIM_RegisterSPIAccelerometerAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify);
|
||||
|
||||
@@ -42,7 +42,7 @@ DEFINE_CAPI(double, Z, z)
|
||||
SimSPIAccelerometerData[index].NAME.RegisterCallback(callback, param, \
|
||||
initialNotify)
|
||||
|
||||
void HALSIM_RegisterSPIAccelerometerAllCallbcaks(int32_t index,
|
||||
void HALSIM_RegisterSPIAccelerometerAllCallbacks(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param,
|
||||
HAL_Bool initialNotify) {
|
||||
|
||||
@@ -12,7 +12,7 @@ A pub/sub WebSockets protocol based on NetworkTables concepts.
|
||||
|
||||
While NetworkTables 4.0 made a large number of improvements to the 3.0 protocol, a few weaknesses have been discovered in "real world" use:
|
||||
|
||||
* Keep alives are not required. This can result in very long timeframes before a disconnect is detected.
|
||||
* Keepalives are not required. This can result in very long timeframes before a disconnect is detected.
|
||||
* Periodic synchronization of timestamps is impacted by high variability of round trip time measurements on a stream connection shared with other data (due to network queueing in adverse network connections), resulting in values being "too old" even if actually more recent due to a change in base time
|
||||
* Disconnect loops can be caused by large amounts of data values being sent in response to a "subscribe all" type of message (e.g. subscribe with empty or `$` prefix), resulting in data transmission being blocked for an excessive amount of time
|
||||
* Publishing operations are not clearly subscriber-driven; the information is available via metatopics but not automatically sent to clients when clients publish
|
||||
|
||||
@@ -448,7 +448,7 @@ public final class NetworkTablesJNI {
|
||||
public static native void releaseEntry(int entry);
|
||||
|
||||
/**
|
||||
* Relesaes pubsub entry.
|
||||
* Releases pubsub entry.
|
||||
*
|
||||
* @param pubsubentry Pubsub entry handle.
|
||||
*/
|
||||
@@ -1002,7 +1002,7 @@ public final class NetworkTablesJNI {
|
||||
/**
|
||||
* Returns the current timestamp in microseconds.
|
||||
*
|
||||
* @return The current timestsamp in microseconds.
|
||||
* @return The current timestamp in microseconds.
|
||||
*/
|
||||
public static native long now();
|
||||
|
||||
|
||||
@@ -448,7 +448,7 @@ public final class NetworkTablesJNI {
|
||||
public static native void releaseEntry(int entry);
|
||||
|
||||
/**
|
||||
* Relesaes pubsub entry.
|
||||
* Releases pubsub entry.
|
||||
*
|
||||
* @param pubsubentry Pubsub entry handle.
|
||||
*/
|
||||
@@ -1542,7 +1542,7 @@ public final class NetworkTablesJNI {
|
||||
/**
|
||||
* Returns the current timestamp in microseconds.
|
||||
*
|
||||
* @return The current timestsamp in microseconds.
|
||||
* @return The current timestamp in microseconds.
|
||||
*/
|
||||
public static native long now();
|
||||
|
||||
|
||||
@@ -759,7 +759,7 @@ TEST_F(LocalStorageNumberVariantsTest, GetEntryPubAfter) {
|
||||
EXPECT_EQ(storage.GetEntryValue(sub2), Value::MakeInteger(1, 50));
|
||||
EXPECT_EQ(storage.GetEntryValue(sub3), Value::MakeFloat(1.0, 50));
|
||||
EXPECT_EQ(storage.GetEntryValue(sub4), Value{});
|
||||
// entrys just get whatever the value is
|
||||
// entries just get whatever the value is
|
||||
EXPECT_EQ(storage.GetEntryValue(entry), Value::MakeDouble(1.0, 50));
|
||||
}
|
||||
|
||||
@@ -781,7 +781,7 @@ TEST_F(LocalStorageNumberVariantsTest, GetEntryPubBefore) {
|
||||
EXPECT_EQ(storage.GetEntryValue(sub2), Value::MakeInteger(1, 50));
|
||||
EXPECT_EQ(storage.GetEntryValue(sub3), Value::MakeFloat(1.0, 50));
|
||||
EXPECT_EQ(storage.GetEntryValue(sub4), Value{});
|
||||
// entrys just get whatever the value is
|
||||
// entries just get whatever the value is
|
||||
EXPECT_EQ(storage.GetEntryValue(entry), Value::MakeDouble(1.0, 50));
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ class AnalysisManager {
|
||||
std::string_view GetUnit() const { return m_data.distanceUnit; }
|
||||
|
||||
/**
|
||||
* Returns a reference to the iterator of the currently selected raw datset.
|
||||
* Returns a reference to the iterator of the currently selected raw dataset.
|
||||
* Unfortunately, due to ImPlot internals, the reference cannot be const so
|
||||
* the user should be careful not to change any data.
|
||||
*
|
||||
@@ -264,7 +264,7 @@ class AnalysisManager {
|
||||
|
||||
/**
|
||||
* Returns a reference to the iterator of the currently selected filtered
|
||||
* datset. Unfortunately, due to ImPlot internals, the reference cannot be
|
||||
* dataset. Unfortunately, due to ImPlot internals, the reference cannot be
|
||||
* const so the user should be careful not to change any data.
|
||||
*
|
||||
* @return A reference to the filtered internal data.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace sysid {
|
||||
|
||||
struct OLSResult {
|
||||
/// Regression coeficients.
|
||||
/// Regression coefficients.
|
||||
std::vector<double> coeffs;
|
||||
|
||||
/// R² (coefficient of determination)
|
||||
|
||||
@@ -319,7 +319,7 @@ public abstract class Command implements Sendable {
|
||||
* commands with {@link CommandScheduler#removeComposedCommand(Command)}. The command composition
|
||||
* returned from this method can be further decorated without issue.
|
||||
*
|
||||
* @param parallel the commands to run in parallel. Note the parallel commands will be interupted
|
||||
* @param parallel the commands to run in parallel. Note the parallel commands will be interrupted
|
||||
* when the deadline command ends
|
||||
* @return the decorated command
|
||||
*/
|
||||
|
||||
@@ -200,7 +200,7 @@ public final class Commands {
|
||||
* @param supplier the command supplier
|
||||
* @return the command
|
||||
* @deprecated The ProxyCommand supplier constructor has been deprecated in favor of directly
|
||||
* proxying a {@link DeferredCommand}, see ProxyCommand documentaion for more details. As a
|
||||
* proxying a {@link DeferredCommand}, see ProxyCommand documentation for more details. As a
|
||||
* replacement, consider using `defer(supplier).asProxy()`.
|
||||
* @see ProxyCommand
|
||||
*/
|
||||
|
||||
@@ -148,7 +148,7 @@ void PneumaticHub::EnableCompressorAnalog(
|
||||
units::pounds_per_square_inch_t maxPressure) {
|
||||
if (minPressure >= maxPressure) {
|
||||
throw FRC_MakeError(err::InvalidParameter,
|
||||
"maxPressure must be greater than minPresure");
|
||||
"maxPressure must be greater than minPressure");
|
||||
}
|
||||
if (minPressure < 0_psi || minPressure > 120_psi) {
|
||||
throw FRC_MakeError(err::ParameterOutOfRange,
|
||||
@@ -178,7 +178,7 @@ void PneumaticHub::EnableCompressorHybrid(
|
||||
units::pounds_per_square_inch_t maxPressure) {
|
||||
if (minPressure >= maxPressure) {
|
||||
throw FRC_MakeError(err::InvalidParameter,
|
||||
"maxPressure must be greater than minPresure");
|
||||
"maxPressure must be greater than minPressure");
|
||||
}
|
||||
if (minPressure < 0_psi || minPressure > 120_psi) {
|
||||
throw FRC_MakeError(err::ParameterOutOfRange,
|
||||
|
||||
@@ -35,7 +35,7 @@ class AnalogTrigger;
|
||||
* / down counter or to interrupts. Because the outputs generate a pulse, they
|
||||
* cannot be read directly. To help ensure that a rollover condition is not
|
||||
* missed, there is an average rejection filter available that operates on the
|
||||
* upper 8 bits of a 12 bit number and selects the nearest outlyer of 3 samples.
|
||||
* upper 8 bits of a 12 bit number and selects the nearest outlier of 3 samples.
|
||||
* This will reject a sample that is (due to averaging or sampling) errantly
|
||||
* between the two limits. This filter will fail if more than one sample in a
|
||||
* row is errantly in between the two limits. You may see this problem if
|
||||
|
||||
@@ -47,8 +47,8 @@ class Counter : public CounterBase,
|
||||
/**
|
||||
* Create an instance of a counter where no sources are selected.
|
||||
*
|
||||
* They all must be selected by calling functions to specify the upsource and
|
||||
* the downsource independently.
|
||||
* They all must be selected by calling functions to specify the up source and
|
||||
* the down source independently.
|
||||
*
|
||||
* This creates a ChipObject counter and initializes status variables
|
||||
* appropriately.
|
||||
@@ -148,7 +148,7 @@ class Counter : public CounterBase,
|
||||
Counter& operator=(Counter&&) = default;
|
||||
|
||||
/**
|
||||
* Set the upsource for the counter as a digital input channel.
|
||||
* Set the up source for the counter as a digital input channel.
|
||||
*
|
||||
* @param channel The DIO channel to use as the up source. 0-9 are on-board,
|
||||
* 10-25 are on the MXP
|
||||
|
||||
@@ -34,7 +34,7 @@ class SerialPort {
|
||||
kOnboard = 0,
|
||||
/// MXP (roboRIO MXP) serial port.
|
||||
kMXP = 1,
|
||||
/// USB serial port (same as KUSB1).
|
||||
/// USB serial port (same as kUSB1).
|
||||
kUSB = 2,
|
||||
/// USB serial port 1.
|
||||
kUSB1 = 2,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace frc::sim {
|
||||
|
||||
TEST(AcclerometerSimTest, ActiveCallback) {
|
||||
TEST(AccelerometerSimTest, ActiveCallback) {
|
||||
HAL_Initialize(500, 0);
|
||||
|
||||
BuiltInAccelerometerSim sim;
|
||||
@@ -39,7 +39,7 @@ TEST(AcclerometerSimTest, ActiveCallback) {
|
||||
EXPECT_TRUE(sim.GetActive());
|
||||
}
|
||||
|
||||
TEST(AcclerometerSimTest, SetX) {
|
||||
TEST(AccelerometerSimTest, SetX) {
|
||||
HAL_Initialize(500, 0);
|
||||
BuiltInAccelerometerSim sim;
|
||||
sim.ResetData();
|
||||
@@ -56,7 +56,7 @@ TEST(AcclerometerSimTest, SetX) {
|
||||
EXPECT_EQ(kTestValue, callback.GetLastValue());
|
||||
}
|
||||
|
||||
TEST(AcclerometerSimTest, SetY) {
|
||||
TEST(AccelerometerSimTest, SetY) {
|
||||
HAL_Initialize(500, 0);
|
||||
BuiltInAccelerometerSim sim;
|
||||
sim.ResetData();
|
||||
@@ -73,7 +73,7 @@ TEST(AcclerometerSimTest, SetY) {
|
||||
EXPECT_EQ(kTestValue, callback.GetLastValue());
|
||||
}
|
||||
|
||||
TEST(AcclerometerSimTest, SetZ) {
|
||||
TEST(AccelerometerSimTest, SetZ) {
|
||||
HAL_Initialize(500, 0);
|
||||
|
||||
BuiltInAccelerometer accel;
|
||||
@@ -91,7 +91,7 @@ TEST(AcclerometerSimTest, SetZ) {
|
||||
EXPECT_EQ(kTestValue, callback.GetLastValue());
|
||||
}
|
||||
|
||||
TEST(AcclerometerSimTest, SetRange) {
|
||||
TEST(AccelerometerSimTest, SetRange) {
|
||||
HAL_Initialize(500, 0);
|
||||
|
||||
BuiltInAccelerometerSim sim;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace frc::sim {
|
||||
|
||||
TEST(RelaySimTest, InitializationBidrectional) {
|
||||
TEST(RelaySimTest, InitializationBidirectional) {
|
||||
HAL_Initialize(500, 0);
|
||||
|
||||
RelaySim sim(0);
|
||||
|
||||
@@ -30,7 +30,7 @@ class Robot : public frc::TimedRobot {
|
||||
|
||||
// Set setpoint and measurement of the bang-bang controller
|
||||
units::volt_t bangOutput =
|
||||
m_bangBangControler.Calculate(m_encoder.GetRate(), setpoint.value()) *
|
||||
m_bangBangController.Calculate(m_encoder.GetRate(), setpoint.value()) *
|
||||
12_V;
|
||||
|
||||
// Controls a motor with the output of the BangBang controller and a
|
||||
@@ -41,8 +41,8 @@ class Robot : public frc::TimedRobot {
|
||||
}
|
||||
|
||||
Robot() {
|
||||
// Add bang-bang controler to SmartDashboard and networktables.
|
||||
frc::SmartDashboard::PutData("BangBangControler", &m_bangBangControler);
|
||||
// Add bang-bang controller to SmartDashboard and networktables.
|
||||
frc::SmartDashboard::PutData("BangBangController", &m_bangBangController);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ class Robot : public frc::TimedRobot {
|
||||
frc::PWMSparkMax m_flywheelMotor{kMotorPort};
|
||||
frc::Encoder m_encoder{kEncoderAChannel, kEncoderBChannel};
|
||||
|
||||
frc::BangBangController m_bangBangControler;
|
||||
frc::BangBangController m_bangBangController;
|
||||
|
||||
// Gains are for example purposes only - must be determined for your own
|
||||
// robot!
|
||||
|
||||
@@ -58,7 +58,7 @@ if(WITH_JAVA_SOURCE)
|
||||
# Generate version file if it wasn't generated already
|
||||
if(NOT WITH_JAVA)
|
||||
configure_file(
|
||||
src/generate/WPILi1bVersion.java.in
|
||||
src/generate/WPILibVersion.java.in
|
||||
generated/main/java/edu/wpi/first/wpilibj/WPILibVersion.java
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -90,7 +90,7 @@ public class Counter implements CounterBase, Sendable, AutoCloseable {
|
||||
|
||||
/**
|
||||
* Create an instance of a counter where no sources are selected. Then they all must be selected
|
||||
* by calling functions to specify the upsource and the downsource independently.
|
||||
* by calling functions to specify the up source and the down source independently.
|
||||
*
|
||||
* <p>The counter will start counting immediately.
|
||||
*/
|
||||
@@ -212,7 +212,7 @@ public class Counter implements CounterBase, Sendable, AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the upsource for the counter as a digital input channel.
|
||||
* Set the up source for the counter as a digital input channel.
|
||||
*
|
||||
* @param channel the DIO channel to count 0-9 are on-board, 10-25 are on the MXP
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,7 @@ public class SerialPort implements AutoCloseable {
|
||||
kOnboard(0),
|
||||
/** MXP (roboRIO MXP) serial port. */
|
||||
kMXP(1),
|
||||
/** USB serial port (same as KUSB1). */
|
||||
/** USB serial port (same as kUSB1). */
|
||||
kUSB(2),
|
||||
/** USB serial port 1. */
|
||||
kUSB1(2),
|
||||
|
||||
@@ -32,7 +32,7 @@ public abstract class RobotDriveBase extends MotorSafety {
|
||||
kFrontRight(1),
|
||||
/** Rear left motor. */
|
||||
kRearLeft(2),
|
||||
/** Reat right motor. */
|
||||
/** Rear right motor. */
|
||||
kRearRight(3),
|
||||
/** Left motor. */
|
||||
kLeft(0),
|
||||
|
||||
@@ -102,7 +102,7 @@ public class DifferentialDrivetrainSim {
|
||||
* @param driveMotor A {@link DCMotor} representing the drivetrain.
|
||||
* @param gearing The gearingRatio ratio of the robot, as output over input. This must be the same
|
||||
* ratio as the ratio used to identify or create the drivetrainPlant.
|
||||
* @param trackWidthMeters The distance between the two sides of the drivetrian. Can be found with
|
||||
* @param trackWidthMeters The distance between the two sides of the drivetrain. Can be found with
|
||||
* SysId.
|
||||
* @param wheelRadiusMeters The radius of the wheels on the drivetrain, in meters.
|
||||
* @param measurementStdDevs Standard deviations for measurements, in the form [x, y, heading,
|
||||
|
||||
@@ -41,7 +41,7 @@ public class Robot extends TimedRobot {
|
||||
private final PWMSparkMax m_flywheelMotor = new PWMSparkMax(kMotorPort);
|
||||
private final Encoder m_encoder = new Encoder(kEncoderAChannel, kEncoderBChannel);
|
||||
|
||||
private final BangBangController m_bangBangControler = new BangBangController();
|
||||
private final BangBangController m_bangBangController = new BangBangController();
|
||||
|
||||
// Gains are for example purposes only - must be determined for your own robot!
|
||||
public static final double kFlywheelKs = 0.0001; // V
|
||||
@@ -69,8 +69,8 @@ public class Robot extends TimedRobot {
|
||||
private final EncoderSim m_encoderSim = new EncoderSim(m_encoder);
|
||||
|
||||
public Robot() {
|
||||
// Add bang-bang controler to SmartDashboard and networktables.
|
||||
SmartDashboard.putData(m_bangBangControler);
|
||||
// Add bang-bang controller to SmartDashboard and networktables.
|
||||
SmartDashboard.putData(m_bangBangController);
|
||||
}
|
||||
|
||||
/** Controls flywheel to a set speed (RPM) controlled by a joystick. */
|
||||
@@ -84,7 +84,7 @@ public class Robot extends TimedRobot {
|
||||
* Units.rotationsPerMinuteToRadiansPerSecond(kMaxSetpointValue));
|
||||
|
||||
// Set setpoint and measurement of the bang-bang controller
|
||||
double bangOutput = m_bangBangControler.calculate(m_encoder.getRate(), setpoint) * 12.0;
|
||||
double bangOutput = m_bangBangController.calculate(m_encoder.getRate(), setpoint) * 12.0;
|
||||
|
||||
// Controls a motor with the output of the BangBang controller and a
|
||||
// feedforward. The feedforward is reduced slightly to avoid overspeeding
|
||||
|
||||
@@ -18,7 +18,7 @@ import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax;
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
private static final double kAngleSetpoint = 0.0;
|
||||
private static final double kP = 0.005; // propotional turning constant
|
||||
private static final double kP = 0.005; // proportional turning constant
|
||||
|
||||
// gyro calibration constant, may need to be adjusted;
|
||||
// gyro value of 360 is set to correspond to one full revolution
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.ejml.simple.SimpleMatrix;
|
||||
*
|
||||
* <p>States is the dimensionality of the state. 2*States+1 weights will be generated.
|
||||
*
|
||||
* <p>[1] R. Van der Merwe "Sigma-Point Kalman Filters for Probabilitic Inference in Dynamic
|
||||
* <p>[1] R. Van der Merwe "Sigma-Point Kalman Filters for Probabilistic Inference in Dynamic
|
||||
* State-Space Models" (Doctoral dissertation)
|
||||
*
|
||||
* @param <S> The dimensionality of the state. 2 * States + 1 weights will be generated.
|
||||
|
||||
@@ -22,7 +22,7 @@ public final class DAREJNI extends WPIMathJNI {
|
||||
* </ul>
|
||||
*
|
||||
* <p>Only use this function if you're sure the preconditions are met. Solves the discrete
|
||||
* alegebraic Riccati equation.
|
||||
* algebraic Riccati equation.
|
||||
*
|
||||
* @param A Array containing elements of A in row-major order.
|
||||
* @param B Array containing elements of B in row-major order.
|
||||
|
||||
@@ -159,7 +159,7 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable {
|
||||
/**
|
||||
* Discretizes a continuous-time chassis speed.
|
||||
*
|
||||
* <p>This function converts a continous-time chassis speed into a discrete-time one such that
|
||||
* <p>This function converts a continuous-time chassis speed into a discrete-time one such that
|
||||
* when the discrete-time chassis speed is applied for one timestep, the robot moves as if the
|
||||
* velocity components are independent (i.e., the robot moves v_x * dt along the x-axis, v_y * dt
|
||||
* along the y-axis, and omega * dt around the z-axis).
|
||||
|
||||
@@ -23,11 +23,11 @@ public class DifferentialDriveWheelPositions
|
||||
/** Distance measured by the right side. */
|
||||
public double rightMeters;
|
||||
|
||||
/** DifferentialDriveWheelPostions struct for serialization. */
|
||||
/** DifferentialDriveWheelPositions struct for serialization. */
|
||||
public static final DifferentialDriveWheelPositionsStruct struct =
|
||||
new DifferentialDriveWheelPositionsStruct();
|
||||
|
||||
/** DifferentialDriveWheelPostions struct for serialization. */
|
||||
/** DifferentialDriveWheelPositions struct for serialization. */
|
||||
public static final DifferentialDriveWheelPositionsProto proto =
|
||||
new DifferentialDriveWheelPositionsProto();
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ public final class NumericalIntegration {
|
||||
/**
|
||||
* Performs 4th order Runge-Kutta integration of dx/dt = f(x) for dt.
|
||||
*
|
||||
* @param <States> A Num prepresenting the states of the system.
|
||||
* @param <States> A Num representing the states of the system.
|
||||
* @param f The function to integrate. It must take one argument x.
|
||||
* @param x The initial value of x.
|
||||
* @param dtSeconds The time over which to integrate.
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ExponentialProfile {
|
||||
/**
|
||||
* Computes the max achievable velocity for an Exponential Profile.
|
||||
*
|
||||
* @return The seady-state velocity achieved by this profile.
|
||||
* @return The steady-state velocity achieved by this profile.
|
||||
*/
|
||||
public double maxVelocity() {
|
||||
return -maxInput * B / A;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TrapezoidProfile {
|
||||
|
||||
private double m_endAccel;
|
||||
private double m_endFullSpeed;
|
||||
private double m_endDeccel;
|
||||
private double m_endDecel;
|
||||
|
||||
/** Profile constraints. */
|
||||
public static class Constraints {
|
||||
@@ -185,7 +185,7 @@ public class TrapezoidProfile {
|
||||
|
||||
m_endAccel = accelerationTime - cutoffBegin;
|
||||
m_endFullSpeed = m_endAccel + fullSpeedDist / m_constraints.maxVelocity;
|
||||
m_endDeccel = m_endFullSpeed + accelerationTime - cutoffEnd;
|
||||
m_endDecel = m_endFullSpeed + accelerationTime - cutoffEnd;
|
||||
State result = new State(m_current.position, m_current.velocity);
|
||||
|
||||
if (t < m_endAccel) {
|
||||
@@ -196,9 +196,9 @@ public class TrapezoidProfile {
|
||||
result.position +=
|
||||
(m_current.velocity + m_endAccel * m_constraints.maxAcceleration / 2.0) * m_endAccel
|
||||
+ m_constraints.maxVelocity * (t - m_endAccel);
|
||||
} else if (t <= m_endDeccel) {
|
||||
result.velocity = goal.velocity + (m_endDeccel - t) * m_constraints.maxAcceleration;
|
||||
double timeLeft = m_endDeccel - t;
|
||||
} else if (t <= m_endDecel) {
|
||||
result.velocity = goal.velocity + (m_endDecel - t) * m_constraints.maxAcceleration;
|
||||
double timeLeft = m_endDecel - t;
|
||||
result.position =
|
||||
goal.position
|
||||
- (goal.velocity + timeLeft * m_constraints.maxAcceleration / 2.0) * timeLeft;
|
||||
@@ -232,7 +232,7 @@ public class TrapezoidProfile {
|
||||
endFullSpeed = Math.max(endFullSpeed, 0);
|
||||
|
||||
final double acceleration = m_constraints.maxAcceleration;
|
||||
final double decceleration = -m_constraints.maxAcceleration;
|
||||
final double deceleration = -m_constraints.maxAcceleration;
|
||||
|
||||
double distToTarget = Math.abs(target - position);
|
||||
if (distToTarget < 1e-6) {
|
||||
@@ -241,40 +241,39 @@ public class TrapezoidProfile {
|
||||
|
||||
double accelDist = velocity * endAccel + 0.5 * acceleration * endAccel * endAccel;
|
||||
|
||||
double deccelVelocity;
|
||||
double decelVelocity;
|
||||
if (endAccel > 0) {
|
||||
deccelVelocity = Math.sqrt(Math.abs(velocity * velocity + 2 * acceleration * accelDist));
|
||||
decelVelocity = Math.sqrt(Math.abs(velocity * velocity + 2 * acceleration * accelDist));
|
||||
} else {
|
||||
deccelVelocity = velocity;
|
||||
decelVelocity = velocity;
|
||||
}
|
||||
|
||||
double fullSpeedDist = m_constraints.maxVelocity * endFullSpeed;
|
||||
double deccelDist;
|
||||
double decelDist;
|
||||
|
||||
if (accelDist > distToTarget) {
|
||||
accelDist = distToTarget;
|
||||
fullSpeedDist = 0;
|
||||
deccelDist = 0;
|
||||
decelDist = 0;
|
||||
} else if (accelDist + fullSpeedDist > distToTarget) {
|
||||
fullSpeedDist = distToTarget - accelDist;
|
||||
deccelDist = 0;
|
||||
decelDist = 0;
|
||||
} else {
|
||||
deccelDist = distToTarget - fullSpeedDist - accelDist;
|
||||
decelDist = distToTarget - fullSpeedDist - accelDist;
|
||||
}
|
||||
|
||||
double accelTime =
|
||||
(-velocity + Math.sqrt(Math.abs(velocity * velocity + 2 * acceleration * accelDist)))
|
||||
/ acceleration;
|
||||
|
||||
double deccelTime =
|
||||
(-deccelVelocity
|
||||
+ Math.sqrt(
|
||||
Math.abs(deccelVelocity * deccelVelocity + 2 * decceleration * deccelDist)))
|
||||
/ decceleration;
|
||||
double decelTime =
|
||||
(-decelVelocity
|
||||
+ Math.sqrt(Math.abs(decelVelocity * decelVelocity + 2 * deceleration * decelDist)))
|
||||
/ deceleration;
|
||||
|
||||
double fullSpeedTime = fullSpeedDist / m_constraints.maxVelocity;
|
||||
|
||||
return accelTime + fullSpeedTime + deccelTime;
|
||||
return accelTime + fullSpeedTime + decelTime;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,7 +282,7 @@ public class TrapezoidProfile {
|
||||
* @return The total time the profile takes to reach the goal.
|
||||
*/
|
||||
public double totalTime() {
|
||||
return m_endDeccel;
|
||||
return m_endDecel;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,7 +59,7 @@ class WPILIB_DLLEXPORT DifferentialDriveAccelerationLimiter {
|
||||
units::radians_per_second_squared_t maxAngularAccel);
|
||||
|
||||
/**
|
||||
* Returns the next voltage pair subject to acceleraiton constraints.
|
||||
* Returns the next voltage pair subject to acceleration constraints.
|
||||
*
|
||||
* @param leftVelocity The left wheel velocity.
|
||||
* @param rightVelocity The right wheel velocity.
|
||||
|
||||
@@ -59,7 +59,7 @@ class KalmanFilterLatencyCompensator {
|
||||
* @param observer The observer.
|
||||
* @param u The input at the timestamp.
|
||||
* @param localY The local output at the timestamp
|
||||
* @param timestamp The timesnap of the state.
|
||||
* @param timestamp The timestamp of the state.
|
||||
*/
|
||||
void AddObserverState(const KalmanFilterType& observer, Vectord<Inputs> u,
|
||||
Vectord<Outputs> localY, units::second_t timestamp) {
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace frc {
|
||||
* version seen in most publications. Unless you know better, this should be
|
||||
* your default choice.
|
||||
*
|
||||
* [1] R. Van der Merwe "Sigma-Point Kalman Filters for Probabilitic
|
||||
* [1] R. Van der Merwe "Sigma-Point Kalman Filters for Probabilistic
|
||||
* Inference in Dynamic State-Space Models" (Doctoral dissertation)
|
||||
*
|
||||
* @tparam States The dimensionality of the state. 2 * States + 1 weights will
|
||||
|
||||
@@ -48,7 +48,7 @@ class SteadyStateKalmanFilter {
|
||||
using OutputArray = wpi::array<double, Outputs>;
|
||||
|
||||
/**
|
||||
* Constructs a staeady-state Kalman filter with the given plant.
|
||||
* Constructs a steady-state Kalman filter with the given plant.
|
||||
*
|
||||
* See
|
||||
* https://docs.wpilib.org/en/stable/docs/software/advanced-controls/state-space/state-space-observers.html#process-and-measurement-noise-covariance-matrices
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace frc {
|
||||
* vectors using a given set of weights.
|
||||
* @param residualFunc A function that computes the residual of two state
|
||||
* vectors (i.e. it subtracts them.)
|
||||
* @param squareRootR Square-root of the noise covaraince of the sigma points.
|
||||
* @param squareRootR Square-root of the noise covariance of the sigma points.
|
||||
*
|
||||
* @return Tuple of x, mean of sigma points; S, square-root covariance of
|
||||
* sigmas.
|
||||
|
||||
@@ -50,7 +50,7 @@ struct WPILIB_DLLEXPORT ChassisSpeeds {
|
||||
}
|
||||
|
||||
/**
|
||||
* Disretizes a continuous-time chassis speed.
|
||||
* Discretizes a continuous-time chassis speed.
|
||||
*
|
||||
* This function converts a continuous-time chassis speed into a discrete-time
|
||||
* one such that when the discrete-time chassis speed is applied for one
|
||||
@@ -85,7 +85,7 @@ struct WPILIB_DLLEXPORT ChassisSpeeds {
|
||||
}
|
||||
|
||||
/**
|
||||
* Disretizes a continuous-time chassis speed.
|
||||
* Discretizes a continuous-time chassis speed.
|
||||
*
|
||||
* This function converts a continuous-time chassis speed into a discrete-time
|
||||
* one such that when the discrete-time chassis speed is applied for one
|
||||
|
||||
@@ -103,7 +103,7 @@ class ExponentialProfile {
|
||||
/**
|
||||
* Computes the max achievable velocity for an Exponential Profile.
|
||||
*
|
||||
* @return The seady-state velocity achieved by this profile.
|
||||
* @return The steady-state velocity achieved by this profile.
|
||||
*/
|
||||
Velocity_t MaxVelocity() const { return -maxInput * B / A; }
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ class TrapezoidProfile {
|
||||
*
|
||||
* @return The total time the profile takes to reach the goal.
|
||||
*/
|
||||
units::second_t TotalTime() const { return m_endDeccel; }
|
||||
units::second_t TotalTime() const { return m_endDecel; }
|
||||
|
||||
/**
|
||||
* Returns true if the profile has reached the goal.
|
||||
@@ -174,7 +174,7 @@ class TrapezoidProfile {
|
||||
|
||||
units::second_t m_endAccel;
|
||||
units::second_t m_endFullSpeed;
|
||||
units::second_t m_endDeccel;
|
||||
units::second_t m_endDecel;
|
||||
};
|
||||
} // namespace frc
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ TrapezoidProfile<Distance>::Calculate(units::second_t t, State current,
|
||||
|
||||
m_endAccel = accelerationTime - cutoffBegin;
|
||||
m_endFullSpeed = m_endAccel + fullSpeedDist / m_constraints.maxVelocity;
|
||||
m_endDeccel = m_endFullSpeed + accelerationTime - cutoffEnd;
|
||||
m_endDecel = m_endFullSpeed + accelerationTime - cutoffEnd;
|
||||
State result = m_current;
|
||||
|
||||
if (t < m_endAccel) {
|
||||
@@ -71,10 +71,10 @@ TrapezoidProfile<Distance>::Calculate(units::second_t t, State current,
|
||||
m_endAccel * m_constraints.maxAcceleration / 2.0) *
|
||||
m_endAccel +
|
||||
m_constraints.maxVelocity * (t - m_endAccel);
|
||||
} else if (t <= m_endDeccel) {
|
||||
} else if (t <= m_endDecel) {
|
||||
result.velocity =
|
||||
goal.velocity + (m_endDeccel - t) * m_constraints.maxAcceleration;
|
||||
units::second_t timeLeft = m_endDeccel - t;
|
||||
goal.velocity + (m_endDecel - t) * m_constraints.maxAcceleration;
|
||||
units::second_t timeLeft = m_endDecel - t;
|
||||
result.position =
|
||||
goal.position -
|
||||
(goal.velocity + timeLeft * m_constraints.maxAcceleration / 2.0) *
|
||||
@@ -105,7 +105,7 @@ units::second_t TrapezoidProfile<Distance>::TimeLeftUntil(
|
||||
endFullSpeed = units::math::max(endFullSpeed, 0_s);
|
||||
|
||||
const Acceleration_t acceleration = m_constraints.maxAcceleration;
|
||||
const Acceleration_t decceleration = -m_constraints.maxAcceleration;
|
||||
const Acceleration_t deceleration = -m_constraints.maxAcceleration;
|
||||
|
||||
Distance_t distToTarget = units::math::abs(target - position);
|
||||
|
||||
@@ -116,26 +116,26 @@ units::second_t TrapezoidProfile<Distance>::TimeLeftUntil(
|
||||
Distance_t accelDist =
|
||||
velocity * endAccel + 0.5 * acceleration * endAccel * endAccel;
|
||||
|
||||
Velocity_t deccelVelocity;
|
||||
Velocity_t decelVelocity;
|
||||
if (endAccel > 0_s) {
|
||||
deccelVelocity = units::math::sqrt(
|
||||
decelVelocity = units::math::sqrt(
|
||||
units::math::abs(velocity * velocity + 2 * acceleration * accelDist));
|
||||
} else {
|
||||
deccelVelocity = velocity;
|
||||
decelVelocity = velocity;
|
||||
}
|
||||
|
||||
Distance_t fullSpeedDist = m_constraints.maxVelocity * endFullSpeed;
|
||||
Distance_t deccelDist;
|
||||
Distance_t decelDist;
|
||||
|
||||
if (accelDist > distToTarget) {
|
||||
accelDist = distToTarget;
|
||||
fullSpeedDist = Distance_t{0};
|
||||
deccelDist = Distance_t{0};
|
||||
decelDist = Distance_t{0};
|
||||
} else if (accelDist + fullSpeedDist > distToTarget) {
|
||||
fullSpeedDist = distToTarget - accelDist;
|
||||
deccelDist = Distance_t{0};
|
||||
decelDist = Distance_t{0};
|
||||
} else {
|
||||
deccelDist = distToTarget - fullSpeedDist - accelDist;
|
||||
decelDist = distToTarget - fullSpeedDist - accelDist;
|
||||
}
|
||||
|
||||
units::second_t accelTime =
|
||||
@@ -143,14 +143,14 @@ units::second_t TrapezoidProfile<Distance>::TimeLeftUntil(
|
||||
velocity * velocity + 2 * acceleration * accelDist))) /
|
||||
acceleration;
|
||||
|
||||
units::second_t deccelTime =
|
||||
(-deccelVelocity +
|
||||
units::math::sqrt(units::math::abs(deccelVelocity * deccelVelocity +
|
||||
2 * decceleration * deccelDist))) /
|
||||
decceleration;
|
||||
units::second_t decelTime =
|
||||
(-decelVelocity +
|
||||
units::math::sqrt(units::math::abs(decelVelocity * decelVelocity +
|
||||
2 * deceleration * decelDist))) /
|
||||
deceleration;
|
||||
|
||||
units::second_t fullSpeedTime = fullSpeedDist / m_constraints.maxVelocity;
|
||||
|
||||
return accelTime + fullSpeedTime + deccelTime;
|
||||
return accelTime + fullSpeedTime + decelTime;
|
||||
}
|
||||
} // namespace frc
|
||||
|
||||
@@ -90,13 +90,13 @@ class ArmFeedforwardTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAcheviableVelocity() {
|
||||
void testAchievableVelocity() {
|
||||
assertEquals(6, m_armFF.maxAchievableVelocity(12, Math.PI / 3, 1), 0.002);
|
||||
assertEquals(-9, m_armFF.minAchievableVelocity(11.5, Math.PI / 3, 1), 0.002);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAcheviableAcceleration() {
|
||||
void testAchievableAcceleration() {
|
||||
assertEquals(4.75, m_armFF.maxAchievableAcceleration(12, Math.PI / 3, 1), 0.002);
|
||||
assertEquals(6.75, m_armFF.maxAchievableAcceleration(12, Math.PI / 3, -1), 0.002);
|
||||
assertEquals(-7.25, m_armFF.minAchievableAcceleration(12, Math.PI / 3, 1), 0.002);
|
||||
|
||||
@@ -171,7 +171,7 @@ class DifferentialDriveAccelerationLimiterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSeperateMinMaxLowLimits() {
|
||||
void testSeparateMinMaxLowLimits() {
|
||||
final double trackwidth = 0.9;
|
||||
final double dt = 0.005;
|
||||
final double minA = -1.0;
|
||||
|
||||
@@ -43,13 +43,13 @@ class ElevatorFeedforwardTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAcheviableVelocity() {
|
||||
void testAchievableVelocity() {
|
||||
assertEquals(5, m_elevatorFF.maxAchievableVelocity(11, 1), 0.002);
|
||||
assertEquals(-9, m_elevatorFF.minAchievableVelocity(11, 1), 0.002);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAcheviableAcceleration() {
|
||||
void testAchievableAcceleration() {
|
||||
assertEquals(3.75, m_elevatorFF.maxAchievableAcceleration(12, 2), 0.002);
|
||||
assertEquals(7.25, m_elevatorFF.maxAchievableAcceleration(12, -2), 0.002);
|
||||
assertEquals(-8.25, m_elevatorFF.minAchievableAcceleration(12, 2), 0.002);
|
||||
|
||||
@@ -220,7 +220,7 @@ class DifferentialDrivePoseEstimatorTest {
|
||||
|
||||
@Test
|
||||
void testSimultaneousVisionMeasurements() {
|
||||
// This tests for multiple vision measurements appled at the same time. The expected behavior
|
||||
// This tests for multiple vision measurements applied at the same time. The expected behavior
|
||||
// is that all measurements affect the estimated pose. The alternative result is that only one
|
||||
// vision measurement affects the outcome. If that were the case, after 1000 measurements, the
|
||||
// estimated pose would converge to that measurement.
|
||||
|
||||
@@ -229,7 +229,7 @@ class MecanumDrivePoseEstimatorTest {
|
||||
|
||||
@Test
|
||||
void testSimultaneousVisionMeasurements() {
|
||||
// This tests for multiple vision measurements appled at the same time. The expected behavior
|
||||
// This tests for multiple vision measurements applied at the same time. The expected behavior
|
||||
// is that all measurements affect the estimated pose. The alternative result is that only one
|
||||
// vision measurement affects the outcome. If that were the case, after 1000 measurements, the
|
||||
// estimated pose would converge to that measurement.
|
||||
|
||||
@@ -245,7 +245,7 @@ class SwerveDrivePoseEstimatorTest {
|
||||
|
||||
@Test
|
||||
void testSimultaneousVisionMeasurements() {
|
||||
// This tests for multiple vision measurements appled at the same time. The expected behavior
|
||||
// This tests for multiple vision measurements applied at the same time. The expected behavior
|
||||
// is that all measurements affect the estimated pose. The alternative result is that only one
|
||||
// vision measurement affects the outcome. If that were the case, after 1000 measurements, the
|
||||
// estimated pose would converge to that measurement.
|
||||
|
||||
@@ -20,7 +20,7 @@ class Twist2dTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testQuarterCirle() {
|
||||
void testQuarterCircle() {
|
||||
var quarterCircle = new Twist2d(5.0 / 2.0 * Math.PI, 0, Math.PI / 2.0);
|
||||
var quarterCirclePose = Pose2d.kZero.exp(quarterCircle);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class Twist3dTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testQuarterCirle() {
|
||||
void testQuarterCircle() {
|
||||
var zAxis = VecBuilder.fill(0.0, 0.0, 1.0);
|
||||
|
||||
var quarterCircle = new Twist3d(5.0 / 2.0 * Math.PI, 0.0, 0.0, 0.0, 0.0, Math.PI / 2.0);
|
||||
|
||||
@@ -171,7 +171,7 @@ TEST(DifferentialDriveAccelerationLimiterTest, HighLimits) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DifferentialDriveAccelerationLimiterTest, SeperateMinMaxLowLimits) {
|
||||
TEST(DifferentialDriveAccelerationLimiterTest, SeparateMinMaxLowLimits) {
|
||||
constexpr auto trackwidth = 0.9_m;
|
||||
constexpr auto dt = 5_ms;
|
||||
constexpr auto minA = -1_mps_sq;
|
||||
|
||||
@@ -212,7 +212,7 @@ TEST(DifferentialDrivePoseEstimatorTest, BadInitialPose) {
|
||||
}
|
||||
|
||||
TEST(DifferentialDrivePoseEstimatorTest, SimultaneousVisionMeasurements) {
|
||||
// This tests for multiple vision measurements appled at the same time.
|
||||
// This tests for multiple vision measurements applied at the same time.
|
||||
// The expected behavior is that all measurements affect the estimated pose.
|
||||
// The alternative result is that only one vision measurement affects the
|
||||
// outcome. If that were the case, after 1000 measurements, the estimated
|
||||
|
||||
@@ -211,7 +211,7 @@ TEST(MecanumDrivePoseEstimatorTest, BadInitialPose) {
|
||||
}
|
||||
|
||||
TEST(MecanumDrivePoseEstimatorTest, SimultaneousVisionMeasurements) {
|
||||
// This tests for multiple vision measurements appled at the same time.
|
||||
// This tests for multiple vision measurements applied at the same time.
|
||||
// The expected behavior is that all measurements affect the estimated pose.
|
||||
// The alternative result is that only one vision measurement affects the
|
||||
// outcome. If that were the case, after 1000 measurements, the estimated
|
||||
|
||||
@@ -220,7 +220,7 @@ TEST(SwerveDrivePoseEstimatorTest, BadInitialPose) {
|
||||
}
|
||||
|
||||
TEST(SwerveDrivePoseEstimatorTest, SimultaneousVisionMeasurements) {
|
||||
// This tests for multiple vision measurements appled at the same time.
|
||||
// This tests for multiple vision measurements applied at the same time.
|
||||
// The expected behavior is that all measurements affect the estimated pose.
|
||||
// The alternative result is that only one vision measurement affects the
|
||||
// outcome. If that were the case, after 1000 measurements, the estimated
|
||||
|
||||
@@ -39,7 +39,7 @@ TEST_F(SlewRateLimiterTest, SlewRateNoLimit) {
|
||||
EXPECT_EQ(limiter.Calculate(0.5_m), 0.5_m);
|
||||
}
|
||||
|
||||
TEST_F(SlewRateLimiterTest, SlewRatePositveNegativeLimit) {
|
||||
TEST_F(SlewRateLimiterTest, SlewRatePositiveNegativeLimit) {
|
||||
frc::SlewRateLimiter<units::meters> limiter(1_mps, -0.5_mps);
|
||||
|
||||
now += 1_s;
|
||||
|
||||
@@ -65,7 +65,7 @@ TEST(ExponentialProfileTest, ReachesGoal) {
|
||||
|
||||
// Tests that decreasing the maximum velocity in the middle when it is already
|
||||
// moving faster than the new max is handled correctly
|
||||
TEST(ExponentialProfileTest, PosContinousUnderVelChange) {
|
||||
TEST(ExponentialProfileTest, PosContinuousUnderVelChange) {
|
||||
frc::ExponentialProfile<units::meter, units::volts>::Constraints constraints{
|
||||
12_V, -kV / kA, 1 / kA};
|
||||
frc::ExponentialProfile<units::meter, units::volts> profile{constraints};
|
||||
@@ -88,7 +88,7 @@ TEST(ExponentialProfileTest, PosContinousUnderVelChange) {
|
||||
|
||||
// Tests that decreasing the maximum velocity in the middle when it is already
|
||||
// moving faster than the new max is handled correctly
|
||||
TEST(ExponentialProfileTest, PosContinousUnderVelChangeBackward) {
|
||||
TEST(ExponentialProfileTest, PosContinuousUnderVelChangeBackward) {
|
||||
frc::ExponentialProfile<units::meter, units::volts>::Constraints constraints{
|
||||
12_V, -kV / kA, 1 / kA};
|
||||
frc::ExponentialProfile<units::meter, units::volts> profile{constraints};
|
||||
|
||||
@@ -41,7 +41,7 @@ TEST(TrapezoidProfileTest, ReachesGoal) {
|
||||
|
||||
// Tests that decreasing the maximum velocity in the middle when it is already
|
||||
// moving faster than the new max is handled correctly
|
||||
TEST(TrapezoidProfileTest, PosContinousUnderVelChange) {
|
||||
TEST(TrapezoidProfileTest, PosContinuousUnderVelChange) {
|
||||
frc::TrapezoidProfile<units::meter>::Constraints constraints{1.75_mps,
|
||||
0.75_mps_sq};
|
||||
frc::TrapezoidProfile<units::meter>::State goal{12_m, 0_mps};
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
namespace wpi {
|
||||
|
||||
/**
|
||||
* Parses a URL into its constiuent components.
|
||||
* Parses a URL into its constituent components.
|
||||
* `schema://userinfo@host:port/the/path?query#fragment`
|
||||
*/
|
||||
class UrlParser {
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace wpi::uv {
|
||||
* template parameters. If data parameters are used, the async callback will
|
||||
* be called once for every call to Send(). If no data parameters are used,
|
||||
* the async callback may or may not be called for every call to Send() (e.g.
|
||||
* the calls may be coaleasced).
|
||||
* the calls may be coalesced).
|
||||
*/
|
||||
template <typename... T>
|
||||
class Async final : public HandleImpl<Async<T...>, uv_async_t> {
|
||||
@@ -132,7 +132,7 @@ class Async final : public HandleImpl<Async<T...>, uv_async_t> {
|
||||
|
||||
/**
|
||||
* Async specialization for no data parameters. The async callback may or may
|
||||
* not be called for every call to Send() (e.g. the calls may be coaleasced).
|
||||
* not be called for every call to Send() (e.g. the calls may be coalesced).
|
||||
*/
|
||||
template <>
|
||||
class Async<> final : public HandleImpl<Async<>, uv_async_t> {
|
||||
|
||||
@@ -102,7 +102,7 @@ class Loop final : public std::enable_shared_from_this<Loop> {
|
||||
* * `Loop::kDefault`: Run the event loop until there are no
|
||||
* active and referenced handles or requests.
|
||||
* * `Loop::kOnce`: Run a single event loop iteration. Note that this
|
||||
* function blocksif there are no pending callbacks.
|
||||
* function blocks if there are no pending callbacks.
|
||||
* * `Loop::kNoWait`: Run a single event loop iteration, but don't block
|
||||
* if there are no pending callbacks.
|
||||
*
|
||||
|
||||
@@ -7,7 +7,7 @@ package edu.wpi.first.units;
|
||||
import static edu.wpi.first.units.Units.Watts;
|
||||
|
||||
/**
|
||||
* Unit of electic current dimension.
|
||||
* Unit of electric current dimension.
|
||||
*
|
||||
* <p>This is the base type for units of current dimension. It is also used to specify the dimension
|
||||
* for {@link Measure}: <code>Measure<Current></code>.
|
||||
|
||||
@@ -202,7 +202,7 @@ results in a 5-byte encoding:
|
||||
[[layout-bit-field]]
|
||||
=== Bit-Field Data Layout
|
||||
|
||||
Multiple adjacant bit-fields of the same integer type width are packed together to fit in the minimum number of multiples of that type. The bit-fields are packed, starting from the least significant bit, in the order they appear in the schema. Individual bit-fields must not span across multiple underlying types; if a bit-field is larger than the remaining space in the data type, a new element of that type is started and the bit-field starts from the least significant bit of the new element. Unused bits should be set to 0 during serialization and must be ignored during deserialization.
|
||||
Multiple adjacent bit-fields of the same integer type width are packed together to fit in the minimum number of multiples of that type. The bit-fields are packed, starting from the least significant bit, in the order they appear in the schema. Individual bit-fields must not span across multiple underlying types; if a bit-field is larger than the remaining space in the data type, a new element of that type is started and the bit-field starts from the least significant bit of the new element. Unused bits should be set to 0 during serialization and must be ignored during deserialization.
|
||||
|
||||
Boolean bit-fields are always a single bit wide. The underlying data type is by default uint8, but if a boolean bit-field immediately follows a bit-field of another integer type (and fits), it is packed into that type.
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ public class WPIUtilJNI {
|
||||
* multiple-consumer scenario.
|
||||
*
|
||||
* @param initialCount initial value for the semaphore's internal counter
|
||||
* @param maximumCount maximum value for the samephore's internal counter
|
||||
* @param maximumCount maximum value for the semaphore's internal counter
|
||||
* @return Semaphore handle
|
||||
*/
|
||||
public static native int createSemaphore(int initialCount, int maximumCount);
|
||||
|
||||
@@ -103,10 +103,10 @@ public interface Protobuf<T, MessageType extends ProtoMessage<?>> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not objects are cloneable using the clone() method. Clonable objects must
|
||||
* Returns whether or not objects are cloneable using the clone() method. Cloneable objects must
|
||||
* also be comparable using the equals() method. Default implementation returns false.
|
||||
*
|
||||
* @return True if object is clonable
|
||||
* @return True if object is cloneable
|
||||
*/
|
||||
default boolean isCloneable() {
|
||||
return false;
|
||||
|
||||
@@ -203,10 +203,10 @@ public interface Struct<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not objects are cloneable using the clone() method. Clonable objects must
|
||||
* Returns whether or not objects are cloneable using the clone() method. Cloneable objects must
|
||||
* also be comparable using the equals() method. Default implementation returns false.
|
||||
*
|
||||
* @return True if object is clonable
|
||||
* @return True if object is cloneable
|
||||
*/
|
||||
default boolean isCloneable() {
|
||||
return false;
|
||||
|
||||
@@ -90,7 +90,7 @@ void ResetEvent(WPI_EventHandle handle);
|
||||
* multiple-consumer scenario.
|
||||
*
|
||||
* @param initialCount initial value for the semaphore's internal counter
|
||||
* @param maximumCount maximum value for the samephore's internal counter
|
||||
* @param maximumCount maximum value for the semaphore's internal counter
|
||||
* @return Semaphore handle
|
||||
*/
|
||||
WPI_SemaphoreHandle CreateSemaphore(int initialCount = 0,
|
||||
@@ -318,7 +318,7 @@ class Semaphore final {
|
||||
* Constructor.
|
||||
*
|
||||
* @param initialCount initial value for the semaphore's internal counter
|
||||
* @param maximumCount maximum value for the samephore's internal counter
|
||||
* @param maximumCount maximum value for the semaphore's internal counter
|
||||
*/
|
||||
explicit Semaphore(int initialCount = 0, int maximumCount = INT_MAX)
|
||||
: m_handle{CreateSemaphore(initialCount, maximumCount)} {}
|
||||
@@ -491,7 +491,7 @@ void WPI_ResetEvent(WPI_EventHandle handle);
|
||||
* multiple-consumer scenario.
|
||||
*
|
||||
* @param initial_count initial value for the semaphore's internal counter
|
||||
* @param maximum_count maximum value for the samephore's internal counter
|
||||
* @param maximum_count maximum value for the semaphore's internal counter
|
||||
* @return Semaphore handle
|
||||
*/
|
||||
WPI_SemaphoreHandle WPI_CreateSemaphore(int initial_count, int maximum_count);
|
||||
|
||||
@@ -55,7 +55,7 @@ void WPI_InitString(struct WPI_String* wpiString, const char* utf8String);
|
||||
|
||||
/**
|
||||
* Initializes a WPI_String from a UTF-8 string and length.
|
||||
* If input string is null or 0 length, initilizes output to 0 length.
|
||||
* If input string is null or 0 length, initializes output to 0 length.
|
||||
* The input string does not need to be null terminated.
|
||||
*
|
||||
* The lifetime of the output string is the lifetime of the input string.
|
||||
|
||||
@@ -166,7 +166,7 @@ inline T UnpackStruct(std::span<const uint8_t> data, const I&... info) {
|
||||
* @tparam Offset starting offset
|
||||
* @tparam N number of objects
|
||||
* @param data raw struct data
|
||||
* @return Desrialized array
|
||||
* @return Deserialized array
|
||||
*/
|
||||
template <StructSerializable T, size_t Offset, size_t N>
|
||||
inline wpi::array<T, N> UnpackStructArray(std::span<const uint8_t> data) {
|
||||
|
||||
Reference in New Issue
Block a user