Commit Graph

42 Commits

Author SHA1 Message Date
Peter Johnson
3fe8fc75aa [wpilibc] Revert "Return reference from GetInstance" (#3342)
This reverts commit a79faace1b.

This change will be superseded in a non-breaking way by changing to static functions and deprecating GetInstance() entirely.
2021-05-09 18:16:07 -07:00
Peter Johnson
a79faace1b [wpilibc] Return reference from GetInstance (#3247)
Improves consistency across all classes.

Affects Preferences, LiveWindow, and CameraServer.

Old commands Scheduler::GetInstance() was not updated as this is already
deprecated.
2021-03-21 11:13:49 -07:00
Peter Johnson
2aed432b4b Add braces to C++ single-line loops and conditionals (NFC) (#2973)
This makes code easier to read and more consistent between C++ and Java.
Also update clang-format settings to always add a line break (even if no braces are used).
2020-12-28 12:58:06 -08:00
Peter Johnson
8f1f64ffb6 Remove year from file copyright message (NFC) (#2972)
Also update copyright to include "and other WPILib contributors" and clarify
license referral language to not be restricted to FIRST teams.
2020-12-26 14:12:05 -08:00
Peter Johnson
387f56cb7b [examples] Add Romi reference Java example and templates (#2905) 2020-12-04 17:34:54 -08:00
Prateek Machiraju
526f26685d [wpilib] Add methods to check game and enabled state together (#2661)
This avoids users having to call both IsOperatorControl() and IsEnabled() to figure out if their robot is
enabled and in the teleop state. The expression above involves calling two methods that each have their
own lock.

These new methods should only involve locking one mutex, since only one call is made to HAL_GetControlWord().
2020-08-29 13:32:19 -07:00
sciencewhiz
15819cc981 [command] Add SimulationPeriodic to templates (#2582) 2020-07-10 21:21:31 -07:00
Prateek Machiraju
7797da78f5 Add missing methods to Timed and TimedSkeleton templates (#2306) 2020-01-24 20:01:23 -08:00
Oblarg
5b7dd186d2 Add templates for new commands for vscode plugin (#2016) 2019-12-29 15:02:49 -06:00
Tyler Veness
9a8067465c Fix incomplete .styleguide (#2113)
Also clean up other .styleguides.

Fixes #2111.
2019-11-20 22:44:18 -08:00
Prateek Machiraju
55a7f2b4ad Add template for old command-based style (#2031) 2019-11-10 23:20:33 -08:00
Thad House
629e95776a Add VendorDeps JSON files for command libraries (#2048)
Add commandversion flag to the examples and templates json files.
2019-11-07 17:38:07 -08:00
Peter Johnson
7508aada93 Add ability to end startCompetition() main loop (#2032)
This is useful for both cleanly exiting from simulation and for unit testing
at a framework level.

This change required removing move constructor/assignment from IterativeRobot.
2019-11-05 21:33:09 -08:00
Thad House
16b34cce20 Remove IterativeRobot templates (#2011)
With the class being deprecated, new projects shouldn't be created with it
2019-10-30 21:26:30 -07:00
Tyler Veness
2bdb443255 Add frc2 includes to list of "other lib" regexes (#1855) 2019-08-26 23:11:07 -07:00
Oblarg
076ed7770c Add new C++ Command framework (#1785)
This is the C++ version of #1682.

The old command framework is still available, but will be deprecated.

Due to name conflicts, the new framework is in the frc2 namespace.
Eventually (after the old command framework is removed in a future year)
it will be moved into the main frc namespace.
2019-08-25 20:55:59 -07:00
Tyler Veness
dd43109596 Deprecate frc/WPILib.h (#1779)
It drastically increases compile times and is bad style. C++ users
should be including what they use. We don't necessarily have to remove
WPILib.h, but it should at least be deprecated.
2019-07-30 00:41:14 -07:00
Tyler Veness
73ec940786 Remove SampleRobot (#1658)
SampleRobot provides no benefits over RobotBase to advanced teams and
TimedRobot is recommended for everyone else.

A skeleton template for RobotBase was added.
2019-07-15 20:09:47 -05:00
Thad House
c12d7729e3 Update examples to use VictorSPX's rather then Sparks (#1521) 2018-12-31 13:45:09 -08:00
Jaci Brunning
90572a3cc5 Add wpilibc and wpilibj skeleton templates (#1441)
See also vscode-wpilib#132.
2018-11-29 22:15:17 -08:00
Tyler Veness
bedef476fd Replace IterativeRobot in examples with TimedRobot (#1310)
Fixes #1309.
2018-09-19 21:41:08 -07:00
Peter Johnson
b44f27ddfa SendableChooser: Rename addDefault and addObject for clarity (#1239)
Rename addDefault to setDefaultOption and addObject to addOption.

The old names are still available but are marked as deprecated.
2018-08-19 01:51:17 -07:00
Tyler Veness
d89b7dd412 Move CameraServer and WPILib headers into their own folder
The old headers were moved into folders because doing so avoids polluting
the system include directories.

Folder names were also normalized to lowercase.
2018-07-22 19:40:57 -07:00
Thad House
c7e97f45f5 Add RobotPeriodic functions to default templates. (#1149) 2018-06-10 20:16:54 -07:00
Thad House
8d218dbca4 Add support for unit testing from GradleRIO for C++ projects (#1094)
In order for this to properly work, we need to remove the main code.
Then the test component will actually have the main in it.  Example tests will be added later.
2018-05-28 02:07:03 -04:00
Thad House
863cfde394 Adds tests to ensure all examples have matching item in json file (#1079)
Also checks that all items in the json file have a matching example
One was missing from C++, that example was added (The one in eclipse was completely wrong)
2018-05-24 20:08:37 -04:00
Tyler Veness
c89678971c Replaced the START_ROBOT_CLASS() macro with a template function (#1050)
The START_ROBOT_CLASS() macro's main() now calls this function through a
deprecated proxy function to encourage users to switch.
2018-05-16 19:54:39 -07:00
Thad House
cff475c1fc Moves C++ templates and examples to match gradle setup (#1065) 2018-05-15 21:25:24 -07:00
Thad House
560123ab7d Fixes command folder name in templates.json (#1061) 2018-05-14 00:19:47 -07:00
Tyler Veness
6729a7d6b1 Run wpiformat on merged repo (#1021) 2018-05-13 17:09:56 -07:00
Thad House
dab6f40b46 Moves examples.xml to json, and adds template json (#1026) 2018-05-04 16:51:37 -07:00
Tyler Veness
96e9a6989c Improved Command-based examples (#906)
Robot.cpp has been split into header-source pairs and the Command-based
examples now define an example subsystem in the Robot class.
2018-03-05 22:06:40 -08:00
Tyler Veness
0ef9803363 Update copyright year to 2018 (#864)
Also fix a few files with incorrect line endings.
2018-01-02 11:20:21 -06:00
Peter Johnson
f9bece2ffb Update LiveWindow to provide continuous telemetry. (#771)
LiveWindow.updateValues() is now called from IterativeRobotBase on every
loop iteration.  Telemetry for all WPILib classes is enabled by default;
it can be disabled for specific classes using LiveWindow.disableTelemetry(),
or all telemetry can be disabled using LiveWindow.disableAllTelemetry().

This necessitated changing the hook methodology into other classes to
be more property-based rather than each class providing multiple functions.
This had the benefit of reducing boilerplate and increasing consistency.

- Remove NamedSendable, add name to Sendable.

- Provide SendableBase abstract class.

- Deprecate LiveWindow addSensor/addActuator interfaces.

- Add LiveWindow support to drive classes.

- Add addChild() helper functions to Subsystem.

- Fix inheritance hierarchy.  Now only sensors inherit from SensorBase.
  Other devices inherit from some combination of SendableBase, ErrorBase, or
  nothing.
2017-12-04 23:28:33 -08:00
Tyler Veness
350b741adc Cleaned up SampleRobot template and added warning about disabling motor safety (#766) 2017-12-04 20:28:31 -08:00
sciencewhiz
0b8d3f0260 Update SampleRobot template to match comments (#768) 2017-12-02 23:28:52 -08:00
Tyler Veness
42096fac3f Ran formatter (#722) 2017-11-10 18:29:27 -08:00
sciencewhiz
6be9e69d13 Switch Command Templates to TimedRobot (#719) 2017-11-09 20:08:41 -08:00
Tyler Veness
faf134a674 C++ examples no longer use deprecated APIs (#703) 2017-11-05 19:39:47 -08:00
Tyler Veness
45d48d6b5a Cleaned up C++ examples (#672) 2017-11-03 13:22:56 -07:00
Tyler Veness
c33fca34e9 Added TimedRobot template (#673) 2017-10-27 21:33:04 -07:00
Tyler Veness
0291a95f68 Add cpp examples (#659)
* Added C++ robot project examples and set up sub .clang-format for them

* Ran formatter
2017-10-17 21:37:58 -07:00