Commit Graph

27 Commits

Author SHA1 Message Date
Peter Johnson
831c10bdfc [wpilibc] Errors: Use fmtlib 2021-05-25 10:04:32 -07:00
Peter Johnson
2385c2a430 [wpilibc] Remove Utility.h (#3376)
Change last 2 uses of wpi_assert to throw error instead.
2021-05-23 15:25:08 -07:00
Peter Johnson
8d961dfd25 [wpilibc] Remove ErrorBase (#3306)
Replace with new exception-based error reporting, consistent with Java.
This also builds stacktraces into the reporting/exceptions.
2021-04-18 20:35:29 -07:00
Tyler Veness
3cf44e0a53 [hal] Add function for changing HAL Notifier thread priority (#3218) 2021-02-28 22:05:26 -08: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
Tyler Veness
fac4e3fcfc [wpilibc] Add real-time priority constructor to Notifier (#2303)
Using this overload makes the thread backing the Notifier run at
real-time priority. This improves scheduling jitter substantially (5ms
+- 2ms down to 5ms +- 1ms).

A version isn't provided for Java because making threads real-time can
cause GC deadlocks.
2020-04-05 23:26:23 -07:00
Thad House
60c09ea51f Fix notifier race happening with very fast notifiers (#2370)
What would happen is the Stop() call would happen between the notifier loop being triggered and calling UpdateAlarm(). This would cause the Update to overwrite the stop.
2020-02-18 20:38:05 -08:00
Peter Johnson
3e049e02f0 Add name to HAL Notifier 2019-11-11 22:03:29 -08:00
Thad House
9bcff37b93 Add HAL specific version of wpi_setError (#2055)
Cleans up error writing, and allows fewer headers to be included in many of the wpilibc cpp files.

This removes all usages of the hal/HAL.h header.
2019-11-08 22:53:20 -08:00
Prateek Machiraju
c07ac23532 wpilibc: Add overloads for units (#1815)
Add unit-taking overloads to the following classes:
- IterativeRobotBase
- LinearFilter
- Notifier
- TimedRobot
- Timer (HasPeriodPassed only)
- frc2::PIDController

The corresponding non-units-taking functions have been deprecated.

The return value of TimedRobot::GetPeriod() was updated.
This is a breaking change, users should use to<double> to get the value in seconds.

Other return values, e.g. Timer::Get(), have NOT been updated due to much wider use.
2019-08-16 21:56:48 -07:00
Tyler Veness
dde61aad32 Remove TimerEventHandler typedef from Notifier class (#1767)
Using std::function<void()> directly makes it much clearer to the user
what kind of function Notifier expects. The Doxygen comments already say
what the function is used for, so the typedef just discards useful
information.
2019-07-20 22:57:16 -07:00
Tyler Veness
62be0392b6 Replace std::lock_guard and std::lock with std::scoped_lock (#1758)
std::scoped_lock was introduced in C++17 and is strictly better than
std::lock_guard as it supports locking any number of mutexes safely.
It's also easier to use than std::lock for locking multiple mutexes at
once.
2019-07-08 22:58:39 -07:00
Tyler Veness
841ef5d739 Remove template types from lock RAII wrapper usages (#1756)
C++17 has template type autodeduction. These wrappers include
std::lock_guard and std::unique_lock.
2019-07-07 19:17:14 -07:00
Tyler Veness
1aa8446725 Add move constructors and assignment operators to wpilibc (#1314)
Fixes #898.
2018-09-24 00:08:25 -07:00
Peter Johnson
67b1c85315 Notifier: properly reset HAL alarm in non-periodic case (#1296)
The loop spins otherwise.
2018-09-03 16:07:23 -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
Tyler Veness
8c680a26f8 Moved C++ comments from source files to headers (#1111)
Also sorted functions in C++ sources to match order in related headers.
2018-05-31 20:47:15 -07: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
Tyler Veness
26a36779a6 Performed cleanup of Timer's free functions (#776)
* GetClock() is now officially deprecated since its comment already informally
  did so and the function just forwards to Timer::GetFPGATimestamp().
* The declaration of GetPPCTimestamp() is missing a definition and has been
  removed.
* std::this_thread::sleep_for() returns immediately when given a negative
  duration, so the check for that was removed from Wait().
2017-11-27 21:59:00 -08:00
Tyler Veness
ba879f4663 Cleaned up variable names for std::lock_guard and their associated mutexes (#759) 2017-11-22 17:10:21 -08:00
Peter Johnson
d214b36786 Change HAL notifier to polling. (#627)
This moves the thread code to the WPILib layer, fixing various potential
races and significantly simplifying the HAL implementation.
2017-11-19 17:58:40 -08:00
Peter Johnson
4d559f3856 Use wpi::mutex instead of std::mutex. (#730)
This uses a priority-aware mutex on Linux platforms.

Fixes #729.
2017-11-13 09:51:48 -08:00
Tyler Veness
dd66b23845 Remove priority mutex (#644)
* Removed hal::priority_condition_variable

* Replaced uses of priority mutexes with std::mutex and std::recursive_mutex

This allowed replacing a use of std::condition_variable_any with
std::condition_variable.

* Replaced all uses of std::recursive_mutex with std::mutex equivalents
2017-09-28 23:32:35 -07:00
Tyler Veness
6e4f66cc8b Classify other libraries' headers properly and fix committed formatting issues (#620) 2017-08-27 00:11:52 -07:00
Tyler Veness
f151892db5 Contents of copyright line now has more standard ordering (#585) 2017-08-24 00:06:13 -05:00
Thad House
e1195e8b9d Update to 2018_v4 image and new build system. (#598)
* Revert "Force OpenCV to 3.1.0 (#602)"

This reverts commit 50ed55e8e2.

* Removes Simulation

* Removes old build system

* Removes old gtest

* Adds new gmock and gtest

* Updates to new ni-libraries

* removes MyRobot (to be replaced)

* moves files to new location

* Adds new sim backend and new test executables

* updates .styleguide and .gitignore

* Changes cpp WPILibVersion to a function

MSVC throws an AV with the old version.

* Disables USBCamera on all systems except for linux

* 2018 NI Libraries

* New build system
2017-08-18 21:35:53 -07:00