Commit Graph

406 Commits

Author SHA1 Message Date
Tyler Veness
ab53d51c6f Fix or suppress clang-tidy warnings (#8254) 2025-09-25 21:28:04 -07:00
Tyler Veness
0a0adebd89 [build] Upgrade to Gradle 8.14.3 (#8164)
This fixes local builds with JDK 24.

I fixed deprecation warnings from `./gradlew wrapper --warning-mode all`
as well.
2025-08-08 09:08:34 -06:00
Gold856
26771e38fb [commands] Deprecate Command.schedule() (#7072)
It's only syntactic sugar over the CommandScheduler's schedule method and creates a footgun because it’s too obvious to try to use in incorrect places.

Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2025-07-02 13:46:59 -07:00
sciencewhiz
79a9d7f987 [examples] Add Accelerometer filtering snippets 2025-05-13 22:03:22 -07:00
sciencewhiz
0877d130be [examples] Add Accelerometer collision detection snippets 2025-05-13 22:03:22 -07:00
sciencewhiz
89555383cc [examples] Add BuiltInAccelerometer Snippet 2025-05-13 22:03:22 -07:00
sciencewhiz
de315947e9 [examples] Add ADXL 345 and 362 snippets 2025-05-13 22:03:22 -07:00
sciencewhiz
b7cd03adc4 [examples] Add AnalogAccelerometer snippets
Delete AnalogAccelerometer comments about sensitivity and zero constants that don't exist
2025-05-13 22:03:22 -07:00
sciencewhiz
55a97f0c11 [examples] Add Analog Potentiometer Snippets (#7957) 2025-05-10 07:18:19 -07:00
sciencewhiz
b96264f042 [examples] Misc fixes for snippets (#7952) 2025-05-04 00:13:46 -07:00
sciencewhiz
a15152712f [examples] Add AnalogInput snippets (#7951) 2025-05-04 00:13:20 -07:00
Eric
17cae787e7 [commands] Mark CommandPtr class as [[nodiscard]] (#7803)
This has the same effect but makes it so any user code returning CommandPtr can't discard a returned command.

Signed-off-by: Eric Ward <ezeward4@gmail.com>
2025-05-03 20:44:55 -07:00
sciencewhiz
e63899e63a [examples] Add snippets for Digital Input article (#7949) 2025-05-01 11:40:38 -06:00
sciencewhiz
c49fc29046 [examples] Add Limit Switch snippets (#7946) 2025-04-29 08:42:32 -06:00
sciencewhiz
659710a79a [examples] Add remaining Encoder snippets (#7936) 2025-04-28 16:25:49 -07:00
sciencewhiz
90ee11a9e0 [examples] Add DutyCycleEncoder Snippets (#7930) 2025-04-25 21:47:53 -07:00
sciencewhiz
21d921184a [examples] Add compilable code snippets (#7909)
This enables frc-docs to use RLIs for things that are currently in-line
code blocks, and ensures they compile, which is important with the 2027
breaking changes coming. They are kept separate from the examples to
ensure they don't polute the VSCode examples finder.

Adds the Encoder snippets used in the frc-docs Encoder article as the
first instance of this.
2025-04-22 15:26:26 -06:00
Tyler Veness
72fdca3507 [examples] Fix C-style cast warning from cpplint (#7591) 2024-12-25 23:33:41 -06:00
sciencewhiz
6fe5da7289 [examples] Fix example json for SimpleDifferentialDriveSimulation (NFC) (#7561)
Uses LTVUnicycleController now instead of RAMSETE.
2024-12-18 09:20:31 -07:00
Jonah Bonner
ca51197486 [wpilib] Add timestamp getters with configurable time base (#7378) 2024-11-16 07:43:38 -08:00
Kavin Muralikrishnan
1e545c38a8 [romi] Update Romi for parity with XRP (#7389) 2024-11-16 07:24:58 -08:00
Kavin Muralikrishnan
6eb652e10e [xrp] Copy XRPReference docs from Java to C++ (NFC) (#7388) 2024-11-16 07:24:21 -08:00
Kavin Muralikrishnan
280d2c7e32 [examples] Update C++ XRP Code to use SI Units (#7366) 2024-11-08 20:24:13 -08:00
Ryan Blue
59dc9ad8f4 [examples] Rename SysId example to SysIdRoutine (#7213)
CMake target output conflicts with sysid (the application) on windows
2024-10-15 22:01:05 -07:00
Gold856
28cb7cf757 [examples] Add ProfiledPID command to RapidReactCommandBot (#7030) 2024-10-11 08:43:24 -07:00
Jade
8f57e4c566 [documentation] Remove more outdated commands examples (#7054)
There are still some examples we'd like to remove here (eg Hatchbot
traditional) but this is a good start with not too many changes required
in frc-docs.
2024-10-10 23:09:11 -07:00
Jade
679892e8e1 [commands, documentation] Remove controller replaceme commands (#7053) 2024-10-10 22:12:02 -07:00
Nicholas Armstrong
4adfa8bf64 [wpimath] Fully discretized ElevatorFF and ArmFF (#7024)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-10-10 22:10:45 -07:00
Nicholas Armstrong
5acb4109ff [examples] Fix flaky ArmSimulationTest (#7170)
Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2024-10-10 22:07:52 -07:00
Nicholas Armstrong
fe80d72fba [wpimath] Add cosineScale method to SwerveModuleState and instance optimize (#7114) 2024-09-30 13:23:30 -06:00
Tyler Veness
554024767e Fix errors from new cpplint.py (#7105) 2024-09-20 17:43:39 -07:00
Ryan Blue
496e7c1bba [hal] Refactor C++ handle closing; check for invalid handle before closing (#7016)
Adds a close function pointer template parameter to hal::Handle.  This allows default destructors in many places.
The status parameter has been removed from close functions; in most places it was not used. Where it was, an error is printed instead.
2024-09-07 10:58:15 -07:00
Ryan Blue
9d6bee1d1e [build] cmake: Add meta target for examples and example tests (#7015)
Also prefix example test targets with Example_ to make running tests easier
2024-08-29 14:03:41 -07:00
Gold856
b12b83aa89 Fix typos with cspell (#6972) 2024-08-17 07:44:34 -07:00
Tyler Veness
8e0d9ac805 Clean up unit UDL usage (#6961) 2024-08-14 10:44:00 -07:00
Gold856
a2060feadc [commands] Fix and deprecate TrapezoidProfileCommand (#6722) 2024-08-13 21:01:17 -07:00
Ryan Blue
5a6dd02ce9 [examples] Replace usages of SIMULATION macro with constexpr if (#6899) 2024-08-03 08:14:17 -07:00
PJ Reiniger
f561a77e75 [upstream_utils] Add googletest (#6820) 2024-07-18 21:10:26 -07:00
Jade
57fa388724 [examples] Prepare for RobotInit deprecation by updating examples (#6623)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-07-16 20:22:39 -07:00
Nicholas Armstrong
30c7632ab8 [wpimath] Make SimpleMotorFeedforward only support discrete feedforward (#6647)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-07-16 17:23:11 -07:00
Gold856
65c6306047 [wpilib,commands] Use Jinja to generate HID classes (#6274) 2024-06-08 09:59:07 -07:00
Sam Carlberg
ad18fa62ee [wpilib] Add LED pattern API for easily animating addressable LEDs (#6344)
Add LEDReader and LEDWriter helper interfaces to facilitate composing simple patterns into more complex ones, e.g. LEDPattern.solid(Color.kBlue).breathe(Seconds.of(0.75)). Pattern composition relies on changing out the write behavior; for example, offsetBy increments the indexes to write to; while blink will switch between playing a base pattern and turning off all the LEDs.

Add a view class for splitting a single large buffer into smaller distinct sections, which is useful for dealing with long chained LED strips mounted on different parts of a robot. Views cannot be written directly to an LED strip (in fact, trying to do so won't even compile).

Adds some utility methods to the Color class for interpolating between two colors, and support color representations with 32-bit integers to avoid object allocations.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-06-05 19:41:10 -07:00
Nicholas Armstrong
f42bc45ee8 [wpilib] FlywheelSim cleanup (#6629)
This is a cleanup of the FlywheelSim class with a few added features.

- One FlywheelSim constructor that takes a plant, DCMotor, and a optional number of measurementStdDevs. The documentation now states how to construct the plant either through LinearSystemId.createFlywheelSystem or identifyVelocitySystem.

- The gearbox, gearing and moment of Inertia (J) are now private final fields. The gearing is determined from the plant in the constructor as well as the moment of inertia. There are getter methods that allow the flywheelSim to return the gearbox, gearing, and moment of inertia.

- The getCurrentDrawAmps function now uses m_x instead of getAngularVelocityRadPerSec in accordance with more accuracy and matches the patter in other sims.

- Added getter methods for the InputVoltage, angularAcceleration and torque

- (Java only) A third getter method for returning the AngularVelocity of the flywheel using a MutableMeasure as a backing field that is set when getAngularVelocity is called. This summarily returns the angularVelocity as just a Measure object. This allows the user of this class to handle unit conversions with less numerical manipulation. Alterations in C++ for this feature were not needed.
2024-05-24 16:05:14 -07:00
Thad House
d05c7c125b [wpilib] Rewrite DutyCycleEncoder and AnalogEncoder (#6398) 2024-05-24 11:53:56 -07:00
Gold856
72a6d22d9a [build] Organize cmake files (#6617) 2024-05-24 10:48:05 -07:00
Nicholas Armstrong
7fc17811fa [wpimath] Add full state support to LinearSystemId functions (#6554)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2024-05-15 07:23:22 -06:00
Gold856
305a0657e2 [cscore] Deprecate AxisCamera (#6579) 2024-05-12 10:28:51 -07:00
Tyler Veness
d88c71ffdc [wpiutil] Upgrade to fmt 10.2.1, add wpi::print (#6161)
We now use a wrapper (wpi::print) to catch exceptions since we can't patch
std::print() to not throw when we ultimately migrate to it.

fmtlib and std format/print throw the same exceptions and always have. We previously patched fmt::print() to not throw a write failure exception, but we can't do that for std::print(); wpi::print() is the migration plan.
2024-05-12 06:25:42 -07:00
Isaac Turner
a6dd95eb9e [wpilib] Remove deprecated Gyro interface (#6567) 2024-05-06 21:54:39 -07:00
Drew Williams
0afc35f336 [commands] Fix C++ SysIdRoutine crashing when passed nullptr or {} (#6508)
Flattens parameter from a `std::optional<std::function<...>>` to just a `std::function<...>`.  This is a breaking change but a trivial one for teams to fix.
2024-05-01 09:09:15 -07:00