Compare commits

...

5595 Commits

Author SHA1 Message Date
Starlight220
aa34aacf6e [wpilib] Shuffleboard: Keep duplicates on SelectTab() (#5198) 2023-03-26 20:12:55 -07:00
Tyler Veness
63512bbbb8 [wpimath] Fix potential divide-by-zero in RKDP (#5242)
If f(x, u) has no dynamics, the truncation error can be zero.
2023-03-26 17:00:09 -07:00
Peter Johnson
9227b2166e [wpilibj] DriverStation: Fix joystick data logs (#5240)
Was logging relative to cached value rather than previously logged value.
Was also logging cached value instead of current loop value.
C++ implementation is correct.
2023-03-26 16:17:13 -07:00
Peter Johnson
fbf92e9190 [wpinet] ParallelTcpConnector: don't connect to duplicate addresses (#5169)
There can be duplicate addresses coming out of name resolution; if we
already started connecting to an address, don't start another connection
attempt.
2023-03-25 16:28:39 -07:00
Peter Johnson
2108a61362 [ntcore] NT4 client: close timed-out connections (#5175)
Pings are sent every 3 seconds.  If we don't see a response to the last
ping before it's time to send the next one, close the connection.
2023-03-25 16:27:40 -07:00
Peter Johnson
0a66479693 [ntcore] Optimize scan of outgoing messages (#5227)
The algorithm being used for scanning outgoing messages was O(n^2)
because it did a full linear search and then appended. This scan is
performed for each client. If there is a burst of outgoing changes, the
outgoing queue can get quite deep all at once and this scan can be very
slow. Replacing with a map fixes this.
2023-03-25 15:20:22 -07:00
Ryan Blue
b510c17ef6 [hal] Fix RobotController.getComments() mishandling quotes inside the comments string (#5197)
Previously, the comment would end at any quote, escaped or unescaped. This allows UnescapeCString to handle the unescaping of quotes and properly end the string.
2023-03-20 13:50:25 -07:00
Starlight220
e7a7eb2e93 [commands] WaitCommand: Remove subclass doc note (NFC) (#5200) 2023-03-20 13:46:26 -07:00
Starlight220
a465f2d8f0 [examples] Shuffleboard: Correct parameter order (#5204) 2023-03-20 13:45:34 -07:00
Mansour Quddus
a3364422fa LICENSE.md: Bump year to 2023 (#5195) 2023-03-18 07:12:08 -07:00
Tyler Veness
df3242a40a [wpimath] Fix NaN in C++ MakeCostMatrix() that takes an array (#5194)
Java's makeCostMatrix() and the C++ MakeCostMatrix() overload that takes
a parameter pack already do the right thing.
2023-03-17 07:05:28 -07:00
Peter Johnson
00abb8c1e0 [commands] RamseteCommand: default-initialize m_prevSpeeds (#5188) 2023-03-13 23:12:17 -07:00
Ryan Blue
c886273fd7 [wpilibj] DutyCycleEncoder.setDistancePerRotation(): fix simulation (#5147) 2023-03-13 21:28:55 -07:00
Peter Johnson
53b5fd2ace [ntcore] Use int64 for datalog type string (#5186)
There's a spec difference between NT4 and datalog for integers; NT4 uses
"int", datalog uses "int64". We were using "int" for datalog as well.

Also add backwards compatibility support to datalogtool for treating
"int" as "int64".
2023-03-13 21:28:07 -07:00
Peter Johnson
56b758320f [wpilib] DataLogManager: increase time for datetime to be valid (#5185)
There's no signal from NetComm as to when it is valid, and 1 second
seems to be marginal.  Increase to 6 seconds for just DS, 5 seconds for
FMS attached.
2023-03-13 21:27:52 -07:00
nt
08f298e4cd [wpimath] Fix Pose3d log returning Twist3d NaN for theta between 1E-8 and 1E-7 (#5168) 2023-03-13 21:27:32 -07:00
Jeffrey Morris
6d0c5b19db [commands] CommandScheduler.isComposed: Remove incorrect throws clause (NFC) (#5183) 2023-03-13 21:27:08 -07:00
Ryan Blue
0d22cf5ff7 [wpilib] Fix enableLiveWindowInTest crashing in disabled (#5173) 2023-03-10 19:24:40 -08:00
Ryan Blue
32ec5b3f75 [wpilib] Add isTestEnabled and minor docs cleanup (#5172) 2023-03-10 19:23:57 -08:00
Dustin Spicuzza
e5c4c6b1a7 [wpimath] Fix invalid iterator access in TimeInterpolatableBuffer (#5138) 2023-02-26 16:42:24 -08:00
nt
099d048d9e [wpimath] Fix Pose3d log returning Twist3d NaN for theta between 1E-9 and 1E-8 (#5143)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-02-26 16:41:36 -08:00
sciencewhiz
4af84a1c12 Fix Typos (NFC) (#5137) 2023-02-26 15:06:37 -08:00
Tyler Veness
ce3686b80d [wpimath] Check LTV controller max velocity precondition (#5142) 2023-02-26 15:05:41 -08:00
Colin Wong
4b0eecaee0 [commands] Subsystem: Add default command removal method (#5064) 2023-02-24 19:58:53 -08:00
Noah Andrews
edf4ded412 [wpilib] PH: Revert to 5V rail being fixed 5V (#5122) 2023-02-24 19:55:50 -08:00
Gabor Szita
4c46b6aff9 [wpilibc] Fix DataLogManager crash on exit in sim (#5125) 2023-02-23 20:13:20 -08:00
David Vo
490ca4a68a [wpilibc] Fix XboxController::GetBackButton doc (NFC) (#5131) 2023-02-23 20:11:10 -08:00
superpenguin612
cbb5b0b802 [hal] Simulation: Fix REV PH solenoids 8+ (#5132) 2023-02-23 20:10:44 -08:00
Thad House
bb7053d9ee [hal] Fix HAL_GetRuntimeType being slow on the roboRIO (#5130)
HAL_GetRuntimeType used to be a free call before the roboRIO2 was added. However, nLoadOut::getTargetClass() is not a free call, and it may hit the IPC layer. Cache this value so it is not called every time.
2023-02-23 00:59:59 -08:00
sciencewhiz
9efed9a533 Update .clang-format to c++20 (#5121)
This does not result in any reformatting
2023-02-20 10:54:55 -08:00
sciencewhiz
dbbfe1aed2 [wpilib] Use PH voltage to calc Analog pressure switch threshold (#5115)
The calculated trigger voltages were calculated with a hard coded 5v.
This introduces error when the 5V provided to the Analog pressure
sensor is not exactly 5v, as the pressure is a ratio of the analog
voltage and provided voltage.

This should improve
https://www.chiefdelphi.com/t/rev-pressure-sensor-enablecompressoranalog-not-reaching-configured-pressure/426868
where the 5v voltage was 4.92 volts, which introduces ~8 PSI of error.
2023-02-19 23:13:22 -08:00
Ryan Blue
de65a135c3 [wpilib] DutyCycleEncoderSim: Add channel number constructor (#5118) 2023-02-19 23:12:48 -08:00
sciencewhiz
3e9788cdff [docs] Strip path from generated NT docs (#5119)
Fixes #5117
2023-02-19 23:12:05 -08:00
Peter Johnson
ecb072724d [ntcore] Client::Disconnect(): actually close connection (#5113) 2023-02-17 23:56:49 -08:00
Peter Johnson
0d462a4561 [glass] NT view: Change string/string array to quoted (#5111) 2023-02-17 18:01:54 -08:00
Peter Johnson
ba37986561 [ntcore] NetworkClient::Disconnect: Add null check (#5112) 2023-02-17 16:48:34 -08:00
Peter Johnson
25ab9cda92 [glass,ov] Provide menu item to create topic from root (#5110) 2023-02-17 16:46:02 -08:00
Peter Johnson
2f6251d4a6 [glass] Set default value when publishing new topic (#5109) 2023-02-17 16:45:38 -08:00
Jonah
e9a7bed988 [wpimath] Add timestamp getter to MathShared (#5091)
This makes it possible to mock the timestamp for wpimath without affecting the rest of the library.

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2023-02-17 14:53:17 -08:00
Peter Johnson
9cc14bbb43 [ntcore] Add stress test to dev executable (#5107) 2023-02-16 22:49:36 -08:00
Peter Johnson
8068369542 [wpinet] uv: Stop creating handles when closing loop (#5102)
This prevents EventLoopRunner::Stop() from hanging in the case when
new handles are created after the async walk closes all the handles.
2023-02-16 22:49:14 -08:00
Peter Johnson
805c837a42 [ntcore] Fix use-after-free in server (#5101)
The client name deduplication didn't properly deduplicate.  Instead,
always append the client index to guarantee a unique name.
2023-02-16 22:45:50 -08:00
bovlb
fd18577ba0 [commands] Improve documentation of addRequirements (NFC) (#5103) 2023-02-16 22:08:46 -08:00
Tyler Veness
74dea9f05e [wpimath] Fix exception for empty pose buffer in pose estimators (#5106)
Fixes #5100.
2023-02-16 22:00:21 -08:00
sciencewhiz
9eef79d638 [wpilib] PneumaticHub: Document range of enableCompressorAnalog (NFC) (#5099) 2023-02-15 20:25:12 -08:00
Peter Johnson
843574a810 [ntcore] Use wpi::Now instead of loop time for transmit time
As the send function is called after local processing, there can be a
substantial delay between the loop time and the actual send.
2023-02-13 23:00:03 -08:00
Peter Johnson
226ef35212 [wpinet] WebSocket: Reduce server send frame overhead
Avoid allocating 4K buffer to send a 10-byte header per frame.
2023-02-13 23:00:03 -08:00
Peter Johnson
b30664d630 [ntcore] Reduce initial connection overhead
Mixing the announce and value messages causes significant downstream
inefficiency in both time and space.
2023-02-13 23:00:03 -08:00
sciencewhiz
804e5ce236 [examples] MecanumDrive: Fix axis comment in C++ example (NFC) (#5096) 2023-02-13 22:18:23 -08:00
Starlight220
49af88f2bb [examples] ArmSimulation: Fix flaky test (#5093) 2023-02-13 12:59:27 -08:00
Peter Johnson
d56314f866 [wpiutil] Disable mock time on the Rio (#5092) 2023-02-12 22:38:34 -08:00
Starlight220
43975ac7cc [examples] ArmSimulation, ElevatorSimulation: Extract mechanism to class (#5052) 2023-02-12 06:50:57 -08:00
Starlight220
5483464158 [examples, templates] Improve descriptions (NFC) (#5051) 2023-02-12 06:49:20 -08:00
Starlight220
785e7dd85c [wpilibc] SendableChooser: static_assert copy- and default-constructibility (#5078)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-02-12 06:24:00 -08:00
Peter Johnson
e57ded8c39 [ntcore] Improve disconnect error reporting (#5085)
Also fix memory leak in WebSocketConnection destructor.
2023-02-11 22:56:29 -08:00
Peter Johnson
01f0394419 [wpinet] Revert WebSocket: When Close() is called, call closed immediately (#5084)
This caused crashes in ntcore.

This reverts commit b879a6f8c6 (#5047).
2023-02-11 22:56:01 -08:00
Jordan McMichael
59be120982 [wpimath] Fix Pose3d exp()/log() and add rotation vector constructor to Rotation3d (#5072)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-02-08 21:31:03 -08:00
Tyler Veness
37f065032f [wpilib] Refactor TimedRobot tests (#5068) 2023-02-07 23:00:46 -08:00
Ryan Blue
22a170bee7 [wpilib] Add Notifier test (#5070) 2023-02-07 23:00:17 -08:00
Tyler Veness
2f310a748c [wpimath] Fix DCMotor.getSpeed() (#5061)
This bug didn't occur in C++ because the units system caught it at
compile time.
2023-02-05 13:21:16 -08:00
Nick Hadley
b43ec87f57 [wpilib] ElevatorSim: Fix WouldHitLimit methods (#5057) 2023-02-05 11:58:53 -08:00
Peter Johnson
19267bef0c [ntcore] Output warning on property set on unpublished topic (#5059)
Previously this was a debug-level message. This can primarily impact
users who call SetPersistent() on an entry before calling SetDefault().
2023-02-05 11:57:29 -08:00
Peter Johnson
84cbd48d84 [ntcore] Handle excludeSelf on SetDefault (#5058) 2023-02-05 11:57:09 -08:00
Peter Johnson
1f35750865 [cameraserver] Add GetInstance() to all functions (#5054)
GetInstance() is required to start the event listener that creates the
network table entries.

This is a C++ only change; Java uses static's and thus doesn't need this.

The right fix is to implement cscore's AddListener() immediate notification,
but that's much too invasive of a change to do this year.

This fixes the common use cases, but doesn't fix all cases, as e.g. creating
a UsbCamera manually before calling any CameraServer functions will still
have the issue, but there's an easy workaround--call
CameraServer::SetSize() prior to creating any cameras.
2023-02-05 11:28:53 -08:00
Peter Johnson
8230fc631d [wpilib] Revert throw on nonexistent SimDevice name in SimDeviceSim (#5053)
This breaks current vendor use of SimDeviceSim.

This reverts commit d991f6e435 (#5041).
2023-02-05 11:27:55 -08:00
Peter Johnson
b879a6f8c6 [wpinet] WebSocket: When Close() is called, call closed immediately (#5047)
This provides the closed callback with the real reason for the
connection being closed.  Keep closed from being called twice by adding
a check in SetClosed().
2023-02-03 22:59:19 -08:00
Peter Johnson
49459d3e45 [ntcore] Change wire timeout to fixed 1 second (#5048)
Previously the timeout was 10 times the update rate, so with low update
rates it could be as small as 50 ms, causing spurious disconnects when
large or many topics were published.
2023-02-03 22:05:41 -08:00
Jordan McMichael
4079eabe9b [wpimath] Discard stale pose estimates (#5045)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-02-03 22:04:30 -08:00
Peter Johnson
fe5d226a19 [glass] Fix option for debug-level NT logging (#5049) 2023-02-03 22:03:45 -08:00
Peter Johnson
b7535252c2 [ntcore] Don't leak buffers in rare WS shutdown case (#5046)
If the request called the callback after the WebSocket had been
destroyed, the buffers were leaked.
2023-02-03 21:56:35 -08:00
Peter Johnson
b61ac6db33 [ntcore] Add client disconnect function (#5022)
As setServer doesn't disconnect, it's useful to have a function that
disconnects without needing to completely stop the client.
2023-02-03 15:28:00 -08:00
Ryan Blue
7b828ce84f [wpimath] Add nearest to Pose2d and Translation2d (#4882)
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2023-02-03 15:27:16 -08:00
Michael Leong
08a536291b [examples] Improvements to Elevator Simulation Example (#4937)
Co-authored-by: Abhay Shukla <105139789+aboombadev@users.noreply.github.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2023-02-03 15:23:06 -08:00
Peter Johnson
193a10d020 [wpigui] Limit frame rate to 120 fps by default (#5030)
Limiting with vsync is apparently unreliable on a number of systems;
this resulted in high CPU/GPU usage.

Also add current actual frame rate to about dialog of GUI tools.
2023-02-03 15:21:52 -08:00
sciencewhiz
7867bbde0e [wpilib] Clarify DS functions provided by FMS (NFC) (#5043) 2023-02-03 15:21:12 -08:00
Peter Johnson
fa7c01b598 [glass] Add option for debug-level NT logging (#5007) 2023-02-03 15:20:03 -08:00
truher
2b81610248 [wpiutil] Add msgpack to datalog Python example (#5032) 2023-02-03 15:19:44 -08:00
Tyler Veness
a4a369b8da CONTRIBUTING.md: Add unicodeit CLI to math docs guidelines (#5031) 2023-02-03 15:19:01 -08:00
Ryan Blue
d991f6e435 [wpilib] Throw on nonexistent SimDevice name in SimDeviceSim constructor (#5041)
Previously this would just create a object that was otherwise non-functional.
2023-02-03 15:18:31 -08:00
Peter Johnson
a27a047ae8 [hal] Check for null in getSimDeviceName JNI (#5038) 2023-02-01 23:25:55 -08:00
Starlight220
2f96cae31a [examples] Hatchbots: Add telemetry (#5011) 2023-01-31 23:44:18 -08:00
Peter Johnson
83ef8f9658 [simulation] GUI: Fix buffer overflow in joystick axes copy (#5036)
This was using an incorrect sizeof which would copy excessive data and
overwrite the button data.
2023-01-31 23:40:22 -08:00
Starlight220
4054893669 [commands] Fix C++ Select() factory (#5024)
Update example to use it.
2023-01-29 07:23:12 -08:00
Sriman Achanta
f75acd11ce [commands] Use Timer.restart() (#5023) 2023-01-29 07:21:07 -08:00
Tyler Veness
8bf67b1b33 [wpimath] PIDController::Calculate(double, double): update setpoint flag (#5021)
Fixes #5020.
2023-01-29 07:18:48 -08:00
Peter Johnson
49bb1358d8 [wpiutil] MemoryBuffer: Fix GetMemoryBufferForStream (#5017)
This would previously just write past the end of the buffer, smashing
the stack.  It's only called in the case when a non-file or block device
is used as the file.
2023-01-28 22:38:34 -08:00
Peter Johnson
9c4c07c0f9 [wpiutil] Remove NDEBUG check for debug-level logging (#5018)
This adds minimal overhead but is useful when debugging release
binaries.
2023-01-28 14:13:58 -08:00
Peter Johnson
1a47cc2e86 [ntcore] Use full handle when subscribing (#5013)
Just using the index is insufficient because of Subscriber overlap with
MultiSubscriber.
2023-01-27 09:14:38 -08:00
Ryan Blue
7cd30cffbc Ignore networktables.json (#5006) 2023-01-26 09:21:58 -08:00
DeltaDizzy
92aecab2ef [commands] Command controllers are not subclasses (NFC) (#5000) 2023-01-25 15:20:29 -08:00
Peter Johnson
8785bba080 [ntcore] Special-case default timestamps (#5003)
Previously, a setDefault() on the server could override a client doing a
real set() if the time offset between client and server was negative,
resulting in a negative timestamp from the client.  This is a not
uncommon situation with robot code, as the robot code always starts at
time 0, so any clients that set values earlier (in real time) would have
negative timestamps.

Also improve special casing of 0 in the transmit side to make sure a
normal timestamp will never get sent as 0.
2023-01-25 11:36:13 -08:00
Peter Johnson
9e5b7b8040 [ntcore] Handle topicsonly followed by value subscribe (#4991)
Previously this wouldn't send the last value on the value subscribe if a
topics only subscription already existed.

Also start adding server implementation unit tests.
2023-01-24 21:50:38 -08:00
Sriman Achanta
917906530a [wpilib] Add Timer::Restart() (#4963) 2023-01-23 14:50:46 -08:00
Tyler Veness
00aa66e4fd [wpimath] Remove extraneous assignments from DiscretizeAB() (#4967) 2023-01-23 09:46:12 -08:00
Starlight220
893320544a [examples] C++ RamseteCommand: Fix units (#4954)
Also fix the memory leak in the command-based auto.
2023-01-22 11:20:35 -08:00
Evan
b95d0e060d [wpilib] XboxController: Fix docs discrepancy (NFC) (#4993)
Comments for leftTrigger said they attach to the right trigger of the controller.
2023-01-21 22:09:55 -08:00
Peter Johnson
008232b43c [ntcore] Write empty persistent file if none found (#4996)
This avoids the warning appearing on every startup when persistent
values aren't used.

Also add note to message saying it can be ignored if persistent values
aren't expected.
2023-01-21 22:09:24 -08:00
Starlight220
522be348f4 [examples] Rewrite tags (NFC) (#4961) 2023-01-21 15:24:10 -08:00
Tyler Veness
d48a83dee2 [wpimath] Update Wikipedia links for quaternion to Euler angle conversion (NFC) (#4995) 2023-01-21 15:16:35 -08:00
Peter Johnson
504fa22143 [wpimath] Workaround intellisense Eigen issue (#4992)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-01-21 15:16:12 -08:00
Brady Schindler
b2b25bf09f [commands] Fix docs inconsistency for toggleOnFalse(Command) (NFC) (#4978) 2023-01-20 23:47:37 -08:00
Thad House
ce3dc4eb3b [hal] Properly use control word that is in sync with DS data (#4989) 2023-01-20 23:46:56 -08:00
Thad House
1ea48caa7d [wpilib] Fix C++ ADXRS450 and Java SPI gyro defs (#4988) 2023-01-20 13:25:13 -08:00
Thad House
fb101925a7 [build] Include wpimathjni in commands binaries (#4981) 2023-01-19 22:05:32 -08:00
Thad House
657951f6dd [starter] Add a process starter for use by the installer for launching tools (#4931) 2023-01-19 20:09:35 -08:00
Tyler Veness
a60ca9d71c [examples] Update AprilTag field load API usage (#4975) 2023-01-19 17:01:17 -08:00
Tyler Veness
f8a45f1558 [wpimath] Remove print statements from tests (#4977) 2023-01-19 17:00:35 -08:00
sciencewhiz
ecba8b99a8 [examples] Fix swapped arguments in MecanumControllerCommand example (#4976) 2023-01-18 21:25:49 -08:00
Berke Sinan Yetkin
e95e88fdf9 [examples] Add comment to drivedistanceoffboard example (#4877)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2023-01-18 20:46:41 -08:00
CarloWoolsey
371d15dec3 [examples] Add Computer Vision Pose Estimation and Latency Compensation Example (#4901)
This PR updates the existing differentialdriveposeestimator example to include computer vision pose estimation and latency compensation.

The example generates a simulated cameraToTarget transformation, which is then fed into ComputerVisionUtil.objectToRobotPose() to compute the robot's field-relative position exclusively from vision measurements. The vision measurements are applied through DifferentialDrivePoseEstimator.addVisionMeasurement().

The updated example constructs an AprilTagFieldLayout from JSON. This requires a deploy directory, something which isn't currently supported in wpilibjExamples and wpilibcExamples.
2023-01-18 20:46:05 -08:00
Peter Johnson
cb9b8938af [sim] Enable docking in the GUI (#4960) 2023-01-18 20:42:58 -08:00
Brennen Puth
3b084ecbe0 [apriltag] AprilTagFieldLayout: Improve API shape for loading builtin JSONs (#4949) 2023-01-18 20:42:39 -08:00
Matt
27ba096ea1 [wpilib] Fix MOI calculation error in SingleJointedArmSim (#4968)
Previous calculation derivation mixed up length and distance to CG.
2023-01-18 20:40:39 -08:00
Jordan McMichael
42c997a3c4 [wpimath] Fix Pose3d exponential and clean up Pose3d logarithm (#4970)
Implementation based on this paper: https://ethaneade.org/lie.pdf
2023-01-18 20:38:03 -08:00
Tyler Veness
5f1a025f27 [wpilibj] Fix typo in MecanumDrive docs (NFC) (#4969) 2023-01-18 13:47:27 -08:00
Tyler Veness
0ebf79b54c [wpimath] Fix typo in Pose3d::Exp() docs (NFC) (#4966) 2023-01-18 13:46:45 -08:00
Oliver W
a8c465f3fb [wpimath] HolonomicDriveController: Add getters for the controllers (#4948) 2023-01-16 08:33:15 -08:00
Starlight220
a7b1ab683d [wpilibc] Add unit test for fast deconstruction of GenericHID (#4953) 2023-01-16 08:28:06 -08:00
Starlight220
bd6479dc29 [build] Add Spotless for JSON (#4956) 2023-01-16 08:26:46 -08:00
Thad House
5cb0340a8c [hal, wpilib] Load joystick values upon code initialization (#4950)
During HAL_Initialize, wait up to 100ms for a DS packet to be received. Then in RobotBase, right after calling HAL_Initialize, call each language's RefreshData function to force a high level DS update. If the DS is connected, will get joystick data. If there is no data, nothing different will happen, but in that case there's no joysticks anyway.
2023-01-15 16:36:44 -08:00
sciencewhiz
ab0e8c37a7 [readme] Update build requirements (NFC) (#4947)
Change to adoptium, and add Xcode min version
2023-01-15 15:19:24 -08:00
Tyler Veness
b74ac1c645 [build] Add apriltag to C++ cmake example builds (#4944)
This fixes compilation of the apriltag vision example on my machine.
2023-01-13 23:24:14 -08:00
Doug Wegscheid
cf1a411acf [examples] Add example programs for AprilTags detection (#4932)
Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2023-01-13 23:08:45 -08:00
sciencewhiz
1e05b21ab5 [wpimath] Fix PID atSetpoint to not return true prematurely (#4906)
Wait until setpoint and measurement have been set.
2023-01-13 22:26:30 -08:00
ohowe
e5a6197633 [wpimath] Fix SwerveDriveKinematics not initializing a new array each time (#4942)
This is problematic if you call it twice before utilizing the result.
2023-01-13 20:16:50 -08:00
Peter Johnson
039edcc23f [ntcore] Queue current value on subscriber creation (#4938)
This fixes a potential race condition in code that only uses readQueue.
2023-01-13 20:07:24 -08:00
Matt
f7f19207e0 [wpimath] Allow multiple vision measurements from same timestamp (#4917)
Co-authored-by: Jordan McMichael <jlmcmchl@gmail.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-01-11 23:04:30 -08:00
Starlight220
befd12911c [commands] Delete UB-causing rvalue variants of CommandPtr methods (#4923)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2023-01-11 22:53:04 -08:00
superpenguin612
34519de60a [commands] Fix spacing in command composition exception (#4924) 2023-01-11 11:46:33 -08:00
Ryan Blue
dc4355c031 [hal] Add handle constructor and name getters for sim devices (#4925) 2023-01-11 11:45:15 -08:00
Ryan Blue
53d8d33bca [hal, wpilibj] Add missing distance per pulse functions to EncoderSim (#4928)
Also fix C++ and Java EncoderSim.setDistancePerPulse() not propagating value to SimEncoderData.
2023-01-11 11:43:56 -08:00
bovlb
530ae40614 [apriltag] Explain what April tag poses represent (NFC) (#4930) 2023-01-11 11:42:30 -08:00
Starlight220
79f565191e [examples] DigitalCommunication, I2CCommunication: Add tests (#4865) 2023-01-08 16:33:53 -08:00
Starlight220
2cd9be413f [wpilib, examples] Cleanup PotentiometerPID, Ultrasonic, UltrasonicPID examples (#4893)
Fix C++ Ultrasonic to return correct units.
2023-01-08 16:33:07 -08:00
Matt
babb0c1fcf [apriltag] Add 2023 field layout JSON (#4912) 2023-01-08 16:30:45 -08:00
ohowe
330ba45f9c [wpimath] Fix swerve kinematics util classes equals function (#4907)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2023-01-08 16:29:35 -08:00
sciencewhiz
51272ef6b3 [fieldImages] Add 2023 field (#4915) 2023-01-08 16:28:25 -08:00
Starlight220
0d105ab771 [commands] Deduplicate command test utils (#4897) 2023-01-08 07:44:53 -08:00
Tyler Veness
cf4235ea36 [wpiutil] Guard MSVC pragma in SymbolExports.h (#4911)
MinGW gives an unknown pragma warning on Windows.
2023-01-07 16:41:40 -08:00
Ryan Blue
2d4b7b9147 [build] Update opencv version in opencv.gradle (#4909) 2023-01-06 18:09:58 -08:00
Peter Johnson
aec6f3d506 [ntcore] Fix client flush behavior (#4903)
We need to ignore per-publisher send periods when flushing.

Also fix NT4 client to use flush async's (same as NT3 client).
2023-01-04 23:36:26 -08:00
Peter Johnson
bfe346c76a [build] Fix cmake java resources (#4898)
These need to be relative paths, but GLOB generates absolute paths by
default.
2023-01-04 08:16:47 -08:00
Ryan Blue
83f1860047 [wpilib] Add/update documentation to PneumaticBase and subclasses (NFC) (#4881)
Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2023-01-02 10:23:59 -08:00
Dustin Spicuzza
9872e676d8 [commands] Make Subsystem destructor virtual (#4892)
C++ best practice if there are other functions that are virtual.
2023-01-02 07:59:12 -08:00
Dustin Spicuzza
25db20e49d [hal] Fix segfault in various HAL functions (#4891) 2023-01-01 23:19:04 -08:00
ohowe
b0c6724eed [glass] Add hamburger menu icon to titlebars (#4874)
This does the same thing as right clicking, but provides a visual indicator.
The icon disappears if the window is too small or docked (right click keeps working).
2023-01-01 20:05:09 -08:00
Tyler Veness
f0fa8205ac Add missing compiler flags and fix warnings (#4889)
This makes the build fail on warnings. It caught two out-of-bounds reads
and a deprecation warning.
2023-01-01 08:14:19 -08:00
Dustin Spicuzza
42fc4cb6bc [wpiutil] SafeThread: Provide start/stop hooks (#4880)
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2022-12-31 15:40:45 -08:00
Sriman Achanta
cc166c98d2 [templates] Add Command-based skeleton template (#4861)
Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2022-12-31 13:18:43 -08:00
Thad House
3f51f10ad3 [build] Update to 2023v3 image (#4886) 2022-12-31 13:16:41 -08:00
Peter Johnson
1562eae74a [ntcore] Refactor meta-topic decoding from glass (#4809) 2022-12-31 12:01:51 -08:00
Thad House
b632b288a3 Fix usages of std::min and std::max to be windows safe (#4887) 2022-12-31 12:00:45 -08:00
Dustin Spicuzza
c11bd2720f [wpilibc] Add internal function to reset Shuffleboard instance (#4884)
Needed for RobotPy test framework.
2022-12-31 10:43:48 -08:00
Peter Johnson
f1151d375f [ntcore] Add method to get server time offset (#4847)
Also exposes this as an event signaled when the offset is updated due to
a ping response from the server.
2022-12-30 20:15:57 -08:00
Ryan Blue
fe1b62647f [hal,wpilib] Update documentation for getComments (NFC) (#4879) 2022-12-30 04:15:37 -08:00
Thad House
c49a45abbd [build] Fix examples linking in incorrect jni library (#4873) 2022-12-29 08:07:59 -06:00
Griffin Della Grotte
bc3d01a721 [build] Add platform check to doxygen plugin (#4862)
This allows the build to work on aarch64 and other platforms without downloadable doxygen binaries.
2022-12-27 22:43:21 -06:00
Ryan Blue
bc473240ae Add Jetbrains Fleet folder to .gitignore (#4872) 2022-12-27 22:41:13 -06:00
Tyler Veness
2121bd5fb8 [wpimath] Remove RKF45 (#4870)
RKDP is strictly better in terms of accuracy per unit of work. We used
RKF45 for sim physics in the 2021 season, but we transitioned to RKDP
before the 2022 season.
2022-12-27 19:29:59 -06:00
Griffin Della Grotte
835f8470d6 [build] Fix roborio cross-compiler on arm hosts (#4864) 2022-12-27 10:26:53 -08:00
Peter Johnson
6cfe5de00d [ntcore] Don't deadlock server on early destroy (#4863)
It was possible to deadlock on instance destroy if the server had started
but had not yet fully initialized its handles.
2022-12-27 10:25:48 -08:00
Ryan Blue
2ac41f3edc [hal, wpilib] Add RobotController.getComments() (#4463) 2022-12-26 11:39:51 -08:00
Sriman Achanta
26bdbf3d41 Java optimization and formatting fixes (#4857) 2022-12-26 11:37:53 -08:00
Sriman Achanta
92149efa11 Spelling and grammar cleanups (#4849) 2022-12-26 11:32:13 -08:00
Ryan Blue
176fddeb4c [commands] Add functions to HID classes to allow use of axes as BooleanEvents/Triggers (#4762) 2022-12-26 11:29:14 -08:00
Starlight220
87a34af367 [templates] Add bindings to command-based template (#4838) 2022-12-26 11:28:06 -08:00
Starlight220
4534e75787 [examples] Remove redundant MotorControl example (#4837)
The MotorControlEncoder had the exact same content, with the addition of an encoder. No point in having both examples.
2022-12-26 11:27:20 -08:00
Griffin Della Grotte
1cbebaa2f7 [commands] Remove final semicolon from test macro definition (#4859) 2022-12-26 00:14:59 -06:00
Ryan Blue
6efb9ee405 [commands] Add constructor for SwerveControllerCommand that takes a HolonomicDriveController (#4785)
Also adds copy and move constructors to HolonomicDriveController.
2022-12-25 18:48:27 -08:00
Thad House
1e7fcd5637 [cscore] Change run loop functions to not be mac specific (#4854) 2022-12-25 13:37:59 -06:00
Peter Johnson
1f940e2b60 [apriltag] Add C++ wrappers, rewrite Java/JNI to match (#4842)
This provides a consistent class-based interface to the underlying C
library from both C++ and Java.

Co-authored-by: Matt <matthew.morley.ca@gmail.com>
2022-12-25 08:15:43 -08:00
Starlight220
a6d127aedf [build] Add missing task dependency in wpilibjExamples (#4852) 2022-12-25 07:37:10 -08:00
Thad House
b893b3d6d3 [cscore] Add support for USB cameras on macOS (#4846)
The main restriction is there must be an event loop running on the main thread.
No special action is required for GUI applications, but for non-GUI applications, a
RunOsxRunLoop() function is provided that needs to be called from the main thread.
2022-12-25 07:36:00 -08:00
Peter Johnson
1696a490fa [glass] Add support for alternate NT ports (#4848) 2022-12-24 20:18:07 -06:00
Peter Johnson
40a22d69bc [glass] Add support for alternate NT ports (#4848) 2022-12-24 20:17:45 -06:00
Sriman Achanta
e84dbfede0 [wpilib] GenericHID: Add rumble both option (#4843) 2022-12-24 11:28:52 -08:00
CarloWoolsey
8aa9dbfa90 [examples] Link apriltag package in examples build.gradle (#4845) 2022-12-23 20:04:59 -06:00
Ryan Blue
eda2fa8a17 [build] Update Spotless (#4840)
Removes JVM args workaround needed for old version of spotless to run on JDK 17.

2 files had formatting updates.
2022-12-21 08:54:41 -06:00
sciencewhiz
d20594db0d Fix typos (#4839) 2022-12-21 08:53:00 -06:00
Ryan Blue
dd8ecfdd54 [commands] Fix typo in waitUntil docs (NFC) (#4841) 2022-12-21 08:24:25 -06:00
Thad House
17ceebfff4 [apriltag] Clean up apriltag JNI (#4823) 2022-12-19 21:06:36 -08:00
Ryan Blue
8b74ab389d [examples] RapidReactCommandBot: Fix array indices (#4833) 2022-12-18 16:54:37 -06:00
David Vo
1aad3489c2 [sim] Implement PD total current and power (#4830) 2022-12-18 08:00:31 -06:00
Ashray._.g
2744991771 [wpimath] Fix docs in SwerveModulePosition (#4825)
Changed m/s and speeds to m and distance.
2022-12-16 05:48:20 -08:00
Peter Johnson
ffbf6a1fa2 [commands] Disable regularly failing unit test (#4824) 2022-12-15 21:53:08 -08:00
Starlight220
fbabd0ef15 [commands] Enhance Command Sendable implementations (#4822) 2022-12-15 18:28:52 -08:00
Thad House
7713f68772 [hal] Use atomic rather then mutex for DS Data updates (#4787)
Using an atomic here means we are never going against a lock that is touchable from user code. That should make reading the DS data from the DS callback even safer.
2022-12-15 18:27:52 -08:00
Starlight220
701995d6cc [examples] Update Command-based starter project (#4778) 2022-12-15 09:40:14 -08:00
Thad House
bf7068ac27 [wpilibc] Add missing PPS implementation for C++ (#4821) 2022-12-15 09:28:42 -08:00
Peter Johnson
aae0f52ca6 [ntcore] NetworkTable: fix visibility of get/set value (#4820) 2022-12-14 19:43:53 -08:00
Thad House
ee02fb7ba7 [hal] Add support for Pulse-Per-Second signal (#4819) 2022-12-14 18:15:34 -08:00
Thad House
518916ba02 [wpilib] Fix DS mode thread event being manual reset accidentally (#4818)
These need to be automatic reset.
2022-12-14 10:17:13 -08:00
Thad House
3997c6635b [hal] Update to new image, use new TCP notify callback and new duty cycle API (#4774) 2022-12-13 22:37:42 -08:00
Michael Leong
cc8675a4e5 [examples] Add comment on how to view elevator sim (NFC) (#4482) 2022-12-13 22:34:00 -08:00
Peter Johnson
fb2c170b6e [ntcore] Simplify local startup (#4803)
The current approach was slightly more efficient but didn't correctly
handle meta-topic publishing for topics published before the server was
started.
2022-12-13 22:31:44 -08:00
shueja-personal
7ba8a9ee1f [wpimath] ProfiledPIDController: Add to SendableRegistry (#4656)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2022-12-13 22:31:06 -08:00
Sriman Achanta
c569d8e523 [wpilib] Joystick.getMagnitude(): use hypot() function (#4816) 2022-12-13 22:29:09 -08:00
bovlb
2a5e89fa97 [apriltag] Improve description of pose coordinates (NFC) (#4810)
The "bottom-left" language appears to be based on [a 2-D diagram  on another page](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/geometry/coordinate-systems.html) and doesn't seem very helpful here.
2022-12-13 22:27:43 -08:00
Drew Williams
cc003c6c38 [apriltag] Fix AprilTagFieldLayout JSON name (#4814) 2022-12-13 22:27:08 -08:00
Sriman Achanta
5522916123 [commands] CommandXBoxController bumper documentation fix (NFC) (#4815) 2022-12-13 22:26:35 -08:00
Peter Johnson
967b30de3a [glass] Fix NT view UpdateClients() bug (#4808)
If UpdateClients() was called in the same update batch as an entry
removal, it could crash in GetEntry() due to a null entry caused by
deletion before a removal erase pass was made.
2022-12-12 23:38:36 -08:00
Tyler Veness
3270d4fc86 [wpimath] Rewrite pose estimator docs (#4807) 2022-12-12 20:30:52 -08:00
Thad House
be39678447 [apriltag] Add test to ensure apriltagjni loads (#4805) 2022-12-12 20:30:25 -08:00
Starlight220
61c75deb2a [commands] Test no-op behavior of scheduling a scheduled command (#4806) 2022-12-12 20:29:47 -08:00
Peter Johnson
a865f48e96 [ntcore] Pass pub/sub options as a unified PubSubOptions struct (#4794)
In Java, PubSubOption is still used for passing options, but this
simplifies C++ use substantially, as it allows aggregate construction.
2022-12-12 19:28:15 -08:00
Ryan Blue
f66a667321 [commands] Fix incorrect Trigger docs (NFC) (#4792) 2022-12-12 15:38:29 -08:00
Peter Johnson
f8d4e9866e [ntcore] Clean up ntcore_test.h (#4804)
The RPC functions are no longer implemented.

Also make header C-safe.
2022-12-12 15:36:54 -08:00
Tyler Veness
7e84ea891f [wpimath] Fix ComputerVisionUtil transform example in parameter docs (NFC) (#4800) 2022-12-11 22:44:08 -08:00
Charlie
da3ec1be10 [wpimath] Change terminology for ArmFeedforward gravity gain (NFC) (#4791) 2022-12-11 22:43:44 -08:00
Ryan Blue
944dd7265d [wpilibc] Add C++ Notifier error handling, update java notifier error message (#4795) 2022-12-11 22:42:22 -08:00
Ryan Blue
6948cea67a [wpiutil] Fix MemoryBuffer initialization (#4797)
Dereferencing an end iterator is undefined behavior and causes a failed assertion when running in Windows debug.
2022-12-11 07:39:04 -08:00
Ryan Blue
a31459bce6 [wpiutil] Fix UnescapeCString overflow when inputSize < 2 (#4796)
Add tests for empty, small, and string without escapes.
2022-12-11 07:36:38 -08:00
ohowe
4a0ad6b48c [wpimath] Rotation2d: Add reference to angleModulus in docs (NFC) (#4786) 2022-12-09 23:35:15 -08:00
Peter Johnson
e6552d272e [ntcore] Remove table multi-subscriber (#4789)
This wasn't well thought out, and leaks horribly in Java.

Reverts part of #4640.
2022-12-09 21:25:29 -08:00
Ryan Blue
bde383f763 [hal] Replace const char* with std::string_view in Driver Station sim functions (#4532) 2022-12-09 13:10:23 -08:00
Ryan Blue
5a52b51443 [hal] Add RobotController.getSerialNumber() (#4783) 2022-12-08 21:58:55 -08:00
Thad House
69a66ec5ec [wpilib] Fix multiple motor safety issues (#4784)
Java was missing the motor safety thread entirely
C++ accidentally used a manual reset event, causing the motor safety thread to spin.
C++ PWMMotorController would not feed the watch kitty.
Both languages would call feed() from the StopMotor call, causing some ping ponging.
2022-12-08 19:47:47 -08:00
sciencewhiz
989c9fb29a [wpimath] Revert Rotation2D change that limits angles (#4781)
Reverts "[wpimath] Constrain Rotation2d range to -pi to pi (#4611)"
This reverts commit d1d458db2b.

This broke multiple teams code in beta. It is also easier to limit the angle externally, then reconstruct a larger angle that got limited. This additionally adds comments to clarify the behavior and retains tests that were added in the reverted commit, and fixes a javadoc comment angle reference.
2022-12-08 18:10:44 -08:00
Peter Johnson
0f5b08ec69 [wpigui] Update imgui to 1.89.1+ (#4780) 2022-12-08 00:24:27 -08:00
Starlight220
fba191099c [examples] AddressableLED: Add unit test (#4779) 2022-12-07 21:47:47 -08:00
Peter Johnson
b390cad095 [wpilibj] Consistently use ErrorMessages.requireNonNullParam (#4776)
Also remove wpilibj version of ErrorMessages and consistently use static import.
2022-12-07 21:46:26 -08:00
Peter Johnson
b9772214d9 [wpilib] Sendable: Don't call setter for getter changes 2022-12-07 21:29:51 -08:00
Peter Johnson
342c375a71 [ntcore] Add subscriber option to exclude single publisher
This enables limited self-exclusion for entries seeing their own changes
or similarly with a pub/sub pair.
2022-12-07 21:29:51 -08:00
Peter Johnson
b0e4053087 [ntcore] Use int for options instead of double
Periodic time is stored in milliseconds.
2022-12-07 21:29:51 -08:00
Peter Johnson
f3e666b7bb [cscore] Convert YUYV and UYVY directly to grayscale (#4777)
This is significantly more efficient than converting by way of BGR.
2022-12-07 10:36:40 -08:00
William Toth
b300518bd1 [hal] Add CAN Stream API to Java through JNI bindings (#4193)
The CAN Stream API allows defining an buffer to receive an
arbitrary set of CAN messages, based on an ID and a mask. Messages
are added to this queue separate of other CAN APIs. This means the
messages can be receive without impacting other APIs such as
vendor APIs.

This enables things like detection of what devices are on the
bus, or custom decoding, without using vendor APIs.

Co-authored-by: Thad House <thadhouse1@gmail.com>
2022-12-06 21:58:09 -08:00
Peter Johnson
be27171236 [wpilibj] Shuffleboard: Check for null sendable (#4772)
Adding a null sendable to a container could result in a delayed NullPointerException.
2022-12-06 21:14:09 -08:00
Starlight220
4bbdbdfb48 [commands] Move GroupedCommands to CommandScheduler (#4728)
Move the command group checking functionality from CommandGroupBase into CommandScheduler.
Update references to grouping as composition for clarity (because explicitly grouping isn't the only way to do it).
Deprecate the static factory methods parallel, race, and deadline in CommandGroupBase in favor of the identical ones in Commands.
2022-12-06 21:13:31 -08:00
Tyler Veness
f18fd41ac3 [wpimath] Remove broken and obsoleted ComputerVisionUtil functions (#4775)
The ComputerVisionUtil class was added before AprilTag support was
announced. Now that it has, the functions for estimating a pose from
range and yaw are no longer needed; it's just better to get the pose
directly from the AprilTag.

The coordinate system on some function arguments was confusing or didn't
match the NWU convention the rest of the library uses. It's easier to
remove the functions now and add them back after they're fixed since the
fixes aren't trivial.

The range function was removed because it uses pitch and yaw in the
camera's spherical coordinate system, which is obsoleted by AprilTags.
AprilTags give you a 6DOF pose directly, so range can be obtained via
Pose2d.getTranslation().getDistance().

Fixes #4757.
2022-12-06 21:11:27 -08:00
Peter Johnson
2d0faecf4f [glass] DataSource: Add spinlock to protect value (#4771)
A lock is needed here due to HAL async callbacks.
2022-12-06 21:09:14 -08:00
Peter Johnson
348bd107fc [hal] Add CANManufacturer for The Thrifty Bot (#4773) 2022-12-06 21:08:45 -08:00
Starlight220
3149dc64b8 [examples] HatchbotInlined: Use Subsystem factories (#4765) 2022-12-06 15:10:39 -08:00
Jordan McMichael
8618dd4160 [glass, wpilib] Replace remaining references to Speed Controller with Motor Controller (#4769) 2022-12-05 20:06:43 -08:00
Peter Johnson
72e21a1ed1 [apriltag] Use wpilibsuite fork of apriltag (#4764) 2022-12-05 19:59:24 -08:00
Ryan Blue
eab0d929e6 [commands] CommandGenericHID POV methods: Fix docs (NFC) (#4760) 2022-12-05 13:46:46 -08:00
Ryan Blue
6789869663 [wpilib] Call set(0) rather than disable for stopMotor (#4763)
For PWM motor controllers, this is going to be the fastest way to stop the motor,
as disabling the PWM output will have a small delay due to the motor controller
needing to detect the missing signal.

Note Set(0) is not a safe approach for CAN motor controllers, which may have closed
loop operation, non-% output set() calls, etc.
2022-12-05 13:33:54 -08:00
Dustin Spicuzza
c9dea2968d [cscore] Emit warning that USB Camera isn't supported on OSX (#4766)
Reduces user confusion, as right now there's really no indication that something is wrong other than there's no camera,
2022-12-05 13:30:13 -08:00
sciencewhiz
8f402645f5 [commands] Fix PIDSubsystem setSetpoint behavior (#4759)
No longer stores a temporary setpoint in PIDSubsystem, instead
immediately sending to PIDController. This fixes an issue where the
setpoint didn't take effect until the Subsystem Periodic method ran, and
could cause commands to finish early if they were scheduled after the
subsystem periodic method ran because it used the old setpoint.
2022-12-03 11:32:46 -08:00
Tyler Veness
f24ad1d715 [build] Upgrade to googletest 1.12.1 (#4752)
This fixes GCC 12 warnings for googletest internals.
2022-12-03 11:32:08 -08:00
Jaci Brunning
ff88756864 [wpimath] Add new DCMotor functions for alternative calculations and reduction calculation (#4749) 2022-12-03 09:47:16 -08:00
superpenguin612
f58873db8e [wpimath] Remove extra terms in matrix for pose estimator docs (#4756) 2022-12-03 09:46:34 -08:00
superpenguin612
37e969b41a [wpimath] Add constructors to pose estimators with default standard deviations (#4754) 2022-12-03 09:46:10 -08:00
Tyler Veness
13cdc29382 [ci] Rename comment command from "/wpiformat" to "/format" (#4755)
It now runs more than just wpiformat.
2022-12-02 18:24:06 -08:00
Tyler Veness
6e23985ae6 [examples] Add main include directory to test builds (#4751)
This fixes the following compilation errors:
```
/home/tav/frc/wpilib/allwpilib/wpilibcExamples/src/main/cpp/examples/UnitTest/cpp/subsystems/Intake.cpp:5:10: fatal error: subsystems/Intake.h: No such file or directory
    5 | #include "subsystems/Intake.h"
      |          ^~~~~~~~~~~~~~~~~~~~~

/home/tav/frc/wpilib/allwpilib/wpilibcExamples/src/test/cpp/examples/UnitTest/cpp/subsystems/IntakeTest.cpp:11:10: fatal error: Constants.h: No such file or directory
   11 | #include "Constants.h"
      |          ^~~~~~~~~~~~~
```
2022-12-02 10:37:49 -08:00
Starlight220
66bb0ffb2c [examples] Add unit testing infrastructure (#4646) 2022-12-02 08:40:14 -08:00
Tyler Veness
74cc86c4c5 [wpimath] Make transform tests use pose/transform equality operators (#4675)
Also add more nonzeros to Transform3d tests to make them more
comprehensive.
2022-12-02 08:36:57 -08:00
Jordan McMichael
e22d8cc343 [wpimath] Use Odometry for internal state in Pose Estimation (#4668)
This effectively replaces the Unscented Kalman Filter used for Pose Estimation with the Odometry model, and uses a recalculable Kalman gain matrix to update pose estimations whenever a vision measurement is added.

Notably, this change removes the need for the confusing generics used in Java, and the C++ implementation got quite a bit less complex as well.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-12-02 08:36:10 -08:00
Ryan Blue
68dba92630 [ci] Update mac and windows builds to Java 17 (#4750) 2022-12-02 08:31:38 -08:00
Tyler Veness
23bfc2d9ab [sim] Remove unmaintained Gazebo support (#4736) 2022-12-01 20:46:47 -08:00
Starlight220
1f1461e254 [wpilib] Add method to enable/disable LiveWindow in test mode (#4678) 2022-12-01 13:28:06 -08:00
Tyler Veness
eae68fc165 [wpimath] Add tolerance for Rotation3d rotation matrix special orthogonality (#4744) 2022-11-30 19:51:31 -08:00
Tyler Veness
4c4545fb4b [apriltag] Suppress warning (#4743) 2022-11-30 19:51:18 -08:00
Tyler Veness
16ffaa754d [docs] Generate docs for apriltag subproject (#4745) 2022-11-30 19:50:52 -08:00
Thad House
5e74ff26d8 [apriltag, build] Update native utils, add apriltag impl and JNI (#4733)
Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2022-11-30 00:16:29 -08:00
Dustin Spicuzza
53875419a1 [hal] Allow overriding stderr printing by HAL_SendError (#4742) 2022-11-29 23:19:15 -08:00
Peter Johnson
aa6499e920 [ntcore] Fix special topic multi-subscriber handling (#4740)
It now matches server behavior, where "" doesn't match special topics.

Also fixes duplicate notification that could occur in some cases.
2022-11-29 21:58:57 -08:00
Peter Johnson
df70351107 [build] Fix cmake install of thirdparty includes (#4741) 2022-11-29 21:58:38 -08:00
Peter Johnson
e9bd50ff9b [glass] NT view: clear meta-topic info on disconnect (#4732) 2022-11-29 21:57:48 -08:00
Peter Johnson
9b319fd56b [ntcore] Add sub option for local vs remote changes (#4731)
This is the subscriber readQueue version of the local value listener flag.
2022-11-29 21:57:20 -08:00
Peter Johnson
18d28ec5e3 [ntcore] Remove duplicate value checking from ClientImpl
This is no longer required with the duplicate value checking in
LocalStorage.
2022-11-29 09:49:47 -08:00
Peter Johnson
bdfb625211 [ntcore] Send duplicate values to network if necessary
Essentially this separates duplicate value detection between network and
local.
2022-11-29 09:49:47 -08:00
Ryan Blue
21003e34eb [commands] Update Subsystem factories and example to return CommandBase (#4729)
Also update rapidreactcommandbot example factories to fit this convention (as in #4655).

C++ does not need an update as CommandPtr already uses CommandBase (#4677).
2022-11-28 19:47:18 -08:00
Starlight220
70080457d5 [commands] Refactor ProxyScheduleCommand, SelectCommand into ProxyCommand (#4534) 2022-11-28 14:43:10 -08:00
Colin Wong
e82cd5147b [wpilib] Tweak Color HSV formula and use in AddressableLED (#4724)
The Color algorithm was tweaked to:
a) not produce incorrect values if the user happens to input a hue outside the [0, 180) range, and
b) more accurately convert the hue remainder from range 0-30 to 0-255. The current conversion vastly overshoots the multiplier (converts 0-30 to 0-270) and relies on clamping the value when constructing the Color object to produce a slightly incorrect result.
2022-11-28 14:42:22 -08:00
Colin Wong
ec124bb662 [commands] Allow unsetting a subsystem's default command (#4621) 2022-11-28 14:03:14 -08:00
Ryan Blue
2b2aa8eef7 [examples] Update all examples to use NWU coordinate conventions (#4725) 2022-11-28 13:49:49 -08:00
Starlight220
cb38bacfe8 [commands] Revert to original Trigger implementation (#4673)
Trigger was refactored to use BooleanEvent when it was introduced in #4104.
This reverts to the original implementation until edge-based BooleanEvents can be fixed.
2022-11-28 13:48:48 -08:00
Starlight220
15561338d5 [commands] Remove one more default command isFinished check (#4727) 2022-11-28 13:44:37 -08:00
Ryan Blue
ca35a2e097 Add simgui files to .gitignore (#4726) 2022-11-28 08:57:57 -08:00
Starlight220
20dbae0cee [examples] Renovate command-based examples (#4409)
Refactor some examples to use newer features, such as HID factories, library-provided command factories, CommandPtr (C++), as well as new idioms such as static/instance command factories.
2022-11-28 08:55:13 -08:00
Eli Barnett
1a59737f40 [commands] Add convenience factories (#4460)
Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2022-11-28 07:41:25 -08:00
Tyler Veness
42b6d4e3f7 Use defaulted comparison operators in C++ (#4723)
Comparison operators which compared against every class member variable
now use C++20's default comparison operators.

Also remove operator!= that in C++20 is now auto-generated from operator==.
2022-11-27 21:01:01 -08:00
Peter Johnson
135c13958f [wpigui] Add FontAwesome (#4713) 2022-11-27 20:00:17 -08:00
Peter Johnson
ffbfc61532 [ntcore] Add NetworkTable table-specific listeners (#4640)
These are similar, but not quite identical to, the NT3 NetworkTable
table listeners.

Also add table topic-only multi-subscriber to ensure functions like
getKeys() work properly regardless of other subscriptions.
2022-11-27 19:46:34 -08:00
Starlight220
8958b2a4da [commands] Add property tests for command compositions (#4715) 2022-11-27 16:23:56 -08:00
Starlight220
e4ac09077c [wpilib] Add link to MotorSafety article (#4720) 2022-11-27 16:23:06 -08:00
Starlight220
f40de0c120 [commands] Add C++ factory templates (#4686) 2022-11-27 11:27:44 -08:00
Peter Johnson
51fa3e851f [build] cmake: Use FetchContent instead of ExternalProject (#4714)
Also switch to using thirdparty-fonts instead of generating them.
2022-11-26 23:05:41 -08:00
Peter Johnson
1da84b2255 [wpigui] Reload fonts to scale rather than preloading (#4712) 2022-11-26 22:30:38 -08:00
Peter Johnson
e43e2fbc84 [wpiutil] StringExtras: Add UnescapeCString (#4707)
Based on implementation in glass but enhanced for generic use.
2022-11-26 18:21:45 -08:00
Peter Johnson
5804d8fa84 [ntcore] Server: Properly handle multiple subscribers (#4717)
Previously, only the first subscriber was actually matched to a topic
when a topic was created; this was a problem when later publishing
values as a client could have both a topic-only subscriber and a normal
subscriber, and only the first one would end up being subscribed to the
topic.
2022-11-26 17:02:22 -08:00
Peter Johnson
169ef5fabf [glass] Update NT view for topicsOnly and sendAll changes (#4718) 2022-11-26 17:01:40 -08:00
Starlight220
148759ef54 [examples] CANPDP: Expand properties shown (#4687) 2022-11-25 23:51:15 -08:00
Starlight220
58ed112b51 [commands] RepeatCommand: restart on following iteration (#4706)
This fixes InstantCommand.repeatedly().
2022-11-25 23:50:42 -08:00
Ryan Blue
dd1da77d20 [readme] Fix broken CI badge (#4710) 2022-11-25 23:49:47 -08:00
Ryan Blue
7cda85df20 [build] Check Gradle plugin repo last to fix CI (#4711) 2022-11-25 23:48:18 -08:00
Thad House
7ed9b13277 [build] Bump version plugin to fix null tag (#4705) 2022-11-24 22:10:59 -08:00
Tyler Veness
6b4f26225d [apriltag] Fix pluralization of apriltag artifacts (#4671) 2022-11-24 09:06:38 -08:00
Peter Johnson
b2d2924b72 [cscore] Add Y16 image support (#4702) 2022-11-24 09:06:06 -08:00
Peter Johnson
34ec89c041 [wpilibc] Shuffleboard SimpleWidget: Return pointer instead of reference (#4703)
Based on beta test feedback, returning a pointer is more intuitive, as
typically the return value is late bound to an instance variable.
2022-11-24 09:05:37 -08:00
Peter Johnson
e15200068d [ci] Disable HW testbench runs (#4704)
These are currently broken with no timetable to fix.
2022-11-24 09:04:57 -08:00
Starlight220
d5200db6cd [wpimath] Rename HolonomicDriveController.calculate params (#4683) 2022-11-23 23:13:50 -08:00
Tyler Veness
2ee3d86de4 [wpimath] Clarify Rotation3d roll-pitch-yaw direction (#4699) 2022-11-23 23:12:59 -08:00
Peter Johnson
9f0a8b930f [cscore] Use MFVideoFormat_L8 for Gray on Windows (#4701) 2022-11-23 22:15:56 -08:00
Peter Johnson
2bca43779e [cscore] Add UYVY image support (#4700) 2022-11-23 22:00:31 -08:00
ohowe
4307d0ee8b [glass] Plot: allow for more than 11 plots (#4685)
Since m_windows is sorted using the ascii, when "Plot <10>" is reached it will be before "Plot <2>" in `m_windows` which makes it so it will not add a new plot after the id 10 is reached. This also fixes a potential issue of someone manually changing an id in the file, which would break adding a new plot in some circumstances.
2022-11-23 13:57:29 -08:00
Starlight220
3fe8d355a1 [examples] StateSpaceDifferentialDriveSimulation: Use encoder reversed constants (#4682)
This matches the Java example.
2022-11-22 10:29:40 -08:00
Peter Johnson
b44034dadc [ntcore] Allow duplicate client IDs on server (#4676)
Currently, the server rejects duplicate client IDs. As we want to make
the client implementation as simple as possible, instead deduplicate the
name on the server side by appending "@" and a count.

NT4 spec has been updated for this change.
2022-11-22 10:27:49 -08:00
Starlight220
52d2c53888 [commands] Rename Java factory wait() to waitSeconds() (#4684)
This is needed to avoid a conflict with Object.wait() when using static imports.
C++ doesn't have this issue, and has units, so Wait() still makes sense there.
2022-11-22 10:16:27 -08:00
Thad House
76e918f71e [build] Fix JNI artifacts linking to incorrect libraries (#4680) 2022-11-21 20:33:46 -08:00
Starlight220
0bee875aff [commands] Change C++ CommandPtr to use CommandBase (#4677) 2022-11-21 09:45:50 -08:00
Peter Johnson
98e922313b [glass] Don't check IsConnected for NT widgets (#4674)
Checking this isn't required, and prevented these widgets from working
in the simulation GUI without another NT client connected.
2022-11-20 17:27:28 -08:00
amquake
9a36373b8f [apriltag] Switch 2022 apriltag layout length and width values (#4670) 2022-11-19 09:11:08 -08:00
Peter Johnson
cf8faa9e67 [wpilib] Update values on controllable sendables (#4667) 2022-11-18 23:50:41 -08:00
Peter Johnson
5ec067c1f8 [ntcore] Implement keep duplicates pub/sub flag (#4666)
Also don't save duplicate NT sets to data log (unless publish keep duplicates flag is set).
2022-11-18 23:50:08 -08:00
Peter Johnson
e962fd2916 [ntcore] Allow numeric-compatible value sets (#4620)
Also fix entry publishing behavior to allow numerically compatible set
default publish following a subscribe.
2022-11-18 22:46:24 -08:00
Ryan Blue
88bd67e7de [ci] Update clang repositories to jammy (#4665) 2022-11-18 20:42:55 -08:00
Jordan McMichael
902e8686d3 [wpimath] Rework odometry APIs to improve feature parity (#4645)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2022-11-18 20:42:00 -08:00
Thad House
e2d49181da Update to native utils 2023.8.0 (#4664) 2022-11-18 19:01:26 -08:00
Peter Johnson
149bac55b1 [cscore] Add Arducam OV9281 exposure quirk (#4663)
Reports exposure range as 1-5000 but real range is 1-75.
2022-11-18 14:15:30 -08:00
amquake
88f7a3ccb9 [wpimath] Fix Pose relativeTo documentation (#4661) 2022-11-18 14:07:50 -08:00
sciencewhiz
8acce443f0 [examples] Fix swerve examples to use getDistance for turning encoder (#4652) 2022-11-18 14:06:21 -08:00
Peter Johnson
295a1f8f3b [ntcore] Fix WaitForListenerQueue (#4662) 2022-11-18 14:01:52 -08:00
Dustin Spicuzza
388e7a4265 [ntcore] Provide mechanism to reset internals of NT instance (#4653) 2022-11-18 10:21:05 -08:00
Tyler Veness
13aceea8dc [apriltag] Fix FieldDimensions argument order (#4659) 2022-11-17 22:15:55 -08:00
Ryan Blue
c203f3f0a9 [apriltag] Fix documentation for AprilTagFieldLayout (#4657) 2022-11-17 19:40:51 -08:00
Thad House
f54d495c90 Fix non initialized hal functionality during motor safety init (#4658) 2022-11-17 18:54:45 -08:00
Starlight220
e6392a1570 [cmd] Change factories return type to CommandBase (#4655) 2022-11-17 15:44:16 -08:00
PJ Reiniger
53904e7cf4 [apriltag] Split AprilTag functionality to a separate library (#4578)
Add AprilTagFieldLayout JSON file and move class to edu.wpi.first.apriltag.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-11-17 14:29:29 -08:00
Drew Williams
2e88a496c2 [wpimath] Add support for swerve joystick normalization (#4516) 2022-11-17 10:53:49 -08:00
Jordan McMichael
ce4c45df13 [wpimath] Rework function signatures for Pose Estimation / Odometry (#4642)
Forcing the use of SwerveModulePostition[] and wpi::array<SwerveModulePosition, len> in place of variadic function signatures.
2022-11-17 10:36:33 -08:00
sciencewhiz
0401597d3b [readme] Add wpinet to MavenArtifacts.md (#4651)
Fixes #4639
2022-11-17 10:35:27 -08:00
Jordan McMichael
2e5f9e45bb [wpimath] Remove encoder reset comments on Swerve, Mecanum Odometry and Pose Estimation (#4643)
In both of these cases, encoder resets are not required for normal use.
2022-11-16 15:20:05 -08:00
sciencewhiz
e4b5795fc7 [docs] Disable Doxygen for memory to fix search (#4636) 2022-11-14 20:19:44 -08:00
Peter Johnson
03d0ea188c [build] cmake: Add missing wpinet to installed config file (#4637) 2022-11-14 20:19:13 -08:00
Thad House
3082bd236b [build] Move version file to its own source set (#4638) 2022-11-14 20:19:00 -08:00
Thad House
b7ca860417 [build] Use build cache for sign step (#4635)
The signing step does not get passed the username and password to the server, so it will just read from the build cache. Then to make sure the tasks are all updated correctly, use if developerid exists as a property to all sign tasks, so it will see the new variable value, and relink. Additionally only update the archives during signing, which will speed up signing.
2022-11-14 19:23:13 -08:00
Starlight220
64838e6367 [commands] Remove unsafe default command isFinished check (#4411) 2022-11-14 14:28:30 -08:00
Peter Johnson
1269d2b901 [myRobot] Disable spotbugs (#4565) 2022-11-14 14:26:41 -08:00
Tyler Veness
14d8506b72 [wpimath] Fix units docs for LinearSystemId::IdentifyDrivetrainSystem() (#4600) 2022-11-14 14:26:16 -08:00
ohowe
d1d458db2b [wpimath] Constrain Rotation2d range to -pi to pi (#4611)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2022-11-14 14:25:15 -08:00
Tyler Veness
f656e99245 [readme] Add links to development build documentation (#4481)
* Add links to development build documentation
* Use GitHub dev docs links in readme badges
2022-11-14 14:23:47 -08:00
Starlight220
6dd937cef7 [commands] Fix Trigger API docs (NFC) (#4599) 2022-11-14 14:21:35 -08:00
Starlight220
49047c85b9 [commands] Report error on C++ CommandPtr use-after-move (#4575) 2022-11-14 14:20:52 -08:00
Tyler Veness
d07267fed1 [ci] Upgrade containers to Ubuntu 22.04 and remove libclang installation (#4633) 2022-11-14 14:20:08 -08:00
Thad House
b53ce1d3f0 [build, wpiutil] Switch macos to universal binaries (#4628) 2022-11-14 10:36:33 -08:00
Ege Akman
5a320c326b [upstream_util, wpiutil] Refactor python scripts (#4614)
Co-authored-by: Sourcery AI <>
Co-authored-by: Vasista Vovveti <vasistavovveti@gmail.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2022-11-13 23:11:54 -08:00
Peter Johnson
c4e526d315 [glass] Fix NT Mechanism2D (#4626) 2022-11-13 23:09:23 -08:00
Ryan Blue
d122e4254f [ci] Run spotlessApply after wpiformat in comment command (#4623) 2022-11-13 14:07:26 -08:00
Peter Johnson
5a1e7ea036 [wpilibj] FieldObject2d: Add null check to close() (#4619) 2022-11-12 16:51:41 -08:00
Peter Johnson
179f569113 [ntcore] Notify locally on SetDefault (#4617)
This is necessary for the simulation GUI to pick up default publishes.
2022-11-12 06:33:10 -08:00
Peter Johnson
b0f6dc199d [wpilibc] ShuffleboardComponent.WithProperties: Update type (#4615)
ShuffleboardComponentBase::m_properties is now a StringMap<nt::Value>.
2022-11-11 15:08:05 -08:00
Tyler Veness
7836f661cd [wpimath] Add missing open curly brace to units/base.h (#4613) 2022-11-11 13:06:42 -08:00
CarloWoolsey
dbcc1de37f [wpimath] Add DifferentialDriveFeedforward classes which wrap LinearPlantInversionFeedforward (#4598)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-11-10 16:54:51 -08:00
Cory
93890c528b [wpimath] Add additional angular acceleration units (#4610)
Added Turns per second squared
Added Revolutions per minute squared
Added Revolutions per minute per second
2022-11-10 16:47:55 -08:00
Tyler Veness
3d8d5936f9 [wpimath] Add macro for disabling units fmt support (#4609) 2022-11-10 14:12:07 -08:00
Tyler Veness
2b04159dec [wpimath] Update units/base.h license header (#4608) 2022-11-10 14:11:44 -08:00
Thad House
2764004fad [wpinet] Fix incorrect jni definitions (#4605)
Also re-enables the check task that would have caught this.
2022-11-10 09:42:02 -08:00
Thad House
85f1bb8f2b [wpiutil] Reenable jni check task (#4606)
New option was added to JNI plugin to allow skipping specific symbols. This let us generally reenable the check task in wpiutil.
2022-11-10 09:33:26 -08:00
ohowe
231ae2c353 [glass] Plot: Fix Y-axis not being saved (#4594) 2022-11-08 21:33:02 -08:00
Tyler Veness
e92b6dd5f9 [wpilib] Fix AprilTagFieldLayout JSON property name typos (#4597) 2022-11-08 13:27:21 -08:00
Thad House
2a8e0e1cc8 Update all dependencies that use grgit (#4596) 2022-11-08 10:20:16 -08:00
Starlight220
7d06e517e9 [commands] Move SelectCommand factory impl to header (#4581)
It's templated, so it needs to be in the header.
2022-11-07 15:49:36 -08:00
Tyler Veness
323524fed6 [wpimath] Remove deprecated units/units.h header (#4572) 2022-11-07 10:18:36 -08:00
Starlight220
d426873ed1 [commands] Add missing PS4 triangle methods (#4576) 2022-11-07 10:15:54 -08:00
PJ Reiniger
5be5869b2f [apriltags] Use map as internal data model (#4577)
This leaves the file format as a list, but internally will transform the collection of tags into a map on de/serialization. The serialization will probably happen once on startup, but the tag lookup can happen 100s of times a second. This honestly probably doesn't make too much of a performance hit since N is small, but this is a simple O(n) -> O(1) change for lookups.
2022-11-07 10:09:06 -08:00
Griffin Della Grotte
b1b4c1e9e7 [wpimath] Fix Pose3d transformBy rotation type (#4545)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
2022-11-07 09:57:33 -08:00
Dustin Spicuzza
a4054d702f [commands] Allow composing two triggers directly (#4580)
For backwards compatibility reasons.
2022-11-07 09:55:28 -08:00
Dustin Spicuzza
0190301e09 [wpilibc] Explicitly mark EventLoop as non-copyable/non-movable (#4579)
It's already not movable because m_bindings isn't copyable, but pybind11
isn't able to detect that
2022-11-07 09:30:03 -08:00
Peter Johnson
9d1ce6a6d9 [ntcore] Catch file open error when saving preferences (#4571) 2022-11-05 21:16:39 -07:00
Peter Johnson
5005e2ca04 [ntcore] Change Java event mask to EnumSet (#4564)
Also convert NetworkTableInstance.getNetworkMode() to return EnumSet.
2022-11-04 20:25:37 -07:00
PJ Reiniger
fa44a07938 [upstream-utils][mpack] Add upstream util for mpack (#4500) 2022-11-04 20:03:49 -07:00
Peter Johnson
4ba16db645 [ntcore] Various fixes and cleanups (#4544)
* NetworkTableInstance: set handle to 0 after destroy
* Fix multiple notifications of local values
* Detect mismatch between handles
* Server: fix setting min period when no topics
* Limit maximum number of subscribers/publishers/listeners
   This helps find resource leaks and prevents them from causing excessive
   slowdowns/crashes.  The limit on each is currently set to 512.
* Don't use std::swap in move operation
2022-11-04 20:01:21 -07:00
Thad House
837415abfd [hal] Fix joysticks either crashing or returning 0 (#4570) 2022-11-04 19:03:11 -07:00
amquake
2c20fd0d09 [wpilib] SingleJointedArmSim: Check angle equals limit on wouldHit (#4567) 2022-11-04 17:14:46 -07:00
Alex Ryker
64a7136e08 [wpimath] SwerveDrivePoseEstimator: Restore comment about encoder reset (#4569) 2022-11-04 15:03:49 -07:00
Brennen Puth
b2b473b24a [wpilib] Add AprilTag and AprilTagFieldLayout (#4421)
This is an API for looking up a Pose3d from a tag id, and includes functionality to load that map from a JSON file.

This also adds JSON support to Pose3d, Rotation3d. Translation3d, and Quaternion.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: AMereBagatelle <themerebagatelle@gmail.com>
2022-11-04 09:56:22 -07:00
Thad House
7aab8fa93a [build] Update to Native Utils 2023.6.0 (#4563) 2022-11-03 20:57:04 -07:00
Starlight220
12c2851856 [commands] WrapperCommand: inherit from CommandBase (#4561)
This makes WrapperCommand Sendable.
Only Java had this issue.
2022-11-03 06:27:23 -07:00
Tyler Veness
0da169dd84 [wpimath] Remove template argument from ElevatorFeedforward (#4554) 2022-11-02 22:54:32 -07:00
Tyler Veness
2416827c25 [wpimath] Fix docs for pose estimator local measurement models (#4558) 2022-11-02 22:53:21 -07:00
Michael Jansen
1177a3522e [wpilib] Fix Xbox/PS4 POV sim for port number constructors (#4548) 2022-11-02 22:52:26 -07:00
ohowe
102344e27a [commands] HID classes: Add missing methods, tweak return types (#4557)
- Make return type of getHID reflect the specific class
- Add getX and getY to CommandJoystick
2022-11-02 22:51:53 -07:00
Peter Johnson
1831ef3e19 [wpilib] Fix Shuffleboard SuppliedValueWidget (#4559)
It was creating duplicate publishers.
2022-11-02 22:49:52 -07:00
Starlight220
a9606ce870 [wpilib] Fix Xbox/PS4 POV sim (#4546) 2022-11-02 10:52:15 -07:00
Tyler Veness
6c80d5eab3 [wpimath] Remove unused SymbolExports.h include from units/base.h (#4541) 2022-11-01 17:18:24 -07:00
Peter Johnson
b114006543 [ntcore] Unify listeners (#4536)
This combines all 4 NT listener APIs (topic, value, connection, and
logging) into a single unified listener API.
2022-10-31 21:52:14 -07:00
Peter Johnson
32fbfb7da6 [build] cmake: Install ntcore generated include files (#4540) 2022-10-31 21:45:24 -07:00
Thad House
02465920fb [build] Update native utils to 2023.4.0 (#4539)
This has some decent changes to the toolchain plugin, so allwpilib is a great way to make sure nothing breaks.
2022-10-31 19:17:42 -07:00
David K Turner
3a5a376465 [wpimath] Increase constexpr support in geometry data types (#4231)
This uses std::is_constant_evaluated() to conditionally use the gcem library for constexpr calculations.
2022-10-31 09:17:00 -07:00
Peter Johnson
1c3c86e9f1 [ntcore] Cache GetEntry(name) values (#4531)
These are typically cached at higher levels anyway, but cache at lowest
C++ layer as well for consistency with NT3.
2022-10-27 23:34:58 -07:00
Starlight220
dcda09f90a [command] Rename trigger methods (#4210)
Motivation

Feedback from 2022 showed that the Trigger API is rather confusing, mostly due to the following:
- duplicate Trigger and Button APIs were available; users were confused searching for a nonexistent difference between them.
- the when terminology was ambiguous and unclear whether it refers to the high state or specifically the rising edge.
- the Active terminology didn't unambiguously refer to the high state; it wasn't unintuitive to understand it as "when the binding is active/polled".
- whileHeld vs whenHeld was very confusing, and the difference between them wasn't obvious. The parallel Trigger verbs, whileActiveContinuously and whileActiveOnce are much less confusing.

Solution

Deprecating Button and its binding methods. The rationale for deprecating Button (and not Trigger) is because Button uses terminology that is needlessly more specific and restricting to the button use case, making the use case of arbitrary trigger conditions unintuitive.

After consideration, deprecation of Button's subclasses was decided against:

- NetworkButton (a trigger condition based on a boolean NT entry/topic) is a use case that is not necessarily intuitive for teams to implement themselves, so it is an abstraction that should be provided in the library. A parallel class for the BooleanEvent level, NetworkBooleanEvent, was also added as part of NT4. NT listeners were considered as a alternative solution, but they require attention to thread safety, and aren't interoperable with the EventLoop API.
- JoystickButton/POVButton provide abstractions around HID buttons. The new Trigger-returning factories on the HID classes are an equal (if not more concise) alternative, but there is no reason not to keep them for those who find their use preferable.

At a later date in the deprecation cycle (perhaps for 2024), when Button is removed, these subclasses should be changed to inherit directly from Trigger.

Trigger's bindings are changed to use True/False terminology, as it should be unambiguous. Each binding type has both True and False variants; for brevity, only the True variants are listed here:

- onTrue (replaces whenActive): schedule on rising edge.
- whileTrue (replaces whileActiveOnce): schedule on rising edge, cancel on falling edge.
- toggleOnTrue (replaces toggleWhenActive): on rising edge, schedule if unscheduled and cancel if scheduled.

Two binding types are completely deprecated:

- cancelWhenActive: this is a fairly niche use case which is better described as having the trigger's rising edge (Trigger.rising()) as an end condition for the command (using Command.until()).
- whileActiveContinuously: however common, this relied on the no-op behavior of scheduling an already-scheduled command. The more correct way to repeat the command if it ends before the falling edge is using Command.repeatedly/RepeatCommand or a RunCommand -- the only difference is if the command is interrupted, but that is more likely to result in two commands perpetually canceling each other than achieve the desired behavior. Manually implementing a blindly-scheduling binding like whileActiveContinuously is still possible, though might not be intuitive.

Notes

It was considered to share BooleanEvent's digital signal terminology; however, once it was decided that Trigger should not inherit from BooleanEvent (due to overload incompatibility) the common terminology was not worth the unintuitiveness stemming from users' unfamiliarity with the signal processing terms.
2022-10-27 22:03:28 -07:00
Tyler Veness
66157397c1 [wpilib] Make drive classes follow NWU axes convention (#4079)
All trigonometric functions and vector classes assume North-West-Up axes
convention, so using North-East-Down convention with them is really
error-prone. We've broken something every time we touched the drive
classes.

We originally used North-East-Down to match the joystick convention, but
the volume of long-lived bugs has made this not worth it in retrospect.

The rest of WPILib also uses North-West-Up, so this makes things
consistent.

KilloughDrive was removed since no one uses it.
2022-10-27 21:59:11 -07:00
Peter Johnson
9e22ffbebf [ntcore] Fix null deref in NT3 client (#4530) 2022-10-27 21:56:15 -07:00
Thad House
648ab6115c [wpigui,dlt,glass,ov] Support arm in GUI tools (#4527) 2022-10-26 23:16:23 -07:00
Tyler Veness
8bc3b04f5b [wpimath] Make ComputerVisionUtil use 3D geometry classes (#4528)
Closes #4189.
2022-10-26 22:20:08 -07:00
Peter Johnson
cfb84a6083 [wpilibc] Don't hang waiting for NT server to start (#4524)
This matches Java behavior.
2022-10-26 10:29:56 -07:00
Tyler Veness
02c47726e1 [wpimath] Remove unused odometry instance from DifferentialDrivePoseEstimator test (#4522) 2022-10-25 22:19:44 -07:00
Peter Johnson
b2a0093294 [ci] Revert upgrade of github-pages-deploy-action (#4521)
It broke publishing
2022-10-25 19:20:30 -07:00
Justin
2a98d6b5d7 [wpimath] PIDController: Add getters for position & velocity tolerances (#4458) 2022-10-25 16:10:19 -07:00
Starlight220
9f36301dc8 [ci] Write wpiformat patch to job summary (#4519) 2022-10-25 12:30:43 -07:00
Jordan McMichael
901fc555f4 [wpimath] Position Delta Odometry for Mecanum (#4514) 2022-10-25 12:28:59 -07:00
Jordan McMichael
4170ec6107 [wpimath] Position Delta Odometry for Swerve (#4493) 2022-10-25 12:28:36 -07:00
sciencewhiz
fe400f68c5 [docs] Add wpinet to docs build (#4517)
Excludes libuv and libuv wrappers.
2022-10-25 08:47:28 -07:00
Peter Johnson
794669b346 [ntcore] Revamp listeners (#4511)
- In both C++ and Java, add listener functions to Instance class (same as NT3 provided)
- Add WaitForListenerQueue functions (same as NT3 provided)
- Move Java non-poller implementation to Instance (previously only handled single instance)
- Change C++ listeners to take non-const references for subscribers etc to help avoid footguns from use of temporary objects (also add doc comment)
- Fix Preferences making .type persistent
2022-10-24 23:27:24 -07:00
Peter Johnson
dcfa85a5d5 [ci] Build sanitizers with clang-14 (#4518) 2022-10-24 22:44:20 -07:00
Peter Johnson
15ad855f1d [ntcore] Add UnitTopic<T> (C++ only) (#4497)
This avoids the need for explicit value() calls (as compared to using
DoubleTopic).  The unit name is published as the "unit" property.

Implementation note: the test needs to be in wpilibc because ntcore does
not depend on wpimath.
2022-10-24 20:07:44 -07:00
Thad House
11244a49d9 [wpilib] Add IsConnected function to all gyros (#4465) 2022-10-24 20:04:16 -07:00
Thad House
1d2e8eb153 [build] Update myRobot deployment (#4515) 2022-10-24 20:03:39 -07:00
Thad House
ad53fb19b4 [hal] Use new HMB api for addressable LED (#4479)
Theres is now a built in HMB api, but you have to dlopen it to access it. Moved our existing infrastructure for this to its own class, added the new functions, then updated interrupts and LEDs to use it.
2022-10-24 18:26:07 -07:00
Thad House
ba850bac3b [hal] Add more shutdown checks and motor safety shutdown (#4510) 2022-10-23 21:59:04 -07:00
Peter Johnson
023a5989f8 [ntcore] Fix typo in NetworkServer client connect message (#4512) 2022-10-23 20:45:01 -07:00
sciencewhiz
c970011ccc [docs] Add Doxygen aliases used by Foonathan memory (#4509) 2022-10-23 18:12:24 -07:00
sciencewhiz
07a43c3d9a [readme] Document clang-format version and /wpiformat (#4503) 2022-10-23 15:59:33 -07:00
sciencewhiz
a05b212b04 [ci] Revert changes to wpiformat task from #4501 (#4508) 2022-10-23 15:49:59 -07:00
Starlight220
09faf31b67 [commands] Replace Command HID inheritance with delegation (#4470) 2022-10-23 12:09:44 -07:00
Starlight220
9e1f9c1133 [commands] Add command factories (#4476)
Co-authored-by: oblarg <emichaelbarnett@gmail.com>
2022-10-23 12:08:22 -07:00
Tyler Veness
f19d2b9b84 [ci] Add NUMBER environment variable to comment command commit script (#4507) 2022-10-23 11:34:03 -07:00
Tyler Veness
a28f93863c [ci] Push comment command commit directly to PR (#4506) 2022-10-23 11:17:52 -07:00
Tyler Veness
c9f61669b8 [ci] Fix comment command commit push (#4505) 2022-10-23 10:47:15 -07:00
Tyler Veness
dcce5ad3b3 [ci] Update github-script API usage (#4504) 2022-10-23 10:15:42 -07:00
Thad House
6836e5923d [wpilibc] Restore get duty cycle scale factor (#4502) 2022-10-23 07:05:09 -07:00
Peter Johnson
335188c652 [dlt] Add deselect/select all buttons to download view (#4499) 2022-10-22 22:12:47 -07:00
Peter Johnson
60a29dcb99 [glass] Field2D: Add "hidden" option for objects (#4498) 2022-10-22 22:12:25 -07:00
PJ Reiniger
b55d5b3034 [ci] Update deprecated github actions (#4501) 2022-10-22 21:09:44 -07:00
Peter Johnson
10ed4b3969 [ntcore] Various NT4 fixes (#4474)
* TopicListener: Fix Add() return values
* Update PubSubOption poll storage documentation
* Update NetworkTableEntry::GetValue() doc
* Add documentation regarding asynchronous callbacks
* Unpublish entry: set publisher to nullptr
* Implement ValueListenerPoller default constructor
* Remove SetNetworkIdentity, make parameter to StartClient
* URI-escape client ID, improve error message
* Add connected message with client id; also improve disconnected message a bit
* Handle SetServers either before or after StartClient
* Fix client use-after-free; also delay reconnect after disconnect to rate limit
* Don't re-announce to already subscribed client; we especially don't want to send the last value again
* Always accept in-order sets, only use timestamp for tiebreak
* Fix LocalStorage::StartNetwork race
* Remove unused/unimplemented function

Also:
* [glass] Remove debug print
* [glass] Fix mpack string decoding
* [cameraserver] Fix up startclient
2022-10-21 22:04:14 -07:00
Thad House
4a401b89d7 [hal, wpilib] New DS thread model and implementation (#3787)
The current DS thread model has some pretty major issues. It makes it difficult to know if all data is from the same remote packet, and if the data changes while the robot loop is running. Additionally, the DS thread is used for a few other things (MotorSafety and State Tracking for EducationalRobot). This also makes sim difficult, as user code has to wait for the thread to know it has new data.

This change completely rethinks how threading works in the driver station model.

First, the DS HAL system receives a new data callback, either from Netcomm or DriverStationSim. Inside the context of this callback, all the low latency data is read and put into a cache. Doing some investigation on the robot side, this is perfectly safe to do, and also ensures a ds packet will not be parsed before we finish reading the current packet data.

After all data is read, the cache is swapped with a 2nd buffer. This buffer just stores the data, none of the HAL DS calls read from this buffer. An event is then fired, stating there is new data ready to go.

Robot code calls HAL_UpdateDSData(). This swaps the 2nd buffer with a 3rd buffer, which always contains the current data. This data will not be updated until HAL_UpdateDSData is called again. Which solves the state problem.

The high level driver station classes have. an updateData() call, which calls HAL_UpdateDSData, and then update button state variables, then data log and update the NT FMS data table (Java also caches across the JNI boundary here, but that could trivially be removed). An extra event provider is provided, allowing other threads to know when this call has been completed.

IterativeRobotBase calls DS.updateData() at the beginning of each loop, and only once per loop. This means all commands will always have the same state.

All of this means there is no longer a DS thread. Everything happens synchronously. This means Sim and testing is easier, as you can just call DriverStationSim.NotifyNewData(), and then DriverStation.UpdateData(), and you can guarantee that all the DriverStation.*** data is up to date.

As for Motor Safety and Educational Robot State Handling, those can all be handled by their own threads. The Educational Thread only needs to run under EducationalRobot, and MotorSafety will only be started if there is a motor safety object enabled.
2022-10-21 22:01:55 -07:00
Tyler Veness
c195b4fc46 [wpimath] Clean up PoseEstimator nominal dt docs (#4496) 2022-10-21 19:53:58 -07:00
Tyler Veness
8f2e34c6a3 [build] Remove wpilib prefix from CMake flat install (#4492)
For system installs, `DESTDIR=/usr cmake --install buildfolder` installs
libraries to `/usr/lib` with the correct rpath. Example structure:
```
/usr/include/wpimath/frc/controller/LinearQuadraticRegulator.h
/usr/lib/libwpimath.so
```

Users need to provide `-I/usr/include/wpimath` in their projects. This
is an artifact of the install() commands being in the subdirectory CMake
files.

For other locations, `DESTDIR=/opt/wpilib cmake --install buildfolder`
installs libraries to `/opt/wpilib/lib`. Example structure:
```
/opt/wpilib/include/wpimath/frc/controller/LinearQuadraticRegulator.h
/opt/wpilib/lib/libwpimath.so
```
2022-10-21 19:23:56 -07:00
Tyler Veness
150d692df7 [wpimath] Remove unused private PoseEstimator function (#4495) 2022-10-21 19:22:37 -07:00
shueja-personal
3e5bfff1b5 [wpimath] FromFieldRelativeSpeeds: Add ChassisSpeeds overload (#4494) 2022-10-21 18:58:23 -07:00
Starlight220
9c7e66a27d [commands] C++: Add CommandPtr overload for SetDefaultCommand (#4488) 2022-10-21 06:35:58 -07:00
Tyler Veness
0ca274866b [build] Fix CMake system library opt-ins (#4487)
-DUSE_SYSTEM_EIGEN now only removes include paths for Eigen instead of
drake as well.

The USE_VCPKG flags were renamed to USE_SYSTEM since they seem general
enough for that to work (the find_package() commands work the same way
on Arch).

The system libuv CMake build now works with Linux libuv as well.
2022-10-20 19:47:12 -07:00
Starlight220
dc037f8d41 [commands] Remove EndlessCommand (#4483) 2022-10-20 17:24:54 -07:00
Tyler Veness
16cdc741cf [wpimath] Add Pose3d(Pose2d) constructor (#4485) 2022-10-20 17:23:00 -07:00
Tyler Veness
9d5055176d [build] cmake: Allow disabling ntcore build (#4486) 2022-10-20 17:21:31 -07:00
Thad House
d1e66e1296 [build] Compile all java code with inline string concatenation (#4490)
Workaround identified in https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8278540
2022-10-20 17:20:36 -07:00
Tyler Veness
1fc098e696 Enable log macros to work with no args (#4475)
This is enabled by the C++20 __VA_OPT__ feature.
Uses of "{}" format string were updated.
Some warning suppressions were required for older clang versions.
Also improve codegen of wpi::Logger::Log(), frc::ReportError(), and frc::MakeError();
these generate better and less redundant code if they use fmt::string_view for the
format string instead of templating on it.
2022-10-19 10:49:27 -07:00
Peter Johnson
878cc8defb [wpilib] LiveWindow: Add enableAllTelemetry() (#4480) 2022-10-17 14:39:57 -07:00
Thad House
8153911160 [build] Fix MSVC runtime archiver to grab default runtime (#4478) 2022-10-16 15:37:13 -07:00
Tyler Veness
fbdc810887 Upgrade to C++20 (#4239)
* Use explicit this capture required by C++20
* Use C++20 span
* Replace wpi::numbers with std::numbers
* Fix C++20 clang-tidy warning false positive in fmt
* Remove ciso646 include since C++20 removed that header
* Fix global-buffer-overflow asan warnings in ntcore tests
* Add DIOSetProxy constructor to HAL

* Upgrade MSVC compiler to 2022
* Bump native-utils to 2023.2.7 (changes to std=c++20)

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2022-10-15 16:33:14 -07:00
Thad House
396143004c [ntcore] Add ntcoreffi binary (#4471)
Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2022-10-15 01:02:38 -07:00
Peter Johnson
1f45732700 [build] Update to 2023.2.4 native-utils and new dependencies (#4473)
* Disable class-memaccess warning in Eigen
* Shim NiFpga_OpenHostMemoryBuffer
* Don't deploy .debug files in integration tests
2022-10-14 23:36:47 -07:00
Peter Johnson
574cb41c18 [ntcore] Various fixes (#4469)
* Fix C++ Publisher and Subscriber move assignment 
* Fix Publisher comment typo.
* Publish: check that properties is an object.
Print a warning, but still publish, just with empty properties.
Add error print for unassigned type publish.
* Return boolean from SetProperties
* Document exception-throw in Java for invalid JSON.
2022-10-14 20:50:55 -07:00
Thad House
d9d6c425e7 [build] Force Java 11 source compatibility (#4472)
We want to have the option of falling back to a Java 11 runtime, at least for this year.
2022-10-14 19:39:54 -07:00
Thad House
58b6484dbe Switch away from NI interrupt manager to custom implementation (#3705)
* Switch away from NI interrupt manager to custom implementation

* Formatting

* Fix tidy

* Formatting

* Fix loading

* Make interrupt api public

* Add multiple wait api

* Formatting

* Fix build

* Fix review comments

* wpiformat

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-13 17:25:54 -07:00
Tyler Veness
ca43fe2798 [wpimath] Use Units conversions in ComputerVisionUtil docs (NFC) (#4464) 2022-10-12 13:54:15 -07:00
Thad House
87a64ccedc [hal] Convert DutyCycle Raw output to be a high time measurement (#4466)
The existing raw time has an issue where it jumps around, as in the FPGA if the frequency is not a multiple or divisor of 25 Mhz it jumps around by 1 every second. While waiting on an FPGA change, update the API to make raw output give nanoseconds rather then a scaled value. This does a longer read cycle to get the correct value, but in the future if a fast FPGA function is added this can be easily changed.
2022-10-12 10:15:09 -07:00
Starlight220
89a3d00297 [commands] Add FinallyDo and HandleInterrupt decorators (#4412) 2022-10-11 09:53:27 -07:00
Starlight220
1497665f96 [commands] Add C++ versions of Java-only decorators (#4457) 2022-10-10 09:00:11 -07:00
Ryan Blue
27b173374e [wpimath] Add minLinearAccel parameter to DifferentialDriveAccelerationLimiter (#4422) 2022-10-10 08:57:37 -07:00
Ryan Blue
2a13dba8ac [wpilib] TrajectoryUtil: Fix ambiguous documentation (NFC) (#4461) 2022-10-10 08:56:40 -07:00
Peter Johnson
77301b126c [ntcore] NetworkTables 4 (#3217) 2022-10-08 10:01:31 -07:00
Peter Johnson
90cfa00115 [build] cmake: Fix libssh include directory order (#4459)
This broke the build if the directory where libssh was installed also
contained a system libuv install.
2022-10-07 22:53:22 -07:00
Starlight220
5cf961edb9 [commands] Refactor lambda-based commands to inherit FunctionalCommand (#4451) 2022-10-06 17:49:27 -05:00
Starlight220
b2276e47de [wpimath] Enable continuous angle input for HolonomicDriveController (#4453) 2022-10-06 17:46:22 -05:00
PJ Reiniger
893b46139a [fieldImages] Add utilities to simplify loading of fields (#4456) 2022-10-06 17:45:07 -05:00
Starlight220
60e29627c0 [commands] C++ unique_ptr migration (#4319)
Add a CommandPtr with an internal unique_ptr to enable not needing to move the underlying classes, which is error-prone due to the potential for lambda captures.
2022-10-05 17:19:28 -05:00
Starlight220
3b81cf6c35 [wpilib] Improve Color.toString (#4450) 2022-10-04 14:36:51 -05:00
Peter Johnson
5c067d30a0 [wpinet] WebSocket: Add SendFrames() (#4445) 2022-10-03 08:04:08 -05:00
Peter Johnson
ceaf493811 [wpiutil] MakeJByteArray: Use span<uint8> instead of string_view (#4446) 2022-10-02 08:28:50 -05:00
Starlight220
10e04e2b13 [examples] FrisbeeBot: Fix reference capture (#4449)
The parameter should be passed by value.
2022-10-02 08:18:43 -05:00
Peter Johnson
726f67c64b [build] Add exeSplitSetup (#4444) 2022-10-02 08:13:08 -05:00
Peter Johnson
c7b7624c1c [wpiutil] Add MessagePack utility functions (#4448)
Also add mpack to srcDirs.
2022-10-02 08:11:42 -05:00
Peter Johnson
d600529ec0 [wpinet] uv::Async: Add UnsafeSend() (#4447)
This version assumes the loop still exists, avoiding some overhead.
2022-10-02 08:10:54 -05:00
Tyler Veness
b53b3526a2 [wpimath] Add CoordinateSystem conversion for Transform3d (#4443)
I also refactored Pose3d's conversion implementation to use the
Translation3d and Rotation3d conversions, thereby giving Translation3d
and Rotation3d test coverage. No changes were made to the expected
values of the Pose3d conversion tests.

The expected values of the Transform3d conversion tests were copied from
the Pose3d conversion tests without modification.
2022-10-01 21:09:04 -07:00
Tyler Veness
38bb23eb18 [wpimath] Add scalar multiply and divide operators to all geometry classes (#4438)
Closes #4435.
2022-09-28 21:34:29 -07:00
Tyler Veness
3937ff8221 [wpilib] Remove deprecated Controller class (#4440)
Now that old command-based has been removed, this base class can be
removed too.
2022-09-28 21:33:55 -07:00
Oliver W
abbfe244b5 [wpilib] Improve Color FromHSV (#4439) 2022-09-28 21:33:33 -07:00
Dustin Spicuzza
4ddb8aa0dd [sim] Provide function that resets all simulation data (#4016)
Fixes #3867
2022-09-26 14:38:38 -07:00
Tyler Veness
a791470de7 Clean up Java warning suppressions (#4433)
Checkstyle naming conventions were changed to allow most of what's in
wpimath. Naming rules were disabled completely in wpimath since almost
all suppressions are for math notation.
2022-09-24 00:13:55 -07:00
Thad House
17f504f548 [hal,wpilib] Fix SPI Mode Setting (#4434)
SPI Mode setting was very broken. MSB and LSB sets did not work (MSB is the only one supported)
and if LSB was set (which was the default) the ioct to set clock phase would fail. This
deprecates all the individual functions, the LSB/MSB functions, and adds an SPI mode selection
function. This is usually more understandable, and shows up in a lot more documentation
2022-09-24 00:11:37 -07:00
Tyler Veness
773198537c [wpiutil] Add wpi::scope_exit (#4432)
This is based on std::scope_exit in the C++ library fundamentals TS v3.
2022-09-23 14:48:59 -07:00
Peter Johnson
5ac658c8f0 [wpiutil] Logger: Conditionalize around WPI_LOG (#4431)
The FMT_STRING() call used in the macro does formatter initialization,
overhead that's not required if Log() is not going to be called.
2022-09-22 23:14:46 -07:00
Peter Johnson
8767e4a941 [wpiutil] DataLog: Fix SetMetadata output (#4430) 2022-09-22 21:54:55 -07:00
Peter Johnson
8c4af073f4 [wpiutil] Synchronization: shutdown race protection (#4429) 2022-09-22 21:53:51 -07:00
Thad House
c79f38584a [build] Fix Java integration tests (#4428)
The new jni libraries for the libraries were never added, so they never get deployed.
2022-09-21 23:15:35 -07:00
Starlight220
36c08dd97c [build] Fix cmake install of fmtlib (#4426) 2022-09-20 09:48:44 -07:00
Peter Johnson
69b7b3dd7d [ci] Remove the Windows cmake job (#4425)
This currently is running into space issues due to vcpkg that are
difficult to fix.
2022-09-18 18:24:55 -07:00
Ryan Blue
738c75fed8 [readme] Fix formatting/linting link (#4423) 2022-09-18 15:12:28 -07:00
Tyler Veness
4eb1d03fb3 [wpimath] Document C++ LinearFilter exception (#4417) 2022-09-17 00:24:35 -07:00
Tyler Veness
ba4ec6c967 [build] Fix clang-tidy false positive on Linux (#4406)
* Fix clang-tidy false positive on Linux

```
== clang-tidy /home/tav/frc/wpilib/allwpilib/wpiutil/src/main/native/windows/StackTrace.cpp ==
/home/tav/frc/wpilib/allwpilib/wpiutil/src/main/native/windows/StackTrace.cpp:12:33: error: expected class name [clang-diagnostic-error]
class StackTraceWalker : public StackWalker {
                                ^
/home/tav/frc/wpilib/allwpilib/wpiutil/src/main/native/windows/StackTrace.cpp:16:17: error: unknown type name 'LPCTSTR' [clang-diagnostic-error]
  void OnOutput(LPCTSTR szText) override;
                ^
/home/tav/frc/wpilib/allwpilib/wpiutil/src/main/native/windows/StackTrace.cpp:23:33: error: unknown type name 'LPCTSTR' [clang-diagnostic-error]
void StackTraceWalker::OnOutput(LPCTSTR szText) {
                                ^
```

* Fix false positives for macOS code
2022-09-17 00:23:59 -07:00
Ryan Blue
97836f0e55 [commands] Fix ProfiledPIDSubsystem setGoal behavior (#4414)
Remove m_goal from ProfiledPIDSubsystem

Delegate setGoal to backing controller
2022-09-17 00:22:45 -07:00
Tyler Veness
fdfb85f695 [wpimath] Remove Java LQR constructor that takes a controller gain matrix (#4419)
The controller gain matrix K should be computed from the solution to the
DARE, but this constructor does not do that. It effectively violates a
postcondition enforced by the other constructors by letting the user
throw in a controller gain matrix that didn't come from an LQR.

Removing this constructor is a breaking change, but it never should have
been included in the class in the first place. There's also no valid
reason to use it. I assume it was originally added for debugging the
class internals.

This constructor does not exist in C++.
2022-09-17 00:18:08 -07:00
Tyler Veness
ab1baf4832 [wpimath] Add rotation matrix constructor to Rotation3d (#4413) 2022-09-17 00:17:30 -07:00
Tyler Veness
9730032866 [wpimath] Document LQR and KalmanFilter exceptions (#4418) 2022-09-17 00:16:40 -07:00
Brandon Parsons
5b656eecf6 [wpimath] Fix HTML5 entity (#4420)
Replace &top; with \u22a4, since Unicode references are supported
but HTML5 entities are not. Should be fixed if JDK is ever
moved forward.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-09-17 00:15:40 -07:00
Starlight220
9ae38eaa7c [commands] Add owning overload to ProxyScheduleCommand (#4405) 2022-09-13 18:33:19 -07:00
Starlight220
cb33bd71df [commands] deprecate withInterrupt decorator (#4407)
until() was recently added as a more intuitive alias for this. At this point, keeping this decorator will just cause confusion, given the functionally-equivalent until() alias and the similarly-named getInterruptionBehavior/withInterruptBehavior
2022-09-11 10:37:55 -07:00
Starlight220
d9b4e7b8bf [commands] Revert "Change grouping decorator impl to flatten nested group structures (#3335)" (#4402)
This reverts commit ef4ea84cb5.
2022-09-07 09:04:21 -07:00
T Grinch
0389bf5214 [hal] REVPH: Improve handling of disconnected CAN Bus (#4169)
Force the status to be 0 (no error) upon initialization of the REV PneumaticHub.
This prevents a program crash in the case of a robot code restart with no CAN Bus present.
2022-09-07 09:01:55 -07:00
T Grinch
4267fa08d1 [wpilibc] ADIS IMUs: Fix memory leak (#4170) 2022-09-06 13:10:33 -07:00
Peter Johnson
65c8fbd452 [wpilib] MotorControllerGroup: Override setVoltage (#4403)
This causes setVoltage to be called on the lower level motor contollers,
which is benefical in cases when they are smart motor controllers.
Previously, the default implementation (using the bus voltage and
calling set()) was used in this case.

This does slightly pessimize the case when the lower level motor
controllers use the default setVoltage implementation, but given the
prevalence of smart motor controllers, this seems like an overall win.
2022-09-06 08:18:33 -07:00
Tyler Veness
f36162fddc [wpimath] Improve Discretization internal docs (#4400) 2022-09-04 17:24:38 -07:00
Tyler Veness
5149f7d894 [wpimath] Add two-vector Rotation3d constructor (#4398)
This is useful for turning a 3D vector into an orientation relative a
coordinate system vector.
2022-09-04 13:16:29 -07:00
Tyler Veness
20b5bed1cb [wpimath] Clean up Java Quaternion class (#4399)
Vector.norm() and Vector.dot() were added to make the implementation
simpler and match the C++ version more closely.
2022-09-04 09:45:02 -07:00
Peter Johnson
f18dd1905d [build] Include all thirdparty sources in distribution (#4397)
Was missing several.
2022-09-03 09:23:51 -07:00
Peter Johnson
aa9d7f1cdc [wpiutil] Import foonathan memory (#4306) 2022-09-02 20:32:21 -07:00
Peter Johnson
2742662254 [ci] Remove a couple of obsolete clang-tidy checks (#4396)
We no longer use LLVM StringRef or Twine.
2022-09-02 20:31:27 -07:00
Thad House
a5df391166 [hal, wpilib] Fix up DIO pulse API (#4387)
The FPGA API takes microseconds directly, instead of a scaled value. Also add a new HAL level API to trigger multiple DIOs with the same pulse at once.
2022-09-02 16:49:42 -07:00
Peter Johnson
59e6706b75 [glass] Turn on docking by default
This uses a full-viewport dockspace and shift to enable docking.
2022-09-02 15:43:54 -07:00
Peter Johnson
8461bb1e03 [glass] Add support for saving docking info 2022-09-02 15:43:54 -07:00
Peter Johnson
b873e208b4 [wpigui] Add support for imgui config flags 2022-09-02 15:43:54 -07:00
Peter Johnson
873e72df8c [build] Update imgui to 1.88 docking branch 2022-09-02 15:43:54 -07:00
Peter Johnson
c8bd6fc5b4 [ci] Fix comment-command (take 2) (#4395) 2022-09-02 08:51:07 -07:00
Peter Johnson
fed68b83b4 [ci] Fix comment-command action not running runners (#4393)
Triggering runners from a push from a runner requires use of a PAT.
https://stackoverflow.com/questions/67550727/push-event-doesnt-trigger-workflow-on-push-paths-github-actions
2022-09-02 08:16:31 -07:00
Tyler Veness
0ef8a4e1df [wpimath] Support formatting more Eigen types (#4391)
Added an Eigen::SparseMatrix formatter.

Also modified the Eigen::Matrix formatter to support Eigen::MatrixXd.
Eigen::MatrixXd sets both dimension template arguments to -1, so they
can't be used for iteration. rows() and cols() are now used instead.

rows() and cols() are constexpr for statically sized matrices, so
there's no performance loss there.
2022-09-02 01:00:05 -07:00
Thad House
c393b3b367 [build] Update to native utils 2023.1.0 and Gradle 7.5.1 (#4392) 2022-09-02 00:59:47 -07:00
ohowe
b5a17f762c [wpimath] Add direction to slew rate limiter (#4377) 2022-09-01 14:46:46 -07:00
Tyler Veness
fafc81ed1a [wpiutil] Upgrade to fmt 9.1.0 (#4389) 2022-09-01 14:45:18 -07:00
Peter Johnson
cc56bdc787 [wpiutil] SafeThread: Add Synchronization object variant (#4382)
This enables use of SafeThread with Synchronization's WaitForObjects() blocking.
2022-08-31 11:29:57 -07:00
Starlight220
4254438d8d [commands] Mark command group lifecycle methods as final (#4385)
This prevents accidental footguns due to overriding of command group lifecycle methods.
2022-08-31 09:15:28 -07:00
CarloWoolsey
97c15af238 [wpimath] LinearSystemId: Fix docs, move C++ impls out of header (#4388)
- Fix inaccuracies and inconsistencies in Java & C++ LinearSystemId documentation.
- Move LinearSystemId function definitions to LinearSystemId.cpp
2022-08-31 09:12:48 -07:00
Peter Johnson
d22ff8a158 [wpiutil] Add JNI access to C++ stderr (#4381)
This is useful in some debugging scenarios.  System.err is separately buffered, so when e.g. debugging test cases it doesn't interleave correctly with the C++ stdout/stderr logging. Even using flush() doesn't seem to help, I think because Gradle does its own buffering.
2022-08-30 20:40:16 -07:00
Peter Johnson
fdb5a2791f [wpiutil] jni_util: Add Mac-friendly MakeJLongArray/JArrayRef (#4383)
Mac has jlong == long long and int64_t = long, so the types are
incompatible despite being the same size.
2022-08-30 20:39:42 -07:00
Starlight220
c3a93fb995 [commands] Revamp Interruptible (#4192) 2022-08-29 21:53:47 -07:00
OmegaMetor
f2a8d38d2a [commands] Rename Command.repeat to repeatedly (#4379) 2022-08-29 15:20:17 -07:00
Peter Johnson
9e24c6eac0 [wpiutil] Logger: paren-protect instance usage in macro (#4384) 2022-08-29 13:25:53 -07:00
Tyler Veness
fe4d12ce22 [wpimath] Add LTV controller derivations and make enums private (#4380)
The LTV differential drive controller derivation wasn't included inline
because it's too long.
2022-08-28 23:04:52 -07:00
Brandon Parsons
eb08486039 [build] Fix MacOS binary rpath generation (#4376)
For RPATH on MacOS use '@loader_path' instead of '$ORIGIN' to reference the directory where the executable is located. The latter is the mechanism used on Linux.

I think this was exposed due to newer OS X ignoring $DYLD_LIBRARY_PATH for security reasons.
2022-08-25 18:17:16 -07:00
Tyler Veness
ccf83c634a [build] Use native-utils platform names instead of raw strings (#4375) 2022-08-25 12:54:11 -07:00
Peter Johnson
3fd69749e7 [docs] Upgrade to doxygen 1.9.4 (#4370)
Doxygen 1.9.2 requires libclang-9, which is no longer available on
Ubuntu 22.04.
2022-08-21 18:49:04 -07:00
Peter Johnson
594df5fc08 [wpinet] uv/util.h: Pull in ws2_32.lib on Windows for ntohs (#4371) 2022-08-21 18:48:49 -07:00
Tyler Veness
539070820d [ci] Enable asan for wpinet and wpiutil (#4369) 2022-08-21 14:59:07 -07:00
Peter Johnson
564a56d99b [wpinet] Fix memory leak in WorkerThreadTest (#4368) 2022-08-21 10:29:31 -07:00
Tyler Veness
5adf50d93c [upstream_utils] Refactor upstream_utils scripts (#4367)
* Root folder variable names are now more descriptive
* clone_repo() now restores the current working directory
* Removed setup_upstream_repo() since it's now identical to clone_repo()
* Moved am_patches()'s for loop into user scripts so the filename prefix
  doesn't need to be included in every patch filename
* Renamed am_patches() to git_am() since its only job now is to run "git am"
* Removed unused apply_patches() function
* Fixed typo in git_am()'s ignore_whitespace arg name
2022-08-20 07:26:34 -07:00
Tyler Veness
d80e8039d7 [wpiutil] Suppress fmtlib clang-tidy warning in C++20 consteval contexts (#4364) 2022-08-19 23:52:19 -07:00
Tyler Veness
0e6d67b23b [upstream_utils] Remove yapf format disable comment (#4366) 2022-08-19 23:51:57 -07:00
Tyler Veness
be5270697a [build] Suppress enum-enum deprecation warning in OpenCV (#4365) 2022-08-19 23:51:43 -07:00
Tyler Veness
8d28851263 Add Rosetta install command to build requirements (#4363) 2022-08-18 19:58:43 -07:00
Tyler Veness
3d2115c93e [wpinet] include-what-you-use in MulticastTest (#4360)
This fixes an MSVC compilation error with C++20.
2022-08-18 14:03:55 -07:00
Tyler Veness
91002ae3cc [wpimath] Upgrade to Drake 1.6.0 (#4361) 2022-08-18 14:03:28 -07:00
Tyler Veness
148c18e658 [wpinet] Upgrade to libuv 1.44.2 (#4362) 2022-08-18 13:57:49 -07:00
Tyler Veness
a2a5c926b6 Fix clang-tidy warnings (#4359)
The warnings included recommendations of braces for if statement
readability, a recommendation for default initialization of an int
array, and include-what-you-use (indirectly through clang-tidy reporting
undefined symbols).
2022-08-17 19:53:56 -07:00
Tyler Veness
ea6b1d8449 [wpiutil] Remove unused ManagedStatic class (#4358)
We migrated to magic statics for lazy construction like the following:
```cpp
class Singleton {
  static Singleton& GetSingleton() {
    static Singleton instance;
    return instance;
  }
};
```
2022-08-17 18:04:42 -07:00
Tyler Veness
ac9be78e27 Use stricter C++ type conversions (#4357)
Now, implicit narrowing conversions are only used with wpi::Now(). This
also fixes clang-tidy warnings about C-style casts. For example:
```
== clang-tidy /__w/allwpilib/allwpilib/wpilibNewCommands/src/main/native/include/frc2/command/SwerveControllerCommand.inc ==
/__w/allwpilib/allwpilib/wpilibNewCommands/src/main/native/include/frc2/command/SwerveControllerCommand.inc:95:18: warning: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting]
  auto curTime = units::second_t(m_timer.Get());
                 ^
```
In that case at least, the cast was removed entirely since Get() already
returns a units::second_t.
2022-08-17 13:42:36 -07:00
Tyler Veness
151dabb2af [wpiutil] Upgrade to fmt 9.0.0 (#4337)
fmt removed fmt::make_args_checked since it's no longer needed for
constexpr format string checks.

fmt deprecated implicit conversions from enums to integers in format
arguments, so I added explicit static casts.
2022-08-16 15:35:26 -07:00
Tyler Veness
340465c929 [ci] Upgrade to clang-format and clang-tidy 14 (NFC) (#4347) 2022-08-16 15:25:04 -07:00
Michael Leong
d45bcddd15 [examples] Add comments to StateSpaceDifferentialDrive (#4341) 2022-08-15 06:26:20 -07:00
Tyler Veness
0e0786331a Update LLVM libraries to 14.0.6 (#4350)
The main noticeable change is the SmallString conversion operator to std::string is now explicit instead of implicit.
2022-08-15 05:38:15 -07:00
Tyler Veness
c5db23f296 [wpimath] Add Eigen sparse matrix and iterative solver support (#4349)
These are useful for efficiently solving huge, but sparse systems of
equations that occur often in optimization problems.
2022-08-13 18:32:02 -07:00
Tyler Veness
44abc8dfa6 [upstream_utils] Remove git version from upstream patches (#4351)
This reduces commit noise when other git versions are used. The version
was removed by passing `--no-signature` to `git format-patch` which is
now documented in the readme.
2022-08-13 18:31:26 -07:00
Tyler Veness
3fdb2f767d [wpimath] Add comments with Ramsete equations (#4348) 2022-08-11 07:09:16 -07:00
Tyler Veness
0485f05da9 [wpilibjExamples] Upgrade jacoco to match allwpilib (#4346) 2022-08-05 10:21:40 -07:00
Thad House
0a5eb65231 [wpinet] Handle empty txt block for mdns announcer (#4072) 2022-08-03 11:15:56 -07:00
sciencewhiz
19ffebaf3e [wpilib] Add reference to I2C Lockup to API Docs (NFC) (#4340) 2022-07-29 21:01:21 -07:00
Tyler Veness
ce1a90d639 [hal] Replace SerialHelper "goto done" with continue (#4342)
The logic is already correct for closing all the objects. So we should just be continuing on error.
2022-07-27 14:37:32 -07:00
Tyler Veness
d25af48797 [ci] Make upstream_utils CI fail on untracked files (#4339)
This catches issues like update scripts putting new files in a different
directory from the old ones.
2022-07-24 19:34:16 -07:00
Jeffrey Morris
ebb836dacb [examples] Fix negations in event loop examples (#4334) 2022-07-24 19:33:52 -07:00
Tyler Veness
d83e202f00 [upstream_utils] Update paths in update_fmt.py (#4338) 2022-07-22 18:08:36 -07:00
Tyler Veness
3ccf806064 [wpimath] Remove redundant LinearFilter.finiteDifference() argument (#4335)
The number of samples is already determined by the length of the stencil
list.
2022-07-22 12:50:30 -05:00
Tyler Veness
6f1e01f8bd [wpimath] Document example of online filtering for LinearFilter.finiteDifference() (#4336) 2022-07-22 12:46:33 -05:00
sciencewhiz
1023c34b1c [readme] Update location of ni-libraries (#4333)
Fixes #4321
2022-07-09 17:44:03 -05:00
Tyler Veness
faa29d596c [wpilib] Improve Notifier docs (NFC) (#4326) 2022-07-01 06:45:00 -07:00
Tyler Veness
add00a96ed [wpimath] Improve DifferentialDriveAccelerationLimiter docs (NFC) (#4323)
Defined trackwidth, added skipped steps to the algorithm's internal
proof, and grouped the algorithm steps more logically with blank lines.
2022-07-01 06:43:57 -07:00
Tyler Veness
82fac41244 [wpimath] Better document trackwidth parameters (NFC) (#4324) 2022-07-01 06:42:49 -07:00
Tyler Veness
5eb44e22a9 Format Python scripts with black (NFC) (#4325) 2022-07-01 06:41:44 -07:00
Peter Johnson
2e09fa7325 [build] Fix mpack cmake (#4322) 2022-06-24 19:35:13 -07:00
Starlight220
fe3c24b1ee [command] Add ignoringDisable decorator (#4305) 2022-06-24 10:52:53 -07:00
Thad House
aa221597bc [build] Add M1 builds, change arm name, update to 2023 deps (#4315) 2022-06-20 12:28:46 -06:00
Tyler Veness
579a8ee229 [ci] Use one worker for Windows release Gradle build (#4318)
It was running out of heap space.
2022-06-18 22:45:12 -07:00
Justus
5105c5eab6 [wpilibj] Change "final" to "exit" in the IterativeRobotBase JavaDoc (NFC) (#4317)
"exit" is used in every other instance.
2022-06-18 15:02:36 -07:00
PJ Reiniger
787fe6e7a5 [wpiutil] Separate third party libraries (#4190) 2022-06-18 08:08:31 -07:00
ohowe
6671f8d099 [wpigui] Update portable file dialogs (#4316)
All commits from March 16, 2022 to June 1, 2022
This fixes the save button in sysid on macOS.
2022-06-17 22:47:22 -07:00
Starlight220
9ac9b69aa2 [command] Reorder Scheduler operations (#4261)
Fixes several cases where calling scheduler operations from a command callback could result in NPEs or other issues.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-06-15 23:32:16 -07:00
Tyler Veness
e61028cb18 [build] halsim_gui: Add wpinet dependency (#4313) 2022-06-15 23:14:31 -07:00
ohowe
661d23eaf5 [glass] Add precision setting for NetworkTable view (#4311) 2022-06-15 21:21:52 -07:00
Tyler Veness
666040e3e5 [hal] Throw exceptions for invalid sizes in I2C and SPI JNI (#4312)
GCC's static analyzer is correctly reporting that resize() requires an
unsigned integer, but the argument provided in the JNI function could be
negative since it's a signed byte. Throwing an exception if the argument
is negative fixes the warning.
2022-06-15 21:20:52 -07:00
Tyler Veness
aebc272449 [build] Upgrade to spotbugs Gradle plugin 5.0.8 (#4310)
This fixes a SecurityManager deprecation warning generated by spotbugs.
2022-06-14 20:26:53 -07:00
Starlight220
fd884581e4 [wpilib] Add BooleanEvent/Trigger factories on HID classes (#4247) 2022-06-13 22:48:16 -07:00
Tyler Veness
9b1bf5c7f1 [wpimath] Move Drake and Eigen to thirdparty folders (#4307) 2022-06-11 21:07:15 -07:00
Starlight220
c9e620a920 [wpilibc] Change EventLoop data structure to vector (#4304) 2022-06-10 05:38:54 -07:00
Peter Johnson
41d40dd62f [wpinet] Fix libuv unused variable warning on Mac (#4299) 2022-06-09 23:30:16 -07:00
PJ Reiniger
30f5b68264 [wpinet] Fix JNI loading error (#4295) 2022-06-08 22:21:22 -07:00
DeltaDizzy
f7b3f4b90e [examples] Getting Started: Change Joystick to XboxController (#4194) 2022-06-08 22:20:33 -07:00
Connor Worley
a99c11c14c [wpimath] Replace UKF implementation with square root form (#4168)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-06-08 22:19:01 -07:00
Starlight220
45b7fc445b [wpilib] Add EventLoop (#4104)
This is a generic expansion of the command-based Trigger framework.
2022-06-08 22:16:51 -07:00
Peter Johnson
16a4888c52 [wpilib] Default off LiveWindow telemetry (#4301)
The original idea of LiveWindow telemetry was to automatically make
telemetry data visible to users.  This has proved increasingly
problematic in recent years due to the "spooky action at a distance"
of telemetry happening for objects that are only constructed but not
used, and blocking or slow object reads resulting in hard-to-debug
loop overrun conditions.
2022-06-08 22:13:00 -07:00
Thad House
17752f1337 [ci] Split debug and release Windows builds (#4277)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-06-06 17:25:02 -07:00
Starlight220
abb45a68db [commands] Remove custom test wrappers (#4296)
Use AtomicBoolean and AtomicInteger instead of
custom ConditionHolder and Counter classes.
2022-06-06 17:13:11 -07:00
Peter Johnson
1280a54ef3 [upstream_utils]: Make work with Python 3.8 (#4298)
str.removesuffix() is only available in Python 3.9, which is not in many
Linux installations.
2022-06-06 17:07:16 -07:00
Starlight220
f2d243fa68 [build] Change defaults for Java lints (#4300)
Removes the need to individually suppress the "serial" warning.
2022-06-06 17:06:43 -07:00
sciencewhiz
a4787130f4 Update using development build to work with 2023 gradlerio (#4294) 2022-06-04 13:58:51 -07:00
Prateek Machiraju
af7985e46c [wpiutil] Use invoke_result_t instead of result_of in future.h (#4293)
std::result_of is deprecated in C++17.
2022-06-02 23:04:20 -07:00
Tyler Veness
e9d1b5c2d0 [hal] Remove deprecated SimDevice functions (#4209) 2022-06-02 22:53:02 -07:00
Prateek Machiraju
45b598d236 [wpilibj] Add toString() methods to Color and Color8Bit (#4286) 2022-06-02 21:23:11 -07:00
Prateek Machiraju
fc37265da5 [wpimath] Add angle measurement convention to ArmFeedforward docs (NFC) (#4285) 2022-06-02 21:22:47 -07:00
Prateek Machiraju
a4ec13eb0e [wpilibjexamples] Remove unnecessary voltage desaturation 2022-06-02 21:22:19 -07:00
Prateek Machiraju
2fa52007af [wpilibc] Use GetBatteryVoltage() in MotorController::SetVoltage
This avoids having to cast to units::voltage_t
2022-06-02 21:22:19 -07:00
Prateek Machiraju
d9f9cd1140 [wpimath] Reset prev_time on pose estimator reset (#4283) 2022-06-02 21:21:42 -07:00
truher
8b6df88783 [wpilibj] Tachometer.getFrequency(): Fix bug (#4281)
Now it returns 1/period (like Tachometer.cpp); before it just returned period.
2022-06-01 10:13:19 -07:00
Tyler Veness
345cff08c0 [wpiutil] Make wpi::array constexpr (#4278) 2022-05-31 20:21:29 -07:00
Tyler Veness
57428112ac [wpimath] Upgrade to Drake v1.3.0 (#4279) 2022-05-31 20:20:01 -07:00
Thad House
a18d4ff154 [build] Fix tools not being copied when built with -Ponly* (#4276) 2022-05-29 22:09:00 -07:00
Peter Johnson
d1cd07b9f3 [wpigui] Add OpenURL (#4273)
This function opens a URL using the default browser.
2022-05-29 18:45:39 -07:00
Peter Johnson
e67f8e917a [glass] Use glfwSetKeyCallback for Enter key remap (#4275)
The imgui internals methods break with imgui >= 0.87.
2022-05-29 18:44:52 -07:00
Tyler Veness
be2fedfe50 [wpimath] Add stdexcept include for std::invalid_argument (IWYU) (#4274) 2022-05-29 15:33:19 -07:00
Peter Johnson
7ad2be172e [build] Update native-utils to 2023.0.1 (#4272)
Also remove x86 build bits.
2022-05-28 11:12:59 -07:00
Peter Johnson
abc605c9c9 [ci] Update workflows to 20.04 base image (#4271) 2022-05-27 23:33:33 -07:00
PJ Reiniger
3e94805220 [wpiutil] Reduce llvm collections patches (#4268) 2022-05-27 13:41:28 -07:00
Tyler Veness
db2e1d170e [upstream_utils] Document how to update thirdparty libraries (#4253)
Also, add a CI job to ensure the sources in the repo are consistent with
the update scripts.
2022-05-26 09:02:32 -07:00
Tyler Veness
96ebdcaf16 [wpimath] Remove unused Eigen AutoDiff module (#4267)
Drake's tests used to include it, but it's commented out since it's not
used.
2022-05-26 09:01:45 -07:00
PJ Reiniger
553b2a3b12 [upstream_utils] Fix stackwalker (#4265) 2022-05-24 21:51:32 -07:00
Tyler Veness
3e13ef42eb [wpilibc] Add missing std::array #include (include-what-you-use) (#4266) 2022-05-24 21:49:22 -07:00
Tyler Veness
d651a1fcec Fix internal deprecation warnings (#4257)
This allows us to error out on deprecation warnings for thirdparty
libraries and standard library features.

Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2022-05-24 13:56:48 -07:00
ohowe
b193b318c1 [commands] Add unless() decorator (#4244) 2022-05-24 09:22:19 -07:00
bovlb
ef3714223b [commands] Remove docs reference to obsolete interrupted() method (NFC) (#4262) 2022-05-24 09:19:38 -07:00
Dalton Smith
3d8dbbbac3 [readme] Add quickstart (#4225) 2022-05-22 20:19:50 -07:00
Peter Johnson
013efdde25 [wpinet] Wrap a number of newer libuv features (#4260) 2022-05-22 20:18:23 -07:00
Starlight220
816aa4e465 [wpilib] Add Pneumatics sim classes (#4033) 2022-05-22 07:21:40 -07:00
Tyler Veness
046c2c8972 [wpilibc] Rename SpeedControllerGroupTest.cpp (#4258)
Also move motor controller test files into motorcontrol folder to match
Java.
2022-05-21 16:20:26 -07:00
Tyler Veness
d80e9cdf64 [upstream_utils] Use shallow clones for thirdparty repos (#4255)
This makes update_llvm.py in particular much faster because the full
repo requires fetching 2 GB.
2022-05-20 18:59:33 -07:00
Tyler Veness
7576136b4a [upstream_utils] Make update_llvm.py executable (#4254) 2022-05-20 17:16:19 -07:00
PJ Reiniger
c3b223ce60 [wpiutil] Vendor llvm and update to 13.0.0 (#4224) 2022-05-20 15:59:53 -07:00
Tyler Veness
5aa67f56e6 [wpimath] Clean up math comments (#4252) 2022-05-20 15:16:56 -07:00
Tyler Veness
fff4d1f44e [wpimath] Extend Eigen warning suppression to GCC 12 (#4251)
It originally only applied to GCC 11. The CMake build passed without
this change, but not the Gradle build.
2022-05-19 18:50:29 -07:00
Tyler Veness
0d9956273c [wpimath] Add CoordinateSystem.convert() translation and rotation overloads (#4227) 2022-05-18 20:41:15 -07:00
Tyler Veness
3fada4e0b4 [wpinet] Update to libuv 1.44.1 (#4232) 2022-05-18 20:40:27 -07:00
Tyler Veness
65b23ac45e [wpilibc] Fix return value of DriverStation::GetJoystickAxisType() (#4230)
It was returning a pointer to the axis type array cast to a bool (always
1) instead of returning the desired axis type.
2022-05-18 14:36:11 -07:00
Tyler Veness
4ac34c0141 [upstream_utils] Cleanup update_libuv.py (#4249) 2022-05-18 14:34:34 -07:00
Tyler Veness
8bd614bb1e [upstream_utils] Use "git am" instead of "git apply" for patches (#4248)
This creates actual commits in the thirdparty repo, which makes rebasing
them onto new versions much easier.
2022-05-18 12:23:15 -07:00
Tyler Veness
4253d6d5f0 [upstream_utils] Apply "git am" patches individually (#4250)
Also, giving am_patches() zero patches isn't an error. The function will
just be a no-op.
2022-05-18 12:22:31 -07:00
Tyler Veness
6a4752dcdc Fix GCC 12.1 warning false positives (#4246) 2022-05-18 12:22:10 -07:00
Tyler Veness
5876b40f08 [wpimath] Memoize CoordinateSystem and CoordinateAxis statics (#4241) 2022-05-18 10:47:46 -07:00
Tyler Veness
5983434a70 [cameraserver] Replace IterativeRobot in comment sample code with TimedRobot (#4238) 2022-05-15 20:47:50 -07:00
Max Gordon
a3d44a1e69 [wpimath] Add Translation2d.getAngle() (#4217)
Co-authored-by: Max Gordon <tonald.drump2.0@gamil.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-05-14 21:22:00 -07:00
Tyler Veness
d364bbd5a7 [upstream_utils] Give vendor update scripts execute permissions (#4226) 2022-05-14 15:31:51 -07:00
Tyler Veness
f341e1b2be [wpimath] Document standard coordinate systems better (NFC) (#4228) 2022-05-14 15:31:06 -07:00
Peter Johnson
9af389b200 [wpinet] AddrToName: Initialize name (#4229) 2022-05-14 06:55:22 -07:00
Austin Shalit
2ae4adf2d7 [ci] Add wpiformat command to PRs (#4223) 2022-05-11 22:06:11 -07:00
sciencewhiz
178b2a1e88 Contributing.md: Correct version of clang-format used (#4222) 2022-05-10 23:48:08 -07:00
PJ Reiniger
18db343cdc [wpiutil, wpinet] Vendor libuv, stack walker (#4219) 2022-05-08 22:21:54 -07:00
Austin Shalit
f0c821282a [build] Use artifactory mirror (#4220) 2022-05-08 13:59:58 -07:00
Peter Johnson
d673ead481 [wpinet] Move network portions of wpiutil into new wpinet library (#4077) 2022-05-07 10:54:14 -07:00
Tyler Veness
b33715db15 [wpimath] Add CoordinateSystem class (#4214) 2022-05-07 10:25:19 -07:00
Dustin Spicuzza
99424ad562 [sim] Allow creating a PWMSim object from a PWMMotorController (#4039) 2022-05-06 08:44:59 -07:00
Tommy Beadle
dc6f641fd2 [wpimath] PIDController: Reset position and velocity error when reset() is called. (#4064)
In addition to m_prevError and m_totalError, m_positionError and
m_velocityError need to be reset to 0 when reset() is called.
Otherwise, the next time calculate() is called, the old values will be
used as the previous error, but this is inaccurate since the caller
wanted to reset the state of the PID controller.
2022-05-06 08:44:08 -07:00
Tyler Veness
f20a20f3f1 [wpimath] Add 3D geometry classes (#4175)
Also clean up 2D geometry documentation.
2022-05-06 08:41:23 -07:00
Kaitlyn Kenwell
708a4bc3bc [wpimath] Conserve previously calculated swerve module angles when updating states for stationary ChassisSpeeds (#4208)
* Calculated swerve module states now stored in a member variable
* If ChassisSpeeds(0, 0, 0) is converted to module speeds, the
previously calculated module angle will be conserved, with forward speed
set to 0
* New tests added
2022-05-06 08:38:20 -07:00
chen perach
ef7ed21a9d [wpimath] Improve accuracy of ComputerVisionUtil.calculateDistanceToTarget() (#4215) 2022-05-06 08:36:58 -07:00
Tyler Veness
b1abf455c1 [wpimath] LTVUnicycleController: Use LUT, provide default hyperparameters (#4213) 2022-05-04 22:04:08 -07:00
Tyler Veness
d5456cf278 [wpimath] LTVDifferentialDriveController: Remove unused variable (#4212) 2022-05-04 22:03:15 -07:00
Tyler Veness
99343d40ba [command] Remove old command-based framework (#4211) 2022-05-04 22:02:53 -07:00
Tyler Veness
ee03a7ad3b Remove most 2022 deprecations (#4205)
Excludes "old" commands and SimDevice functions.
2022-05-04 20:37:27 -07:00
Tyler Veness
ce1a7d698a [wpimath] Refactor WheelVoltages inner class to a separate file (#4203) 2022-05-01 11:01:20 -07:00
Tyler Veness
87bf70fa8e [wpimath] Add LTV controllers (#4094)
This adds a unicycle controller that's a drop-in replacement for Ramsete
and a differential drive controller that controls the full pose and
outputs voltages. The main benefit is LQR-like tuning knobs using a
system model.
2022-04-30 22:54:22 -07:00
Tyler Veness
ebd2a303bf [wpimath] Remove deprecated MakeMatrix() function (#4202) 2022-04-30 22:52:05 -07:00
Peter Johnson
e28776d361 [wpimath] LinearSystemLoop: Add extern templates for common cases 2022-04-30 20:38:55 -07:00
Peter Johnson
dac1429aa9 [wpimath] LQR: Use extern template instead of Impl class 2022-04-30 20:38:55 -07:00
Peter Johnson
e767605e94 [wpimath] Add typedefs for common types
This makes complex code significantly easier to read.

frc::Vectord<Size> = Eigen::Vector<double, Size>
frc::Matrixd<Rows, Cols> = Eigen::Matrix<double, Rows, Cols>
2022-04-30 20:38:55 -07:00
Peter Johnson
97c493241f [wpimath] UnscentedKalmanFilter: Move implementation out-of-line 2022-04-30 20:38:55 -07:00
Peter Johnson
8ea90d8bc9 [wpimath] ExtendedKalmanFilter: Move implementation out-of-line 2022-04-30 20:38:55 -07:00
Peter Johnson
ae7b1851ec [wpimath] KalmanFilter: Use extern template instead of Impl class 2022-04-30 20:38:55 -07:00
Peter Johnson
e3d62c22d3 [wpimath] Add extern templates for common cases
This helps reduce compile times and memory usage.
2022-04-30 20:38:55 -07:00
Peter Johnson
7200c4951d [wpiutil] SymbolExports: Add WPILIB_IMPORTS for dllimport 2022-04-30 20:38:55 -07:00
Peter Johnson
84056c9347 [wpiutil] SymbolExports: Add EXPORT_TEMPLATE_DECLARE/DEFINE 2022-04-30 20:38:55 -07:00
Oblarg
09cf6eeecb [wpimath] ApplyDeadband: add a scale param (#3865)
Also templates it in C++ so it can work with both doubles and units.
2022-04-30 20:29:48 -07:00
Austin Shalit
03230fc842 [build,ci] Enable artifactory build cache (#4200) 2022-04-30 20:27:23 -07:00
Jason Daming
63cf3aaa3f [examples] Don't square ArcadeDrive inputs in auto (#4201) 2022-04-30 20:19:32 -07:00
Starlight220
18ff694f02 [wpimath] Add Rotation2d.fromRadians factory (#4178) 2022-04-30 00:19:29 -07:00
Tyler Veness
4f79ceedd9 [wpilibc] Add missing #include (#4198) 2022-04-30 00:07:37 -07:00
Starlight220
f7ca72fb41 [command] Rename PerpetualCommand to EndlessCommand (#4177) 2022-04-28 09:38:38 -07:00
bovlb
a06b3f0307 [hal] Correct documentation on updateNotifierAlarm (#4156)
The previous documentation suggested that `triggerTime` is the interval until the next alarm, but the implementation is that it is the absolute alarm time.
2022-04-26 21:53:30 -07:00
Tyler Veness
d926dd1610 [wpimath] Fix pose estimator performance (#4111)
Fixes #4087.
2022-04-26 18:43:59 -07:00
ysthakur
51bc893bc5 [wpiutil] CircularBuffer: Change Java package-private methods to public (#4181)
The `size`, `getFirst`, `getLast`, and `resize` methods were all package-private.

Also make `size` return an `int` instead of a `double`.
2022-04-25 14:58:12 -07:00
Tyler Veness
fbe761f7f6 [build] Increase Gradle JVM heap size (#4172)
wpimath artifact publishing was running out of heap
2022-04-24 23:13:57 -07:00
Tyler Veness
5ebe911933 [wpimath] Add DifferentialDriveAccelerationLimiter (#4091) 2022-04-24 07:21:40 -07:00
Tyler Veness
3919250da2 [wpilibj] Remove finalizers (#4158)
They were deprecated for removal in Java 18 because they're error-prone.
Prefer AutoCloseable and Cleaner instead.

https://openjdk.java.net/jeps/421
https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/ref/Cleaner.html
2022-04-24 07:21:08 -07:00
ohowe
b3aee28388 [commands] Allow BooleanSupplier for Trigger operations (#4103) 2022-04-24 07:20:46 -07:00
Tyler Veness
9d20ab3024 [wpilib] Allow disabling ElevatorSim gravity (#4145)
Closes #4144.
2022-04-24 07:19:18 -07:00
Peter Johnson
aaa69f6717 [ci] Remove 32-bit Windows builds (#4078) 2022-04-24 07:18:49 -07:00
Tyler Veness
355a11a414 Update Java linters and fix new PMD errors (#4157)
PMD requires that variables only initialized in the constructor be
final. The compiler errors if those final variables aren't guaranteed to
be initialized, so extra else branches were added to ensure that.

PMD also requires that classes with only private constructors be final.
The equivalent C++ classes were finalized as well, except for
TimeInterpolatableBuffer because it doesn't expose factory functions.
2022-04-24 07:18:05 -07:00
Jason Daming
ffc69d406c [examples] Reduce suggested acceleration in Ramsete example (#4171)
This value mirrors the update to the documentation in wpilibsuite/frc-docs#1792.
2022-04-19 17:10:11 -07:00
camaj
922d50079a [wpimath] Units: fix comment in degreesToRotations (NFC) (#4159) 2022-04-13 22:32:55 -07:00
Jonah Snider
dd163b62ae [wpimath] Rotation2d: Add factory method that uses rotations (#4166)
Rotation2d.fromRotations(1).equals(new Rotation2d(2 * Math.PI)); // true

Also adds a member method to get the value of the Rotation2d in rotations.
2022-04-13 22:31:43 -07:00
Tyler Veness
bd80e220b9 [ci] Upgrade CMake actions (#4161) 2022-04-12 19:00:00 -07:00
Tyler Veness
aef4b16d4c [wpimath] Remove unnecessary NOLINT in LinearPlantInversionFeedforward (NFC) (#4155) 2022-04-08 21:31:42 -07:00
Spud
975171609e [wpilib] Compressor: Rename enabled to isEnabled (#4147)
This is a less confusing name, as enabled() can imply it enables the compressor.
2022-04-08 21:31:08 -07:00
Tyler Veness
5bf46a9093 [wpimath] Add ComputerVisionUtil (#4124)
Closes #4108.
2022-04-08 21:20:53 -07:00
ohowe
f27a1f9bfb [commands] Fix JoystickButton.getAsBoolean (#4131)
This previously always returned false; the get method it inherited was not used in the getAsBoolean defined in the Trigger class. The fix is to swap get() and getAsBoolean() implementations in the Trigger class.
2022-04-08 21:20:23 -07:00
Excalibur FRC | 6738
1b26e2d5da [commands] Add RepeatCommand (#4009)
Co-authored-by: Starlight220 <53231611+Starlight220@users.noreply.github.com>
2022-04-07 22:02:08 -07:00
apple
88222daa3d [hal] Fix misspelling in AnalogInput/Output docs (NFC) (#4153)
value -> valid
(NFC)
2022-04-07 21:57:01 -07:00
Tyler Veness
81c5b41ce1 [wpilibj] Document MechanismLigament2d angle unit (NFC) (#4142) 2022-03-31 00:29:44 -07:00
Peter Johnson
9650e6733e [wpiutil] DataLog: Document finish and thread safety (NFC) (#4140) 2022-03-29 12:28:59 -07:00
Tyler Veness
c8905ec29a [wpimath] Remove ImplicitModelFollower dt argument (#4119)
The math works just fine without model discretization.
2022-03-29 11:29:06 -07:00
Tyler Veness
b4620f01f9 [wpimath] Fix Rotation2d interpolation in Java (#4125)
Fixes #4112.
2022-03-29 08:42:43 -07:00
Tyler Veness
2e462a19d3 [wpimath] Constexprify units unary operators (#4138)
Fixes #4137.
2022-03-29 08:42:08 -07:00
Peter Johnson
069f932e59 [build] Fix gl3w cmake build (#4139) 2022-03-28 22:31:51 -07:00
Tyler Veness
126e3de91a [wpilibc] Remove unused SetPriority() call from Ultrasonic (#4123) 2022-03-24 07:24:12 -07:00
Tyler Veness
ba0dccaae4 [wpimath] Fix reference to Rotation2d.fromRadians() (#4118)
Rotation2d.fromRadians() doesn't exist. The constructor should be used
instead.
2022-03-20 21:57:03 -07:00
sciencewhiz
e1b6e5f212 [wpilib] Improve MotorSafety documentation (NFC) (#4120)
Remove OBE RobotDrive porting guide from MecanumDrive
2022-03-20 21:54:43 -07:00
Tyler Veness
8d79dc8738 [wpimath] Add ImplicitModelFollower (#4056) 2022-03-20 00:36:12 -07:00
Tyler Veness
78108c2aba [wpimath] Fix PIDController having incorrect error after calling SetSetpoint() (#4070) 2022-03-19 23:59:00 -07:00
Tyler Veness
cdafc723fb [examples] Remove unused LinearPlantInversionFeedforward includes (#4069) 2022-03-19 20:47:09 -07:00
Ashray._.g
0d70884dce [wpimath] Add InterpolatedTreeMap (#4073)
- Add InterpolatedTreeMap for Java from team 254's 2016 MIT licensed code
- Add InterpolatedMap for C++ from team 3512's code with @calcmogul (original author) permission

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2022-03-19 20:46:42 -07:00
Tyler Veness
765efa325e [wpimath] Remove redundant column index from vectors (#4116) 2022-03-19 20:44:14 -07:00
Tyler Veness
89ffcbbe41 [wpimath] Update TrapezoidProfile class name in comment (NFC) (#4107) 2022-03-19 20:41:53 -07:00
Tyler Veness
95ae23b0e7 [wpimath] Improve EKF numerical stability (#4093)
The Joseph form of the error covariance update equation is more
numerically stable when the Kalman gain isn't optimal. Numerical
instability and filter divergence can occur if the user goes long time
periods between updates and the error covariance becomes ill-conditioned
(the ratio between the largest and smallest eigenvalue gets too large).
2022-03-19 20:41:28 -07:00
Tyler Veness
d5cb6fed67 [wpimath] Support zero cost entries in MakeCostMatrix() (#4100)
The existing implementation will produce a cost of NaN if a tolerance of
infinity is entered, but the limit approaches zero. Being able to
specify that a state has no cost is useful, so this change adds support for
that.
2022-03-19 20:40:26 -07:00
Tyler Veness
d0fef18378 [wpimath] Remove redundant this. from ExtendedKalmanFilter.java (#4115) 2022-03-19 20:39:10 -07:00
Tyler Veness
d640c0f41f [wpimath] Fix pose estimator local measurement standard deviation docs (NFC) (#4113) 2022-03-19 20:38:32 -07:00
Dustin Spicuzza
a2fa5e3ff7 [wpilibc] BatterySim: Provide non-initializer list versions of Calculate (#4076) 2022-03-14 10:09:55 -07:00
sciencewhiz
a3eea9958e [hal] Add link to FRC CAN Spec (NFC) (#4086) 2022-03-14 10:07:44 -07:00
Tyler Veness
db27331d7b [wpilib] Update DifferentialDrive docs (NFC) (#4085)
Fixes #4084.
2022-03-14 10:07:06 -07:00
Peter Johnson
fdfb31f164 [dlt] Export boolean[] values (#4082) 2022-03-14 10:05:50 -07:00
Dustin Spicuzza
f93c3331b3 [wpigui] disable changing directory when initializing on MacOS (#4092)
- Seems to be intended for resource bundles in MacOS apps, which we don't use
2022-03-14 10:05:22 -07:00
Thad House
ab7ac4fbb9 [build] Fix various warnings in cmake builds (#4081) 2022-03-07 22:36:42 -08:00
Thad House
bc39a1a293 [wpilibc] Fix moved pneumatics objects not destructing properly (#4068) 2022-03-01 11:10:45 -08:00
Tyler Veness
2668130e70 [wpimath] Remove SwerveDrivePoseEstimator encoder reset warning (#4066)
SwerveDrivePoseEstimator uses velocities, so position resets aren't
needed.

Closes #4065.
2022-02-28 17:40:25 -08:00
Austin Shalit
d27ed3722b [ci] Set actions workflow concurrency (#4060)
This sets the workflow concurrency to 1 for all workflows. For PRs this means if you push an additional commit older jobs will be cancelled.

The documentation workflow already only runs on tags or merges to main. For this, we cancel previous runs if they are to the same destination (tag or main) but still prevent 2 jobs from running at once if they are spawned from different refs.
2022-02-27 20:13:58 -08:00
shueja-personal
dae18308c9 [wpimath] Minor fixes to Rotation2d docs (NFC) (#4055)
Fixed incorrect examples on .plus(), and a missing word.

Make example code snippets closer to actual use.
2022-02-27 16:56:56 -08:00
Peter Johnson
d66555e42f [datalogtool] Add datalogtool
This is a support tool for datalog file conversion (and eventually
download/remote datalog file management).
2022-02-26 09:49:34 -08:00
Peter Johnson
9f52d8a3b1 [wpilib] DriverStation: Add DataLog support for modes and joystick data 2022-02-26 09:49:34 -08:00
Peter Johnson
757ea91932 [wpilib] Add DataLogManager
This creates a default log file that captures NT changes and
automatically renames the log file based on time and match info.

DriverStation joystick logging will be implemented by the DriverStation
class instead.
2022-02-26 09:49:34 -08:00
Peter Johnson
02a804f1c5 [ntcore] Add DataLog support 2022-02-26 09:49:34 -08:00
Peter Johnson
9b500df0d9 [wpiutil] Add high speed data logging 2022-02-26 09:49:34 -08:00
Peter Johnson
5a89575b3a [wpiutil] Import customized LLVM MemoryBuffer 2022-02-26 09:49:34 -08:00
Peter Johnson
b8c4d7527b [wpiutil] Add MappedFileRegion 2022-02-26 09:49:34 -08:00
Alberto Jahuey Moncada
ac5d46cfa7 [wpilibc] Fix ProfiledPID SetTolerance default velocity value (#4054)
When trying to set the tolerance of a ProfiledPID, it fails if you don't give it a velocity value. It was missing a conversion from double to the appropiate unit.
2022-02-25 20:27:56 -08:00
Thad House
bc9e96e86f [wpilib] Absolute Encoder API and behavior fixes (#4052)
SetPositionOffset was added. Been requested multiple times, and easy to implement.

The javadocs mentioned GetPositionInRotation. It has tripped up many people how to get the absolute position from the encoder (You currently have to have precreated the DutyCycle object). Add this method (as GetAbsolutePostition) to make this easier to do.

The checks for making sure a matching set of values was read was doing direct double comparisions. This worked ok in the DutyCycle case, but has problems in the analog case. Solve this by using an epsilon comparison.

And finally, scale AnalogEncoders analog input to 0-1 instead of 0-5. This was reported a few years ago, but the issue was missed. This caused the encoder to count from 0-5, then 1-6, then 2-7 etc. This is solved and now works correctly.

Closes #3188
Closes #4046
Closes #4051

And fixes the following issue on CD
https://www.chiefdelphi.com/t/wpilib-analogencoder-java/372649
2022-02-24 22:45:15 -08:00
Dustin Spicuzza
f88c435dd0 [hal] Add mechanism to cancel all periodic callbacks (#4049) 2022-02-23 09:46:01 -08:00
Leonard Abbas
e4b91005cf [examples] Update SwerveModule constructor doc (NFC) (#4042)
Renamed "port" to "channel" for consistency.
2022-02-22 09:26:16 -08:00
Leonard Abbas
a260bfd83b [examples] Remove "this" keyword from SwerveModule (#4043) 2022-02-21 09:27:00 -08:00
Leonard Abbas
18e262a100 [examples] Fix multiple doc typos in SwerveControllerCommand example (NFC) (#4044) 2022-02-21 09:26:20 -08:00
Dustin Spicuzza
4bd1f526ab [wpilibc] Prevent StopMotor from terminating robot during MotorSafety check (#4038)
- Nothing else in that function can throw, so protecting StopMotor should be sufficient
- Fixes #4036
2022-02-19 20:42:10 -08:00
Dustin Spicuzza
27847d7eb2 [sim] Expose GUI control functions via HAL_RegisterExtension (#4034) 2022-02-19 20:40:25 -08:00
Dustin Spicuzza
b2a8d3f0f3 [wpilibc] Add mechanism to reset MotorSafety list (#4037) 2022-02-19 20:38:30 -08:00
Tyler Veness
49adac9564 [wpilib] Check for signedness in ArcadeDriveIK() (#4028)
If xSpeed == -0.0 and zRotation > 0, the algorithm assumes it's in the
third quadrant instead of the first since +0.0 == -0.0.

Also added tests for inverse kinematic functions, fixed some
MecanumDrive test bugs, and added Java MecanumDrive.driveCartesianIK()
and KilloughDrive.driveCartesianIK() overloads with defaulted gyro angle
that C++ already had.

Fixes #4022.
2022-02-17 18:03:59 -08:00
Peter Johnson
a19d1133b1 [wpiutil] libuv: Fix sign compare warnings in gcc 11.2 (#4031) 2022-02-13 16:56:53 -08:00
Peter Johnson
dde91717e4 [build] cmake: Add ability to customize target warnings (#4032) 2022-02-13 16:53:55 -08:00
Peter Johnson
e9050afd67 [sim] Update sim match time to match real robot (#4024)
The real robot has match time set to -1.0 until it's enabled, and then
counts down. Disabling the robot sets the time to -1.0.

The sim GUI has been updated to add preset buttons for auto and teleop
match times. The enable match timing checkbox has been removed as it's
no longer required.

The DS socket plugin has also been fixed to properly initialize
matchTime to -1.0 and reset it to -1.0 on disable.
2022-02-12 22:31:10 -08:00
sciencewhiz
165d2837cf [wpilib] Preferences: Set Persistent in Init methods (#4025)
Fixes #4018
2022-02-12 22:30:02 -08:00
Peter Johnson
ac7549edca [glass] Fix snprintf truncation warning (#4029) 2022-02-12 22:29:26 -08:00
Jonah Snider
4d96bc72e0 [wpilibj] Fix typos in error messages for non-null assertions (#4014) 2022-02-11 18:11:15 -08:00
Dustin Spicuzza
3411eee20f [hal] Replace hardcoded sim array sizes with constants (#4015) 2022-02-10 00:12:07 -08:00
Dustin Spicuzza
74de97eeca [wpilibc] Add mechanism to reset various global structures (#4007) 2022-02-09 22:14:12 -08:00
sciencewhiz
4e3cc25012 [examples] Fix periodic function rate comment (NFC) (#4013)
Fixes #3979
2022-02-08 13:19:31 -08:00
Dustin Spicuzza
90c1db393e [sim] Add exported functions to control the sim GUI (#3995) 2022-02-07 00:39:45 -08:00
sciencewhiz
2f43274aa4 [wpilibj] MechanismRoot2d: Add flush to setPosition (#4011)
Fixes #4010.
2022-02-06 22:47:33 -08:00
Peter Johnson
aeca09db09 [glass] Support remapping of Enter key (#3994)
This is useful for editing of values without disabling the DS.
2022-02-06 00:11:37 -08:00
Peter Johnson
c107f22c67 [sim] Sim GUI: don't force-show Timing and Other Devices (#4001)
Instead preserve their saved visible state.
2022-02-06 00:11:12 -08:00
Peter Johnson
68fe51e8da [wpigui] Update PFD to latest, fix kdialog multiselect (#4005) 2022-02-06 00:10:43 -08:00
modelmat
8d08d67cf1 [wpigui] PFD: Add console warning if file chooser unavailable (#4003)
Also remove iostream use.
2022-02-06 00:10:20 -08:00
Dustin Spicuzza
4f1782f66e [wpilibc] Only call HAL_Report when initializing SmartDashboard (#4006) 2022-02-06 00:07:55 -08:00
Tyler Veness
3f77725cd3 Remove uses of iostream (#4004)
Most of these were unused, the IMU ones were just debug messages.

The only one that wasn't removed is in portable-file-dialogs.cpp since
the replacement looks less trivial.
2022-02-05 23:00:31 -08:00
Peter Johnson
5635f33a32 [glass] Increase plot depth to 20K points (#3993)
2K was sufficient for simulation because it's possible to pause time,
but isn't quite enough for looking at real robot data. 20K points
is 400 seconds at 50 Hz which should make pausing plots much more
useful.

As every point is looped over, this does increase CPU utilization
somewhat but doesn't seem to have much of an impact for typical
use cases. Increasing this further will necessitate some greater
optimizations (e.g. an initial cull using binary search).
2022-02-04 22:20:38 -08:00
Peter Johnson
bca4b7111b [glass] Fix PlotSeries::SetSource() (#3991)
This can be called in a delayed manner, so it's possible for
m_size to already be at maximum, which results in writing past
the end of the array. Instead, just call AppendValue().
2022-02-04 20:47:11 -08:00
Oblarg
6a6366b0d6 [commands] Add until() as alias for withInterrupt() (#3981)
This is a clearer description for the functionality.
Will deprecate withInterrupt next year.
2022-02-03 22:14:52 -08:00
Thad House
16bf2c70c5 [wpilib] Fix joystick out of range error messages (#3988) 2022-02-03 22:10:44 -08:00
Thad House
4b3edb742c [wpilib] Fix ADIS16448 IMU default constructor not working in Java (#3989)
Also fixes a few related uninitialized variables in C++.
2022-02-03 22:09:12 -08:00
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
Starlight220
269cf03472 [examples] Add communication examples (e.g. arduino) (#2500)
Co-authored-by: Andrew Dassonville <dassonville.andrew@gmail.com>
2022-01-06 18:08:57 -08:00
sciencewhiz
5ccfc4adbd [oldcommands] Deprecate PIDWrappers, since they use deprecated interfaces (#3868) 2022-01-06 18:05:24 -08:00
Peter Johnson
b6f44f98be [hal] Add warning about onboard I2C (#3871)
Adds HAL layer warning for #3842. This is needed in the case when a
vendor uses the HAL directly rather than using the WPILib I2C class.

This should not result in a duplicate warning for WPILib I2C users due
to the duplicate message checking performed in HAL_SendError().

We don't want to remove the WPILib I2C warning because it gives stack
trace information while the HAL layer one can't.
2022-01-06 17:44:27 -08:00
Peter Johnson
0dca57e9ec [templates] romieducational: Invert drivetrain and disable motor safety (#3869) 2022-01-06 11:29:15 -08:00
Tyler Veness
22c4da152e [wpilib] Add GetRate() to ADIS classes (#3864)
The angular rate is treated somewhat like an angle during calibration,
but the datasheet says it's angular rate. The variables were renamed to
make this clearer.
2022-01-04 22:26:23 -08:00
Peter Johnson
05d66f862d [templates] Change the template ordering to put command based first (#3863)
Previously it was a bit buried.
2022-01-04 21:23:57 -08:00
Dustin Spicuzza
b09f5b2cf2 [wpilibc] Add virtual dtor for LinearSystemSim (#3861) 2022-01-03 21:25:02 -08:00
Tyler Veness
a2510aaa0e [wpilib] Make ADIS IMU classes unit-safe (#3860)
The gyro rate getters were removed since that data isn't available.
2022-01-03 20:00:53 -08:00
Tyler Veness
947f589916 [wpilibc] Rename ADIS_16470_IMU.cpp to match class name (#3859) 2022-01-03 17:53:57 -08:00
Peter Johnson
bbd8980a20 [myRobot] Fix cameraserver library order (#3858) 2022-01-03 11:59:29 -08:00
Tyler Veness
831052f118 [wpilib] Add simulation support to ADIS classes (#3857) 2022-01-03 11:44:12 -08:00
Noah Andrews
c137569f91 [wpilib] Throw exception if the REV Pneumatic Hub firmware version is older than 22.0.0 (#3853) 2022-01-03 11:09:30 -08:00
sciencewhiz
dae61226fa Fix Maven Artifacts readme (#3856)
Add wpiutil to wpimath
Add wpimath to wpilibj and wpilibc
2022-01-03 10:18:49 -08:00
sciencewhiz
3ad4594a88 Update Maven artifacts readme for 2022 (#3855) 2022-01-01 13:28:36 -08:00
Matteo Kimura
112acb9a62 [wpilibc] Move ADIS IMU constants to inside class (#3852) 2022-01-01 11:40:28 -08:00
Peter Johnson
ecee224e81 [wpilib] Allow SendableCameraWrappers to take arbitrary URLs (#3850)
Useful for adding cameras that are streamed from a coprocessor

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
Co-authored-by: Sam Carlberg <sam.carlberg@gmail.com>
2022-01-01 10:10:37 -08:00
Peter Johnson
a3645dea34 LICENSE: Bump year range to include 2022 (#3854) 2022-01-01 00:00:16 -08:00
Jan-Felix Abellera
7c09f44898 [wpilib] Use PSI for compressor config and sensor reading (#3847)
This adds the REV Analog Pressure Sensor PSI to volt (and vice versa) conversion to allow setting the compressor config in PSI and getting the sensor reading in PSI. Also adds input validation for pressure values at the higher level.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2021-12-31 21:04:56 -08:00
Peter Johnson
f401ea9aae [wpigui] Remove wpiutil linkage (#3851)
It was only being used for fs::remove() (added in #3463), which is easily
replaced by std::remove().

The code change does not affect the WPILib tools, as this code is not used when JSON save files are used.
2021-12-31 07:56:31 -08:00
Peter Johnson
bf8517f1e6 [wpimath] TimeInterpolatableBufferTest: Fix lint warnings (#3849) 2021-12-31 00:06:08 -08:00
David Vo
528087e308 [hal] Use enums with fixed underlying type in clang C (#3297)
This will allow static analysis tools that use clang to always determine the correct intended parameter types for HAL functions.
2021-12-30 21:20:05 -08:00
Thad House
1f59ff72f9 [wpilib] Add ADIS IMUs (#3777)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: Matteo Kimura <mateus.sakata@gmail.com>
2021-12-30 19:43:53 -08:00
Matt
315be873c4 [wpimath] Add TimeInterpolatableBuffer (#2695)
These classes are useful for storing previous robot positions to use in conjunction with the upcoming pose estimators.

Co-authored-by: Prateek Machiraju <prateek.machiraju@gmail.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: cttew <cttewari@gmail.com>
2021-12-30 19:08:05 -08:00
Oblarg
b8d019cdb4 [wpilib] Rename NormalizeWheelSpeeds to DesaturateWheelSpeeds (#3791) 2021-12-30 18:30:08 -08:00
Peter Johnson
102f23bbdb [wpilibj] DriverStation: Set thread interrupted state (#3846)
This is a Java best practice when catching InterruptedException.
2021-12-30 13:13:52 -08:00
Kevin-OConnor
b85c24a79c [wpilib] Add warning about onboard I2C (#3842) 2021-12-30 13:13:03 -08:00
Oblarg
eee29daaf9 [newCommands] Trigger: Allow override of debounce type (#3845)
Previously Trigger could only be debounced on rising edges.
This change preserves the default behavior but adds the capability to override it.
2021-12-29 16:10:43 -08:00
Oblarg
aa9dfabde2 [wpimath] Move debouncer to filters (#3838) 2021-12-28 09:49:41 -08:00
Peter Johnson
5999a26fba [wpiutil] Add GetSystemTime() (#3840)
This portably gets the time in microseconds since the Unix epoch.
2021-12-27 23:06:31 -08:00
sciencewhiz
1e82595ffb [examples] Fix arcade inversions (#3841)
Accounts for differences between ArcadeDrive and the methods used
in some other examples.
2021-12-27 23:05:42 -08:00
Peter Johnson
e373fa476b [wpiutil] Add disableMockTime to JNI (#3839)
This exposes the equivalent of SetNowImpl(nullptr) to Java.
2021-12-27 09:51:32 -08:00
sciencewhiz
dceb5364f4 [examples] Ensure right side motors are inverted (#3836)
Fixes #3827
Adds MotorController inversion for right side, removes inversion in
setVoltage methods.

Also fixes various XboxController negations (was inconsistent throughout examples).
2021-12-26 19:25:26 -08:00
Oblarg
baacbc8e24 [wpilib] Tachometer: Add function to return RPS (#3833) 2021-12-26 15:52:18 -08:00
Austin Shalit
84b15f0883 [templates] Add Java Romi Educational template (#3837)
This is a combination of a Romi Gradle project and Educational robot (added in #3309)
2021-12-26 15:46:22 -08:00
Dalton Smith
c0da9d2d35 [examples] Invert Right Motor in Romi Java examples (#3828) 2021-12-26 15:42:53 -08:00
sciencewhiz
0fe0be2733 [build] Change project year to intellisense (#3835)
This means VSCode won't prompt to upgrade (added in beta 4)
2021-12-25 20:50:06 -06:00
Tyler Veness
eafa947338 [wpimath] Make copies of trajectory constraint arguments (#3832)
This avoids stack-use-after-scope bugs in code like the following when
the original argument goes out of scope:
```cpp
frc2::Command* RobotContainer::GetAutonomousCommand() {
  // Create a voltage constraint to ensure we don't accelerate too fast
  frc::DifferentialDriveVoltageConstraint autoVoltageConstraint(
      frc::SimpleMotorFeedforward<units::meters>(
          DriveConstants::ks, DriveConstants::kv, DriveConstants::ka),
      DriveConstants::kDriveKinematics, 10_V);
```
2021-12-25 07:19:43 -06:00
sciencewhiz
9d13ae8d01 [wpilib] Add notes for Servo get that it only returns cmd (NFC) (#3820)
Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2021-12-23 22:22:18 -08:00
Tyler Veness
2a64e4bae5 [wpimath] Give drivetrain a more realistic width in TrajectoryJsonTest.java (#3822)
Fixes #3819.
2021-12-22 22:28:23 -08:00
Tyler Veness
c3fd20db59 [wpilib] Fix trajectory sampling in DifferentialDriveSim test (#3821)
Also rename C++ test file to match class name.

Fixes #3818.
2021-12-22 22:27:51 -08:00
WarrenReynolds
6f91f37cd0 [examples] Fix SwerveControllerCommand order of Module States (#3815)
DriveSubsystem::SetModulesStates applies module state to incorrect modules.

Fixes #3814.
2021-12-22 12:26:02 -08:00
Peter Johnson
5158730b81 [wpigui] Upgrade to imgui 1.86, GLFW 3.3.6 (#3817)
The GLFW upgrade fixes gamepads not being mapped at startup.
2021-12-22 12:24:36 -08:00
Thad House
2ad2d2ca96 [wpiutil] MulticastServiceResolver: Fix C array returning functions (#3816) 2021-12-22 09:52:57 -08:00
Starlight220
b5fd29774f [wpilibj] Trigger: implement BooleanSupplier interface (#3811) 2021-12-21 11:33:16 -08:00
sciencewhiz
9f8f330e96 [wpilib] Fix Mecanum and SwerveControllerCommand when desired rotation passed (#3808) 2021-12-19 20:08:28 -08:00
Tyler Veness
1ad3b1b333 [hal] Don't copy byte to where null terminator goes (#3807)
Fixes the following compiler warning:
```
/__w/allwpilib/allwpilib/hal/src/main/native/sim/Notifier.cpp:323:21: error: 'char* strncpy(char*, const char*, size_t)' specified bound 64 equals destination size [-Werror=stringop-truncation]
         std::strncpy(arr[num].name, notifier->name.c_str(),
         ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      sizeof(arr[num].name));
                      ~~~~~~~~~~~~~~~~~~~~~~
```
2021-12-19 16:46:12 -08:00
Thad House
dfc24425c3 [build] Fix gazebo gradle IDE warnings (#3806)
Also add note on how to generate all files for the IDE.
2021-12-19 14:20:08 -08:00
Thad House
c02577bb51 [glass] Configure delay loading for windows camera server support (#3803)
We don't currently support cameras in glass, but it's something we want to do in the future. However, when we do this, glass will completely stop working on N builds of windows, and it would fail to load at all with no messages. To solve this, we can delayload the media foundation dlls that are missing. The executable will then launch even without the dlls present, and we can attempt to load them at runtime and dynamically disable camera support.

When we get around to implementing it, we can just call HasCameraSupport, and dynamically hide all camera related code behind that flag.
2021-12-19 14:19:24 -08:00
sciencewhiz
c9e6a96a61 [wpilib] Document range of Servo angle (NFC) (#3796) 2021-12-19 13:53:31 -08:00
Thad House
9778626f34 [wpilib, hal] Add support for getting faults and versions from power distribution (#3794) 2021-12-19 13:42:49 -08:00
Thad House
34b2d0dae1 [wpilib, hal] High Level REV PH changes (#3792)
More functionality was implemented at the HAL level, so expose that to the wpilib level.

This also does units changes for all the PH related functionality.
2021-12-19 13:41:35 -08:00
Thad House
59a7528fd6 [cscore] Fix crash when usbcamera is deleted before message pump thread fully starts (#3804)
shared_from_this will assert if the shared pointer is in the middle of being destructed. Because we access shared_from_this in the message pump, this can easily occur. The solution is to grab the weak pointer, manually attempt to lock it, and only continue if that succeeds. The message pump is already synchronized to the usb camera being destructed, so this is a fine behavior.
2021-12-19 13:39:23 -08:00
Thad House
11d9859ef1 [build] Update plugins to remove log4j vulnerabilities (#3805) 2021-12-19 13:38:48 -08:00
Peter Johnson
e44ed752ad [glass] Fix CollapsingHeader in Encoder, PCM, and DeviceTree (#3797)
The new storage approach was attempting to save both the name and the
open status to the same storage key.
2021-12-19 07:35:12 -08:00
Thad House
52b2dd5b89 [build] Bump native utils to remove log4j (#3802) 2021-12-19 07:33:12 -08:00
sciencewhiz
c46636f218 [wpilib] Improve new counter classes documentation (NFC) (#3801) 2021-12-18 21:40:03 -08:00
sciencewhiz
dc531462e1 [build] Update to gradle 7.3.2 (#3800) 2021-12-18 21:34:35 -08:00
Tyler Veness
92ba98621c [wpimath] Add helper variable templates for units type traits (#3790) 2021-12-18 11:32:32 -08:00
sciencewhiz
d41d051f1b [wpilibc] Fix Mecanum & Swerve ControllerCommand lambda capture (#3795)
Fixes #3765
Also fixes SwerveControllerCommand example calling command twice.
2021-12-18 11:30:57 -08:00
sciencewhiz
c5ae0effac OtherVersions.md: Add one missing case of useLocal (#3788) 2021-12-15 20:30:34 -08:00
Tyler Veness
b3974c6ed3 [wpimath] Upgrade to Drake v0.37.0 (#3786) 2021-12-14 06:41:38 -08:00
Peter Johnson
589a00e379 [wpilibc] Start DriverStation thread from RobotBase (#3785)
With the change from GetInstance to static functions, many functions
don't call DriverStation::GetInstance(), so the DS thread wasn't
getting started by default.  Call InDisabled() to make sure this
happens.
2021-12-12 22:23:13 -08:00
Tyler Veness
8d9836ca02 [wpilib] Improve curvature drive documentation (NFC) (#3783) 2021-12-12 17:59:04 -08:00
Peter Johnson
8b5bf8632e [myRobot] Add wpimath and wpiutil JNI (#3784) 2021-12-12 17:57:52 -08:00
sciencewhiz
1846114491 [examples] Update references from characterization to SysId (NFC) (#3782) 2021-12-11 21:25:43 -08:00
Thad House
2c461c794e [build] Update to gradle 7.3 (#3778) 2021-12-10 21:26:28 -08:00
Jan-Felix Abellera
109363daa4 [hal] Add remaining driver functions for REVPH (#3776)
Add the remaining HAL functions needed to fully support the Pneumatic Hub and its latest firmware.

- Clear sticky faults
- Get device voltage
- Get 5v supply voltage (used for analog to PSI calculation)
- Get solenoid voltage
- Get solenoid current
- Get device firmware and hardware version

Some minor refactoring was done for naming of some internal functions for consistency purposes.
2021-12-09 12:29:09 -08:00
Jan-Felix Abellera
41d26bee8d [hal] Refactor REV PDH (#3775)
Refactors retrieving the faults from the device to match the implementation that we have for the Pneumatic Hub. Instead of having a getter function for each fault, there is a single function to get all faults (sticky or normal) for use with the higher level API

Renames functions to be consistent

Removes some functions that don't need to be included in wpilib:
- Identify device - this just flashes the module LED on the device and has no use in wpilib
- Is PDH enabled - the PDH does not change state depending on robot enabled state

PDH frame and signal names were updated in our DBC, and this PR makes use of the newly generated CAN frame helper functions
2021-12-09 12:27:06 -08:00
Tyler Veness
7269a170fb Upgrade maven deps to latest versions and fix new linter errors (#3772)
This also makes the Gradle build work with JDK 17.

The extra JVM args in gradle.properties works around a bug with spotless
and JDK 17: https://github.com/diffplug/spotless/issues/834

PMD.CloseResource was ignored because it's almost always a false
positive, and there are many of them.
2021-12-09 12:20:08 -08:00
Thad House
441f2ed9b0 [build] actions: use fixed image versions instead latest (#3761) 2021-12-09 12:12:59 -08:00
Modelmat
15275433d4 [examples] Fix duplicate port allocations in C++ SwerveBot/SwerveDrivePoseEstimator/RomiReference (#3773)
- Remove duplicate motor port (2) from C++ SwerveBot/SwerveDrivePoseEstimator

Java has the correct motor ports.

- Fix duplicate port allocation in C++ RomiReference by correcting if/else check

Java logic was already correct, and confirms this change.
2021-12-06 21:08:34 -08:00
Jason Daming
1ac02d2f58 [examples] Fix drive Joystick axes in several examples (#3769) 2021-12-06 16:40:10 -08:00
Jason Daming
8ee6257e92 [wpilib] DifferentialDrivetrainSim.KitbotMotor: Add NEO and Falcon 500 (#3762) 2021-12-06 14:46:58 -08:00
Prateek Machiraju
d81ef2bc5c [wpilib] Fix deadlocks in Mechanism2d et al. (#3770)
UpdateEntries() and Flush() are called from methods that lock the mutex,
so locking it again will cause deadlocks. This also updates the Java
code to make MechanismObject2d::update synchronized like in the C++
version.
2021-12-06 14:42:02 -08:00
Tyler Veness
acb64dff97 [wpimath] Make RamseteController::Calculate() more concise (#3763) 2021-12-06 12:57:42 -08:00
Jan-Felix Abellera
3f6cf76a8c [hal] Refactor REV PH CAN frames (#3756) 2021-12-06 10:08:57 -08:00
Peter Johnson
3ef2dab465 [wpilib] DutyCycleEncoder: add setting of duty cycle range (#3759)
As the sensor needs to maintain an actual duty cycle, it can't go all
the way from 0-100, so provide a way to set the min and max and linearly
map between the two.
2021-12-05 14:28:08 -08:00
sciencewhiz
a5a56dd067 Readme: Add Visual Studio 2022 (#3760) 2021-12-05 14:27:37 -08:00
Tyler Veness
04957a6d30 [wpimath] Fix units of RamseteController's b and zeta (#3757)
Fixes #3755.
2021-12-03 18:21:30 -08:00
Peter Johnson
5da54888f8 [glass] Upgrade imgui to 0.85, implot to HEAD, glfw to 3.3.5 (#3754)
This in particular upgrades the plot widget with a few new features
and makes more plot configuration persistent.
2021-12-03 17:23:18 -08:00
Thad House
6c93365b0f [wpiutil] MulticastService cleanup (#3750)
Fix duplicated constructors, and also use simpler utf conversion API on windows.
2021-12-02 21:06:55 -08:00
Thad House
1c4a8bfb66 [cscore] Cleanup Windows USB camera impl (#3751)
- Use wpiutil string conversion rather than codecvt (which is deprecated).
- Force A function types.
2021-12-02 13:48:03 -08:00
Thad House
d51a1d3b3d [rtns] Fix icon (#3749) 2021-11-30 21:58:58 -08:00
Thad House
aced2e7da6 Add roboRIO Team Number Setter tool (#3744) 2021-11-30 11:17:30 -08:00
Thad House
fa1ceca83a [wpilibj] Use DS cache for iterative robot control word cache (#3748)
The root cause of #3747 is CommandScheduler's ds state checks are behind iterative robots checks. This means that the iterative robot state could return enabled, but the DS cache could still be reporting disabled. This results in a race in the Disabled -> Enabled transition, which manifests in commands not running.

Previously, iterative robot base pulled from the DS cache. This meant that the ds cache was always updated before an iterative robot base loop could run. This still had a race, but this could only occur on the Enabled -> Disable transition, which is much less noticeable and would usually just result in a command running for an extra loop.

We can move back to the old behavior by grabbing the new iterative robot base check variables to use the DS cache.
2021-11-29 20:56:58 -08:00
sciencewhiz
0ea05d34e6 [build] Update to gradle 7.2 (#3746) 2021-11-29 20:53:26 -08:00
Thad House
09db4f672b [build] Update to native utils 2022.6.1 (#3745) 2021-11-29 13:04:08 -08:00
Thad House
4ba80a3a8c [wpigui] Don't recursively render frames in size callback (#3743)
WindowSizeCallback can sometimes be called while doing a render. If this occurs, imgui asserts. Avoid this case.
2021-11-28 01:03:40 -08:00
Peter Johnson
ae208d2b17 [wpiutil] StringExtras: Add substr() (#3742)
Unlike std::string and std::string_view, this substr() allows a start
greater than the length of the string, in which case an empty string
is returned.  This matches llvm::StringRef behavior.
2021-11-27 21:31:40 -08:00
Thad House
6f51cb3b98 [wpiutil] MulticastResolver: make event manual reset, change to multiple read (#3736) 2021-11-27 11:16:24 -08:00
Peter Johnson
f6159ee1a2 [glass] Fix Drive widget handling of negative rotation (#3739)
This would crash in debug mode due to an imgui assertion in PathArcTo.
2021-11-27 10:58:45 -08:00
Thad House
7f401ae895 [build] Update NI libraries to 2022.2.3 (#3738) 2021-11-27 09:43:07 -08:00
Peter Johnson
0587b7043a [glass] Use JSON files for storage instead of imgui ini
Storage is now nested.

Separate "roots" can be configured which save to separate files.
In particular, this is used to save wpigui and ImGui window position
to a -window.json file.

ImGui's ini (for window position) is mapped to JSON.

You can optionally specify a directory to load from on the command line.
If one isn't provided, it uses the global system directory.
Any changes made are automatically saved here.

Workspace | Open: select directory, the current layout is replaced with that
workspace, and future auto-saves also switch to that location. The main
window size/location is not changed, only the contents.

Workspace | Save As: select directory, the current layout is saved there,
and future auto-saves also switch to that location.

Workspace | Reset: window locations are preserved, but all other settings
are reset to default (including e.g. removing plot windows). This will also
end up clearing the current save file. as with load, the main window
size/location is not changed.

Workspace | Save As Global: "save as" to the global system location

Notably, the main window size/location is only loaded at startup, but is
auto-saved as part of the current workspace.
2021-11-27 00:12:13 -08:00
Peter Johnson
0bbf51d566 [wpigui] Change maximized to bool 2021-11-27 00:12:13 -08:00
Peter Johnson
92c6eae6b0 [wpigui] PFD: Add explicit to constructors 2021-11-27 00:12:13 -08:00
Peter Johnson
141354cd79 [wpigui] Add hooks for custom load/save settings
Add GetPlatformSaveFileDir().
2021-11-27 00:12:13 -08:00
Thad House
f6e9fc7d71 [wpiutil] Handle multicast service collision on linux (#3734) 2021-11-26 23:20:54 -08:00
Peter Johnson
d8418be7d1 [glass, outlineviewer] Return 0 from WinMain (#3735)
While this is implicit in main(), WinMain() requires an explicit return.
2021-11-26 23:19:45 -08:00
Thad House
82066946e5 [wpiutil] Add mDNS resolver and announcer (#3733) 2021-11-25 22:08:26 -08:00
Thad House
4b1defc8d8 [wpilib] Remove automatic PD type from module type enum (#3732)
Using automatic type doesn't work with any module number, so the API was confusing.
2021-11-23 23:03:45 -08:00
Oblarg
da90c1cd2c [wpilib] Add bang-bang controller (#3676)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2021-11-23 20:34:46 -08:00
Thad House
3aa54fa027 [wpilib] Add new counter implementations (#2447) 2021-11-23 20:33:36 -08:00
Thad House
b156db400d [hal, wpilib] Incorporate pneumatic control type into wpilibc/j (#3728) 2021-11-23 20:32:02 -08:00
sciencewhiz
9aba2b7583 [oldCommands] Add wrappers for WPILib objects to work with old PID Controller (#3710) 2021-11-23 20:30:30 -08:00
Jan-Felix Abellera
a9931223f0 [hal] Add REV PH faults (#3729) 2021-11-22 21:15:32 -08:00
Tyler Veness
aacf9442e4 [wpimath] Fix units typo in LinearSystemId source comment (#3730) 2021-11-22 21:14:38 -08:00
Tyler Veness
7db10ecf00 [wpilibc] Make SPI destructor virtual since SPI contains virtual functions (#3727) 2021-11-20 11:21:02 -08:00
Tyler Veness
a0a5b2aea5 [wpimath] Upgrade to EJML 0.41 (#3726) 2021-11-20 01:02:37 -08:00
Jan-Felix Abellera
eb835598a4 [hal] Add HAL functions for compressor config modes on REV PH (#3724) 2021-11-20 01:02:23 -08:00
Tyler Veness
f0ab6df5b6 [wpimath] Upgrade to Drake v0.36.0 (#3722) 2021-11-16 14:37:29 -08:00
sciencewhiz
075144faa3 [docs] Parse files without extensions with Doxygen (#3721)
Fixes inclusion of wpi::numbers and some Eigen files
2021-11-16 11:22:34 -08:00
Thad House
32468a40cb [hal] Remove use of getDmaDescriptor from autospi (#3717)
It’s not necessary, as the index equals the channel.
2021-11-13 08:55:21 -08:00
Vasista Vovveti
38611e9dd7 [hal] Fix REVPH Analog Pressure channel selection (#3716) 2021-11-10 18:22:18 -08:00
sciencewhiz
4d78def31e [wpilib] Add DeadbandElimination forwarding to PWMMotorController (#3714) 2021-11-09 21:24:47 -08:00
Tyler Veness
3be0c1217a [wpilibcExamples] Make GearsBot use idiomatic C++ (#3711)
Replace pointer constructor arguments with references, and const qualify
getters where possible.

Also remove redundant simulation P gain.

Fixes #1146.
2021-11-09 20:11:50 -08:00
Tyler Veness
42d3a50aa2 [hal] Check error codes during serial port initialization (#3712)
Throw if serial port init fails.

Fixes #2036.
2021-11-09 20:10:48 -08:00
PJ Reiniger
52f1464029 Add project with field images and their json config files (#3668) 2021-11-08 22:48:16 -08:00
Thad House
68ce62e2e9 [hal] Add autodetect for power modules (#3706)
Default autodetect to REV if no devices are found, as only the REV devices have control functionality (the switchable output).
2021-11-07 13:53:38 -08:00
Thad House
3dd41c0d37 [wpilib] Don't print PD errors for LiveWindow reads (#3708)
If something happens with the PD connection, these would have spammed messages continuously.
This wasn't the case previously, and we don't want this behavior now.
2021-11-07 13:45:28 -08:00
Thad House
7699a1f827 [hal] Fix sim not working with automatic PD type and default module (#3707) 2021-11-05 23:30:10 -07:00
Peter Johnson
e473a00f97 [wpiutil] Base64: Add unsigned span/vector variants (#3702) 2021-11-01 07:48:26 -07:00
Peter Johnson
52f2d580eb [wpiutil] raw_uv_ostream: Add reset() (#3701)
This enables reuse of a raw_uv_ostream object.
2021-11-01 07:47:13 -07:00
Peter Johnson
d7b1e3576f [wpiutil] WebSocket: move std::function (#3700) 2021-11-01 07:46:15 -07:00
sciencewhiz
93799fbe9d [examples] Fix description of TrapezoidProfileSubsystem (#3699) 2021-11-01 00:08:53 -07:00
Tyler Veness
b84644740d [wpimath] Document pose estimator states, inputs, and outputs (#3698)
Fixes #3244.
2021-10-29 17:37:13 -07:00
Tyler Veness
2dc35c1399 [wpimath] Fix classpaths for JNI class loads (#3697)
Found by inspecting the results of the following rg commands:
`rg --multiline 'FindClass\(\s*"'`
`rg 'JClass' -A 1`

Fixes #3660.
2021-10-29 16:23:46 -07:00
Tyler Veness
2cb171f6f5 [docs] Set Doxygen extract_all to true and fix Doxygen failures (#3695)
The template argument order for UnscentedTransform was reversed to match
all the other UKF classes. Since UnscentedTransform is intended as a
class for internal use only, this shouldn't cause much breakage.
2021-10-29 15:07:05 -07:00
Tyler Veness
a939cd9c89 [wpimath] Print uncontrollable/unobservable models in LQR and KF (#3694)
IsDetectable() was added to make the code easier to read.
2021-10-29 00:03:02 -07:00
Tyler Veness
d5270d113b [wpimath] Clean up C++ StateSpaceUtil tests (#3692) 2021-10-29 00:02:03 -07:00
Tyler Veness
b20903960b [wpimath] Remove redundant discretization tests from StateSpaceUtilTest (#3689)
DiscretizationTest already does these.
2021-10-29 00:01:41 -07:00
Tyler Veness
c0cb545b41 [wpilibc] Add deprecated Doxygen attribute to SpeedController (#3691)
Fixes #3690.
2021-10-29 00:01:04 -07:00
Tyler Veness
35c9f66a75 [wpilib] Rename PneumaticsHub to PneumaticHub (#3686)
Fixes #3684.
2021-10-29 00:00:31 -07:00
Tyler Veness
796d03d105 [wpiutil] Remove unused LLVM header (#3688) 2021-10-28 00:18:26 -07:00
Tyler Veness
8723caf78d [wpilibj] Make Java TrapezoidProfile.Constraints an immutable class (#3687) 2021-10-28 00:17:36 -07:00
Tyler Veness
187f50a344 [wpimath] Catch incorrect parameters to state-space models earlier (#3680)
This allows giving more descriptive exceptions than if they are thrown
later in KalmanFilter, for example.

Fixes #3678.
2021-10-27 20:18:57 -07:00
Tyler Veness
8d04606c4d Replace instances of frc-characterization with SysId (NFC) (#3681) 2021-10-27 06:40:17 -07:00
Peter Johnson
b82d4f6e58 [hal, cscore, ntcore] Use WPI common handle type base 2021-10-26 23:39:11 -07:00
Peter Johnson
87e34967ef [wpiutil] Add synchronization primitives
These enable more consistent use of synchronization across the
native libraries.  Users can create Event and Semaphore primitives, but
in addition, libraries can set up any handle as an Event-type signal.
2021-10-26 23:39:11 -07:00
Peter Johnson
e32499c546 [wpiutil] Add ParallelTcpConnector (#3655)
This is a libuv-based parallel, repeating TCP connector for making
multiple parallel DNS resolution and TCP connection attempts to a
network server.
2021-10-26 23:37:58 -07:00
Tyler Veness
aa0b49228d [wpilib] Remove redundant "quick turn" docs for curvature drive (NFC) (#3674)
The parameter docs for allowTurnInPlace say the same thing, and it's no
longer called "quick turn".
2021-10-26 23:37:11 -07:00
Noah Andrews
57301a7f9c [hal] REVPH: Start closed-loop compressor control on init (#3673)
Similar to the PCM, we're going to make the PH not do anything with the compressor until the PH HAL object has been initialized. The mechanism we're going to use to signal to the PH that that has happened is to begin sending the state of the solenoids (which will all be set to off at this point).
2021-10-26 23:36:47 -07:00
sciencewhiz
d1842ea8fb [wpilib] Improve interrupt docs (NFC) (#3679) 2021-10-26 23:35:01 -07:00
Peter Johnson
558151061e [wpiutil] Add DsClient (#3654)
This is a libuv-based implementation of the Driver Station client
for getting robot IPs from the Driver Station port 1742 server.
2021-10-26 23:34:27 -07:00
Tyler Veness
181723e573 Replace .to<double>() and .template to<double>() with .value() (#3667)
It's a less verbose way to do the same thing.
2021-10-25 08:58:12 -07:00
sciencewhiz
6bc1db44bc [commands] Add pointer overload of AddRequirements (artf6003) (#3669)
Also update documentation in CommandBase.
2021-10-25 08:57:22 -07:00
Tyler Veness
737b57ed5f [wpimath] Update to drake v0.35.0 (#3665) 2021-10-22 23:02:08 -07:00
Austin Shalit
4d287d1ae2 [build] Upgrade WPIJREArtifact to JRE 2022-11.0.12u5 (#3666) 2021-10-22 23:01:09 -07:00
apple
f26eb5ada4 [hal] Fix another typo (get -> gets) (NFC) (#3663) 2021-10-22 11:49:21 -07:00
apple
94ed275ba6 [hal] Fix misspelling (numer -> number) (NFC) (#3662) 2021-10-22 07:23:13 -07:00
Peter Johnson
ac2f44da33 [wpiutil] uv: use move for std::function (#3653)
Also use function_ref for Loop::Walk().
2021-10-20 23:24:59 -07:00
Peter Johnson
75fa1fbfbf [wpiutil] json::serializer: Optimize construction (#3647)
Remove unused locale pointer.
2021-10-20 21:09:04 -07:00
Peter Johnson
5e689faea8 [wpiutil] Import MessagePack implementation (mpack) (#3650) 2021-10-20 21:08:31 -07:00
Peter Johnson
649a50b401 [wpiutil] Add LEB128 byte-by-byte reader (#3652)
This is needed for compatibility with streaming data (e.g. libuv) where partial data
may be received.  Also add raw_ostream writer.
2021-10-20 18:50:20 -07:00
Peter Johnson
e94397a97d [wpiutil] Move json_serializer.h to public headers (#3646)
This makes it possible to do "manual" JSON-compliant serialization more efficiently
(e.g. without needing to construct a full json object).
2021-10-20 11:18:13 -07:00
Peter Johnson
4ec58724d7 [wpiutil] uv::Tcp: Clarify SetNoDelay documentation (#3649) 2021-10-20 08:46:44 -07:00
Peter Johnson
8cb294aa4a [wpiutil] WebSocket: Make Shutdown() public (#3651) 2021-10-20 08:45:58 -07:00
Peter Johnson
2b3a9a52b3 [wpiutil] json: Fix map iterator key() for std::string_view (#3645) 2021-10-20 08:45:16 -07:00
Peter Johnson
138cbb94b2 [wpiutil] uv::Async: Add direct call for no-parameter specialization (#3648) 2021-10-20 08:44:33 -07:00
sciencewhiz
e56d6dea81 [ci] Update testbench pool image to ubuntu-latest (#3643) 2021-10-18 21:39:43 -07:00
sciencewhiz
43f30e44e4 [build] Enable comments in doxygen source files (#3644) 2021-10-18 21:39:22 -07:00
sciencewhiz
9e6db17ef4 [build] Enable doxygen preprocessor expansion of WPI_DEPRECATED (#3642)
This fixes documentation for SpeedController and SpeedControllerGroup
2021-10-18 21:29:23 -07:00
sciencewhiz
0e631ad2f2 Add WPILib version to issue template (#3641) 2021-10-18 09:09:57 -07:00
Austin Shalit
6229d8d2ff [build] Docs: set case_sense_names to false (#3392)
This means the output will be consistent for all 3 major os and prevent case issues when sharing files.
2021-10-15 00:37:59 -07:00
Tyler Veness
4647d09b50 [docs] Fix Doxygen warnings, add CI docs lint job (#3639)
The CI docs lint build is configured to fail on Doxygen warnings.
2021-10-14 18:09:38 -07:00
sciencewhiz
4ad3a54026 [hal] Fix PWM allocation channel (#3637)
Previously it showed 31 when 0 was doubly allocated
2021-10-14 07:28:49 -07:00
sciencewhiz
05e5feac41 [docs] Fix brownout docs (NFC) (#3638) 2021-10-14 07:28:21 -07:00
Prateek Machiraju
67df469c58 [examples] Remove old command-based templates and examples (#3263)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2021-10-13 19:17:58 -07:00
Thad House
689e9ccfb5 [hal, wpilib] Add brownout voltage configuration (#3632) 2021-10-13 19:14:27 -07:00
sciencewhiz
9cd4bc407a [docs] Add useLocal to avoid using installer artifacts (#3634) 2021-10-13 10:38:33 -07:00
Peter Johnson
61996c2bbf [cscore] Fix Java direct callback notifications (#3631)
These relied on the OnStart and OnExit callbacks which were not present
in the wpiutil common CallbackManager code.  Add support for these and
fix up other use cases.

Also fixes notifications to correctly filter on event kind.

This fixes a breakage caused by #3133.
2021-10-13 08:46:07 -07:00
Thad House
6d3dd99eb2 [build] Update to newest native-utils (#3633) 2021-10-13 07:47:10 -07:00
Tyler Veness
f0b484892c [wpiutil] Fix StringMap iterator equality check (#3629)
This fixes the following warning.
The member function operator== only works in C++17, and the friend operator== only works in C++20.

```
 /Users/runner/.gradle/caches/transforms-2/files-2.1/c671f5a5dff922b8870f4eb33f4c8e2a/wpiutil-cpp-2022.1.1-alpha-3-1-g4e3fd7d-headers/wpi/json.h:1847:46: warning: ISO C++20 considers use of overloaded operator '==' (with operand types 'const typename json::object_t::iterator' (aka 'const StringMapIterator<wpi::json>') and 'const typename json::object_t::iterator') to be ambiguous despite there being a unique best viable function [-Wambiguous-reversed-operator]
                return (m_it.object_iterator == other.m_it.object_iterator);
                        ~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/runner/.gradle/caches/transforms-2/files-2.1/c671f5a5dff922b8870f4eb33f4c8e2a/wpiutil-cpp-2022.1.1-alpha-3-1-g4e3fd7d-headers/wpi/json.h:1863:20: note: in instantiation of member function 'wpi::detail::iter_impl<const wpi::json>::operator==' requested here
        return not operator==(other);
                   ^
/Users/runner/.gradle/caches/transforms-2/files-2.1/c671f5a5dff922b8870f4eb33f4c8e2a/wpiutil-cpp-2022.1.1-alpha-3-1-g4e3fd7d-headers/wpi/json.h:5008:20: note: in instantiation of member function 'wpi::detail::iter_impl<const wpi::json>::operator!=' requested here
            if (it != end())
                   ^
/Users/runner/.gradle/caches/transforms-2/files-2.1/c671f5a5dff922b8870f4eb33f4c8e2a/wpiutil-cpp-2022.1.1-alpha-3-1-g4e3fd7d-headers/wpi/json.h:5025:16: note: in instantiation of function template specialization 'wpi::json::value<std::basic_string<char>, 0>' requested here
        return value(key, std::string(default_value));
               ^
/Users/runner/.gradle/caches/transforms-2/files-2.1/c671f5a5dff922b8870f4eb33f4c8e2a/wpiutil-cpp-2022.1.1-alpha-3-1-g4e3fd7d-headers/wpi/StringMap.h:442:8: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
  bool operator==(const DerivedTy &RHS) const { return Ptr == RHS.Ptr; }
       ^
```
2021-10-12 23:28:26 -07:00
Lucas
8352cbb7a3 Update development build instructions for 2022 (#3616)
Updates the instructions for development and local WPILib builds as per the GradleRIO 2022 updates.
2021-10-12 22:47:16 -07:00
sciencewhiz
6da08b71dc [examples] Fix Intermediate Vision Java Example description (#3628)
Copy from C++
2021-10-11 22:55:33 -07:00
Peter Johnson
5d99059bf9 [wpiutil] Remove optional.h (#3627)
This has been replaced fully by std::optional and deprecated for a year.
2021-10-11 22:54:33 -07:00
Tyler Veness
fa41b106ab [glass, wpiutil] Add missing format args (#3626)
These were caught by compile-time format string parsing in C++20.
2021-10-11 22:54:20 -07:00
Thad House
4e3fd7d420 [build] Enable Zc:__cplusplus for Windows (#3625)
This makes the version actually be correct.
2021-10-11 20:30:22 -07:00
Starlight220
791d8354da [build] Suppress deprecation/removal warnings for old commands (#3618) 2021-10-10 20:07:12 -07:00
Thad House
10f19e6fc3 [hal, wpilib] Add REV PneumaticsHub (#3600) 2021-10-10 20:04:50 -07:00
Peter Johnson
4c61a13057 [ntcore] Revert to per-element copy for toNative() (#3621)
arraycopy() does not unbox values, so throws an exception.

This was broken in #3419 due to a false positive in PMD
(see https://sourceforge.net/p/pmd/bugs/804/).
2021-10-10 15:53:35 -07:00
Peter Johnson
7b3f62244f [wpiutil] SendableRegistry: Print exception stacktrace (#3620) 2021-10-10 15:53:11 -07:00
Thad House
d347928e4d [hal] Use better error for when console out is enabled while attempting to use onboard serial port (#3622) 2021-10-10 15:52:50 -07:00
Tyler Veness
cc31079a11 [hal] Use setcap instead of setuid for setting thread priorities (#3613)
We originally moved to setuid admin so user programs could do other
things requiring admin if they wanted. However, these things, like
setting RT priorities of other processes, can usually be done instead as
admin during the GradleRIO 2022 deploy process, or adding commands to
the robotCommand script. By going back to setcap, we can simplify the
HAL code.
2021-10-04 09:49:34 -07:00
Tyler Veness
4676648b78 [wpimath] Upgrade to Drake v0.34.0 (#3607) 2021-09-29 15:39:47 -07:00
Thad House
c7594c9111 [build] Allow building wpilibc in cmake without cscore and opencv (#3605)
The hard dependency on cscore was removed a while ago in gradle, so make it not a hard requirement in cmake.
2021-09-27 21:37:04 -07:00
Tyler Veness
173cb7359d [wpilib] Add TimesliceRobot (#3502) 2021-09-26 13:56:33 -07:00
Tyler Veness
af295879fb [hal] Set error status for I2C port out of range (#3603)
Closes #1369.
2021-09-26 10:38:17 -07:00
Tyler Veness
95dd20a151 [build] Enable spotbugs (#3601)
Benign spotbugs warnings were suppressed, and all others were fixed. Bug
descriptions are documented here:
https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html

Co-authored-by: Austin Shalit <austinshalit@gmail.com>
2021-09-24 16:04:02 -07:00
Tyler Veness
b65fce86bf [wpilib] Remove Timer lock in wpilibj and update docs (#3602)
Timer reports a negative duration if the sim timing is restarted. This
can be worked around by calling Reset(). Other options included:

1. Have RestartTiming() call Timer::Reset() on a list of instantiated
   Timers.
2. Have Timer::Get() reset the timer if it notices time went backwards.
   This requires dropping const qualification though, which is a
   breaking change that only fixes a minor edge case.

Closes #2732.
2021-09-24 16:01:13 -07:00
Tyler Veness
3b8d3bbcbf Remove unused and add missing deprecated.h includes (#3599)
I generated lists of includes and uses via
`rg -l deprecated.h | sort -u` and `rg -l WPI_DEPRECATED | sort -u`
respectively. If a file was in the first list but not the second, the
include was unused. If a file was in the second list but not the first,
the include needed to be added.
2021-09-22 18:29:57 -07:00
Tyler Veness
f9e976467f [examples] Rename DriveTrain classes to Drivetrain (#3594)
Drivetrain is one word, not two.
2021-09-22 13:27:26 -07:00
Tyler Veness
118a27be2f [wpilib] Add Timer tests (#3595) 2021-09-22 13:26:58 -07:00
Tyler Veness
59c89428e5 [wpilib] Deprecate Timer::HasPeriodPassed() (#3598)
AdvanceIfElapsed() is safer to use, as it has less surprising side effects.
2021-09-22 13:01:37 -07:00
Tyler Veness
202ca5e782 Force C++17 in .clang-format (#3597) 2021-09-22 10:04:03 -07:00
Tyler Veness
d6f185d8e5 Rename tests for consistency (#3592)
I started with the output of styleguide#217, then renamed a few classes
to fix compilation.

ntcore's StorageTest needed some manual renaming since it put the Test
word in the middle instead of at the end.

One limitation of wpiformat is test cases that were only named "Test"
were unmodified, and an error was generated. These test cases were
manually given more descriptive names:

* TimedRobotTest mode test cases had "Mode" appended to the name. Java
  tests were renamed to match.
* UvAsyncTest and UvAsyncFunctionTest cases were given alternate names
2021-09-21 06:12:50 -07:00
Tyler Veness
54ca474dba [ci] Enable asan and tsan in CI for tests that pass (#3591)
ctest's -E flag skips tests that match a regular expression.
2021-09-19 20:03:40 -07:00
Tyler Veness
1ca383b23b Add Debouncer (#3590)
Supersedes #2358 with updates and cleanups.

Closes #2482 and closes #2487 because we shouldn't support both
time-based and count-based debouncing approaches.

Co-authored-by: oblarg <emichaelbarnett@gmail.com>
2021-09-19 19:58:16 -07:00
Thad House
179fde3a7b [build] Update to 2022 native utils and gradle 7 (#3588) 2021-09-19 17:59:14 -07:00
sciencewhiz
50198ffcf1 [examples] Add Mechanism2d visualization to Elevator Sim (#3587) 2021-09-18 22:06:14 -07:00
sciencewhiz
a446c25598 [examples] Synchronize C++ and Java Mechanism2d examples (#3589)
- Synchronize dimensions
- Make both joints different colors for clarity
2021-09-18 22:05:35 -07:00
Tyler Veness
a7fb831035 [ci] clang-tidy: Generate compilation commands DB with Gradle (#3585) 2021-09-18 10:19:34 -07:00
sciencewhiz
4f5e0c9f85 [examples] Update ArmSimulation example to use Mechanism2d (#3572)
- Correct several comments that referenced elevator
- Changed noise to be 1 encoder tick instead of half a degree
- Changed gear ratio and PID value to be better tuned
- Updated bounds to be similar to a single jointed arm
2021-09-17 22:55:31 -07:00
Tyler Veness
8164b91dc4 [CI] Print CMake test output on failure (#3583) 2021-09-17 22:54:47 -07:00
sciencewhiz
4d5fca27ef [wpilib] Impove Mechanism2D documentation (NFC) (#3584) 2021-09-17 22:54:10 -07:00
Tyler Veness
fe59e4b9fe Make C++ test names more consistent (#3586)
Inconsistent names were found using the following regular expressions.

* `rg "TEST(_F|_P)?\(\w+,\s+\w+Test\)"`
* `rg "TEST(_F|_P)?\(\w+,\s+Test\w+\)"`
* `rg "TEST(_F|_P)?\(\w+Tests,\s+\w+\)"`

Fixes #3495.
2021-09-17 22:51:51 -07:00
sciencewhiz
5c88685495 [wpilibc] Fix C++ MechanisimRoot2D to use same NT entries as Java/Glass (#3582)
Fixes #3578
2021-09-17 12:13:36 -07:00
Tyler Veness
9359431bad [wpimath] Clean up Eigen usage
* Replace Matrix<> with Vector<> where vectors are explicitly intended.
  I found these via `rg "Eigen::Matrix<double, \w+, 1>"`.
* Pass all Eigen matrices by const reference. I found these via `rg
  "\(Eigen"` on main (the initializer list constructors make more false
  positives).
* Replace MakeMatrix() and operator<< usage with initializer list
  constructors. I found these via `rg MakeMatrix` and `rg "<<"`
  respectively.
* Deprecate MakeMatrix()
2021-09-17 12:12:19 -07:00
Tyler Veness
72716f51ce [wpimath] Upgrade to Eigen 3.4 2021-09-17 12:12:19 -07:00
Thad House
382deef750 [wpimath] Explicitly export wpimath symbols
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2021-09-17 12:12:19 -07:00
Peter Johnson
161e211734 [ntcore] Match standard handle layout, only allow 16 instances (#3577)
Now that there are only 16 instances, store them all statically.

Make tests more reliable by using different ports for each connection in listener tests.
2021-09-17 12:11:00 -07:00
Peter Johnson
263a248119 [wpimath] Use jinja for codegen (#3574)
While not really needed for wpimath, it will make more complex codegen
in the future significantly easier.
2021-09-17 00:10:29 -07:00
Tyler Veness
725251d294 [wpilib] Increase tolerances of DifferentialDriveSimTest (#3581) 2021-09-16 23:42:46 -07:00
Tyler Veness
4dff873013 [wpimath] Make LinearFilter::Factorial() constexpr (#3579)
Since BackwardFiniteDifference() gives it a compile-time constant, it
can be evaluated in a constexpr context.
2021-09-16 20:45:24 -07:00
Thad House
60ede67abd [hal, wpilib] Switch PCM to be a single object that is allowed to be duplicated (#3475)
Having PCM as a singleton is a problem, as multiple things need to use it, and that gets really ugly. This changes PCM's to be a reference counted object, that can be passed around and constructed from multiple places.

In Java, this is using a map to hold a data store with a ref count, and allocating new objects any time a duplicate is requested.

In C++, this uses a trick constructor to store a PCM instance in the data store itself. This instance can then be passed to base objects using std::shared_ptr's aliasing constructor, which means constructing a solenoid from a PCM is not allocating after the 1st one.

This did require removing sendable from PCM. A compressor class was added back in to act as sendable for the PCM.

After this change is finished, the only change RobotBuilder and Team Code would require is passing a module type to solenoid constructors.

Co-authored-by: sciencewhiz <sciencewhiz@users.noreply.github.com>
2021-09-16 18:50:27 -07:00
Tyler Veness
906bfc8464 [build] Add CMake build support for sanitizers (#3576)
* Address sanitizer uses -DCMAKE_BUILD_TYPE=Asan
* Thread sanitizer uses -DCMAKE_BUILD_TYPE=Tsan
* Undefined behavior sanitizer uses -DCMAKE_BUILD_TYPE=Ubsan

Only ubsan is enabled in CI for now because asan and tsan report
failures.
2021-09-16 18:48:41 -07:00
Ryan Hirasaki
0d4f08ad9c [hal] Simplify string copy of joystick name (#3575) 2021-09-16 09:32:57 -07:00
Peter Johnson
a52bf87b7d [wpiutil] Add Java function package (#3570)
The standard Java package is missing BooleanConsumer as well as Float classes.

Update SendableBuilder to use it instead of internal BooleanConsumer
interface.
2021-09-15 21:36:11 -07:00
Peter Johnson
40c7645d6e [wpiutil] UidVector: Return old object from erase() (#3571)
This makes it possible to erase and then do additional cleanup (e.g. on a unique_ptr).
2021-09-15 21:35:20 -07:00
Peter Johnson
5b886a23fd [wpiutil] jni_util: Add size, operator[] to JArrayRef (#3569)
These make it usable more like a standard container.
2021-09-15 21:34:16 -07:00
Tyler Veness
65797caa7b [sim] Fix halsim_ds_socket stringop overflow warning from GCC 10 (#3568)
Fixes #3567.
2021-09-14 20:49:02 -07:00
Thad House
66abb39880 [hal] Update runtime enum to allow selecting roborio 2 (#3565)
In some cases, knowing roborio 2 might be useful. This also creates a higher level enum that might be usable later for the discussion on more complex runtime types.
2021-09-13 22:05:38 -07:00
Thad House
95a12e0ee8 [hal] UidSetter: Don't revert euid if its already current value (#3566)
When running from admin account, this hangs for 5-10 seconds.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2021-09-13 21:08:39 -07:00
Tyler Veness
27951442b8 [wpimath] Use external Eigen headers only (#3564)
Internal headers are no longer allowed as of
https://gitlab.com/libeigen/eigen/-/merge_requests/631. Based on
benchmarking I conducted in that thread, there doesn't seem to be a
performance penalty for including the full headers anymore.
2021-09-13 14:31:01 -07:00
Austin Shalit
c42e053ae9 [docs] Update to doxygen 1.9.2 (#3562) 2021-09-12 15:19:04 -07:00
sciencewhiz
e7048c8c8b [docs] Disable doxygen linking for common words that are also classes (#3563)
Add % in front of name in order to suppress doxygen link creation. https://www.doxygen.nl/manual/autolink.html
2021-09-12 15:18:45 -07:00
Thad House
d8e0b6c977 [wpilibj] Fix java async interrupts (#3559) 2021-09-11 09:21:02 -07:00
Thad House
5e6c34c61c Update to 2022 roborio image (#3537) 2021-09-10 13:00:58 -07:00
Tyler Veness
828f073ebd [wpiutil] Fix uv::Buffer memory leaks caught by asan (#3555) 2021-09-09 23:14:10 -07:00
Tyler Veness
2dd5701ac0 [cscore] Fix mutex use-after-free in cscore test (#3557)
Fixes #3546.
2021-09-09 23:13:56 -07:00
Tyler Veness
531439198e [ntcore] Fix NetworkTables memory leaks caught by asan (#3556)
Closes #3543.
2021-09-09 23:13:36 -07:00
Tyler Veness
3d9a4d585e [wpilibc] Fix AnalogTriggerOutput memory leak reported by asan (#3554)
Fixes #3542.

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2021-09-09 19:32:00 -07:00
Tyler Veness
54eda59286 [wpiutil] Ignore ubsan vptr upcast warning in SendableHelper moves (#3553)
The move ctor is trying to cast from e.g. SendableHelper to PIDController before PIDController has been constructed, which is potentially UB. We don't actually use anything in PIDController though, so it's OK in our case.
2021-09-09 12:33:50 -07:00
sciencewhiz
5a4f75c9f8 [wpilib] Replace Speed controller comments with motor controller (NFC) (#3551)
Makes comments consistent with #3302
2021-09-08 22:09:08 -07:00
Tyler Veness
7810f665f1 [wpiutil] Fix bug in uleb128 (#3540)
Caused by UB in left shift; identified by ubsan.
2021-09-08 16:24:28 -07:00
sciencewhiz
697e2dd330 [wpilib] Fix errant jaguar reference in comments (NFC) (#3550) 2021-09-08 14:18:37 -07:00
sciencewhiz
936c64ff51 [docs] Enable -linksource for javadocs (#3549)
Embeds source in javadocs.
Fixes #3547
2021-09-07 22:46:09 -07:00
Tyler Veness
1ea6549548 [build] Upgrade CMake build to googletest 1.11.0 (#3548)
This upgrade uncovered two issues:

ntcore wasn't forcing C++17, which caused a linker error with googletest
Matcher symbols:
```
undefined reference to `testing::Matcher<std::basic_string_view<char, std::char_traits<char> > >::Matcher(std::basic_string_view<char, std::char_traits<char> >)'
```

test_span.cpp wasn't including <algorithm> to use std::sort() and
std::is_sorted().
2021-09-07 13:29:31 -07:00
Tyler Veness
32d9949e4d [wpimath] Move controller tests to wpimath (#3541) 2021-09-06 17:00:13 -07:00
Ryan Hirasaki
01ba56a8a6 [hal] Replace strncpy with memcpy (#3539) 2021-09-05 20:47:40 -07:00
Tyler Veness
e109c42515 [build] Rename makeSim flag to forceGazebo to better describe what it does (#3535) 2021-09-05 17:40:54 -07:00
Noam Zaks
e4c7091647 [docs] Use a doxygen theme and add logo (#3533) 2021-09-02 21:59:16 -07:00
Tyler Veness
960b6e5897 [wpimath] Fix Javadoc warning (#3532) 2021-08-28 22:43:38 -07:00
Jan-Felix Abellera
82eef8d5ee [hal] Remove over current fault HAL functions from REV PDH (#3526) 2021-08-28 20:52:46 -07:00
Tyler Veness
aa3848b2c8 [wpimath] Move RobotDriveBase::ApplyDeadband() to MathUtil (#3529)
It's a useful function outside of the drive classes.

For backwards compatibility, deprecate (rather than remove) RobotDriveBase.applyDeadband()
2021-08-28 20:52:05 -07:00
Tyler Veness
3b5d0d141a [wpimath] Add LinearFilter::BackwardFiniteDifference() (#3528)
This is an alternative to #2344 that handles arbitrary order derivatives
of arbitrary precision. The downside is that since it's part of
LinearFilter, it can't utilize the units type system in the same way to
make Calculate()'s input type different from its output type.
2021-08-28 20:50:18 -07:00
Tyler Veness
c8fc715fe2 [wpimath] Upgrade drake files to v0.33.0 (#3531) 2021-08-28 20:49:19 -07:00
Tyler Veness
e5fe3a8e16 [build] Treat javadoc warnings as errors in CI and fix warnings (#3530) 2021-08-28 20:48:47 -07:00
Tyler Veness
e0c6cd3dcc [wpimath] Add an operator for composing two Transform2ds (#3527) 2021-08-23 20:22:48 -07:00
PJ Reiniger
2edd510ab7 [sim] Add sim wrappers for sensors that use SimDevice (#3517) 2021-08-20 23:19:59 -07:00
Tyler Veness
2b3e2ebc11 [hal] Fix HAL Notifier thread priority setting (#3522)
The HAL Notifier thread is started when the first Notifier is created
and stopped when the last Notifier is destroyed. Currently,
HAL_SetNotifierThreadPriority() will cause a segfault if the Notifier thread
hasn't been started yet (that is, if no Notifier have been created yet).

This change makes HAL_SetNotifierThreadPriority() store the RT and
priority setting. If the thread has already been started, it will set
the priority immediately. If it hasn't, HAL_InitializeNotifier() will
set the priority when it starts the thread.
2021-08-20 23:19:25 -07:00
PJ Reiniger
ab4cb59326 [gitignore] Update gitignore to ignore bazel / clion files (#3524) 2021-08-20 23:18:37 -07:00
PJ Reiniger
57c8615af3 [build] Generate spotless patch on failure (#3523) 2021-08-20 23:18:10 -07:00
Tyler Veness
b903173211 Replace std::cout and std::cerr with fmt::print() (#3519) 2021-08-19 20:31:14 -07:00
Thad House
10cc8b89c4 [hal] [wpilib] Add initial support for the REV PDH (#3503) 2021-08-14 11:44:56 -07:00
Tyler Veness
5d9ae3cdb4 [hal] Set HAL Notifier thread as RT by default (#3482)
This PR gives the Notifier HAL thread RT priority 40 in RobotBase after
HAL initialization and before the user code is run. This drastically
improves scheduling jitter for TimedRobot's AddPeriodic() functions (in
3512's experience).

It's too risky to set user code as RT because badly behaved code
will lock up the Rio (potentially requiring safe mode to recover).

This needs the user program to be setuid admin to succeed.
2021-08-14 11:42:35 -07:00
Tyler Veness
192d251ee8 [wpilibcIntegrationTests] Properly disable DMA integration tests (#3514)
"DISABLED_" must be a prefix, not a suffix.
2021-08-14 10:01:12 -07:00
Starlight220
031962608b [wpilib] Add PS4Controller, remove Hand from GenericHID/XboxController (#3345)
- GenericHID is now concrete, and has only getRawAxis/Button(int) functionality
- getXxx() has been moved into Joystick as that's the only place where it makes sense
- Hand (and therefore getXxx(Hand)) has been removed, replaced by specific getLeft/RightXxx() methods in XboxController and the new PS4Controller class
- C++ ::Button:: and ::Axis:: enums have been converted to identically-namespaced static constexpr ints
2021-08-14 10:00:46 -07:00
Tyler Veness
25f6f478a5 [wpilib] Rename DriverStation::IsOperatorControl() to IsTeleop() (#3505) 2021-08-11 23:04:43 -07:00
PJ Reiniger
e80f09f849 [wpilibj] Add unit tests (#3501) 2021-08-11 23:04:14 -07:00
Tyler Veness
c159f91f06 [wpilib] Only read DS control word once in IterativeRobotBase (#3504) 2021-08-11 18:05:07 -07:00
Thad House
eb790a74d2 Add rio development docs documenting myRobot deploy tasks (#3508)
Co-authored-by: sciencewhiz <sciencewhiz@users.noreply.github.com>
2021-08-11 18:04:20 -07:00
Matteo Kimura
e47451f5a0 [wpimath] Replace auto with Eigen types (#3511)
This fixes a bug regarding temporary Eigen values caused by the usage of auto.
2021-08-11 06:58:19 -07:00
Tyler Veness
252b8c83bf Remove Java formatting from build task in CI (#3507)
This saves time in CI spent performing the same source-level checks in
every build job. Checkstyle, PMD, and Spotless are now run once in the
"Lint and Format" job.

The -PskipPMD flag was replaced with a -PskipJavaFormat flag that
disables Checkstyle, PMD, and Spotless.
2021-08-07 20:39:14 -07:00
Tyler Veness
09666ff294 Shorten Gazebo CI build (#3506)
Only build the Gazebo simulation projects instead of all of WPILib.
2021-08-07 20:37:57 -07:00
sciencewhiz
baf2e501dc Update myRobot to use 2021 java (#3509) 2021-08-07 20:36:11 -07:00
Tyler Veness
5ac60f0a20 [wpilib] Remove IterativeRobotBase mode init prints (#3500)
They don't provide much utility for the end user. A print at the call to
HAL_ObserveUserProgramStarting() was added in their place so it's still
clear when constructors have finished running.
2021-08-05 23:54:50 -07:00
Tyler Veness
fb2ee8ec34 [wpilib] Add TimedRobot functions for running code on mode exit (#3499)
Currently, we have functions like TeleopInit() for running code on mode
entry, but no such functions for running code on mode exit, and it's
cumbersome to add those in user code without making a custom robot
class. This PR adds exit functions to TimedRobot.

Some example use cases include DisabledExit() for operations when the
robot enables (whether that be into teleop, autonomous, or test) and
AutonomousExit() for disabling feedback controllers.
2021-08-05 19:08:29 -07:00
PJ Reiniger
94e0db7963 [wpilibc] Add more unit tests (#3494) 2021-08-05 19:04:51 -07:00
sciencewhiz
b253246959 [wpilibj] Add units to parameter names (NFC) (#3497) 2021-08-05 18:04:20 -07:00
Thad House
1ac73a247e [hal] Rename PowerDistributionPanel to PowerDistribution (#3466)
Makes HAL more generic for the PDP, to enable the Rev PDH in the future.
2021-08-04 20:31:17 -07:00
sciencewhiz
2014115bca [examples] frisbeebot: Fix typo and reflow comments (NFC) (#3498) 2021-08-01 07:17:51 -07:00
liorsagy
4a944dc397 [examples] Consistently use 0 for controller port (#3496) 2021-07-31 20:39:50 -07:00
Tyler Veness
3838cc4ec4 Use unicode characters in docs equations (#3487)
javac and javadoc needed the encoding set to UTF-8.
2021-07-29 22:42:43 -07:00
Aditya Tomar
85748f2e6f [examples] Add C++ TankDrive example (#3493)
This is a basic C++ example that demonstrates a simple differential drive implementation using “tank”-style controls through the DifferentialDrive class and an ordinary joystick.
2021-07-28 21:52:14 -07:00
Tyler Veness
d7b8aa56dc [wpilibj] Rename DriverStation In[Mode] functions to follow style guide (#3488) 2021-07-26 07:29:54 -07:00
Tyler Veness
16e096cf86 [build] Fix CMake Windows CI (#3490) 2021-07-26 07:28:52 -07:00
Tyler Veness
50af74c38f [wpimath] Clean up NumericalIntegration and add Discretization tests (#3489)
* Rename Butcher tableau sections in NumericalIntegration such that
  top-left is c, top-right is A, and bottom-right is b
* Move edu.wpi.first.math.Discretization to
  edu.wpi.first.math.system.Discretization
* Sort Java Discretization to match C++ function order
* Add tests for Java Discretization
  * Required adding Runge-Kutta time-varying impl to tests
* Move C++ Runge-Kutta time-varying impl to tests only
  * Users don't need it
2021-07-25 07:42:59 -07:00
Tyler Veness
bfc209b120 Automate fmt update (#3486)
Also refactored upstream_utils to make writing and maintaining new
upstream repo extractions easier.
2021-07-23 09:01:44 -07:00
Austin Shalit
e7f9331e4b [build] Update to Doxygen 1.9.1 (#3008) 2021-07-22 18:33:15 -07:00
Tyler Veness
ab8e8aa2a1 [wpimath] Update drake with upstream (#3484)
Our patches for the DARE and [[noreturn]] attributes were merged
upstream. We missed their monthly release window by a day, so we'll use
a commit hash for now.
2021-07-22 17:48:48 -07:00
Lucas
1ef826d1da [wpimath] Fix IOException path in WPIMath JNI (#3485)
The current 2021.3.1 release refers to `java/lang/IOException` which causes the following exception when using `toPathweaverJson` or `fromPathweaverJson`:

```
java.lang.NoClassDefFoundError: java/lang/IOException
    at edu.wpi.first.math.WPIMathJNI.fromPathweaverJson(Native Method)
    at edu.wpi.first.wpilibj.trajectory.TrajectoryUtil.fromPathweaverJson(TrajectoryUtil.java:79)
```
2021-07-22 17:48:33 -07:00
Tyler Veness
52bddaa97b [wpimath] Disable iostream support for units and enable fmtlib (#3481)
Supersedes #2497.
2021-07-13 13:41:07 -05:00
Tyler Veness
e4dc3908bb [wpiutil] Upgrade to fmtlib 8.0.1 (#3483) 2021-07-13 13:39:14 -05:00
Tyler Veness
1daadb812f [wpimath] Implement Dormand-Prince integration method (#3476)
Also refactored RKF45 implementation to match the new style, which is
easier to read.

The tests were switched from RKF45 to RKDP since it's more accurate.
2021-07-11 09:42:33 -05:00
Tyler Veness
9c2723391b [cscore] Add [[nodiscard]] to GrabFrame functions (#3479)
Closes #3086.
2021-07-11 09:41:12 -05:00
Tyler Veness
7a8796414c [wpilib] Add Notifier integration tests (#3480)
Closes #2610.
2021-07-11 09:39:42 -05:00
Tyler Veness
f8f13c536f [wpilibcExamples] Prefix decimal numbers with 0 (#3478) 2021-07-11 09:38:13 -05:00
Tyler Veness
1adb69c0fd [ntcore] Use "NetworkTables" instead of "Network Tables" in NT specs (#3477)
Closes #3280.
2021-07-11 09:37:27 -05:00
Tyler Veness
5f5830b960 Upload wpiformat diff if one exists (#3474)
This means users will be able to apply it locally with "git apply".
2021-07-09 21:42:20 -05:00
Tyler Veness
9fb4f35bb6 [wpimath] Add tests for DARE overload with Q, R, and N matrices (#3472)
The autodiff headers weren't used by the tests, so they were removed.
2021-07-09 21:41:33 -05:00
Tyler Veness
c002e6f926 Run wpiformat (#3473)
A recent PR had an earlier version of wpiformat ran on it with more
lenient rules.
2021-07-09 20:49:13 -05:00
Thad House
c154e5262e [wpilib] Make solenoids exclusive use, PCM act like old sendable compressor (#3464) 2021-07-09 15:11:12 -07:00
Thad House
6ddef1cca6 [hal] JNI setDIO: use a boolean and not a short (#3469) 2021-07-08 23:42:31 -05:00
Tyler Veness
9d68d95825 Remove extra newlines after open curly braces (NFC) (#3471) 2021-07-08 23:41:30 -05:00
Tyler Veness
a4233e1a16 [wpimath] Add script for updating Drake (#3470)
Common functionality between the Drake and Eigen update scripts was
refactored into a library.
2021-07-08 22:36:01 -05:00
Prateek Machiraju
39373c6d2d Update README.md for new GCC version requirement (#3467) 2021-07-02 19:06:30 -07:00
Prateek Machiraju
d29acc90a2 [wpigui] Add option to reset UI on exit (#3463)
Also add wpiutil as a dependency for wpigui.
2021-06-26 22:48:54 -07:00
Peter Johnson
a371235b0d [ntcore] Fix dangling pointer in logger (#3465)
This is a breaking change (it changes LogMessage::filename from const
char* to std::string) but there should be few users of it.
2021-06-26 22:47:52 -07:00
Tyler Veness
53b4891a5e [wpilibcintegrationtests] Fix deprecated Preferences usage (#3461) 2021-06-23 21:58:27 -07:00
Prateek Machiraju
646ded9123 [wpimath] Remove incorrect discretization in pose estimators (#3460) 2021-06-23 21:57:52 -07:00
Peter Johnson
ea0b8f48e6 Fix some deprecation warnings due to fmtlib upgrade (#3459) 2021-06-23 21:57:32 -07:00
Prateek Machiraju
2067d7e300 [wpilibjexamples] Add wpimathjni, wpiutiljni to library path (#3455) 2021-06-22 06:33:24 -07:00
Tyler Veness
866571ab41 [wpiutil] Upgrade to fmtlib 8.0.0 (#3457) 2021-06-21 20:57:42 -07:00
Thad House
4e1fa03087 [build] Skip PDB copy on windows build servers (#3458) 2021-06-21 20:56:42 -07:00
Peter Johnson
b45572167d [build] Change CI back to 18.04 docker images (#3456)
This reverts commit d068fb321f (#3420).

The 18.04 docker images now use GCC 8, which was the original reason for
updating.  20.04 uses a much more recent libc, so staying with 18.04
enables more Linux platforms to use the binaries.
2021-06-20 23:03:29 -07:00
Tyler Veness
57a160f1b3 [wpilibc] Fix LiveWindow deprecation warning in RobotBase skeleton template (#3454) 2021-06-19 20:45:56 -07:00
Thad House
29ae8640d9 [HLT] Implement duty cycle cross connect tests (#3453) 2021-06-19 20:11:52 -07:00
Thad House
ee6377e54b [HLT] Add relay and analog cross connects (#3452) 2021-06-19 13:03:58 -07:00
Peter Johnson
b0f1ae7ea3 [build] CMake: Build the HAL even if WITH_CSCORE=OFF (#3449)
Also handle the case of WITH_WPILIB=OFF WITH_SIMULATION_MODULES=ON.
2021-06-19 09:30:49 -07:00
Tyler Veness
7aae2b72dc Replace std::to_string() with fmt::format() (#3451) 2021-06-19 09:30:01 -07:00
Thad House
73fcbbd748 [HLT] Add relay digital cross connect tests (#3450) 2021-06-19 01:21:56 -07:00
Thad House
e7bedde835 [HLT] Add PWM tests that use DMA as the back end (#3447)
Both a decent DMA test, and slightly more reliable PWM test.
2021-06-19 01:21:07 -07:00
Peter Johnson
7253edb1e1 [wpilibc] Timer: Fix deprecated warning (#3446) 2021-06-18 21:00:26 -07:00
Tyler Veness
efa28125c6 [wpilibc] Add message to RobotBase on how to read stacktrace (#3444)
Also make stacktrace info an error instead of a warning in both C++ and Java.
2021-06-17 23:52:48 -07:00
Thad House
9832fcfe14 [hal] Fix DIO direction getter (#3445)
Unset means input, where the code was assuming set means input.
2021-06-17 23:03:00 -07:00
Ryan Hirasaki
49c71f9f2d [wpilibj] Clarify robot quit message (#3364)
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2021-06-16 13:24:06 -07:00
Noam Zaks
791770cf6e [wpimath] Move controller from wpilibj to wpimath (#3439) 2021-06-16 07:45:51 -07:00
Noam Zaks
9ce9188ff6 [wpimath] Add ReportWarning to MathShared (#3441) 2021-06-16 00:52:24 -07:00
Peter Johnson
362066a9b7 [wpilib] Deprecate getInstance() in favor of static functions (#3440)
Co-authored-by: Noam Zaks <imnoamzaks@gmail.com>
2021-06-15 23:06:03 -07:00
Thad House
26ff9371d9 Initial commit of cross connect integration test project (#3434)
Adding as a separate project so current integration tests stay working.
2021-06-14 20:08:11 -07:00
Thad House
4a36f86c81 [hal] Add support for DMA to Java (#3158) 2021-06-14 19:56:42 -07:00
Peter Johnson
85144e47ff [commands] Unbreak build (#3438) 2021-06-14 07:35:21 -07:00
Peter Johnson
b417d961ec Split Sendable into NT and non-NT portions (#3432)
The non-NT portion has been moved to wpiutil.
The NT portion has been moved to ntcore (as NTSendable).

SendableBuilder similarly split and moved.

SendableRegistry moved to wpiutil.

In C++, SendableHelper also moved to wpiutil.

This enables use of Sendable from wpimath and also enables
moving several classes from wpilib to wpimath.
2021-06-13 16:38:05 -07:00
Starlight220
ef4ea84cb5 [commands] Change grouping decorator impl to flatten nested group structures (#3335) 2021-06-13 16:05:14 -07:00
Prateek Machiraju
b422665a3c [examples] Invert right side of drive subsystems (#3437)
The right motors of a DifferentialDrive are no longer automatically
inverted (#3340) so it needs to be done explicitly.
2021-06-13 15:43:16 -07:00
Thad House
186dadf14d [hal] Error if attempting to set DIO output on an input port (#3436) 2021-06-13 15:00:43 -07:00
Tyler Veness
04e64db945 Remove redundant C++ lambda parentheses (NFC) (#3433) 2021-06-12 08:06:45 -07:00
Peter Johnson
f60994ad24 [wpiutil] Rename Java package to edu.wpi.first.util (#3431)
This is more consistent with wpimath being edu.wpi.first.math.
2021-06-12 01:17:09 -07:00
Peter Johnson
cfa1ca96f2 [wpilibc] Make ShuffleboardValue non-copyable (#3430)
This avoids the possibility of it being accidentally sliced by users.
2021-06-11 20:16:35 -07:00
Tyler Veness
4d9ff76433 Fix documentation warnings generated by JavaDoc (NFC) (#3428)
Some C++ Doxygen comments were updated to reflect any wording changes.

See `rg "(@return|@param \w+) TODO" | less` for list of incomplete docs.
2021-06-10 20:46:47 -07:00
Peter Johnson
9e1b7e0464 [build] Fix clang-tidy and clang-format (#3429)
Use the official ubuntu packages on 20.04; don't use ubuntu-latest.
2021-06-10 20:46:21 -07:00
Tyler Veness
a77c6ff3a2 [build] Upgrade clang-format and clang-tidy (NFC) (#3422) 2021-06-10 11:13:09 -07:00
Tyler Veness
099fde97d5 [wpilib] Improve PDP comments (NFC) (#3427)
Also remove HAL doxygen comments from sources;
these functions already had more descriptive comments in their
corresponding headers.
2021-06-10 00:02:51 -07:00
Tyler Veness
f8fc2463ee [wpilibc, wpiutil] Clean up includes (NFC) (#3426) 2021-06-10 00:00:06 -07:00
Tyler Veness
e246b78846 [wpimath] Clean up member initialization in feedforward classes (#3425) 2021-06-09 23:59:31 -07:00
Tyler Veness
c1e128bd5a Disable frivolous PMD warnings and enable PMD in ntcore (#3419)
Some valid warnings like throwing NullPointerException or using a for
loop instead of System.arraycopy() were fixed.

Abstract classes marked with PMD.AbstractClassWithoutAbstractMethod were
made concrete because they already had protected constructors.

Fixes #1697.
2021-06-09 07:01:00 -07:00
Tyler Veness
8284075ee4 Run "Lint and Format" CI job on push as well as pull request (#3412)
This makes the formatter run when pushing to local forks before a pull
request is made.

This is not run on the main branch.
2021-06-08 23:22:40 -07:00
Tyler Veness
f7db09a128 [wpimath] Move C++ filters into filter folder to match Java (#3417) 2021-06-08 21:21:01 -07:00
Tyler Veness
f9c3d54bd1 [wpimath] Reset error covariance in pose estimator ResetPosition() (#3418)
This also fixes a member function name inconsistency between languages
and adds missing documentation to C++'s KalmanFilterLatencyCompensator.

Fixes #3229.
2021-06-08 21:20:43 -07:00
Tyler Veness
0773f4033e [hal] Ensure HAL status variables are initialized to zero (#3421)
HAL functions don't set the status variable on success, so it's possible
to use the status variable in an uninitialized state.
2021-06-08 21:18:59 -07:00
Peter Johnson
d068fb321f [build] Upgrade CI to use 20.04 docker images (#3420) 2021-06-08 12:27:22 -07:00
Peter Johnson
8d054c940c [wpiutil] Remove STLExtras.h
This is a very inefficient header, and it's good to remove to discourage
its use.  Only a handful of use cases remained, and of only array_lengthof.
2021-06-06 21:35:50 -07:00
Peter Johnson
80f1d79218 [wpiutil] Split function_ref to a separate header 2021-06-06 21:35:50 -07:00
Peter Johnson
64f5413253 Use wpi::span instead of wpi::ArrayRef across all libraries (#3414)
- Remove ArrayRef.h
- Add SpanExtras.h for a couple of convenience functions
2021-06-06 19:51:14 -07:00
Peter Johnson
2abbbd9e70 [build] clang-tidy: Remove bugprone-exception-escape (#3415)
This generates warnings for using fmt::print() in main(), which is a
case we're okay with.
2021-06-06 17:47:14 -07:00
Tyler Veness
a5c471af7e [wpimath] Add LQR template specialization for 2x2 system
A differential drive has this dimensionality (2 velocity states and 2
voltage inputs).
2021-06-06 16:45:12 -07:00
Tyler Veness
edd2f0232c [wpimath] Add DARE solver for Q, R, and N with LQR ctor overloads
This is useful for implementing implicit model following.
2021-06-06 16:45:12 -07:00
Peter Johnson
b2c3b2dd8e Use std::string_view and fmtlib across all libraries (#3402)
- Twine, StringRef, Format, and NativeFormatting have been removed
- Logging now uses fmtlib style formatting
- Nearly all uses of wpi::outs/errs have been replaced with fmt::print() or
std::puts()/std::fputs() (for unformatted strings).
- A wpi/fmt/raw_ostream.h header has been added to enable
fmt::print() with wpi::raw_ostream
2021-06-06 16:13:58 -07:00
Peter Johnson
4f1cecb8e7 [wpiutil] Remove Path.h (#3413)
This was missed in the std::filesystem change.
2021-06-06 15:50:28 -07:00
Prateek Machiraju
b336eac343 [build] Publish halsim_ws_core to Maven 2021-06-06 15:04:25 -07:00
Prateek Machiraju
2a09f6fa45 [build] Also build sim modules as static libraries
This allows sim modules to be statically linked into an executable to
create a "perfectly static" simulated desktop program. The entry point
was changed to be unique when building static libraries to avoid symbol
collisions.
2021-06-06 15:04:25 -07:00
Thad House
0e702eb799 [hal] Add a unified PCM object (#3331) 2021-06-05 22:36:39 -07:00
Tyler Veness
dea841103d [wpimath] Add fmtlib formatter overloads for Eigen::Matrix and units (#3409)
This allows using Eigen matrices or units natively with fmt::format() or
fmt::print().
2021-06-05 21:10:41 -07:00
Tyler Veness
82856cf816 [wpiutil] Improve wpi::circular_buffer iterators (#3410)
The implementation of wpi::circular_buffer has been effectively replaced
with a dynamically sized copy of wpi::static_circular_buffer with a
resize() member function.
2021-06-05 21:08:12 -07:00
Tyler Veness
8aecda03ed [wpilib] Fix a documentation typo (#3408)
"indicated" was misspelled.
2021-06-05 13:35:03 -07:00
Thad House
5c817082a0 [wpilib] Remove InterruptableSensorBase and replace with interrupt classes (#2410) 2021-06-05 11:25:21 -07:00
Tyler Veness
15c521a7fe [wpimath] Fix drivetrain system identification (#3406)
The units for angular Kv and Ka were inconsistent with the derivation. A
second factory function overload was added for angular units that uses a
trackwidth to convert to the other form.

Notice how section 15.2 of https://file.tavsys.net/control/controls-engineering-in-frc.pdf
defines the angular feedforward as u = Kv,angular v instead of u = Kv,angular + omega.
The units cancel for elements of A but not B, so just the B matrix was incorrect in our code.

This breaks existing C++ code since the units are part of the function
signature.
2021-06-05 11:22:05 -07:00
Thad House
989de4a1bf [build] Force all linker warnings to be fatal for rio builds (#3407)
This will make sure we catch any bugs for missing runtime dependencies before they become bigger problems.
2021-06-05 11:20:09 -07:00
Tyler Veness
d9eeb45b03 [wpilibc] Add units to Ultrasonic class API (#3403) 2021-06-01 21:54:56 -07:00
Peter Johnson
fe570e000c [wpiutil] Replace llvm filesystem with C++17 filesystem (#3401)
Use ghc::filesystem as fill on older GCC (e.g. RoboRIO).
This can be removed once all GCC platforms have upgraded to 8.1 or later.

File open functionality has been retained from LLVM but moved to "fs" namespace
and tweaked for improved consistency with std::filesystem (e.g. error_code is
passed by reference instead of returned).

Also update WPILibC's Filesystem functions to return std::string.
2021-06-01 21:50:35 -07:00
Tyler Veness
01dc0249de [wpimath] Move SlewRateLimiter from wpilib to wpimath (#3399)
Timer was replaced with wpi::Now() to avoid a dependency on other wpilib
classes.
2021-05-31 10:35:54 -07:00
Tyler Veness
93523d572e [wpilibc] Clean up integration tests (#3400)
The command and shuffleboard integration tests were removed because
their unit tests counterparts already provide adequate coverage. Java
already removed these.
2021-05-31 10:21:34 -07:00
Peter Johnson
4f7a4464df [wpiutil] Rewrite StringExtras for std::string_view (#3394)
Remove unused functions and add StringRef-like convenience functions.
Minimize header dependencies.
2021-05-28 23:42:58 -07:00
Tyler Veness
e09293a15e [wpilibc] Transition C++ classes to units::second_t (#3396)
A lot of these are breaking changes. frc::Timer was replaced with the
contents of frc2::Timer. The others were in-place argument changes or
removing deprecated non-unit overloads.
2021-05-28 22:06:59 -07:00
Prateek Machiraju
827b17a52b [build] Create run tasks for Glass and OutlineViewer (#3397) 2021-05-28 22:04:58 -07:00
Peter Johnson
a610379965 [wpiutil] Avoid MSVC warning on span include (#3393) 2021-05-26 23:14:04 -07:00
Peter Johnson
4e2c3051be [wpilibc] Use std::string_view instead of Twine (#3380)
Use fmtlib where needed for string formatting into std::string_view.
2021-05-26 17:44:18 -07:00
Peter Johnson
50915cb7ed [wpilibc] MotorSafety::GetDescription(): Return std::string (#3390)
This is only called in an error condition, so it's not necessary to over
optimize it.
2021-05-26 07:25:32 -07:00
Tyler Veness
f4e2d26d58 [wpilibc] Move NullDeleter from frc/Base.h to wpi/NullDeleter.h (#3387)
frc/Base.h was also deleted because it's now empty.
2021-05-26 07:24:53 -07:00
Peter Johnson
cb0051ae60 [wpilibc] SimDeviceSim: use fmtlib (#3389)
Also clean up several sim classes to use the channel constructor.
2021-05-26 07:23:13 -07:00
Tyler Veness
a238cec12b [wpiutil] Deprecate wpi::math constants in favor of wpi::numbers (#3383)
The constants were moved from std::math to std::numbers before
ratification in C++20.
2021-05-26 00:09:36 -07:00
Tyler Veness
393bf23c0c [ntcore, cscore, wpiutil] Standardize template impl files on .inc extension (NFC) (#3124) 2021-05-25 22:19:30 -07:00
Tyler Veness
e7d9ba135c [sim] Disable flaky web server integration tests (#3388)
The digital output test sometimes fails on Linux and the digital input
test sometimes fails on macOS.
2021-05-25 20:56:35 -07:00
Tyler Veness
0a0003c110 [wpilibjExamples] Fix name of Java swerve drive pose estimator example (#3382) 2021-05-25 20:55:24 -07:00
Tyler Veness
7e1b27554c [wpilibc] Use default copies and moves when possible (#3381)
The removal of ErrorBase allowed the defaults to be used in more places.
2021-05-25 20:54:39 -07:00
Tyler Veness
fb2a56e2d6 [wpilibc] Remove START_ROBOT_CLASS macro (#3384) 2021-05-25 20:53:26 -07:00
Tyler Veness
84218bfb45 [wpilibc] Remove frc namespace shim (#3385) 2021-05-25 20:52:50 -07:00
Tyler Veness
dd78243406 [wpilibc] Remove C++ compiler version static asserts (#3386)
frc/Base.h isn't the first header included basically anywhere, so the
compiler will fail on C++17 things before the asserts in this header are
processed.
2021-05-25 20:52:23 -07:00
Tyler Veness
484cf9c0e8 [wpimath] Suppress the -Wmaybe-uninitialized warning in Eigen (#3378)
GCC 11 emits a false positive when compiling Eigen and breaks the
build.

Fixes #3363.
2021-05-25 10:05:41 -07:00
Peter Johnson
a04d1b4f97 [wpilibc] DriverStation: Remove ReportError and ReportWarning
Change use cases to directly call FRC_ReportError.
2021-05-25 10:04:32 -07:00
Peter Johnson
831c10bdfc [wpilibc] Errors: Use fmtlib 2021-05-25 10:04:32 -07:00
Peter Johnson
87603e400d [wpiutil] Import fmtlib (#3375)
HEAD as of 5/23/2021 (dd8f38fcbbb6eedecd4d451b03ca7d817e8ae67d).
2021-05-24 23:59:35 -07:00
Peter Johnson
4426216725 [wpiutil] Add ArrayRef/std::span/wpi::span implicit conversions 2021-05-23 15:27:40 -07:00
Peter Johnson
bc15b953b4 [wpiutil] Add std::span implementation
Imported from https://github.com/tcbrindle/span with ifdef's removed
(as we require C++17).
2021-05-23 15:27:40 -07:00
Peter Johnson
6d20b12043 [wpiutil] StringRef, Twine, raw_ostream: Add std::string_view support (#3373) 2021-05-23 15:26:28 -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
Tyler Veness
87384ea684 [wpilib] Fix PIDController continuous range error calculations (#3170)
The inputs should all be errors, so the range should be symmetric.

Fixes #3168.
Fixes #3304.
2021-05-21 23:52:30 -07:00
Tyler Veness
04dae799a2 [wpimath] Add SimpleMotorFeedforward::Calculate(velocity, nextVelocity) overload (#3183)
This is often more convenient than using the overload with velocity and
acceleration.

Fixes #3160.
2021-05-21 23:44:10 -07:00
Tyler Veness
0768c39036 [wpilib] DifferentialDrive: Remove right side inversion (#3340)
Also refactor drive inverse kinematics into separate functions.
This allows composing them with operations separate from the drive
class.
2021-05-21 22:34:16 -07:00
Tyler Veness
8dd8d4d2d4 [wpimath] Fix redundant nested math package introduced by #3316 (#3368) 2021-05-21 22:29:52 -07:00
Dalton Smith
49b06beedf [examples] Add Field2d to RamseteController example (#3371) 2021-05-21 22:28:29 -07:00
Tyler Veness
4c562a4457 [wpimath] Fix typo in comment of update_eigen.py (#3369)
NonMPL2.h clearly doesn't contain MPL2 code.
2021-05-21 21:39:33 -07:00
Tyler Veness
fdbbf11887 [wpimath] Add script for updating Eigen 2021-05-20 18:52:11 -07:00
Tyler Veness
f1e64b349a [wpimath] Move Eigen unsupported folder into eigeninclude
This fixes relative includes in development versions of Eigen.
2021-05-20 18:52:11 -07:00
Ryan Hirasaki
224f3a05cf [sim] Fix build error when building with GCC 11.1 (#3361) 2021-05-19 14:39:18 -07:00
Peter Johnson
ff56d6861d [wpilibj] Fix SpeedController deprecated warnings (#3360)
set() and other functions also need to be repeated on the MotorController
interface to avoid deprecation warnings from vscode.
2021-05-16 19:13:54 -07:00
sciencewhiz
1873fbefba [examples] Fix Swerve and Mecanum examples (#3359)
Fix encoder allocation and default command.
Fixes #3349
2021-05-15 21:39:00 -07:00
sciencewhiz
80b479e502 [examples] Fix SwerveBot example to use unique encoder ports (#3358)
Fixes #3089
2021-05-15 14:15:18 -07:00
PJ Reiniger
1f7c9adeeb [wpilibjExamples] Fix pose estimator examples (#3356) 2021-05-14 11:10:47 -07:00
Peter Johnson
9ebc3b058d [outlineviewer] Change default size to 600x400 (#3353) 2021-05-11 23:34:16 -07:00
Prateek Machiraju
e21b443a45 [build] Gradle: Make C++ examples runnable (#3348) 2021-05-11 19:54:53 -07:00
Peter Johnson
da590120c4 [wpilibj] Add MotorController.setVoltage default (#3347)
This avoids a vscode deprecation warning.
2021-05-11 19:53:55 -07:00
Peter Johnson
561d53885e [build] Update opencv to 4.5.2, imgui/implot to latest (#3344)
Also update native-utils to 2022.0.0 to start pulling 2022 artifacts.
2021-05-10 18:59:14 -07:00
Peter Johnson
44ad67ca8c [wpilibj] Preferences: Add missing Deprecated annotation (#3343) 2021-05-09 18:20:42 -07:00
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
3cc2da3328 Merge branch '2022' 2021-05-09 14:15:40 -07:00
Tyler Veness
a3cd90dd71 [wpimath] Fix classpath used by generate_numbers.py (#3339) 2021-05-09 00:01:03 -07:00
Noam Zaks
d6cfdd3bae [wpilib] Preferences: Deprecate Put* in favor of Set* (#3337)
This naming is more consistent with other APIs.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2021-05-06 08:25:37 -07:00
Tyler Veness
ba08baabb9 [wpimath] Update Drake DARE solver to v0.29.0 (#3336)
This version incorporated the patch we were manually applying, so we're
synced back up with upstream now except for some minor #include changes
to reduce header bloat.
2021-05-05 09:16:55 -07:00
Tyler Veness
497b712f67 [wpilib] Make IterativeRobotBase::m_period private with getter 2021-05-04 13:41:36 -07:00
Tyler Veness
f00dfed7ac [wpilib] Remove IterativeRobot base class
TimedRobot supersedes it (see commit 81498e6 for reasoning).
2021-05-04 13:41:36 -07:00
Thad House
3c08461685 [hal] Use last error reporting instead of PARAMETER_OUT_OF_RANGE (#3328)
Makes the error messages much more specific to each error.
2021-05-01 13:22:08 -07:00
Tyler Veness
5ef2b4fdc0 [wpilibj] Fix @deprecated warning for SerialPort constructor (#3329)
The javadoc @deprecated tag didn't have corresponding @Deprecated
attribute.
2021-05-01 13:20:53 -07:00
Thad House
23d2326d1d [hal] Report previous allocation location for indexed resource duplicates (#3322) 2021-05-01 10:28:30 -07:00
Thad House
e338f9f190 [build] Fix wpilibc runCpp task (#3327) 2021-05-01 10:26:33 -07:00
Noam Zaks
c8ff626fe2 [wpimath] Move Java classes to edu.wpi.first.math (#3316) 2021-05-01 08:53:30 -07:00
Noam Zaks
4e424d51f4 [wpilibj] DifferentialDrivetrainSim: Rename constants to match the style guide (#3312) 2021-05-01 07:09:23 -07:00
Thad House
6b50323b07 [cscore] Use Lock2DSize if possible for Windows USB cameras (#3326)
Can remove a memory copy in many cases. This also fixes a bug where any mjpeg cameras on windows wouldn't work if the fast path was taken.
2021-05-01 07:07:37 -07:00
Tyler Veness
65c148536d [wpilibc] Fix "control reaches end of non-void function" warning (#3324) 2021-05-01 07:05:21 -07:00
Peter Johnson
f99f62bee4 [wpiutil] uv Handle: Use malloc/free instead of new/delete (#3325)
This avoids asan warnings for deleting a different pointer type.
2021-05-01 07:04:14 -07:00
Tyler Veness
365f5449ca [wpimath] Fix MecanumDriveKinematics (#3266) 2021-04-30 15:50:16 -07:00
Starlight220
ff52f207cc [glass, wpilib] Rewrite Mechanism2d (#3281)
Substantially improves Mechanism2d by moving it to NetworkTables and adding
a robot API to create the mechanism elements, instead of requiring a JSON file.

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2021-04-30 13:43:59 -07:00
Tyler Veness
ee0eed143a [wpimath] Add DCMotor factory function for Romi motors (#3319) 2021-04-29 09:59:35 -07:00
Thad House
5127380727 [hal] Add HAL_GetLastError to enable better error messages from HAL calls (#3320)
This uses thread local storage so a full error string can be provided, not just an error code.
2021-04-29 09:56:54 -07:00
Noam Zaks
ced654880c [glass, outlineviewer] Update Mac icons to macOS 11 style (#3313) 2021-04-25 17:30:45 -07:00
Peter Johnson
936d3b9f83 [templates] Add Java template for educational robot (#3309)
Educational robot is a very minimal template designed for educational use
(rather than competition).
2021-04-24 20:22:39 -07:00
Jeff Hutchison
6e31230adc [examples] Fix odometry update in SwerveControllerCommand example (#3310)
The Drive Subsystem was supplying an incorrectly constructed
Rotation2d to the odometry update method. Rotation2d constructor
was being called with heading in degrees, not radians as required.
2021-04-24 20:07:04 -07:00
Peter Johnson
05ebe93180 Merge branch 'main' into 2022 2021-04-19 18:45:31 -07:00
Prateek Machiraju
aaf24e2552 [wpilib] Fix initial heading behavior in HolonomicDriveController (#3290) 2021-04-18 21:00:11 -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
Peter Johnson
659b37ef9d [wpiutil] StackTrace: Include offset on Linux (#3305) 2021-04-18 20:34:39 -07:00
Peter Johnson
0abf6c9045 [wpilib] Move motor controllers to motorcontrol package (#3302)
Also deprecate SpeedController in favor of motorcontrol.MotorController and
SpeedControllerGroup in favor of motorcontrol.MotorControllerGroup.

The MotorController interface is derived from the SpeedController interface
so that code such as SpeedController x = new VictorSP(1) continues to
compile (just with a warning).

SpeedControllerGroup and MotorControllerGroup are independent classes;
both implement the MotorController interface.
2021-04-17 11:27:16 -07:00
Tyler Veness
4630191fa4 [wpiutil] circular_buffer: Use value initialization instead of passing zero (#3303)
This enables use of types that have a no-args constructor rather than one that takes an explicit zero value.
For numeric types, value initialization will result in a zero value, so this is not a functional change.
2021-04-15 11:50:07 -07:00
Peter Johnson
b7b178f49c [wpilib] Remove Potentiometer interface 2021-04-13 22:40:55 -07:00
Peter Johnson
687066af3d [wpilib] Remove GyroBase 2021-04-13 22:40:55 -07:00
Peter Johnson
6b168ab0c8 [wpilib] Remove PIDController, PIDOutput, PIDSource
Move them to the old commands vendordep so that PIDCommand and PIDSubsystem
continue to work.

This also removes Filter and LinearDigitalFilter.
2021-04-13 22:40:55 -07:00
Tyler Veness
948625de9d [wpimath] Document conversion from filter cutoff frequency to time constant (#3299) 2021-04-12 11:12:52 -07:00
Modelmat
3848eb8b16 [wpilibc] Fix flywhel -> flywheel typo in FlywheelSim (#3298) 2021-04-12 11:12:04 -07:00
Peter Johnson
3abe0b9d49 [cscore] Move java package to edu.wpi.first.cscore (#3294)
This is more consistent with the other Java packages, and also is more
correct, as we own the first.wpi.edu domain but not the full wpi.edu domain.
2021-04-10 11:42:41 -07:00
Peter Johnson
d7fabe81fe [wpilib] Remove RobotDrive (#3295)
This has been deprecated for several years, and its functionality has been
completely superseded by other drive classes (DifferentialDrive et al).
2021-04-10 10:28:32 -07:00
Peter Johnson
1dc81669c2 [wpilib] Remove GearTooth (#3293)
This sensor has had zero usage for many years and was last in the KOP
over a decade ago.  There are much better rotation sensors available,
and it's no longer worth maintaining this class.
2021-04-10 10:28:05 -07:00
Peter Johnson
01d0e12603 [wpilib] Revert move of RomiGyro into main wpilibc/j (#3296)
This reverts commit 69e8d0b65d (#3143).

We haven't released a version with this yet, and plan to make a vendor
library instead.
2021-04-10 10:27:44 -07:00
Peter Johnson
397e569aaf [ntcore] Remove "using wpi" from nt namespace
This removes the nt::ArrayRef, nt::StringRef, and nt::Twine aliases.
2021-04-08 22:35:28 -07:00
Peter Johnson
79267f9e60 [ntcore] Remove NetworkTable -> nt::NetworkTable shim 2021-04-08 22:35:28 -07:00
Peter Johnson
48ebe5736a [ntcore] Remove deprecated Java interfaces and classes 2021-04-08 22:35:28 -07:00
Peter Johnson
c2064c78b2 [ntcore] Remove deprecated ITable interfaces 2021-04-08 22:35:28 -07:00
Peter Johnson
36608a283b [ntcore] Remove deprecated C++ APIs 2021-04-08 22:35:28 -07:00
Starlight220
a1c87e1e15 [glass] LogView: Add "copy to clipboard" button (#3274) 2021-04-06 13:19:49 -07:00
Prateek Machiraju
fa7240a501 [wpimath] Fix typo in quintic spline basis matrix 2021-04-03 16:03:38 -07:00
Prateek Machiraju
ffb4d38e24 [wpimath] Add derivation for spline basis matrices 2021-04-03 16:03:38 -07:00
Starlight220
f57c188f2e [wpilib] Add AnalogEncoder(int) ctor (#3273) 2021-04-02 08:26:41 -07:00
Prateek Machiraju
8471c4fb26 [wpilib] FieldObject2d: Add setTrajectory() method (#3277) 2021-04-01 22:08:07 -07:00
Peter Johnson
c97acd18e7 [glass] Field2d enhancements (#3234)
- Add raw support for pose lists > 255/3 in length
- Improve drag selection, especially with closely overlapping objects
- Drag selection of corner also highlights center of object with smaller circle
- Multiple styles (box, line, closed line, track)
- Configurable line and arrow settings (color, weight)
- Add tooltip for object name, index, x, y, rotation
- Context menu for pose edit/add/remove
- View/edit in feet or inches as well as meters
- Configurable object selectability

Implementation: use vector of Pose2d internally, use units
2021-03-27 13:34:44 -07:00
Prateek Machiraju
ffb590bfcc [wpilib] Fix Compressor sendable properties (#3269) 2021-03-26 21:20:54 -07:00
Peter Johnson
6137f98eb5 [hal] Rename SimValueCallback2 to SimValueCallback (#3212) 2021-03-21 23:22:04 -07:00
Peter Johnson
a6f6539691 [hal] Move registerSimPeriodic functions to HAL package (#3211)
This enables the static lists to be private.
2021-03-21 23:21:47 -07:00
Peter Johnson
10c038d9bf [glass] Plot: Fix window creation after removal (#3264)
Previously the following sequence was broken:
- Add two plot windows (creates Plot<0> and Plot<1>)
- Delete Plot<0>
- Try to create a plot window

This failed because it would try to create Plot<1>, which already existed.
It was necessary to also destroy Plot<1> before another plot could be added.

This change fixes this case by trying all 0-N cases.
2021-03-21 18:06:18 -07:00
Peter Johnson
2d2eaa3eff [wpigui] Ensure window will be initially visible (#3256)
Only set the initial window position if the window X/Y postion is within one
of the connected monitor work areas.
2021-03-21 12:39:33 -07:00
Prateek Machiraju
4d28b1f0cd [wpimath] Use JNI for trajectory serialization (#3257) 2021-03-21 12:38:23 -07:00
Peter Johnson
3de800a607 [wpimath] TrajectoryUtil.h: Comment formatting (NFC) (#3262) 2021-03-21 11:40:15 -07:00
Peter Johnson
eff5923778 [glass] Plot: Don't overwrite series ID (#3260) 2021-03-21 11:14:25 -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
9550777b9d [wpilib] PWMSpeedController: Use PWM by composition (#3248)
This cleans up the user experience by removing lower-level functions from the
interface.

Also remove MotorSafety from "raw" PWM.
2021-03-21 11:12:49 -07:00
Peter Johnson
c8521a3c33 [glass] Plot: Set reasonable default window size (#3261) 2021-03-21 10:50:41 -07:00
Peter Johnson
d71eb2cf39 [glass] Plot: Show full source name as tooltip and in popup (#3255) 2021-03-20 20:59:31 -07:00
Peter Johnson
160fb740f4 [hal] Use std::lround() instead of adding 0.5 and truncating (#3012) 2021-03-19 14:24:46 -07:00
Peter Johnson
48e9f39513 [wpilibj] Remove wpilibj package CameraServer (#3213) 2021-03-19 13:51:53 -07:00
Peter Johnson
8afa596fdf [wpilib] Remove deprecated Sendable functions and SendableBase (#3210) 2021-03-19 13:41:11 -07:00
Prateek Machiraju
d3e45c297c [wpimath] Make C++ geometry classes immutable (#3249) 2021-03-19 13:38:54 -07:00
Peter Johnson
2c98939c18 [glass] StringChooser: Don't call SameLine() at end 2021-03-19 13:15:26 -07:00
Peter Johnson
a18a7409fb [glass] NTStringChooser: Clear value of deleted entries 2021-03-19 13:15:26 -07:00
Peter Johnson
2f19cf4524 [glass] NetworkTablesHelper: listen to delete events 2021-03-19 13:15:26 -07:00
Peter Johnson
da96707dca Merge branch 'main' into 2022 2021-03-19 09:22:02 -07:00
Peter Johnson
c3a8bdc240 [build] Fix clang-tidy action (#3246)
Manually install python3.8, as actions/setup-python now needs Ubuntu 20.04.
2021-03-19 08:59:14 -07:00
Peter Johnson
21624ef273 Add ImGui OutlineViewer (#3220) 2021-03-16 22:05:41 -07:00
Peter Johnson
1032c9b917 [wpiutil] Unbreak wpi::Format on Windows (#3242)
This function relies on the behavior of snprintf returning an error value
when the buffer is too small.  By default, _snprintf_s aborts on Windows
instead of returning an error value.

This caused Glass to fail when trying to print a large NT value to a string.
2021-03-16 22:04:55 -07:00
Peter Johnson
2e07902d76 [glass] NTField2D: Fix name lookup (#3233)
This was causing incorrect detection of duplicate names.
2021-03-12 16:54:26 -08:00
Peter Johnson
6e23e1840a [wpilibc] Remove WPILib.h (#3235)
It's been deprecated for several years, is often broken as it's not tested
frequently, and dramatically increases compile times.
2021-03-12 15:58:47 -08:00
Prateek Machiraju
3e22e45066 [wpilib] Make KoP drivetrain simulation weight 60 lbs (#3228) 2021-03-07 22:54:40 -08:00
Peter Johnson
79d1bd6c8f [glass] NetworkTablesSetting: Allow disable of server option (#3227) 2021-03-07 21:24:59 -08:00
Prateek Machiraju
fe341a16f5 [examples] Use more logical elevator setpoints in GearsBot (#3198) 2021-03-07 16:00:00 -08:00
Peter Johnson
62abf46b3f [glass] NetworkTablesSettings: Don't block GUI (#3226)
On some systems, StopClient et al can take a long time to execute.
Instead run these on a separate thread to avoid blocking the GUI.

Also add option to get IP from DS (default on).
2021-03-07 15:40:05 -08:00
Peter Johnson
a95a5e0d9b [glass] Move NetworkTablesSettings to libglassnt (#3224) 2021-03-06 22:19:00 -08:00
Prateek Machiraju
d6f6ceaba5 [build] Run Spotless formatter (NFC) (#3221)
The original PR (#2934) was created before we moved to Spotless so the
formatting check was never run.
2021-03-04 08:24:05 -08:00
Blake Bourque
0922f8af59 [commands] CommandScheduler.requiring(): Note return can be null (NFC) (#2934) 2021-03-03 23:56:57 -08:00
Prateek Machiraju
6812302ff9 [examples] Make DriveDistanceOffboard example work in sim (#3199)
Adds some basic functionality to the ExampleMotorController so that
controller inputs show up in LiveWindow widgets in simulation.
2021-03-03 23:38:13 -08:00
Prateek Machiraju
f3f86b8e78 [wpimath] Add pose estimator overload for vision + std dev measurement (#3200) 2021-03-03 23:37:18 -08:00
Matt Soucy
1a2680b9e5 [wpilibj] Change CommandBase.withName() to return CommandBase (#3209)
Doing this retains the Sendable portion of the type.
2021-03-03 23:35:37 -08:00
Starlight220
435bbb6a8c [command] RamseteCommand: Output 0 if interrupted (#3216) 2021-02-28 22:06:34 -08:00
Tyler Veness
3cf44e0a53 [hal] Add function for changing HAL Notifier thread priority (#3218) 2021-02-28 22:05:26 -08:00
Prateek Machiraju
40b367513f [wpimath] Units.java: Add kg-lb conversions (#3203) 2021-02-27 10:12:41 -08:00
Prateek Machiraju
9f563d584a [glass] NT: Fix return value in StringToDoubleArray (#3208) 2021-02-26 08:43:12 -08:00
Peter Johnson
af4adf5379 [glass] Auto-size plots to fit window (#3193)
Plots can still be set to have a fixed height, in which case the remaining
space is distributed amongst the auto-sized plots.
2021-02-21 16:38:06 -08:00
Peter Johnson
2560146da3 [sim] GUI: Add option to show prefix in Other Devices (#3186)
Also disable rename popup for this window.
2021-02-21 16:35:49 -08:00
Peter Johnson
eae3a6397a gitignore: Ignore .cache directory (#3196)
This is used by newer clangd versions.
2021-02-21 16:35:01 -08:00
Starlight220
959611420b [wpilib] Require non-zero positive value for PIDController.period (#3175) 2021-02-16 18:07:29 -08:00
Prateek Machiraju
9522f2e8c7 [wpimath] Add methods to concatenate trajectories (#3139)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2021-02-16 18:06:36 -08:00
Zachary Orr
e42a0b6cf0 [wpimath] Rotation2d comment formatting (NFC) (#3162) 2021-02-16 18:06:01 -08:00
Claudius Tewari
d1c7032dec [wpimath] Fix order of setting gyro offset in pose estimators (#3176)
The gyro offset should be determined from the desired initial pose, not the current pose. This fix reflects the behavior of the odometry classes and the C++ holonomic pose estimators.
2021-02-16 18:04:38 -08:00
Starlight220
d241bc81ae [sim] Add DoubleSolenoidSim and SolenoidSim classes (#3177) 2021-02-16 18:03:57 -08:00
Tyler Veness
cb7f39afa1 [wpilibc] Add RobotController::GetBatteryVoltage() to C++ (#3179)
This function already exists in Java.
2021-02-16 18:03:25 -08:00
Thad House
99b5ad9ebb [wpilibj] Fix warnings that are not unused variables or deprecation (#3161)
Fix all warnings given by intellisense that are not unused variables or deprecation.
2021-02-12 22:22:11 -08:00
Thad House
c14b237757 [build] Fixup doxygen generated include dirs to match what users would need (#3154) 2021-02-12 22:17:39 -08:00
Starlight220
d447c7dc32 [sim] Add SimDeviceSim ctor overloads (#3134)
Better parallelism with SimDevice.create(), so teams don't have to mess with concatenating the index/channel themselves.
2021-02-12 22:17:13 -08:00
Austin Shalit
247420c9c1 [build] Remove jcenter repo (#3157) 2021-02-12 22:15:52 -08:00
Peter Johnson
04b112e004 [build] Include debug info in plugin published artifacts (#3149) 2021-02-12 22:15:16 -08:00
Prateek Machiraju
be0ce99007 [examples] Use PWMSparkMax instead of PWMVictorSPX (#3156)
This accurately reflects the motor controllers that are distributed in
the Kit of Parts.
2021-02-12 22:14:56 -08:00
Zhiquan Yeo
69e8d0b65d [wpilib] Move RomiGyro into main wpilibc/j (#3143) 2021-02-12 22:14:29 -08:00
Tyler Veness
94e685e1bd [wpimath] Add custom residual support to EKF (#3148)
Fixes #3145.

Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
2021-02-12 22:13:36 -08:00
Peter Johnson
5899f3dd28 [sim] GUI: Make keyboard settings loading more robust (#3167)
Check values during load and operation to avoid potential crashes due to
ini file errors or corruption.
2021-02-12 22:12:20 -08:00
Prateek Machiraju
f82aa1d564 [wpilib] Fix HolonomicDriveController atReference() behavior (#3163)
The atReference() method previously used the rotation error between the
desired trajectory state and the current pose. This was a bug because we
allow teams to use custom rotation setpoints and that wasn't being taken
into account.
2021-02-12 22:11:57 -08:00
Tyler Veness
fe5c2cf4b7 [wpimath] Remove ControllerUtil.java (#3169)
This was already removed from C++ in the offseason and replaced with
MathUtil.inputModulus(). We just neglected to do that for Java; it was
never intended to see a season release. Its implementation is incorrect
compared to inputModulus() as well.

See https://github.com/wpilibsuite/allwpilib/issues/3168 for discussion.
2021-02-12 22:10:58 -08:00
Thad House
43d40c6e9e [wpiutil] Suppress unchecked cast in CombinedRuntimeLoader (#3155)
Because of Java's type system, it is actually literally impossible to check for this cast at runtime. So instead, the only option is to suppress it. Only suppressed for the specific function.
2021-02-07 08:20:33 -08:00
Tyler Veness
3d44d8f79c [wpimath] Fix argument order in UKF docs (NFC) (#3147) 2021-02-01 23:36:32 -08:00
Peter Johnson
ba6fe8ff2e [cscore] Add USB camera change event (#3123) 2021-01-31 18:52:48 -08:00
Peter Johnson
5337258888 [build] Tweak OpenCV cmake search paths to work better on Linux (#3144)
With this change, cmake finds OpenCV Java on Ubuntu with no additional search options.
2021-01-31 18:52:21 -08:00
Peter Johnson
29bf9d6ef1 [cscore] Add polled support to listener
Change Java VideoListener to use polling.
2021-01-31 17:06:37 -08:00
Peter Johnson
483beb6361 [ntcore] Move CallbackManager to wpiutil 2021-01-31 17:06:37 -08:00
Prateek Machiraju
fdaec77594 [examples] Instantiate m_ramseteController in example (#3142) 2021-01-31 17:04:16 -08:00
Peter Johnson
8494a5761b Rename default branch to main (#3140) 2021-01-30 13:46:56 -08:00
Prateek Machiraju
45590eea22 [wpigui] Hardcode window scale to 1 on macOS (#3135)
This fixes an issue with scaling on Retina displays where the frame
buffer size was double that of the window size, resulting in a content
scale factor of 2. This scale factor caused elements to appear too
large, even on the smallest zoom setting.

This change does not affect external monitors on macOS because the
reported content scale was 1 anyway.
2021-01-28 21:52:13 -08:00
Prateek Machiraju
834a64920b [build] Publish libglass and libglassnt to Maven (#3127) 2021-01-25 21:42:38 -08:00
Tyler Veness
2c2ccb3618 [wpimath] Fix Rotation2d equality operator (#3128) 2021-01-25 21:41:34 -08:00
Prateek Machiraju
fb5c8c39ae [wpigui] clang-tidy: readability-braces-around-statements 2021-01-25 09:25:39 -08:00
Prateek Machiraju
f7d39193a4 [wpigui] Fix copyright in pfd and wpigui_metal.mm 2021-01-25 09:25:39 -08:00
Tyler Veness
aec796b212 [ntcore] Fix conditional jump on uninitialized value (#3125)
`m_last_flush` should be initialized before it's used at
Dispatcher.cpp:243.
2021-01-25 08:15:08 -08:00
Peter Johnson
fb13bb2393 [sim] GUI: Add right click popup for keyboard joystick settings (#3119) 2021-01-23 09:10:58 -08:00
Prateek Machiraju
c517ec6779 [build] Update thirdparty-imgui to 1.79-2 (#3118) 2021-01-22 19:48:49 -08:00
David Vo
e8cbf2a717 [wpimath] Fix typo in SwerveDrivePoseEstimator doc (NFC) (#3112) 2021-01-21 09:31:37 -08:00
Prateek Machiraju
e9c86df468 [wpimath] Add tests for swerve module optimization (#3100) 2021-01-20 20:44:37 -08:00
Modelmat
6ba8c289c5 [examples] Remove negative of ArcadeDrive(fwd, ..) in the C++ Getting Started Example (#3102) 2021-01-20 20:43:34 -08:00
Peter Johnson
3f1672e89f [hal] Add SimDevice createInt() and createLong() (#3110) 2021-01-20 20:42:39 -08:00
Prateek Machiraju
15be5cbf1f [examples] Fix segfault in GearsBot C++ example (#3111)
This fixes a dangling this pointer in the DriveStraight and
SetDistanceToBox commands by directly capturing the
drivetrain pointer by value instead.
2021-01-20 20:38:45 -08:00
Evan Pratten
4cf0e5e6db Add quick links to API documentation in README (#3082) 2021-01-19 23:00:54 -08:00
Tyler Veness
6b1898f12e Fix RT priority docs (NFC) (#3098)
The ranges and which value was specified as highest were incorrect on
some of them. On Linux, the range is 1 to 99 with 99 being highest.

From `man 7 sched`:
```
Processes scheduled under one of the real-time policies (SCHED_FIFO,
SCHED_RR) have a sched_priority value in the range 1 (low) to 99 (high).
```

Also clean up the relevant javadoc and doxygen comments.
2021-01-19 22:59:18 -08:00
David Vo
b3426e9c0d [wpimath] Fix missing whitespace in pose estimator doc (#3097) 2021-01-19 22:58:08 -08:00
Modelmat
38c1a1f3e0 [examples] Fix feildRelative -> fieldRelative typo in XControllerCommand examples (#3104)
* MecanumControllerCommand
* SwerveControllerCommand
2021-01-19 22:57:41 -08:00
Peter Johnson
4488e25f16 [glass] Shorten SmartDashboard window names (#3096)
Instead of "/SmartDashboard/name" they now default to "name (SmartDashboard)".
This allows for smaller windows while preserving the name without requiring
user customization.
2021-01-17 20:33:42 -08:00
CoolSpy3
cfdb3058ee [wpilibj] Update SimDeviceSimTest (#3095) 2021-01-17 13:48:25 -08:00
Mark Vedder
64adff5fea [examples] Fix typo in ArcadeDrive constructor parameter name (#3092)
Removed extra 'p' in "Supplier" in the parameter name `zaxisRotateSuppplier` of the  ArcadeDrive constructor of the Romi Reference example.
2021-01-16 20:27:29 -08:00
Thad House
6efc58e3db [build] Fix issues with build on windows, deprecations, and native utils (#3090) 2021-01-16 20:26:52 -08:00
Tyler Veness
f393989a5b [wpimath, wpiutil] Add wpi::array for compile time size checking (#3087)
The wpimath APIs use std::array, which doesn't do size checking. Passing
an array with the wrong size can result in uninitialized elements
instead of a compilation error.

This is a breaking change but is worthwhile to avoid hard-to-debug errors.
2021-01-16 20:26:17 -08:00
Prateek Machiraju
d6ed20c1e4 [build] Set macOS deployment target to 10.14 (#3088) 2021-01-14 21:20:38 -08:00
Tyler Veness
7c524014c8 [hal] Add [[nodiscard]] to HAL_WaitForNotifierAlarm() (#3085)
As this is a C-compatible header, add a WPI_NODISCARD macro for
compiler-specific C-compatible nodiscard attributes.
2021-01-14 20:00:55 -08:00
Matt
406d055f07 [wpilib] Fixup wouldHitLowerLimit in elevator and arm simulation classes. (#3076)
Closes #3050.
2021-01-14 00:28:00 -08:00
sciencewhiz
04a90b5dd1 [examples] Don't continually set setpoint in PotentiometerPID Examples (#3084) 2021-01-13 20:09:08 -08:00
Prateek Machiraju
8c5bfa0132 [sim] GUI: Add max value setting for keyboard joysticks (#3083) 2021-01-12 19:57:04 -08:00
Peter Johnson
bc80c55353 [hal] Add SimValue reset() function (#3064)
This enables correct behavior for resetting incremental sensor values like
encoder counts or gyro accumulated angle with WebSockets.
2021-01-12 00:38:58 -08:00
Peter Johnson
9c3b51ca0f [wpilib] Document simulation APIs (#3079)
- Remove sim checkstyle suppression
- Add [[nodiscard]] to C++ register callback functions
- Add a couple of missing sim functions

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
Co-authored-by: Starlight220 <yotamshlomi@gmail.com>
2021-01-11 21:55:45 -08:00
Prateek Machiraju
26584ff145 [wpimath] Add model description to LinearSystemId Javadocs (#3080) 2021-01-11 20:08:55 -08:00
Prateek Machiraju
42c3d52863 [examples] Sync Java and C++ trajectories in sim example (#3081)
This also shifts the trajectory up and to the right so that the robot is
always visible in the Field GUI during traversal. Some drive constants
and trajectory constraints were also synced between the two languages.
2021-01-11 20:08:22 -08:00
Dustin Spicuzza
64e72f7103 [wpilibc] Add missing function RoboRioSim::ResetData (#3073) 2021-01-10 22:50:25 -08:00
Matt
e955037980 [wpimath] Add optimize() to SwerveModuleState (#3065)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2021-01-10 22:49:46 -08:00
Peter Johnson
fb99910c23 [hal] Add SimInt and SimLong wrappers for int/long SimValue (#3066) 2021-01-09 23:26:19 -08:00
CoolSpy3
e620bd4d3f [doc] Add machine-readable websocket specification (#3059)
Co-authored-by: Vasista Vovveti <vasistavovveti@gmail.com>
2021-01-09 23:24:57 -08:00
Peter Johnson
a44e761d9e [glass] Add support for plot Y axis labels 2021-01-08 11:37:35 -08:00
Peter Johnson
ea1974d576 [wpigui] Update imgui and implot to latest 2021-01-08 11:37:35 -08:00
Matt
85a0bd43c2 [wpimath] Add RKF45 integration (#3047)
This is more stable than Runge-Kutta for systems with large elements in their A or B matrices.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2021-01-06 21:40:25 -08:00
Prateek Machiraju
278e0f126e [glass] Use .controllable to set widgets' read-only state (#3035)
This modifies the mecanum drive, differential drive, speed controller,
and PID controller widgets to only be writeable when .controllable is
set to true.
2021-01-05 18:33:05 -08:00
Tyler Veness
d8652cfd4f [wpimath] Make Java DCMotor API consistent with C++ and fix motor calcs (#3046)
The stall torque, stall current, and free current are now multiplied by
the number of motors instead of just the stall torque. This produces the
same values for Kt and Kv regardless of the number of motors; the motor
resistance still affects the system response.

For an elevator model, the response should be the same as before since a
factor of "number of motors" shows up in the same place in the
acceleration calculation, but the current calculation will also be
correct now.
2021-01-05 18:28:57 -08:00
Peter Johnson
377b7065aa [build] Add toggleOffOn to Java spotless (#3053)
This allows custom formatting where desired (e.g. of table values).

Also upgrade spotless to 5.5.0.
2021-01-05 17:56:45 -08:00
Prateek Machiraju
1e9c79c587 [sim] Use plant output to retrieve simulated position (#3043)
Using the plant output means that measurement noise can be incorporated.
SingleJointedArmSim (in C++ and Java) and ElevatorSim (in C++) used the
state instead of the measurement.

Closes #3042
2021-01-05 17:55:44 -08:00
Peter Johnson
78147aa342 [sim] GUI: Fix Keyboard Joystick (#3052)
This was broken by #3010.

Also fix a few unknown key cases and a nullptr return that could cause a crash.
2021-01-05 17:55:11 -08:00
Peter Johnson
cd4a2265b9 [ntcore] Fix NetworkTableEntry::GetRaw() (#3051)
It was calling value->GetString() instead of GetRaw(), which would assert.
2021-01-04 22:07:50 -08:00
Austin Shalit
767ac1de10 [build] Use deploy key for doc publish (#3048)
This allows us to limit the scope of personal access tokens
2021-01-04 15:21:47 -08:00
Austin Shalit
d762215d13 [build] Add publish documentation script (#3040) 2021-01-04 13:59:19 -08:00
sciencewhiz
1fd09593cf [examples] Add missing TestInit method to GettingStarted Example (#3039) 2021-01-02 22:00:25 -08:00
Zhiquan Yeo
e45a0f6ce2 [examples] Add RomiGyro to the Romi Reference example (#3037) 2021-01-02 21:59:57 -08:00
sciencewhiz
94f8525721 Update imaging link and fix typo (#3038) 2021-01-02 19:57:39 -08:00
Zhiquan Yeo
d73cf64e54 [examples] Update RomiReference to match motor directions (#3036)
Flip the TeleopArcadeDrive axis directions so that positive
values for x-axis speed result in the Romi driving forward (in the
direction of the Raspberry Pi USB ports).
2021-01-02 17:21:07 -08:00
Peter Johnson
f945462bab Bump copyright year to 2021 (#3033) 2021-01-01 21:54:00 -08:00
Tyler Veness
b05946175b [wpimath] Catch Drake JNI exceptions and rethrow them (#3032)
This gives an informative error in Java instead of crashing the JVM.
2021-01-01 17:09:50 -08:00
Tyler Veness
62f0f8190d [wpimath] Deduplicate angle modulus functions (#2998)
frc::NormalizeAngle(), units::math::NormalizeAngle(), and
frc::GetModulusError() were replaced with frc::InputModulus() and
frc::AngleModulus().

They were placed in wpimath/src/main/native/include/frc/MathUtil.h for
C++ and wpimath/src/main/java/edu/wpi/first/wpiutil/math/MathUtil.java
for Java.
2021-01-01 16:22:00 -08:00
Prateek Machiraju
bf8c0da4be [glass] Add "About" popup with version number (#3031) 2021-01-01 15:59:00 -08:00
Prateek Machiraju
dfdd6b3891 [build] Increase Gradle heap size in Gazebo build (#3028)
Builds have been intermittently failing due to Gradle running out of memory.
2021-01-01 10:29:55 -08:00
Peter Johnson
f5e0fc3e9a Finish clang-tidy cleanups (#3003)
* Add .clang-tidy configuration.
* A separate .clang-tidy is used for hal includes to suppress modernize-use-using
  (as these are C headers).
* Add NOLINT where necessary for a clean run.
* Add clang-tidy job to lint-format workflow.  This workflow is now only run on PRs.
  To reduce runtime, clang-tidy is only run on files changed in the PR.

Two wpilibc changes; both are unlikely to break user code:
* BuiltInAccelerometer: Make SetRange() final
* Counter: Make SetMaxPeriod() final

After these cleanups, the only file that does not run cleanly is
cscore_raw_cv.h due to it not being standalone.
2021-01-01 10:27:49 -08:00
Peter Johnson
d741101fe3 [sim] Revert accidental commit of WSProvider_PDP.h (#3027) 2021-01-01 00:44:31 -08:00
Starlight220
e1620799c7 [examples] Add C++ RomiReference example (#2969)
Co-authored-by: Prateek Machiraju <prateek.machiraju@gmail.com>
Co-authored-by: sciencewhiz <sciencewhiz@users.noreply.github.com>
2020-12-31 20:37:20 -08:00
Prateek Machiraju
749c7adb13 [command] Fix use-after-free in CommandScheduler (#3024) 2020-12-31 20:35:17 -08:00
Peter Johnson
921a733911 [sim] Add WS providers for AddressableLED, PCM, and Solenoid (#3026)
Co-authored-by: PJ Reiniger <pj.reiniger@gmail.com>
2020-12-31 20:34:34 -08:00
Austin Shalit
26d0004fe1 [build] Split Actions into different yml files (#3025) 2020-12-31 20:33:39 -08:00
Austin Shalit
948af6d5b5 [wpilib] PWMSpeedController.get(): Apply Inversion (#3016)
This makes get() return the value actually sent to the motor.

This is a breaking change.
2020-12-31 14:35:10 -08:00
Peter Johnson
670a187a3c [wpilibc] SuppliedValueWidget.h: Forward declare ShuffleboardContainer (#3021)
This is needed to break the include loop between SuppliedValueWidget.h and ShuffleboardContainer.h.
2020-12-31 12:35:56 -08:00
Peter Johnson
be9f725023 [ntcore] NetworkTableValue: Use std::forward instead of std::move (#3022)
Because these are forwarding references, they could unexpectedly move a
passed lvalue.  Using std::forward() makes a copy if an lvalue is passed.
2020-12-31 12:35:02 -08:00
Peter Johnson
daf3f4cb1a [cscore] cscore_raw_cv.h: Fix error in PutFrame() (#3019) 2020-12-31 12:34:37 -08:00
Peter Johnson
5acda4cc71 [wpimath] ElevatorFeedforward.h: Add time.h include 2020-12-31 12:18:06 -08:00
Peter Johnson
8452af606b [wpimath] units/radiation.h: Add mass.h include 2020-12-31 12:18:06 -08:00
Peter Johnson
630d449520 [hal] ErrorsInternal.h: Add stdint.h include 2020-12-31 12:18:06 -08:00
Peter Johnson
7372cf7d99 [cscore] Windows NetworkUtil.cpp: Add missing include 2020-12-31 12:18:06 -08:00
Peter Johnson
b7e46c558f Include .h from .inc/.inl files (NFC) (#3017)
This helps both IDEs and linting tools.

Also add some missing braces.
2020-12-31 11:26:53 -08:00
jpokornyiii
bf8f8710ea [examples] Update Romi template and example (#2996)
Updated the RomiReference example to have autonomous example.
Updated RomiReference and both Romi templates to use Encoder.getDistance().
Removed motor inversion.
2020-12-30 22:45:04 -08:00
Austin Shalit
6ffe5b775d [glass] Ensure NetworkTableTree parent context menu has an id (#3015) 2020-12-30 22:43:35 -08:00
Austin Shalit
be0805b85b [build] Update to WPILibVersioningPlugin 4.1.0 (#3014) 2020-12-30 22:40:38 -08:00
Austin Shalit
65b2359b27 [build] Add spotless for other files (#3007)
Adds spotless formatting for Gradle, xml, md, and gitignore files.

yml linting is not performed as it requires a dependency on npm.
2020-12-30 16:17:20 -08:00
Prateek Machiraju
8651aa73e8 [examples] Enable NT Flush in Field2d examples (#3013) 2020-12-30 16:12:15 -08:00
Austin Shalit
78b542737a [build] Add Gazebo build to Actions CI (#3004) 2020-12-30 11:38:49 -08:00
Peter Johnson
fccf86532f [sim] DriverStationGui: Fix two bugs (#3010)
- Slicing of GlfwKeyboardJoystick
- Potential null pointer deref
2020-12-30 11:37:54 -08:00
Peter Johnson
1857417601 [sim] WSProvider_Joystick: Fix off-by-1 in incoming buttons (#3011) 2020-12-30 11:37:20 -08:00
Prateek Machiraju
ee7114a58c [glass] Add drive class widgets (#2975)
This adds widgets for DifferentialDrive and MecanumDrive.
2020-12-30 08:51:55 -08:00
Prateek Machiraju
00fa91d0d6 [glass] Use ImGui style for gyro widget colors (#3009)
This ensures that the colors are properly visible in light mode or any
other custom user styles.
2020-12-30 08:42:26 -08:00
Peter Johnson
b7a25bfc33 ThirdPartyNotices: Add portable file dialogs license (#3005) 2020-12-29 22:46:44 -08:00
Austin Shalit
a2e46b9a1b [glass] modernize-use-nullptr (NFC) (#3006) 2020-12-29 22:46:11 -08:00
Peter Johnson
a751fa22d2 [build] Apply spotless for java formatting (#1768)
Update checkstyle config to be compatible with spotless.

Co-authored-by: Austin Shalit <austinshalit@gmail.com>
2020-12-29 22:45:16 -08:00
Tyler Veness
e563a0b7db [wpimath] Make LinearSystemLoop move-constructible and move-assignable (#2967) 2020-12-29 20:50:26 -08:00
Austin Shalit
49085ca943 [glass] Add context menus to remove and add NetworkTables values (#2979) 2020-12-29 20:49:29 -08:00
Peter Johnson
560a850a2b [glass] Add NetworkTables Log window (#2997)
This moves NetworkTable log messages out of the console (which is hidden on some platforms).
2020-12-29 20:47:58 -08:00
PJ Reiniger
66782e2317 [sim] Create Left/Right drivetrain current accessors (#3001) 2020-12-29 20:46:51 -08:00
Peter Johnson
b60eb1544b clang-tidy: bugprone-virtual-near-miss
A few virtual functions are called by constructors or destructors, which is
dangerous in C++ (as an overridden virtual impl won't be called, only the
one in the current class).  Fix by either marking the function final or
not calling at all (if possible).
2020-12-29 14:26:19 -08:00
Peter Johnson
cbe59fa3bf clang-tidy: google-explicit-constructor 2020-12-29 14:26:19 -08:00
Peter Johnson
c97c6dc065 clang-tidy: google-readability-casting (NFC) 2020-12-29 14:26:19 -08:00
Peter Johnson
32fa97d68d clang-tidy: modernize-use-nullptr (NFC) 2020-12-29 14:26:19 -08:00
Peter Johnson
aee4603269 clang-tidy: modernize-pass-by-value 2020-12-29 14:26:19 -08:00
Peter Johnson
29c7da5f1a clang-tidy: modernize-make-unique 2020-12-29 14:26:19 -08:00
Peter Johnson
6131f4e32b clang-tidy: modernize-concat-nested-namespaces (NFC) 2020-12-29 14:26:19 -08:00
Peter Johnson
67e03e625d clang-tidy: modernize-use-equals-default 2020-12-29 14:26:19 -08:00
Peter Johnson
b124f9101b clang-tidy: modernize-use-default-member-init 2020-12-29 14:26:19 -08:00
Peter Johnson
d11a3a6380 clang-tidy: modernize-use-override (NFC)
Add NOLINT to CommandTestBase due to gmock not adding "override" keyword,
which causes warnings on clang.
2020-12-29 14:26:19 -08:00
Peter Johnson
4cc0706b06 clang-tidy: modernize-use-using (NFC)
Excludes C-compatible headers
2020-12-29 14:26:19 -08:00
Tyler Veness
885f5a9781 [wpilibc] Speed up ScopedTracerTest (#2999)
ScopedTracerTest now uses simulation time instead of wall clock time, so
it doesn't have to actually wait 1.5 seconds.
2020-12-29 10:30:23 -08:00
sciencewhiz
60b5964577 [wpilibj] Fix typos (NFC) (#3000) 2020-12-29 10:29:39 -08:00
Austin Shalit
6e1919414e [build] Bring naming checkstyle rules up to date with Google Style guide (#1781)
Also update Checkstyle to 8.38.

Google changed their style guide from the last time we imported it. This PR brings in those naming changes. The change they made is allowing single letter member, parameter, and local variable names. They also added a lambda naming scheme and I thought it would be good to bring that in too.
2020-12-29 09:27:48 -08:00
Tyler Veness
8c8ec5e63e [wpilibj] Suppress unchecked cast warnings (#2995) 2020-12-28 17:13:34 -08:00
Peter Johnson
b8413ddd5b [wpiutil] Add noexcept to timestamp static functions (#2994)
This silences a clang-tidy warning.
2020-12-28 17:12:51 -08:00
Austin Shalit
5d976b6e18 [glass] Load NetworkTableView settings on first draw (#2993)
Before this change, user settings were not loaded until after the first time they opened the settings context menu.
2020-12-28 15:29:25 -08:00
Tyler Veness
2b4317452b Replace NOLINT(runtime/explicit) comments with NOLINT (NFC) (#2992)
cpplint.py can accept either, but clang-tidy requires NOLINT.
2020-12-28 15:10:31 -08:00
Peter Johnson
1c3011ba4b [glass] Fix handling of "/" NetworkTables key (#2991) 2020-12-28 14:36:30 -08:00
Peter Johnson
574a42f3b4 [hal] Fix UnsafeManipulateDIO status check (#2987) 2020-12-28 13:04:21 -08:00
Matt
9005cd59e5 [wpilib] Clamp input voltage in sim classes (#2955) 2020-12-28 13:03:31 -08:00
Peter Johnson
dd494d4ab7 [glass] NetworkTablesModel::Update(): Avoid use-after-move (#2988) 2020-12-28 13:02:24 -08:00
Peter Johnson
7cca469a12 [wpimath] NormalizeAngle: Make inline, remove unnamed namespace (#2986) 2020-12-28 13:00: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
0291a3ff56 [wpiutil] StringRef: Add noexcept to several constructors (#2984) 2020-12-28 11:34:50 -08:00
Peter Johnson
5d7315280a [wpimath] Update UnitsTest.cpp copyright (#2985) 2020-12-28 10:40:20 -08:00
Matt
254931b9a8 [wpimath] Remove LinearSystem from LinearSystemLoop (#2968)
The system wasn't being used internally, and as LinearSystem is stateless, it doesn't need to be held by LinearSystemLoop.
2020-12-28 10:35:51 -08:00
Prateek Machiraju
aa89744c95 Update OtherVersions.md to include wpimath info (#2983)
This also updates occurrences of 2020 to 2021.
2020-12-28 10:34:19 -08:00
Peter Johnson
1cda3f5ad7 [glass] Fix styleguide (#2976) 2020-12-26 14:31:24 -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
2bc0a7795c [examples] Fix wpiformat warning about utility include (#2971) 2020-12-26 09:34:21 -08:00
Peter Johnson
4204da6ad4 [glass] Add application icon 2020-12-25 22:08:37 -08:00
Peter Johnson
7ac39b10f7 [wpigui] Add icon support 2020-12-25 22:08:37 -08:00
Matt
6b567e0066 [wpimath] Add support for varying vision standard deviations in pose estimators (#2956)
Exposes the R passed to vision correct to users.
2020-12-24 16:05:07 -08:00
Tyler Veness
df299d6edd [wpimath] Add UnscentedKalmanFilter::Correct() overload (#2966)
This adds an overload of UnscentedKalmanFilter::Correct() that takes a
custom measurement covariance but uses default mean and residual
calculation functions.

Closes #2965.
2020-12-24 16:00:36 -08:00
Prateek Machiraju
4e34f05238 [examples] Use ADXRS450_GyroSim class in simulation example (#2964)
This class did not exist when the original example was written. This
also changes the C++ example to use ADXRS450_Gyro for the sake of
consistency.
2020-12-24 15:42:46 -08:00
Tyler Veness
9962f6fd79 [wpilib] Give Field2d a default Sendable name (#2953) 2020-12-24 12:26:03 -08:00
Peter Johnson
f9d492f4b1 [sim] GUI: Show "Other Devices" window by default (#2961) 2020-12-24 12:24:36 -08:00
Peter Johnson
a8bb2ef1c3 [sim] Fix ADXRS450_GyroSim and DutyCycleEncoderSim (#2963)
These were broken by #2952.

Also fix Java ADXRS450_Gyro angle/rate SimValue names.
2020-12-24 12:23:38 -08:00
Peter Johnson
240c629cda [sim] Try to guess "Map Gamepad" setting (#2960)
Looks to see if the joystick name starts with "Xbox" or contains "pad".
2020-12-23 20:38:28 -08:00
Tyler Veness
952567dd3c [wpilibc] Add missing move constructors and assignment operators (#2959)
- Field2d
- FieldObject2d
- AnalogGyro
2020-12-23 20:36:51 -08:00
Peter Johnson
10b396b4c2 [sim] Various WebSockets fixes and enhancements (#2952)
This is a breaking change to the WebSockets layer to align it with
recent specification documentation work.

To support this, HAL SimValue changed readonly to a direction enum.
This allows specifying bidirectional in addition to input and output.

The SimValue change is specifically designed to avoid API and ABI breakage.
This is completely transparent in C++; in Java a new callback class was added,
and the old readonly functions have been marked deprecated.

A new SimValue creation function for enums allows specifying double values
for each enum value, not just strings.  This allows mapping enum values to
doubles in the WebSockets layer.

A ":" in the SimDevice name now maps it to different WebSocket types (e.g.
"Accel:Name" becomes type "Accel", device "Name").  The type is hidden
in the GUI.

Other WebSockets changes:
* Implemented match_time and game_data
* Added joystick rumble data
* Added builtin accelerometer support
* SimValue enums are mapped to string and double value on WS interface
* Added WebSockets protocol specification
* Added READMEs
2020-12-23 15:54:11 -08:00
sciencewhiz
699bbe21a4 [examples] Fix comments in Gearsbot to match implementation (NFC) (#2957) 2020-12-22 22:26:54 -08:00
Prateek Machiraju
27b67deca6 [glass] Add more widgets (#2947)
This adds the following widgets:
- Speed Controller
- Gyroscope
- Command
- Subsystem
- PIDController
- Scheduler
2020-12-22 21:07:44 -08:00
Peter Johnson
581b7ec553 [wpilib] Add option to flush NetworkTables every iterative loop
This functionality is disabled by default, but can be enabled by the user
program by calling setNetworkTablesFlushEnabled.
2020-12-21 09:53:45 -08:00
Peter Johnson
acfbb1a44a [ntcore] DispatcherBase::Flush: Use wpi::Now()
This is faster on some platforms than steady_clock, and will more
consistently support simulation timing.
2020-12-21 09:53:45 -08:00
Peter Johnson
d85a6d8fe4 [ntcore] Reduce limit on flush and update rate to 5 ms 2020-12-21 09:53:45 -08:00
Tyler Veness
20fbb5c63b [sim] Fix stringop truncation warning from GCC 10 (#2945)
If the strncpy() bound is equal to the destination size and the source
string is longer than 256 bytes, strncpy() won't write a null terminator
for the destination string.
2020-12-17 21:51:57 -08:00
Peter Johnson
1051a06a76 [glass] Show NT timestamps in seconds (#2944) 2020-12-17 07:29:00 -08:00
Peter Johnson
98dfc26208 [glass] Fix plots (#2943) 2020-12-17 07:27:29 -08:00
Peter Johnson
1ba0a2cedd [sim] GUI: Add keyboard virtual joystick support (#2940)
This allows joystick testing without a physical joystick.
Comes with a default set of keyboard mappings, but these are fully customizable by the user.
Up to 4 virtual joysticks are supported.

Default keyboard mappings:

    Joystick 0: axis 0: AD, axis 1: WS, axis 2: ER, buttons ZXCV, POV on numeric keypad
    Joystick 1: axis 0: JL, axis 1: IK, buttons M,./
    Joystick 2: axis 0: left/right arrow, axis 1: up/down arrow, buttons insert/home/pgup/del/end/pgdn

Also adds support for DS-style hotkeys of []\ enable, Enter disable, and spacebar disable.
All of these are disabled by default and must be explicitly enabled by the user.
2020-12-17 00:20:12 -08:00
Tyler Veness
4afb13f98b [examples] Replace M_PI with wpi::math::pi (#2938) 2020-12-17 00:15:02 -08:00
Zhiquan Yeo
b27d33675d [examples] Enhance Romi templates (#2931)
Add motors and encoders so they are more usable out of the box.
2020-12-10 21:38:27 -08:00
Peter Johnson
00b9ae77f9 [sim] Change default WS port number to 3300 (#2932) 2020-12-10 20:39:14 -08:00
Prateek Machiraju
65219f3093 [examples] Update Field2d position in periodic() (#2928)
This ensures that the robot position will be updated in dashboards like Glass when running on real hardware.
2020-12-10 20:36:20 -08:00
Peter Johnson
f78d1d4340 [sim] Process WS Encoder reset internally (#2927)
Currently, Encoder.reset() must make a round trip to the sensor and back
in order for the count to be updated for the user program.  As the sim layer
also resets the internal encoder count, this creates a race condition (a WS
message with a new count can be "in flight" during a reset and update the
count).

This changes the WS layer to not put reset on the wire, but instead keep an
offset count internal to the robot program.  The value on the wire is not
reset, but rather all sends and receives are adjusted as necessary to the
internal robot count.

This approach is straightforward, but does result in the value on the wire
not matching the value in the user program.  A future improvement will fix
this, but this change fixes the immediate race condition problem.
2020-12-10 20:30:12 -08:00
Peter Johnson
941edca597 [hal] Add Java SimDeviceDataJNI.getSimDeviceName (#2924)
This was mistakenly omitted from the Java interface.
2020-12-08 20:42:46 -08:00
Matt
a699435ede [wpilibj] Fix FlywheelSim argument order in constructor (#2922) 2020-12-07 22:34:17 -08:00
Prateek Machiraju
66d6417189 [examples] Add tasks to run Java examples (#2920)
Example: ./gradlew :wpilibjExamples:runstatespacedifferentialdrivesimulation
2020-12-07 22:33:17 -08:00
Prateek Machiraju
558e37c412 [examples] Add simple differential drive simulation example (#2918)
This provides an example of using the differential drive simulator without needing to use the command-based library.
2020-12-07 22:32:42 -08:00
Thad House
4f40d991ea [glass] Switch name of Glass back to glass (#2919)
On Unix systems, most executables are lowercase.
2020-12-07 22:32:15 -08:00
Prateek Machiraju
549af99007 [build] Update native-utils to 2021.0.6 (#2914)
This fixes the Glass publishing classifier
2020-12-05 23:58:42 -08:00
Thad House
b336930093 [glass] Change basename of glass to Glass (#2915)
Was glassApp, which makes building an extraction setup much harder.
2020-12-05 23:56:12 -08:00
Prateek Machiraju
c9a0edfb8b [glass] Package macOS application bundle 2020-12-05 23:23:35 -08:00
Prateek Machiraju
2c5668af46 [wpigui] Add platform-specific preferences save 2020-12-05 23:23:35 -08:00
Peter Johnson
751dea32ae [wpilibc] Try to work around ABI break introduced in #2901 (#2917)
The change to SendableBuilder to add GetTable() added a virtual function
early in the class definition.  This is an ABI break for vendor libraries.
Attempt to workaround this breakage by moving GetTable() to the end of the
class definition.
2020-12-05 23:19:15 -08:00
Thad House
cd8f4bfb1f [build] Package up msvc runtime into maven artifact (#2913)
This will make is so we can get the right artifact to the installer, and we can do it automatically and its guaranteed to match what built the artifacts.
2020-12-05 20:14:03 -08:00
Tyler Veness
a6cfcc6866 [wpilibc] Move SendableChooser Doxygen comments to header (NFC) (#2911) 2020-12-05 20:04:44 -08:00
Tyler Veness
b8c4f603db [wpimath] Upgrade to Eigen 3.3.9 (#2910)
It fixes some compilation errors with C++20.
2020-12-05 20:03:47 -08:00
Prateek Machiraju
0075e4b391 [wpilibj] Fix NPE in Field2d (#2909) 2020-12-05 08:46:54 -08:00
Peter Johnson
125af556ce [simulation] Fix halsim_gui ntcore and wpiutil deps (#2908)
They were being linked out of order, so ntcore wasn't being linked.
2020-12-04 23:30:17 -08:00
Matt
963ad5c255 [wpilib] Add noise to Differential Drive simulator (#2903)
Co-authored-by: Prateek Machiraju <prateek.machiraju@gmail.com>
2020-12-04 18:46:50 -08:00
Peter Johnson
387f56cb7b [examples] Add Romi reference Java example and templates (#2905) 2020-12-04 17:34:54 -08:00
Prateek Machiraju
b3deda38c9 [examples] Zero motors on disabledInit() in sim physics examples (#2906)
This ensures that mechanisms will stop moving if the robot is disabled while motors are in motion
2020-12-04 17:34:16 -08:00
Peter Johnson
2a5ca77454 [glass] Add glass: an application for display of robot data
This reuses many pieces of the current simulation GUI.  The common pieces have
been refactored into the libglass library.

The libglass library is designed to be usable for other standalone data
visualization applications (e.g. viewing data logs).

The name "glass" comes from "glass cockpit", as the application features
several multi-function displays that can be adjusted to display robot
information as needed.
2020-12-04 00:36:55 -08:00
Peter Johnson
727940d847 [wpilib] Move Field2d to SmartDashboard 2020-12-04 00:36:55 -08:00
Peter Johnson
8cd42478e1 [wpilib] SendableBuilder: Make GetTable() visible 2020-12-04 00:36:55 -08:00
Prateek Machiraju
c11d34b26c [command] Use addCommands in command group templates (#2900)
This makes the Java templates consistent with the C++ templates as well as the documentation

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2020-12-01 20:52:45 -08:00
Peter Johnson
339d7445b3 [sim] Add HAL hooks for simulationPeriodic (#2881)
This allows vendor libs to hook into the begin or end of simulationPeriodic().
2020-11-30 23:55:36 -08:00
Peter Johnson
d16f05f2c8 [wpilib] Fix SmartDashboard update order (#2896)
We need to execute listener tasks first, then execute value updates.
Otherwise local changes can fight with dashboard-made changes.
2020-11-30 19:24:12 -08:00
Peter Johnson
5427b32a40 [wpiutil] unique_function: Restrict implicit conversion (#2899)
Only implicitly convert from invocable objects.  This avoids potential
ambiguity in higher-level overloaded functions.
2020-11-30 19:21:10 -08:00
Peter Johnson
f73701239d [ntcore] Add missing SetDefault initializer_list functions (#2898) 2020-11-30 19:20:40 -08:00
Peter Johnson
f5a6fc0703 [sim] Add initialized flag for all solenoids on a PCM (#2897)
This allows much easier/faster checking for whether any solenoid has been
initialized on a particular PCM.
2020-11-30 19:20:16 -08:00
Prateek Machiraju
bdf5ba91a4 [wpilibj] Fix typo in ElevatorSim (#2895)
This caused an illegal argument exception whenever the simulated elevator velocity was retrieved.
2020-11-29 22:28:11 -08:00
Declan Freeman-Gleason
bc8f338771 [wpilib] Add pose estimators (#2867)
Pose and state estimators can filter latency-compensated global measurements and fuse them with state-space drivetrain model information to estimate robot position. They are drop-in replacements for the existing odometry classes.

Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
Co-authored-by: Prateek Machiraju <prateek.machiraju@gmail.com>
Co-authored-by: Claudius Tewari <cttewari@gmail.com>
Co-authored-by: Matt <matthew.morley.ca@gmail.com>
2020-11-28 14:35:35 -08:00
Tyler Veness
3413bfc06a [wpilib] PIDController: Recompute the error in AtSetpoint() (#2822)
This makes AtSetpoint() return false after the setpoint is changed with
SetSetpoint().

Closes #2821.

Co-authored-by: Prateek Machiraju <prateek.machiraju@gmail.com>
2020-11-28 14:33:17 -08:00
Prateek Machiraju
2056f0ce09 [wpilib] Fix bugs in Hatchbot examples (#2893)
This fixes an issue with some commands not correctly requiring their
subsytems. Furthermore, an execute() method was added to the
DriveDistance command to continuously update the voltage command.
2020-11-28 14:01:56 -08:00
Peter Johnson
5eb8cfd691 [wpilibc] Fix MatchDataSender (#2892)
The is_convertible test was always treating the input as bool.
Use is_same on T instead.
2020-11-27 22:06:08 -08:00
Thad House
e6a4254488 [build] Delete test folders after tests execute (#2891)
Also deletes object files.

Both of these things are only done on the build server (-PbuildServer flag).

This will remove all test folders, which removes lots of copies of dependencies.

This also fixes an issue where gtest exectubables were installed for cross builds, even though they should not have been.
2020-11-27 21:44:47 -08:00
Prateek Machiraju
d478ad00d0 [imgui] Allow usage of imgui_stdlib (#2889)
This bumps the version number of thirdparty-imgui in Gradle and adds
imgui_stdlib.cpp into the sources in CMake, as well as adding a new
include directory.
2020-11-26 19:28:24 -08:00
Prateek Machiraju
53eda861de [build] Add unit-testing infrastructure to examples (#2863)
This also adds CMake capabilities to the command-based libraries as well
as wpilibExamples.
2020-11-26 11:47:35 -08:00
Prateek Machiraju
cc1d86ba63 [sim] Add title to simulator GUI window (#2888) 2020-11-26 11:46:14 -08:00
Prateek Machiraju
f0528f00e7 [build] CMake: Use project-specific binary and source dirs (#2886)
This ensures that allwpilib will still build correctly when added as a CMake external project.
2020-11-24 20:25:44 -08:00
Tyler Veness
5cd2ad124d [wpilibc] Add Color::operator!= (#2887) 2020-11-24 19:26:00 -08:00
Tyler Veness
6c00e7a902 [build] CI CMake: build with GUI enabled (#2884) 2020-11-24 13:37:39 -08:00
Tyler Veness
53170bbb58 Update roboRIO toolchain installation instructions (#2883)
There were conflicting instructions: install via the archive on
the releases page, and install using a gradlew command.
2020-11-23 19:48:26 -08:00
Dean Brettle
467258e050 [sim] GUI: Add option to not zero disconnected joysticks (#2876)
This allows team sim code to set the joystick values and not have them overwritten by the GUI.
2020-11-23 19:46:27 -08:00
Tyler Veness
129be23c9e Clarify JDK installation instructions in readme (#2882) 2020-11-23 19:45:14 -08:00
Prateek Machiraju
8e9290e86e [build] Add separate CMake setting for wpimath (#2885)
This allows external CMake projects to only depend on wpimath instead of
having to build the entire library.
2020-11-23 19:44:20 -08:00
Starlight220
7cf5bebf8e [wpilibj] Cache NT writes from DriverStation (#2780)
This reduces malloc traffic.
2020-11-21 14:35:43 -08:00
Prateek Machiraju
f7f9087fb5 [command] Fix timing issue in RamseteCommand (#2871)
This issue only existed on the initial iteration. When timing is paused and stepped,
initialize() and execute() get called with the same timestamp the first time, which
would result in a divide by zero. All subsequent steps advance timing and only
call execute() so the time deltas are all set correctly.
2020-11-21 10:03:01 -08:00
CoolSpy3
256e7904fd [wpilibj] SimDeviceSim: Fix sim value changed callback (#2880) 2020-11-20 21:02:23 -08:00
Tyler Veness
c8ea1b6c38 [wpilib] Add function to adjust LQR controller gain for pure time delay (#2878)
There were three options for where to put this function:

1. A free function in LinearQuadraticRegulator.h. Returning a K matrix
   means the user can't use the LinearQuadraticRegulator in a loop
   anymore.
2. A default argument added to ctors in LinearQuadraticRegulator for a
   time delay (default of 0). This has the smallest API footprint from
   the user perspective, but it bloats the already substantial
   constructor overload set of LinearQuadraticRegulator.
3. A member function in LinearQuadraticRegulator that modifies the
   internal K. This would still have to take in a LinearSystem or (A, B)
   pair because the ctor doesn't store it. Storing it internally feels
   like paying for what we don't use most of the time.

I went with option 3.

I verified the tests's expected values in Python with
scipy.linalg.fractional_matrix_power().

Closes #2877.
2020-11-20 15:28:00 -08:00
Peter Johnson
2816b06c05 [sim] HAL_GetControlWord: Fully zero output (#2873)
This ensures the padding is zero'ed.  We already do this on Athena, we just didn't in sim.
2020-11-20 15:11:11 -08:00
Tyler Veness
4c695ea088 Add toolchain installation instructions to README (#2875) 2020-11-19 13:09:09 -08:00
Starlight220
a14d51806d [wpimath] DCMotor: fix doc typo (NFC) (#2868) 2020-11-16 08:04:46 -08:00
Vasista Vovveti
0170977914 [build] CMake: build sim extensions as shared libs (#2866)
This builds sim extensions as dylib's instead of so's on macOS.
2020-11-15 22:50:30 -08:00
Vasista Vovveti
f61726b5ae [build] Fix cmake-config files (#2865)
In the cmake config files, SELF_DIR was being overwritten and was therefore incorrect.

This also adds wpimath as a dependency to wpilibc.
2020-11-15 22:38:55 -08:00
Kevin Jaget
fc27fdac57 [wpilibc] Cache NT values from driver station (#2768)
This significantly reduces malloc traffic by avoiding NT data allocations.
2020-11-15 10:48:54 -08:00
Peter Johnson
47c59859ee [sim] Make SimDevice callbacks synchronous (#2861)
Asynchronous callbacks are more efficient but pose synchronization challenges;
other sim callbacks are synchronous but SimDevice ones were not.
2020-11-14 21:04:51 -08:00
Peter Johnson
6e76ab9c09 [build] Turn on WITH_GUI for Windows cmake CI 2020-11-14 21:03:22 -08:00
Peter Johnson
5f78b76702 [build] Set GLFW_INSTALL to OFF 2020-11-14 21:03:22 -08:00
Peter Johnson
5e0808c848 [wpigui] Fix Windows cmake build 2020-11-14 21:03:22 -08:00
Peter Johnson
508f05a47e [imgui] Fix typo in Windows CMake target sources 2020-11-14 21:03:22 -08:00
Prateek Machiraju
66b57f0323 [wpimath] Copy child constraint in region constraints (#2831) 2020-11-14 12:03:26 -08:00
Prateek Machiraju
cfac22b4c0 [wpilib] Reset odometry in path following examples (#2859) 2020-11-14 12:01:45 -08:00
Prateek Machiraju
2ef67f20a7 [wpilib] Add way to silence joystick connection warnings (#2845)
Warnings cannot be silenced when connected to FMS.
2020-11-14 12:00:56 -08:00
Peter Johnson
7a73946ce1 [build] Update OpenCV to remove WITH_GTK (#2856)
This avoids a false dependency on libgthread on Mac.
2020-11-13 21:18:30 -08:00
Peter Johnson
6d22b5a3c6 [wpigui] Render during resize events (#2857)
This fixes scaling and black window artifacts on Mac.
2020-11-13 21:18:08 -08:00
Prateek Machiraju
50050a0e53 [wpilibc] Update C++ DiffDriveSim example to match Java (#2839) 2020-11-13 11:12:03 -08:00
Austin Shalit
de17422793 [wpilib] Add IsJoystickConnected method (#2847) 2020-11-13 11:11:10 -08:00
Starlight220
6b5e83ce1d [wpilibj] DrivetrainSim: Initialize m_u to default value (#2854)
m_u wasn't being initialized, so if user called update() before setInputs() the program would crash with an NPE.
2020-11-13 11:06:46 -08:00
CoolSpy3
17d75d8a3b [wpilibj] SimDeviceSim: Make register device callbacks static (#2835) 2020-11-11 22:39:18 -08:00
Prateek Machiraju
616405f7ae [wpilib] Fix DiffDriveSim pose reset and example (#2837)
Calling the resetPosition method on an odometry instance expects encoder positions to be reset to zero.
2020-11-11 22:37:14 -08:00
sciencewhiz
5c2dc043cd [wpilib] Update examples to export NewCommands (#2841)
Update all examples to export NewCommands vendor dep except for pacgoat,
which still uses old commands.
2020-11-11 22:36:18 -08:00
sciencewhiz
24a3c12f31 [wpilib] Fix names and descriptions of examples (#2846) 2020-11-11 22:35:28 -08:00
Prateek Machiraju
3e544282ff [hal] Use FPGA time in HAL_SendError (#2849) 2020-11-11 22:34:36 -08:00
Prateek Machiraju
3c85a40648 [sim] Use units for voltage and current in RoboRioSim (#2853) 2020-11-11 22:33:49 -08:00
Prateek Machiraju
ac3c336b98 [wpimath] Use units for LinearSystemId Kv and Ka (#2852) 2020-11-11 22:33:04 -08:00
Prateek Machiraju
f24f282442 [build] Disable Gazebo builds when -PmakeSim is not set (#2810) 2020-11-09 11:37:10 -05:00
Peter Johnson
0dfee4745c [wpiutil] netconsoleTee: Add option to specify port (#2840) 2020-11-08 19:54:57 -08:00
Peter Johnson
eb80f7a787 [wpilibc] SendableRegistry: Add range and null checks (#2830)
If a Sendable like SendableChooser is destroyed and recreated, it leaves
a stale object in the Sendable registry. Using this object results in a
crash. This patch avoids using the stale object.

We should remove stale objects from the global registry upon object
destruction, but this fixes the crashing issue for now.

Closes #2818.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2020-11-02 18:12:40 -08:00
Peter Johnson
68fed2a1a6 [build] Update NativeUtils to 2021.0.4 (#2828)
This pulls in the 2021 versions of thirdparty libs.
2020-11-02 16:33:30 -08:00
sciencewhiz
10d118a8d0 Fix C++ gradle in OtherVersions.md (#2826) 2020-11-01 20:44:39 -08:00
Peter Johnson
e021c33191 [wpilib] Set AnalogPotentiometer dashboard type (#2825)
There's not a specific dashboard type for potentiometers, so use analog input.
2020-11-01 20:44:04 -08:00
cpapplefamily
7b7548196a [wpilib] AnalogPotentiometer: provide scaled value to Dashboard (#2824)
Previously this sent just the raw analog value; the scaled value is likely what users expect.

Co-authored-by: Corey Applegate <coreya@centralmcgowan.com>
2020-10-31 22:27:05 -07:00
Prateek Machiraju
e019c735e1 [build] Update compiler to 2021 (#2823) 2020-10-31 22:24:04 -07:00
sciencewhiz
c253f2c7e2 Update Readme to match current practice (NFC) (#2820)
- Add link to code of conduct
- Update clang version used to 10 to match CI
- Update pull request format to match current practice
- Change Azure references to Actions
2020-10-30 17:28:20 -07:00
Claudius Tewari
0ce9133b55 [wpimath] Address issues with LinearSystemLoop reset() and matrix initialization (#2819)
This address some problems with the LinearSystemLoop class that were discovered through testing.

The initial state estimate of the observer was set to the provided initial state rather than zero as previously, a non zero initial state passed into reset() would lead to a discrepancy between the current state estimate and the actual system state.
2020-10-29 18:10:48 -07:00
Prateek Machiraju
6ac9683a32 [build] Fix Gradle flags for CI documentation job (#2817) 2020-10-26 19:05:31 -07:00
Prateek Machiraju
1d7739d8da [build] Build with -PreleaseMode on tag push (#2816) 2020-10-26 09:20:10 -07:00
Peter Johnson
1de2a6d85c [build] Fix release versioning (#2815)
The way GitHub actions checks out tags checks them out as non-annotated.
2020-10-26 09:13:04 -07:00
Austin Shalit
0a723a50dc [build] Use fetch-depth: 0 to get all history (#2812) 2020-10-25 19:56:52 -07:00
Prateek Machiraju
34b91318f4 [build] Add Developer ID signing workflow (#2779) 2020-10-25 19:41:45 -07:00
Peter Johnson
b11a7114a5 [build] Bump thirdparty-opencv to 3.4.7-4 (#2811) 2020-10-25 17:40:18 -07:00
Tyler Veness
2ca5e1c8d6 Update requirements in README to include full VS install and JDK (#2808) 2020-10-25 10:44:25 -07:00
Tyler Veness
7ae8c7b247 [sim] Use DutyCycleEncoder FPGA index for sim device number (#2803)
The source channel doesn't necessarily correspond with the HALSIM device
index.
2020-10-24 20:18:58 -07:00
Austin Shalit
1e17e40868 [build] Add a javaFormat Gradle task (#2805)
This task allows developers to run all of the Java code quality tools at once.
2020-10-24 20:18:19 -07:00
Tyler Veness
1069019fd2 [wpilib] Add DutyCycleEncoderSim (#2798) 2020-10-23 20:18:49 -07:00
Peter Johnson
4422904a2e [build] Add WITH_GUI cmake option 2020-10-23 07:13:01 -07:00
Peter Johnson
5d085b78bd [build] Fix cmake shared library build
BUILD_SHARED_LIBS is a cmake built-in and must be this name.

Also check for BUILD_SHARED_LIBS with WITH_SIMULATION_MODULES.
2020-10-23 07:13:01 -07:00
Thad House
0927c73b13 [build] Update NativeUtils to latest version (#2797)
Updates compiler folder for Gradle install, and fixes a bug in the sourcelink task.
2020-10-22 21:53:16 -07:00
Prateek Machiraju
5fe8f9017f [build] Refactor CMake flags (#2788)
The CMake enable/disable flags as currently structured are a confusing mix of
WITH, WITHOUT, and USE with odd defaults.  This changes the flags to consistently
use WITH and default the build options to everything enabled.
2020-10-22 21:52:24 -07:00
Tyler Veness
5cdffeaba1 [sim] StepTiming(): incrementally step Notifiers in sequence (#2794)
Currently, StepTiming() advances the time by the given delta, then runs
any Notifiers that expired within that timeframe until their expiration
times are in the future. This doesn't reflect how the Notifiers would
actually run on a real robot. For example, if a Notifier measures the
time between calls for state-space model advancement, it would measure
a large jump in time once, then zero for subsequent runs until the
Notifier was caught up to the current time.

With this change, the time is incremented by the full delta or until the
soonest Notifier, whichever has the smaller delta, then Notifiers set to
expire at that time are run. This is repeated until the time has been
advanced by the full delta. For the state-space model Notifier situation
mentioned before, it would measure multiple small time jumps instead of
one big one.
2020-10-22 20:55:12 -07:00
Austin Shalit
6e7c7374fd [build] Globally Exclude PMD.TooManyMethods (#2793)
This was not a useful check, as every time we hit it, we simply excluded it.
2020-10-22 20:53:48 -07:00
Tyler Veness
fb7b41793b [wpilib] Add ADXRS450_GyroSim (#2800)
Closes #2760.
2020-10-22 20:40:27 -07:00
Tyler Veness
abbf9f01ab [wpilib] Fix typos in simulation classes (#2799) 2020-10-22 20:38:12 -07:00
Prateek Machiraju
17698af5e3 [wpimath] Add distance/angle constructor to Translation2d (#2791) 2020-10-20 21:22:41 -07:00
Peter Johnson
b66fcdb3f7 [sim] Fix Field2D GUI crash when collapsed (#2786)
Collapsed windows result in a vertical content size of 0.
2020-10-19 22:03:06 -07:00
sciencewhiz
7fc48b75dd [command] Add PIDSubsystem PIDController as child (#2784)
Previously, the PIDSubsystem's PID Controller would show as ungrouped in
LiveWindow.

Fixes wpilibsuite/RobotBuilder#260
2020-10-19 20:04:18 -07:00
Prateek Machiraju
07ac5370d8 [wpimath] Fix m_nextR instantiation in LinearSystemLoop ctor (#2783) 2020-10-17 16:44:55 -07:00
Tyler Veness
7c8f1cf7af [wpilib] Support scheduling functions more often than robot loop (#2766)
Currently, teams have to make a Notifier to run feedback controllers
more often than the TimedRobot loop period of 20ms (running TimedRobot
more often than this is not advised). This lets users add callbacks to
the main robot loop that run at a user-defined period. This allows
running feedback controllers more often, but does so synchronously with
TimedRobot so there aren't any thread safety issues.
2020-10-16 17:56:37 -07:00
Tyler Veness
57a97e3fb3 [wpilib] Remove WatchdogTest print statements (#2781) 2020-10-16 16:49:33 -07:00
Prateek Machiraju
061432147d [wpilib] Clean up physics simulation class APIs (#2763) 2020-10-15 21:00:45 -07:00
Tyler Veness
8f3e5794b3 [wpilib] Add TimedRobot unit tests (#2771)
To make the tests reliable, the synchronization in simulation Notifiers
had to be reworked. StepTiming() now waits for all Notifiers to reach
HAL_WaitForNotifierAlarm(), then steps the time, then lets any expired
Notifiers run.

While there, we made some variable names more descriptive and added more
comments.
2020-10-15 20:18:15 -07:00
Tyler Veness
a112b5e231 [wpilib] Fix ProfiledPIDController continuous input (#2652)
There were three bugs:

1. The input range variables used in ProfiledPIDController::Calculate()
   weren't being updated
2. The modulus error calculation was incorrect.
3. The setpoint wasn't being wrapped like the goal, so the invariant
   that the error remains less than half the input range was violated.
   (Thanks to @CptJJ for pointing this out and suggesting a fix.)
2020-10-15 20:05:23 -07:00
Austin Shalit
67859aea44 [build] Split documentation into its own job (#2775)
This also allows us to update the version of java used to build documentation.
2020-10-15 18:52:49 -07:00
Prateek Machiraju
37643ab0b2 [wpimath] Use std::lower_bound in Trajectory::Sample() calculation (#2774) 2020-10-08 20:09:30 -07:00
Austin Shalit
b0ee11f7cc [build] Update vcpkg actions to latest (#2776) 2020-10-08 20:09:02 -07:00
Dalton Smith
7647e29b21 Add docs for building robot projects with other WPILib versions (#2756) 2020-10-07 22:04:52 -07:00
Prateek Machiraju
a3e672f863 [wpimath] C++: Assign zero in MakeWhiteNoiseVector if std-dev is zero (#2773)
A std-dev of zero is UB in C++. Java does not have this issue.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2020-10-07 21:59:34 -07:00
sciencewhiz
9058fe803d [wpilib] Update docs link to stable (NFC) (#2772) 2020-10-07 21:57:50 -07:00
Tyler Veness
32f429a819 [wpimath] Move DiscretizeR() in EKF and UKF from Predict() to Correct() (#2753)
By storing the previous dt, it can be moved into Correct() where it is
actually used. This lets us take the continuous R as an argument in the
user-provided R overload.
2020-10-07 21:54:38 -07:00
Prateek Machiraju
bf26656547 [wpimath] Fix quintic spline generation from control vectors (#2762)
This does not introduce any breaking changes for teams that used the TrajectoryGenerator API for
quintic splines with poses.

The GetQuinticControlVectorsFromWaypoints() method was removed because it is not possible for us (or
would require breaking changes to the shape of the splines) to generate only one quintic control vector
per Pose2d.  Users who actually have control vectors directly (i.e. not from Pose2d objects, but a
dashboard such as PathWeaver) should have the number of control vectors correspond to the number of
"waypoints" and can call GetQuinticSplinesFromControlVectors() directly.
2020-10-04 12:51:48 -07:00
Tyler Veness
96e26247d7 [wpiutil] Add custom priority queue implementation (#2770)
This returns the removed object from pop() to avoid copies.
2020-10-04 12:49:23 -07:00
Tyler Veness
8e538aa82f [wpilibc] Make IsSimulation() checks constexpr (#2769) 2020-10-03 22:26:19 -07:00
Kevin Jaget
fa809b2c4b [wpilibc] Clean up include files (#2708)
Based on run of include-what-you-use.org to identify unused include files in various .h and .cpp files.

The changes mostly fall into 3 categories:
- Actually unused includes - copy-paste errors, not removing includes after cleaning up code, etc
- A too-broad include used where a more specific (and hopefully smaller) header will do
- Interface .h files including headers only needed by the .cpp implementation - moving from .h to .cpp
  will mean that code which uses the .h doesn't pay the price of processing the header file they don't need
2020-10-03 09:21:03 -07:00
Tyler Veness
9a63cd36cd [wpilibc] Const-qualify Watchdog comparison operator (#2767) 2020-10-03 08:36:51 -07:00
Matt
21d949daa8 [wpilibc] Add LinearSystemLoop C++ ctor to match Java (#2755)
Co-authored-by: Prateek Machiraju <prateek.machiraju@gmail.com>
2020-10-02 17:37:26 -07:00
Prateek Machiraju
330b90e046 [wpilib] Enable ArmSubsystem in ArmBot example (#2752) 2020-10-01 20:03:50 -07:00
Tyler Veness
693daafe29 [wpilib] Rename LinearSystemSim's ResetState() to SetState() (#2750)
This makes it more consistent with all other simulation classes,
including the differential drive simulation class.
2020-09-27 15:26:50 -07:00
Peter Johnson
c3b3fb8b74 [sim] Change StepTiming to wait for notifiers (#2603)
Old behavior is available via StepTimingAsync.

This makes it significantly easier to use simulation timing with notifiers.

Also update tests to use simulation framework.  This also speeds up the
timing-dependent tests by using simulation timing.  ResourceLock is used
in the Java tests to prevent parallel execution.

While we're here, tweak HAL Notifier implementation:
- Use wait_for instead of wait_until in WaitForNotifierAlarm
- Check for triggerTime = UINT64_MAX in UpdateNotifierAlarm
2020-09-27 13:27:53 -07:00
Tyler Veness
62731bea20 [wpilib] Add set functions to differential drive simulation (#2746)
All the other simulation objects already have functions like this
through LinearSystemSim.
2020-09-27 13:26:47 -07:00
Peter Johnson
c55fb583b8 [wpilibj] Watchdog: Implement equals and hashCode (#2743) 2020-09-27 13:25:56 -07:00
Prateek Machiraju
9725aff83b [wpilib] Clean up DifferentialDrivetrainSim API (#2747)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2020-09-27 13:25:17 -07:00
Tyler Veness
1320691eb4 [wpilib] Shorten differential drive simulation stability test (#2745)
If the model is unstable, it will almost always diverge within 10
seconds, and the results are rather dramatic. We're also reducing the
threshold to 100 meters because the drivetrain is moving in a small
circle. The translation norm is also used for this reason; the X
component alone regularly crosses zero since the drivetrain moves in a
circle.
2020-09-27 09:31:29 -07:00
Peter Johnson
451f67c63d [hal] SimDevice class: remove HAL_SimDeviceHandle constructor (#2744)
This isn't appropriate for a RAII class.  In particular, it can cause
foot-shooting in simulation mode if the result of
HALSIM_GetSimDeviceHandle is passed instead of HAL_CreateSimDevice.
2020-09-27 09:28:52 -07:00
Prateek Machiraju
43b1b128b1 Improve README-CMAKE.md (#2737) 2020-09-27 09:18:49 -07:00
Tyler Veness
fc991cb59c [wpilib] Clean up simulation physics API (#2739)
Some vestigial functions were never removed, and C++ single-jointed arm
sim was missing a flag for disabling gravity simulation. This is useful
for mechanisms like turrets.

Fixes #2738.
2020-09-27 00:13:59 -07:00
Prateek Machiraju
17d3d2f754 [wpilibc] Add ScopedTracer class (#2724)
This makes it easier for C++ teams to log a certain piece of code using RAII.
2020-09-27 00:10:11 -07:00
Starlight220
73950b9857 [wpilibc] RobotBase::IsReal, IsSimulation: Add doxygen comments (#2735) 2020-09-27 00:08:53 -07:00
Tyler Veness
61ee331f11 [build] Double gradle build max heap size to 2G (#2689)
The Gradle heap size is currently set to 1G, and that's becoming too
small for our Linux build.

Developers who want to override this without editing the project's
build.gradle can override these settings with gradle.properties in
GRADLE_USER_HOME (see
https://docs.gradle.org/current/userguide/build_environment.html for
details).
2020-09-27 00:07:40 -07:00
Tyler Veness
651319589c [wpilibc] Fix a use-after-free in DifferentialDrivetrainSim (#2741)
In the second constructor, a new LinearSystem is created and set to
m_plant. This takes a const ref though, so it's storing a reference to a
temporary object. After the constructor finishes, m_plant points to an
invalid object. When Update() is called, it will crash with a
segmentation fault.

This patch fixes the use-after-free by making m_plant a LinearSystem
value type. The first constructor will generate a copy, but that only
happens once.
2020-09-27 00:02:04 -07:00
Tyler Veness
5479948bd4 Update filepaths in thirdparty notices (#2713) 2020-09-24 20:51:23 -07:00
Kaitlyn Kenwell
1ec145ec87 [imgui] Add IMGUI_IMPL_OPENGL_LOADER_GL3W to cmake compile defs (#2728)
If compiled on a system with a glew header installed, it would autodetect that first and fail to link.
2020-09-24 20:21:44 -07:00
Prateek Machiraju
8ab47cb075 [wpilib] Add C++ diff-drive sim tests and fix Java test name (#2729) 2020-09-24 20:05:27 -07:00
Tyler Veness
b7b3dcf3ea Reorganize build documentation (#2712)
FasterBuilds.md was merged into README.md since it's so useful.
2020-09-24 20:03:47 -07:00
Tyler Veness
f7da0b4525 Improve list of build requirements in README (#2709)
The bulleted list was reworded to address excessive wordiness, and links
are now provided for Windows C++ compiler options.
2020-09-24 20:02:52 -07:00
Austin Shalit
f9a3380184 [build] Add macOS CMake CI (#2711) 2020-09-20 15:15:27 -07:00
Matt
b61f08d3fa [wpilib] Add physics simulation support with state-space (#2615)
This includes physics simulation support for arms/elevator models, as well as differential drivetrains.

Swerve might be added at a later date.

Co-authored-by: Claudius Tewari <cttewari@gmail.com>
Co-authored-by: Prateek Machiraju <prateek.machiraju@gmail.com>
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2020-09-20 09:39:52 -07:00
Prateek Machiraju
0503225928 [build] CMake: Fix Metal linking on macOS (#2725) 2020-09-20 09:31:20 -07:00
Peter Johnson
d4d0b5501b [wpilib] Use more inclusive terminology (NFC) (#2723) 2020-09-19 10:35:38 -07:00
Austin Shalit
6c5726c96f Add CODE_OF_CONDUCT (#2716)
This uses the contributor covenant but with an additional line about Gracious Professionalism
2020-09-17 07:47:51 -04:00
Peter Johnson
56972447b2 [wpigui] Only build static for both gradle and cmake (#2703)
Final use of wpigui is essentially always the static library.
2020-09-13 00:34:28 -07:00
Peter Johnson
67e1796ef6 [wpimath] Fix Eigen rule-of-three violations (#2707)
This avoids deprecated-copy warnings on recent clang and GCC compilers.

Applied from https://gitlab.com/libeigen/eigen/-/merge_requests/29/diffs
2020-09-12 23:01:15 -07:00
Peter Johnson
1ae8da3b3f [wpigui] Move portable-file-dialogs.h to wpigui and upgrade it (#2704)
Also split source and implementation to avoid platform headers in header.
2020-09-12 21:15:02 -07:00
Peter Johnson
3ed97f45fb [cscore] Properly init variable in usbviewer (#2702) 2020-09-12 13:48:04 -07:00
Tyler Veness
ae2809cad4 [wpimath] Update KalmanFilter C++ class docs based on Java (NFC) (#2699) 2020-09-10 14:21:04 -07:00
Tyler Veness
b0a296477e [wpimath] Use newer link to controls book in comments (NFC) (#2700) 2020-09-10 14:20:06 -07:00
Peter Johnson
629a4574db [wpimath] Include Eigen headers in cppHeadersZip (#2696) 2020-09-06 20:53:57 -07:00
Tyler Veness
4be809499d [wpimath] Use more specific Eigen includes in headers (#2693)
This helps reduce compilation overhead. I tried slimming down includes
of <Eigen/QR>, but the householderQr() function we use from there
requires including dependency headers from Eigen that don't fit with
lexographic ordering. It didn't seem worth the effort to work around.

This won't affect user code at all since all the Eigen feature usage
here is internal only; users generally only need <Eigen/Core>.
2020-09-04 20:52:03 -07:00
Peter Johnson
b10063da9a [sim] Set Encoder reset to false when count set (#2692) 2020-09-04 20:51:08 -07:00
Peter Johnson
5e54e13140 [sim] Ignore incoming websocket DS/Joystick when real DS connected 2020-09-04 16:26:46 -07:00
Peter Johnson
8f87c56312 [sim] Automatically turn off GUI DS when real DS connected 2020-09-04 16:26:46 -07:00
Peter Johnson
1b18560e90 [sim] ds_socket: Remove iostream 2020-09-04 16:26:46 -07:00
Peter Johnson
f86a5f9b09 [sim] WebSockets: don't override HAL_Main
Also clean up some other implementation aspects for cleaner shutdown and
reduce peak memory allocation.
2020-09-04 16:26:09 -07:00
Peter Johnson
f1b1bdb121 [hal] Add HAL_Shutdown and simulation shutdown callbacks
This is useful for clean shutdown of simulation extensions.
2020-09-04 16:26:09 -07:00
Peter Johnson
0365557b25 [sim] Make extension registry thread-safe 2020-09-04 16:26:09 -07:00
Peter Johnson
883d962838 [wpiutil] SimpleBufferPool: Deallocate on destruction 2020-09-04 16:26:09 -07:00
Tyler Veness
35790a8990 [wpimath] Remove rho overload from LinearQuadraticRegulator constructors (#2687)
It was added as part of Bryson's rule described in
https://file.tavsys.net/control/controls-engineering-in-frc.pdf. It
doesn't really simplify usage though, and the same thing can be
replicated by multiplying the elements of Q by rho manually. It's easier
to do it that way, it's how 3512 has been doing controller debugging for
a while, and it's probably what other teams will do as well instead of
using the "more structured" way.

Removing these unhelpful overloads also simplifies the LQR interface.
2020-09-03 20:53:17 -07:00
Matt
8edc17dac9 [wpimath] Add Vector overload for times and div (#2686) 2020-09-03 20:48:43 -07:00
Matt
502f5c8b5f [wpimath] Make LinearPlantInversionFeedforward's A and B matrices final (#2688) 2020-09-03 19:07:36 -07:00
Matt
bc28fb187c [wpimath] Remove print from LinearSystemIDTest (#2684) 2020-09-03 19:06:52 -07:00
Peter Johnson
de0277713b [sim] Add API for extensions to discover each other (#2681) 2020-09-03 10:09:01 -07:00
Peter Johnson
1593eb4d47 [sim] Add plotting to simulation GUI 2020-09-02 21:13:38 -07:00
Peter Johnson
70ba92f917 [sim] GUI: Show DS info even when GUI DS disabled 2020-09-02 21:13:38 -07:00
Peter Johnson
47cc71ea01 [hal] Add HALSIM_GetJoystickCounts 2020-09-02 21:13:38 -07:00
Peter Johnson
9453d67273 [sim] Output more error details on extension load failure (#2680) 2020-09-02 20:07:03 -07:00
sciencewhiz
f758af826d [wpilib] Use misspell to find more spelling errors (NFC) (#2679) 2020-09-02 19:41:05 -07:00
Peter Johnson
6a1e5385e5 [sim] WS: Don't call virtual function from destructor 2020-09-01 22:54:05 -07:00
Peter Johnson
63487dca76 [sim] Fix WS blank device messages (e.g. DriverStation) 2020-09-01 22:54:05 -07:00
Peter Johnson
7d6f09f5c7 [sim] SimDataValue: Fix cancellation
The uid was getting incremented by 1 during registration but not decremented
by 1 during cancellation, so cancellation didn't work correctly.

As the underlying registration ensures a non-zero result, don't increment
the result.
2020-09-01 21:32:21 -07:00
Peter Johnson
148eed3cdc [sim] Make sure NotifyListener members are initialized 2020-09-01 21:32:21 -07:00
Thad House
05701317b4 [build] Make loading sim extensions from MyRobot easier (#2671) 2020-08-31 00:34:34 -07:00
Thad House
7548fdae5d [hal] Fix InitialzeInterrupts naming (#2673)
Closes #2605
2020-08-31 00:33:49 -07:00
sciencewhiz
3e41d92c18 [wpilib] Use misspell to fix spelling errors (NFC) (#2674) 2020-08-31 00:33:11 -07:00
sciencewhiz
ad6c8b882e [hal] Fix PDP Energy Calculation (#2672)
Fixes #2642
2020-08-31 00:31:30 -07:00
Tyler Veness
947ff655c5 [wpimath] Refactor KalmanFilter to be steady-state only (#2657)
I didn't notice a performance difference between the original
implementation and this one for a flywheel simulation, so this
simplifies a lot of internals.

This class can no longer implement KalmanTypeFilter because that class
allows setting the error covariance for use in the
KalmanFilterLatencyCompensator class. This won't impact the holonomic pose
estimators that use KalmanFilterLatencyCompensator because they all use an EKF.
2020-08-30 11:46:57 -07:00
Peter Johnson
183b7c85a1 [wpigui] Handle Direct3D framebuffer resize 2020-08-30 06:48:52 -07:00
Peter Johnson
4cf6947af7 [cscore] Add wpigui-based USB camera viewer 2020-08-30 06:48:52 -07:00
Peter Johnson
b83709b269 [wpigui] Add GetDistSquared and MaxFit functions
These utility functions were moved from halsim_gui.
2020-08-30 06:48:52 -07:00
Peter Johnson
c699d55175 [wpigui] Build dev executable in cmake build 2020-08-30 06:48:52 -07:00
Peter Johnson
781afaa852 [wpigui] Refactor texture handling
The platform-specific code now only has create, update, and delete texture.
Image reading functions have been moved to common code.

Also add pixel data functions and image data functions in addition to image
file loading.
2020-08-30 06:48:52 -07:00
Peter Johnson
007b03a2c2 [hal] Fix wpiformat errors (#2670)
These were introduced in the previous commit.
2020-08-29 23:25:41 -07:00
Thad House
ed18693345 [hal] Add no throw/error version of CAN Write methods (#2063) 2020-08-29 23:07:22 -07:00
Thad House
7c99224bb7 Create maintainers.md (#1937) 2020-08-29 20:47:28 -07:00
Prateek Machiraju
c2c4090902 [build] Fix CMake imgui and wpigui on macOS (#2669) 2020-08-29 20:40:50 -07:00
Prateek Machiraju
416288061a [build] Fix Gradle build on macOS 11.0 Big Sur (#2656) 2020-08-29 20:29:49 -07:00
Thad House
83376bc231 [build] Add sourcelink support for windows pdbs (#2592)
SourceLink embeds the git repo and hash into the pdbs, which allows VS to get the source files exactly matching a pdb directly from github.

Only VS and WinDbg are supported currently, but there are issues in the vscode tools repo to enable it there.
2020-08-29 20:27:20 -07:00
Peter Johnson
c0de98f9f2 [sim] Fix GUI scaling of window sizes (#2668)
Also tweak initial sizes, positions, and visibility.
2020-08-29 15:07:12 -07:00
Peter Johnson
70db0db221 [build] Don't unconditionally regenerate wpimath numbers (#2665)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2020-08-29 15:06:49 -07: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
Peter Johnson
5d1220e629 [sim] Use wpigui for simulator GUI 2020-08-27 21:05:17 -07:00
Peter Johnson
b80fde4388 [wpigui] Add wpigui wrappers for GLFW+imgui
These hide the platform specifics behind a common C++ API.  Platforms:
 - Windows: DirectX 11 (with 10 backwards compatibility)
 - Linux: OpenGL 3
 - Mac: Metal
2020-08-27 21:05:17 -07:00
Tyler Veness
148f43b4a5 [wpilibc] Use LLVM containers in ShuffleboardInstance (#2658) 2020-08-27 20:45:14 -07:00
Austin Shalit
0d88213de5 [sim] Add missing new line to extension loader message (#2663) 2020-08-27 20:39:40 -07:00
Austin Shalit
36b8d74faa [build] Revert "[build] Apply temporary JDK arch fix (#2643)" (#2655)
This reverts commit e680ba85fa.
2020-08-27 10:25:33 -07:00
Tyler Veness
5021f28159 [wpilibc] Fix InterruptableSensorBase comment (#2659)
Fixes #2355.
2020-08-27 09:42:43 -07:00
Prateek Machiraju
ee6a814576 [wpilib] Enable continuous input on theta controller in swerve examples (#2651)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2020-08-24 19:28:20 -07:00
Prateek Machiraju
807de9a0a9 [build] Fix Eigen include path for CMake install (#2649) 2020-08-22 11:55:12 -07:00
Matt
9398b6b55b [sim] Add AnalogEncoderSim (#2647) 2020-08-19 22:59:52 -07:00
Zhiquan Yeo
932bfcf374 [sim] Add WebSocket extension (client/server) (#2589)
This allows access to HAL-level simulation data via a WebSocket connection.

The server additionally serves local files.

The following environment variables can be used for configuration:
HALSIMWS_USERROOT (server) - local directory to use for file serving for /user/ URIs, defaults to ./sim/user
HALSIMWS_SYSROOT (server) - local directory to use for file serving for all other URIs, defaults to ./sim
HALSIMWS_URI (client or server) - WebSocket URI, defaults to /wpilibws
HALSIMWS_PORT (client or server) - port number, defaults to 8080
HALSIMWS_HOST (client) - host to connect to, defaults to localhost

Co-authored-by: Zhiquan Yeo <zyeo8@bloomberg.net>
Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
Co-authored-by: jpokornyiii <jpokornyiii@gmail.com>
2020-08-19 22:14:03 -07:00
Peter Johnson
e127bac7fd [sim] Properly initialize AnalogTrigger (#2646) 2020-08-19 21:58:07 -07:00
Prateek Machiraju
bccf13bf67 [build] Run unit tests in CMake build (#2644) 2020-08-19 20:47:26 -07:00
David Vo
950bbd6dc2 [wpilibj] Fix joystick button edge synchronisation (#2433) 2020-08-19 19:46:51 -07:00
Austin Shalit
e680ba85fa [build] Apply temporary JDK arch fix (#2643) 2020-08-19 19:43:53 -07:00
Prateek Machiraju
b23ede7d50 [wpimath] Remove unnecessary copying in constraints (#2645) 2020-08-19 19:36:58 -07:00
Matt
73047d8b35 [wpiutil] Fix WPIUtilJNI.now() implementation (#2640) 2020-08-16 19:40:11 -07:00
Matt
ef5e0c2e75 [wpimath] Remove duplicate WPIMathJNI class (#2639) 2020-08-16 17:16:53 -07:00
Peter Johnson
dc9e560f9b [sim] Add callback for NotifyNewData 2020-08-15 13:47:30 -07:00
Peter Johnson
ae5b07ba01 [hal] Add stubs for sim joysticks and match info on Rio 2020-08-15 13:47:30 -07:00
Austin Shalit
3384c23a56 [build] Specify --tags on fetch and add version sanity check (#2638) 2020-08-15 13:46:41 -07:00
Tyler Veness
c2259d42a8 [wpilib] Add Toggle() function to solenoid classes (#2635)
Toggling a solenoid on a button press is a common idiom, so this
provides a more readable way of accomplishing that.
2020-08-15 08:16:32 -07:00
Austin Shalit
370e9d089f [build] Remove Azure Pipelines CI 2020-08-15 06:14:51 -07:00
Austin Shalit
cab8b18c68 [build] Add GitHub Actions CI Workflow
Testing Actions

use home env variable

Use ~ instead of home

update upload-artifact to v2

Do not specifiy branch glob

Fix architecture typo

Simplify on block

Add apt-get update step

Revert tolerance increase

Add publishing

Add vcpkg
2020-08-15 06:14:51 -07:00
Matt
3b283ab9aa [wpimath] Add core State-space classes (#2614)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: Claudius Tewari <cttewari@gmail.com>
Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
2020-08-14 23:40:33 -07:00
Matt
e5b84e2f87 [wpimath] Use project includes for units, Drake, Eigen (#2634) 2020-08-08 11:54:03 -07:00
Peter Johnson
f86417d791 [wpimath] Move MathShared.h to wpimath/ directory
It was confusing to have it in math/ when the std <math> header exists.
2020-08-07 12:02:02 -07:00
Peter Johnson
8dc3d23831 [wpimath] Move DrakeJNI to edu.wpi.first.math.WPIMathJNI 2020-08-07 12:02:02 -07:00
Peter Johnson
42993b15c6 [wpimath] Move math functionality into new wpimath library (#2629)
The wpimath library is a new library designed to separate the reusable math functionality
from the common utility library (wpiutil) and the hardware-dependent library (wpilibc/j).

Package names / include file names were NOT changed to minimize breakage.  In a future year
it would be good to revamp these for a more uniform user experience and to reduce the risk
of accidental naming conflicts.

While theoretically all of this functionality could be placed into wpiutil, several pieces
of this library (e.g. DARE) are very time-consuming to compile, so it's nice to avoid this
expense for users who only want cscore or ntcore.  It also allows for easy future separation
of build tasks vs number of workers on memory-constrained machines.

This moves the following functionality from wpiutil into wpimath:
- Eigen
- ejml
- Drake
- DARE
- wpiutil.math package (Matrix etc)
- units

And the following functionality from wpilibc/j into wpimath:
- Geometry
- Kinematics
- Spline
- Trajectory
- LinearFilter
- MedianFilter
- Feed-forward controllers
2020-08-06 23:57:39 -07:00
Peter Johnson
ad817d4f23 [sim] Map wpi::Now() to simulated FPGA time (#2631)
This matches on-robot behavior for things like NetworkTables timestamps.
2020-08-06 23:03:42 -07:00
Peter Johnson
77954bb3dd [wpiutil] Add JNI wrapper for wpi::Now() (#2632) 2020-08-06 21:37:38 -07:00
Banks T
52f7a62e1e [wpiutil] Allow aarch64 platform on any OS (#2625) 2020-08-05 13:45:09 -07:00
Peter Johnson
1b8ceb36fc [sim] Add callbacks for joysticks and match info (#2628) 2020-08-03 22:38:48 -07:00
Gabe Deml
ceea1f9d44 [sim] Add Mechanism2D to Simulation GUI (#2607) 2020-08-03 22:38:12 -07:00
Tyler Veness
2f81f2b78a [wpilib] Fix timestamp slew in SlewRateLimiter (#2627)
Fixes #2626.
2020-08-02 00:06:52 -07:00
Prateek Machiraju
aba035eb3d [command] Modify swerve and mecanum commands to use new controller 2020-08-02 00:03:21 -07:00
Prateek Machiraju
5ca2702083 [wpilib] Add HolonomicDriveController class and tests 2020-08-02 00:03:21 -07:00
Prateek Machiraju
af588adce5 [wpiutil] Add angle normalization method 2020-08-02 00:03:21 -07:00
carbotaniuman
399684a58f [wpilibc] Make SendableChooser movable (#2621)
SendableChooserBase was movable; it was an oversight that SendableChooser was not.
2020-07-30 11:34:07 -07:00
Peter Johnson
5cf4c16f5b [wpilibj] Suppress serialVersionUID warnings (#2618)
These are all classes (e.g. Exception classes) which will never be serialized.
2020-07-26 17:06:17 -07:00
Peter Johnson
0fe2319dfc [wpilibj] Use try with resources for Java tests (#2612) 2020-07-24 13:07:11 -07:00
Matt
e759dad019 [wpiutil] Add Drake and Drake JNI (#2613)
Drake is a collection of tools for analyzing robot dynamics and building control systems.
See https://drake.mit.edu/ for details.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2020-07-24 08:34:30 -07:00
Austin Shalit
0c18abed33 [build] Double gradle build max heap size to 1G (#2616)
The Gradle heap size default is 512M, and that's becoming too small for our builds.

Developers who want to override this without editing the project's build.gradle can
override these settings with gradle.properties in GRADLE_USER_HOME (see
https://docs.gradle.org/current/userguide/build_environment.html for details).
2020-07-24 08:30:22 -07:00
Austin Shalit
89dad2fd84 [build] Use artifactory doxygen mirror (#2600)
This avoids the occasional failures we've seen in downloading doxygen during CI.

Also update to doxygen 1.8.18.
2020-07-23 18:10:32 -07:00
Thad House
a6a71f8c76 [hal] Fix RoboRIO notifier never starting (#2611) 2020-07-23 18:09:00 -07:00
Zhiquan Yeo
1fee190fd0 [wpiutil] Add MIME type utility (#2608)
Co-authored-by: Zhiquan Yeo <zyeo8@bloomberg.net>
2020-07-23 10:00:47 -07:00
Peter Johnson
23ba3ca19e [wpilib] Change Watchdog to use HAL notifier (#2602)
This makes it follow simulation timing instead of wall clock time.
2020-07-21 22:58:16 -07:00
Peter Johnson
33d8363297 [sim] Fix HAL notifier race condition (#2606)
WaitForNotifierAlarm was waiting on the CV without first checking to see if
the exit condition was met.
2020-07-20 23:30:14 -07:00
Tyler Veness
49dcf7cf59 [command] Speed up MecanumControllerCommand and SwerveControllerCommand tests (#2604)
Currently, these two tests take several seconds to complete and fail
intermittently in Windows CI. This is caused by relying on wall clock
time.

Sampling the trajectory with wall clock time means the simulation must
run for several seconds to reach the end of the trajectory. Also, the
controller can become unstable when Windows CI experiences process
scheduling delays of several hundred milliseconds. Feedback controllers
don't cope well with large delays on systems with fast dynamics.

This patch uses the mocking functionality of frc::Timer to advance the
clock by 5ms at every timestep instead of using the wall clock time.
This has two benefits:

1. The tests complete much faster because the simulation can step
   forward faster than real time.
2. The controller is more stable because the sample period is uniform,
   which should fix the occasional failures.
2020-07-18 21:58:37 -07:00
Peter Johnson
9778445a74 [sim] Change stepTiming to take seconds (#2599)
This is consistent with other WPILib timer functions.
2020-07-16 22:15:59 -07:00
Peter Johnson
c2cc90b27d [sim] Move WPILib C++ sim implementations out of line (#2598)
This makes the sim classes consistent with the rest of the WPILibC classes.
2020-07-15 23:48:09 -07:00
Peter Johnson
b9feb81226 [sim] Add joystick simulation support (#2595)
This adds joystick functions to DriverStationSim, and new GenericHIDSim,
JoystickSim, and XboxControllerSim classes.
2020-07-15 00:33:57 -07:00
sciencewhiz
b06ddcdd86 [wpilib] Improve and sync AnalogPotentiometer docs (NFC) (#2580) 2020-07-13 22:00:53 -07:00
Peter Johnson
16ef372b53 [hal] Merge WaitForCachedData into WaitForDSData (#2587)
Remove WaitForCachedData as it's no longer required.

Also properly handle caching / transition detection logic that occurs at the
WPILib level.

This also changes DriverStation::IsNewControlData() to check for WPILib-level
caching instead of wrapping the HAL function.
2020-07-13 21:57:54 -07:00
sciencewhiz
f0a34ea64e [wpilib] Remove Analog Gyro specific docs from Gyro interface (#2596) 2020-07-12 15:34:28 -07:00
Prateek Machiraju
33f7dec5cf [wpilibj] Fix Gyro.getRotation2d() units bug (#2594)
The new getRotation2d() method in the Gyro interface was passing
an angle in degrees to a constructor that accepts radians.
Use fromDegrees() factory function instead.
2020-07-12 09:31:15 -07:00
Thad House
3005803598 [build] Update to latest native utils (#2591)
By default, release projects do not include symbols in the new version.
This updates that to now work correctly.
2020-07-11 23:00:18 -07:00
Thad House
eeaaf5d258 [build] Add Azure build using cmake on Windows (#2588)
More people are starting to use this build, so make sure it doesn't break.
Also tests that build succeeds with OpenCV 4.
2020-07-11 13:54:15 -07:00
sciencewhiz
15819cc981 [command] Add SimulationPeriodic to templates (#2582) 2020-07-10 21:21:31 -07:00
Thad House
fe6bfb1ba2 [cscore] Provide USB Camera VID and PID in Windows (#2585) 2020-07-10 13:16:14 -07:00
Thad House
5c8d7b2423 [build] Remove install prefix from CMakeLists.txt for Windows (#2584)
The default actually works much better.
2020-07-10 08:34:53 -07:00
sciencewhiz
ff0801d783 [build] Revert change to DeriveLineEnding made in #1961 (#2581)
Fixes windows with git autocrlf
2020-07-09 21:29:50 -07:00
Prateek Machiraju
ac4b0a3118 [wpilib] AnalogPotentiometer: Use average voltage (#2583)
Using GetAverageVoltage will reduce the noise in potentiometer reading. Potentiometers are unlikely to be used where the minimal lag averaging introduces would impact control loop stability.
2020-07-09 21:29:23 -07:00
Peter Johnson
227084e92e [hal] Implement stub mockdata on RoboRIO (#2575)
This makes it much more user-friendly to use simulation classes without needing
to ifdef for C++ to avoid linker errors or be very careful about construction
to avoid runtime errors in Java.
2020-07-07 21:49:05 -07:00
Matt
a175f6e862 [command] Add simulationPeriodic method to Subsystem (#2577)
This method is run periodically during simulation, after periodic().
2020-07-06 23:32:18 -07:00
Peter Johnson
4043c461d7 [wpiutil] HttpServerConnection: Make more functions virtual (#2576)
This allows easier customization of responses.
2020-07-06 10:12:03 -07:00
Prateek Machiraju
b3b2aa6359 [wpilib] Fix SplineHelper cubic spline bug (#2572) 2020-07-05 22:13:28 -07:00
Peter Johnson
5bd2dca463 [sim] Move HAL_LoadExtensions to end of HAL_Initialize (#2571)
Previously, HAL_InitializeDriverStation would reset any callbacks set in
extensions during load.
2020-07-05 22:12:12 -07:00
Thad House
21740fd2c5 [build] Add PDBs to jnicvstatic archives (#2573)
The tools plugin won't include them in the binary, but it will be easy to look them up if needed.
2020-07-05 22:11:42 -07:00
Peter Johnson
c11ef442fb [wpiutil] Add HttpWebSocketServerConnection (#2505)
This is a derived class of HttpServerConnection that implements the
WebSocket upgrade pieces.  This combination is pretty common so is
worth refactoring here.
2020-07-05 22:10:30 -07:00
Peter Johnson
b5a38001dd [cscore] Add support for changing the USB camera path (#2547) 2020-07-05 22:09:44 -07:00
Tyler Veness
5b6f68cf72 [wpilib] Add parentheses to MSVC #pragma message (#2569) 2020-07-05 15:24:44 -07:00
Peter Johnson
3050e935a1 [sim] Add WPILib-class-taking constructors (#2538)
When not direct mapped, make index constructors private and add factory
functions for channel and index.

Co-authored-by: GabrielDeml <gabrielddeml@gmail.com>
2020-07-04 10:10:43 -07:00
Peter Johnson
80a1fa9ece [sim] Add support for disabling SimDevices (#2568)
This allows disabling/enabling SimDevices via prefix matching.  This can be
used to force devices that normally use SimDevice in simulation mode to
instead talk directly to the hardware as in normal operation.
2020-07-04 01:09:49 -07:00
Peter Johnson
1851ba1434 [sim] Remove index from RoboRIO simulation interface (#2567) 2020-07-04 00:44:56 -07:00
Peter Johnson
c4b8a2505d [sim] Add Java wrapper for getProgramStarted (#2566)
Also move SimHooks to wpilibj (to match wpilibc).
2020-07-04 00:44:37 -07:00
Prateek Machiraju
a1d2d40ad3 [wpilib] Add RamseteController examples (#2553)
This is different from the RamseteCommand examples in that they don't use the command-based library.
2020-07-03 21:59:42 -07:00
Tyler Veness
a3881bb452 [wpilibc] Add implicit conversion from degree_t to Rotation2d (#2564)
There's already an implicit conversion for radian_t, but there's no
implicit conversion from degree_t to radian_t.
2020-07-03 21:58:19 -07:00
Thad House
6e4ee8da2b [cscore] Limit jnicvstatic exports to only C and JNI symbols (#2565)
Reduces risk even more about accidentally interfering with OpenCV.
2020-07-03 21:53:56 -07:00
Tyler Veness
2a0f79b90f [wpilib] Add X and Y component getters to Pose2d and Transform2d (#2563)
pose.Translation().X() and pose.Translation.Y() are common operations,
so shortening them to pose.X() and pose.Y() would be convenient.

Java uses the getX() convention so that is used instead of X() for Java.
2020-07-02 18:09:36 -07:00
Tyler Veness
5ccc98bc14 [wpiutil] Add angular acceleration units (#2562)
We already have predefined linear acceleration units and angular
velocity units. This makes defining acceleration constraints for angular
trapezoid profiles more convenient.

No tests were added for this because the base unit conversions are
already tested. Angular acceleration just adds another time dimension.
2020-07-01 17:16:08 -07:00
Thad House
b1353e4d6e [cscore] Fix jnicvstatic classifier (#2561)
The archive needed to be zip, additionally the library needed to statically link to cscore. All better now
2020-06-30 22:50:02 -07:00
Thad House
9f4de91554 [cscore] Add new jnicvstatic artifact type (#2560)
With the new extraction method, we would need to provide an opencv. However, all of our tools that use opencv use an alternate version of OpenCV, so that would interfere.

This adds an artifact where opencv is statically linked into cscore, but wpiutil is a shared dependency. This solves some shared state hacks, and the extraction works so much better, so its worth making this change to allow that
2020-06-30 20:39:52 -07:00
Tyler Veness
d30d1088da [wpiutil] Split units.h into separate headers for each unit (#2551)
Closes #2508.

Co-authored-by: Prateek Machiraju <prateek.machiraju@gmail.com>
2020-06-29 22:25:09 -07:00
Peter Johnson
c6e6346642 [sim] Support StepTiming() even when timing is not paused (#2558) 2020-06-29 21:52:23 -07:00
Tyler Veness
e08c8a1fc9 [wpiutil] Add circular buffer class with static size (#2542)
This complements wpi::circular_buffer which supports dynamic resizing.
2020-06-29 21:51:05 -07:00
Tyler Veness
e50dbe0c43 [wpilib] Add Gyro::GetRotation2d() (#2555) 2020-06-29 19:10:07 -07:00
Thad House
d9c7bbd046 [wpiutil] Restore existing dll directory when setting dll directory (#2559)
* Allow getting existing dll directory when setting dll directory
2020-06-29 16:33:26 -07:00
Vasista Vovveti
dac0e5b133 [sim] Set Windows timer precision to 1ms (#2557) 2020-06-28 17:45:40 -07:00
Peter Johnson
ce3bc91946 [sim] Move Sim classes from HAL to wpilibc/j (#2549)
Also move some things in HAL for consistency.

WAS:
C++:
- C APIs: #include "mockdata/AccelerometerData.h"
- User side class: #include "simulation/AccelerometerSim.h"
Java:
- JNI APIs: hal.sim.mockdata.AccelerometerData (and a few classes in hal.sim)
- User side classes: hal.sim.AccelerometerSim

IS:
C++:
- C APIs: #include "hal/simulation/AccelerometerData.h"
- C++ class: #include "frc/simulation/AccelerometerSim.h"
Java:
- JNI APIs: hal.simulation.AccelerometerData
- User side class: wpilibj.simulation.AccelerometerSim
2020-06-27 22:11:24 -07:00
Tyler Veness
22c0e2813a [build] Upgrade CI to clang-format 10.0 (#1961)
MacOS no longer ships 6.0, and Arch Linux's mesa GPU drivers are no longer compatible with LLVM 6.0.
2020-06-27 20:39:00 -07:00
Thad House
9796987d59 [wpiutil] Add new combined native class loader (#2554)
* Add new combined native class loader

Allows us to extract a list of binaries that depend on each other, and load them successfully

It is correct that there is no implementation in wpiutil for the new native method. That is a requirement, because its needed to load the libraries, and we cant load the wpiutiljni native library since it depends on wpiutil. Instead we have a separate library built with the tools plugin that handles everything
2020-06-27 18:05:14 -07:00
Peter Johnson
4d275e4767 [cscore] Fix USB camera test failure (#2556)
Introduced by camera filtering in #2532.
2020-06-27 16:14:18 -07:00
Peter Johnson
492d6c2826 [sim] Update thirdparty-imgui (#2552)
Updates the following dependencies:
- glfw to latest 3.3-stable
- imgui to 1.76
- stb to latest master

Removes libvulkan dependency.

Also adds implot.
2020-06-27 16:02:40 -07:00
Peter Johnson
765f009350 [wpiutil] Add HttpQueryMap and HttpPath/HttpPathRef (#2544) 2020-06-27 10:47:41 -07:00
Peter Johnson
629e8b41f2 [sim] Provide method to set the runtime type (#2539)
This is needed for extensions that effectively access real hardware and
want to disable the "simulation" parts of user code.
2020-06-26 20:46:13 -07:00
Peter Johnson
71c187a1ed [hal] Add GetIndex() to handles classes (#2548)
This provides a lock-free way to get just the handle index.
2020-06-26 19:56:05 -07:00
Peter Johnson
00e991e2a0 [wpiutil] Add dual-IPv4/IPv6 uv::AddrToName() (#2545) 2020-06-26 17:14:26 -07:00
Peter Johnson
8a80f97c06 [hal] Move JNI helpers and sim namespace to hal namespace (#2543) 2020-06-26 17:12:55 -07:00
Thad House
3cbec411c7 [build] Add package declaration check to checkstyle (#2446)
Co-authored-by: Austin Shalit <austinshalit@gmail.com>
2020-06-26 11:10:34 -07:00
Thad House
3bcb89fb84 Set rpath on all unix platforms to $ORIGIN (#2299)
* Set rpath on all unix platforms to $ORIGIN

Will make it possible to extract JNI libraries easier
2020-06-23 21:03:04 -07:00
Peter Johnson
62b8a36ce9 [sim] Wrap timing functions in C++ SimHooks (#2540)
These are present in Java but were missed for C++.
2020-06-20 23:47:55 -07:00
sciencewhiz
27566abb06 [command] PIDSubsystem: Add GetSetpoint (#2534)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2020-06-20 16:30:21 -07:00
sciencewhiz
dfb130270a [wpilib] Use inclusive language where practical (#2533)
Co-authored-by: Austin Shalit <austinshalit@gmail.com>
2020-06-19 23:06:34 -07:00
Thad House
1ba616f843 [build] Fix 32-bit Windows builds (#2537) 2020-06-18 21:29:48 -07:00
Peter Johnson
11fb0a4cb7 [cscore] EnumerateUsbCameras(): Only list capture devices (#2532)
Previously this would list ALL /dev/video* devices.  In recent versions of
Linux this leads to listing duplicate devices, as many USB cameras provide
both a video device and a metadata device, and only the video device can
actually be used for streaming.
2020-06-13 20:51:46 -07:00
Peter Johnson
1557a4c3b0 [sim] Make SimDeviceInfo/SimValueInfo data members public (#2531) 2020-06-13 20:50:34 -07:00
sciencewhiz
ab28a7d65f [build] Run Gradle Wrapper validation on PRs (#2527) 2020-06-11 18:28:11 -07:00
Thad House
d58a5e124a [sim] Name DSCommJoystickPacket structure (#2525)
This fixes a C++ standards compliance issue that broke the build on Windows.
2020-06-08 21:28:21 -07:00
Prateek Machiraju
762347f005 [wpilibj] Throw separate exception for constraint misbehavior (#2510)
The most common mistake users (including contributors to WPILib) seem to make while creating new constraints is ignoring some sort of edge case that causes the calculated minimum acceleration to be greater than the calculated maximum acceleration.

This specialized exception, with its detailed error message, should make it easier and quicker for said users to debug and fix bugs within their constraints.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2020-06-08 10:38:47 -07:00
sciencewhiz
4b76adf15b [wpilibc] Remove incorrect timer rollover (#2523)
If the 64 bit FPGA timer rolls over, a 32 bit value is added for
the rollover, an artifact of when it was a 32 bit timer.
The 64 bit microsecond timer won't rollover for 500k years so remove the
check for simplicity.
Fixes #2504
2020-06-08 10:37:27 -07:00
Prateek Machiraju
6be1b95241 [wpilibj] Trajectory: Add zero-arg constructor (#2513)
C++ already has this.
2020-05-29 09:18:42 -07:00
sciencewhiz
38ad790612 CONTRIBUTING.md: Change Travis to Azure (#2520)
Co-authored-by: Austin Shalit <austinshalit@gmail.com>
2020-05-29 09:17:23 -07:00
sciencewhiz
86acb27e24 [wpilibc] Fix doxygen comments (#2519)
Apply doxygen comments to class instead of frc namespace.
Correct references to differential drive.
2020-05-29 09:15:46 -07:00
Starlight220
1b395fa21d [wpilib] Implement Trajectory.equals() (#2517) 2020-05-27 20:43:32 -07:00
Starlight220
92380485c8 [command] Make cancel safe to call from initialize (#2440)
Fixes #2388.
2020-05-20 21:00:34 -07:00
Starlight220
27f9a21a2c [wpilib] Moved Watchdog output to reportWarning() (#2413) 2020-05-20 20:57:06 -07:00
Claudius Tewari
cf7088a462 [wpilibj] RamseteController: Fix units typo in javadocs (#2515) 2020-05-20 20:55:08 -07:00
Peter Johnson
67554ef3b0 [build] Add .inl files to styleguide (NFC) (#2506)
No functional changes.
2020-05-05 18:17:50 -07:00
Thad House
cf20b068ca [sim] Map HAL_GetSystemActive to HALSIM_GetDriverStationEnabled (#2501)
Vendors have requested this for testing purposes.
2020-05-01 09:05:54 -07:00
Thad House
0b9316d94a [build] Revert workaround for azure windows library loading issue (#2481) (#2499) 2020-05-01 08:56:18 -07:00
Tyler Veness
3011ebe547 [wpilibc] Fix uninitialized variable in Trajectory class (#2495)
Valgrind caught this one. If you default initialize a Trajectory, it
doesn't initialize m_totalTime. This means a subsequent call to
Trajectory::TotalTime() returns the value of an uninitialized variable.
3512's software was using 0_s as a sentinel value for when a trajectory
was empty. We didn't notice a problem before because Linux zero-inits
memory.
2020-04-26 08:03:17 -07:00
Starlight220
4b77b0773e [wpilibj] SensorUtil: change exception type (#2490)
Use IllegalArgumentException instead of IndexOutOfBoundsException.
2020-04-23 21:27:48 -07:00
Prateek Machiraju
e5935a4737 [wpilibc] Fix const-qualification in kinematics and constraints (#2478) 2020-04-13 22:32:25 -07:00
Prateek Machiraju
a3a8472b82 [wpilib] Trajectory: Add MaxVelocity and Region constraints (#2466)
Co-Authored-By: Tyler Veness <calcmogul@gmail.com>
2020-04-12 10:39:43 -07:00
Peter Johnson
212182d991 [wpilibj] Remove getSimObject (#2479)
This approach to getting the simulation object doesn't work in C++ and
creates coupling that doesn't need to be present.
2020-04-12 10:37:27 -07:00
Thad House
c82b8546bc [build] Work around azure windows library loading issue (#2481)
Temporary fix until actions/virtual-environments#707 is deployed.
2020-04-12 10:36:25 -07: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
Peter Johnson
5b0122fed4 [sim] Add NetworkTables view to Simulation GUI (#2327)
This enables seeing the tables locally, including update timestamps and
external connections.
2020-04-05 23:09:50 -07:00
Peter Johnson
b46b5df16a [wpilibc] Output Tracer to DriverStation by default (#2469)
This matches the Java behavior.

Also optimizes Java to only create a StringBuffer and call
DriverStation.reportWarning if there is data to output.
2020-04-05 23:09:21 -07:00
Prateek Machiraju
cb51029335 [wpilib] Add Color.fromHSV() static helper (#2461)
Keep AddressableLEDBuffer.setHSV() implementation separate in Java
for performance reasons.
2020-04-05 23:08:52 -07:00
Austin Shalit
e504b3ecbd [command] Add NetworkButton (#2373)
Closes #2371
2020-04-05 23:07:17 -07:00
Austin Shalit
0ad0ec0985 [wpilibj] Move button tests to button package (#2472)
Also make CommandTestBase public to facilitate this.
2020-04-05 23:05:53 -07:00
Austin Shalit
d1d32ada00 [build] Fix artifact publishing (#2471)
Add back variables block that was removed in #2457.
2020-04-05 23:05:13 -07:00
Peter Johnson
8058daa982 [sim] Add encoder rate and distance to Simulation GUI (#2470) 2020-04-05 19:53:39 -07:00
Starlight220
f4c5c0f5b5 [command] Add withName inline decorator to Java (#2420)
This is an inline decorator for setting the name of a command
(equivalent to calling setName()).

It's not possible to implement this for C++, as it would slice the derived
class to return it by value.
2020-04-05 16:11:23 -07:00
Connell Torek
2ecb8dab7d Add issue templates (#2189)
Co-authored-by: Connell Torek <51520860+ctorek@users.noreply.github.com>
2020-04-03 08:42:33 -07:00
Peter Johnson
576d427f03 [wpilib] SpeedControllerGroup: Add vector-taking constructor (#2194)
This allows the list to be constructed dynamically.

Co-authored-by: Thad House <thadhouse1@gmail.com>
2020-04-03 08:39:57 -07:00
Thad House
21aafea098 [hal] Use std::thread for Notifier thread on Rio (#2152)
This gives us more control over the thread than using the NI manager.
2020-04-03 08:38:00 -07:00
Thad House
3ed2908563 [sim] Add HALSIM accessors for encoder rate and distance (#2467) 2020-04-03 08:33:38 -07:00
Thad House
2b188b54d8 [ntcore] Always show StartLocal instances as connected (#2462)
This is useful for testing things that check IsConnected().
2020-04-02 17:58:07 -07:00
Austin Shalit
306720e63e [build] Split build logic into separate files (#2457)
This allows us to share build logic between Azure hosted and WPI hosted hardware.
2020-04-01 21:33:04 -07:00
Prateek Machiraju
a308dd4471 [wpilib] Fix SplineHelper quintic spline generation bug (#2429) 2020-04-01 20:31:29 -07:00
Prateek Machiraju
8f33d21bc2 [wpilib] Add init methods to Preferences (#2443) 2020-04-01 20:26:49 -07:00
Prateek Machiraju
b9ee3ae030 [wpilibc] Refactor Tracer functionality out of Watchdog class (#2456) 2020-04-01 20:10:28 -07:00
Starlight220
c14b87b228 [wpilibj] Refactor Tracer functionality out of Watchdog class (#2452) 2020-04-01 20:09:40 -07:00
David Vo
8a279aaf20 [build] Check SHA-256 of downloaded Gradle distribution (#2169)
https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:verification
2020-03-31 20:44:12 -07:00
sciencewhiz
3a5e541b2d [wpilibc] Add doxygen deprecated tag to deprecated methods (#2336) 2020-03-31 20:43:04 -07:00
Austin Shalit
43574128b3 Add a CODEOWNERS file (#2431) 2020-03-31 20:35:36 -07:00
sciencewhiz
e4a9903844 [build] Fix generateJavadoc dependencies (#2458)
This would previously not be correct on a clean repo (before a build was performed).
2020-03-30 16:50:58 -07:00
Armeen Mahdian
0d30108dcb [wpiutil] Endian.h: minor cleanup and improvements (#2454)
- Make use of if constexpr when possible for byte_swap
- Remove unnecessary make_unsigned_t alias (added to STL in C++14)
2020-03-28 10:35:47 -07:00
Prateek Machiraju
b7a79c70cc C++: Add Watchdog to CommandScheduler (#2437)
C++ counterpart to #2319
2020-03-28 09:29:51 -07:00
Daniel Z
6e6f28d1ac Add watchdog and epoch reporting to CommandScheduler (#2319) 2020-03-28 09:29:15 -07:00
Starlight220
d14978e549 New commands: add docs to end() (#2450)
Added documentation to prevent looping end() by scheduling commands.
2020-03-28 09:18:06 -07:00
Prateek Machiraju
1c28b729ad Move curvature_t to units namespace (#2444)
Note: this is a breaking change.
2020-03-22 22:57:52 -07:00
Thad House
303194b08b Add missing CAN definition for IO Breakout (#2394)
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
2020-03-22 22:56:07 -07:00
Prateek Machiraju
2ee3bfaa25 Make SlewRateLimiter unit declarations public (#2445) 2020-03-22 22:55:10 -07:00
Peter Johnson
029a94dd33 Remove old simulation bits (ds_nt, lowfi, print) (#2432)
These are little used, not actively maintained, and the simulation GUI
and alternative plans for physics simulation replace the functionality.
2020-03-22 22:52:19 -07:00
Prateek Machiraju
f6df9217b6 Remove static import usage in SelectCommand example (#2442) 2020-03-22 16:32:20 -07:00
Peter Johnson
184fae4ba5 DutyCycleEncoder: Set ownsDutyCycle for channel constructor (#2436)
Also close dutyCycle before closing digitalInput.
2020-03-21 10:36:31 -07:00
Prateek Machiraju
35b236651e Timer.start(): Match C++ behavior in Java (#2434) 2020-03-20 21:54:46 -07:00
Peter Johnson
c926770550 DutyCycleEncoder: Close created DigitalInput (#2435) 2020-03-20 21:47:32 -07:00
Joshua Shannon
272eaf184f DutyCycleEncoder: Fix simulation support (#2387)
The DutyCycleEncoder class initializes AnalogTrigger, which is not supported in simulation.

To avoid this, do not use AnalogTrigger (or Counter) in simulation mode.

Fixes #2367

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
2020-03-20 14:32:52 -07:00
Starlight220
56fbb1fc33 Make Ultrasonic.setAuto() static (#2419)
Ultrasonic.setAuto() has static behavior and is static in C++. Tweak docs to be clear about this.
Fixes #2417
2020-03-19 23:25:21 -07:00
Kiefer
33f6bf947e DriverStation (Java): Make getStickButton functions public (#2424)
getStickButtonPressed and getStickButtonReleased were public in C++ but not Java.
2020-03-19 23:23:33 -07:00
Peter Johnson
07326edb6b Sim GUI: Add user rename support to SimDevice list (#2426) 2020-03-19 23:21:29 -07:00
Thad House
144610151c Bump NativeUtils to enable bigobj (#2430) 2020-03-19 23:20:57 -07:00
Tyler Veness
4228d3609e Fix Watchdog epoch prints being off by three orders of magnitude (#2414)
This was caused by m_epochs storing the timestamps as nanoseconds while
the epoch printing code expects microseconds. Adding a duration cast
fixes this.

Java stores the epoch timestamps in a double as microseconds, so it
doesn't exhibit this bug. The comments were updated to make this more
obvious.

Fixes #2392.
2020-03-15 19:56:08 -07:00
Prateek Machiraju
510936a2a0 Improve Button API documentation in GenericHID (#2421) 2020-03-15 19:54:23 -07:00
Dan Katzuv
5854e284ea Convert license file to Markdown (#2190) 2020-03-14 22:18:33 -07:00
Oblarg
a732606e55 Geometry classes: remove explicit serializers/deserializers (#2312)
Jackson can do this with much less code overhead.
2020-03-14 22:15:15 -07:00
Tyler Veness
84e300739c Fix ProfiledPIDController profile direction for continuous input (#2279)
Previously, it could take the long way around. This recomputes the
profile goal with the shortest error, thus taking the shortest path.

Also removed the setpoint clamping from PIDController::SetSetpoint()
because it's unnecessary to make PIDController behave correctly for
a modular arithmetic input, and it breaks the setpoint calculation in
ProfiledPIDController otherwise.

Fixes #2277.
2020-03-14 22:13:57 -07:00
Oblarg
8edf9282c3 Timer: synchronize on lock object (#2352) 2020-03-14 22:13:04 -07:00
Peter Johnson
5a1acaaefc Update copyright dates for #2121 (#2415) 2020-03-14 22:11:36 -07:00
Joshua Shannon
4fd7c210d8 Shuffleboard: Fixed mix up of title and type parameters (#2121) 2020-03-14 22:06:57 -07:00
sciencewhiz
a26a7d217d Remove references to percent tolerance (#2380)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
2020-03-14 22:04:47 -07:00
Thad House
7b7f44d937 Use netcomm function to get target class rather then hardcoded (#2391)
It reports the correct value now, and helps for future proofing
2020-03-14 22:04:12 -07:00
Thad House
6cf89aa0f3 Fix interrupt cancellation (#2406) 2020-03-14 22:03:04 -07:00
Tyler Veness
3be83784cd Add Transform2d::Inverse() (#2407)
This is useful for undoing transformations. One application my FRC team
found was converting perspective n-point data from a "camera to target"
coordinate frame transformation to a "target to camera" coordinate frame
transformation.
2020-03-14 22:01:52 -07:00
Tyler Veness
b6c163acd7 Const-qualify frc2::Timer::HasElapsed() (#2397) 2020-02-29 20:12:31 -08:00
Thad House
05a26b7279 Fix missing Field2d package (#2386) 2020-02-21 20:50:53 -08:00
Tyler Veness
35eb90c135 Fix "'dimensionless' ambiguous symbol" error (#2382)
A typedef for units::dimensionless::dimensionless is defined, which
conflicted with the namespace when we added "using namespace
dimensionless". This patch reverts the "using namespace" directive.
"using" directives were added to pull three of the four relevant
typedefs but avoid the "dimensionless" type conflict.

This issue was first introduced in #2301.
2020-02-21 00:41:50 -08:00
Dustin Spicuzza
761f79385a Add SimulationInit and SimulationPeriodic functions (#2377)
Fixes #2375
2020-02-18 23:05:16 -08:00
Thad House
554bda3332 HAL: Expose NetComm SendConsoleLine (#2337)
This can be use to synchronize writes between threads, assuming writes all go through this and not stdout.
2020-02-18 20:44:40 -08:00
Thad House
2a968df779 Add method for releasing a waiting interrupt (#2347)
Useful for a new high level interrupt implementation.
2020-02-18 20:41:42 -08:00
sciencewhiz
30ccd13b69 Add methods for getting color of an LED (#2366)
Also fix rounding in Color.
2020-02-18 20:40:03 -08: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
Oblarg
65eab93527 Fix DifferentialDriveVoltageConstraint for tight turns w/ zero velocity (#2341) 2020-02-15 12:36:16 -08:00
sciencewhiz
a226ad8509 Set a default option for Sendable Chooser in examples (#2361) 2020-02-15 09:54:12 -08:00
Peter Johnson
31f4fd70ce Sim GUI: Fix crash when field/robot image load is canceled (#2362) 2020-02-15 09:53:21 -08:00
Dustin Spicuzza
7275ab9837 Add headerpad_max_install_names to Mac builds (#2333)
This allows dylib paths to be rewritten to a larger size by downstream tools.
2020-02-10 21:52:58 -08:00
Dustin Spicuzza
5b3facc63b TrapezoidProfile: Make units public (#2342) 2020-02-10 21:44:21 -08:00
CircuitCraft42
0f313fb9ab cmake: Improved portability of OpenCV Java binding search (#2348)
The CMake option OPENCV_JAVA_INSTALL_DIR can be set to the location
to search for the jar file. Note that the file name cannot be
changed, as, after checking several Linux package repositories,
that seems to be constant across all of them.

Fixes #2346.
2020-02-10 17:30:54 -08:00
Oblarg
05b7593e66 C++ circular_buffer: support types not implicitly convertible from int (#2350)
Also fixes two cases of returning a reference to a constant.
2020-02-08 13:35:21 -08:00
sciencewhiz
1b85066d26 Fix C++ ParallelRaceGroup multiple calls behavior (#2339)
The Java version was correct, but the C++ version would only run once.
2020-02-08 10:26:06 -08:00
sciencewhiz
e93b64f58d Add note that only a single instance of ADXRS450 is supported (#2349) 2020-02-08 10:24:18 -08:00
Oblarg
f0a18f31e7 Timer: add hasElapsed, advanceIfElapsed (#2322)
The current hasPeriodPassed() function is confusing.  In preparation for deprecating it,
add new advanceIfElapsed() function with same functionality and hasElapsed() function
which only checks that the time period has elapsed and does not advance the timer.

Also fix a couple of incorrect usages of hasPeriodPassed().
2020-02-08 10:23:29 -08:00
Vasista Vovveti
29c82527a5 Fix typo in ADXL sim double creation (#2332)
Sets m_simY to the virtual Y acceleration.
2020-02-04 20:15:25 -08:00
Peter Johnson
c165dc5e50 Simulation GUI: Add 2D field view (#2261)
The field image and robot image can be loaded or just a wireframe used.
The robot can be moved and rotated with a mouse click + drag.
The robot position is settable in robot code via the Field2d class.
2020-02-01 21:30:23 -08:00
sciencewhiz
42da07396c Add missing references to f in PIDSubsystem javadoc (#2318) 2020-01-31 19:18:17 -08:00
Jonathan Noyola
20e6c04059 Fix cmake install of hal generated files (#2320) 2020-01-31 19:18:00 -08:00
Declan Freeman-Gleason
ff5d3e5b36 RamseteController: Add setEnabled method (#2313) 2020-01-27 21:53:00 -08:00
sciencewhiz
6cc68ab503 Update MavenArtifacts.md (#2289) 2020-01-27 19:45:53 -08:00
Thad House
068465146b Fix null check order in SendableRegistry (#2314) 2020-01-27 19:43:31 -08:00
Thad House
3bcf8057d4 Add more detail to RuntimeLoader failure message (#2309)
Now specifies the C++ runtime is needed, along with more detail to make it easier to troubleshoot and not lose exception information.
2020-01-27 14:10:46 -08:00
David Vo
8039a6c525 Add missing include to ShuffleboardEventImportance (#2310) 2020-01-26 21:03:15 -08:00
Prateek Machiraju
558c020cca Fix duplicated state when using quintic splines (#2307)
Generating a trajectory using quintic splines caused a duplicated state at all knot points.
2020-01-24 23:10:28 -08:00
Prateek Machiraju
7797da78f5 Add missing methods to Timed and TimedSkeleton templates (#2306) 2020-01-24 20:01:23 -08:00
Oblarg
0ab81d768f Add feed-forward and slew rate limiting to advanced drive examples (#2301) 2020-01-23 18:07:38 -08:00
Oblarg
1cee5ccb93 Feed RobotDrive watchdog in RamseteCommand example (#2298) 2020-01-23 17:41:45 -08:00
Dan Katzuv
3ce01b5ac2 Fix DriveSubsystem.getHeading Java documentation (#2282) 2020-01-23 16:46:53 -08:00
sciencewhiz
e6aa8f3ff4 Update toolchain link in readme (#2304) 2020-01-23 16:43:06 -08:00
Peter Johnson
9d7b087972 Simulation GUI: Add support for custom names (#2292)
This allows users to right click on just about any name in the GUI (e.g. "PWM[0]") and rename it (e.g. "Left Motor [0]"). The index portion is not editable. The name is saved into imgui.ini so it's persistent.
2020-01-20 22:47:36 -08:00
Peter Johnson
bb184ed481 Simulation GUI: Refactor ini saving (#2291) 2020-01-20 21:49:03 -08:00
Peter Johnson
b9b31069cc Fix C++ POVButton (#2294)
Also add unit test.
2020-01-20 21:35:19 -08:00
Peter Johnson
d0cf4e8882 Change sim Filesystem.getDeployDirectory() to src/main/deploy (#2293) 2020-01-19 16:34:45 -08:00
sciencewhiz
02fb850761 Add new speed controllers to shuffleboard docs (#2288)
Also fix java links in C++ docs and a few typos.
2020-01-19 14:26:44 -08:00
sciencewhiz
ac8177e10d Fix GearsBot log methods not being called periodically (#2280)
Add logging for C++ Wrist and Claw
2020-01-17 20:18:15 -08:00
Tyler Veness
2eb5c54476 TrapezoidProfile: Fix aliasing of m_initial to result in calculate() (#2284)
Fixes #2283.
2020-01-17 20:17:21 -08:00
Peter Johnson
0e206e69cf Remove Set Camera Server Shared message (#2285) 2020-01-17 20:16:24 -08:00
Peter Johnson
b1357cace7 Fix LiveWindow SetEnabled C++ std::bad_function_call (#2281)
It was missing a null check.
2020-01-16 00:34:51 -08:00
Thad House
37202b6f28 Add missing SensorUtil::kAnalogOutputs (#2276) 2020-01-15 21:34:28 -08:00
Thad House
2ac0d52960 Remove AnalogTrigger::SetDutyCycle (#2275) 2020-01-15 21:33:58 -08:00
Thad House
dbe1e6f466 Fix missing SetDutyCycleSimDevice on Rio (#2274) 2020-01-15 21:33:35 -08:00
Chris Russell
a61fcbd68d Make Button class concrete (#2244) 2020-01-15 18:59:51 -08:00
Thad House
fe597eeba1 Fix SPI DIO count for sim (#2272)
Only 26 DIO were detectable, not 31.
2020-01-15 18:58:14 -08:00
Jonathan Leitschuh
e213a47efd Official Gradle Wrapper Validation GitHub Action (#2273)
See: https://github.com/gradle/wrapper-validation-action
2020-01-15 14:21:50 -08:00
Peter Johnson
dcb96cb50c TrajectoryGenerator: Allow replacement of error reporting function (C++) (#2267)
C++ version of #2234.
2020-01-13 20:36:16 -08:00
Austin Shalit
60d48fec57 Fix Java static colors having zero values (#2269)
Also add test for this.
2020-01-13 12:21:44 -08:00
Austin Shalit
ee8475d21f Run wpiformat (#2270) 2020-01-13 12:19:08 -08:00
Peter Johnson
f47e318131 C++ units: Interoperate with Windows headers min/max (#2268) 2020-01-12 22:52:36 -08:00
Thad House
cb66bcca3c Add callback handlers for LiveWindow (#2053)
Fixes #2223
2020-01-12 22:37:24 -08:00
Simon Abrelat
73302f6162 Fix color name typos (#2265) 2020-01-12 22:15:19 -08:00
Oblarg
cba21a768f Fix C++ JoystickButton and POVButton (#2259)
C++ JoystickButton and POVButton were both nonfunctional due to slicing when trigger passes itself by value to the button scheduler it creates.

Fix is to remove the virtual Get() method entirely and use only the m_isActive functor; since the subclass now passes the button condition back as a functor to the base class, in which it's stored as a member, it will now still work after being sliced.
2020-01-12 14:57:28 -08:00
Peter Johnson
822e75ec45 Simulator GUI: Handle save file having window size=0 (#2260)
This should never happen, but if it does, it's not recoverable without
either deleting imgui.ini or editing it manually.
2020-01-12 01:37:53 -08:00
Peter Johnson
108ddfa1b4 Fix Pi Camera auto exposure property name (#2258) 2020-01-11 15:04:29 -08:00
Prateek Machiraju
d4c8ee5915 Add Axis enum in XboxController (#2253) 2020-01-10 23:43:19 -08:00
Peter Johnson
ab9647ff5b CommandScheduler: Don't store NetworkTableEntry 2020-01-10 23:42:18 -08:00
Peter Johnson
6666d3be42 SendableBuilder: Allow multiple updateTable functions
This fixes cases like CommandScheduler not working when added to both
LiveWindow and SmartDashboard.
2020-01-10 23:42:18 -08:00
Peter Johnson
795086b4cf Fix Demangle when used standalone (#2256) 2020-01-10 23:41:40 -08:00
Peter Johnson
56765cf49a C++ CommandBase: Don't add to LiveWindow (#2255) 2020-01-10 20:37:49 -08:00
Peter Johnson
bf7012fa2d Fix new CommandScheduler.cancelAll() (#2251)
When called outside the run loop, it would result in a CME in Java.
2020-01-10 16:10:16 -08:00
Peter Johnson
10e8fdb724 Make C++ IterativeRobotBase and RobotBase constructor and destructor public (#2242) 2020-01-08 23:17:12 -08:00
Peter Johnson
790dc552ca Add quirks support for Pi camera (#2241)
- Valid video modes (native modes plus some low-res modes)
- Exposure setting
2020-01-07 20:21:28 -08:00
Peter Johnson
0ec8ed6c05 Make C++ controller using declarations public (#2240) 2020-01-06 23:30:47 -08:00
Tyler Veness
832693617f Add missing definition for PIDController::SetPID() (#2239)
Fixes #2238.
2020-01-06 21:17:16 -08:00
sciencewhiz
772ef8f961 Update Maven location to artifactory (#2235) 2020-01-06 20:13:42 -08:00
Peter Johnson
95b6cd2dd9 TrajectoryGenerator: Allow replacement of error reporting function (#2234)
This is needed to avoid use of DriverStation if used from desktop applications
such as PathWeaver.
2020-01-05 16:01:31 -08:00
sciencewhiz
ce1ac17dfb Remove experimental from new command example descriptions (#2226) 2020-01-04 19:57:31 -08:00
Thad House
b2f7a6b651 Add clarification to LED about length and # of drivers (#2231) 2020-01-04 19:57:10 -08:00
Peter Johnson
bedbef7999 Revert "Remove -no-module-directories flag from javadoc build (#2201)" (#2229)
This reverts commit f9a11cce5e.
2020-01-04 19:52:43 -08:00
Thad House
bc159a92a7 Default sim voltage to 12v, make user rails active (#2224) 2020-01-04 15:07:47 -08:00
Austin Shalit
f50d710a5e Make color ctor public (#2222) 2020-01-04 08:28:18 -08:00
Peter Johnson
bc8f68bec7 Add sim HAL_WaitForCachedControlData (#2221) 2020-01-03 22:38:45 -08:00
Peter Johnson
32c62449be Add ArrayRef overloads to new command classes (#2216)
Also default requirements to {} in all cases for consistency.
2020-01-01 20:09:17 -08:00
Tyler Veness
6190fcb237 Run wpiformat (#2218) 2020-01-01 20:04:56 -08:00
Declan Freeman-Gleason
012d93b2bd Use an explicit stack instead of recursion when parameterizing splines (#2197)
This PR changes the spline parameterizer to use an explicit stack instead of recursion. This is motivated by the fact that splines with adjacent waypoints with approximately opposite headings will never parameterize. In this case the parameterizer subdivides these malformed splines fine for a while, and then gets stuck parameterizing infinitely on some interval. In the recursive approach, this would lead to a stack overflow. We could implement a recursion depth counter (this is what my team did on our similar trajectory code last season), but it's hard to choose a good number for max depth because the initial amount of stack used varies based on how the user calls Parameterize.

A good solution for this is converting the recursion to an "explicit stack," which basically simulates recursion, but allows us to have a much larger maximum stack size. Because we avoid the stack overflow, we can instead throws a more informative MalformedSplineException. If the user is using the TrajectoryGenerator instead of the SplineParameterizer directly then the TrajectoryGenerator will go ahead and catch the exception, return a harmless empty trajectory, and report and error to the driver station.
2020-01-01 18:23:08 -08:00
Matt
222669dc2c Fix trapezoidal profile PID controller setpoint bug (#2210)
Co-Authored-By: Austin Shalit <austinshalit@gmail.com>
2020-01-01 15:23:25 -08:00
Peter Johnson
abe25b795b TrajectoryUtil.toPathweaverJson: Create parent directories (#2214) 2020-01-01 13:35:04 -08:00
sciencewhiz
354185189c Update ProjectYear to 2020 (#2212) 2020-01-01 11:14:31 -08:00
sciencewhiz
f14fe434a1 Add (Old) qualifier to old subsystem (#2211) 2019-12-31 23:00:35 -06:00
Prateek Machiraju
e874ba9313 Add Color classes for use with AddressableLED (#2127)
Both floating point and 8-bit integer classes are included, as well as a wide selection of color constants.

Co-authored-by: Austin Shalit <austinshalit@gmail.com>
2019-12-30 00:01:20 -06:00
Peter Johnson
96348e835a Fix C++ SendableRegistry::AddChild() (#2207)
Add a Sendable* overload so pointers to sendable objects work appropriately.
Otherwise an AddLW(this) in a child (which is a Sendable*) could be a
different pointer than a void* to the same object.

For example:
  AnalogInput constructor calls AddLW(this)
  AnalogPotentiometer constructor calls AddChild(analog input pointer)

Also add handling for the child object moving (if it's Sendable).
2019-12-29 23:37:14 -06:00
Oblarg
d91796f8d2 fix clang-format version number (#2206) 2019-12-29 21:31:26 -06:00
Peter Johnson
9abce8eb06 Fix subsystem LiveWindow usage (#2202) 2019-12-29 21:28:38 -06:00
Peter Johnson
8b4508ad53 Use default path for networktables.ini in simulation (#2205) 2019-12-29 18:55:02 -06:00
Oblarg
5b7dd186d2 Add templates for new commands for vscode plugin (#2016) 2019-12-29 15:02:49 -06:00
Peter Johnson
6ea13ea8f3 ntcore: Add support for local-only operation (#2204)
StartLocal() causes future calls to StartServer() or StartClient() to have
no effect. StopLocal() re-enables these calls.
2019-12-29 14:56:41 -06:00
Oblarg
44bcf7fb4d Java examples: use non-static imports for constants (#2191) 2019-12-29 14:55:49 -06:00
Oblarg
c7a1dfc0bc Add SlewRateLimiter class (#2192)
This is extremely useful for implementing various "ramping" functions
(such as voltage ramps, setpoint ramps, etc). Usage is straightforward;
it behaves like all of our other filter classes. C++ version is unit-safe.
2019-12-29 13:36:28 -06:00
Peter Johnson
a12bb447e4 Fail cmake build if python3 generate_numbers.py fails (#2203) 2019-12-29 13:12:00 -06:00
Declan Freeman-Gleason
c4bd54ef44 Add JNI binding to suppress driver station error/warning messages (#2200)
This is to allow suppressing an ugly stack trace/error message in a unit test in #2197. It doesn't support the full HALSIM_SetSendError callback stuff (i.e. you can only suppress, not intercept, stack traces with this).
2019-12-27 21:11:26 -06:00
Austin Shalit
f9a11cce5e Remove -no-module-directories flag from javadoc build (#2201) 2019-12-27 10:19:49 -06:00
Peter Johnson
6008671c30 Report WPILib version as part of usage reporting (#2199) 2019-12-26 22:34:10 -06:00
Peter Johnson
7b952d599d Add usage reporting for many new things (#2184)
- new CommandScheduler
- kinematics and odometry classes
- new PIDController
- ProfiledPIDController
- TrapezoidProfile (reported in Constraints class)

Also update instances.txt to match latest NI version.

One side effect is that a couple of classes are no longer constexpr.
2019-12-25 00:42:14 -06:00
Peter Johnson
93cdf68694 Add Constants.cpp for MecanumControllerCommand example (#2196) 2019-12-24 16:19:02 -06:00
Peter Johnson
0c6f24562f Fix bug in ULEB128 decoding (#2195) 2019-12-24 14:12:42 -06:00
Thad House
bdc1cab013 Add support for configuring SPI Auto Stall Config (#2193) 2019-12-24 12:52:58 -06:00
Prateek Machiraju
3259cffc63 Add transform methods to Trajectory (#2187) 2019-12-23 13:16:30 -06:00
Oblarg
67b59f2b31 Minor improvements/fixes to new command framework (#2186) 2019-12-23 01:09:25 -06:00
sciencewhiz
1ce24a7a2f Add 2020 speed controllers (#2188)
Add CTRE TalonFX (PWMTalonFX)
Add Playing with Fusion Venom (PWMVenom)
2019-12-22 13:51:43 -06:00
Prateek Machiraju
635882a9f7 Add getter for initial pose in Trajectory (#2180) 2019-12-21 06:57:39 -08:00
Thad House
71a22861eb Use ManagedStatic for CameraServer (#2174) 2019-12-20 14:20:38 -08:00
Thad House
9cb69c5b46 Add a way to pass in a preconstructed value to ManagedStatic (#2175)
A lot of our cases don't need the lazy construction, but do need manual destruction.
2019-12-20 14:06:22 -08:00
Thad House
5e08bb28f8 Add docs and lifecycle tasks for faster dev builds (#2182) 2019-12-20 13:48:26 -08:00
Oblarg
ea4d1a39e1 Update characterization values to match real robot (#2183)
This is in preparation for an end-to-end trajectory tutorial example.

Co-Authored-By: Dalton Smith <gamefollower26@gmail.com>
2019-12-20 13:46:13 -08:00
Prateek Machiraju
31b588d961 Fix ArmFeedforward Javadocs (#2176) 2019-12-15 14:34:18 -08:00
Thad House
0b80d566ad Use ChipObject HMB function for LED (#2173)
It's fixed in v9 and up.
2019-12-14 21:15:32 -08:00
Peter Johnson
f8294e689b Sim GUI: Add a bit of spacing to the analog inputs (#2170)
This helps make it clear they are separate controls.
2019-12-14 10:49:01 -08:00
Peter Johnson
b78f115fcf Work around VS2019 16.4.0 bugs (#2171)
Work around frontend bug in scoped_lock and code generation bug in reverse_iterator in gtest.

See https://github.com/google/googletest/pull/2635
2019-12-14 10:48:19 -08:00
sciencewhiz
b468c51251 Change AddressableLED example to use consistent PWM port (#2168) 2019-12-11 15:39:36 -08:00
Prateek Machiraju
023c088290 Add toString() to relevant kinematics classes (#2160) 2019-12-09 21:35:43 -08:00
Thad House
8a11d13a39 Fix C++ DutyCycleEncoder int constructor (#2166) 2019-12-09 21:35:00 -08:00
Claudius Tewari
daa81c64a7 Minor javadoc fix in SwerveDriveKinematicsConstraint (#2167) 2019-12-09 21:34:32 -08:00
Peter Johnson
e20d96ea4e Use __has_include for WPILib.h (#2164)
Now that commands and cameraserver libraries are no longer direct dependencies,
it's necessary to check for their presence.
2019-12-07 21:39:58 -08:00
Thad House
a76d006a07 Update native-utils to 2020.7.2 (#2161)
Fixes a bug where source directories were being added to the header search path
2019-12-07 17:18:50 -08:00
Thad House
24c031d692 Increase SPI auto byte count to allow 32 bytes to be sent (#2163)
The FPGA now supports 32 bytes.
2019-12-07 17:18:25 -08:00
Thad House
6b4eecf5fe Add hidden functions to get the SPI system and SPI DMA (#2162)
With the addition of stall configuration, its not very clear how it works, and seems like it would be different
per use. So adding ways to manually get them, so the functionality can be figured out how to be used.
2019-12-07 17:16:14 -08:00
Oblarg
ccdd0fbdb2 Add TrapezoidProfile external PID examples (#2131) 2019-12-07 13:37:54 -08:00
Tyler Veness
5c6b8a0f45 Replace std::is_pod_v with std::is_standard_layout_v (#2159)
The former is deprecated in C++20.
2019-12-07 13:34:52 -08:00
Thad House
67d2fed685 Add DutyCycleEncoder channel constructor (#2158)
Avoids extra boilerplate at user level.
2019-12-06 20:58:04 -08:00
Thad House
d8f11eb149 Hardcode channels for LSB weight (#2153)
Avoids a mutex and a lookup.
2019-12-06 20:56:40 -08:00
Thad House
b2ae75acd8 Add way to disable "no extensions found" message (#2134)
We want it enabled by default, but there have been requests for a way to disable it.
2019-12-06 20:55:36 -08:00
Austin Shalit
4f951789fe Build testbench tests online inorder to improve speed (#2144)
* Attempt to build testbench tests online inorder to improve speed

* Fix contianer reference

* Start to remove jenkins shell script

* Change job names

* Remove sshpass

* Remove teststand code

* Copy test results back

* Fix build by using athena container

* Fail if any command fails

* Remove jenkins test script

* Remove name argument

* Fix param count

* Add build display name

* Fix scp to copy into dir

* Update display names

* Update stage name

* Fix test results scp

* Create local test report dir

* Remove commented out old code

* Remove force pseudo-terminal allocation

* Remove extra variables

* Update readme

* Remove old test runs

* Update license header
2019-12-06 17:46:29 -05:00
Austin Shalit
005c4c5beb Try catch around task dependencies to fix loading in editor (#2156) 2019-12-06 11:46:21 -08:00
Tyler Veness
34f6b3f4c0 Fix C++ RamseteCommand param doxygen (#2157) 2019-12-05 23:54:32 -08:00
Oblarg
f7a93713fa Fix up templated TrapezoidProfile classes (#2151)
* Fix two-phase name lookup bug

* Fix param in ProfiledPIDCommand constructor overload

* Fix ProfiledPIDCommand/Controller
2019-12-04 20:40:37 -08:00
Tyler Veness
8c2ff94d70 Rename MathUtils to MathUtil for consistency with other util classes (#2155) 2019-12-04 20:39:12 -08:00
Thad House
d003ec2dc9 Update to 2020v9 image (#2154)
- Fix VISA include and FPGA header
- Fix missing VISA lib from executables
2019-12-04 20:38:43 -08:00
Peter Johnson
8e7cc3fe78 Add user-friendly SimDeviceSim wrappers (#2150)
This makes unit testing with SimDevice devices much easier.
2019-12-02 23:27:33 -08:00
Matt
6c8f6cf479 Fix bug in cubic and quintic hermetic spline generation (#2139)
Add documentation for spline derivatives and explicitly zero matrices.
2019-12-01 21:29:52 -08:00
Peter Johnson
e37ecd33ae Sim GUI: Add support for LED displays (#2138)
LED displays connect the LEDs in various ways (column major vs row major,
different starting locations, serpentine connection order), so add
configuration parameters for these options.
2019-12-01 21:28:02 -08:00
Prateek Machiraju
57c5523d67 Fix documentation in RamseteCommand (#2149) 2019-12-01 21:27:02 -08:00
Matt
7b9c6ebc2f Fix wpiutilJNIShared linkage typo in wpilibj (#2143) 2019-12-01 13:25:46 -08:00
Oblarg
9a515c80f8 Template C++ LinearFilter to work with unit types (#2142) 2019-11-30 23:12:02 -08:00
Prateek Machiraju
5b73c17f25 Remove encoder velocities methods in DifferentialDriveOdometry (#2147)
It doesn't make sense to continue to provide a less accurate method of performing odometry
when a more accurate method using distances exists.

This also removes the need to pass DifferentialDriveKinematics to the constructor.
2019-11-30 23:10:29 -08:00
Banks T
b8c1024261 Fix PS3Eye VID and PID (#2146) 2019-11-30 12:35:47 -08:00
Prateek Machiraju
2622c6c291 Add default values for b and zeta in RamseteController (#2145)
Values b=2.0 and zeta=0.7 have been well-tested to produce desirable results.
2019-11-29 21:16:01 -08:00
Austin Shalit
f66ae59992 Add HSV helpers to AddressableLED (#2135)
Also change the setLED() method to setRGB() for consistency and clarity.

Add rainbow example to demonstrate HSV usage.
2019-11-29 15:16:57 -08:00
Oblarg
5e97c81d80 Add MedianFilter class for moving-window median (#2136)
This kind of filter is extremely useful for signals that are susceptible to sudden
outliers - ultrasonics, 1-D LIDAR, and results from vision processing are all
good use-cases.

This also modifies the existing ultrasonic examples accordingly.
2019-11-29 15:13:40 -08:00
Tyler Veness
f79b7a058a Remove unnecessary constructor arg for LinearFilter's circular buffers (#2140)
They are initialized in LinearFilter's constructor, so the default is
never used.
2019-11-28 23:27:20 -08:00
Austin Shalit
e49494830f Replace Jenkins with Azure agent (#1914) 2019-11-25 22:00:35 -08:00
sciencewhiz
b67d049ac2 Check status of PDP CAN reads (#2126)
Fixes #2124
2019-11-25 21:47:35 -08:00
Peter Johnson
70102a60b7 SendableRegistry.foreachLiveWindow: Prevent concurrent modification (#2129)
Copy the internal map values into an array before iterating.

In C++, change to recursive mutex as well.
2019-11-25 21:47:06 -08:00
Oblarg
6dcd2b0e2c Improve various subsystem APIs (#2130)
Improves the APIs for various prebuilt subsystems (PIDSubsystem, TrapezoidProfileSubsystem, ProfiledPIDSubsystem). Addresses #2128, and also changes the rather cumbersome getSetpoint API to a more intuitive setSetpoint one. Updates examples to match.
2019-11-25 21:46:47 -08:00
Thad House
ce3973435e HAL_CAN_ReceiveMessage: return MessageNotFound if no callbacks registered (#2133) 2019-11-25 21:45:44 -08:00
Thad House
3fcfc8ea72 Fix double disable segfaulting interrupts (#2132)
Also fixes DigitalOutput not closing correctly.
2019-11-25 21:43:58 -08:00
sciencewhiz
6ceafe3cd0 Fix class reference for logger (#2123) 2019-11-23 07:47:02 -08:00
Peter Johnson
b058dcf64e Catch exceptions generated by OpenCV in cscore JNI (#2118) 2019-11-22 08:12:17 -08:00
Tyler Veness
0b9307fdf3 Remove unused parts of .styleguide files (#2119) 2019-11-22 06:34:58 -08:00
Peter Johnson
39be812b2e Fix C++ ArmFeedforward (#2120) 2019-11-22 06:31:32 -08:00
Oblarg
21e957ee42 Add DifferentialDrive voltage constraint (#2075) 2019-11-21 21:43:02 -08:00
Oblarg
e0bc97f66b Add ProfiledPIDSubsystem example (#2076) 2019-11-21 20:55:16 -08:00
Modelmat
3df44c874d Remove Rotation2d.h wpi/math include (#2117) 2019-11-21 19:54:29 -08:00
CTT
a58dbec8aa Add holonomic follower examples (#2052) 2019-11-21 19:52:56 -08:00
Tyler Veness
9a8067465c Fix incomplete .styleguide (#2113)
Also clean up other .styleguides.

Fixes #2111.
2019-11-20 22:44:18 -08:00
Tyler Veness
ffa4b907c0 Fix C++ floating point literal formatting (#2114)
Found formatting errors with this regex
"([^a-z0-9\.]\.[0-9]|[^a-z0-9\.][0-9]\.[^a-z0-9\.])" and ignored false
positives.

Fixes #2112.
2019-11-20 21:48:15 -08:00
Oblarg
3d1ca856b2 Fix missing typename and return type (#2115) 2019-11-20 21:46:33 -08:00
Austin Shalit
5f85457a97 Add usage reporting for AddressableLED (#2108) 2019-11-20 20:13:39 -08:00
Austin Shalit
4ebae17123 Enforce leading/trailing zeros in Java numeric constants (#2105)
Enforce that integer literals must not have leading zeros and that floating point literals must have leading or trailing zeros in Java.
2019-11-20 20:13:15 -08:00
Oblarg
fa85fbfc1c Template C++ TrapezoidProfile and ProfiledPIDController on units (#2109) 2019-11-20 20:11:46 -08:00
Thad House
f62e23f1af Add Doxygen for new HAL interfaces (#2110) 2019-11-20 16:21:07 -08:00
Thad House
5443fdabc1 Directly construct PWM port from HAL, avoid wpilib PWM object (#2106) 2019-11-20 14:48:14 -08:00
Austin Shalit
c0e36df9d8 Standardize on PWMVictorSPX in examples (#2104) 2019-11-19 21:48:22 -08:00
Oblarg
8c4d9f5415 Add TrapezoidProfileSubsystem (#2077)
Adds a subsystem that continually runs a TrapezoidProfile, for composition with offboard PID controllers.
2019-11-19 12:38:42 -08:00
Prateek Machiraju
45201d15fc Add encoder distance overload to DifferentialDriveOdometry (#2096)
Also force encoders to be reset to zero on pose reset.
2019-11-19 09:56:34 -08:00
Tyler Veness
845aba33fe Make feedforward classes constexpr (#2103)
ArmFeedforward::Calculate() can't be made constexpr because std::cos()
and thus units::math::cos() is not constexpr.

Fixes #2101.
2019-11-19 06:47:59 -08:00
Thad House
500c43fb84 Add examples for DMA, DutyCycle, DutyCycleEncoder and AddressableLED (#2100) 2019-11-18 22:12:17 -08:00
Prateek Machiraju
5891628112 Use DifferentialDriveWheelSpeeds in RamseteCommand ctor (#2091) 2019-11-18 22:11:05 -08:00
Thad House
b37b68daaf Add JRE deployment to MyRobot Deploy (#2099) 2019-11-18 19:52:56 -08:00
Oblarg
0e83c65d27 Fix small logic error in ParallelDeadlineGroup (#2095) 2019-11-18 15:33:45 -08:00
Thad House
6f6c6da9f5 Updates to addressable LED (#2098)
Only PWM Headers are supported, so enforce that.

Also fixes some init checks and init order checks.
2019-11-18 15:25:04 -08:00
Thad House
1894219ef6 Fix devmain package in commands (#2097) 2019-11-18 15:24:04 -08:00
Peter Johnson
77a9949bbf Add AddressableLED simulation GUI support 2019-11-18 00:51:59 -08:00
Peter Johnson
a4c9e4ec28 Add AddressableLED simulation support 2019-11-18 00:51:59 -08:00
Thad House
8ed2059074 Add AddressableLED (#2092) 2019-11-17 16:39:38 -08:00
Thad House
59507b12dc Bump to 2020 v7 image (#2086) 2019-11-15 21:51:31 -08:00
Peter Johnson
5d39bf8065 Make halsimgui::DrawLEDs() values parameter const (#2088) 2019-11-15 20:29:51 -08:00
Prateek Machiraju
841ef91c0f Use gyro angle instead of robot angle for odometry (#2081)
The odometry classes previously took in the robot angle as an argument, meaning that users had to take care of offsetting the gyro themselves to accurately report the robot angle. This change will make it so that users will not have to worry about resetting gyros and adding offsets themselves, as this will be handled by the odometry classes.
2019-11-15 17:34:10 -08:00
Tyler Veness
1b66ead49d Use standard constant for pi instead of 3.14 (#2084) 2019-11-15 17:33:18 -08:00
Thad House
db2c3dddd7 Use DMA Global Number for DMA Index (#2085) 2019-11-15 17:32:29 -08:00
Thad House
82b2170feb Add DMA support to HAL and WPILibC (#2080) 2019-11-14 22:52:34 -08:00
Thad House
8280b7e3af Add DutyCycleEncoder and AnalogEncoder (#2040) 2019-11-14 22:51:33 -08:00
Thad House
5510960068 Use kNumSystems for DutyCycle count in Ports (#2083) 2019-11-14 12:15:47 -08:00
Thad House
df10652183 Remove release configs of deploy in MyRobot (#2082)
Bug in lower level library causes having both be broken. So for now just removed release.

Issue created in low level library to fix
2019-11-14 12:15:36 -08:00
Thad House
bf5388393e Add deploy options to myRobot (#2079)
Will only deploy to USB by default, and will not deploy the JRE, but will deploy a Java app.
2019-11-13 22:45:19 -08:00
Thad House
b7bc1ea745 Update to 2020v6 image (#2078) 2019-11-13 21:35:52 -08:00
Thad House
708009cd20 Update to gradle 6.0 (#2074) 2019-11-12 17:14:04 -08:00
Thad House
3cce61b89f Add SmartDashboard::GetEntry function in C++ (#2064)
Existed in Java already.
2019-11-12 17:11:32 -08:00
CTT
565e1f3e79 Fix spelling in MecanumDriveOdometry docs (#2072) 2019-11-11 23:25:09 -08:00
Peter Johnson
1853f7b6b7 Add timing window to simulation GUI
This shows the FPGA time and notifier timing, and has buttons to
start/pause/step the simulation.

The GUI also pauses DS new data notifications when paused.  This could be
done globally instead by blocking NotifyNewData at the HAL level?
2019-11-11 22:03:29 -08:00
Peter Johnson
c5a0497124 Add simulation pause/resume/step support
Calling HALSIM_PauseTiming pauses the FPGA clock and notifiers.
Calling HALSIM_ResumeTiming resumes the FPGA clock and notifiers.
Calling HALSIM_StepTiming steps the FPGA clock and runs applicable notifiers.

This will effectively pause TimedRobot and any other notifier-based events,
but of course will not pause user threads that do not use the notifier (e.g.
image processing).
2019-11-11 22:03:29 -08:00
Peter Johnson
f5446c7409 Add Notifier HALSIM access 2019-11-11 22:03:29 -08:00
Peter Johnson
3e049e02f0 Add name to HAL Notifier 2019-11-11 22:03:29 -08:00
David Vo
2da64d15f6 Make usage reporting enums type match (#2069)
This changes the C++ HALUsageReporting enums to have an
explicit type which matches the HAL_Report parameter
types.  In practice this shouldn't change much except
for tooling that might be parsing this header.
2019-11-11 21:38:49 -08:00
David Vo
f04d95e50f Make FRCUsageReporting.h C-compatible (#2070)
Now that HAL_Report has been moved into FRCUsageReporting.h,
this should also be C-compatible.

This also removes the C++ ifdef guard in HAL.h.
2019-11-11 21:38:24 -08:00
sciencewhiz
d748c67a54 Generate docs for command libraries and fix doclint enable (#2071) 2019-11-11 21:38:04 -08:00
Prateek Machiraju
55a7f2b4ad Add template for old command-based style (#2031) 2019-11-10 23:20:33 -08:00
CTT
486fa9c696 Add XboxController examples for arcade and tank drive (#2058) 2019-11-10 22:53:17 -08:00
Oblarg
e3dd1c5d77 Fix small bug in SplineHelper (#2061)
Also add comments for clamped cubic solution.
2019-11-10 22:52:24 -08:00
Oblarg
7dc7c71b58 Add feedforward components (#2045)
Add helper classes for computing feedforwards with parameters supplied by the characterization tool.
2019-11-09 20:16:42 -08:00
Oblarg
5f33d6af12 Fix ProfiledPIDSubsystem parameter name (#2017)
Change from goal to setpoint (these are two different things).
2019-11-09 09:16:50 -08:00
sciencewhiz
94843adb8f Standardize documentation of Speed Controllers bounds (#2043)
Some were in constructor docs, some in init function docs, and some
inline in code. Move them all to class docs.
2019-11-09 09:14:53 -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
Thad House
326aecc9a0 Add error message for CAN Write Overrun (#2062) 2019-11-08 22:51:11 -08:00
Oblarg
00228678d4 Add requirements param to more Command APIs (#2059)
Assorted improvements to the ergonomics of declaring requirements in the new
command framework. C++ requirements list parameters have been defaulted
to an empty list, some missing C++ requirements list parameters have been
added, and both C++ and Java have been given requirements list params in
various InstantCommand wrapper methods (#2049), whose value is
forwarded to the command.
2019-11-08 18:30:30 -08:00
Thad House
ff39a96cee Make DigitalOutput a DigitalSource (#2054)
It's perfectly safe to use as a DigitalSource, and can enable some cool tricks.
2019-11-07 20:03:43 -08:00
Thad House
5ccad2e8a4 Fix frc2::Timer returning incorrect timestamp values (#2057) 2019-11-07 20:02:27 -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
Thad House
6858a57f72 Make notifier command tests a lot more lenient (#2056)
They don't need to be testing timing, just that the command starts and stops.
2019-11-07 17:26:29 -08:00
Thad House
0ebe32823a Fix MyRobotStatic accidentally linking to shared command libs (#2046) 2019-11-06 14:06:04 -08:00
Thad House
384d00f9e6 Fix various duty cycle bugs (#2047) 2019-11-06 14:05:25 -08:00
Thad House
1f6850adf2 Add CAN Manufacturer for Studica (#2050) 2019-11-06 14:04:27 -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
Peter Johnson
f5b4be16db Old C++ Command: Make GetName et al public (#2042)
These used to be effectively public due to SendableBase, and are public
in the Java version.
2019-11-05 20:53:40 -08:00
Peter Johnson
e6f5c93ab1 Clean up new C++ commands (#2027)
- Remove use of std::set. The only place std::set was actually used was in ParallelRaceGroup,
but this was of minimal utility as ParallelRaceGroup checked for duplicate subsystem
requirements, so it would be very unusual to end up with duplicate commands
in any case; replaced it with a vector.
- Remove use of std::unordered_map except for SelectCommand. Replaced with vector.
- Use pImpl idiom for CommandScheduler
- Minimize include files (remove unnecessary ones)
- Reformat include file order for consistency
2019-11-05 20:52:49 -08:00
Thad House
39f46ceab6 Don't allow rising and falling values to be read from AnalogTrigger (#2039)
They can't be caught from user code
2019-11-05 20:42:01 -08:00
Thad House
d93aa2b6b2 Add missing lock in FRCDriverStation (#2034)
Switch newDataCounter to atomic
2019-11-05 20:41:16 -08:00
Austin Shalit
114ddaf81f Fix duplicate encoders in examples (#2033) 2019-11-03 09:08:05 -08:00
Peter Johnson
f22d0961e3 Sim GUI: Add duty cycle support 2019-11-02 21:43:57 -07:00
Peter Johnson
3262c2badb Sim GUI: Use new multi-channel PDP getter function 2019-11-02 21:43:57 -07:00
Peter Johnson
96d40192ae Revert accidental change to MyRobot.cpp (#2029) 2019-11-02 21:06:22 -07:00
carbotaniuman
ed30d5d40e Add JSON support for Trajectories (#2025) 2019-11-02 11:35:03 -07:00
Peter Johnson
2b6811eddb Fix null pointer dereference in C++ CommandScheduler (#2023)
Java has a null check that was missing in C++ when adding default commands.
2019-11-01 23:42:01 -07:00
Thad House
1d695a1660 Add FPGA Duty Cycle support (#1987) 2019-11-01 23:41:30 -07:00
Thad House
509819d83f Split the two command implementations into separate libraries (#2012)
This will allow us at the user code side to determine to include old commands, new commands or both.
2019-11-01 21:58:54 -07:00
Thad House
2ad15cae19 Add multi PDP getter and sim PCM/PDP multi arg functions (#2014) 2019-11-01 21:55:35 -07:00
Thad House
931b8ceefd Add new usage reporting types from 2020v5 (#2026) 2019-11-01 21:54:17 -07:00
Tyler Veness
0b3821eba3 Change files with CRLF line endings to LF (#2022) 2019-11-01 20:26:05 -07:00
Thad House
6f159d1426 Add way to atomically check for new data, and wait otherwise (#2015) 2019-11-01 17:09:28 -07:00
Austin Shalit
a769f1f227 Fix bug in RamseteCommand (using degrees instead of radians) (#2020) 2019-11-01 13:21:02 -07:00
Oblarg
c5186d8159 Clean up PIDCommand (#2010)
PIDCommand uses a function based (callback) model, so functions designed for use in derived classes are of limited utility.
2019-11-01 13:11:55 -07:00
Oblarg
9ebd23d61e Add setVoltage method to SpeedController (#1997)
Add a voltage-compensated setVoltage method to SpeedController, which is sorely needed to help teams use feedforward-based controls effectively. Also uses correct units on the cpp side.

Also update relevant examples.
2019-11-01 09:32:40 -07:00
Prateek Machiraju
f6e311ef86 Fix SplineHelper bug (#2018)
Add unit test to check interior waypoints
2019-11-01 09:28:11 -07:00
Oblarg
f33bd9f050 Fix NPE in RamseteCommand (#2019) 2019-11-01 09:26:48 -07:00
Thad House
1c1e0c9a6a Add HAL_SetAllSolenoids to sim (#2004) 2019-10-30 21:29:35 -07:00
Thad House
ea9bb651a3 Remove accidental OpenCV link from wpilibc shared library (#2013) 2019-10-30 21:28:45 -07:00
Oblarg
cc07425182 Change command decorators to return implementation (#2007)
Changes Command decorators to return actual implementation classes rather than Commands. Previously, decorated commands were not Sendable, which was a problem. Also, there's no real reason not to expose the implementation details here, as we're extremely unlikely to change the implementations in the future.
2019-10-30 21:28:08 -07: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
Thad House
669127e49c Update intellisense to work with Beta 2020 code (#2008)
Needed to fix case when both rio and raspbian compilers installed, along with C++17 intellisense.
2019-10-29 21:36:13 -07:00
Thad House
9dc30797e4 Fix usage reporting indices (#2009)
According to NI, 0 is unspecified, and all the indices need to be
index + 1, so the first index becomes 1.
2019-10-29 21:34:10 -07:00
Thad House
f6b844ea30 Move HAL Interrupt struct to anonymous namespace (#2003) 2019-10-28 22:32:28 -07:00
Thad House
a72f809911 Add extern C to DigitalGlitchFilterJNI (#2002) 2019-10-28 22:30:04 -07:00
Thad House
916596cb01 Fix invalid examples json, add validator (#2001) 2019-10-28 20:10:05 -07:00
Peter Johnson
5509a8e968 Use constexpr for all example constants
Also make DifferentialDriveKinematics constructor constexpr.
2019-10-28 09:19:41 -07:00
Peter Johnson
0be6b64756 Use constexpr for DifferentialDriveKinematics 2019-10-28 09:19:41 -07:00
Thad House
936627bd94 wpilibc: Remove direct CameraServer dependency (#1989)
This makes linking easier, particularly for third party vendors and other language wrappers.
2019-10-27 08:37:30 -07:00
Prateek Machiraju
8e333c0aad Use FPGA Time instead of wall clock time for odometry (#1996) 2019-10-27 07:57:35 -07:00
sciencewhiz
d4430b765e Gearsbot example: Use standard argument order (#1995)
The convention is to put the subsystem last.
2019-10-27 06:28:29 -07:00
Oblarg
75438ab2ce Add RamseteCommand (#1951) 2019-10-26 21:33:41 -07:00
Thad House
989df1b461 Bump Native Utils and OpenCV dependencies (#1993)
OpenCV doesn't change anything other then the hash file. NativeUtils is needed to get the newest compiler.
2019-10-26 16:21:29 -07:00
Oblarg
dbc33b61e1 Fix Timer usage in TrapezoidProfileCommand (#1992) 2019-10-26 12:50:30 -07:00
Oblarg
79f8c5644a Add TrapezoidProfileCommand (#1962) 2019-10-26 09:58:13 -07:00
Prateek Machiraju
9440edf2b5 Refactor TrajectoryGenerator (#1972) 2019-10-26 09:39:47 -07:00
Oblarg
73a30182c3 Add frc2::Timer (#1968)
This is a unit-safe version of frc::Timer.
Undo previous (#1815) deprecation of parts of frc::Timer.
2019-10-26 08:21:40 -07:00
Banks T
36ea865edc Add toString for geometry and trajectory classes (#1991) 2019-10-26 08:18:56 -07:00
Oblarg
cbe05e7e8a Update ProfiledPIDController API (#1967) 2019-10-24 20:37:55 -07:00
Tyler Veness
d04eb35465 Deprecate old PID classes (#1964)
PIDBase was only used by the old PIDController, which is deprecated.
PIDInterface is only used by PIDBase, and that's deprecated by this
commit.
2019-10-24 20:32:31 -07:00
Thad House
02264db69c Add JNI dependencies to myRobotCpp (#1980)
That way it's a bit easier to test the Java builds.
2019-10-24 20:31:07 -07:00
Banks T
2a76c996eb Use VID/PID detection for PS3Eye (#1977) 2019-10-24 20:28:21 -07:00
Thad House
a3820bbdfa Remove HAL_BaseInitialize (#1981) 2019-10-24 20:26:11 -07:00
Thad House
a83fb47933 Update to 2020v5 image (#1983)
* Update to 2020v5 image
2019-10-24 12:14:22 -07:00
CTT
4b0ed910ee Make SwerveDriveKinematics.toChassisSpeeds() public (#1976) 2019-10-24 09:13:04 -07:00
Thad House
103c1b121c Remove DS caching from the HAL level (#1971)
With updates to netcomm, this is no longer required.
2019-10-23 20:25:07 -07:00
Peter Johnson
6635ea75ee Fix NPE in SendableRegistry.foreachLiveWindow() (#1974) 2019-10-22 21:12:07 -07:00
sciencewhiz
cfe23c5cd0 Fix grammar error in comment for configureButtonBindings (#1969) 2019-10-22 19:59:15 -07:00
Thad House
4bde2654e2 Fix mac azure build (#1973)
Build was broken due to an azure image change.
2019-10-22 19:58:48 -07:00
Prateek Machiraju
4f034e6c14 generateTrajectory: default reversed param to false (#1953) 2019-10-21 16:21:46 -07:00
Peter Johnson
acf960f729 Sim GUI: Add option to disable outputs on DS disable 2019-10-21 16:16:17 -07:00
Peter Johnson
2d3dac99f0 Sim GUI: Handle low resolutions and scale default window positions
Low resolutions result in a maximized window and forced user scaling down
(by default, can still be changed by the user).
2019-10-21 16:16:17 -07:00
Peter Johnson
07c86e0cd5 Sim GUI: Support High DPI monitors
Add user setting for scaling on top of DPI scaling.
Add user setting for visual style (light/dark/normal).
Save window position, size, maximized state, scale, and style to ini file.
2019-10-21 16:16:17 -07:00
Peter Johnson
46ad95512e SimDeviceData: Add missing null check 2019-10-21 16:16:17 -07:00
Peter Johnson
5bce489b98 Add ProggyDotted font to imgui (both cmake and gradle) 2019-10-21 16:16:17 -07:00
Peter Johnson
55af553acc Simulation GUI: Map gamepad the same way as DS 2019-10-21 16:16:17 -07:00
Peter Johnson
c59f9cea5f CameraServer: Add VID/PID support for Linux USB devices (#1960) 2019-10-20 14:12:00 -07:00
carbotaniuman
3fc89c84d6 Make splinePointsFromSplines public (#1963) 2019-10-20 14:11:17 -07:00
Peter Johnson
2c50937975 Fix implicitly deleted move constructors (#1954)
These were incorrect and exhibited as warnings on more recent versions of
clang (notably on Mac).

- Use pointers instead of references internally in GenericHID and *Drive
- Leave PIDBase, PIDController, and Resource non-moveable
- Remove the atomic from m_disabled in NidecBrushless
- Make Timer and Trigger copyable as well as moveable
- Implement custom move constructor/assignment for SendableChooserBase

Also comment out some unused variables that caused clang warnings.
2019-10-19 11:36:44 -07:00
Peter Johnson
f3ad927f45 Update Java SmartDashboard and LiveWindow to match C++ 2019-10-19 11:36:24 -07:00
Peter Johnson
05c25deb7b Fix move handling of C++ Sendable in SmartDashboard and LiveWindow 2019-10-19 11:36:24 -07:00
Peter Johnson
d726591ce4 Fix Gazebo sim plugin build (#1959) 2019-10-19 11:35:56 -07:00
Peter Johnson
2ff694fa49 Unbreak gradle build when other compilers installed (#1958)
There was dependency breakage in halsim_gui, which is only available on desktop.
2019-10-19 09:50:49 -07:00
Oblarg
53816155ba Improve command decorator names (#1945) 2019-10-19 08:13:33 -07:00
Peter Johnson
a38f183a98 Fix GenResources.cmake so it's usable in a submodule (#1956)
This is only important for projects that reference this repo as a submodule.
2019-10-18 17:24:47 -07:00
Peter Johnson
b3398dca39 Set gradlebase correctly for all examples (#1950) 2019-10-18 11:39:31 -07:00
Banks T
2c311013d4 Add Aarch64Bionic platform detection (#1922) 2019-10-18 08:03:48 -07:00
Prateek Machiraju
c10f2003c5 Add generateTrajectory overload (#1944)
Add an overload for the generateTrajectory method that accepts a DifferentialDriveKinematics instance instead of a list of constraints. This instance is used to automatically create a DifferentialDriveKinematicsConstraint behind the scenes, saving the user some verbosity.
2019-10-18 08:02:42 -07:00
Prateek Machiraju
63cfa64fb3 Add getters for pose in odometry classes (#1943) 2019-10-18 07:58:22 -07:00
Oblarg
2402c2bad7 Fix C++ command group recursive constructor bug (#1941)
Passing command groups as lvalue-references to other command groups should be illegal, as their copy constructors have been deleted. However, copy constructors are const-qualified. This led to a very obscure bug where passing a command group by lvalue to another command group would result in a valid template expansion 'looking like' a copy constructor, and being preferred to the deleted copy constructor. This would result in constructor recursion (the expanded constructor would, in an attempt to call the copy constructor, call itself), and an eventual segfault when the stack inevitably overflowed.

This fixes the problem by explicitly deleting the problematic constructor signature - attempting to do this now (correctly) generates a compilation error.
2019-10-18 07:57:43 -07:00
Oblarg
f4eedf597f Fix ConcurrentModificationException in CommandScheduler (#1938) 2019-10-18 07:56:12 -07:00
Matt
bb0b207d2f Fix array out of bounds exception caused by parallel race group (#1935)
The current index would be set to -1 by the execute method of ParallelRaceGroup,
and then an index out of bounds exception would be thrown by the end() method of
SequentialCommandGroup. This change bound checks the current command index as well
as only calls end at the end of parallel race group rather than during execute.
2019-10-18 07:55:14 -07:00
sciencewhiz
7bd69e591c Fix typo in temperature (#1940) 2019-10-14 16:16:30 -07:00
Thad House
ec9738245d Bump to 2020 v4 image (#1931) 2019-10-10 10:11:59 -07:00
Thad House
46303a8221 Add messaging to extension loading in the HAL (#1926) 2019-10-09 22:25:02 -07:00
sciencewhiz
d169d6be9e Set extract_static for Doxygen config so that static members show up (#1930)
Update Doxygen to 1.8.16
2019-10-09 22:24:45 -07:00
Thad House
4e183eb104 Bump to 2020 v3 image (#1929) 2019-10-09 22:24:17 -07:00
Peter Johnson
84c185803d LiveWindow: catch errors in callback/builder functions (#1921)
This prevents LiveWindow bugs from crashing the entire robot program.
Instead, an error is printed and the object is removed from LiveWindow.
2019-10-09 22:22:30 -07:00
Thad House
0e3b0f3da7 Remove deprecated free() calls (#1925)
Replaced with the standard close()
2019-10-08 21:30:33 -07:00
Thad House
7f839b87ce Remove timeouts from azure builds (#1924)
Windows builds are occasionally crossing 1 hour and failing
2019-10-07 20:47:01 -07:00
Thad House
45b766a5dc Fix main thread ID being potentially incorrect for simulation (#1923) 2019-10-07 20:45:33 -07:00
Banks T
56d782b16c Add secondary camera name for PS3Eye (#1920) 2019-10-06 22:18:49 -07:00
Peter Johnson
2b4894038e Add simulation GUI plugin
This uses Dear Imgui to provide a cross-platform integrated GUI for robot
simulation. The GUI provides fully integrated DS and joystick support so it's
not necessary to run the official DS.
2019-10-06 17:28:39 -07:00
Peter Johnson
f97d16073a Add imgui build to cmake 2019-10-06 17:28:39 -07:00
Peter Johnson
55a844a3e1 HAL sim: Add encoder channel B access 2019-10-06 17:28:39 -07:00
Peter Johnson
10deba8546 Remove sendables from SendableRegistry when close() is called (#1917)
This only affected Java (C++ RAII doesn't have the same problem).

Needed to add close/AutoCloseable to several classes to add this behavior.
2019-10-05 23:42:53 -07:00
Peter Johnson
a9f0e46680 Implement sim devices for ADXL345, ADXL362, ADXRS450, Ultrasonic
This makes the halsim_adx_gyro_accelerometer simulation plugin and
the accelerometer part of lowfi_simulation obsolete.
2019-10-05 22:39:00 -07:00
Peter Johnson
aa90645865 Add ability to associate other devices with a SimDevice
Implemented only for AnalogInput, DIO, and Encoder.
2019-10-05 22:39:00 -07:00
Peter Johnson
81c2c8a7de Add simulation generic device/value support
This allows high-level library classes to implement enhanced simulation
support even if no low-level corresponding simulation library exists, and
avoids the need for bit-banging complex interfaces like SPI or CAN.
2019-10-05 22:39:00 -07:00
Peter Johnson
e8d6f8a2c1 Move mockdata/HAL_Value.h to hal/Value.h
Also prefix the MakeBoolean et al functions with HAL_ to avoid namespace
pollution.
2019-10-05 22:39:00 -07:00
Peter Johnson
1b266717a8 Add simulation module support to cmake build (#1906) 2019-10-04 19:08:57 -07:00
Thad House
fb8f3bd06b Add testbench yaml file (#1915) 2019-10-04 15:09:35 -07:00
Thad House
846d8def00 Update to 2020 v2 image (#1913)
* Update to 2020 v2 image
2019-10-02 13:14:30 -07:00
Thad House
d6ac6e512b Fix PortForwarder package declaration (#1912) 2019-09-30 15:13:09 -07:00
Banks T
2271570860 Fix PS3Eye exposure setting (#1911) 2019-09-30 15:09:39 -07:00
Peter Johnson
885744d7e1 Add myRobot C++ version to cmake build (#1907) 2019-09-29 20:36:28 -07:00
sciencewhiz
366091fa87 Document that ConditionalCommand requires all subsystems (#1909)
Fixes #1683
Fixes typo
2019-09-29 20:35:41 -07:00
sciencewhiz
c58b072c89 Fix Drive usage reporting order (#1908)
Fixes #1893
2019-09-29 20:35:04 -07:00
sciencewhiz
762c88adb8 Update compiler versions in readme (#1905) 2019-09-29 16:56:11 -07:00
Tyler Veness
af8ce568d1 Add Ramsete unicycle controller (#1790) 2019-09-29 16:48:12 -07:00
Tyler Veness
b2c2934d05 Fix javadoc warnings about invalid usage of ">" (#1904)
The trajectory gen docs use "->". ">" has been replaced with "&gt;".
2019-09-29 16:38:48 -07:00
Tyler Veness
cce26ec78e Replace CRLF line endings with LF (#1902) 2019-09-28 19:55:50 -07:00
Thad House
cb54602d49 Add support for writing RTR CAN Frames to the CAN API (#1900) 2019-09-28 16:49:34 -07:00
Thad House
9f740e5905 Use OS for serial port instead of NI VISA (#1875) 2019-09-28 16:49:11 -07:00
Peter Johnson
b23baf611a Add ability to run robot main loop in a separate thread (#1895)
Default behavior is still to run the robot main loop in the main thread.

The ability to run the robot main loop in a separate thread and add a hook
for running a different function in the main thread is needed for simulation
GUI support on some platforms.
2019-09-28 15:43:24 -07:00
Prateek Machiraju
457f94ba26 Add trajectory generation using hermite splines (#1843) 2019-09-28 15:40:56 -07:00
Thad House
fd612052f3 Update native utils to use new frchome directory (#1884) 2019-09-28 15:40:02 -07:00
Thad House
8858ec55c7 Remove periodic can read call (#1868)
It is not necessary anymore, and is a complicated and confusing API to keep around.
2019-09-28 15:38:58 -07:00
CodingWithFusion
41efb8015d Update CANAPITypes.h (#1860)
Add Playing With Fusion to CAN manufacturer list.
2019-09-28 15:33:18 -07:00
Thad House
c93be1b2d5 Remove LabVIEW HAL support (#1901) 2019-09-28 15:31:43 -07:00
Thad House
680f8919ed Remove eigen, units and libuv from doxygen generation (#1898) 2019-09-28 08:28:31 -07:00
Thad House
c5812524f8 Bump GradleJNI plugin version (#1899)
Fixes an issue where the symbol check task doesn't always run.
2019-09-28 08:28:02 -07:00
Peter Johnson
971303da8c Add PortForwarder class (#1890)
This class provides an easy way to forward local ports to another host/port.
This is primarily useful to provide a way to access Ethernet-connected devices
from a computer tethered to the RoboRIO USB port.

The most natural spot to put the shared implementation of this class was into
wpiutil, so a wpiutilJNI library has been added.
2019-09-26 22:53:21 -07:00
hjelstromboli
50db77bf25 Fix wpiutil cmake eigen install source directory (#1891) 2019-09-16 12:54:13 -05:00
Oblarg
85d42c1993 C++ PIDCommand: Add GetMeasurement() and UseOutput() (#1892)
These are in the Java version but were missed in C++.
2019-09-16 12:53:03 -05:00
Prateek Machiraju
2dfbb855d7 wpilibj: Fix SwerveDriveKinematics ctor parameter name (#1889) 2019-09-15 14:53:21 -05:00
Peter Johnson
471f375a38 Simplify Sendable interface (#1864)
This removes the name and subsystem from individual objects, and instead
puts this data into a new singleton class, SendableRegistry.  Much of
LiveWindow has been refactored into SendableRegistry.

In C++, a new CRTP helper class, SendableHelper, has been added to provide
move and destruction functionality.

Shims for GetName, SetName, GetSubsystem, and SetSubsystem have been added
to Command and Subsystem (both old and new), and also to SendableHelper to
prevent code breakage.

This deprecates SendableBase in preparation for future removal.
2019-09-14 15:22:54 -05:00
Tyler Veness
1d8c4d016f Replace ::value and ::type with _v and _t suffixes (#1885) 2019-09-13 22:14:37 -05:00
Rishab Rao
a5650b9439 Add Units Utility class for Java (#1829)
Units conversion class to convert between commonly used units.

Co-Authored-By: Austin Shalit <austinshalit@gmail.com>
2019-09-12 13:38:25 -05:00
Tyler Veness
904479ad43 Deprecate GearTooth class for removal (#1878)
It only works with a specific sensor that isn't available anymore, the
class is a trivial wrapper around a Counter, and no one uses this class
according to FMS usage reporting.
2019-09-08 13:21:36 -05:00
Prateek Machiraju
86b666bba9 Add equality comparator to geometry classes (#1882) 2019-09-08 13:20:26 -05:00
Tyler Veness
62f07c182c Make one-arg Rotation2d constructor implicit (#1883)
Since a value in radians is always a rotation, it makes sense to provide
an implicit constructor for this for convenience with Pose2d's
constructor.
2019-09-08 13:15:07 -05:00
Prateek Machiraju
f405582f86 Add kinematics suite (#1787)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: Matt <matthew.morley.ca@gmail.com>
2019-09-07 23:11:49 -05:00
Tyler Veness
561cbbd144 Deprecate Filter class for removal (#1876) 2019-09-07 23:02:44 -05:00
Tyler Veness
84e2973aaa Remove unused include from Filesystem.h (#1877) 2019-09-07 23:01:57 -05:00
Thad House
f49859ebfd Remove NI VISA headers, as they are now included in NI Libraries (#1879) 2019-09-07 23:01:27 -05:00
Thad House
bc59db5e6f Rename DEBUG macro to DEBUG0 (#1871)
This avoids conflicts with the platform DEBUG macro on some platforms.
2019-09-06 20:45:52 -05:00
Thad House
dd928b4cbf Remove JNI logging (#1872) 2019-09-06 20:42:40 -05:00
Peter Johnson
3e0f7d0995 Use units for new NotifierCommand (#1869) 2019-09-04 22:54:49 -05:00
Thad House
5ffe15d5ff Remove ability to build all combined artifacts (#1867) 2019-09-04 13:06:46 -07:00
Thad House
516cbef2c4 Remove RoboRIO ifdef from simulation headers (#1859) 2019-09-03 19:55:17 -07:00
Tyler Veness
9b6ffc201c Replace SetOutputRange() with SetIntegratorRange()
If users are attempting to use the output range to limit the controller
action, they should use ProfiledPIDController instead. If they actually
intended to clamp the output, they should use std::clamp().
2019-09-03 19:46:59 -07:00
Tyler Veness
ff8b8f0a8a Remove percent tolerance from PID controller
It breaks the unit system badly; the tolerance member variable has
different units depending on percent vs absolute. Absolute tolerance is
a lot more natural than percent tolerance anyway.
2019-09-03 19:46:59 -07:00
Peter Johnson
0ca8d667d2 Clean up AutoCloseable and other Java warnings (#1866) 2019-09-03 19:44:24 -07:00
Tyler Veness
7112add67f Watchdog: use units::second_t instead of double (#1863)
Fixes #1827.
2019-09-03 15:58:31 -07:00
Peter Johnson
761bc3ef85 Change C++ WaitCommand to use units (#1865)
Also remove unique_ptr usage.
2019-09-02 23:39:51 -07:00
Tyler Veness
1fb3011235 Add MathUtils.clamp() for Java (#1861)
Also use std::clamp() and MathUtils.clamp() in as many places as
possible in place of custom clamp functions or if statements.
2019-08-28 23:24:30 -07:00
Peter Johnson
eb3e0c9c95 Fix cmake Eigen include directory (#1862)
This currently only breaks when cmake is configured with WITH_TESTS but
ultimately this would have affected wpilibc builds too.
2019-08-28 23:24:08 -07:00
Tyler Veness
2250b7fbe3 Rename GearsBotNew example to GearsBot 2019-08-28 22:08:59 -07:00
Tyler Veness
c9f9feff1f Replace deprecated API usage in C++ examples
Since there is a new version of GearsBot using the new command-based
API, the old GearsBot is just removed.

PR #1842 is being included to verify this PR is correct.
2019-08-28 22:08:59 -07:00
Dalton Smith
d6b9c7e148 CONTRIBUTING.md: Point to frc-docs instead of screensteps (#1858) 2019-08-28 22:08:17 -07:00
Thad House
d10a1a7977 Fix eigen build in vcpkg (#1856) 2019-08-27 14:38:23 -07:00
Tyler Veness
2bdb443255 Add frc2 includes to list of "other lib" regexes (#1855) 2019-08-26 23:11:07 -07:00
Sam Carlberg
4b2b21d247 Replace outdated Java collections (#508) 2019-08-26 22:47:18 -07:00
Thad House
8993ce5bf1 Move Eigen headers out of main include folder (#1854)
This allows using Eigen as a separate cmake package, e.g. for vcpkg.
2019-08-26 21:22:41 -07:00
LilTiger
0f532a1174 Add PWMSparkMax (#1751) 2019-08-26 20:29:20 -07:00
Thad House
f7ad363d86 Add jni cross compile options for aarch64 (#1853) 2019-08-26 11:56:35 -07:00
Thad House
9afea33403 Add support for aarch64 jetson bionic builds (#1844) 2019-08-26 09:49:58 -07:00
Peter Johnson
d787b5d609 Add more items to .gitignore (#1850)
- compile_commands.json
- .clang
- .clangd/
2019-08-25 23:30:04 -07:00
Peter Johnson
5dd0d1b7db Use units in SPI 2019-08-25 22:52:48 -07:00
Peter Johnson
07ac711b31 Fix units deprecated warning in IterativeRobot 2019-08-25 22:52:48 -07:00
Peter Johnson
decfd858b8 Correctly report -1 for POV on disconnected joystick (#1852) 2019-08-25 22:51:54 -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
Peter Johnson
a0be07c370 Refactor HAL handle move construction/assignment (#1845)
A templated hal::Handle class is used to wrap handles to make them move-only.
This eliminates a lot of boilerplate move constructor/assignment code
in the main WPILib classes.  HAL_SPIPort and HAL_I2CPort are also wrapped.

The wrapper class does not implement destruction.  This would require the
wrapper class to be handle-specific (rather than generic) and would result
in more code added than it removed, plus would add header dependencies on
more HAL headers.  In addition, some HAL handle release functions are more
complex (e.g. have return values) and can't be easily mapped to a destructor.
2019-08-25 18:42:00 -07:00
Oblarg
558c383088 Add new Java Command framework (#1682)
The old command framework is still available, but will be deprecated.

Due to name conflicts, the new framework is in the wpilibj2 package.
Eventually (after the old command framework is removed in a future year)
it will be moved into the main wpilibj package.
2019-08-25 14:47:07 -07:00
Peter Johnson
1379735aff Delete RobotState and SensorUtil constructors (#1847) 2019-08-24 22:28:39 -07:00
Tyler Veness
e3d86fee46 Move circular buffer class from wpilib to wpiutil (#1840) 2019-08-24 21:35:19 -07:00
Peter Johnson
4cd8a56672 TimedRobot.cpp: Fix deprecation warning (#1846)
For both TimedRobot and IterativeRobotBase, use delegating constructors
to reduce code duplication.
2019-08-24 21:13:29 -07:00
Thad House
b2861f8948 Use 2020 artifacts and artifactory server (#1838)
Uses 2020 artifacts and artifactory server, and new versioning and repository plugins.
2019-08-22 21:48:43 -07:00
Thad House
98cc32703c Update to use artifactory to publish artifacts (#1833)
* Update to use artifactory to publish artifacts
2019-08-21 07:28:24 -07:00
Tyler Veness
fa06403000 Move drive integration tests into wpilibj/src/test (#1836)
Also move drive and controller tests into subfolders.
2019-08-20 21:05:38 -07:00
Thad House
e716c36b89 Fix Nat.java generation to be incremental (#1831)
Also generate the imports.
2019-08-20 21:03:44 -07:00
Thad House
9fd2b5e3fa Fix MSVC builds on cmake windows in vcpkg (#1835) 2019-08-19 20:28:48 -07:00
Redrield
7e95010a29 Add compile-time EJML matrix wrapper to wpiutil (#1804)
This adds a wrapper over EJML's SimpleMatrix that uses generated classes representing numbers to encode the dimensions of each matrix at compile time, and to check operations between matrices for validity at compile time, rather than failing with an exception at runtime. This is required for the Java implementation of state-space control.

Additions to the wpiutil gradle script, and a python script at the wpiutil root are used to generate numeric types from a template at build time for both gradle and cmake. Users will be able to access types through functions on the Nat class.
2019-08-18 15:00:40 -07:00
Tyler Veness
3ebc5a6d3a Add ProfiledPIDController 2019-08-16 23:47:02 -07:00
Tyler Veness
fc98a79dbb Clean up PIDController interface in preparation for ProfiledPIDController 2019-08-16 23:47:02 -07:00
Tyler Veness
fdc098267e Fix compilation error in elevator trapezoid profile example (#1826)
Merging #1815 broke it, then #1814 was merged before fixing the failure.
2019-08-16 23:04:12 -07:00
Oblarg
a3dd84e854 Make XBoxController Button enum public (#1823)
This allows using the raw button number in places where that is useful.
2019-08-16 22:21:49 -07:00
Tyler Veness
a216b9e9ee Add TrapezoidProfile example (#1814) 2019-08-16 22:03:44 -07:00
Prateek Machiraju
8f386f6bb3 wpilibc: Add unit-safety to C++ geometry classes (#1811) 2019-08-16 22:00:32 -07: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
Peter Johnson
f1d71da8a9 Move GetStackTrace and Demangle to wpiutil, add Windows support (#1819)
For Windows, import the StackWalker source (https://github.com/JochenKalmbach/StackWalker)
plus PR 35 in that repo, with a few simplifications to StackWalker.h.
2019-08-12 23:45:45 -07:00
Tyler Veness
ef037457e5 Make LinearFilter copyable and moveable (#1789) 2019-08-09 22:29:23 -07:00
Thad House
76930250c0 Remove objective-cpp support (#1816)
Was only there for mac usb cam support, but we likely won't get to it this summer anyway,
and its causing a breakage in the backing libraries with cross builds
2019-08-09 16:28:53 -07:00
Tyler Veness
1c246418f8 Move TrapezoidProfileTest to trajectory folder (#1812)
The newer controls stuff is using subfolders, so it makes sense for
consistency and reduced clutter.
2019-08-09 16:27:41 -07:00
Matt
95a54a0f29 Add java arcade drive example (#1810) 2019-08-09 16:19:33 -07:00
Thad House
a4530243e1 HAL sim: Fix incorrectly setting dio port to initialized on cleanup (#1813) 2019-08-09 16:14:46 -07:00
Austin Shalit
09d00a6227 Update Java examples to use new PIDController (#1809)
This also allows us to re-enable Werror.
2019-08-04 20:35:33 -07:00
Abiel Fernandez
ba9b517427 Add missing Java examples (#841) 2019-08-04 20:34:02 -07:00
Thad House
6411bd79c6 InterruptableSensorBase: Fix callback function deletion (#1807)
Save the callback function into a unique_ptr member instead.
2019-08-04 20:25:25 -07:00
Austin Shalit
810e58ea85 I2C: Add tip about writeBulk() to transaction() (#1806) 2019-08-04 01:16:38 -07:00
Peter Johnson
607d6c148a Fix wpilibj integration tests jar name (#1808) 2019-08-04 00:06:07 -07:00
Oblarg
c9873e81b2 Remove PIDControllerRunner and mutex from new PIDController (#1795)
Teams that wish to use it asynchronously may still do so - they simply need to handle the thread safety themselves (it is not that difficult, and can be done more cleanly in the calling code anyway).
2019-08-04 00:01:11 -07:00
Tyler Veness
98d0706de8 Fix cscore build with OpenCV 4 (#1803)
The main change in OpenCV 4 was removing its C APIs from OpenCV 1. If
the user has OpenCV 4, they have no way of obtaining the correct
arguments for cscore functions that require the C API. Therefore, we can
fix the build by just not compiling in functions reliant on the C API if
OpenCV 4 is being used.

OpenCV 3 builds should continue to work with this change.
2019-08-03 16:10:39 -07:00
Oblarg
fbe67c90c8 Make Sendable setters synchronous (#1799)
Instead of being called asynchronously by NetworkTables, they are now called by updateValues() synchronously with the main loop, just like the getters.
2019-08-03 15:08:06 -07:00
Oblarg
c67a488a09 Format SendableBuilderImpl javadocs (#1802) 2019-08-03 15:00:43 -07:00
Tyler Veness
8e93ce8929 Fix PIDControllerRunner member destruction order (#1801)
The mutexes in PIDControllerRunner are declared after the Notifier, and
when the PIDControllerRunner object is destructed, the member object
destructors are called in the reverse order in which they are declared.
The mutexes are destructed first, then the Notifier destructor is called
which stops the Notifier.

There's a window between those destructor calls during which the
Notifier can run the callable and attempt to lock a mutex that no longer
exists.

Declaring the Notifier after all the variables its callable uses fixes
this issue, as it ensures the Notifier is destructed first.
2019-08-03 14:58:10 -07:00
Redrield
c98ca7310f Add EJML dependency to wpiutil (#1769)
Add EJML as the Java library for linear algebra for use in wpilib. This is equivalent to Eigen for C++.

The EJML dependency is downloaded in cmake and pulled in via maven in the gradle build.
2019-08-03 14:24:14 -07:00
Oblarg
3b12276bc3 SendableBase: remove unnecessary synchronization (#1797)
Also fixes the move constructor to update LiveWindow to follow the move.
2019-08-02 23:47:17 -07:00
Oblarg
e6d348f382 Fix missing default name in Java PIDController (#1792) 2019-08-02 23:38:35 -07:00
Austin Shalit
df12fc2a86 Java cleanups (#1776)
* Remove extra ';'s
* Remove unnecessary conversions to String
* Use StandardCharsets object
* Replace infinite while with check for interrupted thread
* Remove redundant local vars
* Remove redundant throws clause
* Remove redundant primitive wrapping
* Fix malformed Nested class test
* Remove unnecessary unboxing
* Remove unnecessary explicit type argument
* Replace lambdas with method references
* Replace statement lambdas with expression lambdas
* Replace null check with method call
* Replace number comparison with method call
* Fix broken javadoc comments
* Replace Arrays.asList with singletonLists
* Remove excessive lambda usage
* Remove redundant string operation
* Remove redundant type casts
* Remove unnecessary returns
* Remove redundant suppressions
* Fix unresolved file reference
* static analysis fixes
2019-07-31 22:19:48 -07:00
Thad House
39561751fc Update GradleVSCode version (#1786)
Fixes compile_commands
2019-07-31 22:15:48 -07:00
Tyler Veness
37d316aa09 Add C++20 std::math constants shim (#1788)
Based on http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0631r7.pdf
2019-07-31 22:15:22 -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
Thad House
823174f30a Update native utils to 2020.0.4 (#1783)
Adds -latomic by default to all linux builds
2019-07-30 00:40:23 -07:00
Tyler Veness
37c6952663 Squelch -Wdeprecated-copy for Eigen with GCC >= 9 2019-07-30 00:39:47 -07:00
Tyler Veness
04c9b000ff Revert "Fix build of Eigen 3.3.7 with GCC 9"
-Wextra adds -Wdeprecated-copy, which Eigen emits. We're going to
squelch the warning instead to minimize changes to Eigen's upstream
sources.
2019-07-30 00:39:47 -07:00
Peter Johnson
ca3e71e214 wpiutil: Fix Process::Spawn() (#1778)
Was broken due to removal of ArrayRef initializer_list constructor.
2019-07-26 11:22:23 -07:00
Prateek Machiraju
d946d5a2bb Fix Eigen compilation errors and add tests (#1777) 2019-07-24 20:51:33 -07:00
Tyler Veness
8b1b9ac75a Fix build of Eigen 3.3.7 with GCC 9 2019-07-24 00:03:18 -07:00
Tyler Veness
2f680ba990 Add Eigen linear algebra library
This imports Eigen 3.3.7, which will be used by the wpilibc implementation of
state-space control and mecanum/swerve forward kinematics (the forward
kinematics requires least-squares solutions via a matrix pseudoinverse).

While Eigen has parts licensed under BSD, MINPACK, and MPL2, the files we need
are only MPL2.
2019-07-24 00:03:18 -07:00
Prateek Machiraju
a885db7d48 Make MotorEncoderTest use LinearFilter (#1775)
Closes #1774
This also eliminates the call to the deprecated setPIDSourceType method.
2019-07-23 23:59:06 -07:00
Prateek Machiraju
ee24101696 Add geometry classes (#1766)
These classes introduce ways to represent poses and provide easy ways to transform, rotate, and translate poses across 2d space. This classes will be especially useful for a planned odometry and kinematics suite.

Furthermore, these classes can also be used to simply represent waypoints on a field, do superstructure motion planning, etc.
2019-07-23 23:57:39 -07:00
Thad House
48fe54271a Add HALSIM_SetSendError implementation (#1773) 2019-07-23 23:55:51 -07:00
Peter Johnson
dff58c87f4 Fix unused warning in release build (#1771) 2019-07-21 22:17:42 -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
Loki
0f6ef80ab2 Add RobotState#IsEStopped and DriverStation#IsEStopped (#952) 2019-07-16 09:18:23 -05:00
Austin Shalit
e488861877 Move unit tests from integration test suite (#1170) 2019-07-16 00:02:52 -05:00
Oblarg
dffa1a5cba Make null checks more descriptive (#1688) 2019-07-15 20:22:36 -05:00
Oblarg
fe59d854d5 Notifier: add null check (#1684) 2019-07-15 20:20:11 -05:00
Peter Johnson
10731f3d6b Update uv Udp wrapper for latest features 2019-07-15 20:15:37 -05:00
Peter Johnson
89f7b72b6e Update libuv to 1.30.1 release 2019-07-15 20:15:37 -05:00
Peter Johnson
85f2f87400 wpiutil: Add unique_function (#1761)
This is a move-only variant of std::function to support move-only captures.

Imported from LLVM with some small tweaks (changed to 4 pointer internal storage, warnings fixes).
2019-07-15 20:13:57 -05: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
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
24d31df55a Make sure move constructor is generated for TrapezoidProfile (#1757)
This wasn't necessarily the case before because defining a nondefault
constructor results in no default move constructor.
2019-07-08 22:19:13 -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
e582518bae Fix some move constructors (#1754)
Timer didn't have working move semantics because mutexes aren't
moveable, meaning the default implementations were ill-formed.
MotorSafety wasn't locking its mutex.
2019-07-07 19:15:59 -07:00
Peter Johnson
8757bc471b Remove pre-C++17 shims (#1752)
Now that all compilers support C++17, remove some old C++14/C++17 shims.
2019-07-07 15:44:43 -07:00
Tyler Veness
ea9512977c Add replacement PIDController class (#1300)
Originally, PIDController used PIDSource with its "PIDSourceType" to
determine whether a class should return position or velocity to the
controller. However, the supported languages have changed a lot over 10
years and now support lambdas. Instead of using PIDSource and PIDOutput,
users can pass in doubles to the Calculate() function synchronously.
This makes the controller much more flexible for team's needs as they no
longer have to make a separate PIDSource-inheriting class just to
provide a custom input.

The built-in feedforward was removed. Since PIDController is synchronous
now, they can add their own feedforward on top of what Calculate()
returns.

To facilitate running the controller asynchronously, there is a
PIDControllerRunner class that handles that. By separating the loop from
the control law, PIDController can now be composed with others and be
used to control a drivetrain (a multiple input, multiple output system
that requires summing the results from two controllers) much easier.
Also, motion profiling can be used to set the reference over time.

All the classes related to the old PIDController are now deprecated. The
new classes are in an experimental namespace to avoid name conflicts.

While this is a large change, I think it is a necessary one for growth.
The old PIDController design was created in a time when languages only
supported OOP, and we have more tools at our disposal now to solve
problems. This more versatile implementation can be used in more places
like as a replacement for Pathfinder's "EncoderFollower" class.

There has been hesitation to add lambda support to WPILib for a while
now out of concerns for requiring teams to learn more features of C++ or
Java. In my opinion, this change makes PIDController easier to use, not
harder. The concept of a function is a building block of OOP and should
be learned before classes. The ability to store functions as first-class
objects and invoke them just like variables is rather natural.

Note that PID constants for the new controller will be different from
the old one. The original controller didn't take the discretization
period into account. To fix this, teams should just have to divide their
Ki gain by 0.05 and multiply their Kd gain by 0.05 where 0.05 is the
original default period.
2019-07-07 15:37:13 -07:00
Tyler Veness
9b798d228f Add TrapezoidProfile class (#1673) 2019-06-30 23:25:11 -07:00
Thad House
804926fb5b Unconditionally skip athena builds for sim (#1748)
They'll pretty much never work
2019-06-30 19:45:33 -07:00
Tyler Veness
118e9d29d5 Add C++14 units library (#1749) 2019-06-30 19:44:51 -07:00
Tyler Veness
c705953d77 Add usage reporting to LinearFilter (#1750) 2019-06-30 19:44:15 -07:00
Thad House
852d1b9cad Don't cross-build gazebo for raspbian (#1747) 2019-06-30 12:42:32 -07:00
Peter Johnson
eedb3a1adc Fix GCC 9 warnings (#1730) 2019-06-30 00:28:32 -07:00
Peter Johnson
60dce66a4f Remove wpi::ArrayRef std::initializer_list constructor (#1745)
This can be dangerous as it refers to a temporary, and GCC 9.0 warns about
its use.  Instead add std::initializer_list overloads to common places it
was used in an initializer_list sense.
2019-06-29 23:54:02 -07:00
Thad House
9e19b29c31 Use base azure image for primary wpilib build (#1744)
This will ensure everything works with no flags, even without a rio or raspbian compiler
2019-06-29 21:37:34 -07:00
Thad House
2994250714 Update jni library, fix cross builds of the jni symbol check (#1742) 2019-06-29 21:31:55 -07:00
Thad House
a6b0e9b856 Only disable execution of cross compile google tests (#1741)
Still build them and link them, just don't execute them.

Google test is still disabled completely for the HAL and wpilibc.
2019-06-29 21:31:27 -07:00
Peter Johnson
3c2093119e Use docker container to run wpiformat (#1740)
Also update raspbian image to use new unified name.
2019-06-29 21:11:17 -07:00
Thad House
5fe2eebceb Revert "Don't build halsim_gazebo on raspbian (#1737)" (#1743)
This reverts commit d9cb57a429.
2019-06-29 21:05:44 -07:00
Peter Johnson
4b1b92bb74 Replace wpi::optional with C++17 std::optional (#1732)
Keep wpi/optional.h as a shim with deprecated warnings.
2019-06-29 11:20:22 -07:00
Peter Johnson
0fbb0d989e Update to 2020 compilers (#1733)
Also link to libatomic in cmake and for Raspbian only in gradle.
2019-06-29 09:28:28 -07:00
Thad House
2dc94e6052 Disable google tests on cross compilers (#1738)
Removes checks for onlyathena and onlyraspbian, and just disables gtest for cross compilers.
2019-06-29 09:27:11 -07:00
Peter Johnson
d9cb57a429 Don't build halsim_gazebo on raspbian (#1737)
Reference shared/config.gradle instead of shared/plugins/setupBuild.gradle.
2019-06-28 22:30:17 -07:00
Austin Shalit
f7cfdd7cee Replace crlf line endings with lf (#1731) 2019-06-28 20:55:14 -07:00
Austin Shalit
b6d5d90d9d Add JaCoCo Support (#1734) 2019-06-28 20:01:02 -07:00
Thad House
c7ab2baa6e Add way to disable the jni check tasks from a property (#1736) 2019-06-28 20:00:35 -07:00
Thad House
0c45c5b7ea Fix skip athena and skip raspbian flags (#1735) 2019-06-28 20:00:09 -07:00
Thad House
3dfb01d45b Update to new Native Utils (#1696)
Also update to azure 2019 windows image
2019-06-28 14:09:10 -07:00
Tyler Veness
30e936837c Clean up LinearDigitalFilter class (#782)
* Renamed LinearDigitalFilter to LinearFilter
* Filter base class removed since it wasn't useful
* C++: std::shared_ptr<> replaced with double parameter
2019-06-28 13:35:57 -07:00
Tyler Veness
311e2de4c1 Remove deprecated Joystick constants (#1715) 2019-06-26 14:17:11 -07:00
Benjamin Ward
c08fd6682f Update CAN manufacturer list (#1706) 2019-06-26 14:16:12 -07:00
Peter Johnson
258bba0c2d ErrorBase and WPIError improvements (#1727)
* ErrorBase: Use magic static singleton for globals
* ErrorBase: Add testability features for global errors
* Make WPIError definitions inline functions
(This works around cross-DLL variable issues on Windows)

Fixes #1726.
2019-06-23 20:36:52 -07:00
Peter Johnson
372ca4f456 cmake: Enable googletest unit tests (#1720)
Also don't inherit compile warnings from wpiutil

There's not a good way to disable inherited compiler flags.
2019-06-23 12:44:28 -07:00
Peter Johnson
223d47af0e HALSIM: support mocking of HAL_SendError() (#1728) 2019-06-23 11:48:04 -07:00
Peter Johnson
55cb683db4 Change compiler flags to C++17 (#1723)
The current versions of the RoboRIO and Raspbian compilers support the flag but have
minimal actual C++17 support.  Changing the flag is the first step.
2019-06-20 22:32:50 -07:00
Peter Johnson
ee8a33c568 wpiutil: SafeThread: Add thread id, support getting shared_ptr (#1722)
Rename base class function from GetThread to GetThreadSharedPtr.
2019-06-20 19:51:09 -07:00
Peter Johnson
61426d08de wpiutil: Signal: make operator() const (#1721)
This enables const-ness in uv::Handle ReportError() and Invoke() as well.
2019-06-20 17:51:32 -07:00
Tyler Veness
b630b63ef0 Remove functions in LiveWindow deprecated since 2018 (#1716)
The Java versions were already accidentally removed in #1059.
2019-06-14 18:52:10 -07:00
Peter Johnson
1d0c05d4f8 Styleguide fixes for #1718 (#1719) 2019-06-14 18:51:49 -07:00
Peter Johnson
f07569df19 Fix newer GCC/clang compiler warnings (#1718) 2019-06-14 18:32:27 -07:00
David Vo
0120f31247 C++ SPI: Fix SetClockRate to take int (#1717)
The Java version takes an int, and HAL_SetSPISpeed takes an int as well.
2019-06-12 06:04:52 -07:00
Thad House
c2829ed98e Configure gradle to ignore unresolved headers (#1711)
Work around Gradle's handling of libraries like eigen and opencv
which use macro includes.  Also completely disable incremental includes.
2019-06-11 21:48:32 -07:00
Thad House
221e66f46d Allow disabling static init of JNI libraries (#1672) 2019-06-10 22:29:32 -07:00
Thad House
738852e119 cmake: Add cross toolchain files for Rio and Pi (#1710) 2019-06-10 22:05:20 -07:00
Tyler Veness
27b697b084 Remove frc directory include shims (#1714) 2019-06-10 22:03:52 -07:00
Tyler Veness
9e45373a74 Remove functions and classes deprecated for 2018 season (#1059) 2019-06-10 22:03:15 -07:00
David Vo
eeb1025ac7 SPI: Report port as instance for usage reporting (#1704) 2019-06-10 20:57:36 -07:00
Thad House
bc6f1e2469 Windows compiler options improvements (#1709)
- Use generators to set options only during build
- Add ZcThrowingNew
- Disable 4996

Fixes #1699
2019-06-10 20:09:39 -07:00
Thad House
bb48ae391e cmake: Move example programs into folders (#1654)
This looks cleaner in VS.
2019-06-10 20:04:34 -07:00
Thad House
221011494d Update for C++17 and fix MSVC warnings (#1694)
* Update MSVC arguments
* Fix json allocator
* Fix simulation diamond
* Bump gtest
* Remove empty varargs in unit tests
* Replace test case with test suite
* Remove deprecation warning in optional
* Remove need for NOMIXMAX to be defined in wpilib headers
2019-05-31 15:43:32 -05:00
Thad House
fb1239a2ad Add raw sources and sinks to cscore (#1670)
In some cases, we don't want the cv requirement to get an image, for instance interop with other versions of opencv

This enables getting a raw image, and handling conversions from the user side.
2019-05-30 21:12:05 -05:00
Thad House
7de9477347 Add lambda overloads for interrupts (#1636) 2019-05-30 19:59:35 -05:00
Thad House
90957aeea4 Move libuv to its own subfolder in build (#1661)
Allows using system libuv

* Fix Gradle Build and include dirs

* Update cmake find to support vcpkg libuv
2019-05-30 15:59:26 -07:00
Thad House
47aae502a7 Styleguide fixes (#1702) 2019-05-30 12:36:36 -07:00
pgfisico
0bff98b5ec Correct DifferentialDrive::ArcadeDrive param docs (#1698) 2019-05-30 11:05:42 -07:00
Sam Carlberg
b52e40b80c Allow widgets to be added by passing value suppliers (#1690) 2019-05-30 09:45:23 -07:00
Sam Carlberg
4a00cd77bb Add usage reporting for the Shuffleboard API (#1685) 2019-05-30 09:36:49 -07:00
Thad House
e25e515f2e Publish artifacts on azure (#1678) 2019-05-25 06:18:49 -07:00
Thad House
322ef9b967 Force Java 11, fix javadoc generation (#1695) 2019-05-19 16:59:44 -07:00
Tyler Veness
d42ef5df02 Fix Watchdog print formatting (#1693) 2019-05-19 12:24:40 -07:00
Tyler Veness
f432f65bef Update copyright year in license to 2019 (#1524)
Also update clang-format to 6.0.
2019-05-17 17:35:09 -07:00
Thad House
1726b77ac5 wpiutil: uv: Remove copy from SimpleBufferPool (#1680) 2019-05-07 20:55:58 -07:00
Thad House
620bec9cae wpiutil: uv: Add LoopClosing status to Handle (#1647)
Useful for EventLoopRunner to know if a stop is requested, or close is happening for another reason.
2019-05-05 17:38:56 -07:00
Thad House
7cd6e2e7fa UsbCamera: Solve race in windows initialization (#1638)
Create message pump during UsbCameraImpl creation.
2019-05-05 16:29:47 -07:00
Thad House
7732836bd5 Completely disable watchdog tests on mac (#1679)
They’re just not reliable.
2019-05-05 15:51:14 -07:00
Thad House
698edfda9d Remove framework load, disable mac timeout test (#1676)
* Remove system includes from all mac builds

* Disable java watchdog on mac
2019-05-05 13:16:47 -07:00
sciencewhiz
1c454b000f Add Shuffleboard calls to IterativeRobotBase in C++ (#1607)
Additionally, add epochs for Shuffleboard, LiveWindow, and
Smartdashboard updates.
2019-04-27 22:23:21 -07:00
David Vo
f42905b32e Include missing headers in HAL.h (#1660)
* Include CANAPI.h and Encoder.h in HAL.h

* Include Threads.h in HAL.h

* Make Threads.h C compatible

Also changes the #define to a typedef.
2019-04-27 21:52:54 -07:00
Thad House
bdc822fad8 Only generate passthrough URLs for RoboRIO (#1624)
Otherwise accidentally, a race could occur between coprocessors and rio.

Java was done in both old and new locations as it's a race.
2019-04-27 20:35:23 -07:00
Tyler Veness
d3affb16bc Make failure of HAL_GetFPGATime() more descriptive (#1633) 2019-04-27 20:34:14 -07:00
Peter Johnson
2de3bf7f58 Update LLVM from stable upstream (#1653)
Replace CheckedMalloc with upstream safe_malloc.
2019-04-27 20:33:08 -07:00
Austin Shalit
3cf4f38f5d Fix build on macos10.14.4 (#1648) 2019-04-27 20:25:27 -07:00
Thad House
4e0c10f488 Fix CAN Clean using wrong ID (#1668) 2019-04-27 20:24:40 -07:00
Thad House
3b06313243 Fix Gray to BGR conversion in CameraServer (#1665) 2019-04-27 20:17:17 -07:00
Thad House
6cd1c73efe Fix GUID comparison creating weird symbol (#1659) 2019-04-27 20:16:52 -07:00
Austin Shalit
063bbab6f5 MavenArtifacts.md: update links to HTTPS (#1674) 2019-04-27 20:16:04 -07:00
sciencewhiz
aab4c494d6 Fix type in build.gradle (#1604) 2019-03-10 18:40:16 -07:00
Peter Johnson
bf46af2600 Disable extraneous data warnings in libjpeg (#1630)
These are common with USB cameras.
2019-03-10 18:39:07 -07:00
Thad House
655763a9a7 Limit length of message sent to DS SendError call (#1618)
If total length is over 65536, the packet will get thrown out.
This can be a problem in stack overflow cases (e.g. infinite recursion).
2019-03-03 15:43:04 -08:00
Tyler Veness
a095ec2d8f Fix linker errors with free functions in Threads.h (#1625)
The functions in Threads.h are in the frc namespace. `using namespace frc;` in
Threads.cpp doesn't put their implementations in the frc namespace, so linker
errors occur when attempting to use them in robot programs.

To fix this, one can either wrap them in a namespace block or prepend
`frc::` to the implementation's signature. Based on past discussion, I
opted for the namespace block.
2019-03-03 15:39:59 -08:00
Thad House
12ab035aad Fix receive side of LabVIEW USB streams (#1621)
LabView only accepts %20 instead of + for parameters, only sends '\n' at the boundaries,
and includes the -- when sending the initial boundary.  This solves those parts.

This is not fully enough to fix shuffleboard and others, as the NT format for paths is not the correct path.
2019-03-03 11:20:43 -08:00
Thad House
99e4f7dd2c Fix SPI CS1 not working correctly (#1614)
It was failing the check when remapping digital sources
2019-02-25 18:48:22 -08:00
Peter Johnson
60c2f59051 C++ CameraServer: initialize default Usb camera device number (#1601)
Otherwise just plain StartAutomaticCapture() starts with random number.
2019-02-14 22:39:40 -08:00
Peter Johnson
d55ca191b8 CameraServer: Add switched camera support (#1600)
This adds a new function "addSwitchedCamera" that creates and publishes a
virtual camera where the published stream information is consistent even if
the mjpeg server source is switched to a different camera.

Previously, changing the source of the mjpeg server resulted in updating the
stream information published for that source.
2019-02-14 22:05:40 -08:00
Sam Carlberg
e8b24717c7 C++ Shuffleboard fixes (#1595)
* Fix C++ ShuffleboardComponent template type

* Fix `WithWidget(WidgetType&)`not being properly capitalized

* Fix data members across dll boundaries by using enum for built in types
2019-02-14 20:44:30 -08:00
Tyler Veness
182758c05b Fix Ultrasonic sensor runner thread (#1598)
When there is more than one ultrasonic sensor, only the last sensor
instantiated would work due to incorrect array index management. This
replaces the previous approach with range-based for loops like the C++
implementation.

Supersedes #1589.
2019-02-14 20:25:56 -08:00
Peter Johnson
74f7ba04b0 Java PIDBase: Make setPIDSourceType and getPIDSourceType public (#1599)
Fixes #1596.
2019-02-13 23:41:05 -08:00
Thad House
997d4fdf47 Update HAL GetStackTrace to properly report user errors (#1594)
With the move of the HAL, the old value no longer worked, as the JNI call is in a different namespace
2019-02-11 20:17:31 -08:00
Thad House
76d9e26633 uv: Add reuse to pipe (#1577)
Needed for a reconnection API
2019-02-09 00:09:22 -08:00
Thad House
a230c814cb Add support for WPILib vscode extension for allwpilib C++ intellisense (#1590) 2019-02-09 00:07:48 -08:00
Thad House
12cb77cd7c Fix DS Comm button tests (#1591)
Mac requires the double braces
2019-02-09 00:07:24 -08:00
Thad House
8a9822a96b Allow multiple instances of the same PDP (#1582)
Previously multiple instances would overrun with each other. This make all instances get the same HAL handle.
2019-02-06 22:51:34 -08:00
Thad House
a9371a7586 Fix missing exposure property on windows USB cameras (#1571) 2019-02-06 22:49:55 -08:00
Peter Johnson
6992f5421f cscore: Avoid crash if invalid (null) source set in MjpegServer (#1585)
Fixes robotpy/robotpy-cscore#60
2019-02-03 00:22:07 -08:00
Tyler Veness
43696956d2 Fix Watchdog incorrectly resetting expiration flag upon disable (#1580)
Resetting the flag should only occur in Enable() and Reset().
IterativeRobotBase needs the flag to remain set to print epochs after
disabling the Watchdog.
2019-02-02 00:22:07 -08:00
Thad House
ae3fd5adac Fix docs search having unspecified module directory (#1568)
Also add Doxygen comment for C++ filesystem API.
2019-02-02 00:20:57 -08:00
Jaci Brunning
404666b298 Fix Halsim DS Button Format (#1583) 2019-02-01 23:23:04 -08:00
sciencewhiz
1eb4c99d15 Update README for 2019 changes (#1569)
Fixes #1562
2019-02-01 23:05:41 -08:00
Thad House
910b9f3af7 Add support for camera descriptions on windows (#1572)
For now, has to force enumerate all cameras to find the matching one
2019-02-01 23:04:12 -08:00
Thad House
09d90b02fb Remove prints and unecessary items from windows GetNetworkInterfaces (#1573) 2019-02-01 23:02:12 -08:00
Peter Johnson
0e1f9c2ed2 ntcore: Read ini escaped quotes correctly (#1579) 2019-02-01 23:01:00 -08:00
Thad House
f156a00117 wpiutil uv: Pass IPC value of listening pipe to accepted pipe (#1576)
Otherwise, the acception fails.
2019-01-30 20:37:28 -08:00
Thad House
4a6087ed56 Disable watchdog test on mac (#1578)
It can't be held property on the asure test system
2019-01-30 20:35:16 -08:00
Peter Johnson
88a09dd13a cscore: Handle USB camera integer menus (#1561)
The Pi Camera is one of these.  Previously, integers were just being
cast to a string instead of formatted as a string.
2019-01-24 22:46:29 -08:00
Christopher Cantrell
7d19596367 Changed terminology from "Overload" to "Override" (#1563) 2019-01-24 22:45:05 -08:00
Jaci Brunning
bd05dfa1c7 Fix ds_socket matchinfo (#1555) 2019-01-16 21:32:34 -08:00
Peter Johnson
05d6660a6b cscore: Add config json to VideoSink (#1543)
Same format as VideoSource.

Refactor properties json handling into PropertyContainer.
2019-01-11 20:33:05 -08:00
Peter Johnson
1349dd4bd8 Make MjpegServer functions public (#1545) 2019-01-11 17:53:44 -08:00
Peter Johnson
fdf298b172 CameraServer: Return MjpegServer from StartAutomaticCapture(VideoSource) (#1544) 2019-01-11 16:44:49 -08:00
Peter Johnson
453a9047e4 Fix cmake hal sim build (#1539)
A source directory was named incorrectly in CamelCase.
2019-01-11 02:38:35 -08:00
Peter Johnson
e97e7a7611 Add DriverStationSim.notifyNewData (#1537) 2019-01-09 23:47:42 -08:00
Thad House
308bdbe298 cscore: Windows UsbCamera: Use custom windows message for initial connection (#1534)
WM_CREATE is being called at a time where the message pump cannot be called back into.
2019-01-09 22:52:24 -08:00
Peter Johnson
f889b45d59 cscore: MjpegServer: Fix FPS limiting (#1536)
This uses a 1-second window average to try to hit the desired FPS.
2019-01-09 22:50:34 -08:00
Peter Johnson
444b899a9f Java: Fix Timer.get() handling of accumulated time (#1531)
Fixes #1530.
2019-01-08 19:43:49 -08:00
Tyler Veness
f121ccff0d Avoid Watchdog thread clobbering m_isExpired flag after callback (#1527) 2019-01-08 19:37:59 -08:00
Peter Johnson
bc2c932f92 Fix MotorSafety deadlock (#1526)
Some instances of StopMotor (most notably DifferentialDrive) call Feed(),
which deadlocks due to Check() holding the same lock.

Fixes #1525.
2019-01-02 20:58:39 -08:00
Thad House
6bdd7ce506 Update docs for disabled init to match all the other modes (#1523)
Closes #1522
2018-12-31 19:11:35 -08:00
Thad House
c12d7729e3 Update examples to use VictorSPX's rather then Sparks (#1521) 2018-12-31 13:45:09 -08:00
Dustin Spicuzza
3635116049 cscore: set charset of displayed pages (#1520)
All of our strings are UTF-8, but the default charset for HTML<5 was ISO-8859-1
2018-12-30 23:49:24 -08:00
Peter Johnson
6105873cbe Provide alternate device paths info for USB cameras (#1519)
This is primarily for use on Linux to get by-id or by-path device names.

This information is now part of UsbCameraInfo.

A new entry point was added to UsbCamera to get that camera's UsbCameraInfo.

The alternate paths are also returned in EnumerateUsbCameras.
2018-12-30 11:48:18 -08:00
Sam Carlberg
80f87ff8ad Allow video sources to be added to Shuffleboard (#1453)
Add a Sendable wrapper for VideoSource objects.

Add convenience methods for adding video sources directly to containers
so users won't have to manually wrap video sources.
2018-12-30 11:45:41 -08:00
Peter Johnson
a2368a6199 Watchdog: add timeout message suppression feature
Was part of reverted #1486
2018-12-30 00:16:50 -08:00
Peter Johnson
ae3cb6c83b Watchdog.java: add comment fixes from reverted #1442 2018-12-30 00:16:50 -08:00
Peter Johnson
f0f196e5b3 Revert "MotorSafety: Use Watchdog instead of DS class polling (#1442)"
This reverts commit 26e8e587f9.
2018-12-30 00:16:50 -08:00
Peter Johnson
7c35355d29 Revert "Suppress Watchdog's generic timeout message in MotorSafety (#1486)"
This reverts commit 41596608cc.
2018-12-30 00:16:50 -08:00
Peter Johnson
75cc09a9e4 Revert "Suppress timeout message in C++ MotorSafety class (#1512)"
This reverts commit 300eeb330d.
2018-12-30 00:16:50 -08:00
Peter Johnson
0e2e180635 PowerDistributionPanelTest.cpp: Include thread 2018-12-30 00:16:50 -08:00
Sam Carlberg
01d1322066 Add constants for built-in Shuffleboard widgets and layouts (#1468)
Prevents users from having to remember (and correctly type) the names of Shuffleboard widgets.
2018-12-29 17:22:47 -08:00
Peter Johnson
ceed1d74dc ntcore: Strip whitespace from IP addresses (#1516) 2018-12-29 14:47:25 -08:00
Peter Johnson
e1bf623997 cscore: handle HTTP stream hangs (#1513)
Automatically disconnect the HTTP stream if no frames have been received
for 1 second.
2018-12-29 14:08:45 -08:00
Thad House
d46ce13ffe Fix CAN API timing out incorrectly (#1497)
HAL_GetFPGATime returns 0 if it starts with a non zero status.

Always use monotonic clock for CAN times, rather then trying to sync FPGA.

Change timeout from 50 ms to 100 ms.
2018-12-29 13:57:23 -08:00
Tyler Veness
300eeb330d Suppress timeout message in C++ MotorSafety class (#1512)
wpilibj's default constructor is already correct.
2018-12-27 14:01:02 -06:00
Andrew Dassonville
d817001259 Only write version information on real robot (#1510)
Writing to the versions file throws an exception on Windows, and might
write weird files on Linux.
2018-12-27 00:59:49 -06:00
Austin Shalit
8ac4b113a5 Fix build on macOS 10.14.2 (#1509) 2018-12-25 22:58:04 -06:00
Tyler Veness
f3864e9abb Move deprecated message in C++ from class level to constructor (#1505)
This prevents deprecation messages when including a header but not
instantiating the class. SampleRobot was addressed by #1503.
2018-12-25 01:14:24 -06:00
Thad House
799c3ea8a6 Disable gyro sim test on mac (#1506)
It fails with a mutex error very often, and we have not been able to figure out the issue.

It breaks CI.
2018-12-25 01:13:59 -06:00
David Vo
8d95c38e39 Watchdog: Fix potential IllegalFormatException (#1508)
If an epoch name contains a % symbol, this could've lead to an exception
at runtime where the number of arguments mismatches the format string.
2018-12-25 01:12:44 -06:00
Thad House
a7f4e29b73 Update versioning and vscode plugin (#1498)
versioning fixes multi tag issue
2018-12-24 15:46:41 -06:00
Thad House
b88369f5e8 Move deprecation warning for SampleRobot to constructor (#1503)
This way, the warning doesn't occur when including wpilib.h

Closes #1501
2018-12-24 15:46:12 -06:00
Thad House
ce6f1d0588 Change deperecation year for serial port direct constructor (#1504) 2018-12-24 15:17:19 -06:00
Thad House
f163216a4c Add support for raspbian extraction (#1494)
This is how I did it in C#, and it was the most reliable way I could find.
2018-12-24 15:15:15 -06:00
Thad House
c449ef1064 Unconditionally await in awaitUntil (#1499)
Negative numbers are properly handled, which will reduce chances of deadlocks.
2018-12-24 15:07:47 -06:00
Thad House
6593f4346e Default to DS attached to true in sim (#1500)
Otherwise, it is required to be set manually, which isn't obvious.

This is because the HighLevel DS classes check that the ds is attached before enabling
2018-12-24 02:06:53 -06:00
Thad House
ce1367a115 Make JNI library not found message clearer (#1495)
Closes #1472
2018-12-21 00:26:53 -08:00
Thad House
0d7d880261 Renable full Java 8 Compatibility (#1493) 2018-12-21 00:25:23 -08:00
Thad House
ca2acec88c Update to NI Libraries 2019v12 (#1492) 2018-12-21 00:24:44 -08:00
Thad House
3721463eb3 Don't use symbolic path searching for USB detection (#1491)
The USB directories we care about are not symbolic links, so we can ignore them.

There was a recursive symbolic link, which was causing failure.
2018-12-19 14:40:01 -08:00
Thad House
6e8f8be370 Make C++ examples able to run GradleRIO unit tests (#1490)
Closes #1484
2018-12-17 09:26:20 -08:00
Thad House
d84240d8e9 Bump opencv version to 3.4.4-4 (#1489) 2018-12-14 20:17:51 -08:00
Thad House
1823cb2b68 Fix periodic can packets not being received properly (#1488)
Constant calls would result in timeout, because a valid packet wasn't being returned early.

Also fix data copies (was copying in wrong direction).
2018-12-14 17:43:48 -08:00
Tyler Veness
41596608cc Suppress Watchdog's generic timeout message in MotorSafety (#1486) 2018-12-14 10:53:33 -08:00
Thad House
0c3b488e18 Make ntcore instances not smart pointers (#1485)
During static shutdown, the instances hang on windows 7, so let them leak instead.
2018-12-13 21:33:58 -08:00
Thad House
7d7af287f6 Add empty classes to command/classes creation (#1479)
Closes #1478
2018-12-09 21:25:37 -08:00
Thad House
4119622994 Fix characters in license file (#1480)
Causes wpiformat errors on windows.
2018-12-09 21:23:19 -08:00
Peter Johnson
d528a77963 wpiutil: Fix resources build (#1476) 2018-12-09 11:45:11 -08:00
Peter Johnson
dab7e1b7a2 Add multiCameraServer to cmake build (#1477) 2018-12-09 11:44:45 -08:00
Peter Johnson
ab49345460 Add missing param javadoc comment and fix argument order inconsistency (#1475) 2018-12-09 08:37:09 -08:00
Peter Johnson
608d82423d wpiutil: Use scoped connections to ensure cleanup (#1474) 2018-12-09 01:36:36 -08:00
Peter Johnson
e0e15eafeb wpiutil: Add shared resources for http servers
Files are named only with major.minor versions.  Full versions are:
* bootstrap 4.1.3
* coreui 2.1.8
* feather 4.8.0
* jquery 3.3.1
* popper 1.14.4
2018-12-09 00:58:04 -08:00
Peter Johnson
0fb24538a7 wpiutil: HttpServerConnection: add SendStaticResponse
This function is intended for use when the content is a static const variable.
It allows gzipped static data, but doesn't provide the functionality to ungzip
it if the client doesn't support gzip.  This is because it would add a
dependency on zlib and basically all clients support gzip.

Change extraHeader on all Send functions to include the final newline,
this makes it easier to build up extra headers incrementally.

Expose sig::Connection for messageComplete and headerConn to allow them to
be disconnected by users of the class.  This is commonly needed for things
like WebSocket upgrades.
2018-12-09 00:58:04 -08:00
Thad House
d65547ea74 Bump OpenCV version (#1471) 2018-12-08 23:12:39 -08:00
Peter Johnson
bfe15245a6 Add multiCameraServer executable (#1422)
This standalone CameraServer reads its configuration from a json file.
2018-12-07 23:57:37 -08:00
Nicolas Machado
ff58c5156a Change SmartDashboard type of PIDBase.cpp to match PIDBase.java (#1470) 2018-12-07 19:40:31 -08:00
Tyler Veness
6d4326a560 Rate-limit Watchdog timeout prints to 1Hz (#1459) 2018-12-07 19:39:02 -08:00
Sam Carlberg
97ba195b88 Fix LiveWindow attempting to start listeners on uninitialized sendables (#1463)
Additionally adds a defensive check in SendableBuilderImpl to avoid the NPE.
2018-12-07 19:38:22 -08:00
Thad House
3d546428ab Add missing SubTableListener methods to C++ NetworkTable (#1465) 2018-12-06 23:27:49 -08:00
Dustin Spicuzza
b64dfacff3 DriverStation: fix error checking for GetXXXAxis and GetXXXPov (#1469)
Fixes #1436
2018-12-06 22:31:14 -08:00
Peter Johnson
dcbf02a1ec Update auto SPI for timestamp changes (#1457)
The 2019 FPGA image switched the output of auto SPI from plain bytes to a
sequence of 32-bit words (timestamp, then words with the byte values in the
least significant byte of each word).

In addition to changing the HAL and simulators to reflect this, add piecewise
integration support to wpilibc/wpilibj SPI to take advantage of the timestamps
and use it in the ADXRS450 gyro.
2018-12-06 22:29:20 -08:00
Thad House
7e1ec28839 NI image 2019v9 (#1467) 2018-12-06 21:59:13 -08:00
Thad House
ef16317f8f Update NativeUtils and Doxygen (#1462)
Adds debug stripping to executables.
Copies .debug and .pdb files to install directories to ease debugging.

Update to v0.5 of doxygen, which fixes the download location.
2018-12-05 00:27:18 -08:00
Tyler Veness
26e8e587f9 MotorSafety: Use Watchdog instead of DS class polling (#1442) 2018-12-01 01:34:52 -08:00
Dustin Spicuzza
0d0492bfcc HAL: Add additional error messages to HAL_GetErrorMessage (#965) 2018-12-01 00:06:30 -08:00
Tyler Veness
3b33abfc7b Make Watchdog use single thread dispatch (#1347)
Notifier has one thread per instance because the callbacks must be
asynchronous. Watchdog callbacks can be synchronous, so this overhead
can be done away with via a scheduler thread akin to what the HAL
Notifier does.
2018-12-01 00:05:33 -08:00
Peter Johnson
99033481e0 Add netconsoleTee
This is similar to netconsoleServer, but is designed to operate as a tee
in a pipeline (it reads console data from stdin).
2018-11-30 23:06:31 -08:00
Peter Johnson
b4901985b7 Add netconsoleServer
This is a updated version of netconsole-host that can serve either as a
new-style TCP riolog or output UDP to either localhost or broadcast.
2018-11-30 23:06:31 -08:00
Peter Johnson
97edb6c68f wpiutil: uv::Buffer: Add Dup() function 2018-11-30 23:06:31 -08:00
Peter Johnson
73de3364b7 AxisCamera constructor: add StringRef overload (#1458)
This avoids a conversion ambiguity when StringRef is passed.
2018-11-30 22:35:56 -08:00
Thad House
5551981b3f Upgrade to Gradle 5.0 (#1444)
Also skip raspbian for gazebo.
2018-11-29 23:17:06 -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
Thad House
c405188052 Fix directory iterators not working correctly (#1454)
The size of the directory_entry was different between translation units.
This was caused by the FILE_OFFSET_BITS macro when building wpiutil.
Removing that fixes the issue.
Should fix NavX USB issues.
2018-11-29 00:24:10 -08:00
Thad House
bea0565ac9 Update to OpenCV 3.4.4 (#1452) 2018-11-28 12:26:56 -08:00
Peter Johnson
0b03454366 wpiutil: Replace LLVM Optional with C++17-compatible optional
Imported from https://github.com/akrzemi1/Optional with minor changes:
- Compiler conditional simplifications (we only use recent versions)
- Move from std::experimental to wpi namespace
- Change tests to integrate with Google Test

Update LLVM use cases.
2018-11-28 12:23:56 -08:00
Peter Johnson
489701cacc wpiutil: Rename Optional.h to LLVMOptional.h 2018-11-28 12:23:56 -08:00
Tyler
a769d56ec1 Create C++ ShuffleBoard example (#1438) 2018-11-28 12:13:38 -08:00
Sam Carlberg
6f0c185a05 Add methods to change the selected tab in the Shuffleboard app (#1448) 2018-11-27 22:12:50 -08:00
Sam Carlberg
a60f312d19 Add eager null checks in drive base classes (#1447)
All null motors will be specified in the error messages.
2018-11-27 18:11:56 -08:00
Tyler Veness
acb786a791 Remove MotorSafetyHelper, create MotorSafety base class instead (#562)
Most of the MotorSafety implementation was moved into the MotorSafety base
class. SafePWM's inheritance of MotorSafety was moved into PWM to
eliminate Java needing a helper class.

In Java, a helper class for Sendable (SendableImpl) was added due to
lack of multiple inheritance.
2018-11-22 21:15:26 -08:00
Peter Johnson
df347e3d80 wpiutil: uv::Process: Revamp args/options approach (#1434) 2018-11-19 19:54:54 -08:00
Peter Johnson
e4aa45f34b wpiutil: WebSocket: Fix Sec-Websocket-Accept computation
It needs to use the raw SHA1 bytes, not the hex-decoded text.
2018-11-19 19:24:28 -08:00
Peter Johnson
75cc3cda28 wpiutil: SHA1: Add method to get raw bytes instead of hex 2018-11-19 19:24:28 -08:00
Sam Carlberg
45f4472d42 Add mechanism to control Shuffleboard recordings and add event markers (#1414) 2018-11-18 23:15:30 -08:00
Thad House
69cb53b51b Add support for USB Webcams on Windows (#1390) 2018-11-17 23:16:35 -08:00
Tyler Veness
70a66fc943 Make Gradle show stdout for wpilibj tests (#1431) 2018-11-17 20:29:27 -08:00
Austin Schuh
9207d788ab Convert ReadInterrupt* to return int64_t time (#1417)
HAL_ReadInterruptRisingTimestamp and HAL_ReadInterruptFallingTimestamp
return time as a double.  Instead, keep the raw integer count and move the
double conversion into the C++ and Java code.  This enables comparison of the
time with other timers.
2018-11-15 21:22:03 -08:00
Thad House
ef3a31aa20 Add an example of using the HAL directly (#1374)
This is useful for advanced users, and shows a few things like error messages, and DS things that are needed.
2018-11-15 19:33:50 -08:00
Tyler Veness
63775362fe Remove SynchronousPID class (#1429)
PR #1300 supersedes it, but won't be merged until the 2020 season. Since
SynchronousPID hasn't been used during a season, it would be best to
just remove it to avoid breakage when we deprecate and remove it again.
2018-11-15 19:25:31 -08:00
Tyler Veness
55493b0c18 Fix polymorphic exception types being caught by value (#1426)
Catching these by value breaks the build with GCC 8.2.1.
2018-11-12 19:39:49 -08:00
Tyler Veness
1696557c46 Fix deprecation warning in wpilibj shuffleboard example (#1427)
TimedRobot should be used instead of IterativeRobot.
2018-11-12 19:38:50 -08:00
Thad House
ecd376be4c Export C functions from JNI statically linked library (#1425)
The JNI libraries are useful from other tools, so they should contain the C functions.
2018-11-12 19:38:35 -08:00
Peter Johnson
f54c0f70f6 Update opencv to 3.4.3-19 (#1424) 2018-11-11 19:27:20 -08:00
Peter Johnson
9bc998f4b0 cscore: Add JSON for source settings (#1423)
This allows save and restore of camera settings.  The restore is a bit
smarter than the save.

* Fix mime types in mjpeg server

* wpiutil: WPI_LOG: Make sure level is an unsigned int
2018-11-10 20:30:02 -08:00
Peter Johnson
43d188a429 RobotBase: Call cscore Shutdown() from destructor 2018-11-09 23:33:55 -08:00
Peter Johnson
563d5334c9 Update OpenCV to 3.4.3-17 2018-11-09 23:33:55 -08:00
Peter Johnson
193b0a222c cscore: Add Shutdown() function
This allows ordered shutdown / destruction of sources and sinks prior to
global singleton destruction.
2018-11-09 23:33:55 -08:00
Peter Johnson
76f5d153fa wpiutil: Add Stop() to EventLoopRunner
This allows stopping the event loop without having to destroy the object.

Also fix ExecSync() to actually wait for the call to complete.
2018-11-09 23:33:55 -08:00
Peter Johnson
19caeca990 cscore: Use more standard naming for Instance public variables 2018-11-09 23:33:55 -08:00
Peter Johnson
0abae17653 cscore: Refactor sink and source creation
Also make sources and sinks members of Instance private, with appropriate
accessor functions.
2018-11-09 23:33:55 -08:00
Peter Johnson
81d10bc656 cscore: Build examples on Windows (#1421) 2018-11-09 22:42:04 -08:00
Austin Shalit
b51b86525d Stop webserver on test run (#1420) 2018-11-09 20:36:35 -08:00
Peter Johnson
ace37c517e CameraServer: enable usb cameras on non-Linux platforms (#1411) 2018-11-09 20:27:23 -08:00
Austin Schuh
ac751d3224 Fix unused variable warnings in ntcore (#1416)
This avoids -Wextra warnings.
2018-11-09 20:02:58 -08:00
Thad House
7c9a3c4d77 Update NI Library to 2019.7.1 and OpenCV to 3.4.3-16 (#1418)
Add def for each to eliminate duplication of version number.
2018-11-09 19:59:06 -08:00
Sam Carlberg
8be693f55d Fix list layout in shuffleboard example (#1413) 2018-11-09 01:14:15 -08:00
Peter Johnson
622ae29dff CameraServer: Change opencv sources to publish "cv:" type (#1412)
The LabVIEW dashboard has been fixed to understand this prefix.
2018-11-09 01:13:39 -08:00
Peter Johnson
e7c98feca2 libuv: Use WPI (FPGA) clock on roboRio (#1409)
This is set to the FPGA clock by HAL_Initialize.  Note this change means
that libuv loops should not be started until after HAL_Initialize is called (on the Rio).
Non-Rio functionality is unchanged.
2018-11-07 00:06:18 -08:00
Jaci Brunning
28087424ec Add deploy directory detection (#1400)
Add Filesystem class for java and namespace methods for C++ for detecting deploy location.
2018-11-02 13:16:44 -07:00
Peter Johnson
b6830638df NetworkListener: use Pimpl idiom (#1405)
This enables different platforms to use very different implementations.
2018-11-02 13:14:06 -07:00
Liam Kinne
fb557f49ea Add missing driver station documentation (#1388) 2018-11-01 23:34:48 -07:00
Peter Johnson
746f950a0b Remove ifdefs from linux NetworkListener (#1404) 2018-11-01 23:27:22 -07:00
Peter Johnson
9a38a3e188 Don't use static for raw_ostream outs/errs (#1401)
Static destruction order is not well defined, so it was possible for outs()
or errs() return value to be destroyed even while other code was running,
resulting in a crash.  Instead dynamically allocate the static so the
destructor never runs.  While this technically leaks, valgrind generally
supresses such leaks as the data is still "reachable" from the static pointer.
2018-11-01 10:48:50 -07:00
Thad House
2e3e3a47b9 Use a kill -9 after attemting a safe kill (#1397)
Should fix some deploy deadlocks.
2018-11-01 01:55:26 -07:00
Peter Johnson
e27d6d7bb8 cscore: Change impl to only one singleton (#1398)
This avoids a number of shutdown use-after-free races by controlling the
destruction order.  It also is a prerequisite to making the internal
interfaces mockable for unit testing.
2018-10-31 20:22:58 -07:00
Thad House
1dec0393a1 Fix static deletion race condition in DS thread (#1396)
The static condition variable was getting destroyed before the DS thread exited,
resulting in a deadlock on program exit when the DS thread tried to notify it.
This change moves the condition variable into the DS thread to avoid the race.
2018-10-30 11:51:17 -07:00
Peter Johnson
d03b020326 wpiutil: Add WorkerThread (#1302)
This provides a worker thread that can execute a work function with the result
going into either a future or a uv::Loop functor.
2018-10-29 20:54:42 -07:00
Austin Shalit
71e29b1d91 Remove unused import from rumble example (#1395)
This fixes a nit in #1394.
2018-10-29 20:54:15 -07:00
Thad House
f0b0965f9b Remove large HAL headers from wpilibc headers (#1386)
Now only includes the types in the wpilib headers.
Should immensely clean up intellisense.

Closes #1383
2018-10-29 12:49:17 -07:00
Austin Shalit
f774e47c80 Add an example showing how to use a hid rumbler (#1394) 2018-10-29 12:37:30 -07:00
Nicolas Machado
761933a164 Refactor Java Ultrasonic to use a List container (#1389) 2018-10-29 01:15:32 -07:00
Tyler Veness
99e0f08a6f Move applicable integration tests to native build as unit tests (#1364) 2018-10-29 00:12:38 -07:00
Tyler Veness
e89d5eb692 Fix stringop truncation warning from GCC 8.2 (#1393)
The next line adds a null terminator, but it's cleaner to just do a
std::memcpy() since the code already assumes a null terminator exists in
the source string.
2018-10-29 00:09:53 -07:00
Austin Shalit
2501e11886 Enable HTML5 javadocs (#1267)
This suppresses a build warning about HTML 4.01 being used.
2018-10-29 00:08:21 -07:00
Thad House
9174f23f36 Remove some usages of windows.h (#1370)
For HAL and wpilib, we don't need them, especially where they were being used.
2018-10-28 22:33:55 -07:00
Redrield
9f6544fa87 Allow binding commands to POV (#1378) 2018-10-28 21:54:06 -07:00
Peter Johnson
9a1af132bf Unify GetHostname() and use libuv implementation (#1391) 2018-10-28 19:01:48 -07:00
Thad House
a8aacd3657 Update build setup for raspbian and debug binaries (#1384)
- Build both debug and release binaries
- Append "d" to debug libraries in the style of opencv
- Split shared and static classifiers
- Add raspbian support
2018-10-27 00:19:38 -07:00
Peter Johnson
8ff81f5a2a cscore: Separate platform-specific sources (#1387) 2018-10-23 22:59:47 -07:00
Liam Kinne
349e273ecc AnalogGyro: add "calibrating for n seconds" message (#1380) 2018-10-23 00:29:23 -07:00
Tyler Veness
0a2ab4f0d7 Revert change in behavior in HeldButtonScheduler (#1381)
Originally, the command was restarted every time the scheduler was
executed if the button was pressed. #1340 changed this behavior in a
breaking manner.
2018-10-20 21:25:37 -07:00
Peter Johnson
7c1a7332e1 uv::Async, uv::AsyncFunction: allow calling from within loop 2018-10-16 09:40:59 -07:00
Peter Johnson
172e438cd6 wpiutil: uv::Async: Keep weak reference to loop
Other handles can only be used within the loop itself, but Async is intended
to be used from another thread.  This introduces the possibility of a race
condition between the loop being destroyed and the Async being destroyed.
Change Async to keep a weak reference to a loop and check it before performing
libuv operations.
2018-10-16 09:40:59 -07:00
Peter Johnson
1a7a0db1ff wpiutil: Change uv::AsyncFunction to use promise/future.
This allows the called function to pass along the promise to another
asynchronous callback.

To avoid memory allocations, add a home-rolled, simplified, non-allocating
version of std::promise and std::future as wpi::promise and wpi::future.
2018-10-16 09:40:59 -07:00
Thad House
11e5faf469 Use Array Constructor rather then new array to toArray (#1368)
A bit cleaner to use, and more standard for the current java. Still java 8 compatible.
2018-10-16 01:30:42 -07:00
Peter Johnson
c7118f8ade wpiutil: Signal: Don't use std::forward when calling (#1371)
This causes a std::move of objects that are both moveable and copyable.
2018-10-16 00:39:16 -07:00
Peter Johnson
7933d2cbe5 wpiutil: uv: Don't close uninitialized handles (#1372) 2018-10-16 00:38:48 -07:00
Dan Katzuv
ce8c71b1f3 Fix link for license (#1367)
The previous license link referred to `license.txt', but the correct file is `LICENSE.txt`.
2018-10-14 09:58:54 -07:00
Liam Kinne
da9a575526 Rename squaredInputs to squareInputs in DifferentialDrive (#1361)
Fixes #1360.
2018-10-13 23:10:16 -07:00
Thad House
7068551a3e Bump OpenCV and GTest to 2019 dependencies (#1366) 2018-10-13 20:46:14 -07:00
Tyler Veness
bd9484a2f4 Make MyRobot compilation test use TimedRobot (#1363)
IterativeRobot is deprecated.
2018-10-12 23:41:05 -07:00
Thad House
b9fa3a4398 Update to 2019 RoboRIO and 2019 v4 image (#1352)
Also make updates for Java 11:
* Disable errorprone plugin (currently broken on Java 11)
* Update checkstyle to 8.12
* Update pmd to 6.7.0
2018-10-07 18:11:57 -07:00
Thad House
88b93c220e Update NativeUtils to not copy NI libraries to jenkins RoboRIO (#1359)
Allows for compile only shared libraries
2018-10-06 20:51:00 -07:00
Peter Johnson
0a937bb5b9 wpiutil: SafeThread: Ensure thread is released in destructor (#1358)
The thread must be released with either a detach or a join, otherwise
std::terminate is called.
2018-10-06 18:07:56 -07:00
Peter Johnson
613d5eda0d wpiutil: SafeThread: join on thread exit (#1357)
This can be conditionally disabled (for cases like JNI callbacks where the JVM
may block callbacks into it during shutdown).
2018-10-06 15:17:13 -07:00
Peter Johnson
18c8cce6a7 SafeThread: Avoid use-after-free risk in thread shutdown (#1355)
Use shared_ptr to keep data alive until the thread has terminated.
2018-10-05 16:32:43 -07:00
Peter Johnson
36000ddb36 wpiutil: uv::Loop: Store the thread ID of the loop 2018-10-05 13:32:51 -07:00
Peter Johnson
de6d6c9a5c wpiutil: EventLoopRunner: Allow getting the loop shared_ptr. 2018-10-05 13:32:51 -07:00
Peter Johnson
6d99c0ac6c wpiutil: EventLoopRunner: Remove extraneous wpi namespace qualifier 2018-10-05 13:32:51 -07:00
Peter Johnson
164e9a2c7d wpiutil: uv::Work: Don't connect work and afterWork if they're null 2018-10-05 13:32:51 -07:00
Peter Johnson
f3fb95af70 wpiutil: uv::Tcp: Simplify reuse function 2018-10-05 13:32:51 -07:00
Peter Johnson
40a9fc44ff wpiutil: uv::Poll: add reuse functionality 2018-10-05 13:32:51 -07:00
Thad House
f0ac048645 Remove pmd and checkstyle publishing from azure (#1353)
Bug in azure makes out of branch PRs fail
2018-10-05 10:20:20 -07:00
Tyler Veness
81498e6af9 Deprecate IterativeRobot in favor of TimedRobot (#1341)
Since https://github.com/wpilibsuite/allwpilib/issues/786 has been
closed as not a legitimate concern, there is now no reason to use
IterativeRobot over TimedRobot. It's a drop-in replacement that's
strictly an improvement in terms of execution jitter.

To migrate, one simply has to replace the IterativeRobot subclass in
their robot code with TimedRobot.
2018-10-04 01:02:07 -07:00
Thad House
f1056efa01 Updates version plugin to 2.2 (#1349)
Fixes describe bug, and removes timestamp from published version number
2018-10-04 01:01:00 -07:00
ariovistus
54fbec27df Fix typo (#1348) 2018-10-04 00:59:47 -07:00
Thad House
fd82153456 Fix shuffleboard C++ tests, and run them on desktop (#1351) 2018-10-02 20:55:03 -07:00
Thad House
7b471d8c62 Fix windows image on azure pipelines (#1350) 2018-10-02 10:42:18 -07:00
Sam Carlberg
175c6c1f01 Add fluent builders for more flexibly adding data to Shuffleboard (#1022) 2018-09-28 01:18:18 -07:00
Thad House
ac7dfa5042 Switch to using containers for Linux builds on Azure (#1335) 2018-09-27 22:38:33 -07:00
Tyler Veness
a732854866 Clean up edge detection logic in ButtonScheduler subclasses (#1340)
This also changes the behavior of whileActive to call start once on the starting edge
instead of every loop iteration.
2018-09-26 22:55:34 -07:00
Tyler Veness
6171856020 Document Watchdog epochs better (#1345) 2018-09-26 22:53:34 -07:00
Thad House
d5d744a390 Fix publishing of templates on jenkins (#1343) 2018-09-26 21:10:26 -07:00
Tyler Veness
8b1274d744 Replace typedefs in C++ with using declarations (#1339)
These are more readable than typedefs. C headers were left alone.
2018-09-26 00:09:25 -07:00
Tyler Veness
26c33a9a56 Remove priority_condition_variable (#1337)
Make wpi::condition_variable typedef to std::condition_variable_any if
wpi::mutex typedefs to priority_mutex.

priority_condition_variable was originally intended as a copy of
std::condition_variable_any that also returned the internal handle like
std::condition_variable. This was needed because NetComm required a
pthread_cond_t. We no longer use it anywhere.

Its args were specialized for priority_mutex, but
std::condition_variable_any supports this and more through
templatization.
2018-09-25 21:38:52 -07:00
Thad House
5fad2b1056 Remove travis and appveyor configuration files (#1338)
Also update build badge to point to Azure instead.
2018-09-25 21:37:04 -07:00
Thad House
32ec07ee01 Throw correct exception in HAL_getJoystickAxes/POVs JNI (#1336)
Was incorrectly not returning immediately after throwing the exception.

Also add more detail to exception.
2018-09-24 22:17:17 -07:00
Thad House
15c5a820bf Publish tests to azure ci (#1334)
Makes reviews easier.
2018-09-24 16:36:50 -07:00
Thad House
e15fabd2e1 Add cmake azure build (#1332) 2018-09-24 16:36:24 -07:00
Tyler Veness
1aa8446725 Add move constructors and assignment operators to wpilibc (#1314)
Fixes #898.
2018-09-24 00:08:25 -07:00
Thad House
b1965f74a8 Add styleguide check to azure pipelines build (#1331) 2018-09-23 23:38:04 -07:00
Thad House
0c58a0a705 Repackage CameraServer classes (#1321)
This is necessary for modularization.
Move the wpilibj CameraServer classes to the cameraserver package.
Move the edu.wpi.first.wpilibj.vision package to edu.wpi.first.vision.
To avoid code breakage, add deprecated copies of the wpilibj classes to the wpilibj jar.
2018-09-23 21:20:12 -07:00
Tyler Veness
467c9fd686 Add kInvalid value to HAL_I2CPort and HAL_SPIPort (#1329)
This allows HAL_CloseI2C() and HAL_CloseSPI() to be noops, which makes
enabling move semantics in the I2C and SPI wpilibc classes easier and
cleaner.

Fixes #1328.
2018-09-23 21:14:04 -07:00
Tyler Veness
b505bbefd1 Rename variable in SPI class not compliant with style guide (#1330)
Also rename some wpilibj SPI class variables to match wpilibc and
better communicate their intent.
2018-09-23 18:26:02 -07:00
Thad House
5c6b78ea2b Set up CI with Azure Pipelines (#1306) 2018-09-23 17:43:23 -07:00
Thad House
f89274fb13 Fix hal header zip task dependencies (#1327)
Sometimes wouldn't include generated header file
2018-09-21 12:04:11 -07:00
Thad House
1137582a7a Revert "Move deprecated ntcore classes to wpilibj jar (#1322)" (#1326)
This reverts commit 12c92a822d.
2018-09-21 11:32:11 -07:00
Thad House
e26e3b6aa8 Fix HAL Headers Zip (#1325)
Was generating file into wrong directory
2018-09-21 10:51:17 -07:00
Thad House
456d3e16a6 Update NI Libraries to layout without C++ (#1324)
An explicit classifier is not required because we now generate usage reporting
2018-09-21 10:36:40 -07:00
Thad House
e210073044 Move HAL classes to their own base package (#1317)
Needed for modularization.
2018-09-20 21:59:46 -07:00
Thad House
0068b6aea3 Remove wpilibj tests from wpilibjIntegrationTests (#1323)
Since the integration tests are still on junit 4, the wpilibj junit 5 tests fail.
2018-09-20 21:57:59 -07:00
Thad House
12c92a822d Move deprecated ntcore classes to wpilibj jar (#1322)
Will allow for modularization
2018-09-20 21:50:30 -07:00
Thad House
d2a5aaafdd Use external dependencies for NI and NetComm libraries (#1304)
This removes a number of large binary files from the repo and enables vendors
to depend on these libraries separately.
2018-09-19 21:57:58 -07:00
Tyler Veness
bedef476fd Replace IterativeRobot in examples with TimedRobot (#1310)
Fixes #1309.
2018-09-19 21:41:08 -07:00
Thad House
59386635e7 Add CAN API constructor that takes explicit manufacturer and device type (#1311)
Useful for vendors wanting to use the API and make their own device parameters
2018-09-19 21:40:47 -07:00
Thad House
a846ed062f Add virtual destructor to CameraServerShared (#1313)
Fixes mac builds after update
2018-09-19 21:39:57 -07:00
Matt Soucy
8b5dc53cc7 Add Lambda support to InstantCommand (#1262) 2018-09-11 23:44:22 -07:00
Kay Kasemir
59700882f1 PIDController: Mention unit for 'period' (#1305) 2018-09-11 21:38:19 -07:00
Peter Johnson
025af24523 Make NetworkTableEntry.callRpc and createRpc public (#1303) 2018-09-08 21:19:14 -07:00
Peter Johnson
c0ff6198b3 Change hal sim to use spinlocks (#1291)
This makes callback registration completely thread safe.

This patch also uses templates and macros to dramatically reduce the amount of
manual boilerplate.
2018-09-03 16:08:07 -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
0b113ad9ce Fix some PIDCommand constructors not forwarding subsystems (#1299)
Also added missing constructor to wpilibc's InstantCommand and renamed
argument from requirement to subsystem as per
https://github.com/wpilibsuite/allwpilib/pull/1275#issuecomment-416071940.
2018-09-02 14:18:12 -07:00
Peter Johnson
c8482cd6d2 wpiutil: Add WebSocket implementation (#1186)
This is a RFC 6455 compliant implementation with both client and server support.
2018-08-24 20:54:23 -07:00
Peter Johnson
d6d5321828 wpiutil UidVector: Implement clear() and forward iterator (#1293)
The forward iterator only iterates over "live" elements.

Also add a couple of unit tests for UidVector.
2018-08-24 20:39:57 -07:00
Peter Johnson
8d91343bf5 wpiutil spinlock.h: Include STL mutex for convenience (#1292)
The STL mutex header defines classes like lock_guard and unique_lock.
2018-08-24 20:39:20 -07:00
PJ Reiniger
488ba79379 Add more checkstyle checks to simulator code (#1289) 2018-08-23 23:15:29 -07:00
PJ Reiniger
de212a9dd0 Add names to simulator components (#1268)
Makes configuration easier when you can associate the items with a name
instead of just a port number. Important if there is a GUI added at some
point.
2018-08-23 17:59:09 -07:00
Peter Johnson
8d8f120cc3 EventLoopRunner: Use AsyncFunction 2018-08-20 22:21:53 -07:00
Peter Johnson
57490e0002 Add uv::AsyncFunction to do a roundtrip function call to a uv::Async
This optionally blocks to wait for a return value.
2018-08-20 22:21:53 -07:00
Peter Johnson
1de1900dbb Change uv::Async to accept data parameters
This is a breaking change as it makes Async a template (e.g. Async<> must
be used instead of just Async).  When data parameters are provided, an
internal mutex and vector is used to hold the parameter packs until the loop
runs.
2018-08-20 22:21:53 -07:00
Peter Johnson
4a3e43d4a7 Add HttpMultipartScanner (#1197)
This is a non-blocking version of FindMultipartBoundary.
2018-08-20 22:00:54 -07:00
Peter Johnson
9e37ee13de Add wpi::HttpServerConnection and an example of its use (#1281) 2018-08-20 13:11:39 -07:00
Peter Johnson
7b95c5341a ntcore: Change params in Java RpcAnswer from String to byte[] (#1280)
The underlying protocol uses raw bytes, so they should not be required to be
a valid string.
2018-08-20 13:07:13 -07:00
Peter Johnson
5283726cce ntcore: Describe RPC version 0 in spec (#1279) 2018-08-20 13:06:43 -07:00
Peter Johnson
0b8f4b5e6c Add libdl to wpiutil cmake build (#1288)
This is required for dlopen, which is required by libuv.
2018-08-20 00:56:16 -07:00
Peter Johnson
a5f7342fce Run cmake build in travis (#1287) 2018-08-20 00:55:54 -07:00
Peter Johnson
6df7425440 cmake: Compile cscore and wpiutil examples (#1286) 2018-08-19 23:22:52 -07:00
Peter Johnson
d7b68f3f95 Unbreak cmake build (#1285) 2018-08-19 23:21:51 -07:00
Matt Soucy
e28295fc7b Add dependency injection of Subsystem to Command (#1275) 2018-08-19 19:43:21 -07:00
Peter Johnson
6df500e726 Add missing library dependencies in simulation dev executables (#1284) 2018-08-19 19:12:43 -07:00
Peter Johnson
83cfb8b19f UrlParser: fix Has() functions (#1283) 2018-08-19 17:25:42 -07:00
Peter Johnson
82b25d0ec9 spinlock_bench.cpp: Fix wpiformat warning (#1282) 2018-08-19 17:25:20 -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
Peter Johnson
fa78f30e30 ntcore: Make protocol revision more visible in docs (#1278)
Also add author line to correct document formatting.
2018-08-19 01:38:23 -07:00
Peter Johnson
46ae19d082 wpiutil: Add a mutex-compatible spinlock implementation (#1272)
Note this is only faster than mutex if compiler optimization is enabled.
2018-08-19 01:01:10 -07:00
Peter Johnson
77124a229e Twine: disable part of isValid() that causes spurious warnings (#1271) 2018-08-16 19:35:40 -07:00
PJ Reiniger
1462a5bd46 Fix spacing and const correctness in sim (#1269) 2018-08-15 22:17:59 -07:00
Austin Shalit
44099d9a21 Update errorprone config for Java 10 (#1265) 2018-08-10 20:02:41 -07:00
PJ Reiniger
c2ceebfb9c Add gyro and accelerometer simulator wrappers (#1183) 2018-08-01 21:39:20 -07:00
Peter Johnson
0a0d9245e2 cscore: Add connection strategy to sources (#1252)
By default, sources automatically manage their connection based on whether
any sinks are connected.  This change allows the user to keep a connection
open or force it closed regardless of the number of connected sinks.
2018-07-29 21:18:45 -07:00
Jamie Sinn
7bd3f9f0bd Change ButtonScheduler scope start method to public (#1254)
Fixes #765.
2018-07-29 19:26:48 -07:00
Tyler Veness
4801ae2499 Replace ellipsis characters munged by wpiformat with three periods (#1256)
The Java LinearDigitalFilter class has already been changed.
2018-07-29 19:25:26 -07:00
Peter Johnson
0e9172f9a7 Fix many errorprone warnings (#1247)
This fixes two real bugs:
- TimedRobot had a m_period that was hiding the IterativeRobotBase m_period
  and was not getting initialized.
- PDPSim was swapping two parameters to getCurrent()
2018-07-29 16:47:22 -07:00
Peter Johnson
6db5f80430 docs: Set use_mathjax to true (#1251)
This avoids depending on latex for HTML formula output.
2018-07-29 15:36:28 -07:00
Peter Johnson
898076f698 docs/build.gradle: Use unix EOL (#1250) 2018-07-29 15:14:37 -07:00
Peter Johnson
195e101816 cscore: Use Twine instead of StringRef in API (#1244) 2018-07-29 12:53:41 -07:00
Peter Johnson
97a8f8f47b HAL: Add Doxygen module documentation (#1246)
This helps organize the functions in the generated docs.
2018-07-29 12:49:46 -07:00
Peter Johnson
9408fd5176 Add Doxygen comments for namespaces (#1245) 2018-07-29 12:49:28 -07:00
Thad House
00c2cd7dab Improve JNI loading efficiency (#1224)
A hash is stored for each native library with the name libraryName.hash.
If the library is not found on the system search path, it is extracted to a cache directory.
Extracted libraries are named with the hash appended, so the library will not be
re-extracted if one with the same hash already exists.

Hashing without the hash file requires double traversing if the file is not in the cache,
but it is still faster than creating a new file in most cases.  This won't be needed
after opencv is updated to provide a hash as well.
2018-07-29 10:20:41 -07:00
Austin Shalit
cbb62fb98f Fix errorprone so it is version locked and reports warnings (#1242) 2018-07-29 09:32:22 -07:00
Austin Shalit
a11fcb605d Add UseConcurrentHashMap exception to PMD and clean NOPMDs (#1243) 2018-07-29 09:29:32 -07:00
Austin Shalit
139b1720b2 Fix JavaDoc generation (#1241)
JavaDoc cannot handle redirects so HTTP link does not work anymore.
It also looks like javadoc.options was the wrong thing to set.
Options properly connects external docs to ours.
Re-enabled warnings so these things will pop out if they turn up again.
2018-07-29 09:28:41 -07:00
Austin Shalit
011f0ff536 UsbCamera: Make setConnectVerbose public and add test (#1240) 2018-07-29 00:48:00 -07:00
Thad House
75a67202e5 Add documentation building to repo (#1238)
Running build will now build docs. If you just want to build docs, run :documentation:build
2018-07-28 17:54:41 -07:00
Peter Johnson
186e1dc54b ntcore: Documentation cleanups (#1237) 2018-07-28 17:41:57 -07:00
Peter Johnson
f2393feeef cscore: Documentation cleanups (#1236)
Reformat the C++ documentation to use the normal comment style and
add doxygen grouping.
2018-07-28 17:35:33 -07:00
Peter Johnson
66e35128c9 Use Pimpl idiom for CameraServer
This dramatically reduces header dependencies.
2018-07-28 17:34:42 -07:00
Peter Johnson
6933fefe55 Use Pimpl idiom for Scheduler
Particularly since Scheduler is a singleton, it makes a lot of sense to
use the pointer-to-implementation idiom to reduce header depedencies.
2018-07-28 17:34:42 -07:00
Peter Johnson
fedf828120 Command: Use SmallPtrSet for requirements instead of std::set 2018-07-28 17:34:42 -07:00
Peter Johnson
eb64ea9fc7 MotorSafetyHelper: Use SmallPtrSet instead of std::set 2018-07-28 17:34:42 -07:00
Peter Johnson
826ed7fe3c SmallPtrSet: Fix makeIterator 2018-07-28 17:34:42 -07:00
Peter Johnson
a2d314b0d9 ConditionalCommand.cpp: Remove iostream include 2018-07-28 17:34:42 -07:00
Peter Johnson
6b37ca9f9a UsbCamera: Allow silencing of Connecting message (#1231) 2018-07-28 14:57:41 -07:00
Peter Johnson
0614913f1a Add a way to indicate a Sendable is an actuator (#1226)
SendableBuilder.setActuator() sets the .actuator key in the network table
so dashboards can change behavior on the client side if desired, and also
sets a local flag (retrievable via isActuator()).

Both make drive bases actuators and call setSafeState on them.
2018-07-28 14:04:46 -07:00
Peter Johnson
5fafaf6272 Add confirmation to SendableChooser (#1217)
This echos back the "selected" value to the "active" key to enable dashboards
to display positive feedback to the user that the value is actually set on
the robot side.

Also fixes SendableChooser so it can be safely added to multiple tables.
Changes to "selected" in any table will result in all "active" values being
updated.

Now that adding SendableChooser to multiple tables is supported, an ".instance"
key enables dashboards to treat the same SendableChooser as a common instance
if desired.
2018-07-28 10:43:47 -07:00
Peter Johnson
397a296e25 Add a .controllable key as a standard part of Sendable (#1225)
This indicates whether or not the Sendable listeners are installed.
It is set to true when SendableBuilder.startListeners() starts the listeners,
and set to false when SendableBuilder.stopListeners() stops the listeners.

This allows dashboards to choose to change their widget display based on
whether or not the value is actually controllable.
2018-07-28 10:42:31 -07:00
Thad House
1d9ed8f458 Fix SensorUtil issues (#1194)
C++ PDP was missing module check, and channel check called module.
Java docs said 1 based instead of 0 based.
2018-07-28 09:51:49 -07:00
Austin Shalit
bbb622aaa6 Revert "Use ASAN when on Clang (#1187)" (#1234)
This reverts commit 340b26bada.

Closes #1232

We are reverting this because it broke Mac builds. The root cause of
this is a requirement that the entire application must be built with ASAN
to link properly. For more information about why this is see the below link.

https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow#false-positives
2018-07-28 09:50:25 -07:00
Peter Johnson
8cbe7a6257 cscore: Move CvSourceImpl placeholders into SourceImpl (#1230)
This makes it easier to implement new non-camera Sources.
2018-07-27 23:15:35 -07:00
Peter Johnson
932308b497 MjpegServer: Add ability to set compression, etc in code (#1229)
This allows code to set the stream compression, resolution, and FPS used if
not specified in HTTP parameters by the client.
2018-07-27 23:00:15 -07:00
Peter Johnson
9398278250 cscore: Add properties support to VideoSink (#1228)
Refactor the Property internals into PropertyContainer.
2018-07-27 22:12:30 -07:00
Peter Johnson
c9a75a119a cscore: Support multiple levels of JPEG compression (#1223)
This allows two streams with different compression levels, and also allows
a stream to receive a different compression level than provided by a JPEG
camera (decompress and recompress).
2018-07-27 21:51:40 -07:00
Peter Johnson
04ee8dbe79 UsbCamera: In JPEG mode, get size from image instead of mode (#1222)
Some cameras will accept a different resolution as the mode but then provide
JPEG images of a different size.  Trust the JPEG image size if available.

This also validates the JPEG image is actually JPEG.
2018-07-27 21:50:28 -07:00
Peter Johnson
7fd7192b16 Disable UvGetAddrInfo Concurrent test on Windows (#1227)
This test likes to intermittently hang for some unknown reason, so disable it.
2018-07-27 21:41:04 -07:00
Thad House
63c1f80d60 halsim_ds_socket: Update tag parsing, and add rumble support (#1214)
Outputs are now sent. Ensure only the proper number of outputs are actually sent though.

Also adds match time, and proper enable tags.
2018-07-26 01:30:29 -07:00
Tyler Veness
d54c2665dc Update UsageReporting enums and their uses for 2019 (#1218) 2018-07-25 19:58:05 -07:00
Peter Johnson
8aac46542d Add a SimpleBufferPool for uv::Buffer (#1215)
Buffers are reused on a regular basis in many use cases.
2018-07-25 00:58:54 -07:00
Thad House
c78e1499d7 Remove appveyor artifacts, and only build 64 bit (#1212)
There is a limit on artifacts, and doing both builds gains little and doubles build time.
2018-07-22 23:05:25 -07:00
Thad House
a34df5589e Switch DS Sim Sockets to use UV loops (#1211)
Also adds the simulation packet to force switch the DS to local.
2018-07-22 23:03:55 -07:00
PJ Reiniger
eb2c6e19f8 Add sim hooks to set match data (#1191) 2018-07-22 19:43:24 -07:00
Peter Johnson
c25d48fd0c HttpParser: Add Reset() function (#1210)
This allows reuse of the HttpParser object for multiple requests.
2018-07-22 19:41:23 -07:00
Tyler Veness
794403dcea Add shim headers for headers moved to cameraserver and frc folders
Shim headers were placed in the original location to warn users that they
are deprecated and that they should use the headers in the folders
instead.
2018-07-22 19:40:57 -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
Peter Johnson
31ced30c1e HttpParser: Change Execute() to return StringRef (#1209)
This is more user-friendly than returning the number of parsed bytes.
2018-07-22 15:07:22 -07:00
Jeremy White
74a306d47a Add halsim_ds_socket to allow a simulated robot to talk to the real DS (#1180)
This implements enough of the UDP and TCP protocol used by the FRC
driver station to allow us to talk to either QDriverStation or to the
real Driver Station.

This was inspired by a similar function in Toast by Jaci, and also
uses a lot of the research found in the QDriverStation project.
2018-07-22 15:00:06 -07:00
Peter Johnson
5bf5821138 Cleanup docs in uv::Stream and uv::Tcp (#1207) 2018-07-22 13:01:14 -07:00
Peter Johnson
eed28a5852 Add sockaddr_in overloads for uv::Tcp and uv::Udp (#1206)
These help avoid the need for reinterpret_casts in common use cases.
2018-07-22 13:01:00 -07:00
Peter Johnson
435e026c08 uv::Loop: Add user-defined data (#1205) 2018-07-22 13:00:47 -07:00
Peter Johnson
739267d36d Add Reuse function to uv::Tcp (#1208)
This allows reusing the Tcp object in cases when the connection errors out.
2018-07-22 12:31:50 -07:00
Jeremy White
85118a023d Minor fixes required to enable the simulated robots to run (#1181)
* Fix bugs in PacGoat Java example that prevent it from working.

We have conflicting ports in use, each of which causes a crash
at startup.  These changes fix those issues.

* Change to avoid a crash in Visual C++ when running simulated code.

Without this change, we would get a crash in SendableRobotBase when
constructing a Twine from the 'kOptions' constant string;
we'd get an unable to access memory exception.
2018-07-22 00:58:42 -07:00
Tyler Veness
ae72c0b296 Clean up style issues in wpilibj_frcnetcomm.py (#1199) 2018-07-21 23:50:40 -07:00
Thad House
b72885b4f8 Remove wildcard dep version from gazebo msg (#1203)
We don't want any wildcards in allwpilib.
Also uses plugin repo for protobuf rather then mavenCentral.
2018-07-21 23:50:01 -07:00
Peter Johnson
70b0d7cb03 UDPClient: Add receive functionality (#1204) 2018-07-21 23:49:16 -07:00
Thad House
053ca47d4e Update gradle dependencies (#1202)
ErrorProne fixes some Java 9 issues, vscode cpp fixes a bug and updates for lazy tasks, jni updates for lazy tasks
2018-07-20 16:56:22 -07:00
Jeremy White
74efe5aafe Get halsim_gazebo building again (#1201) 2018-07-20 16:24:48 -07:00
Thad House
fe5d7dd6ba Move DS caching from user level to the HAL (#1143)
Also switch eventName and gameSpecificData to fixed 64-byte arrays to avoid mallocs and
extra NetComm calls.  This behavior matches 2018 LabView.

The DS caching is kept in Java to avoid JNI and/or massive amounts of allocations.
This does not increase latency because Java still only hits NetComm once.

Moving the DS caching benefits all languages other than Java, because it avoids the need
for individual implementations.  If caching is ever added to NetComm, it will then only be
necessary to remove it from the HAL and Java rather than all languages.
2018-07-18 22:22:41 -07:00
Thad House
0b5df467e1 Update Native Utils to fix static allocations (#1196)
Should fix lag after 15 or so builds that was being seen with daemon.
2018-07-18 22:14:24 -07:00
Thad House
80134164a4 Move Java main function from library to user code (#1148)
It is much more reliable than the old approach, as it no longer depends on a magic string
in a manifest file, and if the user changes their main class, or makes it not import from
something RobotBase, it will fail to compile instead of failing at runtime.

With requiring an importer, we should be able to automate this in the importer.
2018-07-18 22:01:19 -07:00
Thad House
76b26c2df5 HAL_InitializePWMPort: Check for MXP port (#1195)
Previously all channels were incorrectly handled as MXP channels.

Closes #1182
2018-07-18 20:39:05 -07:00
Thad House
f8635e8abf Update to gradle 4.9 (#1193)
4.9 will be needed for some things being added to a few of our plugins. It adds the new lazy configuration tasks which help a good amount in some cases.
2018-07-18 20:36:10 -07:00
Peter Johnson
4029b5d84d Update gazebo plugins to Gazebo 9 (#1189)
Note: This breaks Gazebo 7 support.
2018-07-18 20:16:43 -07:00
Thad House
4c527b9b08 Add vscode intellisense settings (#1173) 2018-07-18 12:26:29 -07:00
Peter Johnson
caa03d23a3 Make JxArrayRef less error-prone for jxArray (#1190)
Add a length-taking overload so that if a length happens to be provided for
a jarray, the direct byte buffer overload is not used.
2018-07-17 20:19:49 -07:00
Peter Johnson
297863b17a Add HttpParser and UrlParser C++ wrappers for http_parser. 2018-07-17 02:24:56 -07:00
Peter Johnson
1992b67ee3 Import nodejs/http-parser.
Upstream version: 5b76466c6b9063e2c5982423962a16f7319c81f8
2018-07-17 02:24:56 -07:00
Peter Johnson
e2314f3528 wpiutil: Add C++ libuv wrappers (#1166)
- Provide an EventLoopRunner to run uv::Loop on a separate thread.

- Add raw_ostream wrapper for uv::Buffer.
2018-07-17 01:06:24 -07:00
Jaci Brunning
340b26bada Use ASAN when on Clang (#1187)
This currently only affects MacOS builds, as that's the only platform where clang is used.
2018-07-16 22:48:02 -07:00
Thad House
7f000fecc4 Force a DS mutex release on shutdown on desktop (#1188)
This fixes some issues with freezing tests.
2018-07-16 22:42:04 -07:00
PJ Reiniger
76c901ce78 Add simple motor simulation classes (#1117) 2018-07-12 20:11:26 -07:00
Thad House
57fc614074 Compile C headers in C mode, and fix cscore C (#1179) 2018-07-08 15:42:59 -07:00
Thad House
89d15f061b Fix main function initialization (#1176)
I don't have a good way to ensure this always works, so this is going to be a documentation issue.
But initializeHardwareConfiguration is now reentrant, so we can just have all tests call it.
2018-07-08 15:41:31 -07:00
Austin Shalit
f5b1028b5a Fix race conditions in command tests by increasing the delay time (#1178) 2018-07-08 12:39:15 -07:00
David Vo
ad3e2d7d3b Make HAL headers C-compatible (#1177)
Also fix the return type of HAL_IsNewControlData() and HAL_MatchType's type.

Since UsageReporting is intended to be namespaced, it is hidden when this is being used in C.

Fixes: #476
Closes: #535
Ref: #1122
2018-07-07 22:18:03 -07:00
Thad House
3818a8b3b6 Update to gradle 4.8.1 (#1174) 2018-07-04 09:41:18 -07:00
Thad House
59e8b60267 Add HAL Documentation (#1132) 2018-07-04 00:18:18 -07:00
Peter Johnson
de5d7d3c17 Only use priority_mutex on RoboRIO by default. (#1172)
On all Linux platforms it can be specifically requested by defining
WPI_USE_PRIORITY_MUTEX.
2018-07-03 20:35:07 -07:00
Jeremy White
ebd41fe0bb Bring back the gazebo plugins (#1063)
The models and meshes are not included. We will need
to find an alternate way to reintegrate these and use them.

* Add simulation/gz_msgs back, and build with Gradle.

* Add back in the frc simulation plugins for gazebo.

* Add a new shared library, halsim_gazebo.

This library will become the interface between the
HAL sim layer and gazebo.

* Preserve the first channel number used in created Encoders in the Sim MockData.

This allows us to use the DIO channel number to connect with simulated encoders.

* Have the HAL Simulator set the reverse direction on creation.

This enables a simulator to be aware of the direction.

* Add a drive_motor plugin.

This is a bit of a 'magic' motor, which allows us to build robot
models that drive in a more realistic fashion.  It does this
by apply forces directly to the chassis, rather than relying on
the complex motion dynamics of a driven wheel.

This in turn allows the model to reduce wheel friction,
reducing scrub, and allowing for a more natural driving experience.
2018-06-30 00:45:21 -07:00
Peter Johnson
70960b0251 Signal: rename Signal to Signal_mt and Signal_st to Signal.
The single-threaded version is fine for most of the use cases we're planning
on, and is half the size on most platforms.
2018-06-30 00:21:09 -07:00
Peter Johnson
c8afe9bc2f Signal: Optimize to use plain std::function.
This optimizes the common case of a single simple callback (e.g. std::function
or lambda) so no additional allocation is required.  As a Connection return
value is not possible in this case, provide a separate connect_connection()
function to provide that.
2018-06-30 00:21:09 -07:00
Peter Johnson
1ecaaafa6c Discuss and include licenses for third party software. (#1101) 2018-06-29 11:06:43 -07:00
Thad House
33a01b3146 Add maven documentation (#1140) 2018-06-28 20:07:31 -07:00
Austin Shalit
1d8456e2bf Move FRCNetComm.java into generated directory (#1168) 2018-06-28 13:37:14 -07:00
Peter Johnson
b5bacc09a7 libuv: Silence cast-function-type warning on GCC 8. (#1169)
GCC 8 treats void(*)(void) specially to silence the warning.
2018-06-28 00:33:24 -07:00
Peter Johnson
876c650471 wpiutil: Add a signal-slot implementation. (#1163)
Imported from https://github.com/palacaze/sigslot

Classes were renamed from lowercase_me to UppercaseMe style, primarily
to avoid conflicting with the C standard library "signal" function.  They
were also moved to the "wpi::sig" namespace.
2018-06-27 23:01:17 -07:00
Austin Shalit
3eae079db4 Add PDP usage reporting (#1167) 2018-06-24 23:48:22 -07:00
Peter Johnson
122fdf48b2 libuv: Hook up to build. 2018-06-24 10:31:55 -07:00
Peter Johnson
d94f49b3ba libuv: Silence clang compiler warning in uv-common.c 2018-06-24 10:31:55 -07:00
Peter Johnson
39670fc9c0 libuv: Add pragmas for win32 libraries. 2018-06-24 10:31:55 -07:00
Peter Johnson
6f0d50b9cb libuv: Avoid conditional-true compiler warning.
Instead use a preprocessor macro to comment out the code as necessary.
2018-06-24 10:31:55 -07:00
Peter Johnson
873b2ed13c libuv: Add missing casts. 2018-06-24 10:31:55 -07:00
Peter Johnson
321c144d21 libuv: Remove extern "C" from uv.h.
This results in name-mangling of the uv symbols and thereby avoids potential
symbol conflicts with system libuv installations.
2018-06-24 10:31:55 -07:00
Peter Johnson
13e1af259c libuv: Remove MSVC 2008 stdint from uv.h and uv-win.h. 2018-06-24 10:31:55 -07:00
Peter Johnson
9d7792ead0 libuv: Remove aix, os390, and sunos from uv-unix.h. 2018-06-24 10:31:55 -07:00
Peter Johnson
6d93d3c250 libuv: Rename source files from .c to .cpp.
This ensures they will actually get compiled as C++.
2018-06-24 10:31:55 -07:00
Peter Johnson
156822dbc8 Import libuv 1.21.0. 2018-06-24 10:31:55 -07:00
Peter Johnson
208f82d6f2 Revert "Add libuv dependency (#1109)"
This reverts commit 859b457c3d.
2018-06-24 10:31:55 -07:00
Tyler Veness
a818c7fd47 Add loop timing to IterativeRobot and TimedRobot (#781) 2018-06-24 00:29:21 -07:00
Austin Shalit
50b13d2f36 Convert UnitTestUtility to a JUnit 5 MockHardwareExtension (#1153)
Only initialize the HAL once.
2018-06-24 00:19:45 -07:00
Tyler Veness
b7807bf9d2 Clean up Command container iteration code (#73) 2018-06-23 17:41:45 -07:00
Peter Johnson
ea7d11b1db Twine: Make isNull() public. (#1162)
This makes it possible to pass "null" Twines and detect it in the callee.
2018-06-23 16:13:50 -07:00
Tyler Veness
212f378d08 Replace globalError in ErrorBase with a global set of all errors (#615) 2018-06-18 00:13:28 -07:00
Thad House
2faba39b58 Change wpilibc artifact name to match standard (#1158) 2018-06-17 20:28:43 -07:00
Thad House
064989f2e4 Fix projects having different version numbers (#1113) 2018-06-17 19:59:49 -07:00
Thad House
6b1b4796c2 Remove Link Script (#1159)
This is no longer required due to the move to GradleRIO (it was only used for Eclipse).
2018-06-17 19:52:18 -07:00
Thad House
1ebb83e0f2 Remove explicit close() from Gyro interface (#1152)
It's not needed, as extending AutoClosable is enough.
2018-06-11 15:02:50 -07:00
Austin Shalit
9108a93598 Switch non-integration tests to JUnit 5 (#1120) 2018-06-11 15:01:49 -07:00
Thad House
c7e97f45f5 Add RobotPeriodic functions to default templates. (#1149) 2018-06-10 20:16:54 -07:00
Thad House
5af85dd1bb Explicitly states the gyro direction contract for the Gyro interface (#1151) 2018-06-10 20:13:36 -07:00
Thad House
b20158015c Update java robot class docs (#1150) 2018-06-10 20:12:41 -07:00
PJ Reiniger
b1bb63f9a4 Add ADX Simulator tests (#1142) 2018-06-08 13:25:39 -07:00
Thad House
056e68f2ae Use new CAN API for PDP (#1081) 2018-06-07 22:31:26 -07:00
Thad House
f6e4df6a18 Remove OS Serial Port (#1141)
It was done as a shim fix around some VISA issues that don't seem to exist anymore. Was never really tested, and I don't think ever actually worked.
2018-06-07 20:51:26 -07:00
Thad House
0cde67143a Upgrade to gradle 4.8 (#1136) 2018-06-07 20:49:25 -07:00
Thad House
1f9645afe9 Fix CAN API reads (#1139) 2018-06-07 20:49:03 -07:00
Thad House
86285b427f Removes MSVC 2013 Shims (#1130)
We have done things recently that have broken any builds before VS 2015
2018-06-03 17:16:51 -07:00
Austin Shalit
e548a5f705 Update and enable PMD 6.3.0 (#1107) 2018-06-03 10:00:53 -07:00
Thad House
8eafe7f325 Solve some safety issues with RPCs (#1127)
Java would never properly dispose, and C++'s were easy to respond after disposing.
We now return a bool if the call was successful or not.
2018-06-03 08:43:48 -07:00
Peter Johnson
6aebba5452 Import MapVector from LLVM. (#1128) 2018-06-03 08:39:14 -07:00
Peter Johnson
664a3c2463 ntcore: Fix C API polling array returns. (#1126)
The implementation of ConvertToC for arrays was broken.  Also change it
to be templated on the returned array type, rather than passing the array.
This makes the uses a bit more clean.
2018-06-01 13:45:33 -07:00
Tyler Veness
321dfaf0a2 Remove non-existent directory from .styleguide (#1124) 2018-06-01 09:36:12 -07:00
Tyler Veness
8373e0361b Made Controller interface public (#1123) 2018-06-01 01:00:24 -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
Thad House
d9971a705a Throw UncleanStatusException rather then RuntimeException (#1114) 2018-05-30 23:36:40 -07:00
Thad House
85fe722f4c Fixes JNI files not getting cleaned on rebuild (#1121)
If a JNI file was added then removed without a clean (like a branch change)
The symbol check would fail because extra headers wouldnt get removed.
2018-05-30 23:24:00 -07:00
Thad House
c04f463b78 Makes FRCNetComm interfaces static final classes. (#1118)
Closes #1104
2018-05-29 15:55:38 -07:00
Thad House
307da3ad2d Simplify allocation of JNI global classes and exceptions (#1110)
Helps ensure they get freed properly (We have had a few cases before where this wasn't the case).
2018-05-29 15:44:16 -07:00
Austin Shalit
39f80730de Disable broken ntcore tests using JUnit 5 (#1116) 2018-05-28 23:07:28 -07:00
Tyler Veness
35cfe0d92c Add comment to FRCNetComm.java noting that it is autogenerated (#1115) 2018-05-28 18:29:42 -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
938f835142 Update things deprecated in gradle 4.8; remove unused function (#1093) 2018-05-28 02:00:03 -04:00
Thad House
1dc55c03dc Add Windows PDBs to release zips, and skip strip on mac (#1092)
Mac shared libraries drop about 10% in size, but the symbol library is about 5x the size of the original library.
2018-05-28 01:58:46 -04:00
Thad House
859b457c3d Add libuv dependency (#1109) 2018-05-28 01:56:58 -04:00
Tyler Veness
8958c4eabd Fixed wpilibj_frcnetcomm.py and added invocation to Travis (#1106)
Making Travis run wpilibj_frcnetcomm.py will help avoid bitrot in
FRCNetComm.java in the future. Formatting was also enabled on Python
source files and FRCNetComm.java was added back to the generated files
list.
2018-05-28 00:53:39 -04:00
Austin Shalit
7c9517ce5b Fix gain encapsulation in LinearDigitalFilter (#1105) 2018-05-28 00:52:59 -04:00
Thad House
5bf9720ccf Use externally built Google Test (#1108) 2018-05-28 00:44:12 -04:00
Peter Johnson
d1587ed2c1 LICENSE.txt: Update copyright date to 2018. (#1100) 2018-05-26 10:57:33 -04:00
Thad House
5fcb67aaf5 Fix Checkstyle (#1095)
Broken by merge of earlier change.
2018-05-24 22:56:36 -04:00
Austin Shalit
2e5fece594 Add utility class tests (#871)
Checks for classes that only have static methods.
2018-05-24 20:39:15 -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
Thad House
c4728d291e Makes CAN API initializer setup HAL (#1084) 2018-05-24 20:07:03 -04:00
Thad House
fb45a5b314 Allows passing in the main robot class from the command line (#1091) 2018-05-24 20:05:58 -04:00
Thad House
86c1f8ae50 Fixes initialization when not using the provided main (#1085)
Helpful for simulation, which might not use our main.
2018-05-24 20:03:19 -04:00
Thad House
381c25c573 Fixes interrupts not getting closed properly. (#1088)
The threads being created were never getting cleaned up.
2018-05-24 20:02:13 -04:00
Thad House
62d5301b1f Changes notifier to be closable. (#1090)
Fixes #1089
2018-05-24 19:56:29 -04:00
Austin Shalit
40cc743cc7 Enable checkstyle on cscore, ntcore, wpiutil (#1032)
Also update to version 8.10.
2018-05-24 00:31:04 -04:00
Tyler Veness
ecfe95383c Made SensorBase a utility class and renamed it to SensorUtil (#813) 2018-05-23 23:22:30 -04:00
Austin Shalit
ba93f79d8b Fix mac builds (#1087) 2018-05-23 21:36:43 -04:00
Peter Johnson
dcc2764844 Default to requiring frc namespace for wpilibc. (#972)
Instead of defining NAMESPACED_WPILIB to remove the "using namespace frc"
shim in Base.h, instead require NO_NAMESPACED_WPILIB be defined to add it.

Fix up various examples to use correct namespacing.
2018-05-22 23:33:50 -07:00
Thad House
cbaff52850 Implements AutoCloseable for types, replacing free() (#1048) 2018-05-22 23:33:17 -07:00
Peter Johnson
a2ecb1027a Update LLVM to latest upstream. (#1080)
Also change header guards to WPI header guards.
Remove StringRef::c_str() customization, replacing the handful of uses with Twine or SmallString.
TCPStream: Include errno.h and make Windows includes lowercase for consistency.

Upstream LLVM version: eb4186cca7924fb1706357545311a2fa3de40c59
2018-05-22 23:31:08 -07:00
Thad House
680aabbe7c Add new CAN API (#1036) 2018-05-21 16:09:38 -07:00
Thad House
55b0fe0082 Fixes JNI symbol check on VS 2015 (#1078) 2018-05-19 20:06:05 -07:00
Thad House
8b8c3d5462 Updates NativeUtils dependency (#1077)
New version handles dependency extraction better, and easier for IDEs
2018-05-19 18:49:29 -07:00
Thad House
38a7786f22 Remove spotless (#1074)
Enforcing Line endings isn't a good idea for cross system development,
and wpiformat handles everything else
2018-05-19 18:48:38 -07:00
Tyler Veness
df182f382e PIDController now supports composition (#976)
For example, an outer position feedback controller can now drive the
reference of an inner velocity feedback controller.
2018-05-19 01:32:43 -07:00
Thad House
5cc7573574 Updates JNI to support embedded jni libraries for easier setup (#1075) 2018-05-19 01:31:24 -07:00
Austin Shalit
17401e10f0 Add setting to invert the right side of the drive (#1045) 2018-05-19 01:22:20 -07:00
David Vo
73439d8213 DriverStation: Fix getStickButtonPressed/Released (#856)
This fixes DriverStation in WPILibJ to check the existence of buttons and hold the data mutex in getStickButtonPressed() and getStickButtonReleased(), as the corresponding methods in WPILibC do.
2018-05-16 20:00:48 -07:00
Tyler Veness
72a79aac53 Fixed the names of the arguments to some C++ drive classes (#1070)
The docs already have the correct name, but some headers and sources
weren't updated. Java doesn't have this mistake.
2018-05-16 19:55:27 -07: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
Tyler Veness
64b03704f8 Rename Joystick default channel constants (#904)
The new naming makes it more clear that the constants are intended to be used
with the channel setters.
2018-05-16 19:53:16 -07:00
Tyler Veness
630fc55bde Implemented synchronous PID controller (#993)
SynchronousPID provides a Calculate() function for teams to call themselves
instead of running the controller with a Notifier.
2018-05-16 19:51:37 -07:00
Austin Shalit
f90e429bf9 Add removeAll to preferences (#987)
This removes all keys except for .type.
2018-05-16 19:50:35 -07:00
Austin Shalit
2e0709f05b Add spotless to check line endings (#1055) 2018-05-16 19:47:35 -07:00
Thad House
11d46713d1 Fixes pessimistic std::move (#1069)
Also adds test to ensure all the sim headers get compiled

Closes #1068
2018-05-16 19:45:46 -07:00
Tyler Veness
ef442d775d Refactored DriverStation.java unplugged message handling to match C++ (#808)
Also fixed error handling in C++ for out-of-bounds arguments.
2018-05-16 00:13:52 -07:00
Tyler Veness
3e6c3c3e98 Replaces Timer in PIDController.java with Notifier (#878)
Fixes #877.
2018-05-16 00:02:21 -07:00
Tyler Veness
8d57b73b41 Fixed naming convention of static variable in TimedRobot.java (#876) 2018-05-15 23:59:38 -07:00
Tyler Veness
d8c8643b52 Format HTML and XML files (#944)
Generated by wpilibsuite/styleguide#52.
2018-05-15 23:58:20 -07:00
Tyler Veness
adb6098353 Removed extra newlines after open curly braces (#935)
Generated by wpilibsuite/styleguide#115.
2018-05-15 23:57:24 -07:00
Thad House
938d5379e6 Adds command examples to built examples (#1062) 2018-05-15 23:56:03 -07:00
Peter Johnson
7cd15aa049 Re-enable JsonIteratorObjectTest.KeyValue. 2018-05-15 22:31:35 -07:00
Peter Johnson
f8ed48af98 Update json from upstream version 3.1.2.
This adds support for ubjson and makes a number of bugfixes.

Binary input and output have switched from strings to uint8_t arrays.
2018-05-15 22:31:35 -07:00
Peter Johnson
c274d1790f StringRef: Add comparison operators against const char*. 2018-05-15 22:31:35 -07:00
Peter Johnson
6699f86361 Make most StringRef functions noexcept. 2018-05-15 22:31:35 -07:00
Peter Johnson
c2b1ed3edd ArrayRef: Add value_type typedef like std containers. 2018-05-15 22:31:35 -07:00
Peter Johnson
2c27ad073a raw_istream enhancements. 2018-05-15 22:31:35 -07:00
Peter Johnson
31bb55c319 Add std::vector and unsigned variants of raw_ostream. 2018-05-15 22:31:35 -07:00
Peter Johnson
dd4230d743 StringMap: Add decrement operations to iterator. 2018-05-15 22:31:35 -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
d564e19ef3 Only prints the debug binary message once per build (#1066) 2018-05-15 21:24:44 -07:00
Thad House
1d6eb629ad Adds Objective C++ Build capabilities to cscore mac (#1029) 2018-05-14 19:34:26 -07:00
Thad House
406e18663d Switches NotifyListenerVector to SmallVector (#1004) 2018-05-14 18:17:34 -07:00
Thad House
ab70220ecf Makes SPI edge changes more obvious (#1056)
Rising and Falling mean the opposite when active is set high vs low. Leading and trailing makes much more sense.

Closes #925
2018-05-14 18:16:36 -07:00
Thad House
560123ab7d Fixes command folder name in templates.json (#1061) 2018-05-14 00:19:47 -07:00
Thad House
4e1964156e Removes 32 bit configs for linux and mac. (#1060)
For mac, 32 bit will never be supported. Apple has dropped all support.

For 32 bit linux, vscode explicitly does not support it, and it is difficult to find anybody using a 32 bit os.
2018-05-13 23:27:44 -07:00
Tyler Veness
5ff3d837b6 Fix compilation with GCC 8 (#1051)
The anonymous namespace was renamed due to -Wsubobject-linkage complaining
about a field created in a GTest template class (CborRoundtripTestParam)
being defined in an anonymous namespace. See
https://stackoverflow.com/a/37723265.
2018-05-13 23:11:13 -07:00
Thad House
74d7107ac6 Add AppVeyor Build Support (#1013) 2018-05-13 22:23:35 -07:00
Thad House
e21a246a4d Make the HAL self initialize when ever any initialization function is called (#1012) 2018-05-13 22:02:47 -07:00
Thad House
59a8e9da57 Fixes gradle wpilibj classpath for editors (#1047) 2018-05-13 22:00:56 -07:00
Thad House
795c60da01 Adds a testCpp task to all projects (#1014) 2018-05-13 22:00:36 -07:00
Thad House
f3db329115 Enables MyRobot project (#1028) 2018-05-13 22:00:15 -07:00
Thad House
f07799c67b Disables unstable and failing unit tests (#1057) 2018-05-13 21:59:45 -07:00
Thad House
eec4f53a65 Forces CRLF files to LF (#1054) 2018-05-13 19:37:20 -07:00
Tyler Veness
01d8d0c795 Moved C++ header includes out of extern "C" and added missing C header includes (#1053) 2018-05-13 19:05:39 -07:00
Tyler Veness
6729a7d6b1 Run wpiformat on merged repo (#1021) 2018-05-13 17:09:56 -07:00
Thad House
0babbf317c Adds CMake Readme (#1042) 2018-05-13 14:12:12 -07:00
Thad House
337e89cf6e Adds JNI Simulator interface and updated Sim API (#1002)
The simulator was generated by https://github.com/ThadHouse/SimulatorGenerator
2018-05-11 12:38:23 -07:00
Thad House
1046371349 Fixes some JNI issues with method calling and class storage (#1043) 2018-05-10 22:38:21 -07:00
Austin Shalit
665a6e356a Allow users to feed the watchdog contained in drive objects (#1044) 2018-05-09 20:18:55 -07:00
Dustin Spicuzza
b7ea481bf9 Notifier: reset updatedAlarm before waiting (#946)
- If this isn't done, then the wait will always be performed at least twice
2018-05-04 18:29:42 -07:00
Peter Johnson
7a34f5d17d Check for nullptr return from malloc, calloc, and realloc. (#1023)
These are used in ntcore and cscore.  Add inline null-checking versions
to wpi/memory.h and use them throughout.
2018-05-04 17:55:46 -07:00
Thad House
e8d5759d95 Actually have the cscore examples build, and makes them build only on linux (#1030) 2018-05-04 17:54:56 -07:00
Thad House
eeae84c715 Adds cscore examples to builds (#1027) 2018-05-04 16:51:50 -07:00
Thad House
dab6f40b46 Moves examples.xml to json, and adds template json (#1026) 2018-05-04 16:51:37 -07:00
Peter Johnson
5c2c5ccd07 Remove atomic static shim. (#1020)
This was only useful for pre-VS2015 and was only being used in one place.
2018-05-04 02:07:27 -07:00
Peter Johnson
8cbfe35bd4 ntcore: Remove MSVC 2013 shim. (#1018) 2018-05-04 02:06:45 -07:00
Thad House
954f8c40f5 Adds CMake Builds (#1015) 2018-05-02 21:15:30 -07:00
Peter Johnson
6a49173cea Update cscore examples for llvm to wpi rename. (#1016) 2018-05-02 20:56:55 -07:00
Peter Johnson
1043aef7f7 ntcore: Make header actually a C header (#1007) 2018-05-01 22:51:28 -07:00
Thad House
f7bcf53059 HAL: wait for all objects to release handle before freeing (#1011)
This avoids a race on free.
2018-05-01 19:26:25 -07:00
Tyler Veness
6a159c5bd2 Miscellaneous cleanups (#1008) 2018-04-30 10:30:16 -07:00
Thad House
a098814ea0 Removes the make_unique shim for c++11 (#1010)
All of our compilers support c++14 now.
2018-04-30 10:28:34 -07:00
Peter Johnson
a28832e52f Add backwards compatibility shims for old wpiutil headers.
These generate a warning when included, then include the old header.

Note for GCC, #warning is used; this requires -std=gnu++14 instead of
-std=c++14 (otherwise the warning is treated as an error because #warning is
a GNU extension).  On MSVC, #pragma message is used, which is a bit
unsatisfactory as the message doesn't say where it was included from.

The llvm shim headers also include a llvm namespace shim.
2018-04-30 10:22:54 -07:00
Peter Johnson
f84018af5f Move entirety of llvm namespace to wpi namespace.
During shared library loading, a different libLLVM can be pulled in, causing
llvm symbols from dependent libraries to resolve to that library instead of
this one. This has been seen in the wild with the Mesa OpenGL implementation
in JavaFX applications (see wpilibsuite/shuffleboard#361).

This is clearly a very breaking change. For some level of backwards
compatibility, a namespace alias from llvm to wpi is performed in the "llvm"
headers.  Unfortunately, forward declarations of llvm classes will still break,
but compilers seem to generate clear error messages in those cases
("namespace alias 'llvm' not allowed here, assuming 'wpi'").

This change also moves all the wpiutil headers to a single "wpi" subdirectory
from the previously split "llvm", "support", "tcpsockets", and "udpsockets".
Shim headers will be added for backwards compatibility in a later commit.
2018-04-30 10:22:54 -07:00
Tyler Veness
93859eb84f TimedRobot now uses the Notifier HAL API (#942)
Fixes #941.
2018-04-30 00:00:09 -07:00
Tyler Veness
e7cf6bf7c5 Fixed wpilibj GenericHID.getType() (#969)
It was using array indexing to map the return value of
DriverStation.getJoystickType() to HIDType when the enum should instead be
constructed from the int value. C++ already does this.

Fixes #968.
2018-04-29 23:56:00 -07:00
Peter Johnson
a8fd88840d Revert "Uses ComputeDigitalMask function across HAL DIO (#837)" (#1005)
This reverts commit c84bd744c8.
2018-04-29 21:48:53 -07:00
Thad House
c84bd744c8 Uses ComputeDigitalMask function across HAL DIO (#837)
less risk for errors in the future.
2018-04-29 21:12:15 -07:00
Thad House
11b99a016a Removes old version files from git ignore (#1003) 2018-04-29 20:28:45 -07:00
Brennon Brimhall
dfa46cbddd Fix typos, keep formatting consistent. (#974) 2018-04-29 20:15:50 -07:00
Austin Shalit
91151e33bb Add out to gitignore (#988) 2018-04-29 20:14:53 -07:00
Tyler Veness
2ed9ae1652 Removed unused ROBOT_TASK_PRIORITY constant from RobotBase.java (#991) 2018-04-29 20:14:06 -07:00
Austin Shalit
fdfea35161 Fix JavaDoc tag (#995)
The isParented method had an incorrect javadoc tag for the return value.
2018-04-29 20:13:18 -07:00
Austin Shalit
47783842e9 Fix JavaDoc tag in Differential Drive (#996)
The `{@link SpeedControllerGroup}` was broken because SpeedControllerGroup was not imported.
2018-04-29 20:12:35 -07:00
Thad House
7f88cf768d New 2018 and later build setup (#1001) 2018-04-29 13:29:07 -07:00
Thad House
cb2c9eb6d5 Remove gmock and builds from utility libraries (#999) 2018-04-27 22:14:26 -07:00
Peter Johnson
4a1e520758 Merge cscore into allwpilib. 2018-04-27 20:02:15 -07:00
Peter Johnson
b3aa659f93 Merge ntcore into allwpilib. 2018-04-27 20:02:05 -07:00
Peter Johnson
4870d83ad1 Merge wpiutil into allwpilib. 2018-04-27 20:01:38 -07:00
Peter Johnson
7210a8fd28 Prepare ntcore for merge into allwpilib. 2018-04-27 19:57:35 -07:00
Peter Johnson
0f947613a9 Prepare wpiutil for merge into allwpilib. 2018-04-27 19:56:51 -07:00
Peter Johnson
ea73c10cd8 Prepare cscore for merge into allwpilib. 2018-04-27 19:43:49 -07:00
Peter Johnson
6d3d52f923 Fix GetJpegSize() and JpegNeedsDHT() to handle SOF as first tag. (#127)
Previously these functions ignored SOF if they came immediately after
the SOI (e.g. bytes 2 and 3 of the file).  A handful of cameras generate
images like this.
2018-03-08 19:51:40 -08:00
Tyler Veness
dbd1f1781e Ran wpiformat (#126) 2018-03-07 01:14:21 -08: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
Thad House
14228d82f3 Adds Direct port name Serial API (#956) 2018-03-05 19:41:09 -08:00
Peter Johnson
040731447f Add FPS and byte count telemetry measurement for sources. (#125)
* Add FPS and byte count telemetry measurement for sources.

* Add new error code for telemetry not enabled.
2018-03-04 21:01:55 -08:00
Peter Johnson
5175829bab PWM: Use getRaw and setRaw for Sendable "Value" property. (#963)
Also change type to "PWM".  Move old PWM Sendable behavior for both value
and type to PWMSpeedController.
2018-03-03 21:36:25 -08:00
Peter Johnson
9d7293734a SendableChooser: Do not automatically add to LiveWindow. (#964)
SendableChooser::InitSendable() is written such that it saves the table
being used in an instance variable.  This doesn't work if the chooser is
added to both LiveWindow and SmartDashboard.  Normally it is not added to
LiveWindow because the name is empty, but if setName() is called this could
still happen.  Note adding the same SendableChooser to SmartDashboard with
two different names is also not currently supported, for the same reason.

The correct solution will be to remove the instance variable, but this is
too high risk to implement mid-season, so instead just remove from LiveWindow.
2018-03-03 21:34:42 -08:00
Peter Johnson
1e5ec362f7 CameraServer: catch VideoExceptions in video listener. (#949)
We don't want failures here to stop other video properties from updating.

Reported here: https://www.chiefdelphi.com/forums/showthread.php?t=162860
2018-03-03 01:58:28 -08:00
Tyler Veness
7bb3e4efc3 Made documentation for RobotDriveBase::SetDeadband() clearer (#953)
It now mentions that the deadband is applied to the drive inputs.
2018-03-03 01:57:59 -08:00
PJ Reiniger
67de595c85 ADXRS450_Gyro: Add null check around reset (#948)
Reset() is the only function without a null check around it. We call the function on startup, which means if it is unplugged the robot crashes.

Also added an accessor for checking if it is connected, as some teams (us) would like to handle the case where it was not connected on startup.
2018-03-03 01:57:45 -08:00
Thad House
82152e90fe Adds defaults to PWM config (#961) 2018-03-03 01:56:49 -08:00
Dustin Spicuzza
1e7d439899 HAL Notifier: Don't disable the notifier manager when the last handle is cleaned up (#960)
- Addresses #959, but not a good long term solution
2018-03-03 01:56:24 -08:00
Peter Johnson
71d06a1a20 HttpRequest: Don't reorder parameters. (#73)
Also now allows duplicate parameters (which is needed for some use cases).
2018-03-01 20:01:11 -08:00
Peter Johnson
698feff2ff MjpegServer: Support limiting FPS. (#123) 2018-03-01 20:00:25 -08:00
Peter Johnson
3ef9ffaf34 HttpCamera: Force reconnect when SetUrls() is called. (#122)
The URL often contains other information like the camera resolution,
not to mention actually changing cameras!
2018-02-28 23:28:49 -08:00
Peter Johnson
3025a182cc Fix two bugs in client synchronization. (#270)
Both could occur if a client and server write to the same key and the server
disconnects/reconnects (or restarts).

Bug 1: the client did not properly update the sequence number in this case,
so later server updates could be ignored until the sequence number wrapped.

Bug 2: the client did not properly set the id and sequence number for the
update message back to the server, so the server would ignore the message.
2018-02-28 22:58:34 -08:00
Tyler Veness
febc41c85d Fix Travis CI wpiformat install (#72) 2018-02-20 23:03:29 -08:00
Tyler Veness
627ca6db75 Fix Travis CI wpiformat install (#121) 2018-02-20 23:02:55 -08:00
Tyler Veness
c80b0de2c4 Fix Travis CI wpiformat install (#269) 2018-02-20 23:02:36 -08:00
Tyler Veness
979984fa6b Fix Travis CI wpiformat install (#947) 2018-02-20 23:01:57 -08:00
Thad House
57e9fb33d2 Fixes C++ SendableChooser using invalid temp variable (#945) 2018-02-15 23:00:46 -08:00
Thad House
f5a292dadd Adds TriState JNI entry point (#938)
Also adds missing sim TriState DIO HAL call, and a ToDo for later
2018-02-12 16:05:10 -08:00
Peter Johnson
4e9e7ec8f5 ParseHttpHeaders: Make case-insensitive per HTTP spec. 2018-02-09 11:31:03 -08:00
Sam Carlberg
77d6c11743 Invert right side motors in MecanumDrive sendable (#933)
This aligns with the current behavior of DifferentialDrive
Fixes shuffleboard#404
2018-02-09 08:30:12 -08:00
Peter Johnson
c69b8f00d0 ReadJpeg: Don't read past the end of the image. (#119)
This was causing HTTP cameras that didn't send content-length to skip
frames.
2018-02-08 20:16:30 -08:00
Peter Johnson
0542b50f76 Work around fallthrough warnings on GCC 7+. 2018-02-07 22:10:21 -08:00
Thad House
1077ef9fb7 Adds compile task (#118) 2018-02-04 22:41:28 -08:00
Tyler Veness
67f9c9a5b3 Fixed TimedRobot.java hanging if an exception was thrown (#926) 2018-02-04 22:38:19 -08:00
Thad House
f720cbb121 Switches CtreCanNode to use locking and std::chrono for time (#909) 2018-02-01 21:39:06 -08:00
Tyler Veness
64a7e57fe0 Added output normalization to DifferentialDrive::CurvatureDrive() (#924)
This normalizes within -1..1 to avoid clipping and maintain the ratio between
wheel speeds, since that ratio determines the center of rotation.

Fixes #923.
2018-02-01 21:17:04 -08:00
Tyler Veness
5ca00dddbe Added TimedRobot::GetPeriod() (#915)
Fixes #914.
2018-01-27 01:01:15 -08:00
Tyler Veness
120ceb3427 Fix channel reassignments for C++ Joystick twist and throttle axes (#903) 2018-01-26 17:26:10 -08:00
Thad House
5cbafc1382 Updates to image 17 (#913)
These should be binary compatible, so safe to use with image 16.
2018-01-26 17:21:13 -08:00
Thad House
39d1650d51 Fixes double to int to double cast in encoderJNI (#918)
Fixes #916
2018-01-26 17:20:20 -08:00
Thad House
02336fc478 Makes FMS data never be a null string. (#900)
Fixes #895
2018-01-19 23:49:34 -08:00
Thad House
c00848c060 Fixes indexed classed handle resource (#899)
Nothing in WPILib uses it, so it was not tested
2018-01-19 22:31:59 -08:00
Dustin Spicuzza
738a1c015c PIDController: setContinuous should only check input range if continuous is true (#896) 2018-01-19 22:31:08 -08:00
Thad House
48ae6c954a Publishes match specific data and other FMS info to NT (#874)
This is so products like SB can present the current setup.
2018-01-18 23:17:28 -08:00
Thad House
07f70cf784 Fixes control data packet delay (#875)
Because of an expected change in 2018 that didn't happen, we had a race
condition causing a 1 packet delay on all DS values. This fixes that.
2018-01-18 21:54:33 -08:00
sciencewhiz
e4e1eab413 Fix cancel of inner commands in ConditionalCommands (#858) 2018-01-18 20:04:33 -08:00
Nic Hodlofski
0e8ff4663d SpeedControllerGroup: Call set() from pidWrite()
This means pidWrite() now takes m_isInverted into account.
Fixes #887.
2018-01-18 20:03:13 -08:00
HeroCC
54a0a7654a Link to replacements for RobotDrive in JavaDocs (#879)
In smart IDEs, this will allow users to easily view source for these two classes by linking to it
2018-01-11 22:17:33 -08:00
Rohit Vighne
59f938b584 Invert when getting motor speed in SpeedControllerGroup (#886) 2018-01-11 22:16:42 -08:00
sciencewhiz
5513888457 Fix PIDController with Continous and no Input Range set. (#883) 2018-01-11 21:06:25 -08:00
Peter Johnson
02b6615042 RobotController: Make getBatteryVoltage() static. (#869) 2018-01-04 23:12:13 -06:00
Tyler Veness
1f4822f332 Replaced Talon motor controller in DifferentialDrive class docs with Spark (#868) 2018-01-03 20:27:34 -06:00
Peter Johnson
bb38ef5642 DifferentialDrive: Invert right motor in LiveWindow. (#867) 2018-01-02 21:15:15 -06:00
PJ Reiniger
ca36d1dce6 Adding callbacks for notifying when the distance per pulse changes (#861) 2018-01-02 16:53:39 -06:00
Sam Carlberg
ee33296e1f SmartDashboard override .name entry in putData(String, Sendable) (#866)
Fixes #865
2018-01-02 16:39:16 -06:00
Tyler Veness
4376c94dc1 Updated copyright year 2018-01-02 16:07:38 -06:00
Tyler Veness
19f7a5f108 Set up wpiformat 2018-01-02 16:07:38 -06:00
Tyler Veness
4514ff8071 Removed extra newlines from beginning of Java classes (#264) 2018-01-02 14:47:27 -06:00
Tyler Veness
b66d72f5c2 Updated copyright year 2018-01-02 14:30:19 -06:00
Tyler Veness
c6f6b352fb Set up wpiformat 2018-01-02 14:30:19 -06: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
eedb8910c3 Removed extra newlines from beginning of Java classes (#859)
The content of this PR was generated by styleguide#111.
2018-01-02 11:17:46 -06:00
Tyler Veness
882399c65e Update copyright year to 2018 (#116) 2018-01-02 11:16:20 -06:00
Sam Carlberg
8346caed9c Move subsystem command metadata to metadata key format (#863) 2018-01-01 17:05:03 -05:00
PJ Reiniger
55b6764d50 Fix bugs in simulation libraries (#853)
Some thing got broken in the past couple of weeks with updates to the
HAL.
2017-12-31 14:37:14 -06:00
Thad House
2c4faee667 Fixes -Og compile and strip binaries (#838) 2017-12-29 22:18:35 -06:00
Thad House
2287281066 Fixes linux and mac builds to -Og, and strips binaries (#261)
Also fixes errors from new optimization level.
2017-12-29 22:17:47 -06:00
Thad House
cd4b7b6cc7 Switches to -Og instead of -O2, and strip binaries on linux and mac (#63) 2017-12-29 22:16:35 -06:00
Thad House
da5458a2d2 Updates to newest build setup, fixing -Og and strip binaries (#115) 2017-12-29 22:15:38 -06:00
Jaci R
8d1dee16be Add DriverStation NetworkTables HAL Extension (#829) 2017-12-29 21:55:31 -06:00
Jaci R
76b182600a Add Low Fidelity NetworkTables simulation extension (#823) 2017-12-29 21:54:18 -06:00
sciencewhiz
c647a801ad Add Encoder Index as a child (#857) 2017-12-29 21:48:39 -06:00
sciencewhiz
02131639bc Add Digilent DMC 60 Speed Controller (#855) 2017-12-28 21:42:19 -06:00
Noah Gleason
566e283694 Make setDefaultCommand public (#854) 2017-12-28 12:48:15 -06:00
Peter Johnson
40eb6dfc9b Fix SmartDashboard PutData to hook setters. (#851)
* Fix SmartDashboard PutData to hook setters.

Also update all PutData values in main periodic loop (same as LiveWindow).

* Improve SmartDashboard.putData() repeat call handling.
2017-12-26 18:18:02 -05:00
Dustin Spicuzza
a3e5378d14 SPI: Check for null (#850) 2017-12-25 22:03:22 -06:00
Thad House
691741cfcb Fixes non public static methods in RobotController. (#852) 2017-12-25 20:26:05 -06:00
Thad House
166d9e01bf Add PWMVictorSPX (#842) 2017-12-17 19:59:30 -08:00
Thad House
7eab4371f4 Adds TriState DIO functionality to the HAL (#835)
Adds a function to raw set the DIO direction. Also adds a C++ unsafe
function to enable fast setting of DIO direction.
2017-12-14 00:17:29 -08:00
Peter Johnson
de134a5c60 Add deprecated shims for LiveWindowSendable and NamedSendable. (#834)
This will help prevent old code from breaking (not all cases, but should help).
2017-12-13 23:45:12 -08:00
Peter Johnson
7f074563d0 Add support for automatic SPI transfer engine. (#836)
The SPI Accumulator functions have been moved from HAL to wpilib and rewritten
to use the automatic transfer engine.
2017-12-13 23:41:37 -08:00
Thad House
d3dd586362 Revert "Fixes SPI bad chip select (#818)" (#822)
This is no longer required for image 2018v16.

This reverts commit b42285fddd.
2017-12-12 11:31:20 -08:00
Thad House
9c85105591 Update to image 2018v16 (#833) 2017-12-12 11:03:53 -08:00
Peter Johnson
86ac70a125 Fix wpilibcIntegrationTests RobotController warnings. (#832) 2017-12-11 22:15:29 -08:00
Austin Shalit
3c3a448d47 Deprecate SampleRobot (#472)
Suggest TimedRobot as an alternative.

Remove -Werror from examples to avoid breaking build.
2017-12-11 22:06:01 -08:00
Thad House
8744511f1d Fixes some methods in RobotController not being static. (#831) 2017-12-11 11:48:54 -08:00
Thad House
7729dd972f Fixes JNI symbol check (#830)
setErrorData symbol was missing. However, its been deprecated at the
netcomm level for years, and wasn't exposed in wpilibj. And it would
have been crashing since forever, so safe to remove.
2017-12-11 11:48:39 -08:00
Thad House
8b7aa61091 Adds RobotController class (#828)
Unifies random functionality from other classes
Deprecates all old functions.
2017-12-10 21:52:49 -08:00
Peter Johnson
88a6b4ac38 PIDController::InitSendable(): Use double, not bool for double values. (#827) 2017-12-10 20:58:29 -08:00
Peter Johnson
217b1a2259 VisionRunner: Add stop() function to stop a runForever() loop. (#826)
This was previously possible in Java with Thread.interrupt(), but provide
the same function in both C++ and Java.

Fixes #444.
2017-12-10 20:58:14 -08:00
Thad House
d2e7a90f41 Removes statics from hal sim (#825)
Based off of #824, the equivelent in sim.
2017-12-10 19:38:53 -08:00
Thad House
8bd48d6c34 Switches HAL to manual instead of static initialization (#824)
Only athena.

Will fix a whole lot of init issues.
2017-12-10 18:02:07 -08:00
Thad House
1fa0adb091 Removes MSVC and GCC old version workarounds (#821) 2017-12-08 23:40:35 -08:00
Thad House
f615e68a43 Require GCC 5 for wpilib build (#820)
Will help in season with teams not upgrading their GCC. Will have a
better error message.
2017-12-08 22:48:01 -08:00
Thad House
aa4f0ef4f8 Start using the new FRC compiler define (#797)
Remove all definitions from the MockData headers when in simulation mode.
Add a constexpr IsReal and IsSimulation in RobotBase.
2017-12-08 22:47:21 -08:00
Thad House
b42285fddd Fixes SPI bad chip select (#818)
Temporary workaround for 2018v13 image.
2017-12-08 21:42:30 -08:00
Thad House
8106fbdbea Removes custom CONFIG_ATHENA compiler directive (#796)
In roborio GCC 5.5, __FRC_ROBORIO__ has been added directly to the
compiler. So we can instead use that to detect if we are build for the
roborio, and in a much more reliable way.
2017-12-08 21:40:11 -08:00
Tyler Veness
942ba51765 Reclassified NetworkTables headers as "other library" (#775) 2017-12-07 23:34:29 -08:00
PJ Reiniger
33a08d5b34 Add halsim unit tests (#783)
Also adds function that can register all the callbacks at once.
Since all of the callbacks issue a string identifier, it makes it
possible and easy to have one function callback, and differentiate the
path to take based on the string.  Hooking up all the callbacks at once
makes it easier for the simulator developer to know when something was
added to wpilib rather than looking at the commits.
2017-12-07 22:42:20 -08:00
Thad House
4e3af0756d Removes workarounds for issues in image 10 (#816) 2017-12-06 21:20:03 -08:00
Thad House
5078f6c92a Update to image 2018v13 (#815) 2017-12-06 21:02:36 -08:00
Peter Johnson
899892c119 Change Utility to use Twine. 2017-12-05 00:17:56 -08:00
Peter Johnson
54326311ad Use Twine in error checks. 2017-12-05 00:17:56 -08:00
Peter Johnson
fe53dd2f28 Use Twine for error message inputs. 2017-12-05 00:17:56 -08:00
Peter Johnson
ab137abab5 Use llvm::Twine across C++ Command structure. 2017-12-05 00:17:56 -08:00
Peter Johnson
001dedf3b2 SmartDashboard: Use magic static for static initialization. (#812)
It's possible for SmartDashboard functions to be called from static
initializers in user code, so use a magic static to force initialization
order.
2017-12-04 23:50:27 -08: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
3befc7015b Make MotorEncoderTest use LinearDigitalFilter's reference overload (#811) 2017-12-04 22:37:06 -08:00
Tyler Veness
de63e1c8a1 Fixed race condition between PIDController enable/disable and PIDWrite() call
To make this work in PIDController.java, the use of synchronized had to be
replaced with ReentrantLock and try-catch blocks. The locking in
PIDController.java was made equivalent to PIDController.cpp and some existing
race conditions in PIDController.java were fixed in the process.

Fixes #30.
2017-12-04 20:42:33 -08:00
Tyler Veness
a76b1aa800 Reduced scope of PIDController's critical sections
m_pidInput and m_pidOutput are considered constant after their construction.
Setting the input range, output range, tolerance, or continuous mode locks the
controller. m_error and m_result are held in temp variables and set at the end
of the calculation.

Getters of P, I, D, F, m_error, m_setpoint, m_result, and m_enabled lock the
critical section. P, I, D, F, and m_setpoint are retrieved at the beginning of
Calculate().

Fixes #40.
2017-12-04 20:42: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
Thad House
64bfdc1a69 Bail out of the integration tests if enable fails (#792)
A failure is much better then an infinite loop.
2017-12-04 20:24:26 -08:00
Tyler Veness
65cc85f68d Add reference constructors/factory methods to LinearDigitalFilter (#810)
Composition is less verbose with references than with smart pointers.
2017-12-04 20:12:06 -08:00
sciencewhiz
6a00dc7976 Re-Add PacGoat java example (#802) 2017-12-04 20:09:02 -08:00
Tyler Veness
e9e407a87d Replace C identifier lists with (void) (#809)
These changes were generated by wpilibsuite/styleguide#106.
2017-12-04 20:05:51 -08:00
Tyler Veness
59c4984ed6 Deprecated internal filter of PID controller (#746)
This was replaced with an external LinearDigitalFilter.
2017-12-04 20:05:02 -08:00
Peter Johnson
b428d1e4b3 Remove CANSpeedController interface. (#806)
CANJaguar is no longer supported, and CANTalon no longer uses this interface.
2017-12-04 20:03:07 -08:00
Thad House
0994364591 Fixes cross module base class statics (#779) 2017-12-03 00:05:05 -08:00
sciencewhiz
0b8d3f0260 Update SampleRobot template to match comments (#768) 2017-12-02 23:28:52 -08:00
sciencewhiz
52eba45c51 Add missing documentation for squaredInputs for RobotDrive (#805) 2017-12-02 22:31:51 -08:00
Thad House
9090a82ef5 Fixes halsim sources and headers zips (#804) 2017-12-02 22:30:54 -08:00
Omar Zrien
4e0ed79864 Fix no return warning in jni_util.h (#62) 2017-12-02 00:28:56 -08:00
Peter Johnson
2a69a4c7dc Revert #780 (don't kill FRC_NetCommDaemon). (#795)
This commit reverts commit 0f3f5218ad.
2017-12-01 23:47:01 -08:00
Thad House
9d2393f97e Waits 10 seconds between running the C++ and Java test (#798)
Potentially will fix java tests not enabling.
2017-12-01 23:45:49 -08:00
Peter Johnson
dae619b006 Add error reporting to AbstractComsSetup test initialization. (#800) 2017-12-01 23:44:11 -08:00
Thad House
9c06d2878b Update to latest native plugin (#799)
This is what prints warnings to console.
2017-12-01 16:23:30 -08:00
Peter Johnson
e3a2abdf97 HAL_SetDigitalPWMRate(): Use same logic as LabView. (#794) 2017-12-01 10:26:40 -08:00
Peter Johnson
7867e906e9 NidecBrushless: Have disable() call PWM.setDisabled(). (#763)
This provides a way to stop motor operation even if the DIO is disconnected.

Also change Set() to enable the PWM instead of having the constructor do it.

Provide an explicit Enable() call to re-enable after Disable() is called.
This is different from the other motor controllers (which automatically
re-enable when Set() is called) due to the dual-wiring of this motor
controller.

Motor safety results in disabling the motor only until the next Set() call.
2017-12-01 00:43:11 -08:00
Peter Johnson
65a044f633 Fix HAL_CleanNotifier race. (#793)
This race was caused by holding a lock while calling into FRC_ChipObject,
which was waiting for the callback to exit before returning, and our
callback wanted to grab the same lock.
2017-11-30 20:45:40 -08:00
sciencewhiz
cbd08a1e11 Add tests for equivilance of RobotDrive and DifferentialDrive/MecanumDrive (#732)
Add documentation for how to get same results as RobotDrive and improve
RobotDrive documentation
2017-11-29 21:41:00 -08:00
sciencewhiz
e308dd28f3 Fix javadoc link in Solenoid.java (#789) 2017-11-29 21:33:29 -08:00
Thad House
fa0b4428e9 Runs DS enabled loop in process (#785)
Solves mutex issues, and other issues with the existing teststand
software. And simplifies the unit test structure.
2017-11-28 19:12:05 -08:00
Thad House
6767afd400 Adds a UDPClient (#60)
Send only currently. Will eventually implement receive, but not
necessary for now.
2017-11-28 00:53:10 -08: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
dfc0656e5c Fix wpilibj FilterOutputTest null pointer exception (#778) 2017-11-27 12:28:25 -08:00
Peter Johnson
0f3f5218ad Kill FRC_NetCommDaemon as well as robot programs. (#780)
Also use flock on Jenkins side to prevent multiple simultaneous runs, instead of using teststand mutex.
2017-11-27 12:24:46 -08:00
Tyler Veness
34c44b7ae9 Improved Drive docs and fix implementation bugs (#774)
I also found some inconsistencies in MecanumDrive and KilloughDrive and fixed
them.

Drive now uses the NED axes convention. Therefore, the positive X axis points
ahead, the positive Y axis points to the right, and the positive Z axis points
down.

Translation in X assumes forward is positive. Translation in Y assumes right is
positive. Rotation rate assumes clockwise is positive. Angles are measured
clockwise from the positive X axis.

Based on the angle origin convention, DrivePolar() for both Mecanum and Killough
needed the normalization removed, sine used to compute the Y component, and
cosine used to compute the X component.

The vector rotation done in DriveCartesian() needs to rotate by a negative angle
instead of positive to undo the robot's rotation. RobotDrive assumed a clockwise
angle and sensors returned counter-clockwise angles, which is why it used a
positive angle for rotation.
2017-11-26 18:36:51 -08:00
sciencewhiz
7a250a1b93 Implement PCM One Shot feature. Fixes artf4731 (#539) 2017-11-26 12:55:21 -08:00
Caleb Smith
a338ee8be0 Add PIDController Wrapping (#601) 2017-11-25 21:15:33 -08:00
sciencewhiz
c9d440f338 Fix Java Compressor test. Make limits same as C++. (#772) 2017-11-24 20:14:36 -08:00
Peter Johnson
aa2de65bad Use Twine instead of StringRef where appropriate. (#259)
Deprecated interfaces were not updated.
2017-11-24 20:13:00 -08:00
Tyler Veness
a00b2449db Removed unused includes and replaced Ultrasonic's std::set with std::vector (#767) 2017-11-23 20:46:24 -08:00
Tyler Veness
5c659fdcdf Deprecated PIDController::SetTolerance() (#764)
PIDController::SetPercentTolerance() behaves identically to it, so removing
SetTolerance() leaves one obvious way to do absolute or percent tolerance.
2017-11-23 01:21:36 -08:00
Thad House
d36d72bd4f Fixes MotorSafetyHelper locking and race conditions (#762)
Closes #760
2017-11-23 00:36:57 -08:00
sciencewhiz
614093c0c4 Fix documentation for getMatchTime in Timer class to match DriverStation (#761) 2017-11-23 00:19:05 -08:00
Peter Johnson
877c7f51c1 raw_istream: Don't forward declare Twine et al. (#59)
It breaks existing users who use StringRef.
2017-11-22 23:49:57 -08:00
Peter Johnson
912b74151f Use llvm::Twine instead of llvm::StringRef in several places. (#58) 2017-11-22 21:47:56 -08:00
Peter Johnson
f73db4a49b Twine::isSingleStringRef(): Support CharKind. (#57) 2017-11-22 21:38:25 -08:00
PJ Reiniger
12c4418bda Added callbacks for CAN (#757)
Added callback scheme for a pass through to something higher
level.  Since the ID is embedded into the arbitration ID, and some
devices can use different schemes whether it is plugged in through a
device or put into the daisy chain (pigeonImu), I made one "internal
data object" for max reusability.
2017-11-22 19:48:32 -08:00
Caleb Smith
0431cf97ff Cleanup PIDController (#597) 2017-11-22 18:56:35 -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
Tyler Veness
96de0b5b11 Variable name fixes (#758) 2017-11-22 17:06:57 -08:00
Tyler Veness
85157a56c3 CircularBuffer now uses an idiomatic interface in C++ and Java (#421) 2017-11-22 17:04:57 -08:00
Tyler Veness
029246ed28 Replaced extra constructors in LinearDigitalFilter with llvm::ArrayRef<> (#755)
llvm::ArrayRef<> replaces both the std::initializer_list<> and std::vector<>
constructor overloads.
2017-11-20 21:23:00 -08:00
sciencewhiz
6377ab774d Allow deprecated warnings for tests (#756) 2017-11-20 21:21:50 -08:00
Tyler Veness
05e581f409 Fixed crash in wpilibj SampleRobot (#753)
robotInit() and HAL.observeUserProgramStarting() should be called in
startCompetition() rather than the constructor.

Fixes #752.
2017-11-19 22:47:39 -08:00
Peter Johnson
c73dd807e1 ErrorBase: Remove last use of sstream and iostream. (#750) 2017-11-19 20:16:42 -08:00
Tyler Veness
7a0dd9baa9 Add return-to-zero test for LinearDigitalFilter moving average (#751)
Ensures LinearDigitalFilter moving average returns to zero after non-zero
values are inserted.

Tests for issue #642
2017-11-19 20:16:09 -08:00
Tyler Veness
11f37683c3 Added constructor to PIDController that takes references instead of pointers (#745) 2017-11-19 19:06:00 -08:00
Tyler Veness
5af0c9c101 Replaced const variables with constexpr (#731) 2017-11-19 19:04:28 -08:00
Tyler Veness
259461aee9 Added PIDController::GetAvgError() back in (#749)
It got removed during the LinearDigitalFilter change (#38) instead of deprecated
by mistake.
2017-11-19 18:23:48 -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
Tyler Veness
4a07f0380f PIDController class now uses LinearDigitalFilter for filtering velocity instead of internal queue (#38) 2017-11-19 15:58:30 -08:00
Tyler Veness
cf828ca858 Upgraded clang-format to 5.0 (#103) 2017-11-19 15:15:41 -08:00
Peter Johnson
7847c69231 Update for wpi::Now() change to microseconds. (#113)
Also be explicit in docs about what timebase and step are used.
2017-11-19 14:35:50 -08:00
Peter Johnson
7f46b50b21 Unify WPI_Now and HAL_GetFPGATime. (#743)
Depends on wpilibsuite/wpiutil#56.
2017-11-19 12:33:36 -08:00
Peter Johnson
0e4a1c5dae NetworkTable: Add key utility functions. (#256)
- BasenameKey
- NormalizeKey
- GetHierarchy
2017-11-19 11:52:10 -08:00
Peter Johnson
551504e773 Update documentation for Now() for 1 us steps. (#258)
This is to match wpilibsuite/wpiutil#56.
2017-11-19 11:47:37 -08:00
Peter Johnson
85e83f1bba WPI_Now(): return microseconds, and make backend replaceable. (#56)
- Add function documentation.
- Use uint64_t instead of unsigned long long
2017-11-19 11:47:06 -08:00
Peter Johnson
7eac3fcbda Java NetworkTableEntry.setValue() and kin: Handle common Java types. (#257)
This restores the behavior of the old NetworkTable.putValue() function.
2017-11-19 11:44:54 -08:00
PJ Reiniger
303c259b89 Simulate ADX* family of accelerometers and gyros (#688) 2017-11-18 12:31:51 -08:00
Thad House
cd1dbb1e3a Adds a const buffer listener (#742)
Replaces need for const_cast in SPI and I2C functions
2017-11-17 10:01:49 -08:00
Peter Johnson
a20474bfc7 Update sensors to not use direct byte buffers. 2017-11-17 09:36:57 -08:00
Peter Johnson
479d0beb5a SerialPort: Use byte[] instead of ByteBuffer in JNI. 2017-11-17 09:36:57 -08:00
Peter Johnson
b93aa176d6 AnalogInput: Remove byte buffer usage. 2017-11-17 09:36:57 -08:00
Peter Johnson
9021b37fd2 I2C: Provide byte[] JNI interfaces.
This avoids a direct byte buffer allocation on every read/write/transaction
on the byte[] variants.

Changes HAL I2C interfaces to use const for dataToSend.
2017-11-17 09:36:57 -08:00
Peter Johnson
6307d41002 SPI: Provide byte[] JNI interfaces.
This avoids a direct byte buffer allocation on every read/write/transaction
for the byte[] variants.

Also change spiGetAccumulatorOutput() to directly set the AccumulatorResult
object, avoiding a ByteBuffer allocation.

Changes HAL SPI interfaces to use const for dataToSend.

Fixes #733.
2017-11-17 09:36:57 -08:00
Peter Johnson
e9b0b9d8f6 MjpegServer: Use sink name in title. (#112)
Fixes #83.
2017-11-17 09:34:30 -08:00
Peter Johnson
cad1b9413c Add exposure quirk for LifeCam Cinema. (#111)
This is the same quirk as the LifeCam HD-3000.

Fixes #110.
2017-11-17 09:30:56 -08:00
Peter Johnson
3324bcc5ce Use magic statics instead of ATOMIC_STATIC. (#109) 2017-11-17 09:29:20 -08:00
Peter Johnson
20c8d29ae9 Fix wpi::mutex usage in SetVideoMode(). 2017-11-17 02:04:24 -08:00
Thad House
110726c5bf Adds support to test library for JNI testing (#54) 2017-11-17 01:53:25 -08:00
Peter Johnson
df7c1389de Remove ni-libraries libi2c and libspi. 2017-11-16 23:01:28 -08:00
Peter Johnson
6accc31ee7 HAL: implement I2C and SPI directly instead of using i2clib and spilib.
This reduces library dependencies, improves error handling, and makes
future enhancements easier.
2017-11-16 23:01:28 -08:00
Thad House
f56ec10bcf Only return lower 32 bits of FPGA time (#741)
Works around an NI bug in image 10.
2017-11-16 20:52:50 -08:00
Tyler Veness
e5e6d6a193 Ran formatter based on styleguide#95 (#737) 2017-11-16 01:05:20 -08:00
Tyler Veness
c663d7cd16 Reflowed comments and removed commented out code (#735) 2017-11-16 00:33:51 -08:00
Tyler Veness
1e8d18b328 Upgrade Travis CI Python version to 3.5 (#740) 2017-11-16 00:19:16 -08:00
Peter Johnson
c2d95db3ab Fix PreferencesTest. (#739) 2017-11-15 23:56:17 -08:00
Peter Johnson
7db60f8e7c CvSource: Implement SetVideoMode(). (#104) 2017-11-14 22:09:30 -08:00
Tyler Veness
b3f1e74317 Ran formatter based on styleguide#95 (#108) 2017-11-14 22:07:56 -08:00
Thad House
dd7563376b Force load OpenCV and cscore libraries on program initialization (#716)
Fixes bugs where Mat's are initialized before anything cscore was
called.
2017-11-14 22:04:53 -08:00
Tyler Veness
14fcf3f2f0 Simplified PIDController integration logic (#645)
A clamp() helper function was written based on C++17's std::clamp().
2017-11-13 22:28:55 -08:00
Peter Johnson
020ee227d2 Move ctre headers to hal/src so they aren't user-visible. (#728)
Also removes ctre_frames.h entirely since it's not used.

Fixes #683.
2017-11-13 22:23:18 -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
Peter Johnson
e301adb22b Use wpi::mutex instead of std::mutex. (#105)
This uses a priority-aware mutex on Linux platforms.
2017-11-13 09:51:26 -08:00
Peter Johnson
3438a17341 Use wpi::mutex instead of std::mutex. (#254)
This uses a priority-aware mutex on Linux platforms.
2017-11-13 09:51:05 -08:00
Peter Johnson
e4deda5ccb Fix SafeThread bad merge. (#53) 2017-11-12 23:00:50 -08:00
Peter Johnson
80618a2e64 Use wpi mutex and condition_variable. (#52) 2017-11-12 22:12:03 -08:00
Peter Johnson
e45b6e0f65 Fix typo in priority_condition_variable. (#51) 2017-11-12 22:11:08 -08:00
Peter Johnson
86d4899a54 Make NetworkTable constructor private/package-private. (#253)
Users should be using either NetworkTableInstance.getTable() or
NetworkTable.getSubTable().
2017-11-12 21:57:28 -08:00
Peter Johnson
9d8a508cd5 Add priority_mutex and priority_condition_variable. (#50)
Also provide wpi::mutex and wpi::condition_variable as wrappers for these
on Linux (where they're available), and for std::mutex and
std::condition_variable on other platforms.
2017-11-12 20:56:29 -08:00
Peter Johnson
c9ead29f44 SafeThread: Simplify m_lock assignment. (#49)
Instead of construct-and-swap, just use the move operator=.
2017-11-12 20:10:55 -08:00
Thad House
35d68d2a34 Adds ability to simulate joysticks and event info (#727)
Thanks @pjreiniger for the initiali implementation and work on this.
2017-11-12 19:33:43 -08:00
Peter Johnson
7007725d9f SerialHelper: Check error_code to prevent infinite loop. (#725) 2017-11-11 22:13:59 -08:00
Tyler Veness
0c83cad70c Upgraded clang-format to 5.0 (#431) 2017-11-11 22:09:51 -08:00
sciencewhiz
0001047b8b Add NidecBrushless to WPILib.h (#724) 2017-11-11 16:35:43 -08:00
Peter Johnson
f77fd1eca9 Set SO_EXCLUSIVEADDRUSE for server sockets on Windows. (#44)
On Windows, the shutdown() call relies on exclusively owning the server
socket.
2017-11-11 16:27:33 -08:00
Peter Johnson
5a5e753921 LLVM path: Don't follow symlinks. (#48)
This causes issues in recursive_directory_iterator.
2017-11-11 16:27:07 -08:00
Thad House
c885251367 Fixes HALSim_Print build to be the standardized pattern (#721)
Now publishes in zips, and with proper artifacts.

The code files just moved, and no changes.
2017-11-10 19:26:33 -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
Thad House
7bbd13d914 Adds match specific calls to Java and C++ (#720)
Uses caching, matching the joystick calls.
2017-11-09 19:59:29 -08:00
Thad House
3e4e5261fe Remove no warnings on winsock and scl issues (#47)
Not needed anymore. The winsock one we removed and the scl one is
dangerous anyway.
2017-11-09 18:56:27 -08:00
Thad House
cf4afb6feb Adds get header task (#46) 2017-11-09 18:55:27 -08:00
Thad House
55fa1e5e76 Adds header task (#101) 2017-11-09 18:43:21 -08:00
Thad House
2225c4fee2 Fixes warnings for casts in sim interrupt functions (#718) 2017-11-09 14:01:24 -08:00
Thad House
c101655419 Adds warning prints by updating native plugin (#100) 2017-11-09 11:24:22 -08:00
Thad House
51165ba0aa Updates native plugin to add warning prints (#251) 2017-11-09 11:23:52 -08:00
Thad House
f03b31f433 Adds warning printouts to gradle by updating native plugin (#45) 2017-11-09 09:25:22 -08:00
Tyler Veness
7efab4c43a Replaced ternary operators with if statements (#346)
Instances of the ternary operator were replaced with if statements to make the code base more consistent.
2017-11-08 23:44:03 -08:00
Thad House
c8e44256ef Uses NI provided function for SetOccurDataRef rather then importing the symbol ourselves. (#714) 2017-11-08 23:41:16 -08:00
Peter Johnson
f3cd883c5c Add Nidec Brushless motor. (#705) 2017-11-08 23:40:01 -08:00
Thad House
f34c736fb2 Adds warning prints to native library builds (#710)
Can be disabled with -PskipWarningPrints
2017-11-08 23:14:21 -08:00
Tyler Veness
1276489961 Removed uses of deprecated functions (#709) 2017-11-08 21:29:29 -08:00
Tyler Veness
8b2e656bde Fixed Java velocity PID not calculating result when P = 0 (#717) 2017-11-08 21:28:09 -08:00
Thad House
6e9d1f55c6 Updates image to 2018 v10 image (#713) 2017-11-08 11:26:11 -08:00
Thad House
f4dce9e608 Fixes receive size in Java I2C (#715)
Allows underrun, which matches c++ behavior.

Fixes #711
2017-11-07 18:43:23 -08:00
Thad House
b9aabc71b0 Fixes publishing basenames for examples to make combiner script work. (#712) 2017-11-07 14:54:17 -08:00
Jaci R
0d54772362 Add IDEA plugin to root project (#707) 2017-11-05 19:57:53 -08:00
Tyler Veness
faf134a674 C++ examples no longer use deprecated APIs (#703) 2017-11-05 19:39:47 -08:00
Thad House
c24e755409 Fixes java example publishing and xml file (#706) 2017-11-04 10:09:41 -07:00
Thad House
bee9f1cb17 Adds header task to print out all headers (#704)
Will be used to create a generator for IDE's to get include paths.
2017-11-03 22:50:06 -07:00
Tyler Veness
45d48d6b5a Cleaned up C++ examples (#672) 2017-11-03 13:22:56 -07:00
Peter Johnson
6401aa1fde SerialHelper: Use llvm path functions instead of popen. (#702)
This avoids a fork that causes an out-of-memory error in Java.

Depends on wpilibsuite/wpiutil#43
2017-11-03 12:30:56 -07:00
Peter Johnson
8e797a1a1d Import filesystem directory iterators from llvm. (#43)
Note: these are similar to the C++17 ones, but don't have quite the same API.
2017-11-03 11:40:42 -07:00
Thad House
6af4940c22 Adds HAL calls for match data from DS (#691) 2017-11-01 21:58:44 -07:00
Sam Carlberg
237b2df82f Add .type metadata to preferences table (#701)
Allows shuffleboard to automatically discover the type, instead of inflexibly hardcoding it
2017-10-30 21:50:49 -07:00
Peter Johnson
a70687aaec Improve error reporting for the new TCP netconsole. (#700)
Fixes #695.
2017-10-30 21:50:14 -07:00
sciencewhiz
fbfe85568b Fix preferences test (#699) 2017-10-29 21:30:50 -07:00
Tyler Veness
595b1df380 Fixed minimum number of joystick axes (#696) 2017-10-29 17:21:50 -07:00
Dustin Spicuzza
fd32350dc6 Assign received sequence number on receiving an unknown entry (#250) 2017-10-28 01:07:17 -07:00
Tyler Veness
b9c8ebeffa Ran formatter (#99) 2017-10-27 23:46:50 -07:00
Thad House
efc7770e9b Fixes NPE in DriverStation initialization (#694)
Introduced by #626.
2017-10-27 23:16:42 -07:00
Tyler Veness
21585f70a8 Added functions for detecting button press and release events (#626)
I also shuffled around the HID interfaces to be more intuitive, deprecated some
Joystick and XboxController member functions, and deprecated the JoystickBase
and GamepadBase classes.

Supersedes #89.
2017-10-27 21:45:56 -07:00
Tyler Veness
c33fca34e9 Added TimedRobot template (#673) 2017-10-27 21:33:04 -07:00
PJ Reiniger
de95f08a10 Adding call to notify program started (#692)
Causes the HALSIM_WaitForProgramStart loop to break, essentially
notifying simulators the robot is good to go.
2017-10-27 21:00:52 -07:00
Thad House
90f99dc571 Adds PWM to LoopTiming and CycleStart HAL calls (#693) 2017-10-27 19:44:40 -07:00
Thad House
f34332643a Uses new FPGA calls to get 64 bit FPGA time and 64 bit PWM cycle start time. (#687) 2017-10-27 18:03:10 -07:00
Tyler Veness
4ab095e9c9 Fix formatting in CameraServer.cpp (#689)
A PR didn't rerun the formatter before merging.
2017-10-27 11:35:57 -07:00
Thad House
541753c814 Updates to 2018 v9 image (#686) 2017-10-27 00:47:56 -07:00
Jeremy White
f02bb058bd Set the llvm standard output stream to be unbuffered. (#678)
This is particularly useful for the simulation when invokved
inside Eclipse.  Otherwise, you won't see the robot starting
message.
2017-10-27 00:46:56 -07:00
sciencewhiz
12e96c6f13 Add usage reporting to CameraServer (#682) 2017-10-27 00:45:54 -07:00
Austin Shalit
b65447b6f5 Fix spelling typos (#595) 2017-10-27 00:44:51 -07:00
Tyler Veness
9945a5b3c6 Ran formatter (#681) 2017-10-26 19:28:59 -07:00
Thad House
ce4c9edd1f Fixes halsim_print to not try and build when the 'onlyAthena' flag has been set (#685)
Building a non-athena library in athena only is not possible.
2017-10-25 10:52:35 -07:00
PJ Reiniger
a6e6ae41b9 Add function that can register all the HAL callbacks at once (#646)
Since all of the callbacks issue a string identifier, it makes it
possible and easy to have one function callback, and differentiate the
path to take based on the string.  Hooking up all the callbacks at once
makes it easier for the simulator developer to know when something was
added to wpilib rather than looking at the commits.
2017-10-21 22:45:41 -07:00
Austin Shalit
f4e2e41aaf Remove leading '*' from license and rename to LICENSE.txt (#596) 2017-10-21 16:04:57 -07:00
Thad House
1e528669ff Adds publishing for examples and templates so they can be grabbed from eclipse (#674) 2017-10-21 15:33:42 -07:00
Thad House
a1ea448406 Adds JNI call to get CANStatus (#677)
Call already existed in the HAL.
2017-10-21 15:32:05 -07:00
Tyler Veness
9dc1de1d09 Specified angle units for Vector2d rotate() function. (#679)
Fixes #676.
2017-10-21 15:29:39 -07:00
Tyler Veness
0521d85048 Moved comment after include line so include order is determined properly (#680) 2017-10-21 15:28:46 -07:00
PJ Reiniger
3c842d8234 SPI and I2C simulator (#662)
* Creating SPI and I2C simulation abilities

* Update the callback helpers to support different function callback
types
* Create callback type that uses a buffer
* Created I2C/SPI data classes that manage the callbacks and don't do
much of anything else

* Ran format, cleaned up some issues
2017-10-18 23:01:58 -07:00
Tyler Veness
ec12b0ffe2 Add wpiformat to Travis CI (#98) 2017-10-18 00:49:19 -07:00
Tyler Veness
7fd5947486 Fix include guards (#97)
Enforced by styleguide#79.
2017-10-18 00:48:44 -07:00
Jeremy White
be77f9cb26 Pull request for the Extensions interface only (#655)
* Modify halsim to be able to load extension libraries if they are available.

It will read the list of libraries to try from the HALSIM_EXTENSIONS
environment variable.  Multiple libraries can be given if separated
by ';' (Windows) or ':' (Unix).

The library must have an 'HALSIM_InitExtension' method that returns >= 0 on success.

The library is expected to use the interface expressed by
  hal/src/src/main/native/include/MockData

* Add a simple halsim library that just prints robot values.

This makes a good test bed for cross platform purposes,
and provides the ultimate in light weight simulators.

This initial version only prints PWM values.
2017-10-18 00:27:55 -07:00
Austin Shalit
2fc60680f4 Remove RedundantModifiers (#578) 2017-10-17 21:47:55 -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
Austin Shalit
66002d6cac [WIP] Move examples to allwpilib (Java) (#569)
* Move examples to allwpilib

* Add checkstyle config to examples project

* Ran wpiformat

* Run checkstyle on examples

* Change maximum line length for examples to 80 chars

This number was chosen based on testing of the number of characters shown by default in Eclipse done by @Kevin-OConnor: 51 chars by default on an E09 @ 1024x600 (which has the welcome window open on the right), 71 with welcome closed, 95 with the right-hand outline pane closed

* Add mavenCentral repository

* Rename subproject & error on deprecated API use

* Remove deprecated API usage
2017-10-16 22:30:21 -07:00
Tyler Veness
a7e9ac1062 Fix capitalization of class names in PIDToleranceTest.cpp (#588) 2017-10-16 21:16:33 -07:00
Thad House
434d60592c Adds HAL_Initialize to ErrorBase constructor, and makes HAL_Initialize properly reentrant (#668)
Partial fix to #663, and most likely the best we are going to be able to
get.
2017-10-16 20:00:32 -07:00
Thad House
ee20747255 Adds WPILib JNI shared debug file publish. (#671) 2017-10-16 19:59:05 -07:00
Tyler Veness
f4779379c3 Added brace comments (#670)
Enforced by wpilibsuite/styleguide#80.
2017-10-16 19:56:08 -07:00
Austin Shalit
877a9eae1f Add SpeedControllerGroup (#362) 2017-10-16 19:54:36 -07:00
Tyler Veness
b68e1c5570 Added brace comments (#96)
Enforced by wpilibsuite/styleguide#80.
2017-10-15 10:01:17 -07:00
Thad House
ded1beb949 Removes specific raspbian, armv7 and armv8 cross builds (#249)
Matches wpilibsuite/wpiutil#41
2017-10-14 21:58:32 -07:00
Thad House
a6c7789b5e Removes specific raspbian, armv7 and armv8 cross builds (#41)
Will make the cross platform build case easier. A bit more difficult to
consume, but will be easier in the long run.
2017-10-14 21:57:53 -07:00
Thad House
24752a9751 Removes OpenCV dependency from wpilibJNI (#667)
Not exactly sure why it was there in the first place. Closes #664
2017-10-12 18:25:17 -07:00
Thad House
e1dc099517 Updates to the 2018v5 image (#665) 2017-10-12 18:24:39 -07:00
Sam Carlberg
f0cc623241 Change metadata format to dotfile, make certain entries metadata (#666)
Sendable's "Name" is now ".name"
Sendable's "Subsystem" is now ".subsystem"
Command's "name" is now ".name"
Command's "isParented" is now ".isParented"
2017-10-11 20:27:49 -07:00
Jacob Caporuscio
ba3a85d0cc Changes TalonSRX to PWMTalonSRX in wpilibj and wpilibc. (#656)
Also brings the java kResourceType list up-to-date with the cpp list.
2017-10-11 12:01:50 -07:00
Thad House
79919a5f1c Moves wpilibc link script into shared folder (#660) 2017-10-08 10:42:09 -07:00
Thad House
94ea5bfb06 Move published wpilibj JNI shared artifact into shared/ subfolder (#658)
Makes eclipse easier.
2017-10-07 15:31:36 -07:00
Thad House
24680bbd53 Change link script artifact id (#657) 2017-10-07 12:08:53 -07:00
Peter Johnson
73f8412b42 Correctly handle negative waitForXQueue timeouts in Java. 2017-10-05 23:29:00 -07:00
Peter Johnson
529d7f5fe3 Initialize logger min level from logger_impl. 2017-10-05 23:29:00 -07:00
Peter Johnson
a6c1e18aef NetworkTable.containsKey(): Always return false on empty key. 2017-10-05 23:29:00 -07:00
Peter Johnson
8a37b81f4e LoadEntries: Don't emit NOTIFY_FLAGS. (#247)
Fixes #246.
2017-10-04 11:28:35 -07:00
Peter Johnson
f81b6fbcd6 Fix handling of deleted values in several places. (#241)
Now that the m_entries entry is kept, other places can't assume that
a value exists simply because the entry exists.
2017-10-02 13:06:39 -07:00
Peter Johnson
7fab0e0ef2 Depend on wpiutil 3.+, ntcore 4.+, cscore 1.+ rather than just +. (#651)
Also update to wpilib-version-plugin 2.0.
2017-10-01 10:57:03 -07:00
Peter Johnson
223e61df2a Depend on wpiutil 3.+ rather than just +. (#95)
Also update to wpilib-version-plugin 2.0.
2017-10-01 10:56:21 -07:00
Peter Johnson
303df626a2 Depend on wpiutil 3.+ rather than just +. (#235)
Also update to wpilib-version-plugin 2.0.
2017-10-01 10:55:43 -07:00
Peter Johnson
9e8ad778dd Update wpilib-version-plugin to 2.0. (#39) 2017-10-01 10:55:17 -07:00
Peter Johnson
1f18cc5416 Add SaveEntries() and LoadEntries(). (#233)
These allow saving and loading non-persistent entries in the persistent
file format.
2017-10-01 09:13:43 -07:00
Peter Johnson
e68a71022c Move immediate connection notification logic into Dispatcher.
This prevents a race condition that could result in out of order
notifications.
2017-10-01 09:01:00 -07:00
Peter Johnson
e4a8bff70e Move immediate entry notification logic into Storage.
This prevents a race condition that could result in out of order
notifications.
2017-10-01 09:01:00 -07:00
Peter Johnson
10982e0275 Don't actually remove deleted entries from m_entries. (#239)
Doing so invalidates entry instance handles.

Fixes #238.
2017-09-30 22:55:30 -07: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
19addb04cf Split RobotDrive class into a class for each drive type (#552)
DiffDrive.CurvatureDrive (aka CheesyDrive) and KilloughDrive were also added.
This reorganization paves the way for SwerveDrive.
2017-09-28 23:30:00 -07:00
pjreiniger
abb66d3e4b Replace FRC_NetworkCommunication CAN in wpilibj with HAL CAN (#650) 2017-09-28 22:40:04 -07:00
pjreiniger
db4981f166 Java now asks the HAL if it is a simulation or not (#647) 2017-09-23 07:56:53 -07:00
Peter Johnson
8edc02b06d Update README for new build system. (#232) 2017-09-22 22:32:01 -07:00
Tyler Veness
4b2aaee9ea Made package local methods in NetworkTableInstance public (#234) 2017-09-22 22:31:19 -07:00
Thad House
9fdb33b6af Switches native linux arm build to be nativearm arch (#38)
Fixes gradle bug
2017-09-22 09:30:58 -07:00
Tyler Veness
6e1be897de Ran formatter (#643) 2017-09-19 21:55:36 -07:00
sciencewhiz
423d8f6860 Add missing usage reporting. (#639)
Compressor C++/Java
Servo C++
2017-09-19 21:17:27 -07:00
Jeremy White
eb38204d1a Update the README to note the need for gcc 5+ and Visual Studio (#640)
Update the build requirements in the README.  Add a note about
Visual Studio, the need for gcc 5, and remove the style guide;
it is mentioned further down, and it is not a requirement for building.
2017-09-19 21:14:53 -07:00
Tyler Veness
1711291cd8 Fix Travis build (#641)
Travis now installs pip3 explicitly.
2017-09-19 21:13:03 -07:00
Peter Johnson
3faecdb353 Add SHA1 algorithm implementation. (#32)
Largely based on https://github.com/vog/sha1 with some customizations and
optimizations.
2017-09-10 17:21:19 -07:00
Peter Johnson
57ba58917d PreferencesTest: Use new NetworkTables API. (#636)
This avoids deprecated warnings from the old API.
2017-09-07 22:40:18 -07:00
Thad House
2249a8bac0 Adds a HAL wrapper around the CAN API's (#623)
Can someday be added to the simulator. Removes the last use case for the
ni headers directly.
2017-09-07 21:40:30 -07:00
Thad House
c572e6a307 Adds the rest of the data needed for a publish on jenkins (#628) 2017-09-07 21:07:01 -07:00
Tyler Veness
e444b6015c Updated remaining .styleguide files to new config file format (#635) 2017-09-07 21:02:52 -07:00
Peter Johnson
db96f41ad7 Log.cpp: Use raw_ostream and llvm path functions. (#93) 2017-09-07 00:16:26 -07:00
Tyler Veness
38dbed8e09 .styleguide now uses generalized config file format (#621)
Requires styleguide#66.
2017-09-06 23:00:10 -07:00
Tyler Veness
10fbf17d42 .styleguide now uses generalized config file format (#94)
Requires styleguide#66.
2017-09-06 22:59:23 -07:00
Peter Johnson
34c18ef000 Remove getTable from wpilibj Sendable interface.
This allows nearly all m_table member variables to be removed.
2017-09-06 22:29:04 -07:00
Peter Johnson
0d4fde17e0 Remove GetTable from wpilibc Sendable interface.
This allows nearly all m_table member variables to be removed.
2017-09-06 22:29:04 -07:00
Peter Johnson
040a8c6bcc Update wpilibc to use new NetworkTables package and interfaces. 2017-09-06 22:29:04 -07:00
Peter Johnson
4e80570c4c Update wpilibj to use new NetworkTables package and interfaces.
This may be breaking to CANSpeedController implementations.
2017-09-06 22:29:04 -07:00
Peter Johnson
91529cc435 Update NetworkTables for new API.
This fixes breakages due to the JNI move.

Depends on: https://github.com/wpilibsuite/ntcore/pull/204
2017-09-06 22:29:04 -07:00
Peter Johnson
ef85809690 Fix bug in raw_fd_istream::read_impl(). (#30)
It would not set error if read() returned 0 (indicating EOF).
2017-09-06 22:06:21 -07:00
Peter Johnson
95bce5d656 Add more storage incoming unit tests. 2017-09-06 20:59:09 -07:00
Peter Johnson
cedbafeb28 Add INetworkConnection interface for unit testing. 2017-09-06 20:59:09 -07:00
Peter Johnson
7c1d2f4bc4 Improve client connection synchronization behavior.
The original synchronization behavior was troublesome for two reasons:
- It had unpredictable behavior for updated values
- It brought back to life deleted values

Instead of relying on the server to inform the client regarding reconnections,
the client keeps track of what values have been modified by user code on the
client.  When the client connects to the server, the following occurs.

For entries that have been modified by user code on the client:
- If the entry is not persistent, the server value is overwritten with the
  client value
- If the entry does not exist on the server, the client sends an assignment
  to the server to recreate it on the server

For entries that have not been modified by user code on the client:
- The client value is overwritten with the server value
- If the entry does not exist on the server, the client deletes the entry

Fixes #8.
2017-09-06 20:48:48 -07:00
Peter Johnson
8099d6dbd7 Refactor Storage ProcessIncoming(). 2017-09-06 20:41:53 -07:00
Peter Johnson
8e01b68cf6 Switch Storage save/load to use raw_ostream/raw_istream. 2017-09-06 20:41:53 -07:00
Peter Johnson
d707a07f84 Refactor Storage load and save functionality.
Fixes #191.
2017-09-06 20:41:53 -07:00
Peter Johnson
5ab20bb27c Implement independent instances.
Previously, most of the classes were implemented as singletons so only one
instance was possible.

This change adds an instance handle-based API.  In Java, this API is located
in a different package than the old API (edu.wpi.first.networktables).

Backwards compatibility with ITable and the old NetworkTable API is largely
maintained, but a handful of classes have moved to the new package in Java
(ConnectionInfo and PersistentException), and the old JNI has been completed
replaced.

Also:
- Move SetTeam implementation to Dispatcher.
- Consistently pass time through Java and C++ Value API.
- Rename nt_Value.h to NetworkTableValue.h for consistency with Java.
- Improve documentation
- Make C++ and Java APIs more consistent
- Document RPC functions and support RPC in Java.
- Add polling features for entry and connection listeners and use them to
  move callback threads to Java level.
- Remove thread start and stop hooks (as polling is available).
- Make Notifiers, RpcServer, Dispatcher, and Storage mockable.
- Set NOTIFY_NEW on immediate entry notifications.
- Make GetTable("/") and GetTable("") equivalent.
- Generate local notification for flags update when loading persistent file.

And many unit test updates/changes:
- Use InitGoogleMock instead of InitGoogleTest in test main.
- Move test printers to TestPrinter.h/cpp.
- Provide printers for StringRef, EntryNotifier, and Handle.
- StorageTest: Check notifications.
- Add entry notifier unit tests.
- Storage: Add test for incoming entry assignment.
- Update connection listener tests.
- Add entry listener unit tests.

Fixes #11, #140, #189, #190, #192, #193, #221
2017-09-06 20:28:35 -07:00
Peter Johnson
8125a179fb Only include .cpp files in testsuite build. 2017-09-06 20:28:35 -07:00
Peter Johnson
041563f8ea Change UidVector to be LRU with a reuse threshold. (#29)
This keeps indexes from being instantly reused and reduces the risk of
accidentally using an old index.

Also change erase and emplace_back to return 0-based instead of 1-based
indexes.

This is a breaking change, but a noisy one due to the template parameter
change.
2017-09-06 19:54:58 -07:00
Peter Johnson
ef3267833f Fix IterativeRobot/TimedRobot RobotInit(). (#633)
In C++, it's not legal to call a virtual function from within a constructor,
so the user override was never called (the base function is always called).

See https://isocpp.org/wiki/faq/strange-inheritance#calling-virtuals-from-ctors

While this is technically allowed in Java, also change Java for consistency.
2017-09-05 23:57:26 -07:00
sciencewhiz
a5ef50c9e7 Add documentation for PeriodMultiplier (#632) 2017-09-04 22:03:02 -07:00
sciencewhiz
6eee457898 Renable javadoc fail on error (#631)
Remove reference check and fix HTML error
2017-09-03 14:10:40 -07:00
Thad House
fb6d7b3470 Fixes javadocs (#630) 2017-09-02 21:29:30 -07:00
sciencewhiz
2d78fdabb8 Fix recieve typo in JNI names. (#629)
Fixes #594
2017-09-01 22:48:33 -07:00
Thad House
94c31ceeb1 Gets wpilib compiling with skipAthena and onlyAthena flags (#625) 2017-08-31 21:29:35 -07:00
Thad House
c3f7c85f8a Adds wpi GetHostname function (#25) 2017-08-27 21:35:34 -07:00
Peter Johnson
12b2efa489 Log.cpp: Use raw_ostream and llvm path functions. (#223) 2017-08-27 12:01:31 -07:00
Peter Johnson
67d4da51ee Restore travis support. (#608)
Travis no longer builds athena, as we no longer support 14.04 as a build
platform.  It also does not build the dev or test executables due to
system library symbol differences on 14.04.
2017-08-27 02:14:33 -07:00
Tyler Veness
6e4f66cc8b Classify other libraries' headers properly and fix committed formatting issues (#620) 2017-08-27 00:11:52 -07:00
Thad House
5d403a7b49 Makes an empty stringref have a valid Data pointer (#28)
Now acts similar to std::string, where an empty construction string is valid.
2017-08-26 10:04:11 -07:00
Peter Johnson
3c88f94b43 HttpUtil has moved to wpiutil; use it. (#92) 2017-08-25 18:10:47 -07:00
Tyler Veness
06636a0e1c Set up wpiformat (#86) 2017-08-25 17:48:06 -07:00
Tyler Veness
a4e781a231 Fixed spacing and comment annotations around namespace and extern declarations (#587) 2017-08-24 00:07:46 -05:00
Tyler Veness
f151892db5 Contents of copyright line now has more standard ordering (#585) 2017-08-24 00:06:13 -05:00
Austin Shalit
c45fb73f36 Convert for loops to foreach loops (#592) 2017-08-24 00:00:55 -05:00
sciencewhiz
848280d1f1 Improve C++ Compressor documentation based on Java's docs. (#607) 2017-08-23 23:58:21 -05:00
Thad House
8416b4e42c Add default parameter to StringRef to allow null termination on lengthed strings. (#27) 2017-08-23 21:02:11 -05:00
Thad House
1a0ed61f78 Force the java dev library to be built during build (#24) 2017-08-23 01:27:56 -05:00
Peter Johnson
68501759fa tcpsockets: Don't pull in platform-specific headers in headers. (#26)
This pollutes the namespace for all users of these headers.
This is particularly an issue on Windows.
2017-08-23 01:27:19 -05:00
Peter Johnson
f7016b359f HALUtil: Update to new GetJavaStackTrace function. 2017-08-22 23:09:28 -05:00
Peter Johnson
be58a279a5 Cross-platform JNI sometimes has jlong != int64. 2017-08-22 23:09:28 -05:00
Peter Johnson
909e6c4857 Error.cpp: Use llvm path function instead of OS basename.
This fixes an issue with the mac build.
2017-08-21 17:20:43 -05:00
Peter Johnson
5c0b08f4f5 Turn off -Wunused-const-variable on Mac. 2017-08-21 17:20:43 -05:00
Peter Johnson
05d1cfa276 Add "override" qualifier to several headers.
clang on Mac generates warnings for these.
2017-08-21 17:20:43 -05:00
Peter Johnson
ae675ae4e1 DriverStation: Work around missing pthread_local on Mac. 2017-08-21 17:20:43 -05:00
Peter Johnson
d3b636d073 fpga_clock: Don't use constexpr for time_points.
These are not constexpr on some compilers.
2017-08-21 17:20:43 -05:00
Peter Johnson
8b460f5944 sim DriverStation: Fix missing includes. 2017-08-21 17:20:43 -05:00
Tyler Veness
bdfa32876b Fixed Gradle test task name (#617) 2017-08-21 17:15:38 -05:00
Tyler Veness
4a3472ebb2 Removed unused include in PIDCommand.cpp (#616) 2017-08-20 17:09:13 -07:00
Thad House
9c804c1351 Fixes builds with skipAthena and onlyAthena, and mac builds (#613)
Did these in cscore and the other repos, but forgot about some of the
oddities jenkins has.
2017-08-19 22:15:52 -07:00
Tyler Veness
2a9c454baa Cleaned up and updated .styleguide for new build system file locations and ran wpiformat (#612) 2017-08-19 22:14:34 -07:00
Thad House
1a9a6c3678 Fixes HalSimStaticDeps config and publishing (#610) 2017-08-19 11:32:49 -07: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
Peter Johnson
dd85b1e519 Update googletest and googlemock to 1.8.0. (#90) 2017-08-18 20:47:04 -07:00
Thad House
2d3cf1bdb1 Updates plugin to 1.2.12 (#91)
Fixes .debug issue
2017-08-18 20:22:21 -07:00
Thad House
baa8021c79 Force dev java to be built during build task (#227) 2017-08-18 19:51:14 -07:00
Thad House
133540f577 Switches to the new build system (#87)
* Removes old build system

* Removes old gmock

* Adds new gmock

* Moves source files to new locations

* Adds new build system
2017-08-18 17:52:08 -07:00
Peter Johnson
43c103c0ac Update googletest and googlemock to 1.8.0. (#23) 2017-08-15 23:53:20 -07:00
Peter Johnson
162ac787b7 Update googletest and googlemock to 1.8.0. (#226) 2017-08-15 23:47:25 -07:00
Peter Johnson
fa7d5bc023 Add UidVector (used in both ntcore and cscore Notifier). (#22) 2017-08-14 22:58:11 -07:00
Peter Johnson
9d45088127 Fix destruction order issue in SourceImpl. (#89)
The Frame destructor calls back into SourceImpl, locking m_poolMutex, so
it's necessary to destroy m_frame before m_poolMutex.  Reverse destruction
order to member definition order is guaranteed by the C++ standard.
2017-08-14 22:27:28 -07:00
Thad House
7ef56de3f2 Fix mac builds. (#88)
Warnings for unused functions, and the same skips as Windows.
2017-08-14 22:27:07 -07:00
Tyler Veness
0d76b3f308 Added gradlew.bat to .gitattributes (#225)
The gradle-wrapper.properties file also got committed with CRLF line endings,
which this commit rectifies.
2017-08-14 00:02:38 -07:00
Thad House
50ed55e8e2 Force OpenCV to 3.1.0 (#602)
Will break otherwise when I push a new version
2017-08-13 21:41:45 -07:00
Thad House
92c4c49b01 Removes the custom platform include flag (#224)
Was replaced by #222
2017-08-13 15:41:59 -07:00
Peter Johnson
855df5d679 raw_mem_istream: Add StringRef constructor. 2017-08-13 12:18:19 -07:00
Peter Johnson
c8d9cc7e5b Add filename constructor to raw_fd_istream. 2017-08-13 12:18:19 -07:00
Peter Johnson
1c1fbf14cf Import LLVM openFileForRead and openFileForWrite. 2017-08-13 12:18:19 -07:00
Peter Johnson
9e4dc235d7 Connect to server in parallel rather than doing round-robin. (#205)
This substantially speeds up client connection times.
2017-08-13 12:05:29 -07:00
Peter Johnson
4bd8cf6f5c Native tests depend on native sources, so include in exportedHeaders. (#222) 2017-08-13 10:27:06 -07:00
Thad House
d9c754c30f Add a java version of the dev app. (#218) 2017-08-13 08:02:29 -07:00
Thad House
ea028a3822 Add a cpp dev run task. (#219) 2017-08-13 08:01:39 -07:00
Peter Johnson
7d9e6b7e22 Move ReadLine into raw_istream class as getline. (#20) 2017-08-13 00:56:35 -07:00
Peter Johnson
17b5cace5b Base64: Add raw_ostream and SmallString interfaces. (#19) 2017-08-13 00:55:56 -07:00
Thad House
2fa41b23b9 Add a java version of the dev app. (#16) 2017-08-12 23:52:08 -07:00
Thad House
9f5f6111d4 Add a cpp dev run task. (#17) 2017-08-12 23:51:25 -07:00
Thad House
0782164120 Gradle 4.1 (#220) 2017-08-11 01:10:18 -07:00
Thad House
5439fe7b16 Gradle 4.1 (#18) 2017-08-09 20:20:10 -07:00
Thad House
55111ac35f Fix CORS issue with all requests (#85)
Closes #84.
2017-08-07 17:46:33 -07:00
Thad House
f0cc5d9ca8 Adds an all artifact to the published libraries (#15)
Better then the old desktop zips because it will include all artifacts
built, not just specifically the desktop ones. Also, the individual
artifacts are published as well so users can decide which artifacts they
specifically want, and can help decrease download sizes. The cpp plugin
will continue using the individual artifacts.
2017-08-07 17:44:07 -07:00
Thad House
ccfeab5ac9 Adds an all artifact to the published libraries (#217)
Better then the old desktop zips because it will include all artifacts
built, not just specifically the desktop ones. Also, the individual
artifacts are published as well so users can decide which artifacts they
specifically want, and can help decrease download sizes. The cpp plugin
will continue using the individual artifacts.
2017-08-07 17:42:58 -07:00
Tyler Veness
d682295ccd Miscellaneous cleanups for HAL, wpilibc, and wpilibj JNI (#589)
* Static functions in the HAL implementation were placed in the hal namespace
* "using namespace" declarations in HAL/cpp/Log.h and Timer.cpp were replaced
  with "using" declarations for std::chrono
* An extra include was removed from AnalogGyro.cpp
* InterruptableSensorBase's constructor was defaulted
* Newlines were added to some wpilibc integration tests for grouping
* A variable in HALUtil.h was renamed to follow the style guide

Supersedes #586
2017-08-07 17:36:34 -07:00
Austin Shalit
5e19c1881f Use diamond operator 2017-08-07 17:31:16 -07:00
Austin Shalit
617ff52f18 Use generics 2017-08-07 17:31:16 -07:00
Peter Johnson
7e011bda6f Add HTTP utilities. (#7)
Imported from cscore.
2017-08-06 23:28:21 -07:00
Peter Johnson
8418c39120 Add Path and Twine components from LLVM. (#10) 2017-08-06 23:26:42 -07:00
Peter Johnson
5d3af62c0e Remove use of std::chrono_literals (C++14 feature). (#574) 2017-08-04 20:44:33 -05:00
Peter Johnson
4b8ef57a99 Remove networktables2.type Java custom container types. (#214) 2017-08-04 20:24:36 -05:00
Peter Johnson
d910b0b2a2 Remove deprecated throwing get functions. (#213) 2017-08-04 14:02:28 -05:00
Thad House
80c8de7d69 Add dependency to jni task to fix 32 bit builds (#216)
Fixes #212
Also forces appveyor to test both 32 and 64 bit correctly.
assemble was removed because it would inadvertently cause a 3rd build.
2017-08-04 13:46:58 -05:00
Peter Johnson
7f776deae2 Fix ntcoreExe build model. (#215) 2017-08-04 13:35:23 -05:00
Peter Johnson
8209ba8a00 Move NetworkTable into nt namespace, with a shim. (#211)
Defining NAMESPACED_NT will disable the shim.
2017-08-04 10:32:33 -05:00
Peter Johnson
25c8e873d0 TCPConnector: Add method to connect to server in parallel. (#6)
This substantially speeds up connection times compared to sequentially
trying to connect to each server in round-robin fashion.
2017-08-03 16:45:42 -05:00
Thad House
e24db75f08 Build updates to newest version of plugins and gradle, along with config file (#13) 2017-08-03 16:24:02 -05:00
Thad House
5df7463663 Remove wpiutil and update to the new build system (#210) 2017-08-03 16:14:40 -05:00
Thad House
eb7331f2ab Actually makes the right classifier 2017-08-02 19:47:32 -07:00
Thad House
03bd0820cc Adds a java classifier whenever jenkins is building (#12)
Makes the jar much easier to find when attempting to combine.
2017-08-02 19:33:26 -07:00
Thad House
63768166ea Updates to plugin 1.2 (#9)
1.1 was a bad publish
2017-08-02 13:17:34 -07:00
Thad House
bd899a7a7c Fixes mac RuntimeDetector (#11) 2017-08-02 13:17:26 -07:00
Austin Shalit
ddd5aeba19 Checkstyle 8.1 (#584)
Added a few checks too:
- SimplifyBooleanExpression
- SimplifyBooleanReturn
- StringLiteralEquality
- UnnecessaryParentheses
2017-07-28 22:24:05 -07:00
Peter Johnson
301442ee43 Add json support to wpiutil.
This is a modified version of https://github.com/nlohmann/json.

It's been moved into the wpi namespace as many of the changes are not
compatible.  The amount of template code has been significantly reduced,
enabling many functions to be moved out-of-line, and for the result to
build on older compiler versions (in particular GCC 4.8).
2017-07-28 21:55:03 -07:00
Peter Johnson
de9dd1180b Include src/main/native/cpp when building test. 2017-07-28 21:55:03 -07:00
Peter Johnson
436ed4d1e3 Implement comparison operators for llvm::StringMap. 2017-07-28 21:55:03 -07:00
Peter Johnson
88aa273e55 license.txt: Add LLVM license. 2017-07-28 18:09:14 -07:00
Peter Johnson
d11d8409a8 license.txt: Remove leading asterisks 2017-07-28 18:09:14 -07:00
Peter Johnson
9385d1b6d8 GetJavaStackTrace: Provide llvm::StringRef excludeFuncPrefix. (#3)
This is a bit cleaner to use than the templated version (many compilers
have issues with templating on static strings, for example).
2017-07-28 18:08:54 -07:00
Peter Johnson
b90653f3e3 Logger: Add def_func and min_level constructors. (#2) 2017-07-28 18:08:31 -07:00
Thad House
1243cf04ea Adds new build system to repo (#1) 2017-07-28 07:29:49 -07:00
Peter Johnson
3cfcbe9a95 Remove Scheduler.java from the sim path. (#564)
This is an old version and is duplicative of the shared Scheduler.java.
2017-07-27 00:41:56 -07:00
Thad House
4f5b5b1377 Adds gmock files 2017-07-27 00:04:00 -07:00
Tyler Veness
6bc793505d Suppress MultipleTopLevelClasses warning (#581) 2017-07-26 23:15:00 -07:00
Austin Shalit
3b44160cff Rearrange some method calls so methods fail faster (#583) 2017-07-26 23:14:35 -07:00
Thad House
d9586c8d38 Fixes JNI aliasing issues involving ControlWord and AllianceStation (#575) 2017-07-26 20:59:40 -07:00
Austin Shalit
74df3fac4e Require non null (#580)
* Replace null checks with Objects.requireNonNull()

* Use PMD rule instead of checkstyle rule
2017-07-18 20:32:08 -07:00
Austin Shalit
06321b8e87 Fix encoder sourceA null check (#579) 2017-07-18 19:34:45 -07:00
Thad House
f3efb948fe Switches CANJNI to use byte[] rather then ByteBuffer, and throws exceptions for invalid platforms (#571)
Fixes #567
2017-07-10 20:33:34 -07:00
Tyler Veness
432c03bf63 Updated Gradle to 4.0.1 (#573)
New PMD checks required modifying PIDController
2017-07-10 20:31:20 -07:00
Austin Shalit
bfd224278b Fix Java MyRobot linting (#572) 2017-07-10 20:29:52 -07:00
Tyler Veness
822ea6abc8 Made SpeedController class organization consistent between languages (#568) 2017-07-09 19:43:56 -07:00
Tyler Veness
97437ee58b Miscellaneous formatting and style fixes for integration tests (#570)
Added newline before comment block and replaced angle brackets around includes
with quotation marks. All other integration tests use quotation marks for WPILib
includes.
2017-07-09 19:27:43 -07:00
Thad House
aa7fe0db29 Fixes unused buffer warning on platforms other then athena (#566) 2017-07-09 08:59:26 -07:00
Thad House
237685d4a5 Fixes static initialization of HAL handles (#565) 2017-07-08 22:04:01 -07:00
Thad House
abbe630274 Gets WPILib building on windows and C++11 vs C++1y (#561) 2017-07-08 14:17:21 -07:00
Tyler Veness
89d3b08e77 Added TimedRobot (#520) 2017-07-08 07:50:56 -07:00
Thad House
f826216a28 Gets JNI compiling on all platforms (#563) 2017-07-08 07:48:27 -07:00
Austin Shalit
aa0a874ad0 Add periodic method to subsystems (#528)
Fixes #526.
2017-07-02 23:02:41 -07:00
Thad House
2da26c0579 Make HAL_Initialize timeout configurable, makes result a bool, and makes Java an exception rather than assert. (#557) 2017-07-01 00:43:06 -07:00
Tyler Veness
d34c844900 Fixed function ordering in robot base classes (#553) 2017-06-30 22:12:28 -07:00
Tyler Veness
68b63632c4 Removed functions that have been deprecated for at least one year (#551) 2017-06-30 22:05:33 -07:00
Chris Gregory
d2de94778e Remove memory leak in ConditionalCommand (#537)
This also properly handles nullptrs passed into ConditionalCommand
instead of having Undefined Behavior or NullPointerExceptions.
2017-06-30 22:01:21 -07:00
Austin Shalit
4fd4a50d41 Update Preferences to not use deprecated APIs (#555) 2017-06-30 19:38:32 -07:00
Tyler Veness
9d93820717 Replaced STL streams with LLVM's raw_ostream (#344)
std::cout and std::printf were replaced with llvm::outs() and std::cerr was replaced with llvm::errs().
2017-06-30 19:33:43 -07:00
Thad House
c57a7f0a41 Switches all notifiers created with the external API to be threaded (#546)
Testing showed this wasn't an issue with timing, and allows for more
safety in user code making mistakes. Places where the extra thread
wouldn't help have been kept non threaded, using a new internal API.
2017-06-30 18:58:58 -07:00
Thad House
1d15fcd072 Prints error when HAL_GetFPGATime call fails in fpga_clock. (#558) 2017-06-30 18:46:50 -07:00
Thad House
e824b1129e Adds way to reset and version all HAL handles (#545)
Useful in the sim to force a full reset. On roboRIO, the information is
still created and added, but is not checked because of speed
considerations.
2017-06-30 16:28:28 -07:00
Tyler Veness
0cd03c66e3 Remove deprecated Task class (#550) 2017-06-30 16:12:19 -07:00
Thad House
462b231dac Adds function to HAL to free malloc'd joystick name (#543)
No safe way to do this with interop, so a function is needed.
2017-06-30 16:11:16 -07:00
Tyler Veness
e4a918850f Fixed return value of SendableChooser<T>::GetSelected() for non-pointer T's (#512)
Fixed undefined behavior when returning nullptr for T = std::string. Also added
support for smart pointers. T = std::unique_ptr<U> returns U* and T =
std::shared_ptr<U> returns std::weak_ptr<U>.
2017-06-30 15:37:22 -07:00
Thad House
d472af3517 Removes CAN.h from the HAL (#556)
I can't find where the actual code is implemented, and I get errors if I
try to link or compile to any of its functions. Even CANJaguar doesn't
use them, nor did the old impl of CANTalon. Plus looking at the API it
makes no sense anyway, since it doesn't do any buffers , so I think its
worth it to remove it.

Removes CAN.h from the JNI header
2017-06-30 15:13:51 -07:00
Tyler Veness
98a587a347 Removed unused includes and added missing stdint.h includes (#549) 2017-06-25 09:05:49 -07:00
Aaron Pinto
5fd996876b Fixed a typo (#547) 2017-06-04 00:34:11 -04:00
Sam Carlberg
f43675e2bd Add functionality for getting the current network mode (#202)
Use bit flags to indicate a combination of network mode and status.
2017-06-02 17:25:20 -07:00
Sam Carlberg
417cf33f90 Expose ITable paths (#200)
Closes #196
2017-05-26 21:02:45 -07:00
Tyler Veness
b433d98c02 Replace std::stringstream with llvm::raw_svector_ostream (#345)
A few locations were changed to use std::ostringstream.
2017-05-15 23:10:40 -07:00
Thad House
7006672b06 Fixes hal shim from alias to using item (#538)
Fixes #536
2017-05-12 17:02:54 -07:00
Thad House
efec0c5cc3 Moves the HAL priority_ custom types to the hal namespace (#532)
There is a shim for backwards compatibility, just like the frc namespace.
As with the frc namespace, the library compiles without the shim.
2017-05-11 21:25:22 -07:00
Thad House
16e71eac43 Fixes assertions to not crash StringRef (#534)
We can't read [0] on an empty StringRef or the StringRef itself asserts
(this may crash in non-debug mode as an empty StringRef is not guaranteed to have a valid pointer).
Instead, we can just check if the StringRef is not empty.

Closes #502
2017-05-10 20:14:14 -07:00
Thad House
067b1f3ee0 Adds a way to get the native handle from SafeThread (#198)
Useful to wpilib to enable easier changing of RT priorities.
2017-05-09 22:04:57 -07:00
Thad House
3d2f41d081 Adds a way to get the native handle from SafeThread (#198)
Useful to wpilib to enable easier changing of RT priorities.
2017-05-09 22:04:57 -07:00
Thad House
68b62abb52 Adds chrono wrapper around fpga time (#527)
Useful for some of the scenarios in C++ where using the chrono wrappers
might be very helpful.
2017-05-09 20:29:29 -07:00
Thad House
b2f3479692 Switches SPI and I2C to use enums in the HAL for ports (#531)
Closes #397
2017-05-09 12:12:46 -07:00
Tyler Veness
67d62ba164 Travis now passes the current year to wpiformat (#438)
See also styleguide#41.
2017-05-08 21:56:35 -07:00
Thad House
e1fc60b8dd SolenoidBase functions are now static (#530)
Instance methods were kept around for backwards compat in Java. In C++,
the instance methods were changed to match Java. Also some cleanup to
the JNI layer to match updated variable types we missed.

Closes #416
2017-05-08 21:55:11 -07:00
sciencewhiz
f32e696fef Fix exception when getting a relay in kReverse Direction. Fixes #458 (#525)
Add additional tests that would have caught this previously.
2017-05-08 21:54:03 -07:00
Thad House
fc81298fac Switches DS to use Occur callback rather than internal netcomm semaphore (#510)
Allows us to control multithreaded access and spurious wakeups easier.
closes #509

Switches DS to use new waitForData functionality

Adds a few new functions
2017-05-08 20:21:47 -07:00
Thad House
5987cfeaaf Fix SPIs to not set CS DIO pins into DIO mode (#504)
HAL_GetPort both allocates the DIO and sets the DIO into DIO mode.  The DIO setting was overriding the SPI setting on the port, so SPI chip selects were broken if you had more than one.  Instead use CreatePortHandleForSPI, which is a special function that only allocates the DIO handle, but doesn't actually set the DIO into DIO mode.
2017-05-08 20:04:41 -07:00
Thad House
cd0ece4511 Removes the semaphore class (#529)
Its been deprecated, and its going to interfere with fixing #459
2017-05-08 19:42:28 -07:00
sciencewhiz
dc9f85ebb9 Fix comment refering to old _val enum values (#524) 2017-05-07 17:10:52 -07:00
sciencewhiz
35a2055cda Improve documentation for WaitCommand and TimedCommand. (#494) 2017-05-07 13:29:11 -07:00
Austin Shalit
a1066776a5 Make SmartDashboard methods static (#523) 2017-05-07 10:32:40 -07:00
Austin Shalit
4dae747343 Refactor RobotDrive squaring (#390) 2017-05-07 09:40:48 -07:00
Thad House
d348a5b947 Fixes WaitForInterrupt to return values matching enum (#503) 2017-05-07 09:07:14 -07:00
Austin Shalit
f0c413f40d Relay stores nt value in enum (#460) 2017-05-07 09:05:15 -07:00
Austin Shalit
846eee2f6c HashMap -> LinkedHashMap (#492) 2017-05-06 23:38:10 -07:00
Austin Shalit
0b9ff68da1 StartLiveWindowMode ITables use lambdas (#461) 2017-05-06 23:26:18 -07:00
Austin Shalit
7187e005d4 Add Checkstyle WhitespaceAfter check (#466) 2017-05-06 23:22:16 -07:00
Chris Gregory
a5cd24e7ea Reduce scope of for loop variables to for loop initializer (#517) 2017-05-06 23:15:34 -07:00
Jonathan Leitschuh
dbe821baee Change the wrapper to use the all distribution with the sources (#498) 2017-05-06 21:34:15 -07:00
Peter Johnson
04486c6472 CameraServer: Always update addresses when updating stream values. (#496)
This should prevent (as currently happens) occassionally getting just the
mDNS address in the stream value.
2017-05-06 21:31:45 -07:00
Austin Shalit
2ee8ba9361 SafePWM: Rename Feed to feed (#463)
Add a deprecated shim to avoid breaking any user code using Feed.
2017-05-06 21:31:02 -07:00
Thad House
b07782cd89 Removes StatusIsFatal checks from PDP (#493)
The exceptions were removed from Java because these fail more often then
not. Teams are noticing this in C++ as well. In addition for some reason
ClearErrors() is causing about 0.5 seconds of lag. That's another issue,
but this will match Java and solve that issue for users.
2017-05-06 21:29:32 -07:00
Austin Shalit
305450b6e4 Remove 'value' from PIDSourceType (#464) 2017-05-06 21:27:07 -07:00
Thad House
fdd0b853ed Fixes Base.h to work properly with MSVC 2015 and above (#513) 2017-05-06 21:23:33 -07:00
Dustin Spicuzza
49de28d3d0 Add overloads for property types except enum (#73)
- Fixes #70
2017-05-01 20:44:09 -07:00
Dustin Spicuzza
c34cf11769 MjpegServer: style fixes for root page (#72)
- Moves stream to the right of any settings
- When the page is too small, then the stream will move to the top of the settings
2017-04-30 08:49:21 -07:00
Austin Shalit
42facbb07e Make Java "struct" constructors public for testing/simulating (#195) 2017-04-30 08:48:02 -07:00
Joseph Jackson
9f97cd61bf Correct platform path for 32-bit Linux (#179)
Gradle needs to produce a platform path of "Linux/i386" when targeting a Linux 32-bit Intel platform. Otherwise, it doesn't match Java's os.name/os.arch when loading the ntcore library in NetworkTablesJNI.java. Windows uses "x86" but Linux uses "i386". (http://lopica.sourceforge.net/os.html)
2017-04-30 08:47:02 -07:00
Max Narvaez
1d025204e7 Fixed Spelling Mistakes in SmartDashboard.java (#506)
Fixed comment spelling.
2017-04-30 00:29:27 -07:00
Peter Johnson
59133a7d93 Use Javadoc formatting for Java comments. (#66) 2017-03-11 21:56:14 -08:00
Thad House
b484cbba7c Adds SinkFrameTimeoutCpp to def file (#61) 2017-02-17 20:41:32 -08:00
Peter Johnson
61e34621cc Add GetNextFrame timeout to CvSink and MjpegServer.
MjpegServer uses the timeout to generate keep-alives to any clients
(which helps detect disconnects and avoid stale client threads).

CvSink GrabFrame now defaults to a timeout, but the timeout can be
changed by the user, or the old no-timeout version is now available
as GrabFrameNoTimeout.
2017-02-17 02:06:46 -08:00
Peter Johnson
5e9575de66 Add missing CS_SetDefaultLogger in cscore-jni.def. 2017-02-17 02:06:46 -08:00
Tyler Veness
12f759860e Corrects assumptions about return values from i2c-lib (#484)
Fixes #478
2017-02-17 00:05:54 -08:00
Dustin Spicuzza
c02d34dbf3 Allow resetting the logger back to default (#55) 2017-02-16 22:12:16 -08:00
Peter Johnson
8f97637b71 Fix handling of HTTP cameras that do not provide a Content-Length. (#59)
ReadJpeg was not correctly parsing the SOS segment.
2017-02-16 22:11:54 -08:00
Peter Johnson
878d3a6f4f Publish video modes to webserver. (#58)
This puts a table of modes onto the main webpage and also adds them to
the JSON output.

Fixes #50.
2017-02-16 01:06:38 -08:00
Peter Johnson
ef25bbde75 Fix SetExposureAuto. (#57)
This is an enum value; setting 3 seems to be correct for USB cameras.

Fixes #56.
2017-02-15 16:25:43 -08:00
Austin Shalit
1bdbb5ddcc Remove usages of isEnable() (#483) 2017-02-14 01:16:36 -08:00
Paul Friederichsen
b573fb6555 Fix param order in RobotDrive docs (#481)
Fix Javadoc @param order in RobotDrive and fix order of params in C++ docs
2017-02-14 01:14:56 -08:00
Thad House
b50a7bdbee Fixes memory leak for SPI reads (#474)
Adds a stack allocation for most use cases.
2017-02-14 01:14:08 -08:00
Thad House
5a5f10dfc8 Fixes I2C read change size of pointer (#479)
Fixes #477
2017-02-10 15:21:59 -08:00
Dustin Spicuzza
8c3efa5926 Increment reference count when creating VideoSource object (#53) 2017-02-09 00:55:40 -08:00
Thad House
e6656326a8 Adds field IP to round robin list (#187)
With how many more coprocessors are being added, this is probably needed
to make the field crew sane.
2017-02-09 00:55:01 -08:00
Peter Johnson
e375b4a9ff CameraServer: auto-increment startAutomaticCapture(). (#468)
Also add GetServer() functions so the automatically created VideoSink can
be retrieved by user code if desired.
2017-01-20 01:07:37 -07:00
Thad House
ff141ab1ff Fixes exception on camera creation without plugged in camera (#470)
Would throw if the camera was disconnected. We handle this properly at
the JNI level to not have this crash the entire program, but the error
is still kind of annoying, and not really an error.
2017-01-20 01:02:27 -07:00
Thad House
cf8cab850b Fixes missing VideoProperty constructor. (#49) 2017-01-20 00:49:58 -07:00
Peter Johnson
b8537be219 CameraServer: Remove NT-driven settings. (#467)
Unfortunately, due to the way NT synchronization is currently performed,
this has unexpected and undesirable behavior: when a dashboard (or any other
NT client) is left running between code restarts, when it reconnects, any
code settings will be overwritten by the NT synchronization process.  As
fixing this will require a fairly major NT change (and likely a user-visible
one), it's not desirable to do at this point in the year.

Instead, disable NT driven settings entirely (e.g. make the NT interface
publish only).  To emphasize the read-only nature of the NT values, attempts
to change the NT values will be immediately overridden by CameraServer.

To better inform users about the actual property names (e.g. for use in their
code), the "raw_" settings no longer have "raw_" removed from their names
(they are still placed in the "RawProperty" subtable).

This change also contains a couple of Java fixes:

* Make getInstance() thread-safe

* Properly synchronize access to m_tables between multiple threads.

* Use Hashtable instead of HashMap.
2017-01-19 12:30:07 -07:00
Thad House
db5dfa1746 Adds sliders for all settable properties to the default webpage (#48)
When the page is loaded, if properties can be found they will
automatically be created on screen. They are currently not auto
updating. Raw values are currently disabled because of this.
2017-01-19 01:02:37 -07:00
Peter Johnson
13457d1bf4 Update setUpdateRate() documentation to match implementation.
Update rates as fast as 10 ms are now allowed.

Fixes #184.
2017-01-18 21:32:15 -08:00
Austin Shalit
8f1b034b2f Fix typo in JavaDoc (#462) 2017-01-16 22:57:28 -07:00
Thad House
71d0a07e0a Fixes solenoid allocation error message (#455)
The error was NO_AVAILABLE_RESOURCES, which is not the proper error to
return. Instead,  just return the error directly from the allocation.
2017-01-14 23:59:05 -07:00
sciencewhiz
d322342494 Remove comments about Blue DS (#450)
It's unlikely that anyone is still using the Blue Kwikbyte DS from 2009,
and the reference is confusing to people who weren't around then.
2017-01-14 23:52:48 -07:00
Peter Johnson
8f8c4d3d95 HttpUtil: Allow "http" scheme to be mixed case. 2017-01-10 00:15:39 -08:00
Thad House
d47bd1ecbc Fixes embedded library name used for extraction in Java (#45) 2017-01-09 20:49:02 -08:00
Thad House
e9fcb5381a Fixes Java artifact clasifiers when using custom suffix (#44) 2017-01-05 14:14:42 -08:00
Thad House
3e2631f49b Fixes Java artifact clasifiers when using custom suffix (#183) 2017-01-05 14:13:57 -08:00
Peter Johnson
bc7ab17692 CameraServer updates (#446)
* CameraServer: Add properties and video mode NT interchange.

* Automatically serve Axis cameras so they're accessible via USB.
2017-01-05 02:51:55 -08:00
Peter Johnson
3c3236c5d5 Fix video mode notifications. 2017-01-05 01:42:19 -08:00
Tyler Veness
7a049c29bd Added a conditional command that chooses 1 of 2 commands (#435)
Tests and documentation for ConditionalCommand were also added. This is a fixed version of #9, so it doesn't support lambdas.

Closes #9
2017-01-04 23:48:13 -08:00
Thad House
23462ec7df Adds way to force publishing version from command line (#43)
In case we need to do a recreation of an artifact for some reason, this
makes it possible.
2017-01-04 22:16:17 -08:00
Thad House
ac56b0a33e Adds way to force publishing version from command line (#182)
In case we need to do a recreation of an artifact for some reason, this
makes it possible.
2017-01-04 22:15:23 -08:00
Thad House
1fc375b31a Updates the gradle wrapper to version 3.3 (#445) 2017-01-04 22:08:48 -08:00
Austin Shalit
eee7f3991c Allow VisionRunner to stop (#442) 2017-01-04 19:41:07 -08:00
Thad House
b55c604c0a Updates Gradle to 3.3, and removes the Visual Studio 2015 workaround (#41) 2017-01-04 19:40:44 -08:00
Thad House
a72f8f3bcd Add new ARM Toolchain, add toolchainpath to README (#42)
Matches ntcore #165
2017-01-04 19:40:28 -08:00
Thad House
2e3503517d Add OS level serial port (#426) 2017-01-04 19:38:17 -08:00
Thad House
27c0405fc9 Reruns gradle wrapper to fully generate 3.3 files (#181) 2017-01-04 19:08:33 -08:00
Thad House
b9e80ecfdc Updates to gradle 3.3, and removes Visual Studio 2015 workaround (#180) 2017-01-04 17:37:02 -08:00
Thad House
a3adb38bef Adds support for specifying output suffix of arm packages. (#34)
Currently if using a separate compiler prefix, it would get published to
the arm classifier. This modifies so the output suffix can now be
specified (e.g. "hf" for armhf).
2017-01-04 01:38:37 -08:00
Peter Johnson
593ba37c43 Java VideoEvent: Make propertyHandle public. 2017-01-04 01:16:10 -08:00
Peter Johnson
4ed78a84ef Java VideoMode: Provide PixelFormat-taking constructor. 2017-01-04 01:16:10 -08:00
Thad House
e893662c0a Adds new functions to def file (#40) 2017-01-03 19:52:26 -08:00
Austin Shalit
15e58acc76 Java SendableChooser no longer sets a default on addObject (#441) 2017-01-03 19:13:45 -08:00
Thad House
5df78c520c Adds support for building separate armhf artifacts (#177)
Currently if using a separate compiler prefix, it would still get published
to the arm classifier. This modifies so a classifier suffix can be used to
disambiguate arm from armhf.
2017-01-03 19:12:47 -08:00
Thad House
f13f886886 Fixes arm example builds on windows (#39) 2017-01-03 19:10:21 -08:00
Thad House
5dd8e4dc7f Adds defs for the C windows functions, and shims the 5 missing ones (#38) 2017-01-03 19:09:11 -08:00
Austin Shalit
5aa5e3e09e SendableChooser generic value (#433)
* Java SendableChooser now decorates with type (non-breaking change)

* C++ SendableChooser now is templated on the type instead of using void* and stores values (breaking change)

* C++ SendableChooser now uses llvm::StringMap instead of std::map
2017-01-03 14:40:31 -08:00
Peter Johnson
883fd5b062 For property events, provide property name rather than source name.
This is much more useful.
2017-01-02 23:17:00 -08:00
Peter Johnson
7ddbf20108 Create VideoCamera base class and move camera settings functions to it.
This makes them available for both UsbCamera and HttpCamera / AxisCamera.

To avoid virtual functions in the public-facing interface, move the
implementation of the camera settings functions to the core library.
2017-01-02 23:17:00 -08:00
Peter Johnson
23135d7a5a Allow Sink.SetSource() to be given an empty source.
In Java, allow source to be null (pointers are not used in C++, so
this isn't necessary).
2017-01-02 23:17:00 -08:00
Thad House
b91ab0b44f Gets builds working on Windows (VS 2015) (#37)
Def files will be updated after the latest PR with new definitions gets
added.
2017-01-02 23:16:35 -08:00
Thad House
9a2ec13ba4 Fixes SetIntArrayRegion template for windows builds (#178) 2017-01-02 22:29:56 -08:00
Thad House
78995f5cca Fixes SetIntArrayRegion template for windows builds (#178) 2017-01-02 22:29:56 -08:00
Thad House
f225c4773a Fixes gradle publish with no flags. (#35) 2017-01-02 17:23:11 -08:00
Tyler Veness
25ae7b2c2b Upgraded Doxygen gradle plugin to 0.3 (#440) 2017-01-02 10:03:37 -08:00
Tyler Veness
4b6dc9583a Corrected order of access specifiers in MockCommand class (#436) 2017-01-02 00:44:35 -08:00
Thad House
64eab1f7b3 Fixes missing Extern "C" from HAL Threads (#437)
Also fixes incorrect return value during set
2017-01-02 00:43:12 -08:00
Fred Silberberg
bac4b3d5cb Fixed gradle publish with no flags. (#176) 2017-01-01 00:13:00 -08:00
Thad House
182f57216f Adds project and classpath ignores (#425)
VsCode now supports Java, but it creates these files, and there is no
way to turn it off. Will be adding this to a few other repos too.
2017-01-01 00:08:13 -08:00
Tyler Veness
65b091a39a Call SmartDashboard::init() in RobotBase constructor. (#428)
Fixes #427
2017-01-01 00:07:22 -08:00
Austin Shalit
ed1a94531a Update license headers to 2017 (#434) 2017-01-01 00:05:57 -08:00
Peter Johnson
e3f99a4a22 JStringRef: ensure string is null terminated so c_str() works correctly. 2016-12-26 14:13:15 -08:00
Peter Johnson
df7d3261c9 JStringRef: ensure string is null terminated so c_str() works correctly. 2016-12-26 14:13:15 -08:00
Peter Johnson
95ad4783f1 Revert "Fixes TCPAcceptor able to use an empty string (#172)"
This doesn't actually do anything since the outer if statement checks
for empty m_address already.

This reverts commit 6ad9f45d9a.
2016-12-26 13:55:21 -08:00
Peter Johnson
b5b0899226 Revert "Fixes TCPAcceptor able to use an empty string (#172)"
This doesn't actually do anything since the outer if statement checks
for empty m_address already.

This reverts commit 6ad9f45d9a.
2016-12-26 13:55:21 -08:00
Thad House
9a0a1baa6b Fixes TCPAcceptor able to use an empty string (#172) 2016-12-26 12:27:08 -08:00
Thad House
6ad9f45d9a Fixes TCPAcceptor able to use an empty string (#172) 2016-12-26 12:27:08 -08:00
Fred Silberberg
4e12ffb0ae Update the wpilib version plugin (#423) 2016-12-25 23:01:03 -08:00
Fred Silberberg
7ec223d445 Update WPILib Version Plugin (#33) 2016-12-25 22:13:00 -08:00
Fred Silberberg
ed9e837229 Updates the wpilib version plugin (#171) 2016-12-25 22:11:54 -08:00
Fred Silberberg
b9a08e8260 Fixed entry comment (#169) 2016-12-25 22:11:14 -08:00
Peter Johnson
58931e1d30 Be even more permissive on valid JPEG formats. 2016-12-25 01:45:35 -08:00
Peter Johnson
976ca80056 Use InetNtop on Win32 rather than WSAAddressToString. (#170)
Similarly, use InetPton rather than WSAStringToAddress.

The WSAAddressToString function is intended to provide a user-readable
string and thus includes the port number.  This breaks some use cases
on Windows which expect to get just the IP address.

Note: The InetPton and InetNtop functions are available only in Vista or above.
2016-12-25 01:30:12 -08:00
Peter Johnson
95e5295666 Use InetNtop on Win32 rather than WSAAddressToString. (#170)
Similarly, use InetPton rather than WSAStringToAddress.

The WSAAddressToString function is intended to provide a user-readable
string and thus includes the port number.  This breaks some use cases
on Windows which expect to get just the IP address.

Note: The InetPton and InetNtop functions are available only in Vista or above.
2016-12-25 01:30:12 -08:00
Peter Johnson
4800c201e4 Add Axis camera creation functions and Http camera NT publishing. (#420) 2016-12-24 21:05:08 -06:00
Thad House
dc9a9e5d96 Fixes typo in SensorBase error message (#422) 2016-12-24 21:04:32 -06:00
Peter Johnson
4b16999fbc Fix tests that are only built on cmake. (#168)
Fixes #167.
2016-12-24 01:58:12 -06:00
Peter Johnson
318d23ba1c Add AxisCamera wrapper class.
This takes hosts (IP or DNS name) rather than URLs, making it easier
to use.

Also add more overloads to resolve ambiguities encountered when using
std::string and const char*, and also add overloads for
std::initializer_list<T> so braced initializer lists can be used.
2016-12-23 22:26:27 -08:00
Peter Johnson
9c4c7c08bf Java HttpCamera: Make accessor functions public. 2016-12-23 22:26:27 -08:00
Peter Johnson
9016a9e8b8 Start implementing HttpCamera.
This is a work in progress that does not yet support camera settings.
2016-12-23 22:26:27 -08:00
Peter Johnson
4c8c41fdc0 CvSink: Support grayscale images.
Also support 4-channel BGRx images and provide better error reporting
on bad images passed to PutFrame.
2016-12-23 22:25:11 -08:00
Peter Johnson
205d3b1d04 Some cameras don't provide the JFIF header, so don't require it.
This fixes DHT not being inserted on some images.
2016-12-23 22:21:11 -08:00
Peter Johnson
1575fff07a MjpegServer: Limit the number of simultaneous clients to 10.
This prevents client issues from swamping the network.
2016-12-23 22:01:35 -08:00
Peter Johnson
8c7338f2ba TCPAcceptor: Include port number in error messages. (#166) 2016-12-23 20:36:45 -06:00
Peter Johnson
459cc65b3f TCPAcceptor: Include port number in error messages. (#166) 2016-12-23 20:36:45 -06:00
Thad House
6844f05c3d Adds SetAllSolenoids function to CTRE PCM code (#419)
Closes #417.
2016-12-23 14:35:45 -06:00
Austin Shalit
8f67f2c24c Remove unused code and add pmd check (#395) 2016-12-23 13:20:13 -06:00
Thad House
cc246bb9ac Switches JNI to use new jni_util methods (#404)
* Uses WPIUtil string objects in JNI

* Switches JNI to use new jni_util classes
2016-12-23 13:13:17 -06:00
Peter Johnson
3d28275675 UsbCamera: Simplify the message passing implementation. 2016-12-23 10:58:11 -08:00
Sam Carlberg
bf9f0a9e6d Add vision pipeline API to make it easier to run OpenCV pipelines (#388) 2016-12-23 10:48:56 -06:00
Peter Johnson
6f41b3cde7 UsbCamera: Implement LifeCam HD-3000 exposure quirk.
On Linux, the V4L exposure setting is logarithmic and only accepts
certain exact values.
2016-12-22 23:44:40 -08:00
Peter Johnson
9ffc09a11b Fix settings example if there's no "--" in arg list. 2016-12-22 22:50:07 -08:00
Peter Johnson
ced2608afd Move ExtCtrlIoctl to UsbCameraProperty::DeviceQuery. 2016-12-22 22:44:46 -08:00
Peter Johnson
adbca532c0 Break up UsbCameraImpl::DeviceProcessCommands(). 2016-12-22 22:36:07 -08:00
Peter Johnson
5e38d8f28a Refactor UsbCameraProperty. 2016-12-22 22:11:54 -08:00
Peter Johnson
d6ef2c04a5 Start refactoring source property implementations. 2016-12-22 21:19:50 -08:00
Peter Johnson
ce69783871 UsbCamera: Scale some properties to make them constently percentages.
The "raw" version of these properties are still available, just prefixed
with "raw_".
2016-12-22 20:51:04 -08:00
Austin Shalit
c3160bad44 Update SendableChooser to use HashMap (#394) 2016-12-22 15:56:23 -08:00
Thad House
94b8ac42ca Adds CPP version of vision pipeline (#399) 2016-12-21 23:58:42 -06:00
Thad House
a03e3d7eb9 Fixes HAL to build without all headers included in HAL.h (#418) 2016-12-21 23:55:31 -06:00
Jaci R
a42ec08d16 Fix RoboRIO Cross-Toolchain GCC Status (#405)
* Dedicated RoboRIO Toolchain, allow Toolchain Path to change

* Add cCompiler Tool to correctly discover RoboRIO GCC on Mac

* Add @333fred requests for GString and ToolChainPath

* Add Toolchain Path option to README
2016-12-21 19:56:28 -08:00
Thad House
fddb6cd9d8 Fixes SPI Accumulator averages (#415) 2016-12-21 20:17:53 -06:00
Peter Johnson
10b13da3da Refactor USB vendor/product to product string to UsbUtil.h.
Also implement reading of /var/lib/usbutils/usb.ids for systems that
have it (e.g. desktop Linux).
2016-12-21 10:56:40 -08:00
Peter Johnson
88afefe464 Avoid crash in SourceImpl constructor.
The Frame constructor calls back into SourceImpl (the passed this reference),
and when in-place constructed in the SourceImpl constructor, SourceImpl
is only partially constructed.
2016-12-21 10:56:40 -08:00
Thad House
841f016017 Fixes SerialHelper when used with OS serial ports. (#411)
Also makes the SerialHelper API public so it can be used externally.
2016-12-21 00:16:05 -06:00
Thad House
8e4afc95c7 Switches C++ strings to StringRef (#336) 2016-12-21 00:08:24 -06:00
Peter Johnson
80abf6bf24 Support per-stream resolution settings.
The code now automatically resizes as required.

This change also disconnects camera resolution settings from MJPEG
stream connections; setting the camera resolution can now only be done
via code.
2016-12-20 20:48:31 -08:00
Jaci R
94359709a1 Add new ARM Toolchain, add toolchainpath to README (#165) 2016-12-19 23:16:39 -06:00
Tyler Veness
8cec948699 Fix typos (#409) 2016-12-19 22:06:39 -06:00
Tyler Veness
31ae7c942c Fixed signatures of deleted assignment operators (#408)
While it technically doesn't matter what the return type of the assignment operator is since it's deleted, assignment operators should return a reference instead of a value.
2016-12-19 11:24:23 -08:00
Tyler Veness
d0900626da Removed format.py shim (#393)
Now that our formatter is a Python package (wpiformat), the format.py shim for invoking it is no longer necessary. styleguide#29 should be merged before this patch.
2016-12-18 19:46:20 -08:00
Peter Johnson
0ee4cadca0 CameraServer: Workaround LabVIEW dashboard OpenCV compatibility. (#406)
The current LabVIEW dashboard (Beta 4) requires the source type to be either
"usb:" or "ip:" and does not support "cv:".  To work around this, use a source
type of "usb:" for OpenCV sources as well.

Workaround for #407.
2016-12-18 13:36:44 -08:00
Peter Johnson
8501b7c9e2 CvSourceImpl::CreateProperty(): Use lock_guard instead of unique_lock. 2016-12-18 09:13:52 -08:00
Peter Johnson
0ce0855a6f Java: check for null and use new jni_util features. 2016-12-18 09:13:51 -08:00
Peter Johnson
e1dabbc2d5 cscore_cpp.cpp: Fix include order. 2016-12-18 09:13:01 -08:00
Peter Johnson
c08a489e27 Improve error message for VIDIOC_STREAMON "no space left on device". 2016-12-18 09:13:01 -08:00
Peter Johnson
28a2ba4bf8 Add external logger interface. 2016-12-18 09:13:01 -08:00
Peter Johnson
2b8b8e7403 Improve logging consistency by using source/sink name throughout. 2016-12-18 09:12:59 -08:00
Peter Johnson
bdaf60b2d6 Replace tabs with spaces in gradle files. 2016-12-18 09:05:03 -08:00
Peter Johnson
7c2f994a66 Refactor source IsConnected() and connected notification. 2016-12-18 09:05:03 -08:00
Thad House
24b5a9c389 Adds UsageReporting include when using the LabVIEW shim (#401) 2016-12-16 22:42:45 -08:00
Peter Johnson
bb9f5b7491 jni_util: Add JException wrapper class.
This allows more natural C++ Throw semantics (for a variety of string
data types) for any java exception that just takes a String argument.
2016-12-15 21:54:36 -08:00
Peter Johnson
c091d74de4 jni_util: Add JException wrapper class.
This allows more natural C++ Throw semantics (for a variety of string
data types) for any java exception that just takes a String argument.
2016-12-15 21:54:36 -08:00
Austin Shalit
626220e9f3 Fix javadoc typo (#403) 2016-12-15 19:46:42 -08:00
Peter Johnson
19be09c361 Add null checks on all JNI object parameters. 2016-12-15 00:27:32 -08:00
Peter Johnson
57d053a8fb jni_util: Make JStringRef and JArrayRef null-safe.
They return empty string and empty array (to avoid crashes) but also
report an error with backtrace to stderr when called in that manner.
2016-12-14 23:59:06 -08:00
Peter Johnson
8c2a148ed1 jni_util: Make JStringRef and JArrayRef null-safe.
They return empty string and empty array (to avoid crashes) but also
report an error with backtrace to stderr when called in that manner.
2016-12-14 23:59:06 -08:00
Peter Johnson
0e43765c53 jni_util: Add GetJavaStackTrace. 2016-12-14 23:59:02 -08:00
Peter Johnson
6fbaf57b99 jni_util: Add GetJavaStackTrace. 2016-12-14 23:59:02 -08:00
Peter Johnson
12aee3e022 Make JLocal and JArrayRef movable but non-copyable. 2016-12-14 23:29:23 -08:00
Peter Johnson
2df00647d5 Make JLocal and JArrayRef movable but non-copyable. 2016-12-14 23:29:23 -08:00
Peter Johnson
498a8e2b7d Fix JArrayRef DirectBuffer destructor.
Previously it would try to release array elements even if the DirectBuffer
constructor was used.
2016-12-14 23:29:23 -08:00
Peter Johnson
99395273c7 Fix JArrayRef DirectBuffer destructor.
Previously it would try to release array elements even if the DirectBuffer
constructor was used.
2016-12-14 23:29:23 -08:00
Peter Johnson
4568156bdf Make JClass more useful and use it in ntcore JNI. 2016-12-14 23:29:18 -08:00
Peter Johnson
ce7611562f Make JClass more useful and use it in ntcore JNI. 2016-12-14 23:29:18 -08:00
Thad House
323d68d460 Fixes multiple initialization of HAL_BaseInitialize (#400) 2016-12-13 12:31:44 -08:00
Thad House
db2091dd94 Adds safe serial port write methods (#396)
The old method had a fairly large risk of undefined behavior, and the way the docs
were written could cause users to get confused.
Deprecate the old method and add StringRef method as preferred approach.
2016-12-10 22:40:44 -08:00
Thad House
8216d85e52 Adds check for PWM overallocation (#392) 2016-12-09 21:23:54 -08:00
Austin Shalit
a705eb1c61 Add PMD and solve issues (#389) 2016-12-07 21:24:44 -08:00
Thad House
77f664a6b1 Fixes simulator HAL builds (#391) 2016-12-06 19:56:31 -08:00
Austin Shalit
c30057e923 Remove unused imports (#387) 2016-12-05 21:36:52 -08:00
Peter Johnson
81fd0eefac usbcvstream example: Print error from GrabFrame. 2016-12-04 21:45:37 -08:00
Peter Johnson
b5fd15e052 CvSink::GrabFrame(): Add delays like MjpegServer to avoid consuming CPU. 2016-12-04 21:45:37 -08:00
Peter Johnson
ecfc684174 MjpegServer: Increase bad frame wait from 10 to 20 ms. 2016-12-04 21:45:37 -08:00
Peter Johnson
4600ea135c Frame: Make Data struct public. 2016-12-04 21:45:37 -08:00
Peter Johnson
3b82ba8945 Refactor JPEG functions to JpegUtil. 2016-12-04 21:45:37 -08:00
Peter Johnson
c32fc57ce1 Refactor HTTP utilities. 2016-12-04 21:45:37 -08:00
Peter Johnson
9a8f66e3e5 SourceImpl: Add no-copy PutFrame. 2016-12-04 21:45:37 -08:00
Peter Johnson
ef39713219 Revert "Don't output \r\n before boundary. This throws off some clients."
This reverts commit ae8c8ec230.
2016-12-04 21:45:37 -08:00
Thad House
da68fea081 Fixes shared wpiutil switch on athena (#24) 2016-12-04 21:44:06 -08:00
Peter Johnson
06108b9479 Update CameraServer support. (#386)
* Follow MixedCase rename.

* Add GetVideo function to get cameras by name.
2016-12-04 00:26:08 -08:00
Peter Johnson
1f93a4ab4f Change acronym class names to use MixedCase (UsbCamera, MjpegServer). (#22) 2016-12-04 00:08:47 -08:00
Thad House
7a587390ba Fixes OpenCV on windows when we get to it. (#23) 2016-12-04 00:08:26 -08:00
sciencewhiz
16181523c9 Put language in version string (#377) 2016-12-02 20:36:22 -08:00
Jacob Caporuscio
7e0706cf83 Updated Usage Reporting for 2017 v8 Image (#385) 2016-12-02 18:16:49 -08:00
Thad House
bff67887fd Adds capabilities to support certain HAL functionality from LabVIEW (#382)
They can only include HAL/LV/HAL.h, HAL/cpp/*.h, and HAL/handles/*.h.
Nothing else will work properly.
2016-12-02 00:32:01 -08:00
Thad House
351ff5eb48 Adds new Threads API for priority setting while using std::thread (#379)
Also adds Java API for doing the same to Java threads (standard Java Thread.setPriority only works
when Java is run as root, even if the process has the right privileges).
2016-12-01 21:06:19 -08:00
Thad House
378a145cf7 Fixes Missed Symbol from Def file (#162) 2016-12-01 13:45:39 -08:00
Thad House
3625f11e08 Adds C methods that take a cv::Mat* (#21)
Some implementations of OpenCV use cv::Mat as their native pointer
rather then CvMat, so we need to support both in the C interface
2016-11-30 22:00:44 -08:00
Thad House
051df14046 Updates ni patch task to automatically switch all files to LF (#381)
Still requires manual intervention to make files not readonly, but
that's easier.
2016-11-29 20:20:49 -08:00
Thad House
ee0318f697 Updates NI Libraries to image 8 (#380) 2016-11-29 19:56:30 -08:00
Thad House
1332ba3ad2 Adds JNI symbol check to ensure we don't miss any definitions (#19) 2016-11-27 23:17:26 -08:00
Peter Johnson
558b2ffa41 NetworkStream: Add setBlocking() and getNativeHandle(). (#161)
Also add checking for "would block" errors in send() and receive().

Check for set nonblocking failures in TCPConnector as well (generate warnings rather than errors)
2016-11-27 19:59:52 -08:00
Peter Johnson
1315a3967d NetworkStream: Add setBlocking() and getNativeHandle(). (#161)
Also add checking for "would block" errors in send() and receive().

Check for set nonblocking failures in TCPConnector as well (generate warnings rather than errors)
2016-11-27 19:59:52 -08:00
Thad House
a6fb1efcbe Switches internal joystick errors to take StringRef (#378)
Previously this would have allocated the std::string every time, even if
the message wasn't printed. Now takes a StringRef, and only converts to
std::string when the message actually gets printed.
2016-11-26 21:22:39 -08:00
sciencewhiz
31fecc28a4 Check for NaN motor speed. Fixes artf5467. (#376) 2016-11-26 21:04:40 -08:00
Austin Schuh
00b76d42e0 Fixed unused variable warning from gcc. (#159)
This makes it so that ntcore builds with -Wextra -Werror
2016-11-26 16:28:50 -08:00
Austin Schuh
e7c4150c02 Fixed unused variable warning from gcc. (#159)
This makes it so that ntcore builds with -Wextra -Werror
2016-11-26 16:28:50 -08:00
Thad House
bc06c843c7 Adds JNI symbol check to ensure we don't miss any definitions (#160) 2016-11-25 17:07:58 -08:00
Thad House
30b1efc354 Adds check to ensure all JNI symbols have been defined properly (#373) 2016-11-25 17:07:36 -08:00
Thad House
7d721eb569 Fixes memory leak in SerialHelper VISA (#366) 2016-11-25 15:52:21 -08:00
Peter Johnson
b8e9439d32 Message: Fix typo in error message. (#158) 2016-11-24 23:50:02 -08:00
Fred Silberberg
d48aac5beb Gradle Update (#372)
This does a major cleanup on our gradle files, primarily converting all instances of manual dependency downloading to use the correct configuration-based method, which has the advantage of being both less code and more safe.
2016-11-24 23:44:35 -08:00
Fred Silberberg
14b56db99e Gradle 3.2.1 (#369)
Updated to gradle 3.2.1. This also moves all of the task graph listeners for dependency setup to use the gradle model, making it both safer and reducing line count.
2016-11-24 22:15:54 -08:00
Thad House
bfe429de51 Switches handles back to std::array (#367)
The binary size is being increased much less then when we originally
tried this. Using static arrays save a pointer indirection and will help
with cache in real time cases.
2016-11-24 21:55:20 -08:00
Thad House
57ef5cfd07 Splits out SerialHelper to allow using OS or VISA resources (#365)
Also removes regex and uses simple splits instead
2016-11-24 21:53:04 -08:00
Fred Silberberg
4bbb7c0bcc Fixed javadoc generation to actually download cscore and ntcore and include the source in its output. (#368) 2016-11-24 21:51:01 -08:00
Thad House
4de70bff5e Adds missing JNI method definitions (#371) 2016-11-24 21:49:34 -08:00
Peter Johnson
687f0c7dc0 Use const parameters in std::sort lambda. (#364)
This is more correct, and non-const fails on gcc 4.8.
2016-11-22 22:30:58 -08:00
Thad House
f3d66e92ec Searches for USB serial devices to get the correct VISA object (#363)
Fix was made in LabVIEW, and this matches what was done there.
2016-11-22 21:51:47 -08:00
Fred Silberberg
046d385a78 Actually fix lack of - (#157) 2016-11-20 21:42:17 -08:00
Fred Silberberg
5caf75237b Fixed version generation when no - is present (#156) 2016-11-20 21:32:32 -08:00
Thad House
9a91ae54d6 Fixes incorrectly changed Java enums (#360)
Some enums need a specific value when they get passed to JNI
2016-11-20 20:32:52 -08:00
Tyler Veness
69422dc063 Replaced floats with doubles (#355)
This makes our APIs more consistent. With optimizations enabled, doubles are just as efficient as floats on ARMv7, so we should take advantage of the extra precision.
2016-11-20 07:25:03 -08:00
Dustin Spicuzza
7bcd243ec3 Reorder the HAL handle types (#357) 2016-11-20 00:01:24 -08:00
Thad House
8f70bea899 Fixes Athena Runtime build not including ntcore (#356) 2016-11-19 23:58:29 -08:00
Thad House
948c4275ad Fixes the wpilibj jar not getting updated during every build (#359) 2016-11-19 23:52:19 -08:00
Peter Johnson
03a1159915 Java CameraServer: Fix type cast exception. (#358)
Also fixes an unchecked warning.
2016-11-19 22:45:45 -08:00
Thad House
a19b1b9341 Adds data accessor functions to JNI (#18) 2016-11-19 19:02:20 -08:00
Tyler Veness
1c8fb298b4 Ran formatter (#354) 2016-11-19 00:39:32 -08:00
Tyler Veness
b25a7cb370 Command::IsFinished() must be overriden by subclasses again (#353)
Documentation was added for InstantCommand and TimedCommand.
2016-11-19 00:26:22 -08:00
Tyler Veness
140c365e4b Added XboxController class (#140)
Joystick and Gamepad functionality was separated into cleaner interfaces.
2016-11-18 23:05:37 -08:00
Peter Johnson
8c93ceb728 Add cscore-based CameraServer. (#352)
Not fully functional yet, but implements basic functionality required for LabView dashboard interoperability.
2016-11-18 22:30:22 -08:00
Peter Johnson
0b1e876dcf Bump wpiutil version to 1.0.2. 2016-11-18 22:25:38 -08:00
Thad House
ac50d7cf8a Removes NiVision from allwpilib (#305) 2016-11-18 20:04:21 -08:00
Peter Johnson
ae8c8ec230 Don't output \r\n before boundary. This throws off some clients. 2016-11-18 19:52:22 -08:00
Thad House
ecb873ff45 Fixes myRobotJava zipping before Java gets built (#351) 2016-11-18 19:44:13 -08:00
Peter Johnson
ec8c0eb3c2 Fix FPS setting and crash in reapplying settings. 2016-11-18 19:23:35 -08:00
Peter Johnson
3d898dd8f7 MJPEGServer: Fix URI %xx-decoding. 2016-11-18 19:03:35 -08:00
Peter Johnson
df18e178ee MJPEGServer: Provide a bare-bones HTML root page. 2016-11-18 18:58:03 -08:00
Peter Johnson
71a6e08988 MJPEGServer: Make a couple of tweaks for Axis camera compatibility. 2016-11-18 18:33:49 -08:00
Peter Johnson
a05636d9a6 Add data accessors for USBCamera and MJPEGServer.
USBCamera: getPath()

MJPEGServer: getListenAddress() and getPort()
2016-11-18 17:21:03 -08:00
Peter Johnson
5eecbfd9bf Implement immediate notify on network interfaces event. 2016-11-18 16:27:26 -08:00
Thad House
78baa04ecc Adds OpenCV to myRobotJava (#350) 2016-11-18 16:20:30 -08:00
Peter Johnson
65514b3028 USBCamera: Update description on reconnect. 2016-11-18 16:16:04 -08:00
Peter Johnson
881d55f858 VideoListener: Add move assignment operator. 2016-11-18 15:10:37 -08:00
Krypton Cougars
b78f580d47 Adds default methods for Commands (#238) (#238)
Closes #235
2016-11-18 14:42:40 -08:00
Peter Johnson
cc20d9d0fe Add no-parameter constructors for specific sources/sinks. 2016-11-18 14:33:47 -08:00
Thad House
b115c75226 Adds SPI DIO to WPILib (#256) 2016-11-18 14:15:53 -08:00
Thad House
6bc092f3ae Updates SPI device pin (#348) 2016-11-18 14:14:51 -08:00
Thad House
f99a266ce4 Adds CsCore dependency to myRobotCpp (#349) 2016-11-18 14:14:11 -08:00
Peter Johnson
35aa544415 VideoEvent: Make sourceHandle and sinkHandle public. 2016-11-18 13:20:50 -08:00
Peter Johnson
bad4ca4666 Add event for network interfaces change. 2016-11-18 12:41:08 -08:00
Peter Johnson
5fecc57e8a Add methods to get the hostname and network interfaces. 2016-11-18 12:41:08 -08:00
Peter Johnson
e1f4e3d2d7 Fix mapping into Java enums.
The values are bitmask not contiguous, so we need to use a switch instead
of an array.
2016-11-18 12:41:08 -08:00
Peter Johnson
5ace9e4189 Renumber event kind values. 2016-11-18 12:41:08 -08:00
Peter Johnson
9945459a41 Notify sink enable and disable events. 2016-11-18 12:41:08 -08:00
Peter Johnson
22c11fad36 Notify source property events. 2016-11-18 12:41:08 -08:00
Peter Johnson
c6b527d452 Notify source connect, disconnect, and video mode changes. 2016-11-18 12:41:08 -08:00
Peter Johnson
8e9911d330 Notify on sink source change. 2016-11-18 12:41:08 -08:00
Peter Johnson
b245725941 Notify on source and sink create and destroy. 2016-11-18 12:41:08 -08:00
Peter Johnson
154ae5dcbf Notifier: Take Impl rather than handle in notification functions.
Also take CS_EventKind rather than RawEvent::Kind.

Still provide the handle methods for the basic events (this is particularly
useful for create and destroy events).

This makes these functions easier to use from within the implementation.
2016-11-18 12:41:08 -08:00
Peter Johnson
bae2037086 Handle: Add methods to get Data struct from Impl pointer.
Also make a number of methods in UnlimitedHandleResource inline.
2016-11-18 12:41:08 -08:00
Peter Johnson
c0bc8d7028 Change examples to start at port 8081 rather than 8080.
Port 8080 is too commonly used for other purposes.
2016-11-18 12:41:08 -08:00
Peter Johnson
736b5ff424 Java: throw VideoException on error. 2016-11-18 12:41:08 -08:00
Peter Johnson
29cd2b11be enum_usb example: output the property type. 2016-11-18 12:41:08 -08:00
Peter Johnson
dcf773c3ef Add USBCamera setting functions similar to the old WPILib nivision ones. 2016-11-18 12:41:08 -08:00
Peter Johnson
791cabbc26 Rename Type to Kind. 2016-11-18 12:41:08 -08:00
Peter Johnson
3c7d8063f6 VideoProperty: rename type() to getType(). 2016-11-18 12:41:08 -08:00
Peter Johnson
3381340eb5 Add method to get source/sink type.
Also provide convenience method to enumerate all sinks connected to a source.
2016-11-18 12:41:08 -08:00
Peter Johnson
6446b9ef10 Add sink source changed event. 2016-11-18 12:41:08 -08:00
Peter Johnson
6c19eb59b2 VideoSource, VideoSink: Provide equality operation.
* Provide hashCode implementation for Java.

* Provide getHandle for both C++ and Java.
2016-11-18 12:41:08 -08:00
Peter Johnson
797d049f31 Use java.util.function.Consumer for event listener. 2016-11-18 12:41:08 -08:00
Peter Johnson
0bcafedebf MJPEGServerImpl: Refactor NeedsDHT. 2016-11-18 12:40:31 -08:00
Peter Johnson
7e0e8286eb SourceImpl: Refactor frame allocation into AllocFrame. 2016-11-18 12:40:31 -08:00
Peter Johnson
5ae1162378 Move MJPEG DHT insertion from SourceImpl to MJPEGServerImpl.
OpenCV imdecode supports images with no DHT, so it's not necessary to
add it on the source side.
2016-11-18 12:40:31 -08:00
Peter Johnson
c80c4ae55c MJPEGServer: Use worker thread model.
Also make the worker thread a class for future per-client configuration use.

Depends on wpiutil #153.
2016-11-18 12:40:31 -08:00
Peter Johnson
254b88bdbe Start adding support for non-MJPEG frame types.
Not yet supported by MJPEGServer.
2016-11-18 12:40:31 -08:00
Thad House
2657d89178 Adds a c_str method to StringRef (#155)
The StringRef class does not ensure the string is null terminated. As there is
no defined way to actually check for a null terminator, we determine
if it is null terminated based on the constructor type. Then if on c_str
it is not known to be null terminated, we use a passed in buffer to copy
the string and ensure null termination.
2016-11-14 22:51:52 -08:00
Thad House
38ec59f03a Adds a c_str method to StringRef (#155)
The StringRef class does not ensure the string is null terminated. As there is
no defined way to actually check for a null terminator, we determine
if it is null terminated based on the constructor type. Then if on c_str
it is not known to be null terminated, we use a passed in buffer to copy
the string and ensure null termination.
2016-11-14 22:51:52 -08:00
Fred Silberberg
1f724d58e0 Made the test scripts executable to fix -dirty on the version numbers. (#347) 2016-11-14 21:16:51 -08:00
Peter Johnson
259cf1ff3a Mark NetworkTablesJNI callback interfaces as FunctionalInterface. (#154)
This allows them to be used in Java 8 lambdas.
2016-11-13 23:33:12 -08:00
Thad House
de4a246bb4 Adds OpenCV Loading to wpilib program startup (#338) 2016-11-11 22:32:13 -08:00
Peter Johnson
b12658afc2 Make SafeThreadOwner moveable. (#153)
This allows it to be used in data structures such as std::vector.

Also make GetThread() const.
2016-11-11 22:18:52 -08:00
Peter Johnson
c23880f829 Make SafeThreadOwner moveable. (#153)
This allows it to be used in data structures such as std::vector.

Also make GetThread() const.
2016-11-11 22:18:52 -08:00
Thad House
41dd9e4f06 Loads OpenCV JNI Library in Java (#15) 2016-11-11 21:55:13 -08:00
rrossbach
412b80da30 Fixes joystick button handling HAL JNI layer (buttons are in an (#341)
int, not a byte)
2016-11-10 20:21:54 -08:00
Thad House
47319960a5 Fixes a missed change to unique_ptr in the HAL (#337) 2016-11-08 16:53:17 -08:00
Thad House
b22d218236 Removes CANJaguar specific constants from JNI files (#339) 2016-11-08 16:52:24 -08:00
Thad House
3d1f69075a Adds a size parameter to JStringRef (#152)
Want to use that for some allwpilib JNI cleanups and potential bug fixes
2016-11-07 19:35:48 -08:00
Thad House
dc94a3fac9 Adds a size parameter to JStringRef (#152)
Want to use that for some allwpilib JNI cleanups and potential bug fixes
2016-11-07 19:35:48 -08:00
Thad House
6eb82bc314 Exclude genlinks.bat from HAL zip (#333) 2016-11-06 21:47:34 -08:00
Thad House
a06dd25d56 Adds cscore and opencv to wpilib (#332)
Unit tests now run using shared wpilib as well, since we had to add a ton
of sharedl ibraries anyway. Test scripts also updated to work properly.
2016-11-06 21:47:18 -08:00
Thad House
468cac543f Fixes JNI 2016-11-06 19:28:14 -08:00
Thad House
d4b48216e8 Renames uberzip to athena-uberzip, and doesn't include static library in it 2016-11-06 17:42:34 -08:00
Thad House
e1bb05bc52 Updates to the 2017 v7 image (#329) 2016-11-05 23:20:40 -07:00
Peter Johnson
f83ff41e47 Rename from cameraserver to cscore.
This is primarily to avoid header naming conflicts with wpilib.
2016-11-05 22:11:55 -07:00
Thad House
891ce06312 Adds opencv headers to uberzip (#11) 2016-11-05 21:37:47 -07:00
Thad House
0658ba6f77 Adds javadocs and sources to published windows builds (#10) 2016-11-05 21:37:24 -07:00
Peter Johnson
29d8d1d74c Implement listener interfaces. 2016-11-05 13:19:02 -07:00
Peter Johnson
8d2efb2838 Improve listener interface.
Now a structure is passed back, enabling combining the existing source
and sink listeners and adding property listeners as well.
2016-11-05 13:19:02 -07:00
Thad House
e07a40a16d Adds an UberZip that preincludes the opencv libraries
Helps eclipse a lot
2016-11-05 12:01:16 -07:00
Thad House
38a3eda6a7 Switches CameraServer on Arm to use non-included native library 2016-11-05 11:37:12 -07:00
Thad House
6d1ab7606b Enables temporary publishing on windows 2016-11-05 11:36:30 -07:00
Tyler Veness
8694a020ac Removed entries from .styleguide that are included in .gitignore (#331)
format.py now considers files that match patterns in .gitignore to be modifiable files. Therefore, listing them in .styleguide is redundant.
2016-11-05 08:39:46 -07:00
Thad House
1efb2e4d3d Deprecates Task and Semaphore, and changes other deprecations to use wpiutil version (#330) 2016-11-05 00:23:52 -07:00
Peter Johnson
77edf1e103 Add FRC Driver Station connection support.
The 2017 FRC Driver Station supports getting the robot IP via a TCP
connection that returns JSON.  Use this to support overriding the
server IP address used for client connections.

Default to using this approach for client connections in the NetworkTable
interfaces.

Add support for setting the server address without stopping and
restarting the client.

SetTeam now also round-robins by default.
2016-11-04 23:42:41 -07:00
Peter Johnson
28c8678ea2 SafeThread: Use atomic for m_active. 2016-11-04 23:39:09 -07:00
Peter Johnson
34acd9d47c SafeThread: Use atomic for m_active. 2016-11-04 23:39:09 -07:00
Thad House
861726cefa Adds gradle task to fix NI libraries whenever new ones are added. (#325)
Generates genlinks, and modifies headers to make them self contained
2016-11-04 15:17:17 -07:00
Thad House
81212d80c6 Fixes ultrasonic declaration (#328)
Also adds test to ensure this doens't happen again
2016-11-04 15:02:29 -07:00
Thad House
2235a809c4 Fixes a missed change from the ni-libraries location change (#326) 2016-11-04 13:26:34 -07:00
Thad House
3fe0f49ac0 Moves NI headers to their own folder in the repo (#324) 2016-11-04 01:22:28 -07:00
Thad House
03d8f9193b Moves using namespace from ChipObject.h into hal namespace (#323) 2016-11-03 23:01:13 -07:00
Thad House
05ca76ea99 Runs clang-format on ntcore (#150)
Also updates .clang-format to match allwpilib

WPIUtil was skipped
2016-11-03 21:03:45 -07:00
Thad House
d1065f0bd1 Moves deprecation definition to wpiutil (#149) 2016-11-03 20:08:47 -07:00
Thad House
cf0ec7b9a9 Moves deprecation definition to wpiutil (#149) 2016-11-03 20:08:47 -07:00
Thad House
5e54969f6b Adds Task back into WPILibC (#320)
Note that deprecation has not been added yet, since we need to add the
deprecation API's for MSVC and GCC < 4.9.
2016-11-02 22:17:40 -07:00
Peter Johnson
46085824ae Add DHT data to MJPEG source images if not present. 2016-11-02 21:32:13 -07:00
Thad House
18ef5eb1bf C++ and Java tests for the new build system (#309) 2016-11-01 23:41:05 -07:00
Tyler Veness
b5e3d92e9d Remove errant "using namespace" in global namespace (#318) 2016-11-01 23:40:28 -07:00
Tyler Veness
ba8761e39e "using" directives are no longer used in global namespaces (#219) 2016-11-01 23:09:51 -07:00
Thad House
78f0b1562c Removes Task.h from wpilib.h header (#317) 2016-11-01 23:08:57 -07:00
Thad House
5c28b30028 Removes NetworkTables from Java executable jar (#303) 2016-11-01 22:34:52 -07:00
Peter Johnson
59267da72b Namespace all wpilibc functions/classes into "frc" namespace. (#311)
Base.h provides a backwards compatibility shim (enabled unless
NAMESPACED_WPILIB is defined) that does a "using namespace frc".
However, as some header files do not include Base.h, this may
be a breaking change in some corner cases (with an easy fix).

Fixes #218.
2016-11-01 22:33:12 -07:00
Dustin Spicuzza
36ad45c07d Delete .gitreview (#316) 2016-11-01 22:31:53 -07:00
Thad House
ecb2add791 Removes additional references to CANTalon from the library. (#312) 2016-11-01 20:13:26 -07:00
Thad House
9bbdaf300b Removes the task class from wpilib (#314)
Was required back on the cRIO, but there are much better alternatives
nowadays.
2016-11-01 20:12:08 -07:00
Thad House
bc492bb40e Removes the REAL definition from wpilib.h (#315)
Interferes with OpenCV, and is heavy namespace polution anyway.
2016-11-01 19:23:59 -07:00
Thad House
7067179b28 Ignores the vscode directory. (#6) 2016-11-01 00:37:10 -07:00
Thad House
81221c4874 Moves JNI internal utility methods to frc namespace (#310) 2016-10-31 23:04:49 -07:00
Peter Johnson
4828a69867 Update versioning plugin. 2016-10-31 20:15:42 -07:00
Peter Johnson
3fcc808e99 Use zlib built into OpenCV. 2016-10-31 20:00:14 -07:00
Peter Johnson
15cdd661a4 Simplify OpenCV dependencies.
Depends on https://github.com/wpilibsuite/opencv/pull/6
2016-10-30 23:58:33 -07:00
Thad House
137b3d81fb Fixes JNI file not being copied to output directory for integration tests (#308) 2016-10-30 23:14:19 -07:00
Fred Silberberg
6741f47ef1 Update version plugin (#307) 2016-10-30 01:18:18 -07:00
Fred Silberberg
60d9f3de68 Update version plugin (#148) 2016-10-30 01:14:57 -07:00
Thad House
f87baaa4fc Moves dependencies to their own gradle file, and adds capabilities to link to ntcore and wpilib (#4) 2016-10-29 22:36:04 -07:00
Fred Silberberg
fecd8a448f Fix wpiutil version (#147) 2016-10-28 21:04:47 -04:00
Fredric Silberberg
fe4ef75cf6 Updated wpiutil version 2016-10-28 20:09:54 -04:00
Peter Johnson
87c7a9db54 Add USB and OpenCV processed dual stream example. 2016-10-28 00:54:28 -07:00
Peter Johnson
fa2ce40084 Add OpenCV library links to example executables. 2016-10-28 00:53:44 -07:00
Peter Johnson
4eac3fe9a0 Disable x86 platform for now until we get OpenCV working with it. 2016-10-28 00:52:41 -07:00
Peter Johnson
d7efd62511 build.gradle: Fix OpenCV library order.
Also include OpenCV-built liblibjpeg.a and liblibpng.a.
2016-10-28 00:51:28 -07:00
Peter Johnson
e10b399f51 CvSource: Implement NotifyError. 2016-10-28 00:47:18 -07:00
Peter Johnson
39a8195386 CvSourceImpl: Add stub for CreateProperty(callback). 2016-10-28 00:46:43 -07:00
Thad House
e75e9092a8 Fixes athena runtime zip not being built at the correct times (#306) 2016-10-27 22:01:28 -07:00
Thad House
247cef5ec2 Removes CANJaguar from wpilib (#300)
Now located at https://github.com/wpilibsuite/CANJaguar.
2016-10-27 10:54:52 -07:00
Peter Johnson
43331419f6 MJPEGServer: Output boundary at start of image instead of end.
This avoids hiccups/timeouts causing the next image being seen as a
completely new file rather than a continuation of a multi-part.
2016-10-26 23:58:22 -07:00
Peter Johnson
c66a55d81a Implement CvSink.
* Make CvSink constructor explicit.

* Add SetDescription function.
2016-10-26 23:37:00 -07:00
Peter Johnson
9a44a38141 Fix source and sink refcounting. 2016-10-26 23:34:44 -07:00
Peter Johnson
5f69cb2a5b SinkImpl: Refactor GetDescription, add GetError, SetEnabled. 2016-10-26 23:31:48 -07:00
Peter Johnson
a5f63c3ae3 SourceImpl::GetNextFrame(): Avoid spurious wakeups. 2016-10-26 23:31:18 -07:00
Peter Johnson
0053962182 SourceImpl: add PutError().
The error message is stored as a normal frame with unknown pixel format.
2016-10-26 23:30:13 -07:00
Peter Johnson
c462d0b249 CvSourceImpl.h: Remove unnecessary include. 2016-10-26 23:26:15 -07:00
Thad House
29f999e2b2 Adds new handle structure and type for vendors (#297) 2016-10-26 23:09:33 -07:00
Peter Johnson
778edaeb28 Reverse the JNI load order to look for system library first. (#145) 2016-10-25 22:27:33 -07:00
Peter Johnson
273a395a2f Client: when reconnecting, default to NT3. (#143)
Previously once the client fell back once to NT2, it would never try
connecting as NT3 even if the server was replaced with a NT3-capable
one.

Fixes #142.
2016-10-25 21:44:47 -07:00
Thad House
5e3755493d Linking and maven publish location rewrite (#298)
* Links HAL shared instead of static, and doesn't include library in jar

* Strips shared object files, and includes debug in releases

* Zips the HAL libraries into a separate maven artifact

* Switches to shared wpiutil

* Switches wpilibc to shared

* Moves maven artifacts

wpilibc now in edu.wpi.first.wpilibc:athena
wpilibj now in edu.wpi.first.wpilibj:athena
wpilibj jni not in edu.wpi.first.wpilibj:athena-jni
hal now in edu.wpi.first.wpilib:hal
athena runtime added (hal, ntcore, wpiutil) edu.wpi.first.wpilib:athena-runtime

Changes made where wpilibc does NOT include all required artifacts anymore. Dependent on hal, wpiutil and ntcore packages to work correctly.
JNI does NOT include all required artifacts anymore. Dependent on hal and wpiutil packages to work correctly.
2016-10-25 20:46:09 -07:00
Thad House
aa49ebd47f Links wpiutil on roboRIO dynamically (#141) 2016-10-25 20:42:42 -07:00
Thad House
c45384b91a Removes the native library from the RoboRIO Jar (#139)
Includes the native zip in the maven artifact as well.
2016-10-25 20:42:06 -07:00
Thad House
70343c0b3f Fixes missing function for Timer::GetMatchTime() (#299) 2016-10-25 19:01:18 -07:00
Fred Silberberg
88fdbc6d3e Readds wpiutilZip dependency to the build. (#144) 2016-10-25 07:04:49 -07:00
Peter Johnson
7ca6c5ef34 Remove RemoveSourceProperty. 2016-10-24 22:29:58 -07:00
Thad House
60e199b0bd Fixes format.py on windows (#293) 2016-10-24 22:17:02 -07:00
Thad House
1071686d81 Replaces C++ IsNewControlData semaphore with atomic bool, and Java code with AtomicBool (#187) 2016-10-24 20:32:43 -07:00
Peter Johnson
511d551546 Implement most CvSource functionality. 2016-10-24 20:27:00 -07:00
Tyler Veness
fdebdd520a Added format.py to Travis config (#236) 2016-10-23 21:37:43 -07:00
Peter Johnson
7ea13f7e03 Refactor properties from USBCameraImpl to SourceImpl. 2016-10-23 18:20:56 -07:00
Tyler Veness
5ca5583fc3 Removed unnecessary set of parentheses and ran formatter (#290) 2016-10-23 16:34:00 -07:00
Thad House
75463a249f Implements threaded notifiers and interrupts in the HAL (#281) 2016-10-23 14:34:43 -07:00
Thad House
7280d241f0 Fixes DIO not erroring with too high of DIO number (#288) 2016-10-23 14:21:14 -07:00
Austin Shalit
963391cf39 Cleanup SolenoidBase, Solenoid, and DoubleSolenoid (#271) 2016-10-23 14:20:28 -07:00
Thad House
4f4c52d6d5 Switches JNI to use SafeThread from WPIUtil (#282) 2016-10-23 14:18:46 -07:00
Fred Silberberg
499da6d08d Updated the wpilib version plugin to 1.2. Fixes issues with submodules. (#289) 2016-10-23 14:17:59 -07:00
Peter Johnson
6754703ad1 Updated the wpilib version plugin to 1.2.
Fixes issues with submodules.
2016-10-23 14:17:16 -07:00
Fred Silberberg
89b8e5435f Updated the wpilib version plugin to 1.2. Fixes issues with submodules. (#138) 2016-10-23 14:15:28 -07:00
Peter Johnson
b0ab351f7f Don't check for existence in distributing .debug files. (#137)
This check is unnecessary and is run during task creation, so prevents
the .debug file from being included the first time gradle is run.
2016-10-23 13:18:01 -07:00
Austin Shalit
39e4d11f8e Remove .pullapprove.yml (#287) 2016-10-23 11:20:29 -07:00
Peter Johnson
9b6f4ecd0d Don't check for existence in distributing .debug files.
This check is unnecessary and is run during task creation, so prevents
the .debug file from being included the first time gradle is run.
2016-10-23 10:42:51 -07:00
Thad House
df4a2c07f0 Checks for system initialization in functions that can be called before creating handle based objects (#285) 2016-10-23 10:00:34 -07:00
Thad House
c46c490376 Adds wpiUtil to HAL and JNI (#280) 2016-10-23 09:51:30 -07:00
Peter Johnson
9142cbb820 CvSource: Update interface functions.
- Add SetDescription
- Supply minimum, maximum, step, defaultValue, and value to CreateProperty
- Add SetEnumPropertyChoices
2016-10-23 08:43:06 -07:00
Peter Johnson
1f6b386325 Implement frame timestamps and use wpi::Now() for generation. 2016-10-22 22:09:47 -07:00
Thad House
f2751db5c2 Adds NI Libraries symbolic link (#286) 2016-10-22 14:21:26 -07:00
Peter Johnson
aad1266a94 Distribute shared library .debug files. 2016-10-22 09:57:38 -07:00
Peter Johnson
06a40680aa Change debug strip to be part of link task (as doLast).
This avoids spurious re-linking.
2016-10-22 09:57:38 -07:00
Peter Johnson
cc2cbf810d Exclude opencv MANIFEST.MF files to prevent repeat unzips.
As natives and jni extract to the same location, their MANIFEST.MF files
were overwriting each other.
2016-10-22 09:57:38 -07:00
Peter Johnson
cf9aa90321 Don't overwrite platform-dependent opencv zip files.
This was causing native downloads to overwrite each other.

Also create a single def for openCvNativesFolder.
2016-10-22 09:57:38 -07:00
Peter Johnson
d51f6c45e5 JNI: initialize status to 0. 2016-10-22 09:57:38 -07:00
Peter Johnson
017ec83ce3 Add support for OpenCV to Java wrappers. 2016-10-22 09:57:38 -07:00
Peter Johnson
6641612de5 Update to use wpi version plugin. 2016-10-22 09:57:38 -07:00
Peter Johnson
218718a063 Add OpenCV dependency and update OpenCV interfaces.
This requires the wpilibsuite/opencv packages with PRs 1-3 applied.
2016-10-22 09:57:33 -07:00
Peter Johnson
353041535c Distribute shared library .debug files. (#136) 2016-10-22 09:35:36 -07:00
Peter Johnson
e4234f5198 raw_istream: Add std::istream style in_avail(). (#135) 2016-10-21 22:50:38 -07:00
Peter Johnson
d81840d6c6 raw_istream: Add std::istream style in_avail(). (#135) 2016-10-21 22:50:38 -07:00
Peter Johnson
1d336996be Dispatcher: Minimize amount of time m_flush_mutex is held. (#132) 2016-10-21 20:01:41 -07:00
Peter Johnson
86c43df8d1 Fix connection notification races. (#130)
Use a mutex on the connection state and one-shot all change notifications.

Fixes #127.
2016-10-21 19:40:56 -07:00
Peter Johnson
5c1b7ecd17 Change debug strip to be part of link task (as doLast). (#134)
This avoids spurious re-linking.
2016-10-21 19:18:32 -07:00
Peter Johnson
011ac1fa22 Java: Allow any Number type (not just Double) to be passed to putValue(). (#129)
Also improve exception message.

Fixes #72.
2016-10-21 19:17:50 -07:00
Thad House
2bff276adb Fixes a missed formatting issue (#283) 2016-10-21 08:30:49 -07:00
Fred Silberberg
e5e1a1a4d1 Moved version generation to the WPILib versioning plugin. (#277)
* Moved version generation to the WPILib versioning plugin. This also moves ntcore and wpilib to the latest available version.

* Fixed description string.

* Gave full path for ignored files.
2016-10-20 23:54:04 -07:00
Fred Silberberg
b8e5258cf3 Creates the build dir if it doesn't exist, and deletes the version files during clean' (#131) 2016-10-20 22:41:40 -07:00
Fred Silberberg
56179088bb Updated the gradle build to get the version from the WPILibVersioning plugin (#123)
* Updated the gradle build to get the version from the WPILibVersioning plugin

* Added version output for downstream projects

* Fixed non-arm build.
2016-10-20 21:34:14 -07:00
Thad House
780e9580b7 Ignores KeepAlive messages during initial handshakes (#128)
Shouldn't happen normally, but could happen if handshakes take a longer
then normal period of time.
Closes #126
2016-10-19 22:47:33 -07:00
Austin Shalit
0613f1d182 Cleanup encoder class (#272) 2016-10-19 22:39:47 -07:00
Austin Shalit
8b94e0933a Update README (#261)
Update the README to include instructions on how to image the test bench roboRIO.
2016-10-19 22:37:43 -07:00
Austin Shalit
23ef57561d Cleanup PowerDistributionPanel (#275) 2016-10-19 22:34:57 -07:00
Austin Shalit
33b95816ee Cleanup SensorBase class (#273) 2016-10-19 22:33:36 -07:00
Thad House
4c1e4fd80c Updates image to v6 (#278)
Added exports of the environment variables set in the frcRunRobot script to prevent fork calls.
2016-10-19 22:30:29 -07:00
Thad House
b775b01e0a Optimizes NetworkTables string concatenation (#125)
During testing, I was seeing a lot of unnecessary code (and allocations
in Java/C#) when appending the path separator to the base path. That
technically is a constant, so this computes this constant during class
construction.
2016-10-17 22:33:59 -07:00
Peter Johnson
0a8e0e9746 MJPEGServer: Pass resolution and FPS requests to source. 2016-10-17 20:16:49 -07:00
Dustin Spicuzza
89805a44c1 Fix NetworkTable::setFlag typo (#124) 2016-10-16 17:28:35 -07:00
Peter Johnson
9caa0af4d9 USBCamera, HTTPCamera: Name functions consistent with classes. 2016-10-15 23:07:28 -07:00
Peter Johnson
70531762b9 usbstream: Wait for enter rather than infinite loop/sleep. 2016-10-15 22:45:56 -07:00
Peter Johnson
30f4ecd171 Rename HTTPSink to MJPEGServer. 2016-10-15 22:44:26 -07:00
Peter Johnson
d56c3f9adf USBCamera: Default to MJPEG and lowest resolution. 2016-10-15 21:27:03 -07:00
Peter Johnson
73a97c1774 USBCamera: Finish implementing mode support. 2016-10-15 17:24:47 -07:00
Fred Silberberg
3784b665de Updated version for beta 1 (#270) 2016-10-13 18:50:39 -07:00
Kevin-OConnor
567ea1d58d Remove CAN TalonSRX from WPILib (moving to external library) (#268) 2016-10-13 18:50:20 -07:00
Austin Shalit
55346e28d0 DoubleSolenoid free reverse port handle instead of channel (#274) 2016-10-13 12:41:36 -07:00
Peter Johnson
8ec2b1d96f README: Fix artifact names. 2016-10-13 00:38:13 -07:00
Peter Johnson
c858e0391d README: Remove reference to cmake. 2016-10-13 00:36:41 -07:00
Peter Johnson
63c9af4578 Add license. 2016-10-13 00:35:08 -07:00
Peter Johnson
473a87a76b USBCameraImpl.cpp: Clean up formatting a bit. 2016-10-13 00:32:06 -07:00
Peter Johnson
4c6f6536b8 tests.gradle: Link to wpiutil. 2016-10-13 00:31:45 -07:00
Peter Johnson
cb4d8a6555 Add examples.
Disable google tests for now.
2016-10-13 00:18:16 -07:00
Peter Johnson
417545d521 Finish most of USBCameraImpl.
The main thing not yet fully implemented is video mode setting.

Also fix a handful of bugs in HTTPSinkImpl.
2016-10-13 00:16:24 -07:00
Peter Johnson
7f88bd15d1 SinkImpl: Keep enabled count rather than just boolean.
This allows e.g. multiple HTTP streams to individually call Enable() and
Disable().
2016-10-13 00:13:18 -07:00
Fred Silberberg
49b8c4ba78 Fixes the gradle dependencies for building (#269) 2016-10-12 21:06:33 -07:00
Thad House
f1c2b66569 Reverts the 2017 Image for Beta 1 (#264)
* Revert "Updated the rpath to point to the correct location for the Java integration tests. (#262)"

This reverts commit c313dde03a.

* Revert "Update image 2017 v5 (#254)"

This reverts commit 8d1c51b7e9.
2016-10-12 19:52:49 -07:00
Austin Shalit
27bf94fd06 Remove kDefaultPeriod from IterativeRobot (#232)
* Remove kDefaultPeriod from IterativeRobot

* Remove period

* Remove NextPeriodReady
2016-10-09 13:58:30 -07:00
Thad House
4896a77c86 Fixes guarantees for waitForData (#252)
As discussed in #234, we now check for the timeout case and handle a
timeout correctly.
2016-10-09 11:46:01 -07:00
Austin Shalit
d1d3f049f2 Solve scp file not found (#263)
Solves the scp file not found bug after installing a new image on the test bench.
2016-10-09 11:45:26 -07:00
Peter Johnson
7b3f6eeae2 Add raw_fd_istream. (#121) 2016-10-08 16:03:33 -07:00
Peter Johnson
f6df7cad9b Add raw_fd_istream. (#121) 2016-10-08 16:03:33 -07:00
Peter Johnson
15cb505163 TCPStream: Avoid SIGPIPE signals.
On Mac, this is done by setting SO_NOSIGPIPE on the socket.
On Linux, this is done with MSG_NOSIGNAL on the send call.
2016-10-08 16:02:55 -07:00
Peter Johnson
cc1b94afd2 TCPStream: Avoid SIGPIPE signals.
On Mac, this is done by setting SO_NOSIGPIPE on the socket.
On Linux, this is done with MSG_NOSIGNAL on the send call.
2016-10-08 16:02:55 -07:00
Fred Silberberg
c313dde03a Updated the rpath to point to the correct location for the Java integration tests. (#262) 2016-10-08 13:08:26 -07:00
Fred Silberberg
8d1c51b7e9 Update image 2017 v5 (#254)
* Updated the image version and dependent libraries to 2017 v5.

* Updated version for beta 1

* Some additional library updates, task updates, and rpath updates
2016-10-08 00:13:31 -07:00
Thad House
a59e00e901 Adds a test to make sure WaitForData is properly waiting (#258) 2016-10-06 11:18:47 -07:00
Tyler Veness
7070162b98 Fixed lint errors (#259) 2016-10-06 11:05:09 -07:00
Thad House
9859c14ca1 Fixes status parameter in wrong location for initialization range functions (#260) 2016-10-06 11:04:38 -07:00
Thad House
a7eca7d4bd Adds ConnectionInfo to Rpc callback (#116) 2016-10-03 10:04:30 -07:00
Thad House
64ebe7f5e5 Updates SmartDashboard with new NetworkTables3 functions (#162) 2016-10-03 09:59:18 -07:00
Thad House
8b2345a706 Removes an unnecessary function from HAL Power (#237)
Was not declared in header, so never used anywhere
2016-10-03 09:52:47 -07:00
Thad House
e65f9908d7 Makes IterativeRobot not double check for new control data (#253)
Previously could cause a race condition. Also moves wait to the top of
the loop in order to avoid having an initial loop be ran before data can
be check.

Sim is handled in #232, except that needs to be updated as well to move
the wait to the top of the loop.
2016-10-02 09:05:32 -07:00
Tyler Veness
fd52912d74 Fixed return value propagation of format.py (#251) 2016-10-02 08:10:22 -07:00
Fred Silberberg
9e7993905f Remove slack integration (#257)
Slack integration is useless noise that no one reads. This removes it.
2016-10-02 01:11:09 -07:00
Thad House
9047c98e68 Fixes possible indefinite timeout on multiple RPC calls (#120)
Calculates timeout before the RPC call checks ever loop.
2016-09-30 12:41:52 -07:00
Thad House
a656207220 Forces exceptions to throw on HAL handle creation functions (#209)
Fixes #199
2016-09-29 20:18:40 -07:00
Peter Johnson
53d0789660 Storage: Escape equal sign in strings. (#119)
This helps interoperability with standard config parser libraries
(such as Python's RawConfigParser).
2016-09-29 20:16:32 -07:00
Peter Johnson
ee24a6f4fc Disable support for non-MJPEG formats. 2016-09-29 00:06:31 -07:00
Peter Johnson
70616c48e3 Add support for enumerating and changing USB camera video mode. 2016-09-29 00:04:16 -07:00
Peter Johnson
81e63ea3a5 Fix simulation build with latest ntcore/wpiutil. (#250) 2016-09-28 20:45:03 -07:00
Peter Johnson
d4bbd5cc6f Make raw_socket_istream constructor explicit. 2016-09-25 19:48:49 -07:00
Peter Johnson
1affae956b Make raw_socket_istream constructor explicit. 2016-09-25 19:48:49 -07:00
Peter Johnson
7463e02080 Logger: Use raw_ostream and SmallString. 2016-09-25 19:48:49 -07:00
Peter Johnson
d3ed26f7cc Logger: Use raw_ostream and SmallString. 2016-09-25 19:48:49 -07:00
Peter Johnson
f711ced4ca Add raw_socket_ostream.
This wraps NetworkStream in a llvm::raw_ostream.
2016-09-25 19:48:49 -07:00
Peter Johnson
1ec89fc4f3 Add raw_socket_ostream.
This wraps NetworkStream in a llvm::raw_ostream.
2016-09-25 19:48:49 -07:00
Peter Johnson
a92b7298f9 Add 1-character read to raw_istream. 2016-09-25 19:48:49 -07:00
Peter Johnson
de07b01a75 Add 1-character read to raw_istream. 2016-09-25 19:48:49 -07:00
Peter Johnson
4c6c096c50 Change API of raw_istream to be more similar to raw_ostream. 2016-09-25 19:48:49 -07:00
Peter Johnson
c2ae897b02 Change API of raw_istream to be more similar to raw_ostream. 2016-09-25 19:48:49 -07:00
Peter Johnson
b2e1291973 Refactor JNI helpers into wpiutil (support/jni_util.h). (#105) 2016-09-25 19:29:17 -07:00
Peter Johnson
94c2b65798 Refactor JNI helpers into wpiutil (support/jni_util.h). (#105) 2016-09-25 19:29:17 -07:00
Peter Johnson
760d6a26d3 Make SafeThread header-only. (#117) 2016-09-25 18:21:29 -07:00
Peter Johnson
3a419768ca Make SafeThread header-only. (#117) 2016-09-25 18:21:29 -07:00
Peter Johnson
d8ee44349c Update to latest LLVM code (#88)
* Update to latest LLVM code.

* Add LLVM's raw_ostream.

* MathExtras.h: Include cmath for log2.
2016-09-25 17:49:01 -07:00
Peter Johnson
ee42448504 Update to latest LLVM code (#88)
* Update to latest LLVM code.

* Add LLVM's raw_ostream.

* MathExtras.h: Include cmath for log2.
2016-09-25 17:49:01 -07:00
Peter Johnson
d90cf843e8 Move common utility classes to wpiutil library. (#79)
This is a breaking change to dependencies that use the static ntcore
library.  Unless the wpiutil library is also linked, linker errors will
result.  This does not affect the shared ntcore library.
2016-09-25 17:23:39 -07:00
Peter Johnson
f6b700ea97 Move common utility classes to wpiutil library. (#79)
This is a breaking change to dependencies that use the static ntcore
library.  Unless the wpiutil library is also linked, linker errors will
result.  This does not affect the shared ntcore library.
2016-09-25 17:23:39 -07:00
Tyler Veness
5dfae8d6bd Fixed include order (#245)
See wpilibsuite/styleguide (#11).
2016-09-25 16:50:13 -07:00
Peter Johnson
107a4cc1e2 Add wpiutil dependency. (#190) 2016-09-25 16:47:49 -07:00
Tyler Veness
35d51d68f7 Made a comment use more professional language (#249) 2016-09-23 22:16:33 -07:00
Tyler Veness
049fec470b Fixed compilation with GCC 6 (#248)
Since newer versions of GCC emit more warnings and errors, I tried building WPILib with GCC 6.2.0. This patch fixes compilation errors that occurred.
2016-09-23 20:27:11 -07:00
Tyler Veness
659dbef751 Ran format.py after writing unit tests for and fixing bugs in it (#239) 2016-09-21 23:48:54 -07:00
Peter Johnson
a5fe605aae HTTPSink: Add basic property setting support. 2016-09-20 23:27:21 -07:00
Peter Johnson
7818c3bda3 USBCamera: Normalize property names. 2016-09-20 22:28:48 -07:00
Peter Johnson
d5e5755ff4 Collapse boolean/double/enum properties into just integer. 2016-09-20 22:17:12 -07:00
Peter Johnson
8fbc23b1fa HTTPSinkImpl fixes. 2016-09-20 20:40:58 -07:00
Tyler Veness
ac9b6f7b18 Implemented CircularBuffer resizing (#224) 2016-09-20 19:43:34 -07:00
Tyler Veness
425ed464ed Removed leading underscores from variable names (#246) 2016-09-20 12:41:42 -07:00
Austin Shalit
2c15bb247e Remove delay from periodic methods. (#243) 2016-09-20 12:34:17 -07:00
Austin Shalit
28e178b1a8 Update Compressor documentation (#244) 2016-09-20 12:31:16 -07:00
Peter Johnson
d05f0820b2 HTTPSinkImpl: Report property step and default. 2016-09-20 00:01:09 -07:00
Peter Johnson
dad44cc928 Add status parameter to property functions. 2016-09-19 23:50:47 -07:00
Peter Johnson
2c80587d11 Start implementing USBCamera. 2016-09-19 22:11:37 -07:00
Peter Johnson
80eb056432 Fix property handles (and allocate more bits to the property index). 2016-09-19 22:04:45 -07:00
Thad House
80e546b79f Adds a way to externally test C structures (#115)
For language interop, its nice to be able to create the structs from the
C side to make sure everything works properly.
2016-09-18 21:48:17 -07:00
Peter Johnson
6eba04ed8e Use copy-and-swap idiom for reference-counted classes. 2016-09-18 17:25:48 -07:00
Peter Johnson
c606671d27 Consistently name property max/min functions and add step/default. 2016-09-18 17:25:21 -07:00
Peter Johnson
9bb37d5df0 Remove support for multiple channels. 2016-09-18 17:15:27 -07:00
sciencewhiz
5d2a08443b Fix Typos. Fixes artf4853 (#242) 2016-09-18 08:43:22 -07:00
Thad House
e952236e1a Reverts the last 2 Rpc changes (#114)
* Revert "Fully asigns the ConnectionInfo struct (#113)"

This reverts commit 9a3100b221.

* Revert "Passes the ConnectionInfo of the Rpc client on server callback (#112)"

This reverts commit 7e9754acff.
2016-09-16 22:23:58 -07:00
Thad House
9a3100b221 Fully asigns the ConnectionInfo struct (#113)
For some reason, it was putting garbage in for the things that shouldn't
have been, which doesn't make much sense.
2016-09-16 21:56:57 -07:00
Thad House
7e9754acff Passes the ConnectionInfo of the Rpc client on server callback (#112) 2016-09-16 20:20:55 -07:00
Tyler Veness
087eeec760 C standard library functions and types are now prefixed with std:: (#227) 2016-09-14 20:52:06 -07:00
Thad House
dbe03afb9a Fixes error in driver station control word cache (#222) 2016-09-13 21:22:25 -07:00
Thad House
2ecb939b35 Add a method to detect the HAL runtime version (#228) 2016-09-13 21:21:57 -07:00
Austin Shalit
1416fb8f67 Update Periodic JavaDoc (#231) 2016-09-13 21:21:25 -07:00
Tyler Veness
aeb6c4889b Added license template file (#225) 2016-09-13 20:28:07 -07:00
Thad House
c2fc6711d8 Switches enums to use a fixed size for their base (#230) 2016-09-13 20:27:38 -07:00
Thad House
f271185cbc Adds a RobotPeriodic method to IterativeRobot (#226)
Called globally during each IterativeRobot loop
2016-09-13 20:25:18 -07:00
Peter Johnson
b78592d622 Log.h: Remove unnecessary includes. 2016-09-10 21:54:16 -07:00
Peter Johnson
052f746c68 Use StringRef and ArrayRef return values when buf passed.
For functions where a SmallVector is passed to be used as a stack buffer for
the return value, have the return value be the appropriate StringRef or
ArrayRef type.  This allows for both more natural usage and enables directly
returning (rather than copying) a permanently stored or constant string.
2016-09-10 21:30:39 -07:00
Peter Johnson
c4ceec145a Enable unit tests. 2016-09-10 13:01:16 -07:00
Peter Johnson
775386d8b3 HTTPSinkImpl: Implement GetDescription. 2016-09-10 12:46:43 -07:00
Peter Johnson
451c08ef7b Add wpiutil library dependency to builds. 2016-09-10 12:06:18 -07:00
Peter Johnson
52c8743b36 Finish rename of EnumerateSinks to EnumerateSinkHandles.
And similarly for EnumerateSources to EnumerateSourceHandles.
2016-09-09 23:28:57 -07:00
Peter Johnson
5c59b9aeb3 Make HTTPCamera constructor public. 2016-09-09 23:06:50 -07:00
Peter Johnson
3e00dabd16 Import gmock. 2016-09-09 22:55:15 -07:00
Thad House
4fc7daedc9 Fixes incorrect deadband value being passed over PWM (#223) 2016-09-09 15:58:38 -07:00
Thad House
c5c069743b Switches AppVeyor to use same build for 32 and 64 bit java tests (#107) 2016-09-09 12:09:53 -07:00
Peter Johnson
ba241cd7f9 Source: Keep track of how many sinks are connected and enabled. 2016-09-08 23:52:23 -07:00
Peter Johnson
ddb97bfafb Fix SendStream error handling. 2016-09-08 21:00:23 -07:00
Peter Johnson
e415ca66b6 Initial HTTPSink implementation. Untested. 2016-09-08 00:07:20 -07:00
Peter Johnson
85be299da1 Start implementation. 2016-09-08 00:07:20 -07:00
Peter Johnson
9dd5bea7a5 Create a common CS_Handle. Add initial status values. 2016-09-08 00:07:20 -07:00
Peter Johnson
e71abedefb Add logging implementation. 2016-09-08 00:07:20 -07:00
Thad House
3888d7726a Adds connection listeners that can be called statically (#111)
This way you can have a connection listener before initializing NetworkTables.
2016-09-06 21:30:59 -07:00
Tyler Veness
6bfc008673 Replaced snake case variable names with mixed case (#221) 2016-09-06 19:43:24 -07:00
Tyler Veness
2c94d0ba2f Cleaned up integer type usage in the HAL (#192)
Replaced all uses of built-in types except char with stdint.h typedefs and all unsigned types with signed in the HAL
2016-09-06 19:39:28 -07:00
Tyler Veness
0cd05d1a42 Cleaned up integer type usage in wpilibc (#92)
Replaced all unsigned types to signed and int32_t with int in wpilibc
2016-09-06 00:01:45 -07:00
Tyler Veness
ff93050b31 Remove static_assert for sizeof(uint32_t) <= sizeof(void*) (#220)
According to #192, we don't cast integers to pointers anymore. The size static_assert is unnecessary.
2016-09-05 23:31:58 -07:00
Tyler Veness
05626cfafe Fixed cpplint.py warnings (#215)
* Fixed cpplint.py [build/include_order] and [build/include_what_you_use] warnings
* Fixed cpplint.py [readability/casting] warnings
* Updated .styleguide format
* Fixed cpplint.py [build/header_guard] warnings
2016-09-05 13:55:31 -07:00
Thad House
59ec54887d Switches notifier to use a typedef for the callback, and prepends HAL_ to InterruptHandlerFunction (#216) 2016-09-05 07:31:51 -07:00
Tyler Veness
028efff50d Ran format.py (#217) 2016-09-05 07:31:02 -07:00
Thad House
fc48944b47 Fixes Rpc Cancel. Check was only in timeout case instead of global (#110) 2016-09-02 19:28:59 -07:00
Tyler Veness
2499771cf4 Added extensions to .styleguide (#214)
wpilibsuite/styleguide is going to use extensions specified in .styleguide instead of hardcoded extensions. This patch should be merged first to maintain correct operation.
2016-09-01 20:31:38 -07:00
Fred Silberberg
c989ae808b Updated gradle to 3.0 (#208) 2016-09-01 20:30:37 -07:00
Thad House
2150f5879b Adds AppVeyor support for VS 2013 and 2015 (#106) 2016-08-30 22:04:19 -07:00
Thad House
85156d15ca Fixes the final issue with VS 2013 builds (#109) 2016-08-30 21:27:48 -07:00
Peter Johnson
6943d14f93 Java: Use wpiutil jni-util.h helpers. 2016-08-28 21:20:40 -07:00
Thad House
ade4e87d6f Fixes support for MSVC 2013 (#104) 2016-08-28 19:17:31 -07:00
Peter Johnson
8007a7b153 Correctly handle UTF8 Java translation for StringArray. (#103) 2016-08-26 21:55:11 -07:00
Peter Johnson
e8643600f2 Implement all current JNI native functions. 2016-08-26 10:46:10 -07:00
Peter Johnson
cb7f1f6e3e Initial .def file real content. 2016-08-26 09:31:58 -07:00
Peter Johnson
af7132be82 Initial CameraServerJNI.cpp commit. 2016-08-26 09:31:42 -07:00
Peter Johnson
ec080118f4 Clean up odd special case of GetSourceProperty(). 2016-08-26 09:24:18 -07:00
Peter Johnson
6bcc0e2d82 Correctly prefix CS_EnumerateSourceProperties. 2016-08-26 09:12:55 -07:00
Peter Johnson
2fd81a7e33 Add copyright notices to Java files. 2016-08-26 09:01:54 -07:00
Peter Johnson
2f99f81aa6 Java: Add VideoProperty implementation. 2016-08-26 08:51:28 -07:00
Peter Johnson
97f1f1c9c4 CameraServerJNI: Fix case of a few functions. 2016-08-26 08:51:28 -07:00
Peter Johnson
0fbb2e8a14 Add methods to get property name and enumerate properties.
Also add method to remove property by handle.
2016-08-26 08:51:23 -07:00
Peter Johnson
0158fd35f0 Continue implementing C wrappers.
Implement non-OO C++ EnumerateUSBCameras().
2016-08-26 07:04:33 -07:00
Peter Johnson
80b15b7fe5 Add a bit of description about how handles work in the C API. 2016-08-26 01:00:38 -07:00
Peter Johnson
2acca6eeb1 cameraserver_cpp.h: Move stdint.h above the C++ includes. 2016-08-26 00:43:03 -07:00
Peter Johnson
151c89fb5d Rename FrameGrab to GrabFrame. 2016-08-26 00:30:45 -07:00
Peter Johnson
4f22ac4100 Move all non-trivial inline functions to cameraserver_oo.inl. 2016-08-26 00:29:28 -07:00
Peter Johnson
7c1da2dfcd Split classes in cameraserver_cpp.h out to cameraserver_oo.h. 2016-08-26 00:08:02 -07:00
Peter Johnson
b5d32ec844 VideoSource, VideoSink: Move the status flag too. 2016-08-25 23:17:46 -07:00
Peter Johnson
aec16a934f Revamp API again and start implementing C and Java wrapper shells. 2016-08-25 23:13:48 -07:00
Tyler Veness
93b486b6ba Replaced C-style casts found by GCC in HAL, wpilibc, and JNI (#211) 2016-08-24 21:39:16 -07:00
Fred Silberberg
075155b431 More gradle 3.0 additions (#102) 2016-08-22 20:59:50 -07:00
Peter Johnson
c25c62e0af Update gradle to 3.0. 2016-08-22 20:40:19 -07:00
Thad House
2ec6132fcb Switches compiler from -O0 to -Og (#197)
Should be a heavy increase in performance
2016-08-21 19:15:58 -07:00
Thad House
8aba2b2850 Adds .vscode to styleguide ignore files (#210) 2016-08-21 12:35:58 -07:00
Tyler Veness
32c95fa0da Moved style guide documents and scripts to wpilibsuite/styleguide (#207) 2016-08-21 10:31:43 -07:00
Fred Silberberg
e653a228fa Updates gradle to 3.0. Now that the check bug is fixed, removes the empty check tasks. (#101) 2016-08-21 11:16:33 -04:00
Peter Johnson
b2831347bc Revamp API. 2016-08-19 23:05:28 -07:00
Thad House
7845caa100 Fixes GetRpcResult not removing calluid from call list on non blocking call (#100) 2016-08-19 21:48:30 -07:00
Thad House
66d214c8a8 Finishes blocking call canceling (#99) 2016-08-18 00:05:06 -07:00
Thad House
277cf2a08f Removes new line from mdns name (#98)
Closes #97
2016-08-17 21:21:55 -07:00
Thad House
7bf44e951c Fixes server side polled rpcs (#96) 2016-08-16 23:32:13 -07:00
Thad House
c0ce4270f0 Adds a way to cancel a blocking rpc call (#94) 2016-08-16 23:31:45 -07:00
Thad House
d6e8de21ef Fixes rpc timeouts and blocking call list error (#95) 2016-08-16 23:31:01 -07:00
Peter Johnson
1635cba827 Reduced minimum update rate from 100 ms to 10 ms. (#89) 2016-08-16 12:07:17 -07:00
Thad House
a786470623 Only allows 1 blocking call per Rpc Call Id (#93) 2016-08-15 22:46:49 -07:00
Thad House
4164e670d2 Adds Visual Studio Code files to gitignore (#92) 2016-08-15 22:44:36 -07:00
Peter Johnson
062470ef68 Add llvm::SmallSet. (#90) 2016-08-15 22:05:47 -07:00
Thad House
0b80bd2b09 Adds timeout capabilities to blocking Rpc Calls (#86) 2016-08-15 20:24:07 -07:00
Thad House
40365faeda Adds a static mutex to notifiers to stop destructor race condition (#204) 2016-08-15 19:56:32 -07:00
Peter Johnson
e1515299c2 Initial commit. 2016-08-14 12:38:13 -07:00
Thad House
776cb915bc Revert "PIDController queue now stores inputs instead of errors (#138)" (#205)
This reverts commit 7501ae65a1.
2016-08-13 23:49:31 -07:00
Thad House
5e9fe2f5cb Adds an ignore for Visual Studio Code files (#203) 2016-08-13 14:44:10 -07:00
Tyler Veness
7501ae65a1 PIDController queue now stores inputs instead of errors (#138)
Closes #29.
2016-08-12 22:04:44 -07:00
Peter Johnson
63469c00c4 run-tests-on-robot.sh: Save coredump on crash. (#201) 2016-08-12 19:18:48 -07:00
Fred Silberberg
3df257cdbb Set duplicate strategy for all jars and zips to prevent duplicates from occurring (#191) 2016-08-12 13:45:58 -07:00
Tyler Veness
45b8e9ab4f Renamed "pin" to "channel" and variables with underscores now use mixed case (#194) 2016-08-12 13:45:28 -07:00
Tyler Veness
227fdc1a60 Updated C++ style guide (#196)
include guard section now requires #pragma once, enumerators now exclusively use constant naming, and a mention of format.py was added to the "Formatting" section and CONTRIBUTING.md.
2016-08-12 07:14:49 -07:00
Tyler Veness
d347cebf67 Cleaned up odd formatting from static_cast by using "u" integer literal (#200) 2016-08-12 06:08:57 -07:00
Tyler Veness
3819cd0768 Updated cpplint.py and fixed its regexes for C-style casts (#193)
Additional C-style cast warnings thrown were also fixed.
2016-08-11 23:38:45 -07:00
Tyler Veness
e8f1fdda44 format.py now emits warnings for modified generated files (#195) 2016-08-11 23:10:10 -07:00
Tyler Veness
fd4719cb87 Fixed Doxygen comments for LinearDigitalFilter (#198) 2016-08-11 22:47:51 -07:00
Thad House
bc99d341fb Changes remote_name to remote_ip (#87)
Was confusing, as remote_name seemed like a name but wasn't.
Also changes remote_ip in the C api to use an NT_String
2016-08-07 16:38:20 -05:00
Tyler Veness
6ef4745d86 Added Joystick::GetAxisType() (#98) 2016-08-07 10:19:19 -05:00
Fredric Silberberg
0f9f7309e3 Sets the duplicate strategy to exclude in all zip tasks (#85) 2016-07-30 23:07:21 -05:00
Peter Johnson
e6244289ff Create dummy wpiutil library. (#84)
This will allow dependencies such as wpilibc to update to use wpiutil
without breaking "normal" ntcore static library use in the meantime.

This commit also restructures the gradle files by creating a new
(placeholder) wpiutil project, and moving the ntcore project into
a separate gradle file.  Added toolchains/native.gradle (refactored from
ntcore).

Also fixes ntcore skipJava on Windows by providing an alternate .def file
for this case.
2016-07-27 22:18:56 -05:00
Peter Johnson
30fbfe46e6 Create dummy wpiutil library. (#84)
This will allow dependencies such as wpilibc to update to use wpiutil
without breaking "normal" ntcore static library use in the meantime.

This commit also restructures the gradle files by creating a new
(placeholder) wpiutil project, and moving the ntcore project into
a separate gradle file.  Added toolchains/native.gradle (refactored from
ntcore).

Also fixes ntcore skipJava on Windows by providing an alternate .def file
for this case.
2016-07-27 22:18:56 -05:00
Peter Johnson
a73166a665 Make many more utility classes/headers public. (#76)
Moving these headers from src to include enables other libraries to use the
functionality provided.

* tcpsockets
* atomic_static
* raw_istream
* timestamp
* SafeThread
* Base64
* LEB128
* ConcurrentQueue

The classes have been moved into the wpi namespace as they're generic.
2016-07-27 00:39:38 -07:00
Thad House
62a980d3c8 Fixes Relay Constant Test (#189) 2016-07-26 13:53:45 -07:00
Thad House
866046edd1 Some general cleanups in the HAL (#188)
AnalogTrigger initialization checks are now in the correct order. Plus
frees no longer grab the structure if it is not needed.
2016-07-25 23:26:34 -07:00
Fredric Silberberg
8ac7e44f19 Updates gradle to 2.14.1 (#186) 2016-07-25 21:21:34 -07:00
Fredric Silberberg
d66f65e376 Updates gradle to 2.14.1 (#83) 2016-07-25 21:21:08 -07:00
Thad House
a831978cce Uses the fixed SensorBase functionality in the WPILib (#185) 2016-07-21 23:24:06 -07:00
Thad House
8da577b56f Moves FRCDriverStation to athena folder (#184) 2016-07-21 23:22:02 -07:00
Thad House
512ecf6490 Makes SensorBase checks use HAL check methods (#182) 2016-07-20 22:47:29 -07:00
Thad House
0901ae0808 Switches the HAL structs to use unique_ptr (#183) 2016-07-20 22:05:17 -07:00
Thad House
1ca291f20b Fixes a missed HAL_Bool change from int32 (#181) 2016-07-17 20:54:39 -07:00
Thad House
75eabfee1c Moves DriverStation HAL code to its own header and definition (#179)
To allow for future use as a plugin for the HAL simulator.
2016-07-17 19:42:33 -07:00
Tyler Veness
f7c3f13a7f Improve CircularBuffer documentation (#180) 2016-07-16 20:50:19 -07:00
Tyler Veness
57efd13f7f Replaced PIDController::Initialize() with delegating constructors (#178) 2016-07-16 12:50:17 -07:00
Thad House
7ddc153623 Fixes analog gyro casting to float then returning double (#177) 2016-07-15 18:13:51 -07:00
Tyler Veness
f9ebd3bde6 Fixed PIDController::GetError() for continuous inputs (#169)
Closes #31
2016-07-15 13:44:04 -07:00
Thad House
2c911b0f7a Adds a maximum time based cache to HALControlWord data (#158)
This is one of the calls with the delayed IPC. In the past, teams have
called an IsMode function so much that their code would start lagging.
This adds a cache, so the data is updated either when new data arrives
and we are notified of it, or after 50ms has passes since the last time
the cache was checked and updated.
2016-07-15 13:39:26 -07:00
Tyler Veness
1bf2d58db1 Reordered DriverStation functions in wpilibc and wpilibj to match wpilibc header (#166) 2016-07-14 20:50:38 -07:00
Tyler Veness
c93b5bedf9 Miscellaneous cleanups for wpilibc PID controller (#175)
* Reorder wpilibc PIDController's SetAbsoluteTolerance() and SetPercentTolerance() implementations to be consistent with header and wpilibj

* Added std:: prefix to fabs() calls in wpilibc PIDController
2016-07-14 13:51:32 -07:00
Thad House
dffaa0abb9 Moves HAL cpp headers from root to HAL directory (#174)
Could not include the ctre and NetComm folders, as those would require
changing ctre dependancies. Also removes a duplicated FRCComm header
that was not needed.
2016-07-14 00:17:29 -07:00
Tyler Veness
20c6525b1d Cleaned up wpilibj enums (#167)
* Converted enumerated constants in wpilibj to enums and made their implementation more consistent

* Reflowed text in JNI calls and updated JNI signatures
2016-07-13 23:39:58 -07:00
Fredric Silberberg
fe7165a8f7 Removed double-add of shared classpath. Fixes #157. (#164) 2016-07-13 22:20:30 -07:00
Thad House
d2aa168f66 Implements Better Error Messages from the HAL (#172)
* Makes the HAL provide a better error message for certain things.

* Makes Java error messages better

* Updates C++ errors.

* Moves handles header folder to HAL directory
2016-07-13 20:29:28 -07:00
Thad House
05c00430b3 Fixes CPP lint errors added to HAL. (#173) 2016-07-13 20:16:45 -07:00
Thad House
5305087162 Fixes a missed float to double change in the HAL. (#176) 2016-07-13 19:25:57 -07:00
Thad House
b979fc2a67 Adds SetDefault Java definitions to Def file (#82) 2016-07-13 01:53:26 -07:00
Thad House
58092c5190 Adds SetDefault methods to NetworkTables (#54)
There was no way to atomically check for a key in the table,
and then setting if it if non existant. Back before persistent
this was not a problem, however now it is, as its possible for
values to be added before team's robot programs start. This makes
the old method of calling Put*** methods in RobotInit invalid.
This adds SetDefault methods, which do this atomically.
2016-07-13 00:31:03 -07:00
Fredric Silberberg
6615a34e99 Added contributing and license files (#63) 2016-07-12 23:20:51 -07:00
Peter Johnson
50a2612839 Notifier: maintain freelist to reuse uids. (#81)
This avoids endless growth of the vector.

Fixes #80.
2016-07-12 23:19:46 -07:00
Tyler Veness
6251697f60 Added Lint task and parallelized format.py (#161) 2016-07-12 21:59:09 -07:00
Thad House
ea1a1e6bc3 Makes the CANJaguar error status messages more useful (#165)
The previous version would just return the class name for the
DigitalOutput port. Now it actually gets the dio port value for better
readability.
2016-07-12 21:53:51 -07:00
Thad House
edf5ecd4a0 Changes HAL Headers to be C compliant. (#171) 2016-07-12 21:53:06 -07:00
Tyler Veness
1b1ee7f9f3 Renamed spiGetSemaphore() to spiGetMutex() (#170) 2016-07-12 15:11:41 -07:00
Tyler Veness
3fade171f9 Fixed inconsistencies in documentation (#168) 2016-07-12 10:50:21 -07:00
Tyler Veness
c99e89dfca Fixed the remaining cpplint.py warnings (#160)
Replaced std::sprintf in BaeUtilities.cpp with std::stringstream and marked GetVisionErrorText() in FrcError.cpp as NOLINT
2016-07-12 10:46:34 -07:00
Thad House
b51e85ae26 Switches HAL to fixed length signed integers, and adds our own HAL_Bool Type (#155)
* Switches HAL to fixed length signed integers, and adds our own HAL_Bool type

* Replaces HAL Floats with Doubles

Doubles are just as fast as floats with optimizations turned on, so
switches to all doubles. All made doubles for consistency.

* Prepends HAL/ to HAL include files. Also fixes some range errors
2016-07-12 10:45:14 -07:00
Thad House
4a98e68815 Moves the DS new data wait calls down to the HAL. (#156) 2016-07-10 23:10:05 -07:00
Tyler Veness
0cb288ffba Fixes warnings thrown by cpplint.py (#154)
* Fixed cpplint.py [runtime/int] warnings

* Fixed cpplint.py [readability/casting] warnings

* Fixed cpplint.py [readability/namespace] warnings

* Fixed cpplint.py [readability/braces] warnings

* Fixed cpplint.py [whitespace/braces] warnings

* Fixed cpplint.py [runtime/explicit] warnings

* Fixed cpplint.py [runtime/printf] warnings

* Fixed cpplint.py [readability/inheritance] warnings

* Fixed cpplint.py [whitespace/tab] warnings

* Fixed cpplint.py [build/storage_class] warnings

* Fixed cpplint.py [readability/multiline_comment] warnings

* Fixed cpplint.py [whitespace/semicolon] warnings

* Fixed cpplint.py [readability/check] warnings

* Fixed cpplint.py [runtime/arrays] warnings

* Ran format.py
2016-07-10 17:47:44 -07:00
Tyler Veness
e44a6e227a Refactored wpilibj HAL JNI to simplify generating it from HAL headers (#109)
wpilibj FRCNetworkCommunication.java is now generated from HAL headers and was renamed to FRCNetComm.java
2016-07-10 16:24:57 -07:00
Tyler Veness
aafca4ed7f Reduced duplication between formatting scripts with Task base class (#80)
Also added scripts for EOF newline management and for removing trailing whitespace. configure.bat was rewritten to use CRLF line endings. Documentation for the existing scripts was also improved.
2016-07-10 08:33:27 -07:00
Thad House
ea6876e81f Some general HAL cleanups (#153) 2016-07-09 17:38:18 -07:00
Tyler Veness
aa9c2b2c92 Made Log.h use std::chrono (#136) 2016-07-09 16:58:31 -07:00
Thad House
43a2eccdc9 Finishes Prefix Renames (#152) 2016-07-09 01:12:37 -07:00
Thad House
b637b9ee4c Prepends all HAL functions with HAL_ (#146) 2016-07-09 00:24:26 -07:00
Thad House
5ad28d58ec Switches PWMs to do scaling at the HAL level. (#143) 2016-07-08 21:29:29 -07:00
Thad House
be2647d44e Switches Java to use HAL Constants (#145) 2016-07-08 00:08:07 -07:00
Thad House
4a3e3a6324 Changes DigitalSource API for HAL ease of use (#144) 2016-07-07 21:43:55 -07:00
Thad House
7597e3c274 Switches handle resources to dynamic arrays (#142) 2016-07-07 21:32:41 -07:00
Thad House
0a983eeeb8 Moves Gyros to the HAL (#131) 2016-07-07 21:31:45 -07:00
Austin Shalit
b036bf2e34 Add method to get the port number of a Joystick (#137) 2016-07-04 09:18:28 -07:00
Tyler Veness
73602e6cb4 Added missing include for robot startup macro (#135) 2016-07-03 23:24:56 -07:00
Thad House
72455280a9 Removes unneeded resource includes from WPILibC files (#134) 2016-07-03 23:18:45 -07:00
Thad House
ea95bb85aa Adds Constants from new constants class to encoders (#133) 2016-07-03 21:52:49 -07:00
Thad House
fb865d3ee7 Adds a special exception and status message for a handle error (#127) 2016-07-03 17:27:06 -07:00
Thad House
36ac37db8c Moves Encoders to Handles and Moves WPILib Encoders to HAL (#124) 2016-07-03 15:22:22 -07:00
Thad House
b45e0917ae Adds port constants to the HAL (#130) 2016-07-02 23:19:14 -07:00
Thad House
0e127679c1 Removes some unused variables from DigitalInternal (#128) 2016-07-02 16:33:19 -07:00
Fredric Silberberg
2f36d508c4 Gradle 2.14 (#118)
Updates the gradle version to 2.14. In doing so, some model elements have changed. Additionally, some redundant elements have been removed from the gradle scripts.
2016-07-02 16:32:14 -07:00
Thad House
cf29d4560b Moves HAL PCM objects to header and HAL namespace (#129) 2016-07-02 11:58:49 -07:00
Thad House
8c4ad62422 Switches Solenoids to Handles (#126) 2016-07-02 09:24:54 -07:00
Thad House
62c217cd01 Switches compressor to handles (#125) 2016-07-02 08:22:44 -07:00
Thad House
0f105a26f7 Switches Counters to Handles (#123) 2016-07-01 00:29:08 -07:00
Peter Johnson
eb4350033b Update Travis OS X build to use newest image. (#75)
Fixes #74.
2016-07-01 00:08:43 -07:00
Thad House
47694ef810 Switches DigitalPWM to Handles (#121) 2016-06-30 23:43:00 -07:00
Thad House
f77a976fbb Switches resource errors to AllocationExceptions in JNI (#122) 2016-06-30 21:39:55 -07:00
Thad House
3593ecb17e Switches PWM and DIO to Handles (#120) 2016-06-30 21:39:09 -07:00
Fredric Silberberg
384ad57d21 Updates Gradle to 2.14 (#78) 2016-06-30 19:57:29 -07:00
Thad House
9b2af0d090 Switches relays to handles (#119) 2016-06-29 19:58:14 -06:00
Thad House
e8e052712e Switches AnalogInputs and AnalogTriggers to Handles (#117)
Results in a breaking change to AnalogTrigger int constructor. If a user wants
multiple AnalogTriggers, they must use the AnalogInput constructor.
2016-06-27 21:32:30 -07:00
Thad House
77a1af44c4 Removes freePort from the HAL (#116)
It was a no-op, and most likely in the future it will be that way too.
Removing to clean up the API.
2016-06-27 13:38:33 -07:00
Thad House
5e2a76147c Moves handle definitions to main handle header (#115) 2016-06-27 13:36:38 -07:00
Thad House
e1d4845ccd Move Analog Outputs to Handles (#112) 2016-06-27 11:32:40 -07:00
PatrickPenguinTurtle
95d40ed01f Fixed issue with digital outputs used as pwm on mxp (#14)
When a digital output object that was tied to an mxp pin had enable pwm called on it
it would pwm on a pin 6 lower
 (although if this wasn't an mxp pin it wouldn't do anything at all.)
Fixed in Digital.cpp by adding 6 if it is an MXP pin in setPWMOutputChannel()
This should fix the CanJaguar test because when digitalOutputs used as PWM
were freed, the PWM generator was set to the number of pins, which meant it
was actually outputing on pin 20.

Change-Id: Ib48db3e6e3bf78659622145969d24011cc231ea6

Updated Hal to include some documentation about swaping mxp pins.

Cannot find NI related documentation as to the pin numbers being wrong though

Change-Id: I71d84431dc9bc7bf22aa29b6633e49723311b5f7

fixed formatting on changed files

Change-Id: I5b7c16cd798132b6b20c1d03f334a95b42d2ee11
2016-06-24 19:46:43 -07:00
Tyler Veness
aa22d4c33b Clarified that PID controller runs in discrete time (#107)
This was added to explain the apparent oversight with respect to controller behavior with different sample rates.
2016-06-20 23:25:23 -07:00
Thad House
046e043c4e Moves Interrupts over to Handles instead of pointers (#99) 2016-06-20 23:22:48 -07:00
Thad House
74fc10999b Fixes preferences formatting (#108) 2016-06-20 22:17:40 -07:00
Tyler Veness
cee9b2609d Added std:: prefix to more C standard library uses (#106) 2016-06-19 00:19:45 -07:00
Tyler Veness
daa0260a4e Deduplicated UsageReporting definitions (#104) 2016-06-19 00:15:57 -07:00
Tyler Veness
d66c61a36e Cleaned up robot startup and cleanup/shutdown code (#77)
Cleaned up RobotBase, removed singleton list from SensorBase, and removed unused typedefs and NULL_TASK macro from HAL's Task.hpp. Making the robot class instance static fixed non-POD statics used by the instance during destruction from being destroyed first.
2016-06-19 00:13:18 -07:00
Tyler Veness
ecc210f99a Rename Notifier::m_handlerMutex to Notifier::m_notifyMutex (#105)
A month ago, we discussed renaming this mutex to better reflect its current use, and this commit does that. The inline comment was also updated.
2016-06-18 02:20:29 -07:00
Thad House
3cacc2aba6 Switches indexed handles to shared_ptr (#101)
As discussed, the old method of was going to have issues, and was not
going to help in the case of the structs containing pointers. I think we
are just going to have to be careful, as guarenteeing the internal
pointers are const is going to be very difficult.
2016-06-18 00:59:53 -07:00
Peter Johnson
085c47b671 Unbreak wpilibc WritePreferencesToFile test. (#103)
ntcore recently changed GlobalDeleteAll() to not delete persistent values.
This test was relying on the old behavior to provide a clean slate.
2016-06-18 00:58:22 -07:00
Peter Johnson
4b516de183 Don't delete persistent entries in DeleteAllEntries. (#71)
This is a behavior change but without it DeleteAllEntries is dangerous and
not very useful, so I consider the current behavior to be a bug.
2016-06-17 22:33:02 -07:00
Peter Johnson
c7d9ecbab3 Fix mac build by not defining false and true. (#73) 2016-06-17 22:32:18 -07:00
Thad House
039515082a Fixes formatting in error.cpp (#102) 2016-06-17 21:35:00 -07:00
Thad House
c3908660b1 Switches all HAL Handle errors to be zero (#100)
As discussed, we don't really need the error checking specifically, as
we are just going to throw exceptions anyway, so this will make sure you
can check for 0 and be sure you catch any handle errors.
2016-06-17 20:21:25 -07:00
Tyler Veness
b2795af2b8 Added note that multilib GCC is required when building the native version on 64 bit Linux (#66)
Without a GCC installation that can build both 32 and 64 bit executables, the native build will fail on 64 bit Linux machines with an error about unsigned __int128 being undefined. GCC does not support __int128 on 32 bit targets, and GCC was using it via a standard library implementation header intended for 64 bit machines.

Instances of "arm" were replaced with "ARM" where the acronym was intended.
2016-06-11 02:55:46 -04:00
Thad House
6c6c087e30 Fixes .gitignore ignoring needed files (#68)
ntcore.def and build.gradle were being ignored, which could cause issues
if those files ever got deleted.
2016-06-11 02:52:24 -04:00
Peter Johnson
3c77faaf61 Fix UTF8 conversion in Java. (#70)
Java doesn't use standard UTF8, so surrogate pairs were being converted
incorrectly and incompatibly with C++.

Fixes #69 (artf3973).
2016-06-10 22:24:42 -04:00
Thad House
fc515f4572 Changes HAL Port from a pointer to a handle (#93)
HAL Port is using a special handle, where the module and pin are bit
shifted straight into the handle. This is one of the few special cases
we have, but for the way port is used it is much cleaner and uses much
less memory.  Plus it is generic and not specific to one type.
2016-06-05 15:23:58 -07:00
Tyler Veness
5a82f73d9b Replaced .h C headers with c-prefixed version and added std:: prefix to C standard library usage (#90)
This was not done to stdint.h for brevity in type names. Also removed "using namespace std;".
2016-06-05 07:33:37 -07:00
Thad House
776a991d61 Moves Notifier over to handles (#97)
Internally, the linked list now uses shared_ptrs instead of raw
pointers. In addition, in the WPILib the notifier handle is now made
atomic. Then before the class is destructed, the handle is now set to 0.
This should help solve one of the existing race conditions. A 0 handle
is correctly handled down at the HAL level.
2016-06-05 07:29:47 -07:00
Thad House
8527f2c2a1 Fixes HandleResource classes (#95)
Issues were found when adding unit testing. The classes should now work
properly.
2016-06-03 11:24:58 -07:00
Thad House
c85b72b952 Fixes a few bugs in the initial handle implementation (#94)
Failure to check for invalid type on handle creation, and handle type
check was broken.
2016-06-01 20:12:50 -07:00
Peter Johnson
f0d9e19b5c ErrorBase: change to ostringstream. (#66)
This fixes a snprintf issue on 64-bit platforms by avoiding the use
of snprintf.
2016-06-01 00:12:55 -07:00
Tyler Veness
c7c011813f Made include ordering/organization more explicit in style guide (#86) 2016-05-31 23:46:44 -07:00
Thad House
d76f0d4022 Adds support for Handles to the HAL (#91)
Handles will be replacing opaque pointers in the HAL for better compatibility and easier error checking. This commits adds the initial resource manangement and definition for handles.
2016-05-31 23:45:47 -07:00
Peter Mitrano
de7678f2fc remove author requirement for now (#84)
waiting on a fix from pullapprove
2016-05-30 11:02:37 -04:00
Tyler Veness
2f7eff7091 Removed @author from comments (#88)
Keeping @author lines in the comments serves no functional purpose.
2016-05-29 09:24:04 -07:00
Tyler Veness
7a402b4170 Replaced "RoboRIO" with "roboRIO" in comments (#87) 2016-05-29 09:19:43 -07:00
Peter Johnson
10b4814e60 VisionAPI.cpp: Remove non-UTF8 characters. (#85) 2016-05-29 09:17:01 -07:00
Tyler Veness
613309c0a2 Replaced wpilibj class Init() methods with delegating constructors (#79) 2016-05-27 00:06:47 -07:00
Thad House
c622c03eff Places while loop around DS wait condition. (#83)
In case of Spontaneous wake ups, we should be checking a condition
variable as well.

Note that we can not use the existing m_newControlData, as that has a
possible race condition with existing user code that it does not look
like we could work around.
2016-05-26 23:05:08 -07:00
Thad House
ed7d2d6aa6 Splits the HAL Analog Implementation Files (#82) 2016-05-26 22:14:25 -07:00
Tyler Veness
51ff9e9f69 Classes which use I2C or SPI now do so via composition rather than inheritance (#72) 2016-05-26 21:37:23 -07:00
Tyler Veness
9f2f301fa4 Deduplicated FRC network communication headers (#71)
The network communication headers were moved to the include directory of the HAL and their copies were removed from wpilibc. Also, symModuleLink.h was removed because the function which it prototypes hasn't been used in WPILib since the roboRIO switch.
2016-05-26 20:20:58 -07:00
Tyler Veness
fa8bb3fa91 Remove obsolete timer functions and replace with std::chrono (#64)
Removed delayTicks(), delayMillis(), delaySeconds(), HAL_NO_WAIT, HAL_WAIT_FOREVER,
niTimestamp32(), and niTimestamp64().

Replaced clock_gettime() and usleep() with std::chrono.
2016-05-26 20:19:23 -07:00
Jonathan Leitschuh
4af0bbddee Add Travis Badge to ReadMe (#81)
This provides a quick navigation link to our travis build.
Additionally, it makes it so that the master build status can be confirmed quickly.
2016-05-26 15:54:12 -07:00
Tyler Veness
4aca3c2022 Removed extraneous curly braces around std::lock_guards in PIDController class (#78) 2016-05-26 12:59:34 -07:00
Tyler Veness
753ab85efb Removed commented out includes and imports (#76) 2016-05-26 12:59:01 -07:00
Thad House
da6b8c7ae1 Split HAL Digital Implementation files (#59)
Split to match the new headers. Uses a namespace 'hal' for internal functions and globals.
SPIAccumulator merged back into SPI header, as it was not a good split. Analog
accumulator will move back to analog input when the analog split is done.
2016-05-26 12:56:39 -07:00
Tyler Veness
305ab08f1c Renamed DriverStation::IsSysBrownedOut() to DriverStation::IsBrownedOut() to match the Java version. This changes the external API. (#67) 2016-05-25 23:09:24 -07:00
Tyler Veness
e9718fc7bf Replaced NULL with nullptr in C++ source files (#70) 2016-05-25 23:07:45 -07:00
Tyler Veness
8566878af4 Fixed C++ simulation build with Boost 1.60 (#49) 2016-05-25 22:41:58 -07:00
Tyler Veness
62812faf62 Clean up include guards and EOF newlines (#65)
* Replaced include guards with #pragma once

* All source files now have exactly one newline appended

Some files had either two newlines at the end or none (which isn't POSIX compliant). This patch fixes that.
2016-05-25 22:40:15 -07:00
Tyler Veness
d82635bbe1 Reordered headers according to the style guide (#58)
Subsections are alphabetized according to lexographic ordering. Also, HAL includes were moved from headers to source files where possible. This change may cause user code which uses HAL functionality and does not include the relevant HAL header (since it may have been provided by another WPILib header) to fail to compile.
2016-05-25 22:38:11 -07:00
Tyler Veness
a598e2d09b format.py: add missing 'sys' import (#69) 2016-05-25 21:11:43 -07:00
Tyler Veness
b5b2f0c7d8 Fixed typo in LinearDigitalFilter documentation (#62) 2016-05-25 20:27:34 -07:00
Tyler Veness
e6f6d24780 Removed empty default constructors and destructors from Gazebo plugins (#63) 2016-05-25 20:26:01 -07:00
Tyler Veness
21b2aabf18 Removed unused DS_LOG() macro (#61) 2016-05-25 20:25:06 -07:00
Tyler Veness
74f9da9da1 artf2612: Added Python script for updating license in source files (#57)
This is a follow-up of 3cd1253. A C++ program was written to automate the license update originally. That program was translated to Python so it can be kept in the repository and run when needed. It has been tested on Windows using the standard Python 3 installation and on Linux.

The original version skipped files that had "//" at the beginning since most were files that should be excluded. The relevant files are now in an exclusion list and the rest are processed normally. The .hpp file extension has been added as well. The script rewrote CompressorJNI.cpp to remove the carriage returns from its line endings.
2016-05-25 20:23:37 -07:00
Peter Johnson
e63830ed21 format.py: Fix running from styleguide directory on Windows. (#55) 2016-05-24 22:33:13 -07:00
Peter Johnson
eb51de65e5 format.py: Error out if no files found to format. (#56)
This can happen if the script is run from a directory other than the
project root or styleguide.
2016-05-24 22:16:53 -07:00
Peter Johnson
565a125dad Reformat for recent commits (#54) 2016-05-24 22:16:21 -07:00
Peter Johnson
3af8e7e9fd ControllerPower.cpp: Use quoted include instead of bracket for HAL. (#53)
This is consistent with all other source files.
2016-05-24 20:59:33 -07:00
Peter Mitrano
e3eae023da Cleanup of gazebo plugins (#46)
* Upgraded plugins for gazebo 7
* Fixed documentation on sensors
2016-05-24 20:27:24 -07:00
Thad House
6d9b3b0aaa Splits HAL Digital and Analog Headers into multiple headers (#52)
The Digital and Analog headers (and the implementations, but that will
be moved over later) are just too big and congested. This splits those
headers, and then changes the few things that needed to be changed in
WPILib to get the code working again. No function changes were made in
this commit.
2016-05-24 00:58:10 -07:00
Tyler Veness
9e99df1cf7 Removed sync group from SpeedController interface (#51)
CANJaguar is the only motor controller using sync groups, so that feature doesn't belong in an interface used by all motor controllers. If teams want to use sync groups, they should cast to the appropriate motor controller type themselves.
2016-05-23 20:42:58 -07:00
Thad House
e842ff7ad5 Explicitly stop the PIDController Notifier in the destructor (#48)
This helps reduce the probability of a PID Controller Segmentation Fault.
2016-05-22 23:24:10 -07:00
Peter Johnson
21b1e39b2a HAL Notifier: Use freelist to avoid use-after-free race. (#50)
As the notifierMutex is unlocked while the callback is being called in
alarmCallback(), it's possible for next to be invalidated due to a
cleanNotifier() call.  Now, instead of deleting the notifier immediately,
add it to a freelist to be cleaned up at the tail end of alarmCallback.
2016-05-22 23:21:45 -07:00
Thad House
8fc55c80a9 Renames all our .hpp HAL files to .h (#44)
Adds consistency, as the HAL was .hpp however all other code was .h.
2016-05-22 21:41:22 -07:00
Tyler Veness
248ca0c4a0 Added verbose flag to format.py (#47)
Making the "Processing" lines only print with a verbose option keeps the output clean.
2016-05-22 21:40:30 -07:00
Tyler Veness
0d655d7cec Ran formatter again (#45)
The previous wpilibc reformat missed an issue with CANTalon.h, and a patch merged since then didn't run the formatter.
2016-05-22 21:39:33 -07:00
Peter Mitrano
e71f454b9d Renamed folders for consistency, using sim/athena/shared schema (#27)
Rename the following folders:
hal/lib/Athena -> hal/lib/athena
hal/lib/Desktop -> hal/lib/sim
hal/lib/Shared -> hal/lib/shared
wpilibc/Athena -> wpilibc/athena
wpilibc/simulation -> wpilibc/sim

Windows users may need to run gradlew clean after updating.
2016-05-22 14:55:51 -07:00
Thad House
54092378e9 Changes HAL to return -1 to 1 for joysticks (#35)
First part of the HAL changes. Returns -1 to 1 for joysticks instead of
-128 to 127. Implemented by replacing the old structure with a new
structure that uses floats instead of shorts.
2016-05-21 01:42:16 -07:00
Thad House
a4f0c4fbe0 Implements locking in C++ DriverStation, and adds double buffering to DS Thread (#25)
Currently, about 5ms of every 20ms loop the DS thread would hold
the mutex, while grabbing data. During this time, and call to grab
joystick data would be blocked. This change grabs the joystick data
to a cache, and then grabs the mutex and moves the data references
around. This is much more efficient then the old code, and gives
teams more of their teleop loop time back for use.

Another major change this does is use preallocated arrays when entering
the JNI. Previously every JNI DS call would allocate an entire new array.
With a GC'd language where those arrays go on the heap, thats a problem,
and creates tons of garbage. That garbage is no longer created anymore,
as all arrays and byte buffers sent to JNI in the DS are preallocated.

In addition, GetJoystickName was always returning joystick 0 data, which
this fixes.
2016-05-21 00:41:15 -07:00
Omar Zrien
0965d60a71 Fixed a bug where using the two parameter constructor for CANTalon could cause invert-direction to not be initialized. (#26)
Original fix from Jacob Caporuscio
2016-05-20 23:08:35 -07:00
Peter Mitrano
f2d601d834 Use interrupt() in our interrupt exceptions (#24) 2016-05-20 23:06:07 -07:00
Tyler Veness
e14e45da76 Add format script which invokes clang-format on the C++ source code (#41)
On Windows machines, clang-format.exe must be in the PATH environment variable.
2016-05-20 17:30:37 -07:00
Peter Mitrano
68690643d2 Fix travis configuration to include compiling sim (#28) 2016-05-20 18:58:49 -04:00
Jonathan Leitschuh
00b2902102 Converts non hardware dependent tests to unit tests (#10) 2016-05-20 12:15:14 -07:00
Jonathan Leitschuh
975568c774 Adds Error Prone as compile time check to java projects (#13) 2016-05-20 10:48:41 -07:00
Jonathan Leitschuh
a834fff7b2 Applies Google Styleguide to Java parts of the library (#23)
This was partially applied to simulation but
simulation is a bit of a mess and has a lot of duplicated code.
2016-05-20 09:07:40 -07:00
Jonathan Leitschuh
64ab6e51fe Create .pullapprove.yml (#42) 2016-05-19 14:33:48 -04:00
PatrickPenguinTurtle
05a2089816 Fixed PCM tests by raising tolerance slightly (#15)
The PCM tests recently were failing by being slightly higher than voltage than expected. raised the tolerance to account for this.
Voltage was still clearly less than the on state while in the off state.

Change-Id: I8ac28867024f3ce7b4104fc03622e6133ac2b80f
2016-05-14 16:09:32 -04:00
Jonathan Leitschuh
6272244a73 Adds error-prone to check java code 2016-05-13 21:17:20 -07:00
Jonathan Leitschuh
a532518056 Adds all relevent tools to gitignore 2016-05-13 21:10:41 -07:00
Peter Johnson
320db8df18 Add .clang-format. 2016-05-13 21:05:56 -07:00
Jonathan Leitschuh
b827f484be Add Slack Notification from Travis (#11) 2016-05-12 18:05:02 -04:00
Jonathan Leitschuh
000a98f193 Fix apt-get update -q causing build to fail (#20)
`sudo apt-get update -q` can fail a site doesn't respond.
This is the solution proposed here:
Related https://github.com/travis-ci/travis-ci/issues/5221
2016-05-12 17:51:57 -04:00
Fredric Silberberg
bb64dd3546 Updated README, and added in CONTRIBUTING. This adds tables of contents,
as well as fixing a few other issues.
2016-05-12 14:20:20 -04:00
Jonathan Leitschuh
d1fb8cc209 Merge pull request #60 from wpilibsuite/build/appveyor
Adds appveyor build config
2016-05-12 11:57:35 -04:00
Jonathan Leitschuh
7d33059c20 Add appveyor badge to readme 2016-05-11 18:47:39 -04:00
Jonathan Leitschuh
d0c40b5ce2 Fixes indentation in .travis.yml 2016-05-11 15:06:06 -04:00
Jonathan Leitschuh
6794ff9ce8 Add Travis Build Configuration 2016-05-11 14:57:22 -04:00
Jonathan Leitschuh
ed0f197d1b Adds appveyor build config 2016-05-11 14:17:55 -04:00
Jonathan Leitschuh
25ad7a6230 Merge pull request #59 from wpilibsuite/build/osxTravisBuild
Adds OSX Build to travis
2016-05-11 14:12:28 -04:00
Jonathan Leitschuh
5fb31baea6 Adds OSX Build to travis 2016-05-11 13:45:53 -04:00
Jonathan Leitschuh
ffb384ebfc Add Travis Badge to ReadMe 2016-05-11 11:54:15 -04:00
Jonathan Leitschuh
95098c5496 Add required apt packages to travis 2016-05-11 11:43:03 -04:00
Jonathan Leitschuh
3862668420 Add Travis config file 2016-05-11 11:32:02 -04:00
Tyler Veness
083362bd86 Removed {@inheritDoc} from C++ sources and readded .inc files to Doxygen extension mapping
{@inheritDoc} doesn't exist in Doxygen, so I removed instances of it from the C++ source. It isn't needed anyway because Doxygen automatically fills in base class documentation for member functions in derived classes if no documentation is given. The extension mapping for .inc files was accidentally removed during the build system changes so this commit adds it back in.

Change-Id: I599e3bdafd76ee7d78a66090d81707cda5a399d7
2016-05-11 02:11:00 -07:00
Thad House
0f228e7b7d Implements a common PWMSpeedController base class
There was a lot of duplicated code between all 7 PWM speed controllers.
This moves all the duplicated code down to a base class, that will make
it easier to add speed controllers in future years if needed again. Also
if we need to add a method to all speed controllers, we only have to do
it in 1 place, and not 7.

Change-Id: I25eb1d097c0f5f7dbd7656db2f4a30d006d50f98
2016-05-11 01:01:31 -07:00
Tyler Veness
686f5d9fef Fix incorrect comments in the HAL I2C functions and incorrect return values for some I2C class member functions.
These issues were found and fixed while interfacing with an ITG3200 gyroscope. Fixes artf4173.

Change-Id: Id3c6b34aa707650480e90605e98ae1b44d7a7b98
2016-05-11 00:24:15 -07:00
Tyler Veness
ad8763fc8d Removed unused pcre.h header. If regexes are needed in the future, use C++11's regex header.
Change-Id: I0284943f3f09bbe9184885da6a486b82f73fd089
2016-05-10 23:12:36 -07:00
Thad House
1011b56b4c Fixes notifier restart error when last notifier is deleted
This actually isn't a large issue, since the HAL automatically creates a
notifier at the beginning to handle the time rollover, but during
testing without that, I noticed that deleting the last notifier would
disable notifiers for the entire lifetime of the program. This seemed to
be caused by the CLOSEST_TRIGGER static variable not being reset, and
causing new notifiers to never be added to the queue. This fixes that.
Not a bug that can be seen normally, but still a bug.

Change-Id: I6ac61c632918c90972cd0664aa833e3bc9e8c535
2016-05-10 23:06:13 -07:00
Peter Johnson
5904314a75 Improve ADXRS450 error detection.
Ensure the POR, PWR, and CST error bits are not set when reading the sample.

Reported by: Jared Russell, Austin Schuh

Change-Id: Ib38178d6b51880480aee86e13c16f9ba89a80693
2016-05-10 23:04:54 -07:00
Thad House
e852547344 Makes Java Timer timing more accurate
Java was using integer division for calulating Timer values, which
was causing Timer values to be concatinated, and only accurate
to the nearest millisecond. This changes it to use double division,
which matches C++ and makes timing much more accurate

Change-Id: I61b893f4ad5791bf4dfdd767ee4346c1ed4ea418
2016-05-10 23:02:35 -07:00
Peter Johnson
fa8b68419f Make Java AnalogGyro.getAngle() thread-safe.
In the Java implementation, "result" is an instance variable (to avoid
needing to perform a memory allocation on each call to getAngle).  However,
this means that calls to getAngle() from multiple threads can step on each
other.  Synchronize the method to avoid this issue.

Reported by: Jackson Gray (http://www.chiefdelphi.com/forums/showthread.php?threadid=145124)

Note this does not synchronize accesses between configuration methods such
as calibrate() and accessor methods such as getAngle().

Change-Id: I9ecc962d4fba66f6134fd801cfd607f155b41fe5
2016-05-09 20:36:36 -07:00
Fredric Silberberg
ec13d00b18 Fixed gradle build issue where files were not getting added to the wpilib java jar correctly.
Change-Id: I6c3cdd9906a94ff2d00340eb060a629d26c39a4a
2016-05-09 12:53:29 -07:00
Peter Johnson (294)
36447d86d8 Merge "Clear error buffer total when clearing the buffer contents" 2016-05-05 23:30:50 -07:00
Peter Johnson
5ac68f74d4 Support client round robin to multiple server addresses.
Change-Id: If87dc64a485b1c8a340c5f6fa39ca09d40133e30
2016-04-08 22:02:52 -07:00
Peter Johnson
b8ad1de33c Make members of ConnectionInfo and EntryInfo public. 2016-04-08 13:08:07 -07:00
Joe Ross
1e14403b3b Update POV documentation with examples of POV angles
Change-Id: If0f5b75366785b94a97b02694667fc00f8bfe196
2016-03-19 14:06:38 -07:00
Dustin Spicuzza
bee507eda8 Clear error buffer total when clearing the buffer contents
- Reported by Eli Barnett
- See http://www.chiefdelphi.com/forums/showthread.php?p=1559160`

Change-Id: I0efa4584452940bdfab3cc57c1823a8b33d387ff
2016-03-17 21:27:44 -04:00
Fredric Silberberg
16343bbe71 Updated release to version 5. 2016-03-01 15:55:19 -05:00
Peter Johnson
623a5fcf8d Fix C++ CameraServer request handling.
The request is not guaranteed to be in a single packet, so it may be necessary
to perform multiple reads to get the complete request.  The previous code
could unpredictably fail as it only performed a single read.

Fixes artf4817.

Change-Id: I7734a12e1a2542f5d7ca0889453c387f0bb30538
2016-02-24 00:18:59 -08:00
Fredric Silberberg
6bd1654b80 Updated release number for the new release
Change-Id: Ib05f1db442cd1eacd77653c0e0984a5337609f7b
2016-02-11 16:12:35 -05:00
Fredric Silberberg
952ebb11ad This adds StopMotor() to the SpeedController interface for C++ and Java.
For Java, this is as simple as just adding it, as all motors already
have an implementation from MotorSafety that is correctly resolved. For
C++, I had to override StopMotor in the classes that descend from
SafePWM and explicitly call the SafePWM version. RobotDrive now calls
StopMotor on each of its SpeedControllers, instead of calling Disable or
setting the motor to 0.0 as it was doing previously.

Additional small formatting corrections to the previous commit starting
this were added.

Change-Id: Ie94565394927a910ce74bc628670ac3d658d8df9
2016-02-11 12:19:52 -08:00
Brad Miller (WPI)
91c5db06db Merge "More updates to the Gyro test fixing potential null pointer exception" 2016-02-11 11:17:06 -08:00
Omar Zrien
df33a78221 Added Config routine to allow enabling/disabling of limit switch and soft limits. This improves upon the ConfigLimitMode routine, which does not allow certain combinations of enable/disabled limit features.
Also keeps parity with LV and Java.

Change-Id: Id2f4c9f169effc6bc3ea48529e8f04f387609ddc
2016-02-11 09:11:30 -08:00
Brad Miller (WPI)
a33076ab9a Merge "Add an additional member variable for "stopped" which indicates the CAN motor controller has been explicitly stopped, but not disabled by the user (main use case is MotorSafety tripping). When Set() is called the next time the controller will be re-enabled automatically." 2016-02-10 08:33:39 -08:00
Peter Johnson
f80312b86b Merge pull request #52 from robotdotnet/master
Fixes Connection Listeners
2016-02-08 23:55:10 -08:00
Thad House
836dc7a880 Fixes Connection Listeners
AddConnectionListener was returning the uid of entry listeners, which
would make connection listeners not work.
2016-02-08 15:40:34 -08:00
Kevin O'Connor
d567bd0bca Add an additional member variable for "stopped" which indicates the CAN motor controller has been explicitly stopped, but not disabled by the user (main use case is MotorSafety tripping). When Set() is called the next time the controller will be re-enabled automatically.
Change-Id: Ib1c0e5d0ddd55343d83039acbc46c0f9c4e451a1
2016-02-08 18:13:57 -05:00
Patrick
f436b33d79 More updates to the Gyro test fixing potential null pointer exception
also retuned the deviation over time test to make it pass more reliably.
Ran sucessfully 40/40 times run including several run with the entire wpilibj

Change-Id: I2e42c368fdb81f9206e15ce39878ea105da1e405
2016-02-08 15:03:51 -05:00
Peter Johnson
7283293887 Merge pull request #51 from robotdotnet/RemoteChanges
Adds extended Remote Connection Listener
2016-02-08 01:19:02 -08:00
Peter Johnson
3c3b2c75c0 Rate-limit duplicate error messages to avoid flooding console.
Fixes artf4809.

In both C++ and Java, error messages are being sent to both the console
(via stdout/stderr) and being reported via the HAL.  We don't want to
remove the stdout/stderr reporting at present because users debugging only
via netconsole (e.g. using riolog) won't see the HAL-reported errors.  Until
there's an alternative means to getting the HAL-reported errors to those
users, instead store the previous 5 error messages and don't duplicate them
more often than once per second.

Changes the error reporting from setErrorData() to sendError(), which
improves driver station error reporting.  The "location" in C++ is given as
the immediate caller (e.g. the WPILib function).  The "location" in Java is
given as the first user function in the call stack.  Note the full call stack
is provided in both instances.

Change-Id: I590dd63dcb66825301ebb260aff00cd8d7d501ed
2016-02-08 01:14:56 -08:00
Thad House
710bd586d5 Adds extended Remote Connection Listener
Since we now get ConnectionInfo when setting a connection listener,
there is some good information in there that teams could use.
Implemented using default interface methods, so teams should see no
change if they don't implement the Ex methods.

I noticed that the connection listener methods don't exist at all in
C++, so they did not get added there.
2016-02-06 23:28:19 -08:00
Brad Miller (WPI)
f17d27aacf Merge "artf4818: Fix CAN Talon JNI references with underscores." 2016-02-06 09:38:26 -08:00
Brad Miller (WPI)
94629bcb78 Merge "Updated PDP port of Talon and disabled PDP tests for Victor and Jaguar since the Victor and Jaguar don't draw enough current for the PDP to read above 0. PDP tests for both java and cpp only test the Talon now." 2016-02-06 08:45:44 -08:00
Patrick
4a6f55b61d Fixed the gyro deviation over time test
Also modified the testgyroCalibratedParameters to reduce code duplication.

Change-Id: I356562df4e9da1848d84e82ee82c5fbfc47d7d31
2016-02-02 13:38:51 -05:00
Joe Ross
fdfedd12fc artf4818: Fix CAN Talon JNI references with underscores.
Add test to verify bindings are correct

Change-Id: I766f2d7ff32a1bee2289974e331a4d8d5d563a35
2016-01-31 20:30:37 -08:00
Brad Miller (WPI)
ae1171d1be Merge "Fixed the motor tests by reducing speed to within the limits of the encoders we use. Also fixed java pid tolerances since getAvgError() was broken. It is now fixed and works properly. Added tests for both java and cpp that test if pid tolerances are working using fake input output pairs." 2016-01-31 09:48:51 -08:00
Patrick
6b356020f3 Updated PDP port of Talon and disabled PDP tests for Victor and Jaguar since the Victor and Jaguar don't draw enough current for the PDP to read above 0. PDP tests for both java and cpp only test the Talon now.
Change-Id: I84b2f168b27d07b444e223ae225013b6e97edde3
2016-01-29 14:49:58 -05:00
Patrick
7041cbc5eb Fixed the motor tests by reducing speed to within the limits of the encoders we use. Also fixed java pid tolerances since getAvgError() was broken. It is now fixed and works properly. Added tests for both java and cpp that test if pid tolerances are working using fake input output pairs.
Change-Id: I5bf23dbbdab996c582e1035fc2b2f36dd5f52417
2016-01-28 14:47:15 -05:00
Peter_Mitrano
f24c8b1b8d Fixed robot drive for C++ Simulation
initial values for m_invertedMotors is now 1
previously it was done in some of the constructors, but not all of them.

Change-Id: I2c1ce8d8a67f82d02c4c51f1c4d1aaad143f3112
2016-01-25 12:03:48 -05:00
Fred Silberberg (WPI)
d62256156e Merge "Update version number for Release 3 Print distinctive message on robot program startup Change-Id: Ic91b81bd298ee6730503933cf0e733702e4b4405" 2016-01-24 16:07:23 -08:00
Brad Miller
61dbd43664 Update version number for Release 3
Print distinctive message on robot program startup
Change-Id: Ic91b81bd298ee6730503933cf0e733702e4b4405
2016-01-24 18:31:23 -05:00
Brad Miller (WPI)
f913b5de8c Merge "Removed publishing of java sim jar" 2016-01-24 15:27:54 -08:00
Omar Zrien
bd3e068f3b PDP Classes should support any PDP address
Change-Id: I3a8586e099559ee51449185734b89aaa6cd075d6
2016-01-22 23:53:49 -05:00
Peter Johnson (294)
cb4cc63221 Merge "Added -pthread" 2016-01-22 13:44:47 -08:00
Fredric Silberberg
838d8abf63 Added -pthread
Change-Id: Iea1553c9632fb270d56140a046cffa5258ce6d2d
2016-01-22 14:18:52 -05:00
Peter Johnson
94bd629b80 Merge pull request #48 from ThadHouse/master
Load ntcore from path if extracted load fails
2016-01-21 21:53:04 -08:00
Fred Silberberg (WPI)
c6ff69079a Merge "Remove maven local as a possible search location" 2016-01-21 15:40:44 -08:00
Omar Zrien
5d3ac3ea71 Another improvement to HAL-joy getting to ensure it works in future RIO image updates.
Change-Id: I1f396b151e42dfd2b31de1fabde24b2988e8b599
2016-01-21 14:52:51 -08:00
Peter_Mitrano
f9e87f0cce Removed publishing of java sim jar
This causes the name of the jar to change, and thus fail to be included
in the simulation zip. There is no need to publish java sim jar.
Also added dependency on jar being built before zipping it

Change-Id: I1fa3dcf405d7da78a8d112381ecc3bfb2d6d367b
2016-01-20 15:15:02 -05:00
Thad House
73d6e98bf2 Loads ntcore from path if extracted load fails
There's a lot of buzz going around the internet about people trying to
get ntcore working on other devices. One of the things that makes it
harder is having to have a separate jar for each platform. What this
change does is if the loading of the extracted library fails, it will
attempt to load ntcore from the path. This means that a program like
GRIP can just provide the libntcore.so and not have to worry about
compiling different versions for different platforms.
2016-01-18 22:39:27 -08:00
Peter Johnson
8801568325 DriverStation::GetJoystickName(): Make work for stick>0.
Change-Id: I1c62742cf8b80c81d21c2198f966c8151a758a01
2016-01-15 10:45:20 -08:00
Peter_Mitrano
75a91e24ef Remove maven local as a possible search location
maven caches are not stored in maven local, and searching here can
cause problems for building simulation.

Change-Id: Id106e80cfb9129431fd43500b06f879e7c682115
2016-01-15 11:56:35 -05:00
Brad Miller (WPI)
6adf4c48cd Merge "Fix HALGetJoystickDescriptor()." 2016-01-15 08:44:03 -08:00
Brad Miller (WPI)
026c427a2b Merge "Fixed Simulation C++ API" 2016-01-15 08:43:31 -08:00
Peter_Mitrano
63878d8ab7 Fixed Simulation C++ API
Fixed API in the following classes:
 - RobotDrive
 - AnalogGyro

moved some files from Athena the shared that are independant of platform
Renamed Gyro to AnalogGyro
added smart pointer constructors to RobotDrive

Change-Id: If8a1bde5aed77fd60869d1993c302dd519bc8848
2016-01-15 11:26:16 -05:00
Peter Johnson
83f902f2f6 Fix HALGetJoystickDescriptor().
This reverts the previous commit instead fixing it at the root
HALGetJoystickDescriptor function, which also fixes use of that function
by the C++ DriverStation class.

Change-Id: I1f203a015d8f10d119c61635def2822bf124754c
2016-01-14 21:49:50 -08:00
Peter Johnson
c90a8c586f getTable(): Don't prepend slash if key already starts with it.
This makes getTable("/foo") and getTable("foo") equivalent.
2016-01-14 21:38:04 -08:00
Thad House
f79ed1ab44 Artf4800: Fixes HALGetJoystick*** Segfault
The HALGetJoystick*** methods were not initializing the descriptor
variable properly. This was causing a SegFault if joysticks were moved
around while one of these methods were running.

Change-Id: If804c7ea724b10381765068e4d6fad75fad69ecb
2016-01-14 11:19:51 -08:00
Brad Miller (WPI)
bf89762e82 Merge "fix sim_ds launch script" 2016-01-13 10:19:40 -08:00
Brad Miller (WPI)
bd1e091629 Merge "Added build dir specification for sim javadoc to not overwrite athena javadoc" 2016-01-13 10:17:15 -08:00
Fredric Silberberg
2662a7ab0d Initialized the m_sensors variable to fix artf4798.
Change-Id: Iab7b76c0e36b3a8e5ab764f7dcd6772a2058bd0f
2016-01-12 16:27:34 -05:00
Fredric Silberberg
713d54fd2f Added build dir specification for sim javadoc to not overwrite athena javadoc
Change-Id: Idcc1303628134dd37c6c178b0bd66cfe2d24f928
2016-01-11 22:26:25 -05:00
Peter_Mitrano
75a07fc3e4 fix sim_ds launch script
It seems the tilde character doesn't always resolve to the home
directory

Change-Id: I69ecbab266901b271a16ce81b60a8bf7873f8a20
2016-01-08 01:31:01 -05:00
Peter Johnson
6b740e87b3 Fix C++ PIDController SetToleranceBuffer and OnTarget locking.
Also implement OnTarget fix in simulation PIDController.

Change-Id: Ic4b452759f80aa769a721f22cb6e732c2a9a213a
2016-01-07 20:55:10 -08:00
Brad Miller (WPI)
ac27f4b644 Merge "Fix onTarget() so that it returns false until there are any values retrieved" 2016-01-07 09:25:52 -08:00
Brad Miller
99b6000a65 Fix onTarget() so that it returns false until there are any values retrieved
The onTarget() method uses the average error and there might not be a valid value
until the PIDController runs once. This is causing commands to bail out early in
simulation.

Change-Id: I7bac9ecb847cbe4f378385b1a6998bba10147554
2016-01-07 12:03:17 -05:00
Peter Johnson
628811ed03 Correctly set smart dashboard type for AnalogGyro and ADXRS450_Gyro.
The GetSmartDashboardType() function defined by GyroBase was returning the
correct "Gyro", but the overrides in AnalogGyro and ADXRS450_Gyro were
incorrectly changing this, resulting in SmartDashboard not recognizing these
as being gyros.

Additionally, AddSensor in the C++ AnalogGyro was setting the name to Gyro
rather than AnalogGyro.

Change-Id: Ib2e31cd2712cc2bc26c8082ed760175d0ee80fb6
2016-01-06 20:45:47 -08:00
Brad Miller (WPI)
c57e749a94 Merge "Fixed sim_ds script library path" 2016-01-06 14:41:44 -08:00
Brad Miller (WPI)
3350926d26 Merge "PIDController feed forward term can now be calculated by the end user" 2016-01-06 14:38:59 -08:00
Peter_Mitrano
4dec393c2d Fixed sim_ds script library path
Change-Id: I12fe435ea397cbcaf5da5b214c36ef5f76eb88cb
2016-01-06 00:14:11 -05:00
Brad Miller (WPI)
0e9f07d1c2 Merge "Fixing install script... again" 2016-01-05 19:30:43 -08:00
Peter Johnson
5765b13976 Use absolute path for NT persistent storage.
Fixes artf4782.

Change-Id: I34c142b3e17e2ba26cff429ceb771e30196f9bfd
2016-01-05 19:20:16 -08:00
Peter_Mitrano
2d43048807 Fixing install script... again
apparently `ln -sf` does not overwrite existing symlinks
so we use `rm -f` first, then use `ls -s`

Change-Id: I033839e50b942cc3508004c84837e9090f1b4f5c
2016-01-05 16:45:22 -05:00
Tyler Veness
e3ce991f18 PIDController feed forward term can now be calculated by the end user
The current feed forward calculation is only useful for velocity PID controllers where F, the feed forward constant, is 1 over the maximum setpoint for the output. For motion profiles which use position PID controllers, the appropriate calculation for velocity and acceleration feed forwards is different. This change allows the user to provide their own feed forward implementation without having to rewrite the entire Calculate() function.

Both default feed forward calculations are velocity feed forwards. Suggestions for sensible feed forward constants are included in the inline comments.

Change-Id: Id175786f26bd342de52a1fae89595cbeba5dfc93
2016-01-05 10:52:25 -08:00
Tyler Veness
3cd1253977 artf2612: Update license in source files.
Years update, references to WIND_BASE were removed, and WPILib license was
moved to the root directory of the project.

If there was already a comment block, a year range through 2016 was created
using the first year in the comment. If there was no comment block, a block
with just the year 2016 was added.

Comments were not added to files from external sources (NI, CTRE).

Change-Id: Iff4f098ab908b90b8d929902dea903de2f596acc
2016-01-05 00:35:05 -08:00
Peter Johnson (294)
008fb2e382 Merge "Removed gz_msgs from wpilibcSim" 2016-01-04 23:22:07 -08:00
Tyler Veness
887f220fe7 Ultrasonic: replace linked list with std::set.
Also remove m_mutex.  It's no longer necessary because we ensure the automatic
thread is stopped while the set is being accessed.

Change-Id: I5994bbeba022a2ebd9e166fca369ebc8c229975c
2016-01-04 22:52:35 -08:00
Peter_Mitrano
dd19778152 Removed gz_msgs from wpilibcSim
it's not directly required to link at this time, and if you want to use a different
version of protobuf on the end-user's computer then linking their robot programs
will fail

Change-Id: I9ad7c07a17b7a332b4027adbe71be605e415bc2d
2016-01-04 22:50:21 -05:00
Peter Johnson (294)
7a2be548a7 Merge "Replaced linked list in Notifier with std::list" 2016-01-04 19:49:55 -08:00
Peter Johnson (294)
5f93009661 Merge "Renamed Gyro to AnalogGyro to match athena API" 2016-01-04 19:33:40 -08:00
Tyler Veness
d77f5c8019 Replaced linked list in Notifier with std::list
Change-Id: I3bcb1195102d792db994dba98adc7425767b16e8
2016-01-04 19:13:52 -08:00
Peter_Mitrano
6faa51ff48 Renamed Gyro to AnalogGyro to match athena API
Removed references to HAL classes, enabling moving of these classes into
shared.

Change-Id: I8d9053e1046d6fc2a60e13fb29410fd2c95180d2
2016-01-04 19:09:51 -08:00
Peter Johnson
9092b74f4e TCPAcceptor: Check for socket creation failure. 2016-01-04 18:13:39 -08:00
Peter Johnson
b3d28c7e3a Merge pull request #46 from 333fred/master
Adds a compilerPrefix argument for using a compiler with a different toolchain.
2016-01-04 18:03:49 -08:00
Peter Johnson
ed92385469 Merge pull request #44 from ThadHouse/master
Fixes Android Build issues
2016-01-04 18:02:08 -08:00
Thad House
1247976a34 Fixes Android Build issues
Trying to build with the android standalone compiler, and these 2 things
were causing errors. I don't know what an equivalent to basename would
be, because I don't really know what it does.
2016-01-04 17:35:51 -08:00
Fredric Silberberg
880bc7db9f Adds a compilerPrefix argument for using a compiler with a different
toolchain.
Resolves github #45.

Change-Id: I6f16dcc41278f12fbbc1f742d6aaf3ad19ac61bc
2016-01-04 19:53:56 -05:00
Peter Johnson (294)
ce2245110b Merge "Adds CANTalon to LiveWindow" 2016-01-04 14:38:31 -08:00
Brad Miller (WPI)
dfba97a540 Merge "Fixing the frcsim installer script" 2016-01-04 13:41:20 -08:00
Peter Johnson
20f23e0e31 TCPConnector: Don't leak socket descriptors.
Also check to see if socket() returns error (less than 0) and error out.
2016-01-04 13:08:00 -08:00
Thad House
99b2b65148 Adds CANTalon to LiveWindow
CANTalon was not being added to the LiveWindow list.

Change-Id: I732bb65a899f11bb9b1ef0a7320f0f0cc78233f7
2016-01-04 12:28:27 -08:00
Peter Johnson (294)
5976baec02 Merge "Fixes CAN devices in C++ library not showing in the livewindow" 2016-01-04 12:08:49 -08:00
Peter Johnson
932ec8e302 Merge "HAL: Use extern "C" in implementation files." 2016-01-04 11:58:44 -08:00
Sam Carlberg
1c6fe85a7b Fixes CAN devices in C++ library not showing in the livewindow
Change-Id: I47a9d6370b4b2573272881258d4bb46aa149bed0
2016-01-04 11:48:31 -08:00
Peter Johnson
d9efcbc7a9 C++ NetworkTable: Add array and raw getters and setters.
For consistency with Java NetworkTable; also makes these data types easier
to use (although they are less efficient as they require a memory allocation
and data copy).
2016-01-04 09:37:29 -08:00
Tyler Veness
e15ca5a414 Added linear digital filters
Linear digital filter class based on code from FRC team 341

Change-Id: I4c5198e36a089e08a6d054bf1bf80392def27e23
2016-01-03 23:05:49 -08:00
Peter Johnson
5e2a07d58a Fix client connection to 2.0 server.
Fixes #42.
2016-01-03 17:54:08 -08:00
Peter_Mitrano
70bc630f1f Fixing the frcsim installer script
URL for simulation zip changed as of gerrit 1264
script argument name changed from INSTALLER to INSTALL
fixed jar and logo paths for sim_ds

to use the script, it's now simply:
./frcsim-installer.sh INSTALL

You can optionally supply a promotion status from which to install, such as
./frcsim-installer.sh INSTALL beta
./frcsim-installer.sh INSTALL development

Also added some information to the README

Also allow any type of file install-resources since it may contain
libraries and jars

Change-Id: Ie876a05c88d3d48b8592f1800959988ae66edd04
2016-01-03 02:05:22 -05:00
Brad Miller (WPI)
6c89f34e44 Merge "Default bufLength for PIDController in Java should be 1" 2016-01-02 19:09:58 -08:00
Peter Johnson (294)
d542fe4293 Merge "Adds WaitResult to Java waitForInterrupt" 2016-01-02 09:54:57 -08:00
Peter Johnson
351e8599ac HAL: Use extern "C" in implementation files.
This turns accidental parameter mismatches between header and implementation
into compiler errors.

Change-Id: Ic26fabb82b2fd5f79407a11435cdbd35348af15f
2016-01-02 09:49:35 -08:00
Peter Johnson
620836e1cb Update .gitignore. 2016-01-02 09:39:14 -08:00
Dustin Spicuzza
31a39b4e59 Default bufLength for PIDController in Java should be 1
- cpp version defaults to 1
- Documentation in getAvgError() says it defaults to 1

Change-Id: Id45f345f048f4c02709745ec1fb97744b7af7715
2016-01-02 12:00:40 -05:00
Peter Johnson
e2ec34090a Keep track of FPGA time rollovers with 64-bit time.
This allows both greater than 72 minute (2^32 * 1 us) timeouts and also
gracefully handles notifiers across the FPGA time counter rollover.

Change-Id: Ibde0b903155f60b618b0ca4d5f8f6dd49f90b020
2016-01-02 06:29:59 -08:00
Brad Miller (WPI)
063925e737 Merge "Change C++ Notifier to allow std::function callback." 2016-01-02 06:29:20 -08:00
Brad Miller (WPI)
de4708cbdb Merge "Rewrite C++ Notifier to use HAL multi-notifier support." 2016-01-02 06:28:40 -08:00
Brad Miller (WPI)
8bbc1d43bb Merge "Rewrite Java Notifier and update Interrupt JNI." 2016-01-02 06:27:44 -08:00
Peter Johnson (294)
c01146eb02 Merge "Readded styleguide accidentally removed in the reorg" 2016-01-01 20:09:33 -08:00
Peter Johnson (294)
3e71573c51 Merge "Artf4179: Allow alternate I2C addresses for ADXL345_I2C" 2016-01-01 19:34:47 -08:00
Fredric Silberberg
5bc6e1378c Readded styleguide accidentally removed in the reorg
Change-Id: I240516c2c62d056e6ea4c31026918f5414c6a710
2016-01-01 19:32:33 -08:00
Peter Johnson
af2f54720d Java: Don't detach thread when releasing globals.
JavaGlobal was unconditionally attaching to (okay) and detaching from (bad)
the current thread during destruction.  We don't want to do this if the
destructor gets called from an attached thread.  Instead, use GetEnv to
first try to get the environment, and only attach and detach if it returns
an error saying the thread is detached.

Also, make sure notifier callbacks appropriately free Java locals to avoid
running out of local variable space.
2016-01-01 19:05:00 -08:00
Tyler Veness
5cee85f921 Fixed some typos in the comments of MotorEncoderFixture.java, a method name in CANMotorEncoderFixture.java, and the README files
Change-Id: I87d982068f3e7cdcce6e5b06c34a7ef326f5eae0
2016-01-01 16:19:53 -08:00
Thad House
951c81f5b7 Adds WaitResult to Java waitForInterrupt
WaitResult gets returned from C++ and the JNI, so should probably be returned
in Java as well.

Adds WaitResult tests to Java AbstractInterruptTest

Change-Id: Ic3cb2919652696c458c39006b2f716301c0736f4
2016-01-01 11:20:59 -08:00
Joe Ross
75d1891a57 Artf4177: Use read byte count for ReadString
Change-Id: Id27a60553792bf668b5c653b889449e695aebdc6
2015-12-31 19:44:53 -08:00
Joe Ross
376fc6be6f Artf4179: Allow alternate I2C addresses for ADXL345_I2C
Change-Id: I43e65251b4a7a5b90afb698b753b86672110e837
2015-12-31 17:51:16 -08:00
Peter Johnson
91a451f87a Change C++ Notifier to allow std::function callback.
Also provide templated varags constructor for backwards compatibility and
ease of use.

Update PIDController to use new constructor, eliminating static function
CallCalculate().

Change-Id: Iaeae95aa5953f294f5debc5fc569ef6d4684f223
2015-12-29 18:33:29 -08:00
Peter Johnson
b0de0b7386 Rewrite C++ Notifier to use HAL multi-notifier support.
This removes redundant queue code from the C++ library.

The old queue code is still needed by simulation, and as the delta between
the simulation and athena headers has grown significantly, this splits the
header into two separate files.

Change-Id: Ia76b38337a25eb9d4890b3eb9bd76b1cbda7f285
2015-12-29 18:33:29 -08:00
Peter Johnson
5dc5ed83b3 Rewrite Java Notifier and update Interrupt JNI.
Notifier takes advantage of the multi-notifier support now in HAL.

Each Notifier is now handled by a separate thread at the JNI level, so
one notifier taking longer to process (or being breakpointed) does not
stop the other notifiers from running.  These threads are configured as
daemon threads.

In both Notifier and Interrupt JNI, the JNI thread attachment no longer
repeatedly calls AttachCurrentThread().  This improves performance but more
importantly avoids impacting the Eclipse debugger, which attempts to
track each call to AttachCurrentThread() as a separate Java thread.

Note: There is currently no way to free an interrupt handler.  Repeatedly
calling attachInterruptHandler() will result in leaking previous handlers.

Change-Id: Ib12e3df88943c03e0269d3906e5b153767139391
2015-12-29 18:33:22 -08:00
Brad Miller (WPI)
fe01096e7a Merge "finishing up FRCSim installer" 2015-12-29 14:25:28 -08:00
Peter Johnson
236ef199aa Merge pull request #41 from 333fred/master
Added skipArm flag to disable the arm build entirely
2015-12-29 13:37:29 -06:00
Peter_Mitrano
acc7fbbf01 finishing up FRCSim installer
adds build of gz_msgs on end-user computer
This means we don't need to provide different zips for different
versions of ubuntu.
The problem was that gazebo on 14.04 comes with protobuf 2.5 but gazebo on 15.10 comes with 2.6
added a few other fixes to the install script as well

also fix dependency between simluation publishing and libwpilibcsim
building

Change-Id: I57d5a26ed7795bc61a25402e2986c6023d1d78ac
2015-12-29 13:48:59 -05:00
Fredric Silberberg
1ea5b21dcf Added skipArm flag to disable the arm build entirely
Change-Id: I49c6cb3bfb3b1eda60d5b99b634b1e82fb2afcc8
2015-12-29 12:08:51 -05:00
Peter Johnson
e6054f543a ntcore_c.h: Whitespace fixes. 2015-12-29 08:57:10 -08:00
Peter Johnson (294)
416a238bed Merge "Artf4776 Fixes First DIO PWM usage errors" 2015-12-29 08:23:56 -08:00
Peter Johnson
2aaaed34f9 Unbreak build on VS2012. 2015-12-28 19:27:05 -08:00
Peter Johnson (294)
3d2b54a1c0 Merge "Artf4774 Fixes HAL getHALErrorMessage missing error" 2015-12-28 18:39:44 -08:00
Brad Miller (WPI)
ae99eb6761 Merge "Prevent double free in DigitalGlitchFilter" 2015-12-28 18:33:36 -08:00
Brad Miller (WPI)
e2fb1c6d46 Merge "Set correct error message" 2015-12-28 18:30:08 -08:00
Dustin Spicuzza
4881795a92 Prevent double free in DigitalGlitchFilter
Change-Id: Icf9660762c78054895bf8e86a6dfae0615288de6
2015-12-28 21:11:29 -05:00
Peter Johnson
fef8f933d9 Add SafeThread to fix thread JNI shutdown races.
During JVM shutdown, some JNI calls may not return, so it's not possible to
reliably perform a join() during static variable destruction (which occurs
as the JVM unloads the JNI module).

Also, due to static variable destruction, it's not safe to use any members
of a static class instance from a separate thread of execution.

SafeThread is a templated thread class and a related owner class that's
designed for safe operation and shutdown of threads in the presence of
callbacks that may not return.  It also passes ownership of variables from
the static instance to the thread, so the thread can safely operate until
it exits (the last operation of the thread being to destroy its instance).

Notifiers, RpcServer, and Logger now use SafeThread to ensure race-free
destruction in both C++ and Java.

All Java callback threads are now marked as Java daemon threads so they
don't keep the JVM running after main() terminates.

All Java callback threads are now named so their purpose is more easily
identified in a debugger.

Add SetRpcServerOnStart and SetRpcServerOnExit (similar to Listener).
2015-12-28 17:51:56 -08:00
Peter_Mitrano
17b363f3b4 working on install process for FRCSim 2016
To publish the simulation zip, run ./gradlew publish -PmakeSim

Targeting Ubuntu 14.04 and 15.10 for now, with 14.04 being the
currently best supported.
Two scripts have been drafted for installing, for 14.04 and 15.10
It currently publishes to ~/releases/maven/development/simulation

There is a known bug that gz_msgs for 15.10 must be built using
protobuf 2.6, which is not the default on 14.04.

Change-Id: I6cccd601671553d30fd05bbbc79c2b7dc1efbf1d
2015-12-28 16:42:24 -05:00
Brad Miller (WPI)
85c3e6a4fd Merge "This commit adds documentation generation, including grabbing ntcore sources, for both Java and C++. This will need changes made in the wpilib promotion tasks to copy the generatd documentation to the correct places." 2015-12-25 20:45:12 -08:00
Peter_Mitrano
2c04cf135b Improved READMEs
fixed a few incorrect statements
added structure and organization to main README to help people find
stuff when they're first starting

Change-Id: I6148f2e9bc63cbeaf5f2e40566bf9d274ed36aaa
2015-12-25 21:16:00 -05:00
thouse
dbba4a1036 Artf4776 Fixes First DIO PWM usage errors
Adds Java and C++ integration tests for testing DIO PWM

Change-Id: Iae32b57636a9648b92e8e0520f6cbba4c3c377ca
2015-12-25 08:34:43 -08:00
Brad Miller
083c90d377 Added libnipalu to make vision programs link properly
Change-Id: Ib45dbc2944f80bba1063cbd7c7875d3cf215584b
2015-12-24 21:35:31 -05:00
Fredric Silberberg
729545809e This commit adds documentation generation,
including grabbing ntcore sources, for both
Java and C++. This will need changes made in
the wpilib promotion tasks to copy the generatd
documentation to the correct places.

Change-Id: I64590b5eda001da2cc8ae498b2b1c0fd298da284
2015-12-24 14:43:51 -05:00
Fredric Silberberg
d8de5e4f19 Added ntcore sources zip to the main build
Change-Id: I7760ebb86c5493d5d9bc3ef9b9def02bcfb7216c
2015-12-24 14:42:36 -05:00
Dustin Spicuzza
842aba97b8 Set correct error message
Change-Id: Ieed132ec95568b4c01dce9c59feaa36eda4c56dc
2015-12-24 01:05:08 -05:00
Peter Johnson (294)
554543c5d0 Merge "Fixes the sources zip to actually include all sources." 2015-12-23 18:07:57 -08:00
thouse
d3f4400035 Artf4774 Fixes HAL getHALErrorMessage missing error
Change-Id: Ie0686363939f4be389f1dc284bb2a68f2783836d
2015-12-23 11:00:20 -08:00
Peter_Mitrano
20749ed6e9 Condition java sim build on -PmakeSim flag
This prevents issues building wpilib if you have ntcore but haven't
built desktop
If you want to build sim, use -PmakeSim
This will require the desktop build of ntcore, which can be done with:
./gradlew build publish -PmakeDesktop

Change-Id: I20f379267a226dbdfcff8fe6223670257725965a
2015-12-23 10:38:51 -08:00
Peter Johnson
44821c3e3c Change how Dispatcher is shut down.
The previous use of a timeout resulting in thread detach instead of thread
join resulted in a race condition on Mac between destruction and thread
closeout.  This commit removes the detach functionality and uses dup2() to
on Linux/Mac and connecting to itself on Windows to try to ensure accept()
exits.
2015-12-23 08:08:53 -08:00
Fredric Silberberg
8cc066ecc4 Fixes the sources zip to actually include all sources.
Change-Id: I54658aacd715c9c06e1625dbebb2933d09921df1
2015-12-22 13:01:57 -05:00
Peter Johnson
2540f102b0 Include sys/select.h on Unix platforms. 2015-12-21 12:24:59 -08:00
Peter Johnson (294)
684da8d89f Merge "Add SPARK and SD540 motor controllers" 2015-12-21 10:24:05 -08:00
Peter Johnson
8b3f4aa68c Remove unused member variable. 2015-12-21 09:03:30 -08:00
Peter Johnson
0537f9d0d7 Fix mac.gradle. 2015-12-20 23:49:47 -08:00
Fredric Silberberg
4b0980fb86 Fixed jar task dependencies. The stripped version of the binary is now added to the jar, not the full debug version of the binary
Change-Id: I8057dffd9e4ca28cca1fe8f0e95fa5fc536f2c9e
2015-12-21 00:33:36 -05:00
Peter Johnson
65e4eeeb7c Fix Windows linkage.
Windows needs ATOMIC_STATIC_INIT.
2015-12-20 21:06:17 -08:00
Peter Johnson
298dc54910 Fix Windows build. 2015-12-20 20:55:36 -08:00
Peter Johnson (294)
fb486e381f Merge "Added a withoutTests gradle flag for CMAKE feature parity" 2015-12-20 20:45:51 -08:00
Peter Johnson
32001427d4 Java: call JNI AttachCurrentThread less frequently.
Each call to AttachCurrentThread results in a new Java thread object being
created.  This is inefficient and also causes debugging issues with Eclipse
due to constant creation and removal of threads.  Now AttachCurrentThread is
only called once for (all) listeners and once for logging (if used).
2015-12-20 20:42:09 -08:00
Austin Schuh
13496c75b4 Fixed double free of DriverStation.
DriverStation was being added to the singletons and also as a const
member variable.  This made it so that on program exit, it was
getting double freed.

Change-Id: I87f8260615dc31d57ce7c7204c1dfde22973ad51
2015-12-20 16:15:24 -08:00
Fredric Silberberg
2a43813d14 Added a withoutTests gradle flag for CMAKE feature parity
Change-Id: I7b76c3a616e66cb8e3372b01a61049a7f1406503
2015-12-20 18:05:06 -05:00
Peter Johnson
b4c0583896 ContainsKey: Compare to nullptr.
This is a style change, not a functional change.
2015-12-19 22:36:32 -08:00
Peter Johnson
88b985be5d Allow building of tests to be disabled in cmake.
Defining WITHOUT_TESTS will result in tests not being built.

Fixes #38.
2015-12-19 20:34:18 -08:00
Peter_Mitrano
d69803804f Repaired simulation build on linux
Reverted to old driverstation and joystick code because we're not ready
for windows drive station yet

updated paths to reflect new wpilib organization
fixed name of gazebo topic (if you want /gazebo/frc/time use ~/time)
included network tables in wpilibJavaSim
Added ds script, and improved frcsim script
always start gazebo with verbose

Change-Id: I3c54b7000019a5985079a88200896a8069e69b86
2015-12-19 14:42:43 -05:00
Peter Johnson
7528b6b8bf Fix NetworkTable::ContainsKey.
Previously this would always return false due to how explicit bool is
evaluated in a return context.

Also add a test for this function.

Reported by: jcreigh
2015-12-19 08:47:52 -08:00
Peter_Mitrano
0d062fba3a Add Cmake wrappers and unzip desktop ntcore builds
the task allcsim will build everything
requires ntcore desktop to be built
also fixed Driverstation to match non-sim C++ API

Conflicts:
	wpilibc/simulation/CMakeLists.txt

Change-Id: Id38141a5b48ed7fe064c7e6c8d2f618481b7e298
2015-12-18 22:29:57 -05:00
Kevin O'Connor
fa903dd9ce Add SPARK and SD540 motor controllers
Change-Id: I33f9c588b6d535b1f274d211563ef146f34439b1
2015-12-17 16:28:05 -05:00
Brad Miller (WPI)
9316933454 Merge changes I55ce71c6,I803680c1
* changes:
  Rewrite CANTalon JNI layer.
  Last feature addition for CANTalon java/C++ user-facing API.
2015-12-17 10:56:37 -08:00
Brad Miller (WPI)
31e1041ba3 Merge "Remove broken and unused HALLibrary.java." 2015-12-16 09:33:27 -08:00
Peter Johnson
1b03f818ad Rewrite CANTalon JNI layer.
Also update C++ and C functions from generator script output.

Change-Id: I55ce71c609ba5f5811db2ae78786ab7013a04b69
2015-12-16 00:02:13 -08:00
Omar Zrien
cd5765559a Last feature addition for CANTalon java/C++ user-facing API.
- CANJaguar also touched up to report it can't do the new control mode (just like with follower).
- New third optional param for talon c'tor to speed up enable control frame.
- The pulse width routines have been moved to where the script generator puts them.  No actual changes there but should help Peter integrate the latest code generator.

Last feature additions for TalonSRX HAL for FRC2015-FRC-2016 season.

-HAL driver uses control_5 frame if firmware supports it.  This allows teams to see/confirm control settings taking effect before enabling the robot.
  For example selecting the sensor type and going to web-dash to check sensor values now works without having to enable the robot.
-Motion profile HAL routines added.  Tested on Single-Speed Double reduction (with slave Talon too).
-Start moving ctre frame defs into a new common header (better then shoving a bunch of struct defs at top of module).
-New child class in CANTalonSRX for buffering motion profile points.  Not sure it would be best to leave it as is or make another module.  It's trivial now so I thought that was acceptable, (in future it will likely possess compression strategies => no longer trivial).

Change-Id: I803680c1a6669ca3f5157d7875942def6f75b540
2015-12-16 00:02:01 -08:00
Peter Johnson
4b04073389 Remove broken and unused HALLibrary.java.
Change-Id: Iec501cdf2f05fcdee115471e5fa1ce2a6dfb6d57
2015-12-15 20:56:34 -08:00
Peter Johnson
0a06fdb523 Clean up FRCNetworkCommunicationsLibrary JNI.
Change-Id: I37031c1593c7cb902cec33d4dc787daa9ba9765c
2015-12-15 20:48:55 -08:00
Peter Johnson
c2ecffe708 Update to latest UsageReporting.h.
Also fix DigitalGlitchFilter usage reporting for C++ (only report on
construction rather than on each call) and add for Java.

Change-Id: I73758b16d81c40442c4acec43e0aa6804b2ba250
2015-12-15 20:47:21 -08:00
Kevin O'Connor
ec69c6a866 Fix Solenoid Resource object creation. Fixes artf4758.
Change-Id: I8b40d6606d7091fa6e8bf95b75f820e6b524ae06
2015-12-15 20:02:59 -08:00
Peter Johnson
bc0c895619 Take 2 on usage reporting.
The previous commit missed the MindsensorsSD540 value.

Remove wpilibc/Athena/include/NetworkCommunication/UsageReporting.h copy; it
was not actually used (all references except the one in DriverStation.cpp
had been commented out), and has been superseded by the one in HAL.hpp.

Change-Id: I51e2eafa85ee5e40050d702aa0bf69171e887a60
2015-12-14 21:15:47 -08:00
Peter Johnson
9e18330586 Report usage for ADXL362 and ADRXS450.
Change-Id: I31c6b76923923606ea2838f346b24375b97b01ef
2015-12-13 17:52:10 -08:00
Peter Johnson
e25d9fc96a Use correct condition variable in DispatchThreadMain(). 2015-12-11 21:13:41 -08:00
Fredric Silberberg
82d89d3b70 Updated to NI image v18
Change-Id: If120eee63c7815bfcf2f05fdf48a0399497a645d
2015-12-11 18:24:01 -05:00
Brad Miller (WPI)
7ba89306ca Merge "Make C++ Analog Potentiometer test work." 2015-12-10 22:13:08 -08:00
Peter Johnson
c70e710caf Remove raw pointer deprecation warnings.
See discussion in 2016 beta forums for rationale.

Change-Id: I86a4c1bd61655f4895e2fe0e935f25dc8a89d830
2015-12-10 21:54:31 -08:00
Fredric Silberberg
b1a3ded2fa Added desktop classifier publishing for c++ as well
Change-Id: I7174aa3fce10fee2988e16b5a95c392b430cefb6
2015-12-10 18:31:59 -05:00
Peter Johnson
bafe4e56a7 Notifier: Change back to constructor from ATOMIC_VAR_INIT.
Change-Id: Ia0addacee57f03e12f2ca12f7b5a1ba29d913ac4
2015-12-09 20:24:39 -08:00
Peter Johnson
bd2a28f597 Add ADXRS450_Gyro.
This is a digital gyro interfaced via SPI.  Uses the HAL SPI accumulator.

Basic code function successfully tested on a ADXRS453.

Change-Id: Ibc0c7db9964c041fb1e04af4db17e3310ea83c04
2015-12-09 20:24:39 -08:00
Brad Miller (WPI)
6851dee3f6 Merge "Gyro: Add support for fixed calibration (artf4124)." 2015-12-09 06:54:52 -08:00
Peter Johnson
de219055f0 HAL: Add software-based accumulator for SPI devices.
Change-Id: I154c4c8f438163edf3ebc2c38f67a976d8cfbfd7
2015-12-09 06:50:36 -08:00
Brad Miller (WPI)
530ce310a6 Merge "HAL: Add support for multiple Notifiers." 2015-12-09 06:50:00 -08:00
Peter Johnson
bc6da8effa Add noexcept shim for MSVC. 2015-12-09 01:22:21 -08:00
Peter Johnson
5d26b13553 NetworkTable: Add override declarations for all functions.
clang generates errors for using override on only some functions.
2015-12-09 01:18:14 -08:00
Peter Johnson
0d7106450b Make TableKeyNotDefinedException::what() const noexcept. 2015-12-09 01:18:00 -08:00
Peter Johnson
60647a2f8c Turn off Nagle algorithm to decrease latency.
This is safe because of the way writes are performed: for each transmission,
all outgoing messages are concatenated in memory and only a single write()
syscall is made.
2015-12-09 00:58:06 -08:00
Peter_Mitrano
8b0f19a0fb Updated Notifier to match changes in gerrit 1171
some changes were ommitted because they don't exist in sim

Change-Id: I6901998635f73c14efc894c408d2b5fd98e4d94c
2015-12-07 12:12:54 -05:00
Peter Johnson
76ee093e92 Add exception-generating C++ functions, but mark as deprecated.
These are good to have for backwards compatibility, but discouraged for new
development (default-taking functions should be used instead).  The reason
is that the exceptions must be explicitly handled and may initially work but
then fail at an inopportune moment.

Mark the similar Java functions as deprecated as well for the same reason.

Update all the docs for consistency.

Mark overridden functions as such in both C++ and Java.

Make IsPersistent and GetFlags const in C++.
2015-12-06 22:39:38 -08:00
Fredric Silberberg
d0c01ac30d Updates wpilib to use different repos for the different build versions, instead of using classifiers
Change-Id: Ic4cd1f1f93ae1036834cdcf1d0f1499fc946a429
2015-12-06 16:38:57 -05:00
Fredric Silberberg
9e6635ec13 Fixed log compilation on Mac
Change-Id: Ic231c56bdfd74c23d6086fb8ec485a0cec17d248
2015-12-06 16:14:26 -05:00
Fredric Silberberg
db91e20ec7 Updated ntcore build to build both arm and native versions
Change-Id: I515f051bbb816a1a82667462ad4e140cdb0fabdc
2015-12-06 14:43:30 -05:00
Peter Johnson
3cd20d3ff2 Java: Fix getValue(). 2015-12-06 08:22:34 -08:00
James Kuszmaul
6a8fcbc407 Make C++ Analog Potentiometer test work.
Previously, the AnalogOutput simulating a potentiometer was setting
the output voltage assuming a supply votlage of 5V. Now it uses
the actual "5V" that is being output. The Java test was already
doing this correctly.

Change-Id: Icbba89f9bc14ebe0005416de55dcac3a2727bf21
2015-12-03 16:18:51 -05:00
Peter_Mitrano
5c82146549 comment out halDesktop
HalDesktop is not nessecary right now, and it breaks the mac build
This will be revisited once the NI Driverstation is needed for sim

Change-Id: I2c665d0abfaeee3b9d20d4d8aad8d4eed8a7b38b
2015-12-03 02:22:26 -05:00
Peter Johnson
f5fe5cfcf1 JNIWrapper: Fall back to system library if not found in .jar.
This is useful primarily for debugging purposes (as the temporary file
written by the loader can't be easily loaded by gdb).

Change-Id: Ic4ea22ef88363c5ff998980b0352844645766fd9
2015-12-02 06:35:38 -08:00
Brad Miller (WPI)
10e51f0261 Merge "HAL: Increase safety during program termination." 2015-12-02 06:23:32 -08:00
Brad Miller (WPI)
b71cea69c8 Merge "DigitalInput: Don't crash on Get() of invalid channel." 2015-12-02 06:18:24 -08:00
Brad Miller (WPI)
01b64b5bd5 Merge "Add support for ADXL362 SPI accelerometer." 2015-12-02 06:14:35 -08:00
Brad Miller (WPI)
e9f98b28cc Merge "Reduce overhead of setErrorX() calls." 2015-12-02 05:55:40 -08:00
jmanning
cd47030651 artf4160
This fixes the java version of the addressOnly() function.

Change-Id: Iec308c76f7699729c628f230d366b34626afccd8
2015-12-01 21:30:41 -08:00
Peter Johnson (294)
4f535fb77b Merge "Re-enable C++ Pressure Switch Test." 2015-12-01 20:01:28 -08:00
James Kuszmaul
d34ba8866b Re-enable C++ Pressure Switch Test.
Also, the pressure switch test is wired correctly now,
  so it should be working again in Java as well.

Change-Id: I066bc969c2e946d79df7c967cd000acfe840dd04
2015-12-01 17:37:14 -05:00
Austin Schuh
b3b03c43c8 artf4700: Added DigitalGlitchFilter
Initial Java support from Tyler Veness.
Final java support done by Jerry Morrison.

Change-Id: I1f85eb555f9ea4c0250c4c6729d7c51a76f5bef4
2015-12-01 01:30:42 -08:00
Joseph
375a19563e Gyro: Add support for fixed calibration (artf4124).
Testing added for Gyro constructors, getters, and setters.

Change-Id: Id3ba2656bfdb286e01fbd95dff95115a3446c92e
2015-11-30 23:43:32 -08:00
Peter Johnson (294)
6d00b77ef3 Merge "artf4175: Fixes FakeEncoderFixture encoder type error" 2015-11-30 23:10:12 -08:00
Peter Johnson
93b65aad36 DigitalInput: Don't crash on Get() of invalid channel.
The constructor sets m_channel to UINT32_MAX and reports an error if the
channel index is out of range (or CheckDigitalChannel fails for some other
reason).  A Get() following this would result in a crash because it wasn't
checking StatusIsFatal().

The new behavior now checks StatusIsFatal() and simply returns false.

Change-Id: I15529401294e4ccd1e09df834e02cca367fab67c
2015-11-30 22:44:48 -08:00
Joe Ross
c3c35c604c fix javadoc warnings/errors
Change-Id: I079699631185f986952bbf4cbb23661f9f9d123d
2015-11-30 22:30:26 -08:00
Peter Johnson
03c43a46d7 HAL: Add support for multiple Notifiers.
This is a poor man's version of the multi-instance Notifier support in
the higher level languages.  It's intended primarily so that notifiers
can be created internal to the HAL.

One benefit of this change is that the current FPGA timestamp is passed
as the first parameter to the ProcessQueue function (rather than the
useless interrupt mask).

Caution for other languages wrapping the HAL: this adds a parameter to
initializeNotifier().

An atexit hook is used for safe cleanup at program termination.

Change-Id: I782b3a74c10215588ae9b7191906fb4186a81028
2015-11-30 22:00:19 -08:00
Peter Johnson
07be45af80 HAL: Increase safety during program termination.
- Add an atexit hook to set global and watchdog to nullptr.
- Add checks to HAL functions for these nullptrs (also good checks if they
are called prior to HALInitialize).

Change-Id: I138657e8279ed9289648a91c91091ea6a1eb5dcc
2015-11-30 22:00:19 -08:00
Peter Johnson
c2642f39ed Avoid null pointer deref on disconnect. 2015-11-30 20:02:40 -08:00
Peter Johnson
7182b9a6b5 Upgrade TCPConnector messages from DEBUG to ERROR / INFO.
This makes the client a lot more "chatty" but also a lot more informative
as to what's actually going on connection-wise.
2015-11-30 20:01:54 -08:00
Peter Johnson
ac9e42af36 TCPConnector: Select only IPv4 addresses. 2015-11-30 20:01:15 -08:00
Peter Johnson
790862db4b Provide default stderr logger for INFO/WARN/ERR levels. 2015-11-30 19:43:47 -08:00
Thad House
2f8562c238 artf4175: Fixes FakeEncoderFixture encoder type error
Change-Id: Icb2f472acdc7ef9144f96677c84cdcc3128030cd
2015-11-28 17:11:04 -08:00
Austin Schuh
bb9988365f Fixed const correctness in casts and unused parameters.
GCC was throwing warnings about const correctness issues and unused
parameters.  This patch gets rid of those warnings by using the
correct casts.
2015-11-28 13:12:30 -08:00
Peter Johnson
a66eaa4348 Reduce overhead of setErrorX() calls.
Checking the status code in the macro before "context" is used avoids
significant overhead (string processing) in the common case when the code
is zero.

Change-Id: I69b8b220187ac1ab905cdf56dde5c4b6c61101b7
2015-11-28 11:44:26 -08:00
Austin Schuh
61760c839a Removed unnecessary ::std::string calls.
All the Error and assert calls were using const ::std::string & arguments.
When provided with a char*, the compiler was creating a temporary string
object to pass in.  This was triggering mallocs everywhere, even in the
fast paths.

Change-Id: Ie0ad1f240334de677618086bddd64113c56aae6e
2015-11-28 11:44:09 -08:00
Tyler Veness
055ee09825 Fixed current and potential bugs caught by Coverity
Change-Id: I9f9d09dc797ffea062eeb49c881be1d5acb63d7b
2015-11-28 11:08:12 -08:00
Peter Johnson (294)
b0fec4089b Merge "Added README, deleted old obsolete building instructions" 2015-11-28 10:58:56 -08:00
Joe Ross
906fe65e39 Optimize Solenoid Gets. Fixes artf4730.
Implement GetAllSolenoids in the HAL so that SolenoidBase doesn't have to
read each solenoid individually.

Change-Id: I85559565949f7a7119ead410187235636a63f0ed
2015-11-28 03:29:03 -08:00
Brad Miller (WPI)
84ca2ab0f5 Merge "Prevent PID tests from hanging." 2015-11-28 03:11:45 -08:00
Peter Johnson (294)
d998e53f9a Merge "Moved gyro calibration into a separate function so teams can recalibrate at any time after construction" 2015-11-27 22:44:43 -08:00
Thad House
2f2184e8ce Makes HALSetDataSem take a MULTIWAIT_ID rather then a NATIVE_MULTIWAIT_ID
Having the HAL take a NATIVE_MULTIWAIT_ID without any way to get that
structure from extern "C" code is a problem. This makes it so it just
takes a MULTIWAIT_ID, and then grabs the native handle inside the HAL.

Change-Id: I06da18ba34adcea2f16e4e53da672f38be79e28e
Signed-off-by: Dustin Spicuzza <dustin@virtualroadside.com>
2015-11-27 22:33:28 -08:00
Thad House
de39877efb artf4153 Adds HAL structure memory management
In the current HAL, once the port structures were created, there was no
way to free the structures. The way the C++ libraries were written this
wasn't a problem, since it grabbed a copy of each and stored them in an
array on bootup. However java does not do this, and grabs new ports
every time an object is created. This causes memory leaks if an object
is ever disposed in java. The same thing looks to be happening in
python, and C# does it too currently, but that would change if this gets
merged.

Adds java memory management fixes

Adds memory management to AnalogInput and Analog Output C++

SolenoidPorts and Digital Ports are all hold static arrays with their
port pointers (although solenoid overwrites them if a new solenoid on
the same module is created), however analog always grabbed new pointers.
I would fix the solenoid one, but I don't know what the ideal way to do
it would be.

Silently ignores free(null) calls by checking passed parameter is non-null.

Change-Id: Id32993b57b53f896e46e55c97541d3bd90b52648
2015-11-27 22:02:02 -08:00
James Kuszmaul
e3191b0bfd Prevent PID tests from hanging.
For the previous couple of months, the PID tests have been hanging.

The reason that the tests have been hanging lies with the Notifier,
not the PID controller. Basically, a deadlock was occuring during
Notifier destruction when the notifier destructor was called while
the notifier interrupt handler was being called. Because the low-level
interrupt manager waits for the interrupt handler to finish executing before
disabling itself, the notifier destructor would not exit until the
ProcessQueue function finished. However, at the same time, the handler
was attempting to lock the queueMutex before continuing; the Notifier
destructor had locked the queueMutex while wrapping things up, meaning
that the last run of the handler would not complete until the destructor
did, resulting in a deadlock.

In order to repair this, I reduced the scope of the lock on the queueMutex
in the destructor so that it only locks when absolutely necessary. This
should work now.

This bug was likely introduced over the summer when we updated to stl
mutexes and locks, which may have messed up the original lock structure.

This likely did not affect any teams, as it can only occur if you are actively
destroying every* Notifier object present and if the destructor happens to be
called while the handler is being run.
*Note: the component of the destructor causing issues only ran if the last
  Notifier object is being destroyed.

Change-Id: I38ba4e60816a2a8d523e927c25378390a0755444
2015-11-27 21:37:10 -08:00
Peter Johnson
e162e4d1c0 Merge "Fix HALGetJoystickAxisType() definition to match header." 2015-11-27 21:08:49 -08:00
Fredric Silberberg
5080e5b77b Added README, deleted old obsolete building instructions
Change-Id: I9f774caa7b9729ed1fdd2a50117c7d67e65044e4
2015-11-27 12:01:39 -08:00
Fredric Silberberg
f10f8558eb Added README for building
Change-Id: I1bd91831b85adb90bd373c2bed44d2e4acf5dcae
2015-11-27 14:58:30 -05:00
Tyler Veness
9b4dd268b0 Moved gyro calibration into a separate function so teams can recalibrate at any time after construction
Change-Id: I6c43af3ad8e21dcc82dded61f0cd0ae2ddbe0965
2015-11-27 10:33:22 -08:00
Peter Johnson (294)
aa95a8c299 Merge "artf4162: Fixes multiple solenoid creations in java" 2015-11-26 23:50:31 -08:00
Peter Johnson (294)
c935ae2d94 Merge "Adds new CanTalon HAL Functions to C library" 2015-11-26 22:31:48 -08:00
Brad Miller (WPI)
8ad1c07a2d Merge "Remove temporary batch file." 2015-11-26 20:35:56 -08:00
Thad House
966e4be36a artf4162: Fixes multiple solenoid creations in java
Change-Id: Iff1d6cb608c1c95723fa3121fd6c24629952f4dd
2015-11-26 17:10:52 -08:00
Thad House
66b28e95a7 Adds new CanTalon HAL Functions to C library
New functions were added to CanTalonSRX in the HAL, however they were
not added to the C side of the library.

Change-Id: I15197e5dce5db0f5ff207d1318c21be485c90741
2015-11-26 02:21:33 -08:00
Peter Johnson
f36e36424f Fix HALGetJoystickAxisType() definition to match header.
Change-Id: Ie68546930dd1cd07d39f8796f855e8ee26ccd317
2015-11-26 00:03:55 -08:00
Peter Johnson (294)
752f5fb4e4 Merge "Update PCM test to check Solenoid get methods also" 2015-11-25 22:55:32 -08:00
Peter Johnson (294)
68bb074165 Merge "Arguments to Task are now forwarded to std::thread more correctly" 2015-11-25 22:48:10 -08:00
Peter Johnson
03ce0a1b92 Remove temporary batch file.
Change-Id: If696f5833907fab9c9406a8bfb72167edc74fbec
2015-11-25 20:37:24 -08:00
Joe Ross
ab90e7aa2a Update PCM test to check Solenoid get methods also
Change-Id: Ib66973875b9289d06ab356757c6f7c574c87c8bd
2015-11-25 14:27:11 -08:00
Brad Miller (WPI)
ad64c0b025 Merge "spiSetBitsPerWord doesn't exist; remove from headers." 2015-11-25 06:09:03 -08:00
Brad Miller (WPI)
fec7f3a5e1 Merge "Make PDP parameters consistent with other HAL functions." 2015-11-25 06:07:55 -08:00
Peter Johnson
c59e08ee9f Add support for ADXL362 SPI accelerometer.
Tested with hardware on both C++ and Java.

Change-Id: I52f95fc77fffe4efae0c8332007cd683835023ab
2015-11-24 23:48:53 -08:00
Tyler Veness
d59016be35 Arguments to Task are now forwarded to std::thread more correctly
Change-Id: I81a934a6fac4ead30c67010e9968e46ad2f86571
2015-11-24 01:14:42 -08:00
Peter Johnson
2cd7bc83c8 Update .gitignore for new tree structure.
Change-Id: I9e0e3e791c31a3f390b6cf7550c4acdb049bf452
2015-11-23 23:53:35 -08:00
Peter Johnson
964b243619 Make PDP parameters consistent with other HAL functions.
All other HAL functions have status as the last parameter, only PDP did not.
This changes makes the PDP parameter order consistent with the rest of the HAL.

Change-Id: I725e33f75deab34e6a83b7048b2d6c365fa56a21
2015-11-23 23:31:57 -08:00
Peter Johnson
51a35daed7 spiSetBitsPerWord doesn't exist; remove from headers.
Change-Id: I4899ec92a5198199699e7d840c9e0801cccdb861
2015-11-23 23:01:55 -08:00
Tyler Veness
84e793503d std::shared_ptr doesn't need to be initialized with nullptr. The C++ standard already guarantees it will behave as if it is.
Change-Id: I160567e9fb2857f8d7ac4acbe093c4100a7421eb
2015-11-23 18:41:56 -08:00
Fredric Silberberg
26c27756af Updated the definitions file to add overloaded functions, added
no-unused-private-field for Mac builds. Gradle also now works
with the classifier-based dependency system, rather than having
separate repos for every level.

Change-Id: I2eb87391181e91b5675e3e982e4d915be83e14ea
2015-11-23 18:36:43 -05:00
Fredric Silberberg
6d854afb0e WPILib Reorganization
This is a major restructuring of the WPILib repository to simply build
procedures and remove the remnants of Maven from everything except the
eclipse plugins. Gradle files have been largely simplified or rewritten,
taking advantage of splitting up parts of the build into separate build
files for ease of reading.

The eclipse plugins are now in a separate project, as is ntcore. All
dependencies are resolved via Maven dependencies, with the
Jenkins-maintained WPILib repo. Project structures have also been
simplified: we no longer have separate subprojects inside wpilibc and
wpilibj. Where possible, these changes hav been done with git renames,
to make sure we still have full history for all repositories. Other
unrelated subprojects have also been broken out: OutlineViewer is now a
separate project.

Change-Id: Ib4e2a6e1a2f66427a14f16612b0e0d69ed661878
2015-11-21 18:26:49 -05:00
Peter Johnson
c76e60324b Add Java support for raw values.
Either ByteBuffer or byte[] can be used for putRaw().
getRaw() returns byte[].
2015-11-20 01:22:26 -08:00
Peter Johnson
d98ceb60c3 Merge pull request #36 from ThadHouse/master
Makes SetTeam use Mdns
2015-11-19 23:15:06 -08:00
Thad House
2e050b0540 Makes SetTeam use Mdns 2015-11-19 23:02:39 -08:00
Peter Johnson
c20d34c2b6 Rename Gyro to AnalogGyro and make Gyro an interface.
Refactor common implementation parts of AnalogGyro into GyroBase.

This will make it possible to add digital gyros in a similar way to how
digital accelerometers were added.

Change-Id: I437ef259e9ecb81f18a91a95c5a58b6607db5e15
2015-11-18 21:25:30 -08:00
Peter Johnson
e2a4556669 Add ByteBuffer interfaces to I2C and SPI.
Use these interfaces in ADXL345_I2C and ADXL345_SPI.

Change-Id: I62d37e80eb71cec9019dd095f3721e0e5d60bf3f
2015-11-18 21:23:02 -08:00
Peter Johnson
44ba8823d7 Merge pull request #34 from JLLeitschuh/feat/functionalTableListener
Makes ITableListener a lambda function
2015-11-17 22:44:20 -08:00
Jonathan Leitschuh
4c42712b24 Makes ITableListener a lambda function 2015-11-18 01:39:53 -05:00
Fredric Silberberg
6a0485a72c Fixed mac lib path
Change-Id: Ib6f38b7f42df9c9908c7e60eca12dd48c9c4114a
2015-11-17 18:51:16 -05:00
Dustin Spicuzza
af3facd1c2 Merge "Notify the Driver Station that code is ready after robotInit is called" 2015-11-15 21:08:35 -08:00
Colby Skeggs
d690974ad0 Improved error handling in HAL Digital and Solenoid systems.
Change-Id: Iafd68c5bd143e9ee87ecf714bccb2c77e599b649
2015-11-15 20:59:35 -08:00
Tyler Veness
76756048c4 Notify the Driver Station that code is ready after robotInit is called
Change-Id: Id833a2a945c14bcbb4761d4fe463c6c9f7c4430c
2015-11-15 20:36:47 -08:00
Dustin Spicuzza
91891081b9 Merge "Update docs to reflect that PDP can now be at any address." 2015-11-15 20:20:12 -08:00
Dustin Spicuzza
ff4abd63f1 Merge "JNI: Don't call HALInitialize() within an assert()." 2015-11-15 20:15:22 -08:00
Joe Ross
511c4a4d3b Update docs to reflect that PDP can now be at any address.
Change-Id: Ia6bba4c72588e261ec313fbc7bd62b83a61fb00b
2015-11-14 09:27:24 -08:00
Peter Johnson
967400f181 Merge pull request #32 from ThadHouse/master
Adds StopNotifier and StopRpcServer functions
2015-11-11 20:57:55 -08:00
Thad House
a142cc48d3 Adds StopNotifier and StopRpcServer functions
Workaround for #30.  Allows libraries to shut down the secondary
threads.
2015-11-11 20:50:30 -08:00
Peter Johnson
3469f6733c GetRpcResult: Check m_terminating after wait() returns. 2015-11-10 23:21:50 -08:00
Peter Johnson
2b6c6f280c Merge pull request #31 from ThadHouse/master
Fixes SetEntryRaw to actually set raw.
2015-11-10 23:09:05 -08:00
Thad House
aefeee39aa Fixes SetEntryRaw to actually set raw. 2015-11-10 23:03:00 -08:00
Peter Johnson
27101979fa Add extern "C" to ntcore_c implementation.
This will catch any future parameter type mismatches to the header file.
2015-11-10 00:39:46 -08:00
Peter Johnson
033520d426 Merge pull request #29 from ThadHouse/master
Fixes parameter type differences for c interface.
2015-11-10 00:38:31 -08:00
Thad House
16e68c3480 Fixes parameter type differences for c interface. 2015-11-10 00:25:37 -08:00
Peter Johnson
94b6073f34 Merge pull request #28 from ThadHouse/master
Makes Value::MakeStringArray properly set size
2015-11-09 22:08:27 -08:00
Thad House
8fc2eee2b4 Makes Value::MakeStringArray properly set size
The Value::MakeStringArray methods were not setting the size of the
arr_string. This was causing the  NT_Value struct called from the C
entry listener callback to not have the array size, which would then
cause the GetValueStringArray method to fail the malloc.
2015-11-09 22:05:38 -08:00
Brad Miller
28f55802b5 Reverted RobotBase debugging changes from Peter.
Change-Id: I336b63bae0f751fe846a13d702e01c80e53831cf
2015-11-07 12:01:44 -05:00
Peter Johnson
06372cb143 JNI: Don't call HALInitialize() within an assert().
If built without asserts enabled (e.g. -DNDEBUG), HALInitialize won't get
called.  Instead call outside the assert and then do the assert.

Change-Id: I51546b9f9fc9a74f8a3a732c4b754257d9697e46
2015-11-06 20:46:29 -08:00
Peter Johnson
7023013c4b Simplify JNI interfaces.
These changes both simplify the Java code and improve performance across the
JNI boundary.

This also fixes the AnalogCrossConnectTest by adding delays to
setInterruptHigh() and setInterruptLow() to ensure the change in voltage has
time to propagate and extends the timeouts in AbstractInterruptTest.

Detailed changes:

Hoisted status checks to C.  This avoids the need to create direct byte
buffers (expensive) and significantly simplifies the Java code.  The C code
now directly generates the exception or reports the error to the DS.

The JVM pointer is now a global across the JNI, initialized by the OnLoad
function, avoiding the need for some of the class-specific initializers to
get this pointer for callbacks.

Opaque pointers (such as ports) are now passed as long values rather than
with a ByteBuffer wrapper.

Added extern "C" to source files.  This allows earlier detection of JNI
definition mismatches to the Java source headers.

Changed JNI signatures to more closely match HAL signatures (in particular,
boolean is now universally used instead of byte for HAL bool, which cleans
up mapping back and forth to 1/0 from true/false).

Change-Id: I4ea0032cabb0871cd74106a3a70d947258c29d2d
2015-11-06 09:04:22 -08:00
Fredric Silberberg
927400a43c Added classifiers for networktables to to the pom
Change-Id: I9bfef83aba55b62268d08e39f07b3e4bd7c09bdc
2015-11-04 19:20:43 -05:00
Brad Miller
2f228380f4 Updated the ntcore reference and updated the build.gradle file to build with the most recent ntcore commit.
Change-Id: Icc7f795efdd97169ce9f837ad22b3de57d5d2d05
2015-11-04 17:45:06 -05:00
Brad Miller
44bd52c44d Update the image version to 15
Change-Id: I82c81dff64d933a1a7a5e0a1c12256833fc2a387
2015-11-04 14:41:10 -08:00
Brad Miller (WPI)
21124e0174 Merge "Revert "Added work around for the missing path on the frc_console_tee command in frcRunRobot"" 2015-11-04 14:40:52 -08:00
Brad Miller (WPI)
09962a7c87 Revert "Added work around for the missing path on the frc_console_tee command in frcRunRobot"
This reverts commit 97a7716a23.

Change-Id: I7d9e40acc192ad33d24bc32ea9fb9499f8609983
2015-11-04 14:26:05 -08:00
Fredric Silberberg
969af7b610 Added publishing of an ntcore sources zip
Change-Id: Ibcdbff6b165f7b35ac6163e39c61f315db15f323
2015-11-03 21:12:23 -08:00
Fredric Silberberg
da66118331 Add JNI headers to the exported headers when compiled with JNI
Change-Id: I3b2dcad2f15445a9aea27ab0905d397d1cf9f9b5
2015-11-03 21:10:44 -08:00
Tyler Veness
beeefa2356 kFramework_Simple was renamed to match the corresponding robot framework's name
Change-Id: I0123e71e0bb56526fe187cd17cb71a8278739cd5
2015-11-03 10:38:19 -08:00
Brad Miller (WPI)
26f1bd6a1c Merge "Fixed documentation generation for .inc files" 2015-11-03 08:29:33 -08:00
Brad Miller (WPI)
a34f3f238b Merge "HALUsageReporting::kFramework_Simple was renamed to match the corresponding robot framework's name" 2015-11-03 08:10:14 -08:00
Tyler Veness
231178c26a HALUsageReporting::kFramework_Simple was renamed to match the corresponding robot framework's name
Change-Id: I2ad0f8d48cabe5f6c1adf622cf5377eb5be362f7
2015-11-02 23:23:57 -08:00
Peter Johnson
424efca1bf NetworkConnection: bump debug levels a bit.
DEBUG4 is getting pretty verbose.
2015-11-02 22:12:20 -08:00
Peter Johnson
4d7ea37d56 Fix update message type data.
The type was being read and written as the raw enum value rather than as
the actual type definition.
2015-11-02 22:08:35 -08:00
Peter Johnson
32a1beb772 WireDecoder: Add commented-out read stream dumping. 2015-11-02 22:06:55 -08:00
Peter Johnson
d850b2fd76 Gradle build: rebuild on changes to header files in src. 2015-11-02 22:04:23 -08:00
Brad Miller (WPI)
bb52c2441e Merge "Update the library version string for the driver station (artf4708)" 2015-11-02 12:20:06 -08:00
Peter Johnson
9f5fe63aaa Reuse dead connection slots.
This fixes a memory leak on multiple disconnect/reconnect of the same client.
2015-11-01 22:48:11 -08:00
Peter Johnson
03ee425e5f Add additional debug messages. 2015-11-01 22:48:11 -08:00
Brad Miller
042e3a3237 Update the library version string for the driver station (artf4708) 2015-11-01 15:08:55 -05:00
Peter Johnson
9200b7c78c Add extern "C" to JNI definitions to catch mismatches. 2015-11-01 07:44:43 -08:00
Tyler Veness
520d946f63 Fixed documentation generation for .inc files
Change-Id: I2ba5cb335b2e29968069bd362793532de607679c
2015-11-01 01:17:26 -07:00
Fredric Silberberg
b793810e4a Fixes for mac builds
Change-Id: I66dafd5e6d5ff10e7fb98cf718bb6f9343d03184
2015-10-31 18:49:11 -04:00
Fredric Silberberg
9df5f5e27a When running on jenkins, the base name of produced archives becomes the project name. This fixes that to be the correct name.
Change-Id: Ie5a25bf9eabdb8fb1a1ee14d56e2e7badc634afc
2015-10-31 14:28:54 -04:00
Peter Johnson
7fbd0e34d3 Merge pull request #27 from 333fred/master
Gradle Update
2015-10-31 10:46:43 -07:00
Fredric Silberberg
77cf3adf64 This commit updates the gradle files to be cleaner. It also builds for the
current platform by default, and only builds tests when building for the
current platform. Mac builds and VS2015 builds are fixed.

The other big change in this update is the introduction of Debug and
Release builds. Debug builds are built with -O0 and -g. Release builds are
built with -O2 and -g. For GCC-based builds, the resulting shared object
is copied, stripped of debug information, and a debug link is set up to
the copied shared object. This allows the release build to clock in at
around 600 KB. On Windows, the debug info is already stored in a separate
PDB file, so this copy and strip is not necessary.

ntcore is being separated out from the rest of allwpilib. All other
builds will consume a published maven dependency from this project.
There are 4 possible publishing targets now: release, stable, beta, and
development. These are specified on the command line via -Prepo=<repo
name>.

Change-Id: Ie8cb21f910953e09b80a5192317033eb0866cb70
2015-10-31 13:31:01 -04:00
Peter Johnson
ad3424a693 Fix RobotDrive constructor (4 SpeedControllers).
Previously this was not initializing maxOutput.

Fixes artf4699.

Patch provided by: rossbach.ron@gmail.com

Change-Id: I8de5e4a508412d3ca51c58ea87e490916c3bd67c
2015-10-28 22:10:46 -07:00
Brad Miller
97a7716a23 Added work around for the missing path on the frc_console_tee command in frcRunRobot 2015-10-23 19:33:21 -06:00
Kevin O'Connor
fc0a94af2a Update image version to v14
Change-Id: I49a55fd35d3eb33f8909590340422d24ec145eda
2015-10-23 16:00:30 -04:00
Kevin O'Connor
4da09db20b Revert "Updated the scripts to run as admin and manually start the robot programs. This will be reverted with a new image from NI"
This reverts commit 4972480b23.
2015-10-23 15:29:38 -04:00
Omar Zrien
a0cc45a8f0 Format and style changes.
Rebuilt last SRX-related commit with latest checkout.

Change-Id: I9f10418580275dae5cd07d740d401d45ee44e276

C++: Added Magnetic Encoder sensor types
C++: API for changing status frame rates updated to use paramEnums.
C++: Added Setting nominal and peak outputs for closed loop modes.
C++: Added current-closed loop
C++: added vcomp mode
C++: Added unit scaling (rotations and rpm)
C++ Added allowableclosedlooperr
C++: Added auto zero position on index pin
C++: Added pulse width decoder API
C++: Added multiplicands in status frames, increasing the max reported pos and max rpm.
C++: Added SetClosedLoopOutputDirection() for reversing slave output and reversing single-direction closed loopoutput.
C++: Added generic ConfigSet and ConfigGet for future flexibility/features.
C++: Added IsSensorPresent
Java: Added Magnetic Encoder sensor types
Java: Added unit scaling (rotations and rpm)
Java: Added current-closed loop
Java: added vcomp mode
Java Added allowableclosedlooperr
Java: Added auto zero position on index pin
Java: Added pulse width decoder API
Java: setForwardSoftLimit and setReverseSoftLimit takes double instead of int so underneath we can support rotations instead of native units.
Java: Added generic SetParam and GetParam for future flexibility/features.
Java Added isSensorPresent

Change-Id: I800251510e411624dce5ee10272606c31764b8ab
2015-10-16 11:27:57 -07:00
Brad Miller (WPI)
a3b6535fe9 Merge "Updated the scripts to run as admin and manually start the robot programs. This will be reverted with a new image from NI" 2015-10-16 11:26:58 -07:00
Brad Miller (WPI)
29299079fa Merge "Updated roborio version numbers" 2015-10-16 11:26:44 -07:00
Brad Miller (WPI)
06dea34ff3 Merge "DO NOT ACCEPT THIS COMMIT UNTIL IMAGE CONTAINS netconsole-host: Don't overwrite system netconsole on deploy" 2015-10-16 11:26:29 -07:00
Brad Miller
4972480b23 Updated the scripts to run as admin and manually start the robot programs. This will be reverted with a new image from NI 2015-10-16 13:51:38 -04:00
Brad Miller
e73d873df9 Updated roborio version numbers 2015-10-16 13:50:40 -04:00
Brad Miller (WPI)
4eadd99d2c Merge "Removed simluation eclipse plugin" 2015-10-16 09:25:18 -07:00
Sam Carlberg
1316deaf5b Added LiveWindow support for PID control for CAN speed controllers.
Change-Id: Id32e27ee7074ffa23824d5d8c0e9509059001284
2015-10-14 16:47:13 -04:00
Peter Johnson
dd0e3e4abb Implement join with timeout (and detach).
Under certain situations (notably JNI shutdown), it's possible to get
deadlock when using thread join().  To avoid this, implement a timeout.
Normally we try to simply join the thread, but if it times out, we
detach the thread instead.
2015-10-09 23:50:01 -07:00
Peter Johnson
d77b3d788e Dispatcher: Remove unused member variable. 2015-10-09 22:52:26 -07:00
Brad Miller
64c8f1b487 Reupdated the ntcore version
Change-Id: I13124b7b75c1514c3c8f0f66821e37ad3010e306
2015-10-08 18:56:56 -04:00
Brad Miller (WPI)
39c40a9b86 Merge "Revert "Don't overwrite system netconsole on deploy (PENDING NEW IMAGE)"" 2015-10-08 13:55:00 -07:00
Brad Miller
fbbb8dab72 update the version 12 image number
Change-Id: If609ff0924ab72ca08e53d38a45c9f7a91b659ce
2015-10-08 16:29:28 -04:00
Brad Miller (WPI)
e449362131 Merge "Revert "Don't overwrite system netconsole on deploy (PENDING NEW IMAGE)"" 2015-10-08 13:21:59 -07:00
Brad Miller (WPI)
b4761f8f93 Revert "Don't overwrite system netconsole on deploy (PENDING NEW IMAGE)"
This reverts commit 490c88a9bd.

Change-Id: Id50af75bbe2385eddaf12aad2914a9032c8487e7
2015-10-08 13:20:42 -07:00
Patrick Plenefisch
298bc80373 DO NOT ACCEPT THIS COMMIT UNTIL IMAGE CONTAINS netconsole-host: Don't overwrite system netconsole on deploy
This reverts commit bff8eb366b.

Change-Id: I4c52f1a2c86aef9fb2f56aa3109df41d4426d29f
2015-10-08 12:35:35 -04:00
Patrick Plenefisch
bff8eb366b Revert "Don't overwrite system netconsole on deploy (PENDING NEW IMAGE)"
This reverts commit 490c88a9bd.
2015-10-08 12:33:50 -04:00
Brad Miller (WPI)
763d81653b Merge "Don't overwrite system netconsole on deploy (PENDING NEW IMAGE)" 2015-10-08 07:53:42 -07:00
Brad Miller (WPI)
4036ddf552 Merge "Fixed miscellaneous typos" 2015-10-08 01:05:02 -07:00
Peter Johnson
dff6e89b4b Notify local listeners on preferences load.
Also notify local listeners even when disconnected.
2015-10-08 00:04:38 -07:00
Tyler Veness
32af49dbb8 Fixed miscellaneous typos
Renamed RelayCrossConnectFxiture to RelayCrossConnectFixture and fixed spelling of variable in PIDCommand class prototype

Change-Id: I2e0970c9b14f58b7fa5ad70024b29e7a54524f0c
2015-10-07 21:35:25 -07:00
Peter Johnson
c01d057d7b Counter: Explicitly call mode constructor.
This is a compiler bug workaround.  On gcc 4.8.2, the default argument to
the Counter(Mode) constructor is not recognized as a valid delegating
constructor to use.

Change-Id: I616453567c45ce523e14345bd667ea893bf219a3
2015-10-07 20:59:42 -07:00
Patrick Plenefisch
490c88a9bd Don't overwrite system netconsole on deploy (PENDING NEW IMAGE)
Change-Id: I7aa115be1bff2bdf1077c2fa53a0a3de958033e8
2015-10-07 19:29:56 -04:00
Patrick Plenefisch
6fc3f1d3d9 Update netconsole-host binaries (TODO: make part of build)
Change-Id: If7920c467281ea67763c9eebc317a2f11e312089
2015-10-06 17:27:37 -04:00
Sam Carlberg
1309533a48 Updated eclipse plugins to check for the 2016v10 image instead of 2015v23.
This should really be moved to a top-level config file later

Change-Id: I28b26a4be02a0bd2fe74a416c96db13f522e4b8e
2015-10-06 14:32:44 -04:00
Peter Johnson
57b00d3b38 Fix StorageTest unit test on MSVC 2015.
Per https://msdn.microsoft.com/en-us/library/bb531344.aspx, "Exponent
formatting", MSVC 2015 fixed the %g format to match the C standard's
requirement of printing a 2-digit exponent if only 2 digits are
required.
2015-10-05 20:22:36 -07:00
Patrick Plenefisch
29e54a9899 Adding path back in for OS X toolchains because of Apple lockdown
Change-Id: Ia7a76172b8d5d3996556328a00ecc73ca84f5774
2015-10-05 11:09:01 -04:00
Patrick Plenefisch
c384fc97d5 Fixing up rpath libstdc++ for all versions
Change-Id: Ic67b18f27ebeb0a6bdfd67c75f12e6bb4626c944
2015-10-04 18:22:21 -04:00
Brad Miller (WPI)
9c1ab69871 Merge "Automatically set persistent on new Preferences keys." 2015-10-04 15:09:14 -07:00
Brad Miller (WPI)
d9e9712b07 Merge "Update ntcore to latest version." 2015-10-04 14:34:33 -07:00
Brad Miller (WPI)
e281437c4b Merge "Replaced instances of std::unique_lock with std::lock_guard where possible" 2015-10-04 14:17:00 -07:00
Brad Miller (WPI)
f8c0fb1059 Merge "Fix typo in Preferences Test name" 2015-10-04 14:00:29 -07:00
Peter Johnson
87fc49c66d Automatically set persistent on new Preferences keys.
This improves interoperability with old dashboards as it enables new
Preferences keys to be added from an old dashboard and still be
automatically saved.

Change-Id: I51e988006f8fa4fd780fac34f47633a9727f31e0
2015-10-04 13:21:16 -07:00
Peter Johnson
f93bf82fa9 Update ntcore to latest version.
The latest version provdes more extensive listener features and fixes a
handful of bugs.

Change-Id: Ie59c3d879ac12dd5172c2aebd901bdee55570fa2
2015-10-04 13:20:34 -07:00
Tyler Veness
c0ecde302f Replaced instances of std::unique_lock with std::lock_guard where possible
If a lock is used with a mutex that doesn't need to be unlocked again before the lock is destroyed, std::lock_guard can be more efficient than std::unique_lock due to less overhead.

This commit also removes a redundant set of curly braces in PIDController.cpp intended to constrain a lock's scope.

Change-Id: Idd692ce439528ddb319a4c62c40c7351a664eb97
2015-10-04 13:20:11 -07:00
Joe Ross
c2f5bcc04e Fix typo in Preferences Test name
Change-Id: If1cfc3a63e0731fc764b535fd66ed7a1511de199
2015-10-04 13:19:58 -07:00
Peter Johnson
38e0cd6963 Provide compatibility shim for std::make_unique().
make_unique is C++14 only.  This provides a shim for C++11-only compilers.

Change-Id: Ibaa79822a7a6cfa8020c201c2edea1754650f570
2015-10-04 13:19:46 -07:00
Peter Johnson
898952a2df Merge pull request #26 from Beachbot330/master
fix javadoc warnings/errors
2015-10-04 08:41:08 -07:00
Joe Ross
202cb8bb1f fix javadoc warnings/errors 2015-10-03 19:20:26 -07:00
Peter Johnson
f64b055499 Provide DEPRECATED macro as portable version of [[deprecated]].
The [[deprecated]] attribute is a C++14 feature not supported by MSVC or
GCC < 4.9, but can be simulated on both of these compilers through the
use of alternative (compiler-specific) attribute methods.

Change-Id: I34aed5705db2407c592f7cabd5274358c48d34fe
2015-10-03 13:17:53 -07:00
peter mitrano
a480cc65e3 Removed simluation eclipse plugin
Plugins will be delivered through a seperate installer
models will be delivered through the online gazebo model repository

Change-Id: Id9df358837460ae3956657327dbfeb6414b033c2

Conflicts:
	eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/site.xml
2015-10-03 13:08:27 -07:00
Fredric Silberberg
ef3fa53fc3 Fixed solenoid allocation bug exposed by adding status pointer initialization
Change-Id: Ibabdf2f1716554b85fd1056c6f1bbe614fa97f4e
2015-10-03 15:43:03 -04:00
Peter Johnson
049be6870c Always initialize status to 0 when calling HAL from JNI.
The HAL functions often call NI functions that may expect status to be
initialized on entry.  Java does not guarantee direct pointer allocation
memory to be initialized, although that may have been occurring by accident.

Change-Id: I5e3a553f3a7be8de3716ccfc13e6ca1cb4f2a552
2015-09-30 19:20:02 -07:00
Brad Miller
c0c91c414a Modified the test scripts to run as admin rather than lvuser until we have the passwd issue resolved
Change-Id: I943a17c7f872faf69e845b61423eb0ae7044cca5
2015-09-30 11:18:54 -04:00
Patrick Plenefisch
9f859234fb Update for latest image, not sure about ctre folder so leaving
Change-Id: If2218df082bca93d25b88088696d6c2897732efd

Adding FRC Local new mdns name

Change-Id: I53d206879663b96009ba3a12de161b7a425ffd10

Adding rpath for new libstdc++

Change-Id: I0c022efb0b15f094d153b44f60215ca00d5f1924
2015-09-30 06:03:56 -07:00
Peter Johnson
89ae8f214e Initialize status in HALInitialize.
Change-Id: If6230f949ba0dc1061186b1877aaf34a4dd8a987
tGlobal::create() expects the incoming status to be 0.
2015-09-29 23:27:25 -07:00
Peter Johnson
4592c90e34 Add protocol specification documentation.
These have been converted to asciidoc (asciidoctor variant) from the original
Google Docs documents.
2015-09-27 23:22:08 -07:00
Peter Johnson
734e9a4461 Fix NT_GetEntryInfo implementation signature to match header.
Fixes #25.
2015-09-27 21:08:15 -07:00
Peter Johnson
90959defd9 Provide more extensive listener features.
This enables listeners to be notified of not only value updates, but also flag
changes and deletions by using a bitmask to specify what notifications are
desired.  The old API (which only provided a new/not new) flag is still
supported.  This also subsumes the feature to listen to local changes (that's
one of the bitmask options).
2015-09-27 01:55:32 -07:00
Peter Johnson
51064f5e75 Fix client initial flags setting.
Before the server has assigned the id, the client doesn't generate flags
update messages.  This behavior is correct, but the client must then send
the appropriate flags update message when the id is finally assigned by
the server.
2015-09-27 01:55:32 -07:00
Peter Johnson
3e8afc14b0 Java NetworkTable: perform string comparion correctly. 2015-09-27 01:55:32 -07:00
Fredric Silberberg
3c4b96024c Reverted task dependency changes that do not work
Change-Id: I5935a149a30e10164ddcd254e06f5a89a993b82c
2015-09-25 22:04:00 -04:00
peter mitrano
75d9228f33 Fixed networktables build
using findAll form instead off whenAdded
fixed instances of network tables versions from 0.1.0 to 3.0.0

Change-Id: I01054d727259ea5dbf3ba8fae49764337d4f6cf9
2015-09-24 21:58:28 -04:00
Peter Johnson
424bf51a7b Implement local notification.
The default behavior is to only notify remote changes, but for some
applications (e.g. GUI's) it's advantageous to know about local
changes as well.

This is (slightly) optimized in that local changes only result in
additional resources being consumed if (any) local listeners have been
created.
2015-09-23 00:56:08 -07:00
Fredric Silberberg
00f797a327 NetworkTables updates for beta
This commit does a few things. First, we publish ntcore as a maven
artifact so the plugins can build with new networktables, and java
programs will depend on the correct version when compiled. We also revert
the changes to OutlineViewer for now. I got an exception when attempting
to start a server with the new network tables in OutlineViewer on Windows,
I will create a bug for this. Also, since we don't have the binaries
integrating properly yet and won't for the first beta, we need to be using
the platform agnostic version anyway.

Change-Id: I9960f25bc3f2b30bb59fce665eb914ef5e661c9c
2015-09-21 18:14:18 -04:00
Fredric Silberberg
75358e6c45 This adds a maven publish routine for ntcore to replace the networktables
java routine.

Change-Id: Ie4665f9f47c11cb66b6f255d5fe24e91c186a88e
2015-09-21 15:23:44 -04:00
Peter Johnson
e2879b7bf2 Fix JNI embed location on Windows.
Make it Windows version agnostic and fix the amd64 runtime / x86-64 build
architecture naming difference.

See artf4198.
2015-09-20 10:56:06 -07:00
Tyler Veness
525f88ae17 artf4115: Added MotorSafety to Relays
Change-Id: Ia8d9ecfa21bb8102e73d91ec44791bd5141a0b4b
2015-09-19 15:58:35 -07:00
jmanning
c21c47f546 artf4000
A fix contributed by James Ward to fix the restriction on the read/write sizes in I2C.

Change-Id: Iddc48dc55ff9cea37d8dcfaba5e63f0d14e4c7d0
2015-09-19 15:24:07 -07:00
Fredric Silberberg
3635299fde Updated Gradle Version
This updates our Gradle wrapper to version 2.5. The Gradle update
requires no changes to developer systems.

Change-Id: Ia2846600579b182c1a8e12889cdcaa8ffd82a812
2015-09-19 17:40:32 -04:00
Tyler Veness
a7feaddd6b Fixed some warnings printed during wpilibC++Sim build
Change-Id: I11eea8a577af7c37c61978edd721ca16e4e41748
2015-09-19 14:23:49 -07:00
Brad Miller (WPI)
771b5807f4 Merge "Updated C++ documentation" 2015-09-19 14:16:21 -07:00
Brad Miller (WPI)
c248ce7948 Merge "PIDSubsystem.cpp: Use make_shared instead of make_unique." 2015-09-19 13:57:36 -07:00
Peter Johnson
6db58a2cc0 PIDSubsystem.cpp: Use make_shared instead of make_unique.
m_controller is a std::shared_ptr, so make_shared should be used.

Change-Id: I77c855a3055a372ab3feba1a1d8e5c4bac42157f
2015-09-19 12:45:50 -07:00
Peter Johnson (294)
b80d2f6659 Merge "Updated gradle version." 2015-09-19 12:32:53 -07:00
Peter Johnson
4c83259acb C++ NetworkTable: Provide AddSubTableListener().
This matches the implementation provided by Java NetworkTable, with the
exception that the subtable is not provided (because it's not a value).
The listener still can get access to the subtable by calling
source->getSubTable(key).
2015-09-19 12:25:21 -07:00
Fredric Silberberg
9c50e9f964 Updated gradle version.
Change-Id: If233899c69ad3036b65328334d3d318b5b860dad
2015-09-19 15:06:17 -04:00
Peter Johnson
a3effbfb9f Java NetworkTable: Don't use ipAddress when starting server.
This matches the C++ behavior.  Using the IP address here is confusing to
users because it's actually the listen address.
2015-09-19 11:45:07 -07:00
Peter Johnson
90ce262bb3 C++ NetworkTable: Provide SetPort() method.
This was previously only available in Java.
2015-09-19 11:44:14 -07:00
Peter Johnson
23448c8277 NetworkTable interface: Provide method to set persistent filename. 2015-09-19 11:40:31 -07:00
Peter Johnson
d904dfce71 Include the ARM JDK JNI headers.
These are GPL-licensed.  This removes the dependency on the ARM JDK being
installed in order to build wpilibj.

Change-Id: I6ea89f601a2e8210acaf9ae257ddc289c548d7f3
2015-09-19 09:14:24 -07:00
Peter Johnson
d9fa086ec0 Include the ARM JDK JNI headers.
These are GPL-licensed.  This removes the dependency on the ARM JDK being
installed.

Fixes #24.
2015-09-19 08:30:40 -07:00
Peter Johnson
f89c5e150f Use new NetworkTables across WPILib (C++ and Java).
Also make sure table listeners stop listening in their destructors.  This
might be better handled by moving the table itself into ITableListener and
providing cleanup functionality there.

A submodule is used to pull in ntcore.

Change-Id: I3031c1a768595cf0f8754c47e15cd423e2dbcce5
2015-09-18 06:09:36 -07:00
Peter Johnson
3b91fac192 ntcore.def: Add JNI getEntries function. 2015-09-17 21:39:42 -07:00
James Kuszmaul
f65e697107 Revert changes preventing old user code from compiling.
I'm not 100% sure whether we want these, but they are a quick
find and replace to do.

Basically, there are two primary things that we have done
this summer that break existing user code:
-Changing GetInstance() calls to return references instead
 of pointers. This forces users to change from doing something
 like LiveWindow::GetInstance()->AddSensor() to LiveWindow::GetInstance().AddSensor().
-Making PIDGet() and related calls const, forcing users to change
 the function signatures wherever they override them.

The GetInstance() calls don't really matter to me either way,
especially since there are no real ownership issues going on there,
unlike the rest of the smart pointer-related changes.

For the const stuff, it is certainly more correct to mandate that
user PIDGet() functions be const and the such, but at the same time,
I'm not sure that there is any strong need for it, and the errors
generated are not the most helpful. While this wouldn't necessarily
be an issue for more experienced teams or completely new teams (who
don't have any old code to be reusing), it may cause issues for more
average teams who aren't familiar with the intricacies of C++ anything.

Change-Id: I6e7007982069292ea70e6d0fc8ca40203340df1b
2015-09-16 19:10:01 -04:00
Peter Johnson
e42f9b0603 Add EntryInfo class (missed in previous commit). 2015-09-16 00:53:14 -07:00
Peter Johnson
c5d456f3a6 Add ITable/NetworkTable GetKeys and GetSubTables accessors. 2015-09-16 00:51:05 -07:00
Peter Johnson
6cbc219427 Add ITable/NetworkTable accessors for new features. 2015-09-15 23:43:42 -07:00
Peter Johnson
4b06e74a14 Java: Return boolean from put functions.
The put functions return false if the key already exists with a different type.
2015-09-15 22:23:34 -07:00
Peter Johnson
42f973ebe0 Java: Don't raise illegal state exceptions unless really necessary.
- Ignore no-op calls to setServerMode() / setClientMode().
- Duplicate calls to initialize() act as a restart.
- shutdown() silently does nothing if not running.
2015-09-15 22:03:11 -07:00
Peter Johnson
84e7d5906c Java: Use Global instead of WeakGlobal for callbacks.
For some reason, weak globals don't work as they (unexpectedly) are
getting destroyed even though we save the callback in a map at the Java
level.
2015-09-15 21:32:51 -07:00
Peter Johnson
51eb96903c Java: Improve robustness against JVM crashes on exit.
The JVM doesn't always do a good job of telling JNI modules that the JVM
is going away, which results in a crash in the JavaGlobal and/or
JavaWeakGlobal destructors as they try to delete the associated references
after the JVM has already gone away.

To protect against this, the Notifier now has a static variable that's set
when the Notifier instance (a singleton) is destroyed.  This is used by
JavaGlobal and JavaWeakGlobal to detect when a process exit is in process.
2015-09-14 22:00:22 -07:00
Peter Johnson
6d8e796932 Disable logging on static instance destruction.
This avoids possible deadlocks on exit when a logger callback exists.
2015-09-12 21:44:51 -07:00
Peter Johnson
f7e603c7db Add DEBUG4 message for messages received during client handshake. 2015-09-11 19:19:15 -07:00
Peter Johnson
30ad381b6c Notify on entries created/modified during handshake. 2015-09-11 19:18:50 -07:00
Peter Johnson
5181c4e5be Java: Don't free locals after detaching thread.
We use a smart pointer to hold local java variables, and it was getting
destructed after DetachCurrentThread() was called, causing a JVM crash.
2015-09-11 16:28:58 -07:00
Peter Johnson
a2ec638db8 Java: Use empty string as default IP rather than null.
Using null can crash the JVM if initialize() is called before setIPAddress.
2015-09-11 12:06:22 -07:00
Brad Miller (WPI)
ef1e81f93e Merge "Create a WPILib Style guide." 2015-09-11 08:29:32 -07:00
Peter Johnson
953a2ce807 Implement keep-alives. 2015-09-08 23:17:11 -07:00
Peter Johnson
e1efb7364e Don't allow update intervals slower than 1 second. 2015-09-06 11:41:35 -07:00
Peter Johnson
123ba9c670 Use SmallVector instead of malloc buffers for WireEncoder. 2015-09-06 11:00:44 -07:00
Peter Johnson
d3e63e0078 Change cmake to output same jar name (ntcore) as gradle. 2015-09-05 23:19:22 -07:00
Fredric Silberberg
21e21d3b8b Fixed the Windows build. Also added ensuring that vs2012 is installed if
vs2015 is detecting, and printing an error that actually makes sense if it
is not. Finally, added a .gitreview file, so that git-review will be able
to autodetect the host and project for ntcore automatically.

Change-Id: I3cb9910d03d4742619770c91c06e3d5d1ee0f031
2015-09-06 01:12:19 -04:00
Peter Johnson
702b6de734 Java: Fix crash on JVM exit.
Fixes #22.
2015-09-05 11:05:02 -07:00
Peter Johnson
6233b3477b Java: Fix fallback on external library. 2015-09-05 10:57:37 -07:00
Peter Johnson
07942bf422 Notifier: fix Stop() so it actually notifies the thread. 2015-09-05 10:55:24 -07:00
Peter Johnson
66f9f73cb3 Add gradle wrapper. 2015-09-03 21:31:31 -07:00
Peter Johnson
2dd9eafa4f Enable "make test" on cmake. 2015-09-03 21:31:31 -07:00
Fredric Silberberg
b1783cc1db Integrate googletest and googlemock. 2015-09-03 21:31:26 -07:00
Peter Johnson
c5c615b7d3 Add sublime text files to .gitignore. 2015-09-03 21:13:33 -07:00
Peter Johnson
897420a5f4 Reindent build.gradle. 2015-09-03 20:44:32 -07:00
Tyler Veness (3512)
5d1ab0e820 Merge "Unbreak cmake build." 2015-09-01 20:38:49 -07:00
Tyler Veness
af01ff3001 Updated C++ documentation
Fixed incorrect documentation for Task class, improved documentation for RobotDrive's drive() function (thanks to FRC Team 4579), and ran doxygen -u on cpp.doxy to remove deprecated XML_SCHEMA and XML_DTD tags

Change-Id: I2f3fa4018d69b84e67376a5feb0eca43d5fa7623
2015-09-01 17:46:55 -07:00
Peter Johnson
550b04cff8 Merge pull request #21 from ThadHouse/master
Documents the C API
2015-08-31 21:05:26 -07:00
Thad House
46e0ac1258 Added documentation to the C interface
Client/Server functions.
2015-08-31 19:12:45 -07:00
Thad House
22d984a6bd Comments the interop functions in the C interface.
Properly space the comments.
2015-08-31 18:56:05 -07:00
Peter Johnson
8d6f96adb9 Add NT_FreeCharArray. 2015-08-29 08:58:53 -07:00
Peter Johnson
1f431754a9 Simplify C entry point function names.
Rename GetEntry*FromValue to GetValue*.
Rename a couple of NTStringArray to simply StringArray.
2015-08-29 08:48:36 -07:00
Peter Johnson
40093df91f Remove NT_AllocateNTString from ntcore.def. 2015-08-29 08:43:57 -07:00
Peter Johnson
f3bfee149c Change NT_GetEntry*FromValue to return copies.
Previously they returned references to the strings/arrays within the passed
NT_Value, which is different from the GetEntry* functions and risks
double-frees.
2015-08-29 08:39:40 -07:00
Peter Johnson
9b9b41f40e Reformat to match coding style. No functional changes. 2015-08-29 08:30:40 -07:00
Peter Johnson
a451fd3f04 Make string/raw getters/setters use char*+len instead of NT_String.
Also remove NT_AllocateString.

This avoids passing and returning struct NT_String by value.

Also make GetEntry*FromValue take a const NT_Value*.
2015-08-29 08:25:48 -07:00
Peter Johnson
7565207242 StartClient(): Make a local copy of server_name.
Previously we just held onto the const char* provided by the user.
This does not work in cases such as Java which provide a temporary
string.
2015-08-29 00:07:10 -07:00
Peter Johnson
e516200e09 Java: Add shutdown method to NetworkTable. 2015-08-28 23:57:37 -07:00
Peter Johnson
5beaf45773 TCPConnector: Add more info to debug messages. 2015-08-28 23:57:18 -07:00
Peter Johnson
1ca0157768 Java: Add backwards compat shims for array types. 2015-08-28 21:09:46 -07:00
Peter Johnson
dbe4168d8d Java: allow both object arrays and native arrays.
This allows easier use of things like ArrayList<Double>.
2015-08-28 20:48:29 -07:00
Peter Johnson
969916851c Need to return nullptr, not false. 2015-08-28 17:17:20 -07:00
Peter Johnson
b00b4cb185 Avoid warnings by using sprintf_s on MSVC.
Also use std::snprintf on other platforms.
2015-08-28 14:16:49 -07:00
Peter Johnson
2b9e7c6af1 Silence MSVC warnings regarding bool conversions. 2015-08-28 14:07:51 -07:00
Peter Johnson
0d9aaa86c6 Silence unused variable warning. 2015-08-28 14:07:18 -07:00
Peter Johnson
28b613d60c Silence MSVC winsock deprecated warnings. 2015-08-28 14:06:46 -07:00
Peter Johnson
b971c741d7 Fix JNI for Windows and implement JNI getValue functions. 2015-08-28 13:52:16 -07:00
Peter Johnson
ecadb117da Merge pull request #5 from ThadHouse/master
Add Getters, Setters, and Allocators to the C interface
2015-08-28 13:40:21 -07:00
Thad House
4b7dfc0254 Implements individual getters and setters for the C interface.
Starting to add Getters, Setters, and Allocators to the C interface

Because of the union in the NT_Value structure, some languages would
have a difficult time with the interop. This commit adds individual
getters and setters to the C interface to make interop easier.

In addition, some languages cannot allocate native memory in the same
heap that the C code would use. This adds allocation functions to make
sure that all our memory is allocated and can be freed properly from the
same heap.

The reason the getters are not individual get functions are because that
would require the calling code to first get the type, and then call the
specific getter for that type. Doing combined get functions causes
interop code to only have to cross interop boundaries once to get the
value instead of twice, for a light performance increase. However, this
could be changed without much work.

NT getters and setters round 2

Fixed some of the code based on the comments in the pull request.

Creates individual getters.

Should work better then 1 single getter.

Fixes end of file new line, and fixes function nameing

SetNTValue... made less sense then SetEntry... Matches the getter
naming.

Fixed methods to be less leaky.

Fixed Formatting, Fixed return values on Bool and Double. Added Contains Key

Changed ContainsKey to GetType. Also renamed Arr to Array

In public functions, I think I like Array better then Arr. Also, make
the getters that use value check for a null value, which should prevent
segfaults.

Fixes C++ Type functions to work properly

NTString Set functions still do not work properly though. I need some
help on there. Error message is in the pull request.

Changes Get functions to return status and have pointer to data passed in to be set.

Fixes NT_Strings

Added  new functions to ntcore.def

Fixes NT_PostRpcResponse in the def file

Was NT_PostRpcRepsonse, which was failing the build.

Removed unused parameter from setters

Since we were forcing exports in the cmake build, they were seen in
windows, but since the header didnt match the implementation they
wouldn't export on linux. So fixed that. Linux builds now work properly,
tested on a physical RIO.

Added a DisposeEntryInfoArray method.

There was no way to free the array returned from GetEntryInfo

Adds NT_DisposeEntryInfoArray to the def file.

Implement automatic persistent saves.

Also loads persistent file on server start.

Update TODO.

raw_istream and kin: a few cleanups.

anchor() doesn't seem to change compiler output in current compilers, so
remove it.  Use default where appropriate rather than empty bodies.

Clean up trailing whitespace.

Dispatcher: Move several fixed initial values to header.

Uninline constructors to reduce GetInstance() inlined code size.

Logger: Move m_min_level init to header.

Replaced time.h with std::chrono

This implementation returns the same values as the previous one on both a Linux machine and the roboRIO.

Value: Use variant of enable_if to fix MakeString/MakeRaw in GCC.

Tested on GCC 4.8, GCC 4.9, and clang 3.6.

Don't dispose in ConvertToC for NT_String and NT_Value.

Fixes #16.

Fixed Gradle build to actually export proper functions

Finishes fixes in pull request

Changes array setters to be const

To build RPC, needed a way to allocate a Char Array

Since after the callback, the C code explicitly frees, a way to make
sure to allocate the callback return string from the same heap was
needed.

Adds const to NTString setters.

Removes Const from NTString setters
2015-08-28 13:37:49 -07:00
Peter Johnson
a990859db6 Initial commit of Java wrappers.
The JNI bindings are built directly into the shared library.  In the gradle
build, all built shared libraries are embedded into the generated jar.

Java bindings may be disabled via -DWITHOUT_JAVA (cmake) or -PskipJava=true
(gradle).

TODO:
- getEntryInfo() and RPC are not yet implemented.
- The cmake build doesn't integrate the built objects into the jar.
- The Java client and server tests are not built (but have been manually
  tested).

This has not yet been tested on Windows.
2015-08-28 12:43:49 -07:00
Peter Johnson
9c576b10d0 NetworkTable: Don't prefix path with / if key is empty.
This avoids NetworkTable("").putValue("foo") resulting in key "//foo".
2015-08-28 12:24:33 -07:00
Peter Johnson
b28807d791 Client and server tests: Prefix keys for compatibility.
The NetworkTable interface prefixes with /, so this makes simple
interoperability testing easier.
2015-08-28 12:23:41 -07:00
Peter Johnson
b488cdd6ff Support immediate notify of connection listener.
Also only perform immediate notification to the callback actually
requesting the notification, not all existing callbacks.

Offset returned uids by 1 so uid=0 can be used to indicate immediate
notification.
2015-08-28 00:13:56 -07:00
Peter Johnson
302cc064c6 ConnectionListener: Use bool instead of int for connected parameter. 2015-08-27 23:48:40 -07:00
Peter Johnson
6e4d7ca933 NetworkTable: Protect listeners with mutex. 2015-08-27 23:39:52 -07:00
Peter Johnson
6c8a5935c9 NetworkTable: Fix table and key listener behavior.
The implemented behavior didn't match the old networktables implementation.
2015-08-27 22:22:51 -07:00
Peter Johnson
86445b6670 Import llvm::SmallPtrSet. 2015-08-27 22:16:56 -07:00
Peter Johnson
330ba39939 Unbreak Unix build. 2015-08-24 21:45:41 -07:00
Peter Johnson
0f4eecebe6 Fix StorageTest on MSVC.
MSVC outputs %g with a 3-digit instead of a 2-digit exponent.
2015-08-24 21:30:07 -07:00
Peter Johnson
a3dbe9a800 Fix Windows client.
Windows returns WSAEWOULDBLOCK on a connect() attempt on a nonblocking socket.

Also wrap socket error handling so errors are correctly reported on Windows.

Fixes #19.
2015-08-24 21:21:13 -07:00
Peter Johnson
822dc45834 Close persistent file before attempting to rename.
Windows requires the file be closed in order to rename it.
2015-08-24 20:38:33 -07:00
Peter Johnson
b8a99690b6 Fix non-unit tests build on Windows. 2015-08-24 20:22:41 -07:00
Peter Johnson
48b1120c31 Add some basic non-unit tests. 2015-08-24 20:07:36 -07:00
Peter Johnson
c27a1cec48 Unbreak StorageTest. 2015-08-22 23:26:22 -07:00
Peter Johnson
9d4a66a400 Merge pull request #17 from 333fred/master
Fixed Gradle build to actually export proper functions

Fixes #13.
2015-08-23 00:15:10 -05:00
Fredric Silberberg
c846dff524 Fixed Gradle build to actually export proper functions 2015-08-23 01:10:39 -04:00
Peter Johnson
29f73cb5c1 Don't dispose in ConvertToC for NT_String and NT_Value.
Fixes #16.
2015-08-22 19:31:53 -07:00
Peter Johnson
a8836b7665 Value: Use variant of enable_if to fix MakeString/MakeRaw in GCC.
Tested on GCC 4.8, GCC 4.9, and clang 3.6.
2015-08-22 14:01:33 -07:00
Peter Johnson
96bf5c24b5 Merge pull request #4 from calcmogul/master
Replaced time.h with std::chrono
2015-08-20 22:40:59 -07:00
Tyler Veness
ab9de550d9 Replaced time.h with std::chrono
This implementation returns the same values as the previous one on both a Linux machine and the roboRIO.
2015-08-20 16:04:55 -07:00
peter mitrano
4514e4489a refactored HAL library
builds two libraries, Athena  and Desktop.
Simulation should use Desktop, Robots should use Athena

Also:
 - copied Driverstation and Joystick from Devices into Sim
 - Descreased dependency of pthreads in JNI.
 - removed Simulation ifdef from non simulation
 - added missing decprecated attribute for msvc
 - removed usage reporting from sim
 - removed unused pom.xml and constexpr

Change-Id: If8eb540f9434dce17c77a245fda6985713e80b2d
2015-08-20 11:22:42 -04:00
Peter Johnson
9cb9c3beb0 Logger: Move m_min_level init to header. 2015-08-19 22:04:31 -07:00
Peter Johnson
2d1bc2f4c7 Uninline constructors to reduce GetInstance() inlined code size. 2015-08-19 21:49:18 -07:00
Peter Johnson
c6bed1f464 Dispatcher: Move several fixed initial values to header. 2015-08-19 21:16:44 -07:00
Peter Johnson
c41341c7e3 Clean up trailing whitespace. 2015-08-19 20:41:59 -07:00
Peter Johnson
f0e31487f0 raw_istream and kin: a few cleanups.
anchor() doesn't seem to change compiler output in current compilers, so
remove it.  Use default where appropriate rather than empty bodies.
2015-08-19 20:37:27 -07:00
Peter Johnson
a34143ae75 Update TODO. 2015-08-19 19:18:09 -07:00
Peter Johnson
ca9ce0f3a3 Implement automatic persistent saves.
Also loads persistent file on server start.
2015-08-19 19:18:09 -07:00
Peter Johnson
a5ccafd924 Merge pull request #3 from 333fred/gradle-changes
Gradle changes
2015-08-18 14:17:53 -07:00
peter mitrano
43960b9bca changed windows file separator to unix file separator
Change-Id: I7e57bde57c1f735d9bd70b26141fb562be392b4f
2015-08-18 12:05:30 -04:00
peter mitrano
29d029fa61 merged from frcsim branch
verified to work on real robots
adds sim eclipse plugins, fixed JavaGazebo, made wpilibC++Sim build on windows
 - Java and C++ simulation robot programs run on windows
 - simulation eclipse plugin delivers models and gazebo plugins
 - Java Gazebo now respects GAZEBO_IP variables and can work across networks
 - hal and network tables win32 hacked to work on windows
 - smart dashboard broken on windows due to network tables hacks
 - wpilibC++Sim, gz_msgs, and frcsim_gazebo_plugins build with CMake
 - removed constexpr for cross platform compatibility
 - msgs generated using .protos as a part of build process
 - some spare and unused cmake/pom files deleted
 - simulation ubuntu debians removed entirely
 - refactored CMake project flags and macros
 - updated to match non-sim C++ API
 - fixed and updated documentation
 - servo added to simulation

Change-Id: Ia702ff0f1fee10d77f543810ad88f56696443b05
2015-08-18 10:39:25 -04:00
Fredric Silberberg
9458da0454 Added building for arm, x86, and x64 with Gradle. This only builds ntcore currently, I'm working getting Google Test to work. 2015-08-15 21:46:21 -07:00
Peter Johnson
738881099f Unbreak cmake build.
Several ctre headers were in source directories but were required by other
headers in include directories.  This worked in gradle but not in cmake.

Change-Id: I806c76031b396d1694a18b8e30c705e92f617a66
2015-08-14 08:01:59 -07:00
Brad Miller (WPI)
4e46692191 Merge "Fixed wpilibJavaSim build" 2015-08-14 07:46:03 -07:00
Brad Miller (WPI)
8056aaa0aa Merge "Accelerometer classes no longer use PIMPL pattern" 2015-08-14 07:42:47 -07:00
Peter Johnson
80247e98e5 Use relative include paths in tcpsockets. 2015-08-13 23:07:45 -07:00
Peter Johnson
293d005432 Turn on logging in unit tests. 2015-08-13 22:14:17 -07:00
Peter Johnson
a395e3577f Notifier: Fix condition variable race. 2015-08-13 21:35:33 -07:00
Peter Johnson
8d7cdeabbf Implement remote procedure calls. 2015-08-13 21:32:16 -07:00
Tyler Veness
93b0dab7e4 Accelerometer classes no longer use PIMPL pattern
Change-Id: I792ac05e7080190ce268818a2bb94dacbeba274c
2015-08-13 15:16:00 -07:00
Tyler Veness
099056789e Fixed wpilibJavaSim build
Recent changes in master broke the build of wpilibJavaSim. Since the build server doesn't build the plugins after the library, this wasn't caught.

Change-Id: Ibd4a2ba9f359ddbc395ba0654fccada10ca78c78
2015-08-13 13:54:38 -07:00
Tyler Veness
f96b61ef11 artf4106: ISO C++ forbids variable-size array
C++14 changed the definition of VLAs, so the previous usage was no longer valid ISO C++. GCC 5.1.0 actually enforces this definition, so this commit fixes the build under GCC 5.1.0. This also builds under GCC 4.9.1.

Change-Id: Ib5ae2c49b4c4c21455b722b6633d7841066b4872
2015-08-13 12:26:46 -07:00
James Kuszmaul
b5695581c3 artf4170: Make CANTalon disable on destruction.
This both disables the CANTalon in the CANTalon class (which
should be redundant) and stops sending control signals in the
CanTalonSRX hal class.

Change-Id: I63d6a9d016c221e385d5d5a3679d854882ac6650
2015-08-13 11:42:30 -07:00
Tyler Veness
2bf3b6bed4 Replaced WPILib.h includes in integration tests with the minimum required subheaders to improve compilation times
I ran the benchmark in a tmpfs with an Intel Core i5-2430M. I ran it three times for each combination of build invokation and source tree.

First, I tested "make". For master (eb7d55f), I measured an average of 42.751s with a standard deviation of 0.372s. For this commit, I measured an average of 33.394s with a standard deviation of 0.140s. There was a 9.356s, or 22%, improvement with a total error of 1.3%.

Second, I tested "make -j4". For master (eb7d55f), I measured an average of 21.723s with a standard deviation of 0.158s. For this commit, I measured an average of 16.823s with a standard deviation of 0.340s. There was a 4.900s, or 23%, improvement with a total error of 2.7%.

Change-Id: Idb3adce62ed8ef449360c6583896b6da3565cf58
2015-08-13 11:31:46 -07:00
James Kuszmaul
e017f93f16 Fixed examples to build/run with new WPILib versions.
Also added some references/smart pointers to a couple places
that seemed convenient to the user.

I haven't updated the constructors for RobotDrive() related
examples, pending the results of gerrit change https://usfirst.collab.net/gerrit/#/c/960/

A few things that we are noticing:
--It might be nice if ReturnPIDInput() didn't have to be const;
  when people try to override it, they have to remember to put
  the const in and if they don't, then the compiler error isn't the
  most obvious (especially since this is a change). This would also
  apply to PIDGet() in the PIDSource interface.
--SendableChooser still takes raw pointers. This could lead to an
  issue I had to debug briefly where you accidentally call
  GetSelected() on autoChooser and put the resulting raw pointer
  into a unique_ptr, which destroys the pointer when it goes out of
  scope. Specifically, I was testing the PacGoat example and
  I ended up with a situation where if auto mode was run once, it
  was fine, but if it was run twice, the selected command would
  have been destroyed by the unique_ptr. I believe that this
  just requires updating SendableChosser to take shared_ptr.
--When the samples are compiled with -pedantic, it points out that
  START_ROBOT_CLASS macro expansion results in a redundant semicolon.

Change-Id: Ib4c025a61263d0d2780d4253faa31713e15333a5
2015-08-13 11:26:28 -07:00
Brad Miller (WPI)
4f8c1dff2f Merge changes I8a9cf402,I8c0f8442
* changes:
  Tuned test constants for VelocityPID.
  artf4127: Implemented velocity PID controller
2015-08-13 11:15:01 -07:00
James Kuszmaul
92edf35b41 Make deprecated warnings not error for macs.
Change-Id: I82e748e2f313e111ed2acd30fd11a1b027a6797c
2015-08-13 12:33:05 -04:00
Peter Johnson
e199e3571b Revert "Don't error on strict-aliasing warnings."
This reverts commit 492463411d.
2015-08-12 17:17:19 -07:00
Peter Johnson
e9618df1b5 Avoid pointer aliasing for double/bits conversions.
Instead use the llvm MathExtras.h functions for this, which use union
aliasing.
2015-08-12 17:15:10 -07:00
Peter Johnson
c34ba968f1 Message: Remove ArrayRef-taking ExecuteRpc/RpcResponse. 2015-08-12 17:11:09 -07:00
Peter Johnson
0cbcfbc3f0 Import llvm::DenseMap.
Bring in (most of) MathExtras.h as well, as it's shared by SmallVector and
DenseMap.
2015-08-12 17:08:45 -07:00
James Kuszmaul
cd4ebbd8a0 Tuned test constants for VelocityPID.
Also added a GetAvgError method to the PIDController
which averages the past n error values for use with
noisy sensor values (namely, for the velocity stuff).

Change-Id: I8a9cf40259dd56ef9093b36ed6891cc18b9131cf
2015-08-11 06:32:24 -07:00
Tyler Veness
d5922bb037 artf4127: Implemented velocity PID controller
Change-Id: I8c0f84422f7ca0ac5c50fddb282fb3452ee1d491
2015-08-11 01:05:45 -07:00
Peter Johnson
492463411d Don't error on strict-aliasing warnings.
These warnings occur in release mode for the double-to-uint64 cast used
for transmitting double values.
2015-08-04 20:38:31 -07:00
Peter Johnson
cd53feb193 Log DEBUG() macros: avoid spurious warnings in release builds. 2015-08-04 20:36:39 -07:00
Peter Johnson
00feb67064 Only use enable_if template on Windows.
This isn't required and doesn't compile on older GCC versions.
2015-08-04 19:59:45 -07:00
Peter Johnson
b3eed38187 Get build working on Windows (MSVC 2013).
Windows needs static libraries to build the tests as gtest/gmock are built statically.
2015-08-04 01:29:06 -07:00
Peter Johnson
f683a5c63c Export C API functions on Win32. 2015-08-04 00:15:00 -07:00
Peter Johnson
7d409f071e Add win32 tcpsockets implementation. 2015-08-04 00:01:13 -07:00
Peter Johnson
4146db6fc8 Visual Studio 2013 compilation fixes.
- Missing header file callouts in some cases (library deltas)
- Lack of support for auto parameters in lambdas
- Defining of ERROR by windows.h
- Dispatcher::Connection needs a move constructor (default not generated)
- Need explicit enable_if on std::string move template in Value to avoid trying to move const char[] (string literal)
- Compile flags
2015-08-03 01:27:02 -07:00
Peter Johnson
a86f65db1e Dispatcher: Implement transmit combining.
This handles most of the major cases, but not a loop of delete/assign, which
should be uncommon anyway.
2015-08-02 23:21:23 -07:00
Peter Johnson
53a0531def Storage::ProcessIncoming(): Don't override parameter with local. 2015-08-02 23:20:42 -07:00
Peter Johnson
7db00575c9 NetworkConnection: Add a bit more debugging. 2015-08-02 22:23:14 -07:00
Peter Johnson
5b65bfb64d Storage: Fix comparison for client update-on-assign. 2015-08-02 22:18:46 -07:00
Peter Johnson
3b0eb56cf6 Update TODO. 2015-08-02 21:47:56 -07:00
Peter Johnson
e9073a3cc0 Implement notifiers.
The notifier thread is lazily started when the first notifier is added.
This avoids the extra thread/processing overhead when notifiers are not used.
2015-08-02 21:47:01 -07:00
Peter Johnson
538a19fd47 Implement GetConnections(). 2015-08-02 10:47:05 -07:00
Peter Johnson
84ff80710c Refactor TCP-specific pieces of Dispatcher. 2015-08-02 00:33:41 -07:00
Peter Johnson
0dcaf56ed1 Add NetworkAcceptor and NetworkStream interfaces.
These allow mocking of TCPAcceptor and TCPStream respectively.
2015-08-02 00:06:27 -07:00
Peter Johnson
6703968f73 Dispatcher: Fix shutdown order race.
We need to wait until after the dispatch and client/server threads have
been stopped before closing connections, as these threads can add connections.
2015-08-01 23:37:13 -07:00
Peter Johnson
8ec65dbfc8 Use unique_ptr instead of shared_ptr for m_server_acceptor. 2015-08-01 20:29:16 -07:00
Peter Johnson
4670ef6ec5 Refactor StorageTest base class. 2015-08-01 16:33:52 -07:00
Peter Johnson
35e6400174 Storage: Add vector include. 2015-08-01 16:33:39 -07:00
Peter Johnson
67de7af7b2 Storage: Use unique_ptr instead of shared_ptr for Entry. 2015-08-01 11:47:35 -07:00
Peter Johnson
3b207ad2c3 StorageTest: Fix string comparison for Warn().
Previously this was comparing pointers rather than the string contents.
2015-08-01 11:45:41 -07:00
Peter Johnson
b5274a495e Dispatcher: Don't call Storage::GetInstance() internally.
This makes it difficult to test.  Instead, store reference as member variable,
and populate it at constuction (with an alternate constructor available for
test purposes).
2015-08-01 11:15:04 -07:00
Peter Johnson
11508b77d1 Ensure initial synchronization is atomic. 2015-07-31 23:56:06 -07:00
Peter Johnson
0a10778697 NetworkConnection: Kill write thread when read dies and vice-versa. 2015-07-31 23:40:16 -07:00
Peter Johnson
ecbf76e94b Update tcpsockets classes to use log framework. 2015-07-31 23:34:54 -07:00
Peter Johnson
6c0103639c Make LOG() usable from other namespaces. 2015-07-31 23:33:41 -07:00
Peter Johnson
c2eb4a766e Dispatcher: Provide some INFO-level connection messages. 2015-07-31 23:26:38 -07:00
Peter Johnson
06e8d835dd Provide ostream output for StringRef. 2015-07-31 23:20:59 -07:00
Peter Johnson
3a71acec52 Automatically reconnect client.
Also clean up some condition variable handling to make it more robust.
2015-07-31 23:14:26 -07:00
Peter Johnson
a9af4589ac Don't send empty message lists from dispatch.
This terminates the write thread.
2015-07-31 22:49:43 -07:00
Peter Johnson
4356e313ec Add logging framework.
DEBUG messages are completely optimized out if NDEBUG is defined.
2015-07-31 22:41:26 -07:00
Peter Johnson
afcfdb13a0 Clean up CMakeLists.txt a bit. 2015-07-31 20:57:56 -07:00
Peter Johnson
3a570add4e Build as a shared rather than static library. 2015-07-31 20:54:25 -07:00
Peter Johnson
ead125555c Implement client/server handshaking. 2015-07-31 20:32:52 -07:00
Peter Johnson
98ad6d1b43 Message: Handle receiving Server Hello. 2015-07-31 20:14:15 -07:00
Peter Johnson
978cdadda0 Storage::GetEntryType(): Check for null entry. 2015-07-31 14:16:13 -07:00
Peter Johnson
cde7782c21 Make StorageEntry a struct and move into Storage class. 2015-07-31 13:48:33 -07:00
Peter Johnson
138ebf5b4d Storage: generate messages rather than intermediate updates. 2015-07-31 13:21:19 -07:00
Tyler Veness
f0e3bb5164 artf4165: D term of PID controller now uses change in input instead of change in error
This avoids large additions introduced by the D term when a step change occurs in the setpoint. Otherwise, the changes return the same values. Let error = setpoint - input and prevError = prevSetpoint - prevInput. If the D term is calculated via error - prevError, then:

error - prevError = (setpoint - input) - (prevSetpoint - prevInput)

If we ignore the setpoint changing, then we get:

error - prevError = (setpoint - input) - (setpoint - prevInput)
                  = prevInput - input

Change-Id: Ifa4af9b265e3c4bd263e8541355f2b80269693e9
2015-07-30 08:55:28 -07:00
Tyler Veness
918cde0c0f artf4155: Move Port.h from hal/lib/Athena to hal/include/HAL
Change-Id: I76a8d8baf4d77b7383c321d16a9286537632c3e9
2015-07-30 08:54:02 -07:00
peter mitrano
43f16510fa moved ctre includes from C++Devices into Hal
Change-Id: I0d0460516b5e26345faa321ed6e24d80eba65358
2015-07-30 07:57:14 -07:00
Brad Miller (WPI)
959f8775d0 Merge "Temporarily disable MutexTests until artf4167 is resolved." 2015-07-30 07:51:14 -07:00
Brad Miller (WPI)
0d70a39f67 Merge "Replaced ::std with std for readability/consistency." 2015-07-30 07:47:38 -07:00
James Kuszmaul
ba57c7f24d Make gradle actually build command tests in C++.
Change-Id: I7052f526facc557eb0a0ca58467e1220722f7d18
2015-07-30 10:00:53 -04:00
Peter Johnson
a127bca0e4 Push down null check for m_queue_outgoing. 2015-07-30 00:06:50 -07:00
Peter Johnson
83be99e78c Immediately process incoming messages.
This required moving message processing into the Storage class.
2015-07-29 23:45:04 -07:00
Peter Johnson
5b5e3ae6aa Dispatcher: Start implementing processing of incoming messages. 2015-07-29 20:33:26 -07:00
Peter Johnson
f6576b18f7 Storage: Add more Dispatcher accessors. 2015-07-29 20:33:13 -07:00
Peter Johnson
9a621e9272 Various NetworkConnection improvements.
- Keep connection state.
- Store remote id
- Getter for proto_rev
- Cleanup on Stop()
- Cleaner termination of write thread.
2015-07-29 20:31:59 -07:00
James Kuszmaul
4b575e3e7e Replaced ::std with std for readability/consistency.
Change-Id: I65f9673c237d3513f99827e28963eb22ae9df0c2
2015-07-29 16:48:04 -04:00
Peter Johnson
c01f2977ac StorageEntry: Make value() const. 2015-07-28 22:29:58 -07:00
Peter Johnson
683c53babc Message::str(): Return StringRef. 2015-07-28 22:07:02 -07:00
Peter Johnson
5823e3c780 Storage: Add CreateEntry function for Dispatcher use. 2015-07-28 22:06:42 -07:00
James Kuszmaul
cbc372c71e Temporarily disable MutexTests until artf4167 is resolved.
Change-Id: I09f4e48ff304df312daf4ebb77681965acf6066d
2015-07-27 11:51:29 -04:00
Peter Johnson
a0d30ffef1 Storage: Use StringMap instead of ConcurrentQueue for updates.
Updates are merged or themselves updated as user code changes.  This avoids
the need for the dispatcher to do this and also avoids the need for disabling
updates when the dispatcher isn't running, because there's no risk of memory
usage piling up.
2015-07-26 20:41:48 -07:00
Peter Johnson
fb1b82e239 StorageEntry: Also store copy of name here.
This wastes a bit of space but is necessary for assign message generation.
2015-07-26 10:28:20 -07:00
Peter Johnson
3bc5699ba1 Storage: Provide accessor for global mutex. 2015-07-26 09:42:14 -07:00
Peter Johnson
18659257d3 Storage: Make setters globally atomic.
Previously, setters were locally but not globally atomic because they
used GetEntry() (globally atomic) in conjunction with locally atomic
gets/sets to the StorageEntry.  To support synchronizing network handshakes
they need to be globally atomic.

GetEntry() has been removed due to this issue, so a helper was added to
StorageTest instead.
2015-07-26 09:27:23 -07:00
Peter Johnson
3c7cb363ba NetworkConnection: Prefer emplace to push. 2015-07-25 10:47:53 -07:00
Peter Johnson
787d39851b Update gradle build to match cmake build. 2015-07-25 01:33:15 -07:00
Peter Johnson
ae070aca70 Value: Add type check functions. 2015-07-24 22:11:57 -07:00
Peter Johnson
63dd895e6d Pass CMAKE_TOOLCHAIN_FILE down to external project (gmock). 2015-07-23 22:31:51 -07:00
Peter Johnson
507b083e77 WireEncoderTest.cpp: Don't test compiler truncation. 2015-07-23 22:06:57 -07:00
Peter Johnson
13bc05d9ec leb128Test: Fix incorrectly sized constants. 2015-07-23 22:04:51 -07:00
Peter Johnson
3f24b86875 ITable: Add Persist function to make a key persistent. 2015-07-23 21:53:33 -07:00
Peter Johnson
1368f0ec8f NetworkTable: Use networktables.ini as persistence filename. 2015-07-23 21:47:54 -07:00
Peter Johnson
196fcf791b ITable: Const'ify getter functions. 2015-07-23 21:46:30 -07:00
Peter Johnson
6bccf528d7 ITableListener.h: Forward declare ITable. 2015-07-23 21:41:30 -07:00
Peter Johnson
1fc03803cd ITableListener::ValueChanged: Don't make key const. 2015-07-23 21:40:24 -07:00
Brad Miller (WPI)
f74ca87e26 Merge "NamedSendable::GetName() is now const qualified" 2015-07-23 07:49:02 -07:00
Brad Miller (WPI)
5756be5c23 Merge "Fix std::unique_ptrs using incomplete types" 2015-07-23 07:48:05 -07:00
Brad Miller (WPI)
2da3f7f89b Merge "Replaced all uses of DISALLOW_COPY_AND_ASSIGN macro" 2015-07-23 07:46:51 -07:00
Brad Miller (WPI)
cf965d26a0 Merge "Make test scripts spawn driverstation as admin." 2015-07-23 07:45:17 -07:00
Brad Miller (WPI)
af3eaae090 Merge "Comment out SetPriority() in Task constructor." 2015-07-23 07:43:17 -07:00
Peter Johnson
8fa0e6c914 Add shims for old NetworkTable interface.
This provides classes for virtual subtables using path delimiters within
the global NetworkTable namespace.
2015-07-23 01:23:09 -07:00
Peter Johnson
6f940bcaaf Add immediate_notify and is_new to entry listener.
On the callback function, is_new indicates the value is newly added.

On adding a callback function, immediate_notify indicates the callback
should be called once (with is_new=true) for each matching entry that
already exists.
2015-07-23 01:02:53 -07:00
Peter Johnson
79f732f239 Import llvm::SmallString and dependencies.
Update StringRef and StringExtras with SmallVector functions.
2015-07-22 22:29:46 -07:00
Peter Johnson
593bc28446 Move StringMap.h and StringExtras.h to public includes.
While these aren't required by the public interface, they are generally
useful classes for users of the library.
2015-07-22 22:10:56 -07:00
Peter Johnson
9c204533e8 Value: Disambiguate std::string&& and StringRef.
Making the former a template causes the compiler to prefer the latter
when given a bare C string.
2015-07-22 22:08:13 -07:00
Peter Johnson
4c14f7823a ntcore_cpp.h: Comment cleanup. 2015-07-22 21:41:25 -07:00
Peter Johnson
4aa2d65bba Storage: Use std::forward and emplace for updates. 2015-07-21 22:43:44 -07:00
Peter Johnson
bb5848a033 ConcurrentQueue: Add emplace function.
Also use std::forward for rvalue push.
2015-07-21 22:43:02 -07:00
Peter Johnson
9f728b850e Add MSVC specific compiler flags. 2015-07-21 21:14:22 -07:00
James Kuszmaul
9c2678fdb9 Make test scripts spawn driverstation as admin.
Change-Id: Ic7f27fa902b2ac67c6785b7f422601ade3d23f2c
2015-07-21 08:50:43 -04:00
Tyler Veness
3bbeccfbb5 Replaced all uses of DISALLOW_COPY_AND_ASSIGN macro
Change-Id: I8371beb286a20d4c7619aab226136569fdefafef
2015-07-21 01:23:34 -07:00
Peter Johnson
b4c65dc210 Make global instance init thread-safe.
Use local statics except for Visual C++ < 2015.
2015-07-20 23:36:22 -07:00
Peter Johnson
5df62ac172 Storage: Disable use of update queue by default.
This ensures we don't "leak" memory for local use when the dispatch thread
is not running.
2015-07-20 22:24:47 -07:00
Peter Johnson
0979c1c9ca Storage, NetworkConnection: Don't in-place construct atomics.
Visual C++ 2013 doesn't support this.
2015-07-20 20:52:26 -07:00
Peter Johnson
8bbe5f9fdb ArrayRef: Add portability checks for constexpr. 2015-07-20 20:49:49 -07:00
Tyler Veness
881dcd08e5 Fix std::unique_ptrs using incomplete types
CANTalon declared a std::unique_ptr<CanTalonSRX> with CanTalonSRX as an incomplete type. This causes a compilation error in code using CANTalons. The CANTalonTest didn't catch this because it included ctre/CanTalonSRX.h as well as CANTalon.h. Normal user code doesn't do that.

I reviewed uses of std::unique_ptr elsewhere and determined that PIDCommand may suffer from the same problem. There is no test for PIDCommand to prove otherwise.

Change-Id: I54caf4941927910471ffb7170eb6737ba0e08437
2015-07-20 20:39:49 -07:00
Peter Johnson
3cd3d1691e Message: Use #define instead of constexpr. 2015-07-20 20:34:19 -07:00
Peter Johnson
6b2fb02bed Dispatcher: Don't in-place construct atomics.
Visual C++ 2013 doesn't support this.
2015-07-20 20:21:37 -07:00
Peter Johnson
8938a19810 Dispatcher: Avoid warning by using for(;;) instead of while(true). 2015-07-20 20:20:01 -07:00
Peter Johnson
158ae61811 Dispatcher::SetUpdateRate(): Explicitly convert to int. 2015-07-20 20:19:01 -07:00
James Kuszmaul
6bd2534f0e Comment out SetPriority() in Task constructor.
Change-Id: I82bdab5558f328d686461556b9425ddec878eb6b
2015-07-20 19:38:06 -04:00
Tyler Veness
451c4e81c3 NamedSendable::GetName() is now const qualified
Change-Id: Ie9e4daac4473e44f4248385f992da750501443e5
2015-07-20 16:17:29 -07:00
James Kuszmaul
eb7d55fd59 Fixed classes with undefined constructor.
IterativeRobot and BinaryImage had no constructor
defined (and so would give linker errors).
Error just had an empty constructor defined,
so I switched to "=default".

Change-Id: Ia8efb4282928227878dfefeda58ccb8cf06aabb2
2015-07-20 17:31:44 -04:00
Brad Miller (WPI)
c776324f96 Merge "Make the teststand run as lvuser instead of admin." 2015-07-20 14:22:17 -07:00
James Kuszmaul
98f2d08103 Changed const char* -> string in most of wpilibc.
The HAL will remain untouched in order to maintain C-style
compatibility. A few places in wpilibc were left as
C-style strings, especially if special formatting (eg,
elaborate uses of snprintf or sscanf) was being used.

In general, const char* was changed to std::string.
character buffers used for formatting were either
untouched, changed to std::stringstream, or changed
to std::string, depending on what was done with
the buffer.

Change-Id: I5e431ddf1cc4d9a6d534e1f21b16ea23be26e7f1
2015-07-20 13:20:02 -04:00
James Kuszmaul
534ea134a4 artf4154: Get rid of raw pointers in C++.
This deals with the majority of the user-facing code
in wpilibC++Devices and a substantial portion of it in
wpilibC++. wpilibC++Sim and wpilibC++IntegrationTests
are untouched except where it is necessary to make them
work with the rest of the libraries.

There is still a lot to do in the following areas:
-The HAL (which we may not want to touch at all).
-The I2C, Serial, and SPI interfaces in wpilibC++Devices,
  which I haven't gotten around to doing yet.
-Most wpilibC++Devices classes have void* pointers
  for interacting with the HAL.
-InterruptableSensorBase passes a void *params for
  the interrupt handler.
-I haven't converted all the const char* to std::strings.
-There are plenty of other cases of raw pointers still
  existing.
-This doesn't fall directly under raw pointer stuff,
  but move syntax and rvalue references could be introduced
  in many places.
-I haven't touched vision code.
-The Resource classes conflict (one is in the hal, the other
  in wpilibC++). Someone should figure out a more
  permanent fix (eg, just renaming them), then doing
  what I did (making a new namespace for one of them,
  essentially the same as renaming it).

A few other things:
-I created a NullDeleter class which is marked as deprecated.
  What this does is it can be passed as the deleter to a
  std::shared_ptr so that when you are converting raw pointers
  to shared_ptrs the shared_ptr doesn't do any deletion if
  someone else owns the raw pointer. This should only be
  used in making old raw pointer UIs.
-I had to alter the build.gradle so that it did not
  emit errors when deprecated functions called deprecated
  functions. Unfortunately, gradle doesn't appear to be
  actually printing out gcc warnigns for some reason.
  The best way I have found to fix this is to patch
  the toolchains (https://bitbucket.org/byteit101/toolchain-builder/pull-request/5/make-gcc-not-throw-warnings-for-nested/diff)
  so that a deprecated function calling a deprecated
  function is fine but a non-deprecated function calling
  a deprecated function will throw a warning (which we
  then elevate with -Werror). I believe that clang
  deals with this properly, although I have not
  tried it myself.

Change-Id: Ib8090c66893576fe73654f4e9d268f9d37be06a2
2015-07-20 13:18:29 -04:00
Tyler Veness
fd4c169658 artf4149: Removed references to VxWorks
Implemented setTaskPriority() and getTaskPriority() in Task HAL API

Removed all other unimplemented functions in HAL and removed spawnTask()

Replaced instances of pthread_t* with TASK typedef

Removed unused HAL error constants and removed commented-out classes and functions in wpilibj's HALLibrary

Changed Task class API to match the construction semantics of a std::thread

Change-Id: I3bc951a3da90d24c5589fae4d1ca2bb60225c873
2015-07-20 11:49:29 -04:00
James Kuszmaul
5712565068 Removed dependencies on pthread from frcsim.
Because we want to be able to compile/run wpilibC++Sim on
windows, we would prefer not to require a windows version
of pthread. This commit moves from pthread constructs to
standard library constructs.

Change-Id: I12392a8910189537dd067afdf017e4994d570a66
2015-07-20 07:06:57 -07:00
Tyler Veness
3f59f3472a artf4156: Replaced synchronization primitives with C++11 equivalents
Change-Id: I90da739347e875efda2a29dd5484b6dda3cd4753
2015-07-20 10:06:08 -04:00
Peter Johnson
98d45777c6 Remove unnecessary llvm qualifier. 2015-07-20 00:19:20 -07:00
Peter Johnson
d059022071 Add logging to TODO. 2015-07-19 23:52:12 -07:00
Peter Johnson
c9260ea785 Change GetEntryTypeFunc to std::function.
Also implement it as a member function of Dispatcher.
2015-07-19 23:17:14 -07:00
Peter Johnson
c9ca2f902e Add TODO list. 2015-07-19 22:56:48 -07:00
Peter Johnson
29691e0ac5 StorageTest: Add LoadPersistent and SavePersistent coverage. 2015-07-19 22:45:20 -07:00
Peter Johnson
a3fcce891f LoadPersistent: Fix various bugs. 2015-07-19 22:44:34 -07:00
Peter Johnson
8db016c223 SavePersistent: Sort in name order, fix list commas. 2015-07-19 21:10:20 -07:00
Peter Johnson
b0802f3e26 StorageTest: Add fixture classes, add GetEntryInfo test. 2015-07-19 19:43:27 -07:00
Peter Johnson
e4731a4e4e Storage::GetEntryInfo: Actually filter on types. 2015-07-19 19:42:13 -07:00
Peter Johnson
67ae9e1ba7 Add initial set of unit tests for Storage. 2015-07-19 18:11:36 -07:00
Peter Johnson
d6afbc56c4 Storage: Delete functions now delete from map.
This is ok due to the map storing shared_ptr.
2015-07-19 18:10:26 -07:00
Peter Johnson
ffb54872c0 Storage::SetEntryFlags(): Fix deadlock, check for empty name. 2015-07-19 17:50:31 -07:00
Peter Johnson
ead6b4960f Storage: Use make_shared instead of reset. 2015-07-19 16:46:59 -07:00
Peter Johnson
21b7acc397 Storage: Make testable, make EntriesMap typedef private. 2015-07-19 16:36:30 -07:00
Peter Johnson
173111c64c ConcurrentQueue: Make mutex mutable. 2015-07-19 16:36:08 -07:00
Peter Johnson
cf18355fe2 Unit tests: Prefer constructor to SetUp() in fixtures. 2015-07-19 16:30:04 -07:00
Peter Johnson
1cc148848b StartServer: Take persist_filename as a StringRef. 2015-07-19 16:11:56 -07:00
Peter Johnson
ec54904347 Tighten up C++ API implementation a bit. 2015-07-19 16:09:59 -07:00
Peter Johnson
0a18d2e57b Storage: Make individual entries thread safe.
Also use shared_ptr to refer to entries rather than names.
2015-07-19 16:02:21 -07:00
Peter Johnson
c08e2ed8fc ConcurrentQueue: Add size() function. 2015-07-18 01:32:21 -07:00
Peter Johnson
2437f06c7f Implement majority of Storage functionality.
It's also now thread-safe.
2015-07-18 01:29:51 -07:00
Peter Johnson
9b7e265762 Continue implementing client. 2015-07-18 01:29:24 -07:00
Peter Johnson
c4a7f6ec9b SavePersistent: Safely save through temp file.
Also change SavePersistent and LoadPersistent to take StringRef.
2015-07-18 00:39:08 -07:00
Peter Johnson
d05656b716 StorageEntry: Make data public, remove accessors.
Also add id and seq_num fields.
2015-07-17 23:41:25 -07:00
Peter Johnson
04789d9ae4 SequenceNumber: Add default constructor. 2015-07-17 23:41:05 -07:00
Peter Johnson
77acf1f35b Implement Flush() API. 2015-07-17 22:40:00 -07:00
Peter Johnson
412e8034de Start implementing client and server. 2015-07-17 22:39:36 -07:00
Peter Johnson
a6162ba990 NetworkConnection: Trigger threads as necessary in Stop(). 2015-07-17 22:28:47 -07:00
Peter Johnson
7c51178608 TCPAcceptor: Add shutdown() function. 2015-07-17 22:28:13 -07:00
Peter Johnson
899c489124 TCPStream: Shutdown on close. 2015-07-17 22:27:49 -07:00
Peter Johnson
3062e1e740 Message: Add data accessors. 2015-07-17 19:41:40 -07:00
Peter Johnson
854bfba7c9 Value: Set last_change field. 2015-07-17 11:16:03 -07:00
Peter Johnson
1d4de091f9 Implement nt::Now(). 2015-07-17 11:15:44 -07:00
James Kuszmaul
b8f044f8ec Make the teststand run as lvuser instead of admin.
Change-Id: I46c9fee09c99826393d02f792508307a77d14320
2015-07-17 13:32:59 -04:00
Peter Johnson
440916cf2a Fix string terminator in char** output. 2015-07-17 10:16:46 -07:00
Peter Johnson
3f4feb2f5c Remove unused variable. 2015-07-17 10:16:31 -07:00
Peter Johnson
3025a7e51e Finish C wrappers. 2015-07-17 08:47:25 -07:00
Peter Johnson
fcbd2751ba Provide C++ API. Move all classes to "nt" namespace.
The C API is now just simple wrappers around the C++ API.
2015-07-17 07:21:07 -07:00
Peter Johnson
56f1481c24 Add Dispatcher. 2015-07-16 22:55:50 -07:00
Peter Johnson
2ea20b8e81 Value: Use NT_Value for internal storage.
This saves a tiny bit of space, but also allows for the NT_Value equivalent
of a Value to be provided with no copy cost (will be useful in the C API).
2015-07-16 21:44:37 -07:00
Peter Johnson
9906116d23 Don't base Value on NT_Value.
Also use std::string instead of NT_String.

Conversions to/from the internal structures will be done at the interface.
2015-07-16 01:38:27 -07:00
Peter Johnson
555725a05b NetworkConnection: Don't explicitly declare default move constructor. 2015-07-15 23:29:17 -07:00
Peter Johnson
13cbf4e288 Message: use shared_ptr.
NetworkConnection: Own the input and output queues.
2015-07-15 21:20:18 -07:00
Peter Johnson
beb92e6cbf NetworkConnection: Ignore duplicate Start() calls. 2015-07-14 23:15:30 -07:00
Peter Johnson
4d3fb3c497 Storage: Use unique_ptr for instance. 2015-07-14 23:15:08 -07:00
Peter Johnson
dbd0c98306 Message: implement MsgType constructor. 2015-07-14 23:09:56 -07:00
Peter Johnson
53fb702512 ConcurrentQueue: Add empty() function.
Change-Id: I563c0343f70a5e4577a6387914d821728cbdd007
2015-07-13 22:56:58 -07:00
Peter Johnson
e640708245 Start implementing network connectivity.
Change-Id: I82875bfd1c3a086033d22de636d4fb43455ebac3
2015-07-13 22:46:41 -07:00
Peter Johnson
8fdaf61ef1 Use typedef for GetEntryFunc function pointer.
Change-Id: I58d4be7783656eb712cb32cd17075b4f35886693
2015-07-13 22:45:35 -07:00
Peter Johnson
a5713252dc Message::Read(): restructure to read directly into Message.
Change-Id: Ibed3d6d334130c165543fd20987ac5d54b0696eb
2015-07-12 23:35:23 -07:00
Peter Johnson
f5ec5e180d Message: don't explicitly convert StringValue.
Change-Id: I2ab104d19e49c1b6d3384134587182ce9b8980f8
2015-07-12 23:14:48 -07:00
Peter Johnson
27e0f22c04 StringValue: Implictly convert/assign from StringRef.
Change-Id: I87f1e60a3e87db66c6efda824f9e66e919f0a5ea
2015-07-12 23:13:43 -07:00
Peter Johnson
2016bcb37a Replace MessageReader and MessageWriter with Message.
Change-Id: I4b23d5a1e0e39dc2487f252a0947f11328e33090
2015-07-12 11:24:34 -07:00
Peter Johnson
1760d32019 MessageReader: Rename Run() to ReadMessage().
Change-Id: Id6312478e331c4d7f7832e214a57ecf0338e0fcb
2015-07-11 09:33:35 -07:00
Peter Johnson
9808c6e62b Remove extra whitespace.
Change-Id: Ibbfe4f4e1b73f9dcf58cb3ae1f34ffa661ef5de0
2015-07-11 09:33:35 -07:00
Peter Johnson
071b278b71 MessageReader: Use rvalue refs and std::move for handlers.
Change-Id: Iedba512d64ef2674c18a88b9fb720b2a6346b902
2015-07-11 09:33:35 -07:00
Peter Johnson
f4673f3123 WireDecoder::Read(): Use const char instead of plain char.
Change-Id: I14932ccd174b70fa3f90676c66ac0907e6086238
MessageReader: Use StringRef for callbacks.
2015-07-11 09:33:35 -07:00
Peter Johnson
8ee4c36e02 MessageReader/MessageWriter: bring in proto_rev().
Change-Id: I7b4ce8a33fe480eb78fb36935de5480bdd1f6f13
2015-07-11 09:33:34 -07:00
Peter Johnson
0f876d1989 Use StringRef instead of NT_String in various places.
Change-Id: Ibd11e0e1c3157eb8647211797ef8b4aa63f58eb8
2015-07-11 09:33:34 -07:00
Peter Johnson
eecf0deeec Add WireDecoder test and finish WireEncoder test.
Change-Id: I0d2b3421df55f8f986678b694bbd5481e8fc6e6b
2015-07-11 09:33:34 -07:00
Peter Johnson
6aa32e8752 WireDecoder: Add overloads for StringValue and Value.
Change-Id: Idb41fd16fec8efc8b984c1a9b4d225829d16e344
StringValue: Add comparison operators.
2015-07-11 09:33:34 -07:00
Peter Johnson
a55b6565b8 WireDecoder ReadDouble: Use ref cast.
Change-Id: I47f23709960d13c005916b5d41d81339302adda5
2015-07-11 09:33:34 -07:00
Peter Johnson
c1c0c8d418 Optimize Write16/32/Double a bit.
Change-Id: I3d09a9d1b0b33da401312b3389234f7680da6f97
2015-07-11 09:33:34 -07:00
Peter Johnson
1634773529 Finish WireEncoder tests and fix a bug.
Change-Id: Iddb6003cf2050aebbda4650a5596342288432fde
2015-07-11 09:33:34 -07:00
Peter Johnson
547e2ad72b leb128 test: naming consistency
Change-Id: Ib37433110781d87f8736c82d4b8249d580b5a1dd
2015-07-11 09:33:34 -07:00
Peter Johnson
ca90648118 Add copyrights and header guards.
Change-Id: I1e4c22a1626095750b6ffa8e0edd5e078ef221ec
2015-07-11 09:33:34 -07:00
Peter Johnson
958fbaa819 ValueTest / StringValueTest: Make conversion function static.
Change-Id: Ia7411fd58cfd7ee9225a7c7f90534567e7ae02ba
2015-07-11 09:33:34 -07:00
Peter Johnson
fa19a54ab7 Separate ValueTest and StringValueTest into headers.
Change-Id: If326e6943a11f271ef939dc815a45ba0b4ee271c
2015-07-11 09:33:34 -07:00
Peter Johnson
c9c1b7e5d8 Rename test files.
Change-Id: If7a2894f21b86bf9e4036e3069a2e5602ca932b0
2015-07-11 09:33:34 -07:00
Peter Johnson
4d5e5c82d4 Start WireEncoder testing.
Change-Id: I0e4161f5b3cab167d3c3d650588671be8a1b78b3
2015-07-11 09:33:34 -07:00
Peter Johnson
9bd4a5ecc3 Add proto_rev accessors to WireEncoder and WireDecoder.
Change-Id: I401a0fbc675379c4d5b1dbcc42cbefe0311304f1
2015-07-11 09:33:34 -07:00
Peter Johnson
09d6619a58 Add LEB128 test.
Change-Id: Iaeb2d818226a281a905cb69ef12725e504c3a03d
2015-07-11 09:33:34 -07:00
Peter Johnson
e7ba40dcfd ReadUleb128: Take const buf.
Change-Id: Idd4637790938485a291a20eab4e14f5112c04c8a
2015-07-11 09:33:34 -07:00
Peter Johnson
ae42eee8e1 More Base64 fixes (correct decode return value).
Change-Id: Ic8f5eb7efd39e1d155a458aa41e430232bee7c7d
2015-07-11 09:33:34 -07:00
Peter Johnson
1e9b9b9a3e Base64: Fix a little differently.
Change-Id: I394a1c99e1ecf87b4e236cf0aced5f9429364ace
2015-07-11 09:33:34 -07:00
Peter Johnson
1225d3ef75 Slight whitespace fix.
Change-Id: I752a000775efefd45cf5c5be0a084e855f68e13f
2015-07-11 09:33:34 -07:00
Peter Johnson
407ded6b8c Use ASSERT_EQ with correct order of arguments.
Change-Id: Ieed4703283ae222df3aee8adb07ca1e65e863c62
2015-07-11 09:33:34 -07:00
Peter Johnson
c7b5266f9a Add Base64 tests and fix a couple of bugs found.
Change-Id: I9762fe018be78cf38aa506026e78139e2479cd98
2015-07-11 09:33:33 -07:00
Peter Johnson
5a0fccc9cf Add unit tests for StringValue and Value.
Add unit test framework to CMakeLists.txt.
Fix a couple of bugs found by unit tests.

Change-Id: I2092a7f0570fae0f19f9e083c4837ccefcc4ca1a
2015-07-11 09:33:33 -07:00
Peter Johnson
b66fb68f29 Finish LoadPersistent().
Change-Id: I5c4c439dc3d2585f2edae74f78c14f826b091186
2015-07-11 09:33:33 -07:00
Peter Johnson
cb30bb5d70 Rename base64 to Base64.
Change-Id: I0dea9f77ca898ab1a278a0b0163418f96f823725
2015-07-11 09:33:33 -07:00
Peter Johnson
40ebb9a844 C++-ify base64 functions.
Change-Id: I5cf7a8971b18b7a2700fe8d616733e32fa1e3282
2015-07-11 09:33:33 -07:00
Peter Johnson
b7a87bb6f9 Make StringValue noncopyable.
Change-Id: I5b02cf988aaa15c467fa62c96c951d2891bc43db
2015-07-11 09:33:33 -07:00
Peter Johnson
e38cce46ad Add missing llvm headers.
Change-Id: I2e913ef8289b2336a74690195085ca9f6e14d94e
2015-07-11 09:33:33 -07:00
Peter Johnson
f6deafee22 Add type-safe wrapper around NT_Value and NT_String.
Change-Id: Ib7ef5a6de9c8c7a1f5f6432083d1fb38328438dc
2015-07-11 09:33:33 -07:00
Peter Johnson
8d6a0786c8 Move all C api functions to ntcore.cpp.
Change-Id: I17b4f5fec30ecd684cf04af2bbd6b7346bfcd683
2015-07-11 09:33:33 -07:00
Peter Johnson
9ee3070667 Storage: Make entries private, add accessors.
Use range-based for in SavePersistent.

Change-Id: If43ed97379114b3bf8a5e95da99103791cd09d4d
2015-07-11 09:33:33 -07:00
Peter Johnson
05e084364a Start implementing LoadPersistent.
Switch to using fstream instead of stdio.

Change-Id: I600a8748a0b3dcf24740d63cc296df000abc388d
2015-07-11 09:33:33 -07:00
Peter Johnson
69e91244f4 Rename make_StringRef to MakeStringRef.
Change-Id: I18ca471c6e31f79956bcab9d4405afc355238a8f
2015-07-11 09:33:33 -07:00
Peter Johnson
e37a9d81f1 Cleanups and commenting.
Change-Id: I491a68af8614198af450942cd378c9486f27d338
2015-07-11 09:33:33 -07:00
Peter Johnson
95d0736bb6 More coding guidelines name changes, and use "using".
Change-Id: I48a898d13623749a55c469ba558155cd1467b4ce
2015-07-11 09:33:33 -07:00
Peter Johnson
de4ba1aa35 Fix up naming of Base64 and Leb128 functions.
Change-Id: I80a2493d822b59311ba0d7bd68b5ccf0e3b29e6a
2015-07-11 09:33:33 -07:00
Peter Johnson
d7ca3343bc File renames.
Change-Id: I3fa88f94593941a25f65eaabfcbbca2428613e6c
2015-07-11 09:33:33 -07:00
Peter Johnson
cee77a3228 Reformat per new coding guidelines.
Change-Id: Ib0e5d3a6fabe6db414d72b334ca7a7f33bc5726b
2015-07-11 09:33:33 -07:00
Peter Johnson
f5a82be9e5 timestamp.cpp: A few cleanups.
Change-Id: Ifcc93a27ddf901b8ec0c9e8de250e88e21536a8f
2015-07-11 09:33:33 -07:00
Peter Johnson
2a1ccaff1e Add timestamp function NT_Now().
Change-Id: I797a220308cd64ca0545222b433a18aa2294bac5
2015-07-11 09:33:33 -07:00
Peter Johnson
b195dfbe09 Add ConcurrentQueue implementation.
Change-Id: I28224d07c0b093bd520f0a1038cc808b1fac626c
2015-07-11 09:33:33 -07:00
Peter Johnson
0aab4c27e1 Use nullptr.
Change-Id: I469bbe4994ea22a22d2d72e47d72cab606d43eef
2015-07-11 09:33:32 -07:00
Peter Johnson
42ad98567c Use C++11 deleted functions for noncopyable.
Change-Id: I686f8871932c8bd611c74ef1e84a31530ea96d66
2015-07-11 09:33:32 -07:00
Peter Johnson
c06e625413 Fix code style for pointer and references.
Change-Id: I3ca5988f09aa4f81946dc3e53116c8151a981024
2015-07-11 09:33:32 -07:00
Peter Johnson
1a48e75d43 Implement SavePersistent.
Change-Id: I0b635b3e17dcfb6f238f57f2bff5575538ab7743
2015-07-11 09:33:32 -07:00
Peter Johnson
a896a3ade5 Import LLVM StringMap et al.
Change-Id: Ic48c722c2856c7aa36001935adbcf31b986ac1f3
2015-07-11 09:33:32 -07:00
Peter Johnson
62ef9e1c6b Remove extra Reserve calls.
Change-Id: I8d4142fa459cf74067e549363d4b88e2334faf5f
2015-07-11 09:33:32 -07:00
Peter Johnson
047cccda89 Refactor WireEncoder.
Change-Id: I50106755ce5571821d6e36767b16d08b91f054de
2015-07-11 09:33:32 -07:00
Peter Johnson
dbed3fea6f Move remaining read functions.
Change-Id: I415edc98fa06bb8e2c1a950ebdeb42775d915a77
2015-07-11 09:33:32 -07:00
Peter Johnson
b88a9295bf More refactoring.
Change-Id: Iaf937feb0486d2f008a47584c0a75edccbde2b34
2015-07-11 09:33:32 -07:00
Peter Johnson
c4d4679ed9 Finish EXECUTE_RPC and RPC_RESPONSE handling.
Change-Id: I927711c0625527093899f63c171302901ff8277a
2015-07-11 09:33:32 -07:00
Peter Johnson
c2063f3a88 Refactor MessageReader into WireDecoder.
Change-Id: If5842b4f6b9a7db3d3de515cd71324ab7ee82f50
2015-07-11 09:33:32 -07:00
Peter Johnson
03bae15b96 ntcore: Implement RPC_RESPONSE reading.
Change-Id: I80b678fb5fccc0ef21b6c5b9a89e49d18702e8a0
2015-07-11 09:33:32 -07:00
Peter Johnson
842fb957a6 ntcore: Initial commit.
Change-Id: Id8df275a34aaa628581b18e39014b880c29bf9b2
2015-07-11 09:33:32 -07:00
Brad Miller (WPI)
7f5ee01d3e Merge "DISALLOW_COPY_AND_ASSIGN macro now uses the delete keyword and allows move assignment and construction" 2015-07-07 16:49:23 -07:00
Tyler Veness
f4d84cdd4f Fixed potentially uninitialized value warnings emitted by clang
Removed unused variable from DigitalInput class

Removed extraneous explicit std::string conversions in Preferences class

Change-Id: Ia445abfd136a7b3e7f0491ed22aaa057814bcc8f
2015-07-07 16:46:33 -07:00
Brad Miller (WPI)
974e301a8b Merge changes I3d35139f,I05bb06f6,I4a3db0f1,I452b4794,If281e46a
* changes:
  artf4107: Removed most "Init" functions from classes
  artf4107: Replaced throw() with noexcept
  artf4107: GetInstance() calls are now atomic
  artf4107: Uniform initialization syntax introduced
  artf4107: clang-modernize was run on WPILib
2015-07-07 16:34:39 -07:00
Brad Miller (WPI)
9dc7bb4ec0 Merge "Changed 'mvn.bat' to 'mvn.cmd' such that the eclipse plugins can build on Windows with the current version of maven." 2015-07-07 16:21:04 -07:00
Tyler Veness
1ab3ea670d artf4107: Removed most "Init" functions from classes
They were either replaced with delegating constructors or merged into the only constructor in the class.

Change-Id: I3d35139f6ab23c719433a9f76942b02a3b07ddac
2015-07-02 21:50:40 -07:00
Tyler Veness
e4a8aacc51 artf4107: Replaced throw() with noexcept
Change-Id: I05bb06f6485120da05ce22c464b41f3cb0a0e00e
2015-07-02 21:50:39 -07:00
Tyler Veness
faedfa6ed4 artf4107: GetInstance() calls are now atomic
C++11 guarantees construction of static variables to be atomic, so this patch takes advantage of that.

Change-Id: I4a3db0f19c5fa5461fef3b6b63d7b8fec596c962
2015-07-02 21:50:39 -07:00
Tyler Veness
368ad30d37 artf4107: Uniform initialization syntax introduced
Change-Id: I452b4794d757a0817589ec62b75eda7fbdd74904
2015-07-02 21:50:39 -07:00
Tyler Veness
b1befed14f artf4107: clang-modernize was run on WPILib
Loops were converted to their range-based equivalents, variable types were replaced with auto where the type was already specified on the same line, the override keyword was added, and instances of NULL and assignments of 0 to pointers were replaced with nullptr.

Change-Id: If281e46a2e2e1c37f278d56df9915236d4b2c864
2015-07-02 21:49:47 -07:00
Tyler Veness
045a9b32db DISALLOW_COPY_AND_ASSIGN macro now uses the delete keyword and allows move assignment and construction
Change-Id: Ibb19cdb4343e0d7ddaa073cff5373ec24f24a2d3
2015-07-02 21:41:27 -07:00
James Kuszmaul
7a711a21f9 Make jenkins fail if tests fail catastrophically.
Previously, when the C++ tests seg faulted, Jenkins didn't make any noise.

Change-Id: I3e3599d1b55d704c59a9675e3074ee76348cb035
2015-07-02 16:58:10 -04:00
James Kuszmaul
1c3882ec72 Create a WPILib Style guide.
This commit is intended to be used a place
to start work on getting the styleguides which
we would like to use for WPILib up to date in
some useful format.

This particular commit need not be merged immediately
and people who wish to contribute to/have suggestions
for the style guide can either comment on this
or make commits based on this with their
suggestions.

The changes in this commit itself are relatively minimal,
just adding reminders that the style guides are
works in progress.

The main things which we need to do to get the style
guides useful are:
-Making formatting rules clear/easy to follow. For
  instance, I do not believe that the original guides
  linked straight to the eclipse format configuration
  files, even though they are quite useful.
-Adding in some WPILib specific stuff and information
  about how best to work on the code in our environment.
-Removing any guidelines which we don't want or don't need.
-Making the style guide readable/accessable enough that
  we can actually expect people to use/read it.
-Determining how/to what degree we want to enforce the
  strictures in the style guide.
-Determining how to handle our pre-existing code to
  either update it outright or to grandfather it in.
-Any other things to do which I may have forgotten
  while writing this commit message.

Change-Id: Ia6ea131e7d81d8c77a0487c8da17c0b264590e06
2015-07-01 15:44:17 -04:00
James Kuszmaul
35ccbb9c90 Fixed bad initialization of PDP.
Change-Id: I4603c7d51cfb8962d012aff0b6a1dac2e7525e40
2015-06-29 15:17:03 -04:00
Joseph
8794f7d636 Changed 'mvn.bat' to 'mvn.cmd' such that the eclipse plugins can build on
Windows with the current version of maven.

Change-Id: I10305a01392d9fe3002c451aa0b835a407fa2c81
2015-06-26 09:51:29 -04:00
Joseph
2c392d1813 Fixed comment problem in GyroMecanum cpp and made other small fixes to sample
programs.

Change-Id: Id6ee60085fa369ce3eb2e8261c0352b24886e2ae
2015-06-26 09:39:36 -04:00
Brad Miller (WPI)
7dcbe171bc Merge "Major formatting changes (breaks diffs). No code changes." 2015-06-25 12:29:00 -07:00
Brad Miller (WPI)
6fefcc779a Merge "Added new sample programs to the eclipse plugins for C++ and Java. Modified examples.xml for the corresponding added programs." 2015-06-25 12:19:26 -07:00
James Kuszmaul
7eb8550bdb Major formatting changes (breaks diffs). No code changes.
The changes made in this commit do not affect any actual code,
    they are purely aesthetic. I ran clang-format with google style
    over all .h/.cpp files in wpilibc that weren't in wpilibC++Sim
    or gtest, and the eclipse formatter over all of the Java files
    using the Google eclipse formatting configuration.

Change-Id: I9627bca0bc103c398ecc1c5ba17467193291ae63
2015-06-25 15:07:55 -04:00
Joseph
bd64d9a7ef Added and implemented GetInverted method.
Change-Id: I53bd51e41311e3ffcd3fa3ffbc4e72cfab530109
2015-06-25 14:55:18 -04:00
Patrick
0122086d23 Added tests for motor inversions.
This commit squashes all of Patrick's eleven commits into one
so that things are a bit more sane. The original commit messages
and change ids (for gerrit) can be found below.

Testing Motor Inversion Feature (Java tests only so far)

Change-Id: I44cd9b5a3fe066e1071316831dde14bff5ec3bd9

Test 2 of java testing for Motor Inverting

Change-Id: I96cc0534bb1d28a70d10c582f0b40ea3a2d83cab

Added another test to try to track down issue with InvertingMotor jaguar and Talon

Change-Id: I9b5292315c93ec0d568d53a6bcdac5b998a6d857

More Testing on the Inverting motors with jaguars and talons.

Change-Id: I896210a54903e3c0af68e8c41360c165cf9c3122

Added C++ integration Tests for the motor inversion.

Change-Id: I81af5d4aab78d755340d99608b838046bf7ddda1

C++ tests for Motor Inversion now without crashing

Change-Id: Ifdecdbfc1aeb18aafb2b4c63709b27636074a274

More testing of inverted motors (now with c++ tests)
Talon seems not to be working on test rig
Also added a CANJaguartest file in java since was missing
Currently porting the CANJaguar tests from c++ to java

Change-Id: Ib578d6ee1256ac31ddf20603aa6f24adde08065b

Another attempt at adding java tests for can jaguar inversion.

Change-Id: I971a886a4e555ada5bd15a814094da2a1eb5c8e1

Minor changes and attempt to rerun tests after yesterday's jenkins crash.

Change-Id: I7ed0904d4243499c3246e9c39e5493d0d9c962c5

All motor inversion tests should be working now. Talon on the test rig has been fixed.

Change-Id: I20bd6d7486b758ce1ce47ac799150475b3152b6f

Updated Inversion tests again. Should work this time. (worked on the test rig prior)

Change-Id: Ifdf222d5e5733fe802f29e7d939b72e84972e8da

Added tests for motor inversions.

This commit squashes all of Patrick's eleven commits into one
so that things are a bit more sane. The original commit messages
and change ids (for gerrit) can be found below.

Testing Motor Inversion Feature (Java tests only so far)

Change-Id: I44cd9b5a3fe066e1071316831dde14bff5ec3bd9

Test 2 of java testing for Motor Inverting

Change-Id: I96cc0534bb1d28a70d10c582f0b40ea3a2d83cab

Added another test to try to track down issue with InvertingMotor jaguar and Talon

Change-Id: I9b5292315c93ec0d568d53a6bcdac5b998a6d857

More Testing on the Inverting motors with jaguars and talons.

Change-Id: I896210a54903e3c0af68e8c41360c165cf9c3122

Added C++ integration Tests for the motor inversion.

Change-Id: I81af5d4aab78d755340d99608b838046bf7ddda1

C++ tests for Motor Inversion now without crashing

Change-Id: Ifdecdbfc1aeb18aafb2b4c63709b27636074a274

More testing of inverted motors (now with c++ tests)
Talon seems not to be working on test rig
Also added a CANJaguartest file in java since was missing
Currently porting the CANJaguar tests from c++ to java

Change-Id: Ib578d6ee1256ac31ddf20603aa6f24adde08065b

Another attempt at adding java tests for can jaguar inversion.

Change-Id: I971a886a4e555ada5bd15a814094da2a1eb5c8e1

Minor changes and attempt to rerun tests after yesterday's jenkins crash.

Change-Id: I7ed0904d4243499c3246e9c39e5493d0d9c962c5

All motor inversion tests should be working now. Talon on the test rig has been fixed.

Change-Id: I20bd6d7486b758ce1ce47ac799150475b3152b6f

Updated Inversion tests again. Should work this time. (worked on the test rig prior)

Change-Id: Ifdf222d5e5733fe802f29e7d939b72e84972e8da
2015-06-25 14:55:06 -04:00
Joseph
ae90e5f6d3 Added new sample programs to the eclipse plugins for C++ and Java.
Modified examples.xml for the corresponding added programs.

Change-Id: I3d86c570f446ec8cf3013c58dd94215f2907bbb1
2015-06-25 14:31:51 -04:00
Brad Miller (WPI)
2d71c1c1c7 Merge "[artf4062] Eclipse now throws error on bad build." 2015-06-25 10:26:46 -07:00
Brad Miller (WPI)
0ad0b567e8 Merge "Artifact artf3896, commented out line that deletes the folders/files in wpilib/tools so teams smartdashboard extensions don't get deleted on plugin update." 2015-06-25 10:24:41 -07:00
James Kuszmaul
4013402134 Add PIDInterface for PIDController and CAN devices.
Added a PIDInterface for the PIDContrller, CANJaguar, and CANTalon to
inherit from.

Change-Id: I88d4943159476a44400009703db5e79d8cd4b5a9
2015-06-25 12:10:35 -04:00
James Kuszmaul
27e4509676 Add CANSpeedController interface in Java.
This helps to bring Java to parity with C++.

Change-Id: Ibc79fd788c5c3c11af5de49d0c87436ebf4ba710
2015-06-25 11:55:56 -04:00
Brad Miller (WPI)
6ce98056d3 Merge "Added Ultrasonic example program in Java and C++, updated examples XML." 2015-06-25 08:51:28 -07:00
Brad Miller (WPI)
c7944d76af Merge "Add check for CPP Perspective to CPP Launch Shortcuts. Fixes artf2627" 2015-06-25 08:49:01 -07:00
Kevin O'Connor
9c0df8c8fa Add check for CPP Perspective to CPP Launch Shortcuts. Fixes artf2627
Change-Id: I56f73c41d3266a557d6d42e5b6f7d7c97ce845b0
2015-06-25 09:43:44 -04:00
Tyler Veness
5598445a67 Improve const correctness.
See https://usfirst.collab.net/sf/tracker/do/viewArtifact/projects.wpilib/tracker.4_defects/artf4148

Change-Id: I47b0d5a91fd49e47e2c7348b0705e998ec815682
2015-06-24 15:20:44 -07:00
Joseph
c357d1dcae Added Ultrasonic example program in Java and C++, updated examples XML.
Change-Id: I510bef33d8565d124894d926d6634b04b1b6ca28
2015-06-24 16:30:55 -04:00
jmanning
c6b790cadd Artifact artf3586: Added include for stdint.h in WPIErrors.h file, so the header can stand alone.
Change-Id: Ia4fdad9d5c994fd78220dc81809a180a529d3792
2015-06-24 08:29:29 -07:00
jmanning
ead60eaab8 artf3622: Each Solenoid creates handles for all other Solenoids as well
Fixed so that one static handle is called for all Solenoids.

Change-Id: Ib5f3bbaa160d253e0533259bfe0e9e2a6f11733f
2015-06-24 08:28:37 -07:00
jmanning
39130721d0 Artifact artf3528, Added support for PDP's having addresses other than zero, and added ability to have multiple PDP's.
Change-Id: I8e36ab47d6f60b99a668965396c25856cc07a0cb
2015-06-24 08:13:39 -07:00
Kevin O'Connor
8d17270dce Merge "Added functions to get names, HID types and isXbox descriptors from joysticks." 2015-06-24 08:13:12 -07:00
jmanning
bf4ccf13d9 Added functions to get names, HID types and isXbox descriptors from joysticks.
Change-Id: I3cd6ebc04d64398f05001cd008696e13ee1ab6ea
2015-06-24 10:56:59 -04:00
James Kuszmaul
ee824680d2 Re-adjusted some PID values for the tests.
Change-Id: I95623307c2a0b86003acbbcd029768fae5d4689e
2015-06-23 11:27:25 -04:00
James Kuszmaul
d252ed5283 [artf4062] Eclipse now throws error on bad build.
Although I have tested this on my machine, further testing
to ensure that the problem really is solved may be helpful.

Change-Id: I892ad7d9f8fa7e791390a38036dafdba00d3a670
2015-06-22 14:03:32 -04:00
Brad Miller (WPI)
3de0f162bf Merge "Added modified Google Style Guide." 2015-06-22 08:31:54 -07:00
Brad Miller (WPI)
13948e8199 Merge "[artf3943] Add LiveWindow mode to CANTalon." 2015-06-22 08:30:51 -07:00
Brad Miller (WPI)
ac80114c42 Merge "Fixed BuiltInAccelerometer Tests, changed expected axis of gravity from the z-axis to the y-axis." 2015-06-22 08:29:52 -07:00
James Kuszmaul
7100052c54 Added modified Google Style Guide.
See artf4151. This is just a preliminary run at
putting together an appropriate style guide for
WPILib. Edits will need to be made and the style
guide should evolve over time. However, we have to
start somewhere, and enforcing at least the basic
formatting rules should make a good start.

Change-Id: I608b6f6f52918e2dda7443abb64c535e96d0af69
2015-06-19 09:36:26 -04:00
jmanning
4b45b6a191 Artifact artf3896, commented out line that deletes the folders/files in wpilib/tools so teams smartdashboard extensions don't get deleted on plugin update.
Change-Id: Ie738bf249a4dc8c300a3ed95a8178b8dc3ff6443
2015-06-18 13:52:22 -04:00
James Kuszmaul
b5ce281357 [artf3943] Add LiveWindow mode to CANTalon.
Still needs testing.

Change-Id: If01ed86a7f75c644c4eeea5ad775d006a424e888
2015-06-17 15:19:29 -04:00
Joseph
e48edbebd3 Fixed BuiltInAccelerometer Tests, changed expected axis of gravity from the z-axis to the y-axis.
Change-Id: Ie88569009d809ba150358a7fa7c6d84726fb32f6
2015-06-15 14:52:21 -04:00
James Kuszmaul
0862210f59 Fix bad suffix for staticLibArchiver on macs. Needs to be tested on mac.
Change-Id: I3bc851feec54d7ad86c2a59731b94ca6a59a5f46
2015-06-12 14:01:56 -07:00
Sam Carlberg
1c9dffc301 Commented OS X workaround in build.gradle
Change-Id: Icf9361e3f9f6f7d6d459eb483fcf4e51a5e5c26c
2015-06-12 16:12:41 -04:00
Brad Miller (WPI)
32251fe4a3 Merge "Makes the build work on Mac (needs to be tested on other platforms)" 2015-06-12 13:10:01 -07:00
Brad Miller (WPI)
08487b56ac Merge "Changed calculate method to protected and virtual" 2015-06-12 13:09:38 -07:00
Sam Carlberg
40c6fbe24d Makes the build work on Mac (needs to be tested on other platforms)
Change-Id: Ibc579d5f141f3ace9892e7f898cfd21050bc2aaf
2015-06-12 13:09:24 -07:00
Brad Miller (WPI)
33f012a60e Merge "CANTalon: Add getter methods for soft limits." 2015-06-12 13:04:33 -07:00
Brad Miller (WPI)
fafc8635c8 Merge "add some comments etc documenting various not-implemented things" 2015-06-12 13:03:41 -07:00
Brad Miller (WPI)
8674ac20fa Merge "Added missing archiver prefix for wpilibc" 2015-06-12 13:01:19 -07:00
Joseph
2296d6560d Changed calculate method to protected and virtual
Change-Id: I0e5900b4f079eee5f7b8933de2bf2f0a064cf762
2015-06-12 12:33:25 -07:00
Fred Silberberg (WPI)
bbffc825e4 Merge "Change wpilibcZip to use "lib" instead of "libs" to match where eclipse plugins expect libraries" 2015-06-10 08:55:34 -07:00
Kevin O'Connor
682bc171fd Change wpilibcZip to use "lib" instead of "libs" to match where eclipse plugins expect libraries
Change-Id: I597c43d773507037cc7677fe4e1952a640543c81
2015-06-10 10:40:49 -04:00
Peter Johnson
47088c0354 CANTalon: Add getter methods for soft limits.
Added functions:
- getForwardSoftLimit
- getReverseSoftLimit
- isForwardSoftLimitEnabled
- isReverseSoftLimitEnabled

Change-Id: I03b8f692c08c326a6ff0bfd929b7fdd5d7406a0f
2015-06-03 08:37:59 -07:00
Brian Silverman
4cac5a957b add some comments etc documenting various not-implemented things
Change-Id: I1103b65006e8330260bfe1202bdb64eb84d3fccc
2015-06-03 11:27:35 -04:00
Patrick
675fbc032c Test bench fixes and updates. Attempting to make it possible to have a stable build again. Gyro test still seems a bit unreliable.
Change-Id: I0c140a5263048ff47ed1ec6b243e07baf43ec21e
2015-06-03 10:26:31 -04:00
Brian Silverman
880eae1424 don't use uninitialized variables
Change-Id: I9869c3bf64f00ddff641e5dc06b16179c3b3ce2f
2015-06-03 09:05:36 -04:00
Brad Miller (WPI)
d1d28e70e1 Merge "This commit adds JNI bindings for the C++ Notifier." 2015-06-03 06:02:03 -07:00
Brad Miller (WPI)
269bf9db64 Merge "Removed confusing error on deploy." 2015-06-03 05:59:59 -07:00
Brad Miller (WPI)
671954a664 Merge "Add MSYS Makefile option for cmake to Building.md as well as a note about the warning that's generated. Fixes artf3748" 2015-06-03 05:56:50 -07:00
Brad Miller (WPI)
19526361f1 Merge "Add DisabledInit to C++ Command Based template. Move and modify comment on Java version. Fixes artf3840" 2015-06-03 05:54:19 -07:00
Brad Miller (WPI)
a9593854d8 Merge "Fix usage reporting for new motor controllers and Analog output" 2015-06-03 05:53:07 -07:00
Brad Miller (WPI)
9cda6e3ff8 Merge "Tuned some values in tests to account for hardware imperfections." 2015-06-03 05:49:39 -07:00
Brad Miller (WPI)
0853dc8e5d Merge "Fixed access issues and 'overridableParamatar' misspelling." 2015-06-03 05:45:38 -07:00
James Kuszmaul
0b7bb41b22 This commit adds JNI bindings for the C++ Notifier.
The bindings only wrap the HAL interface, rather than the entire C++ Notifier,
as I ran into issues trying to wrap the whole Notifier (all the existing
bindings only wrap HAL components, so wrapping stuff in :wpilibc is
unexplored). As such, the new edu.wpi.first.wpilibj.Notifier is just a
re-implementation of the wpilibc/.../Notifier.cpp.

The purpose of doing this bindings is to allow Java users a better option
for running tasks which require good timing (such as control loops). The
previous method used java.util.Timer to schedule a task, causing various
issues. Although this update does improve things, Java loop timing is still
substantially worse than that of C++, and, even worse, if Java decides to call
the garbage collector at the wrong time then the loop can be delayed by
multiple milliseconds and the next iteration will be shorter to account for it
(although this particular behavior could be updated).

A few notes on individual components:
-the HAL Task.hpp and Task.cpp were modified due to compilation/linkage
 issues with the JNI bindings. Nothing substantive changed.
-NotifierJNI was added to the build files for gradle.
-HALUtil was modified to include a function for getting the length of a C
 pointer, rather than relying on it being 32-bit.

Change-Id: I966512d8a82c2a438ed8c8bbcc6cdc6ed186d0f2
2015-06-02 16:05:03 -04:00
James Kuszmaul
90f05dd31a Removed confusing error on deploy.
rm no longer throws a file not found error on deploy.
Also, throw in a sync command at the end of the deploy so that we don't get corrupted files.

Change-Id: I561916e4fec1b8449f9a70b7ee2155b0b62abc80
2015-06-02 16:04:25 -04:00
Kevin O'Connor
9b6e48e142 Add MSYS Makefile option for cmake to Building.md as well as a note about the warning that's generated. Fixes artf3748
Change-Id: I67371a7a98d998b221731f9a8da8139057c6aa96
2015-06-02 11:00:25 -04:00
Kevin O'Connor
5a094879b6 Add DisabledInit to C++ Command Based template. Move and modify comment on Java version. Fixes artf3840
Change-Id: I2371fc9cf64588e38f35b17715773604df6c2392
2015-06-02 10:00:34 -04:00
Kevin O'Connor
8b71ddc30f Fix usage reporting for new motor controllers and Analog output
Change-Id: I574e431ae551ecf8efc90c004abf14568f22c068
2015-06-02 09:46:09 -04:00
James Kuszmaul
1805968d78 Tuned some values in tests to account for hardware imperfections.
Messed with some gyro and CANJaguar tests.
Note: The encoder for the CANJaguar slips a great deal with the motor accelerates rapidly.

Change-Id: I09547f95b122eb48b4f97c0496f970cf1a77c5b2
2015-05-26 09:43:05 -04:00
Fredric Silberberg
01d73d04f3 Added missing archiver prefix for wpilibc
Change-Id: I010a036915b1df85b35444890aa2d1cc2592470a
2015-05-20 18:55:54 -04:00
Fredric Silberberg
1e4e0bacde Gradle Build
This adds gradle support for building wpilibj and wpilibc. At this
point, both of these libraries should be fully ready to go.

Gradle should give us a number of improvements, including less
dependencies for getting building up and running, and MUCH faster build
times. I'm noticing significantly faster build times already compared to
Maven, with neither system building the plugins. The changes here should
be pretty straight forward. The basic command for gradle is './gradlew'.
This is the gradle wrapper, and it will find and download the correct
gradle executable for your system. There is no need to install anything
yourself. To see every task available, run './gradlew tasks'. The
important tasks for us are listed under the WPILib header when the tasks
command is run. To generate unit test binaries, the
fRCUserProgramExecutable command will create the C++ tester, and the
wpilibjIntegrationTestJar command will create the Java tester. The Jenkins
deploy scripts have been modified to know the difference between maven
generated and gradle generated jars with an environment variable. Creating
the eclipse plugins still requires Maven, but gradle will handle calling
it correctly and generating the proper dependencies for it. Create the
plugins by calling ./gradlew eclipsePlugins.

Jenkins can now be modified to support the new build system. Unit tests
are run with ./gradlew test. Generating the integration tests uses the
above two commands, and then process proceeds exactly as it did before.
For publishing documentation, a new task has been created, ./gradlew
publishDocs, which handles putting the documentation where Jenkins expects
for publishing.

Change-Id: I9a260d391984f98ef9170993efe933e4026161dc
2015-05-20 16:22:17 -04:00
Colby Skeggs
569f02de89 Fixed access issues and 'overridableParamatar' misspelling.
interruptFired was package-private, which meant that it couldn't be
used... at all. Oops! Also, fixed obvious misspelling of
overridableParamatar, which probably won't hurt anyone because they
couldn't have used interruptFired anyway...

Change-Id: I6c57c015d04cde31f5be92265db1d1d9ba0760c9
2015-04-09 23:43:42 +00:00
Joe Ross
0dffbd8634 Catch exception when instantiating USB camera if camera isn't present
Change-Id: I7f81c26619e55b49a0d205bdefe5fcd8adc7c3e2
2015-03-22 11:36:02 -07:00
Kevin O'Connor
0e46592ad1 Don't send DS errors if no DS.
Change-Id: I765d8c21371e772ec09bf696f6dd2fff43f8ed24
2015-02-23 16:19:16 -05:00
Brad Miller (WPI)
d2edb80da2 Merge "Use PCM Device ID when getting status. Fixes artf4014." 2015-02-23 13:15:26 -08:00
Brad Miller
6159fde98e Set POV values on error to return -1 rather than 0 AND bump the version number (artf4005)
Change-Id: I6fffb693a8e58427086b9f9a673cd70bebdbca33
2015-02-20 18:35:38 -05:00
Joe Ross
7bdd91a058 Use PCM Device ID when getting status. Fixes artf4014.
Change-Id: I0e1f478d1b96d20b97dec8d0ffe251c8fd0f6897
2015-02-15 16:43:09 -08:00
Kevin O'Connor
605bb45e0c Fix endian order of buffers in AnalogTrigger.java
Change-Id: Ica262494c4b8169d812295006e24f9cb440de078
2015-02-13 11:16:55 -05:00
Brad Miller
215002e487 Fix analog trigger bug with MXP mapping (artf4010)
Add the interrupt code for MXP mapping and analog triggers
Took out the unneeded static definition
Change-Id: I9a3483ee8f806b46b4349845e7a189f497c36916
2015-02-12 17:33:31 -05:00
Brad Miller
964475c724 Bump the version number to 1.1 for the network table changes
Change-Id: Id3ed20c88de5744acfe95ed0916c3c7f3fc0e386
2015-02-10 17:21:02 -05:00
Fredric Silberberg
bfa4bbaf78 Final move of Dustins network tables patches
Change-Id: I7d351d87e63c8174b62f4ec09f805f685c80019c
2015-02-09 14:22:44 -05:00
Mitchell Wills
39158754d7 Partial merge of patch from James Killian
Narrows scope of locks in write manager
added delay to incomming stream monitor loop

Change-Id: I6ced23c11cd3c2102041a73cb94fd1f1d351c7a4
2015-02-07 19:56:12 -05:00
Mitchell Wills
048b02e6cd Applied patch from Dustin Spicuzza to fix robot hang
Change-Id: I273feafcad5c95de04a11bab64c2d5596f248662
2015-02-07 19:56:11 -05:00
Fred Silberberg (WPI)
130319b771 Merge "Fixes artf3989: Java SerialPort no longer ignores return value of serialRead" 2015-01-21 14:58:09 -08:00
Thomas Clark (WPI)
0b414b1bde Merge "Disable Encoder console spam introduced in e13720b." 2015-01-21 14:05:01 -08:00
Thomas Clark (WPI)
8a244cc9dc Merge "Make index encoder constructors work." 2015-01-21 14:03:17 -08:00
Brad Miller (WPI)
397162390b Merge "Correct energy to be in Joules rather then millijoules. Fixes artf3940" 2015-01-21 12:15:23 -08:00
Joe Ross
bbc216f998 Disable Encoder console spam introduced in e13720b.
Change-Id: I10501f9bb9e8f8e0607291209f9a44a8dc3fa6b8
2015-01-18 18:57:34 -08:00
Joe Ross
72a56e6a8a Make index encoder constructors work.
Change-Id: I50e1262128197e7d65ed773c998d820efde152fe
2015-01-17 22:28:02 -08:00
Colby Skeggs
102c992e50 Fixes artf3989: Java SerialPort no longer ignores return value of serialRead
Change-Id: I5d522111189372a3c95b90804abf05ae1d0b553e
2015-01-18 01:30:19 +00:00
Joe Ross
9f057fddfd Correct energy to be in Joules rather then millijoules. Fixes artf3940
Note: power and thus energy will still be wrong until PDP firmware 1.39
or later is used. See artf3939.
Change-Id: Ic68b8a28c78f1b5d524fa5fb45e3bc0d9cd4a76a
2015-01-17 09:59:25 -08:00
Brad Miller
e614217d41 New netconsole-host that overwrites the old one on every deploy
Change-Id: I9f9e94a67810b1b40b354a2bfc511f44a05b858a
2015-01-16 21:03:52 -05:00
Kevin O'Connor
9b7042a51a Fix errors in Vision examples.
Change-Id: I752a99ff7b8872a0fc8926e3633c2b521383bbd0
2015-01-16 15:35:48 -05:00
Brad Miller (WPI)
081d7f7361 Merge "Applied updated DIOJNI file from Ron Rossbach. Fixes artf3982." 2015-01-16 07:36:17 -08:00
Brad Miller (WPI)
352c021b17 Merge "Updated the Java CameraServer to use the new USBCamera and prevent large camera data copies. Fixed a small bug in USBCamera to prevent reinitializing a camera if it is already initialized. Also fixed some issues with the getJpegSize function to correct for Java incorrectly casting 0xff to an integer, and the byte buffer limit being set incorrectly." 2015-01-16 07:35:32 -08:00
Brad Miller (WPI)
5f90bf167e Merge "Enable nivision Java wrappers to be generated with Python 3." 2015-01-16 07:35:17 -08:00
Brad Miller (WPI)
445eafefb3 Merge "More Java nivision wrapper fixes." 2015-01-16 07:34:33 -08:00
Brad Miller (WPI)
a917f63e7d Merge "2015 Color and Retroreflective vision samples for C++ and Java" 2015-01-16 07:33:21 -08:00
Brad Miller (WPI)
2228361f39 Merge "Add SetCANJaguarSyncGroup to RobotDrive" 2015-01-16 07:32:57 -08:00
Fredric Silberberg
aaa599fa28 Updated the Java CameraServer to use the new USBCamera and prevent large
camera data copies. Fixed a small bug in USBCamera to prevent
reinitializing a camera if it is already initialized. Also fixed some
issues with the getJpegSize function to correct for Java incorrectly
casting 0xff to an integer, and the byte buffer limit being set incorrectly.

Change-Id: I184efd265c617b02523dd9c5d347cc7ca5b4a77b
2015-01-15 19:27:00 -05:00
Peter Johnson
5d95bbb33f Enable nivision Java wrappers to be generated with Python 3.
Change-Id: I8ce57874e4730ed10dd0093c147b14c22f141201
2015-01-15 00:04:23 -08:00
Peter Johnson
d0258923e8 More Java nivision wrapper fixes.
- Fix sliceByteBuffer, getBytes, and putBytes implementations, which had
  functional errors.  Also, getBytes and putBytes now use the ByteBuffer
  get/put byte[] functions, which should improve performance.

- Don't generate wrappers for functions that are not available in the
  shared library.

Change-Id: Iaf45814b34720d3fdcd58adf99ad9c3ff2703bc3
2015-01-14 23:49:37 -08:00
Kevin O'Connor
91ccc5d10b 2015 Color and Retroreflective vision samples for C++ and Java
Change-Id: Id95925ced100b25d591c40995bb016780737312d
2015-01-14 12:45:17 -05:00
Brad Miller (WPI)
9fda920055 Merge "Add @file annotation so files are picked up in doxygen" 2015-01-14 07:54:34 -08:00
Brad Miller (WPI)
e9dd72ac77 Merge changes I0ec40c14,I4d099e62
* changes:
  nivision Java wrappers: implement our own error text function.
  Fix a few major nivision Java wrapper issues.
2015-01-14 07:53:48 -08:00
Brad Miller (WPI)
cce1bbc1f2 Merge "Update to point to Gazebo3.2 header location." 2015-01-14 07:41:18 -08:00
Peter Johnson
9fc79c41d1 nivision Java wrappers: implement our own error text function.
Change-Id: I0ec40c143b1c5a5fff8495643f83ad494ab32e57
2015-01-14 01:08:29 -08:00
Joe Ross
1dba916887 Add @file annotation so files are picked up in doxygen
Change-Id: Ie2e0bdd23d29dbf91600a25e3c0ae0228519b41a
2015-01-13 22:44:54 -08:00
Peter Johnson
ce7a56284f Fix a few major nivision Java wrapper issues.
- sliceByteBuffer() was not setting native order on the duplicated buffer.
  This caused all array-copyin functions to generate bad values.
- Correctly handle unsigned byte and unsigned short values.  These could
  read/write to bad locations previously.
- Implement custom version of imaqReadFile() to always pass in NULL for
  the colorTable.  Eventually a more-complete version should be written.

Also this works around a crash in imaqGetErrorText() by not calling it from
throwJavaException().  It's not clear why imaqGetErrorText() is crashing at
present (my best guess is there's still something fishy with multiple C++
lib versions getting loaded somehow), as this used to work.  Instead,
the exception now just gives the error code without the error message,
which is not user friendly but at least doesn't crash.  This will be fixed
in a future commit by creating our own version of imaqGetErrorText() based
on the information available in the header file.

Change-Id: I4d099e62ee41f8e2a50089806561be191cb5d9d7
2015-01-13 22:18:17 -08:00
Joe Ross
34d515debb Make sure Utility file is included in doxygen output.
Fixes http://www.chiefdelphi.com/forums/showpost.php?p=1427109&postcount=3

Change-Id: I716cd6be21980945c4a7846f5c32e50e040be3e9
2015-01-12 22:44:02 -08:00
Brad Miller (WPI)
cff103d15e Merge "Add encoder indexing in Java" 2015-01-12 12:48:39 -08:00
Brad Miller (WPI)
1b5cabc0d1 Merge "Add encoder indexing support in C++" 2015-01-12 12:48:23 -08:00
Brad Miller (WPI)
9fcfc5b3b7 Merge "Added the C++ implementation of Peter Johnson's UsbCamera. Rewrote CameraServer to use the new USBCamera implementation and get rid of some unnecessary copying of the entire image." 2015-01-12 10:45:57 -08:00
Brad Miller (WPI)
f181c70134 Merge "Add USBCamera class." 2015-01-12 10:45:41 -08:00
Brad Miller (WPI)
46c40da539 Merge "NIVision: Add dx functions." 2015-01-12 10:45:20 -08:00
Brad Miller (WPI)
1c05a982e1 Merge "Synchronize CANTalon documentation between languages." 2015-01-12 10:43:37 -08:00
Thomas Clark
ba7f56833b Add SetCANJaguarSyncGroup to RobotDrive
Manually specifying a sync group causes that value to be
passed in all of the speed controller Set() calls, and
CANJaguar::UpdateSyncGroup() to be called afterwards.

Change-Id: I365216463e3dd57b3fafb1bed898fb0da4b08793
2015-01-12 01:27:53 -05:00
Fredric Silberberg
7600473da6 Applied updated DIOJNI file from Ron Rossbach. Fixes artf3982.
Change-Id: Ibf20e833d7ab5b1ca80239ad5b8bb116c1624fca
2015-01-11 14:34:26 -05:00
Peter Johnson
9f04b79580 Fix Timer.hasPeriodPassed().
It was incorrectly using seconds instead of milliseconds.

Change-Id: Iecd2802c548caee4a5185f00a2b785143d6b1b16
2015-01-11 01:55:33 -08:00
Fredric Silberberg
2282a11a79 Added the C++ implementation of Peter Johnson's UsbCamera.
Rewrote CameraServer to use the new USBCamera implementation and get rid
of some unnecessary copying of the entire image.

Change-Id: I877750e990b6159c0aaf829df62b253a171fbada
2015-01-09 14:39:47 -05:00
Peter Johnson
1a2344bddc Add USBCamera class.
Change-Id: Ie7dfa679d9eeb7d55613ac1694a63ce70161d76c
2015-01-08 21:14:32 -08:00
Fred Silberberg (WPI)
ae9a7d19f1 Merge "Miscellaneous AnalogTrigger fixes" 2015-01-08 14:07:45 -08:00
Fred Silberberg (WPI)
e1141b9f27 Merge "Disable C optimize setting so better C++ doc is generated" 2015-01-08 13:47:10 -08:00
Fred Silberberg (WPI)
ff71aca572 Merge "Update docs to add missing channel numbers" 2015-01-08 13:44:32 -08:00
Fred Silberberg (WPI)
837671e95f Merge "Document that PDP must be address 0 and add/fix measurement units" 2015-01-08 13:43:36 -08:00
Fred Silberberg (WPI)
38c0308fc7 Merge "Correct path of sfx so that it can be launched from eclipse menu" 2015-01-08 13:42:43 -08:00
Thomas Clark
f21e4a9da5 Miscellaneous AnalogTrigger fixes
AnalogTrigger.createOutput is now public.  It was mistakenly made
package local before.

The AnalogTriggerType enum now uses the same naming convension
as other enumerations in WPILib.  There's no way that this breaks
existing code, since AnalogTrigger.createOutput wasn't public before
this commit.

Change-Id: I9a2b921a996012f61dac0e395602f8cc429d7611
2015-01-08 00:31:36 -05:00
Thomas Clark
e13720bb94 Add encoder indexing in Java
Change-Id: I7d6a7da4301703aafab9d63ce67b6c88c62647c9
2015-01-08 00:23:32 -05:00
Joe Ross
0cf7d6f457 Update docs to add missing channel numbers
Change-Id: I2ffcc84c4801c5bd1062b74f36dd35e06b4834e6
2015-01-07 20:15:26 -08:00
Thomas Clark
a2dfffeddc Add encoder indexing support in C++
Java will be done tonight or tomorrow

Change-Id: I3a3287a197b6f071c261172eb8ec930693e8b3c7
2015-01-07 00:06:45 -05:00
Brad Miller
87e1df068c Fixed a null pointer exception in the mecanum drive sample program (Fixes artf3974)
Change-Id: I9518cd49ca815b9e1dc3ab63b7a4ee7034e5b444
2015-01-05 17:34:13 -05:00
Peter Johnson
f19c290fde NIVision: Add dx functions.
This includes getters, setters, video mode enumerate, and get image data.

These are necessary to improve the CameraServer code performance.

Also clean up unused return generation.

Change-Id: I3e7365e046d0ea9370586c5158138a5b07e20218
2015-01-05 01:11:49 -08:00
Joe Ross
5c342a8e1a Document that PDP must be address 0 and add/fix measurement units
Change-Id: I4864e3242d8a19ad3dfb7740f23632e2b939ca90
2015-01-02 16:08:19 -08:00
Joe Ross
f7117aac4b Correct path of sfx so that it can be launched from eclipse menu
Change-Id: I54f35d480afbe1d356ee5a55e8c04e62f94ee757
2015-01-02 15:41:04 -08:00
Alex Henning
05cd0627b2 Update to point to Gazebo3.2 header location.
Change-Id: Ifebb31a375e8b7a6136115748c3634757fb732b8
2015-01-02 18:34:35 -05:00
Joe Ross
2bc83bd80a Disable C optimize setting so better C++ doc is generated
Change-Id: I9cc98c83f47013e174835a6e418c49305ef360e5
2014-12-31 20:03:44 -08:00
Joe Ross
79fbbbc0dd Synchronize CANTalon documentation between languages.
Still lots of documentation needed.

Change-Id: I122d00fb0f4a9f57f3d479749ec02b2249856d2b
2014-12-31 19:18:52 -08:00
Brad Miller (WPI)
359a155915 Merge "Make 3 axis Accelerometers work in LiveWindow. Fixes artf3902." 2014-12-30 21:05:26 -08:00
Brad Miller
fb7f5e9de8 Add methods to retreive the FPGA index for counters and encoders and return the encoding type as an integer
Change-Id: Iaa4062ec124b968b27e7c812cc754032fcb354d2

Add methods to retrieve the FPGA index for counters and encoders and return the encoding type as an integer

Change-Id: If04dc291f39a9b331495d2b97a8b87d3ded71280
2014-12-30 23:23:04 -05:00
Joe Ross
7db63055f6 Make 3 axis Accelerometers work in LiveWindow. Fixes artf3902.
Change-Id: Iced12b3c408b0d7b8fe822a9f17a7992293bae7d
2014-12-30 19:59:25 -08:00
Thomas Clark (WPI)
b94341a23e Merge "Update nivision JNI generator to correctly gen Priv_ReadJPEGString_C." 2014-12-30 14:18:00 -08:00
Peter Johnson
afbd70d393 Update nivision JNI generator to correctly gen Priv_ReadJPEGString_C.
Change-Id: I206da9f3f660b4d567a3b535702b70e5f967b071
2014-12-30 13:24:30 -08:00
Joe Ross
ceccd95084 Add PDP to LiveWindow for C++
Change-Id: I45967739b81090e809b9e8f1c31ad7ff58554ec1
2014-12-30 12:31:35 -08:00
Brad Miller (WPI)
91b9812482 Merge "Add PDP LiveWindow code" 2014-12-30 11:57:28 -08:00
Brad Miller
0dbc40e515 Added missing .java file
Change-Id: I96aa235960bc59f435b7b1b55a29462f8f8052e4
2014-12-30 14:35:06 -05:00
Brad Miller
5ce89b3382 Added a Java AxisCamera sample program
Change-Id: Iba0eb9f06a91f577323cefd695f8dd601a96db97
2014-12-30 10:27:20 -05:00
Thomas Clark
8ccf3d9c14 Add AxisCamera Java class
The API is basically the same as the C++ one.

The JNI function for Priv_ReadJPEGString_C was manually renamed, since the
python scripts don't name the C++ functions correctly, causing an
UnsatisfiedLinkError at runtime. If further changes are made to the bindings,
either the method will have to be manually renamed again after the code is
regenerated, or the python scripts will have to be updated.

The old ignored edu.wpi.first.wpilibj.camera package was removed.

Change-Id: Icd37fc15c7bb41061568c3b2f580c6765cbf0300
2014-12-30 02:17:03 -05:00
Joe Ross
230fa2d168 Add PDP LiveWindow code
Change-Id: Ia3f4d8118d9068d021994fd2e5aca676d7dfa979
2014-12-29 21:10:21 -08:00
Joe Ross
d165f57e6e Clean up misc documentation
Change-Id: Ib0a4a7a389fb657d78d8b8bce4fcaeed67c3693d
2014-12-29 15:10:41 -08:00
Brad Miller (WPI)
2d15b6b03e Merge "Update Java install URL to the new URL with the java installer." 2014-12-29 13:38:47 -08:00
Brad Miller (WPI)
5d9baa44ee Merge changes Ie40db6c9,I0b5e752e
* changes:
  Write lib version from Java (fixes artf3788)
  Update Javadocs for Java (fixes artf3761 and artf3953)
2014-12-29 13:35:52 -08:00
Brad Miller (WPI)
822416d2f7 Merge "Write lib version from C++ (fixes artf3788)" 2014-12-29 13:35:04 -08:00
Brad Miller (WPI)
3fe726d851 Merge "Update docs for C++ (fixes artf3761 and artf3953)" 2014-12-29 13:26:13 -08:00
Kevin O'Connor
4c0b2c18ab Write lib version from Java (fixes artf3788)
Change-Id: Ie40db6c993d12aadb66b07fcfdc0a62b87a2e2ed
2014-12-29 16:06:11 -05:00
Kevin O'Connor
b4c5a3af77 Update Javadocs for Java (fixes artf3761 and artf3953)
Change-Id: I0b5e752e8f6377770163dcdc61aa79ad4c7cbe94
2014-12-29 16:02:07 -05:00
Kevin O'Connor
eddb0b20b0 Write lib version from C++ (fixes artf3788)
Change-Id: Ia11c2dab2050ffe4299d1ccd68c986573f0a05e3
2014-12-29 14:15:55 -05:00
Kevin O'Connor
6d8e782f53 Update docs for C++ (fixes artf3761 and artf3953)
Change-Id: Ic0c4ac8494cadff13461d9bb8b5943cd87619f0a
2014-12-29 14:09:37 -05:00
Joe Ross
0368322385 Update Camera templates to make C++ and Java more similar.
Include delays and template code from other examples to show how to use
these examples in a full robot program. Change Java example in example
finder to Simple Vision to match C++. Add comments about how to find cam
number and change default to cam0.

Change-Id: I85846ccfaf016c538a750b057a7fd766cdff9447
2014-12-29 13:48:11 -05:00
Joe Ross
19e05ff52b Update Java install URL to the new URL with the java installer.
Change-Id: Id554d0e2251d9efd7f06466bd2e093602911dc54
2014-12-28 20:23:48 -08:00
Brad Miller (WPI)
a6aef54ef4 Merge "Axis camera C++ example program" 2014-12-28 13:15:54 -08:00
Brad Miller
32f3bea465 Axis camera C++ example program
Change-Id: I60a14ce91fc09831b497ccdaaa7bb1bb26c8d945
2014-12-28 15:47:08 -05:00
Brad Miller (WPI)
9aacf5eb29 Merge "Artifact artf3925 : PCM : Can't find any user facing java/C++ API for getting/clearing PCM faults" 2014-12-28 10:58:12 -08:00
Thomas Clark
f3484686c9 Fix some typos in AxixCamera.cpp
There were some mistakes in comments left over from copying and pasting
comments from pre-2015 code, a couple formatting issues, and one getter
that wasn't implemented

Change-Id: I2e9d19be15445717cce175902c42e7e0932b56ad
2014-12-28 02:31:17 -05:00
Brad Miller (WPI)
b78b14bf5f Merge "Add AxisCamera C++ class" 2014-12-27 19:37:49 -08:00
Brad Miller (WPI)
c08dc98650 Merge "Add the 2014 C++ vision classes back in" 2014-12-27 19:37:29 -08:00
Brad Miller (WPI)
9fbffd88cb Merge "Change the java intermediate vision filename to match c++" 2014-12-27 18:38:11 -08:00
Brad Miller
6c15a3600a Change the java intermediate vision filename to match c++
Change-Id: Iadd173a6ea6089203103f0ca9c220a0b4ff5b286
2014-12-27 21:35:33 -05:00
Omar Zrien
548941dd99 Artifact artf3925 : PCM : Can't find any user facing java/C++ API for getting/clearing PCM faults
Change-Id: If5cb5b08f685158c5317233c4d9bc8e688138df7
2014-12-26 19:40:39 -05:00
Thomas Clark
9d8418c14e Add AxisCamera C++ class
Change-Id: I927334753027b519214d7541497f6c7f6d698163
2014-12-26 16:36:55 -05:00
Brad Miller (WPI)
326bf4fc9c Merge "Updates the InterrupatableSensorBase documentation to reflect the bug described in artf3623." 2014-12-26 13:28:20 -08:00
Fredric Silberberg
3c4a1d9a1a NIVision Forward Port
Ported the NIVision libraries from the old NIVision implementation to
the new autogenerated JNI bindings.

Change-Id: I7c68ca6abef1185d59a9787e9a269d720c825e2f
2014-12-24 16:39:46 -05:00
Fredric Silberberg
7687028269 Updates the InterrupatableSensorBase documentation to reflect the bug
described in artf3623.

Change-Id: I5f93dea65202cf30ba67c063eb8c90bedbfe43ae
2014-12-24 14:19:01 -05:00
Brad Miller
a55f34646d Encoder/Counter Fixes
This fixes all encoder variants with the getRate and getPeriod methods.
The clock speed in the HAL was updated, as was the scaling factors for setting
the stall periods. A default of .5 seconds is now set for the max period.
Additionally, a long standing bug was fixed with Java 2x encoders.

Changed tests to take into account the increased default timeout on encoders

Change-Id: I8b54c07ea467154be94d7ae7e9ada1775933dee4
2014-12-23 20:13:41 -05:00
Thomas Clark
53473e21be Add the 2014 C++ vision classes back in
Most of the old vision code still compiles with minimal changes. I haven't
tested it extensively, since the AxisCamera class isn't done, but it
should work, as it was barely modified.

Java bindings are still TODO, since they used some JNA stuff that probably
won't work now.

Change-Id: I8edf991410cb30b932379f277cee9d329ee35009
2014-12-23 17:42:14 -05:00
Brad Miller (WPI)
b4097fbd58 Merge "ClearStickyFaults() should not take a param, just clears sticky flags in a one shot manner. GetCompressorFault() => GetCompressorCurrentTooHighFault() There are now three compressor related faults so getters needed to be more verbose. New getters()... GetCompressorCurrentTooHighStickyFault GetCompressorShortedStickyFault GetCompressorShortedFault GetCompressorNotConnectedStickyFault GetCompressorNotConnectedFault" 2014-12-22 09:20:31 -08:00
Brad Miller (WPI)
3b72114555 Merge "Fix imports on vision examples so they compile. Fix Typo." 2014-12-22 09:16:42 -08:00
Brad Miller (WPI)
cc36454b90 Merge "Add C interface for CanTalonSRX::SetModeSelect(modeSelect, demand)." 2014-12-22 08:45:10 -08:00
Omar Zrien
aae20ddbff Artifact artf3945 : CANTalon : Motor Safety Object never feed
Change-Id: I6894399d0eb7c36ff698639862fa6ad045a70db8
2014-12-21 16:47:03 -05:00
Joe Ross
ffd9061766 Fix imports on vision examples so they compile. Fix Typo.
Change-Id: I1d6ebf47c824fa93d8a312882cddc778f340009e
2014-12-20 20:47:09 -08:00
Peter Johnson
9ffdea188b Add C interface for CanTalonSRX::SetModeSelect(modeSelect, demand).
Change-Id: Ic8305ec283ddb89afc60d6bc5226411b1f8cc18b
2014-12-20 12:46:05 -08:00
Patrick Plenefisch
46dc99a115 Adding SFX to tools zip
Change-Id: I09a04506682a5d0ccbe8e556285de587915f7383
2014-12-19 09:52:25 -08:00
Brad Miller (WPI)
91d714d2e9 Merge "Single line bug in CanTalonSRX::GetAnalogInVel(). return value was not being sign-extended." 2014-12-19 07:02:09 -08:00
Brad Miller (WPI)
9a28aaaa7c Merge "Change expected voltage on CAN tests" 2014-12-19 07:01:20 -08:00
Omar Zrien
96a76ba89e Single line bug in CanTalonSRX::GetAnalogInVel(). return value was not being sign-extended.
Change-Id: I44271726ece9aaa7b94f35e611f24a18dbb53825
2014-12-19 03:27:29 -05:00
Brad Miller
d26059a4fb Change expected voltage on CAN tests
Change-Id: I8c4533c7bcc81e7904d10792316382d4c01a840a
2014-12-18 21:22:31 -05:00
Brad Miller
ee0d835304 Remove an extra constructor from a bad merge
Change-Id: I0475eef143814ebf8ee4ec71a019872420442c4f
2014-12-18 18:28:15 -05:00
James Kuszmaul
6080a3b186 Duplicate of gerrit 739; changed method from public to private.
Change-Id: Ib15210ff0e5d8d99a649397499bab4737a1a489e
2014-12-18 16:08:46 -05:00
Omar Zrien
3d06a763a2 CanTalon : Adding config routines for limit switch normally open vs normally closed.
They already existed in Labview, so this will keep parity
New C++/Java funcs
ConfigFwdLimitSwitchNormallyOpen
ConfigRevLimitSwitchNormallyOpen

Change-Id: Ifd65ead827838e7158f7261c67adc3738c72eabf
2014-12-18 15:57:26 -05:00
Omar Zrien
e1480ec798 Noticed that if changeControlMode() is called every teleop loop, it causes motor to stutter as it enters and immediately leaves kDisabled.
A simple improvement was to only perform the disable-before-next-set strategy if the caller's request mode is not equal to the current mode.

To keep things simple, SetControlMode was renamed to private method ApplyControlMode so we can still invoke it from c'tor.
Then, the new impl'n of SetControlMode() just calls ApplyControlMode() when caller's request mode is different.  That takes care of direct-calls from team source, and indirect calls through enableControl().

Applied to both c++ and java.
Tested in java so far...

Change-Id: I934c06c5339d933918470659acd635e12eb4d113
2014-12-18 15:54:47 -05:00
Omar Zrien
a5d9ba412c Second pass through all the HAL functions and cpp/java API. Filled in some parity holes between java and cpp.
Java...
added setStatusFrameRateMs() to modify the frame rate for status frames
added missing func that already exists in c++
	isFwdLimitSwitchClosed()
	isRevLimitSwitchClosed()
	getNumberOfQuadIdxRises()
	getPinStateQuadA()
	getPinStateQuadB()
	getPinStateQuadIdx()
added getAnalogInRaw() that doesn't count overflows (for potentiometers).
added setStatusFrameRateMs() to modify the frame rate for status frames
added getBrakeEnableDuringNeutral()

C++...
added GetAnalogInRaw() that doesn't count overflows (for potentiometers).
added SetStatusFrameRateMs() to modify the frame rate for status frames
added GetBrakeEnableDuringNeutral()
added kLimitMode_SrxDisableSwitchInputs to CANSpeedController::LimitMode

Patch set 2: Joe Ross, fixed two javadoc errors

Change-Id: I0bf871e138953de60eeacb547dc359f2125b1327
2014-12-18 15:51:47 -05:00
Omar Zrien
2434515d41 artf3913
Increased wait delay to 4ms to cover worst case delays for solicted signal getters.
Specifically....
-Get firmware vers
-Get P,I,D,F gains
-Get IZone, Get CloseLoopRampRate
-Get IAccum (integral accumulator)

Change-Id: I313ea984832cce5182af8e5af5e775837fd54fdc
2014-12-18 15:49:29 -05:00
Brad Miller (WPI)
741618250b Merge "C++ CANTalon was missing SetIzone. Added SetIzone to match java, and made the set/get Izone integral." 2014-12-18 12:45:34 -08:00
Omar Zrien
8b8d7e77cd C++ CANTalon was missing SetIzone. Added SetIzone to match java, and made the set/get Izone integral.
Change-Id: I264ac8faaab0ebd208062923f6da2094e7e28b0a
2014-12-18 15:16:10 -05:00
Omar Zrien
c093a553ee changed variable type of closeLoopRampRate in setpid to double from int. It's represents V per sec since it calls setCloseLoopRampRate() underneath.
The other remaining closeloopramprate changes are also merged into this commit, so they may be redundant on gerrit.

Change-Id: Ic3108bb3669e487009b8f52412da3c2f44c42f6f
2014-12-18 15:11:39 -05:00
Fred Silberberg (WPI)
a1375e58cd Merge "Don't fail silently if DIO or PWM allocation fails" 2014-12-18 11:25:39 -08:00
Brad Miller (WPI)
15ff7f5038 Merge "Added the getButtons method back that reads all the buttons at the same time" 2014-12-18 10:33:11 -08:00
Brad Miller
c17ba98f72 Added the getButtons method back that reads all the buttons at the same time
Change-Id: I0f7f35b6a70f861911166de7be3802547ff4b2eb
2014-12-18 10:57:11 -05:00
Brad Miller (WPI)
dee755ab19 Merge "renamed param to match function name." 2014-12-18 07:06:20 -08:00
Brad Miller (WPI)
92c54f5f5d Merge "Image v23" 2014-12-17 15:10:36 -08:00
Fred Silberberg (WPI)
1fde00643f Merge "Fixed post4066 bug: Prestart() inaccessible." 2014-12-17 14:19:03 -08:00
Colby Skeggs
47443b4e1e Fixed post4066 bug: Prestart() inaccessible.
Change-Id: Ie179453b038458e77257c1b2d0acba7a4224f6c4
2014-12-17 13:39:54 -08:00
PetaroMitaro
f01e5b5570 fixed robotCommand in src
Change-Id: I591939301da4427e9139b824b016bb00d4b24485
2014-12-17 16:11:48 -05:00
Omar Zrien
198e2eed14 ClearStickyFaults() should not take a param, just clears sticky flags in a one shot manner.
GetCompressorFault() => GetCompressorCurrentTooHighFault()
	There are now three compressor related faults so getters needed to be more verbose.
New getters()...
	GetCompressorCurrentTooHighStickyFault
	GetCompressorShortedStickyFault
	GetCompressorShortedFault
	GetCompressorNotConnectedStickyFault
	GetCompressorNotConnectedFault

Fire and forget api added. Likely not used any time soon, BUT having it ready in HAL is harmless.
	FireOneShotSolenoid()
	SetOneShotDurationMs()

Solenoid fuse and compressor current too high fault bits were flipped in decoder

Change-Id: Ib47dddddd8e4cc22149de1b583968d99919b00af
2014-12-17 15:05:46 -05:00
Fredric Silberberg
22c4207553 Image v23
This updates the image version to version 23. It also moves the vision libraries
to follow the same conventions as the rest of the ni libraries.

Change-Id: I39e6fb3d8bbd2fd3141c2a43a5bae2fd15149003
2014-12-17 11:04:21 -05:00
Omar Zrien
bea9eb0efa renamed param to match function name.
Change-Id: I89c483691e0f99a6d20bed1271209a8141e71c0e
2014-12-16 20:05:30 -05:00
Brad Miller (WPI)
b72eb4b812 Merge "added Java vision example programs" 2014-12-16 11:43:02 -08:00
Dustin Spicuzza
0d8c454727 Don't fail silently if DIO or PWM allocation fails
Change-Id: I800c429507c3436c2d49561ba279700ad52569fe
2014-12-16 14:24:14 -05:00
PetaroMitaro
d61d491a02 added Java vision example programs
Change-Id: Icd99f53cc544c2609a333f0a86f4eac064d565bd
2014-12-16 11:14:37 -05:00
Brad Miller (WPI)
786e844a9f Merge "Fix ControllerPower 5v faults and add javadocs. Fixes artf3918." 2014-12-16 08:07:30 -08:00
Joe Ross
170b5860ee Fix javadoc compile errors that broke build.
Change-Id: Ie110743154f842dc3a2e756f7917e3aa131c87bd
2014-12-15 19:03:27 -08:00
PetaroMitaro
26c50ebe02 fixed java CameraServer
Change-Id: I34b8c1e2ff05199afdcab579f7ac7188fbe40fd7
2014-12-15 19:45:56 -05:00
Joe Ross
46c659d6b6 Enable Java 8 doclint checking (except for missing tags).
Change-Id: Iebfc7b99cbe43375f9cc067cca322244af44395b
2014-12-15 15:50:44 -08:00
Joe Ross
6fdd491081 Fix javadoc warnings.
Change-Id: I37049f234c6dfddc138121822525794d74e1b74c
2014-12-15 18:48:46 -05:00
Fred Silberberg (WPI)
fe4535dfa0 Merge "Resolved artf3579: robot can no longer be enabled until robotInit() finishes in IterativeRobot; similar options available by overriding prestart() for other base classes." 2014-12-15 15:39:21 -08:00
Brad Miller
636e2e13ad Wrong package declaration in camera server
Change-Id: Ia35d7f78d37aa0db51eb98901364fc228dabaa53
2014-12-15 13:40:25 -05:00
PetaroMitaro
d3f5b74668 added CameraServer.java
Change-Id: I4c41b560d879ffc6d8aa4681cad8f75297fe6cda

Fixed some issues with the camera server class

Change-Id: Ifda524b55f84053be004a404a2890905ded7b266
2014-12-15 11:00:49 -05:00
Brad Miller (WPI)
8116bbd15b Merge "Fix various bugs in nivision wrappers." 2014-12-15 05:42:07 -08:00
Peter Johnson
37052246a5 Fix various bugs in nivision wrappers.
- IMAQdx typedef overrides were being ignored, resulting in incorrect types
(e.g. IMAQdxSession was a long instead of an int).

- Allocated byte buffers byte order was not being set.

- imaqDispose was incorrectly named.

Change-Id: I5d038d45e82755615f0a5bb928defb98f557f93e
2014-12-15 02:44:07 -08:00
Joe Ross
a649d3b553 Fix ControllerPower 5v faults and add javadocs. Fixes artf3918.
5V faults was returning count of 3.3V faults. Copied javadocs from
C++.

Change-Id: I95b5c6ed1213ed235ecde11ef7e28ad05aabca6e
2014-12-14 16:55:22 -08:00
Omar Zrien
6a7e7cf611 Two param constructor added to C++/java CANTalon so caller can optionally specify the periodMs at which the talon control frame is sent.
The param is capped in the HAL C++ class to [1ms, 95ms] so that zero and negative periods are caped to 1ms, and so that caller can't pass an absurdly large value, which causes TALON is appear disabled.

Change-Id: I4207194be25a33bbd6ad281a75301ce6684659a5
2014-12-14 17:09:52 -05:00
Brad Miller (WPI)
77997e52fb Merge "added PDP methods to javalib" 2014-12-14 07:34:56 -08:00
Peter Johnson
e655072efc Synchronize access to buffered Joystick data.
Change-Id: Iae453872e89c7b6364d486a6bbc8b210c94defee
2014-12-14 10:22:18 -05:00
Brad Miller (WPI)
0427fc34c4 Merge "Check for negative button value and add missing newline." 2014-12-14 07:07:01 -08:00
Brad Miller (WPI)
e33d80be14 Merge "Add USB serial port option. Uses kUSB for ALSR3" 2014-12-14 07:05:52 -08:00
Brad Miller (WPI)
8381eee185 Merge "Wrap IMAQdx functions." 2014-12-14 06:57:00 -08:00
Colby Skeggs
1c24096cc9 Resolved artf3579: robot can no longer be enabled until robotInit() finishes in IterativeRobot; similar options available by overriding prestart() for other base classes.
Change-Id: I07fde4b1bd2fae0c2e2a04336639b44ec715628a
2014-12-14 01:22:41 +00:00
Omar Zrien
3a684d28b2 PWM timing change for SP and SRX. added 3us to outer bounds
Change-Id: Idce12f8290b5f5646d0d3b14c2a4414fba3120cd
2014-12-13 18:06:43 -05:00
Joe Ross
8786b242b2 Add USB serial port option. Uses kUSB for ALSR3
Change-Id: Ie43fa14fff6aa2f332d3ebacfba099984f8b4eb7
2014-12-13 11:52:27 -08:00
Peter Johnson
b29a4bebf2 Check for negative button value and add missing newline.
Change-Id: I407ab2e0090c22b08503c6de0460d6c1291fa07f
2014-12-13 02:37:35 -08:00
Peter Johnson
db0b421019 Wrap IMAQdx functions.
Quite a few functions aren't wrapped, but the most critical ones for
vision should be.

This also fixes a couple of issues:
- nivision_arm.ini (and imaqdx_arm.ini) are now generated without need for
  running the output on the RoboRIO.
- enum values are generated even if the value is not directly specified.
2014-12-13 00:32:20 -08:00
Kevin O'Connor
8efe998270 Make VictorSP and TalonSRX use correct bounds (give an extra 1us on min and max to ensure saturation). Fixes artf3914 for C++ and Java
Change-Id: Ia1a848e011615e4ff50b9f5ef6e1017764aeb904
2014-12-12 18:09:44 -05:00
Brad Miller (WPI)
ac60198842 Merge "Change vision defaults from "cam1" to cam0". Add some error reporting to Intermediate Vision example" 2014-12-12 14:01:26 -08:00
Brad Miller (WPI)
8a5ee71fd8 Merge "Make SetImaqError actually set the error" 2014-12-12 14:00:48 -08:00
Brad Miller (WPI)
af4ce1074a Merge "Image v22" 2014-12-12 12:49:11 -08:00
Dustin Spicuzza
7636041393 Don't use raw type for HALSetNewDataSem
Change-Id: Ifb6561a33b8e0c49072f9d9c00a2c9c8f4cc3fe3
2014-12-12 15:26:47 -05:00
Fredric Silberberg
745489fec7 Image v22
Added the v22 libraries and headers, and updated the minimum version number to version 22

Change-Id: Ie89dcde0212f164296c01e906b3ee9f332fb0b02
2014-12-12 15:15:45 -05:00
Kevin O'Connor
04f9ca4feb Change vision defaults from "cam1" to cam0". Add some error reporting to Intermediate Vision example
Change-Id: If0bb60611c6c5e6f2411ad5d0432c712b24efb24
2014-12-12 15:08:07 -05:00
Kevin O'Connor
ca5dfbe492 Make SetImaqError actually set the error
Change-Id: Ib714a2ff380319c60f42c859454441e4b69736e0
2014-12-12 14:36:27 -05:00
Brad Miller (WPI)
07619a37a0 Merge "Add C function wrappers for CanTalonSRX." 2014-12-12 05:12:07 -08:00
Brad Miller (WPI)
34d3d756ea Merge "Update javadoc for RobotDrive. Mecanum methods are implemented." 2014-12-12 05:11:06 -08:00
Brad Miller (WPI)
61a5fcce18 Merge "Squashed commit of the following:" 2014-12-12 05:10:34 -08:00
Brad Miller (WPI)
82c4563d34 Merge "getHALErrorMessage(): Add missing CTRE errors." 2014-12-12 05:06:37 -08:00
Peter Johnson
fa337bc747 Add C function wrappers for CanTalonSRX.
Also sync wpilibC++Devices copy of CanTalonSRX.h.

Change-Id: Ideabb0493230ab37563698d37b0360c590f4bbbb
2014-12-12 01:41:08 -08:00
Peter Johnson
8ae7e973f2 getHALErrorMessage(): Add missing CTRE errors.
Change-Id: Ifea0bd9c57d007744616c8808e8f4b1429199898
2014-12-12 00:11:50 -08:00
Peter Johnson
574f2e692a Java nivision: Add RawData to wrap void*.
Change-Id: I8a5dc2a208a39b3c0a26a1a9f906a5c19738628d
2014-12-11 22:19:08 -08:00
Kevin O'Connor
827341caa2 Squashed commit of the following:
commit c8543f97f77a0fef282b6598ae094ac75ea1dd22
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Thu Dec 11 16:41:08 2014 -0500

    Go back to buffering Joystick data.

    Change-Id: I0b4204bfc6e81f50dc4a01c58cfbe14a771e902f

commit a8ddee2a923749903aafe2a8121171b1d70750e7
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Fri Dec 5 17:38:58 2014 -0500

    Add error for using non-existent button 0. Fixes artf3870.

    Change-Id: I5b83cc7e3f0e4ab957279a877c76eeab6cb4b77b

Change-Id: Iae36482fd82176a9e09da1cfdfb69591411b2be2
2014-12-11 16:47:29 -05:00
Brad Miller (WPI)
dd272e6bcb Merge "Add Java nivision wrappers." 2014-12-11 10:00:38 -08:00
Joe Ross
3bdaa63a28 Update javadoc for RobotDrive. Mecanum methods are implemented.
Change-Id: Ia0e0fc62f8deae778eaa14789086ff47210796bb
2014-12-10 19:34:56 -08:00
Brad Miller (WPI)
41b393c210 Merge "Fixed minor issues in CANTalon. Fixes artf3884, 3885, 3887." 2014-12-10 05:53:56 -08:00
Brad Miller (WPI)
11cf860ecd Merge "Check and coerce rumble inputs to range of 0 - 1." 2014-12-10 05:31:55 -08:00
Brad Miller (WPI)
2168d2cb77 Merge "Require Jaguar version v108 or higher." 2014-12-09 14:21:10 -08:00
Peter Johnson
430722c4a3 Add Java nivision wrappers.
Only very basic testing performed to date.

The wrappers are still a bit incomplete (some structures and functions),
but are much more complete than the old ones.

Fixes artf3796.

Changes from initial changeset:
- Use // for comments.
- Add auto-generate notices to the beginning of each generated file.
- Include error number with error text in exception.
- Add free() function to structures.
- Fix out-of-order / non-array enums.
- Avoid duplicate calls to DisposedStruct.write() as .getAddress() does it.
- Refactor OpaqueStruct.
- Default to no null allowed except when overridden.
- Implement unowned return values.
- Add gen_struct_sizer script.

Change-Id: Ie0d102c45817ea8812d98fe4938d1a2255c61664
2014-12-09 00:48:57 -08:00
Joe Ross
497f38fe0e Check and coerce rumble inputs to range of 0 - 1.
Change-Id: Ic2ee301549e68e8cc56f91755521f456c8d0b5f7
2014-12-08 20:45:22 -08:00
James Kuszmaul
9f2dcdeab6 Fixed minor issues in CANTalon. Fixes artf3884, 3885, 3887.
Adds isEnabled and getSetpoint functions to CANTalon classes.
Sets m_controlEnabled=false in Java if changeControlMode(Disabled) is
called.

Change-Id: I08fd0972df22ad83c5578dd43dd6b3536f3b365b
2014-12-08 15:32:54 -05:00
PetaroMitaro
ac07142e4c added PDP methods to javalib
Change-Id: I60f3f615b01dba6e05721c78ba890859c7c9f027
2014-12-07 14:40:27 -05:00
Omar Zrien
19a7243bfc C++
Added Get/clear routine for IntegralAccumulator
Added missing status check in GetFirmwareVersion().  I don't expect this to affect anything.

JAVA
Renamed getRampRate to getCloseLoopRampRate in java to match the set routines in java, and match all routines in cpp.
Added GetFirmwareVersion to java to match cpp.
Added Get/clear routine for IntegralAccumulator
Retested all three routines in java.

Change-Id: I4ce9d9c87a379b9d4a76aae226e2072876218688
2014-12-07 11:19:14 -05:00
Brad Miller (WPI)
e3ac0b628c Merge "Fixed issue in setting CANTalon values." 2014-12-07 08:12:14 -08:00
James Kuszmaul
709a88ad68 Fixed issue in setting CANTalon values.
Used to be that if you called Set less than ~20 ms after changing the
mode, potentially unwanted behavior could ensue.

Change-Id: I27cb3603286d8fddd894649787d88c0446b00615
2014-12-07 10:52:32 -05:00
Omar Zrien
6b844b52ec comment change and added SetModeSelect(int modeSelect,int demand)
{

Change-Id: Iadac7ec70cf04cdc339771c4e919e93723cf62ec
2014-12-06 15:32:14 -05:00
Omar Zrien
9056edf932 commented out system.out.prints in CANTalon.set()
Change-Id: I85bc50c5f1ee7364395eb28d03e3845fe70649c0
2014-12-06 13:39:49 -05:00
Brad Miller (WPI)
ff2ea1287d Merge "Added C++ versions of the joystick query functions" 2014-12-05 17:29:55 -08:00
Brad Miller
b41690b387 Added C++ versions of the joystick query functions
Change-Id: I4acdb0a54493e633b2a7a9b265c3958a9ba163d1
2014-12-05 20:13:23 -05:00
Fred Silberberg (WPI)
ce8e65d41e Merge "Changed AnalogPotentiometer to use angle specification and rail voltage." 2014-12-05 16:58:04 -08:00
James Kuszmaul
66622b43e7 Fixed accidental confusion between seconds/milliseconds.
get* in CANTalon would've blocked for 1 sec instead of 1ms.

Change-Id: I1b6fce24329e2789053372181dbef5c28f4b747a
2014-12-05 19:16:53 -05:00
Omar Zrien
568b842c73 added setPosition to java. Great for zero-ing your relative sensors, also exists in cpp and LV.
Change-Id: Idfd8c0d2c568306cb6853803315a99b92992b388
2014-12-05 19:11:17 -05:00
Omar Zrien
4d142cdafa commented out throws in getP,getI,getD,getIzone, getRampRate.
Getting/setting these should be available all the time.

Change-Id: I8ecc6dc8847c946c63c83081a338c1bd70a656b5
2014-12-05 19:05:25 -05:00
Colby Skeggs
2ae8f40a58 Changed AnalogPotentiometer to use angle specification and rail voltage.
Change-Id: I98f2c1c16726496a69c86174cdb870c74e05822c
2014-12-05 23:40:20 +00:00
James Kuszmaul
4833316571 Added more Talon SRX documentation and PID samples.
Change-Id: I2b1326c11452c6895846ded1277dbf4d38a5222d
2014-12-05 17:21:36 -05:00
Brad Miller (WPI)
16f9db30a9 Merge "fixed bug artf3676 : Typing in a project name into the create command dialog in eclipse is broken" 2014-12-05 14:07:38 -08:00
PetaroMitaro
e092742f40 fixed bug artf3676 : Typing in a project name into the create command dialog in eclipse is broken
Change-Id: I591f1950624e280feb8f7cb262bce11783cb3ff1
2014-12-05 16:32:51 -05:00
PetaroMitaro
4f6fa2482b added joystick and driverstation counts for POV, buttons, and axis 2014-12-05 16:30:20 -05:00
Joe Ross
52408e2658 Add classes for VictorSP and TalonSRX PWM control.
Update documentation for existing classes to better describe what
they control

Change-Id: I1932b39a3f082c2eb57f41edb4ba55c73cce2938
2014-12-05 16:20:58 -05:00
Brad Miller (WPI)
d986ffac81 Merge "Java-Installer" 2014-12-05 13:02:54 -08:00
Fredric Silberberg
bc3c5447e7 Java-Installer
Added the java-installer to the tools-zip created by the plugins

Change-Id: Ibf03e3cf83c6c8a7663c4c55c0fb18623020039e
2014-12-05 16:02:15 -05:00
Brad Miller (WPI)
b125e6b40a Merge "Various getters and setters added to C++. usleep added to the getters that require a little time for solicted response (getPIDF, getIzone, and getFirmwareVers. Tested against the TALON SRX unit test originally written for CanTalonSrx HAL class." 2014-12-05 12:52:51 -08:00
Brad Miller (WPI)
88a043bda4 Merge "Change Periodic Status rate to 20ms. Jaguar firmware v109 fixes issue with periodic status sending." 2014-12-05 11:49:52 -08:00
Fred Silberberg (WPI)
c57d01af94 Merge "Add USB IP to deploy fallbacks and make fallbacks work." 2014-12-05 11:48:44 -08:00
Brad Miller (WPI)
6abde412c1 Merge "Image v20" 2014-12-05 11:42:40 -08:00
Brad Miller (WPI)
5e6cd0bf9e Merge "Implement Joystick Outputs and Rumble (fixes artf3807)" 2014-12-05 11:42:14 -08:00
Kevin O'Connor
ec03c3068d Add USB IP to deploy fallbacks and make fallbacks work.
Change-Id: Iae28b1bc883e65cd6f3a88858405d43815c7323b
2014-12-05 13:53:44 -05:00
Kevin O'Connor
45f3b76103 Fix off-by-one in button checking (fixes artf3861)
Change-Id: Ic3c33bf08417fef9c7432a19a419534b76cb8597
2014-12-05 12:26:05 -05:00
Kevin O'Connor
dac04cb4a2 Implement Joystick Outputs and Rumble (fixes artf3807)
Change-Id: I7e2fa3990f47b6c51ae498035878a29c02817c1b
2014-12-05 12:24:50 -05:00
Omar Zrien
7d026be264 Various getters and setters added to C++.
usleep added to the getters that require a little time for solicted response (getPIDF, getIzone, and getFirmwareVers.
Tested against the TALON SRX unit test originally written for CanTalonSrx HAL class.

Change-Id: I7e75b8b63ac9ffecb5d48b87cbe0e0ee05bbb5a2
2014-12-05 05:08:10 -05:00
James Kuszmaul
5893d28f39 Added support for basic PID in java Talon SRX.
Tested analog PID in Java and C++.
Changed to default to controlEnabled.
Loosely wrapped a bunch of CanTalonSRX functions in Java.

Change-Id: I9da380e2368d9a72f08be4434ac63b5710a9f90f
2014-12-04 17:00:36 -05:00
Fredric Silberberg
cd01945908 Image v20
This adds the updated v20 libraries, and bumps the image version number
in the ant build scripts

Change-Id: I7c4431c167dd77763d4004709454767daefccbf0
2014-12-04 14:50:21 -05:00
Kevin O'Connor
36c53667cd Require Jaguar version v108 or higher.
Change-Id: Ib3a29a9182a776771db8b45bf82df3168e800277
2014-12-04 14:15:01 -05:00
Omar Zrien
ea610eb302 Getters for : AppliedThrotte, CloseLoopErr, Sensor/Ain/Enc Pos and Vel are now signed extended. Before this negative values would not de-serialize correctly.
There are some redundant TALON fixes in this particular commit, hopefully it handles ok on Jenkins.
Tested with Talon SRX Unit Test (firm 0.34)

Change-Id: I67db546fea2867cc6bd53ea26dc1cb61ac106490
2014-12-04 10:40:59 -05:00
Omar Zrien
d04476bb2f Wired close loop pos and vel to CANTalon::Set().
Did basic testing with close loop pos with talon slaving.

Change-Id: I880a29bff29a43d45b7af1be05e08b09063bf5d7
2014-12-04 10:40:59 -05:00
Kevin O'Connor
2bb0a32c15 Change Periodic Status rate to 20ms. Jaguar firmware v109 fixes issue with periodic status sending.
Change-Id: I9d5e1f8dce5f63ea97fc3d14de518980d299b5eb
2014-12-04 10:22:01 -05:00
Fredric Silberberg
cdbe80315f Image v19
This updates the hal headers and ni libraries for image v19. There were
very few changes this time around, only some network communications stuff.
Also updated the minimum version number in the build properties to the new
image version

Change-Id: Ic8cb384b92c54d938dec36df34fc609626b4cd5d
2014-12-03 18:19:25 -05:00
Brad Miller (WPI)
517e708fd8 Merge "Reorded network table init to avoid error and added disabledInit to template (artf3841, artf3840)" 2014-12-03 14:37:07 -08:00
Brad Miller
70825be690 Reorded network table init to avoid error and added disabledInit to template (artf3841, artf3840)
Change-Id: I5d1b1925f594e8019541033b20f70be003798d82
2014-12-03 17:36:26 -05:00
Brad Miller (WPI)
43532198c7 Merge "Artifact artf3520 : Need a PDP Clear Sticky Faults API" 2014-12-03 11:40:18 -08:00
Omar Zrien
4da9ebe1fd Artifact artf3520 : Need a PDP Clear Sticky Faults API
Artifact artf3740 : C++ and Java don't implement all PDP features

Change-Id: I6a519d16de412a4d477b1f9c57e9b405b2e1aae0
2014-12-03 14:36:43 -05:00
Brad Miller (WPI)
9479793e1d Merge "Open scope of several data fields to be able to extend CommandGroup" 2014-12-03 11:08:06 -08:00
Brad Miller (WPI)
20e9f499b0 Merge "Add hasPeriodPassed function to java, for parity with C++ Timer API" 2014-12-03 11:06:58 -08:00
Brad Miller
3d897cef58 Make robot programs deploy as lvuser for correct permissions (artf3860)
Change-Id: Ia996f9c1b910c5c9cf33ca8a4305acd8b141b40c
2014-12-03 11:40:35 -05:00
Brad Miller
fa229f2b13 Added java joystick message spam fix (artf3836)
Change-Id: I1e29aea00dc61574272f47fc3e1bcd98bd825d22
2014-12-03 11:05:49 -05:00
Brad Miller
b1056cf6d7 Prevented missing joystick messages from coming out more than once a seccond (fixes artf3836)
Change-Id: I78c0862b0d1c65951a01169db56dbe4eaddf8247
2014-12-03 07:42:48 -05:00
Dustin Spicuzza
8e707169a1 Add hasPeriodPassed function to java, for parity with C++ Timer API
Change-Id: I0f9a2714f20deaaccce610bd3eec58409eac3104
2014-11-30 23:51:01 -05:00
Joe Ross
47961c8b13 Open scope of several data fields to be able to extend CommandGroup
Change-Id: I81ac59dd45aa50ed3d8dc4fdd1d5807899af546b
2014-11-30 08:28:15 -08:00
Brad Miller (WPI)
b59f4141c4 Merge "Open scope for gyro methods. Fixes FirstForge artf1699." 2014-11-28 08:34:15 -08:00
Brad Miller (WPI)
d62d82b28b Merge "Feed motor safety when StopMotor is called. Fixes artf1687 on FirstForge." 2014-11-28 08:29:27 -08:00
Brad Miller
a9d30c0389 Fixed a typo in the SRX sample project to correct a variable name error
Change-Id: I68f9cf33062bf2ef5df88247af8a5ee470a28d77
2014-11-28 11:07:08 -05:00
Joe Ross
6e0c84d942 Feed motor safety when StopMotor is called. Fixes artf1687 on FirstForge.
Change-Id: I75c1b30c28193c1e5ed5f6fad502ab88ebc345fa
2014-11-27 11:31:00 -08:00
Joe Ross
bb8ea17acf Open scope for gyro methods. Fixes FirstForge artf1699.
Allows user to cause gyro calibration on demand. It also exposes
the AnalogInput object as protected to allow the user to extend
the gyro class and implement their own calibration.

Change-Id: Ib4206a9b16ce6d5e8e5ca9c28a14471974705a7f
2014-11-27 08:37:27 -08:00
Brad Miller (WPI)
c683e24aa9 Merge changes If51bf61d,Ia6f4997b
* changes:
  Added Omar's new CanTalonSRX code.
  Added nicer Java interface for Talon SRX -- throttle mode works.
2014-11-26 12:53:44 -08:00
James Kuszmaul
7b371f6d7c Added Omar's new CanTalonSRX code.
I also updated the C++ and Java code some. For C++, this meant making it
compile and adding in the framework for the closed-loop control of the
motor. For Java, I updated the JNI bindings with SWIG and created an
GetTemperature accessor function to demonstrate how to use the accessors
because swig does funny stuff with pass-by-reference functions.

Change-Id: If51bf61d0a9bc65a8d497f8d91a5be8d6ff4fdcc
2014-11-26 15:51:16 -05:00
Brad Miller (WPI)
f6de7bc961 Merge "Java debug launcher no longer waits for text marker to appear in console." 2014-11-26 12:05:27 -08:00
Brad Miller
c00d9f1523 Updated the names and descriptions for the c++ vision examples
Change-Id: I7f4e72ddd3e5f5ad20012ed81bd74fa5373e0ebd
2014-11-26 14:26:32 -05:00
James Kuszmaul
6ec2d262c8 Added nicer Java interface for Talon SRX -- throttle mode works.
Change-Id: Ia6f4997b4836826f56a3dd4c8f7f29a0bf62d94c
2014-11-26 14:02:20 -05:00
Brad Miller (WPI)
3c8b31608c Merge "Use standard eclipse dialogs instead of Swing dialogs" 2014-11-26 10:32:19 -08:00
Brad Miller (WPI)
29f36b0eac Merge "Overwrite instead of append during version check. Fixes artf3818" 2014-11-26 09:10:17 -08:00
Brad Miller (WPI)
486885e8bf Merge changes Id7a97940,I6234fe06
* changes:
  Simulator makefiles: Set file extension based on platform
  Fix CMakeLists.txt to not be platform specific
2014-11-26 09:02:01 -08:00
Brad Miller (WPI)
020d97580a Merge "Fixed bug with SDFormat version changing." 2014-11-26 09:01:36 -08:00
James Kuszmaul
28a41e4ac2 Added support for CAN Talon SRX in C++ and Java.
Currently, the JNI bindings are generated by Swig and, unfortunately,
  the interface available through Java is lower-level than that for C++
  (ie, direct access to the ctre code through the JNI bindings, rather
   than an interface on top of that), but it does work.
See eclipse plugins for some short samples.
There are a couple of short unit tests as placeholders.
Still needs some cleaning up.

Change-Id: Iae2f74693ca6b80bf7d5aca0625c66aa6e0b7f85

Added quick samples for C++/Java CAN Talon stuff.

Change-Id: I3acb27d6fd5568d88931e0d678c09973d436735d
2014-11-26 11:55:37 -05:00
Brad Miller (WPI)
f590cda8f9 Merge "match templates with robot builder." 2014-11-26 08:34:03 -08:00
Joe Ross
c98f54dbbc match templates with robot builder.
Change-Id: Iedb8b9efc58ca73bc654b119d5d1aed5b4eb5553
2014-11-26 07:41:56 -08:00
Brad Miller
81840b2c49 Add a getControlWord() call to the run thread in DS so that the program is kept alive
Change-Id: I8b86506f6125422e19e8b5ab23e3667bf808bdc4
2014-11-25 17:34:38 -05:00
Paul Malmsten
78ccb48fd3 Java debug launcher no longer waits for text marker to appear in console.
Lanucher immediately attempts to attach 20 times before giving up
and waits 2 seconds between attempts.

Change-Id: Ib0a70b8bbf5e90d5a733ea4e0d6b17d91b36db87
2014-11-23 15:34:52 -05:00
Kevin O'Connor
b9913d3e12 Overwrite instead of append during version check. Fixes artf3818
Change-Id: I05bde0997e13318c113a7f7ee228fa1c007bfd2f
2014-11-22 14:32:13 -05:00
Brad Miller (WPI)
56430ccd7c Merge "Pipe java program output through NetConsole" 2014-11-22 11:14:06 -08:00
Brad Miller (WPI)
d412584f16 Merge "Tried to improve reliability of a couple of unit tests." 2014-11-22 10:58:09 -08:00
Kevin O'Connor
364a3afad4 Pipe java program output through NetConsole
Change-Id: Ia012d73236d8e9c73cb53eb011f1b1f9d3c2ce83
2014-11-21 16:39:46 -05:00
Kevin O'Connor
97456f40f7 Don't buffer NetComms data and add IsDSAttached() check to C++ IsEnabled() method (fixes artf3747)
Change-Id: Idaa7edcd601147c39fb31b7966d9e975869dea87
2014-11-21 13:14:48 -05:00
Kevin O'Connor
7e5ed03d28 Check if Joystick Button exists when requested and pass 0 and warn if it doesn't
Change-Id: I2194859ef8b263f1a20aba52ec154fb0a1fc8078
2014-11-21 12:07:08 -05:00
Kevin O'Connor
14a1e6ae8e Get MatchTime from NetComms (fixes artf2538)
Change-Id: I7ea438ce4610087bceac696a958e3c1e3ead238a
2014-11-21 10:37:29 -05:00
Dustin Spicuzza
529f5b773f Use standard eclipse dialogs instead of Swing dialogs
- Swing dialog triggers freeze on Eclipse Luna on OSX 10.10

Change-Id: I9f59e884d19dd397502537286d2730be9eb0fec1
2014-11-20 23:39:54 -08:00
James Kuszmaul
91c70daf5b Tried to improve reliability of a couple of unit tests.
Change-Id: I45307da855808e85c8f9b9958c7590d60636f8e9
2014-11-20 16:39:32 -05:00
Alex Henning
e86312cd6f Fixed bug with SDFormat version changing.
Change-Id: Ia2d17fc60763678ad4971d108861988157537fc3
2014-11-20 16:07:00 -05:00
Brad Miller (WPI)
99dc3c90ed Merge "Removed the tail command" 2014-11-19 16:57:01 -08:00
Brad Miller
4ad8818a8a Added vision samples
Change-Id: Ieb482d072ae15817be40477f187f081c9f7fe19f
2014-11-19 19:39:35 -05:00
Fredric Silberberg
e4babbe4d6 Removed the tail command
The build scripts were still calling the tail command for following the log
file, even though we're now using netconsole. I've removed them.

Change-Id: I48498c1ef338f99130e447097081db92b394e1aa
2014-11-19 14:20:53 -05:00
Fred Silberberg (WPI)
9ec5164075 Merge "Handle cases where no DS is attached (initial m_controlWord, reportError, getAlliance and getLocation) fixes artf3778" 2014-11-19 10:42:32 -08:00
Fred Silberberg (WPI)
033e5f37b4 Merge "Add methods for checking Watchdog status, ds status, and brownout status" 2014-11-19 10:34:33 -08:00
Brad Miller (WPI)
e3d256e441 Merge "Change uint to int for channels on constructors which can take a single channel or single pointer to avoid ambiguous calls." 2014-11-19 10:28:34 -08:00
Kevin O'Connor
867e4080dc Change uint to int for channels on constructors which can take a single channel or single pointer to avoid ambiguous calls.
Change-Id: Id56f611675bf4dee8d31e152c4ee30112d07aac4
2014-11-19 11:40:43 -05:00
Kevin O'Connor
4be9732e9c Moves C++ global build properties to properties file to match Java.
Adds host reachability check and static IP fallback
Adds roboRIO Image check
Adds JRE check for Java

Change-Id: I07f3a0863bde0ebec7e7d8f48270e45758bddba5
2014-11-19 09:20:35 -05:00
Kevin O'Connor
cd29e1c32f Handle cases where no DS is attached (initial m_controlWord, reportError, getAlliance and getLocation) fixes artf3778
Change-Id: I6befa8e31e6762a101cd0a19641e558c955865b9
2014-11-18 16:54:06 -05:00
Kevin O'Connor
e73b3ed7b5 Add methods for checking Watchdog status, ds status, and brownout status
Change-Id: I723c87d0c50612cbffbb81b0e039efd0ef05fcd0
2014-11-18 15:56:59 -05:00
Dustin Spicuzza
d7a9794080 Simulator makefiles: Set file extension based on platform 2014-11-17 21:36:29 -08:00
Dustin Spicuzza
6234fe06f5 Fix CMakeLists.txt to not be platform specific
- Additionally, use the boost macro to properly find its library
2014-11-17 21:36:29 -08:00
Fred Silberberg (WPI)
c7a90b2ccc Merge "Fix write when used with long byte array." 2014-11-17 11:56:51 -08:00
Brad Miller (WPI)
e5443f0e78 Merge "Added in new headers and libraries for image version 18. This image contains a change to fix artf3773, which switched setDataSem to be a pthread_cond_t variable instead of a mutex. As a result, a few new HAL functions had to be exposed over JNI, specifically the functions for MultiWait." 2014-11-17 11:28:36 -08:00
Brad Miller (WPI)
0abe19a1ae Merge "Added support for launching a simulation friendly SmartDashboard." 2014-11-17 11:27:13 -08:00
Joe Ross
ccd64090bb Fix write when used with long byte array.
If the byte array allocated is longer then the count passed to the
write method, there will be a buffer overflow exception. Only put
the number of bytes specified by count.

Change-Id: I10ff48d5a5cf3f82c4e4e347326be033db300cdb
2014-11-16 16:40:49 -08:00
Fredric Silberberg
c6891fc034 Added in new headers and libraries for image version 18. This image contains a change to fix artf3773, which switched setDataSem to be a pthread_cond_t variable instead of a mutex. As a result, a few new HAL functions had to be exposed over JNI, specifically the functions for MultiWait.
Change-Id: I28be07c8102acb078440ee74ded46527328dd271
2014-11-16 17:01:44 -05:00
Thomas Clark
6f4d6ed998 Add support for vision in C++
Add IMAQdx and its dependencies

Change-Id: I6befa563e96db224db83fb90985c86eb3e8d4f3e

Add a "CameraServer" class for C++

This class allows the driver station's camera viewer to interact with
a C++ program.  It includes both an automatic mode to send images from
a webcam to the dashboard in a background thread, and an option to
manually feed it IMAQ images.

Change-Id: I54fdb164c00dce165859c22f435be647dc9927cc
2014-11-16 13:06:49 -05:00
Brad Miller (WPI)
0670ff145f Merge "Using netconsole-host to start programs and get output directed to netconsole and the log file (fixes artf3777, artf3750)" 2014-11-15 16:27:27 -08:00
Brad Miller
655ade6436 Using netconsole-host to start programs and get output directed to netconsole and the log file (fixes artf3777, artf3750)
Change-Id: I904989f94132dd0031b5bec9cca2c8dee46070fe
2014-11-15 19:19:36 -05:00
Alex Henning
7cfa0d04d7 Added support for launching a simulation friendly SmartDashboard.
Change-Id: I84176cf522da20a74234f7cfb7b8a6aaca7d9248
2014-11-14 16:08:17 -05:00
James Kuszmaul
f1476be276 Reverted accidental commits
Change-Id: Ieee3600da11df698f1025c85972acd979e486aa0
2014-11-14 15:28:48 -05:00
James Kuszmaul
9be6ee4712 CANTalon throttle works.
Fleshed out CANTalon interface; it currently works just to write a
throttle. The firmware doesn't fully support everything yet, so we are
still significantly limited.

Change-Id: I2868c4c168a8cb42cda754589777beef31ffd354
2014-11-14 15:21:12 -05:00
Thomas Clark
9050ea7e3d Generalize CANJaguar and CANTalon with a CANSpeedController interface in C++
CANSpeedController is a subinterface of SpeedController that adds method
prototypes and enums for all of the common smart speed controller features.

CANJaguar implements this interfaces.  CANTalon does too, but
most methods are stubs right now.

Change-Id: I67e0177d91e45444657280502a247d787ad5c74c
2014-11-14 15:21:12 -05:00
Thomas Clark
c1f68eb2b0 Stick the CanTalonSrx code in, get it to compile
There's a CANTalon class, but it doesn' do anything yet

Change-Id: Ib397db6fc0376f9de95e5efc42a223700be3dbca
2014-11-14 15:21:12 -05:00
Brad Miller (WPI)
fb53eea6b2 Merge "[artf3749] Repaired undefined behavior in takeMultiWait." 2014-11-13 10:07:50 -08:00
Brad Miller
6c294e137b Increase timeout on network table test
Change-Id: I362209954a0abf09c1cd9a0421c2e67a15a58dc6
2014-11-13 09:49:30 -05:00
Brad Miller (WPI)
988defee16 Merge "Adds the new shared object libraries and headers for image version 17" 2014-11-13 06:39:03 -08:00
Brad Miller (WPI)
279ae1cd9d Merge "Removed remains of the old toolchain method." 2014-11-13 05:09:49 -08:00
Brad Miller (WPI)
49f6b90d15 Merge "Removed the timing option from Iterative Robot Template since it conflicted with its purpose (artf3751)" 2014-11-12 12:50:27 -08:00
Fredric Silberberg
6cd5eeab6f Adds the new shared object libraries and headers for image version 17 2014-11-12 15:43:58 -05:00
Brad Miller
c883c9e2fc Removed release configuration from template (fixes artf3688)
Change-Id: I4e6d1abc68f23f870911b7d871b5a835cc26afef
2014-11-12 15:41:55 -05:00
Alex Henning
54951c888f Removed remains of the old toolchain method.
Change-Id: Ib885730acdbb27707ce2caadadc3f9ce86fdd0ca
2014-11-12 15:27:29 -05:00
Brad Miller (WPI)
739508ff83 Merge "First cut at pulling in riolog plugin." 2014-11-12 12:22:04 -08:00
James Kuszmaul
f67849a9b1 [artf3749] Repaired undefined behavior in takeMultiWait.
Change-Id: Ieae7d602472f585db2a896cc76355a5c23d1d670
2014-11-12 15:21:53 -05:00
Brad Miller (WPI)
7c5b3c6286 Merge "Added the OutlineViewer to distribute with the plugins." 2014-11-12 11:47:29 -08:00
Brad Miller (WPI)
eb536ba340 Merge "Added default world files to examples." 2014-11-12 11:40:13 -08:00
Brad Miller (WPI)
19737ba443 Merge "Implement user API for roboRIO power methods (fixes artf3728 and artf3537)" 2014-11-12 06:35:48 -08:00
Brad Miller (WPI)
9f0bed2e6f Merge "Correct off-by-one error in DigOut PWM Gen B HAL code (fixes artf3705 for C++/Java)" 2014-11-12 06:32:07 -08:00
Brad Miller (WPI)
86e4c3b77c Merge "athena-deploy now calls the clean step to deal with a known ant issue where it does not detect changed constants. This addresses art3766." 2014-11-12 06:30:26 -08:00
Fred Silberberg (WPI)
e216d1abd6 Merge "Fix all the samples to build with the C++11/14 language features (constexpr)" 2014-11-11 13:52:33 -08:00
Alex Henning
20aeb5c6cc Added the OutlineViewer to distribute with the plugins.
Change-Id: I958050675782ad2c16e44fad4e272204e19d7d48
2014-11-11 16:39:10 -05:00
Kevin O'Connor
3ad31dd4d7 Implement user API for roboRIO power methods (fixes artf3728 and artf3537)
Change-Id: I7501a83dcdd81d45b298e044379ea4ac3670c742
2014-11-11 15:42:56 -05:00
Kevin O'Connor
4c5b8c8c46 Correct off-by-one error in DigOut PWM Gen B HAL code (fixes artf3705 for C++/Java)
Change-Id: I4cd65089690463b69cfe815bd078d744fb21ff0f
2014-11-11 15:40:48 -05:00
Fredric Silberberg
747cdc8a58 Updated an incorrect voltage constant for the 5V input rail, and added
parenthesis to make the order of operations explicit.
Fix for artf3728

Change-Id: I2dfbad03980c4154cf253fbb06792b8502fcca02
2014-11-11 15:29:20 -05:00
Brad Miller
c3c7baa15c Removed the timing option from Iterative Robot Template since it conflicted with its purpose (artf3751) 2014-11-11 14:49:05 -05:00
Fredric Silberberg
2fdb7c8eba athena-deploy now calls the clean step to deal with a known ant issue where it does not detect changed constants. This addresses art3766.
Change-Id: I0bead9f585c610bb10faef3494c0b3358a79447f
2014-11-11 14:16:43 -05:00
Brad Miller
1d0a6b8ace Fix all the samples to build with the C++11/14 language features (constexpr) 2014-11-11 09:15:46 -05:00
Alex Henning
08fdf45f6e Added default world files to examples.
This saves a step and prevents one of the biggest user errors with the
pacgoat example.

Change-Id: Icdceb1da37c4b456f1a34daa815f3bbe2a47e18e
2014-11-09 14:26:23 -05:00
Paul Malmsten
7338471194 First cut at pulling in riolog plugin.
Plugin was retrieved from https://github.com/mstoeckl/riolog.git with minimal changes to
make it compile.

Change-Id: I340d77c69fe7598595deeaba8d4cd9414b971399
2014-11-08 12:56:45 -05:00
Brad Miller (WPI)
da0cc0c83f Merge "Fixes for 0 based joysticks and joystick axes in simulation." 2014-11-07 08:33:33 -08:00
Brad Miller (WPI)
6e0637e771 Merge "Upped the limits for the output on some PID tests." 2014-11-07 08:31:59 -08:00
Brad Miller (WPI)
8d49d8255b Merge "Move SerialPort to HAL and add SerialPort support for Java Squashed commit of the following:" 2014-11-07 08:27:36 -08:00
Alex Henning
3b53f84c8f Fixes for 0 based joysticks and joystick axes in simulation.
Change-Id: I67608450d0818b38f6d5b5c709190433f2dc5cf5
2014-11-06 19:00:02 -05:00
James Kuszmaul
05bb3cdd71 Upped the limits for the output on some PID tests.
We were having issues with intermittent PID tests because one of the
motors on the test stand was sticky and needed a bit of a push to start.

Change-Id: Ic75cd38de867a74be3e4e445bd0d02323dfc4df8
2014-11-06 14:05:35 -05:00
Kevin O'Connor
18de3aebdd Make sure the whole JVM exits if an exception is thrown. This prevents the DS thread, NT thread or any additional user thread from keeping the program alive when the main thread exits (fixes artf3743)
Change-Id: Ide89a3abe57171553af0a8c68077391b9a91fd29
2014-11-05 15:51:15 -05:00
Brad Miller (WPI)
de5e5ab405 Merge "[artf3709] Fixed PIDController loop timing." 2014-11-05 11:51:04 -08:00
Kevin O'Connor
6b6e5d9530 Move SerialPort to HAL and add SerialPort support for Java
Squashed commit of the following:

commit 4359262e2fef69b1646e3d76641fe622a78dfd89
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Wed Oct 29 13:43:12 2014 -0400

    Add SerialPort to JNI and modify Java SerialPort to use it.

    Change-Id: Id3e6fa538a50e6a96274d8fb1be546dc396fc9c6

commit 114b192388c2fb01745cb3d5ad83612e9d66ea83
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Tue Oct 28 15:46:06 2014 -0400

    Move Serial port handling to HAL and define serial errors

    Change-Id: I4cc73b64d71aafacb410bce080cb29e5fdf565a3

Change-Id: I35b729ad502137ee4c877a415d78007861991e31
2014-11-05 13:58:14 -05:00
Kevin O'Connor
fa20e6ca4f Check for fatal interrupt status on multiple interrupt methods to avoid hanging program (fixes artf3602)
Change-Id: I31cb499fd1641deec26001b719fd0a6f07d20692
2014-11-05 13:19:41 -05:00
Brad Miller (WPI)
e56aa87af4 Merge "Change Talon to use 1x update rate (fixes artf3733)" 2014-11-05 09:55:39 -08:00
Brad Miller (WPI)
63bb8e1f32 Merge "Remove unimplemented sendErrorStreamToDriverStation method (fixes artf3617)" 2014-11-05 08:44:48 -08:00
Brad Miller (WPI)
c1e63acc14 Merge "Use ByteBuffer for conversion from raw sensor bytes to Java types (fixes artf2673)" 2014-11-05 08:44:20 -08:00
Brad Miller (WPI)
68ba9bfeae Merge "Detect projects which are duplicates on Windows due to casing (fixes artf3487)." 2014-11-05 07:48:39 -08:00
Brad Miller (WPI)
aa643d8ba7 Merge "Update Interrupt Javadocs (fixes artf3492 and artf3602)" 2014-11-05 07:46:26 -08:00
Brad Miller (WPI)
1f8a3d5bf3 Merge "DigitalInputs are now automatically added the LiveWindow in both C++ and Java" 2014-11-05 07:43:52 -08:00
Brad Miller (WPI)
2fa04c1750 Merge "Don't raise exception for Joystick axis/POV out of active range. Shorten error message and change to Warning (filtered by DS by default)" 2014-11-05 07:17:09 -08:00
Brad Miller (WPI)
cd3db9631e Merge "Move user program to home\lvuser based on comments from Joe" 2014-11-05 05:23:22 -08:00
Brad Miller (WPI)
8ccb99d87c Merge "Added ignore support for intellij" 2014-11-04 13:49:24 -08:00
Brad Miller (WPI)
b14ca08474 Merge "[artf3717] Added isEnabled to Teleop Loops in Samples." 2014-11-04 13:48:46 -08:00
Kevin O'Connor
b898cec901 Change Talon to use 1x update rate (fixes artf3733)
Change-Id: I592147100058504c919bdd2f31d56580503f5bc2
2014-10-31 18:52:28 -04:00
James Kuszmaul
687e2c6711 [artf3709] Fixed PIDController loop timing.
For C++: The PIDController loop had been changed to run an infinite loop
with a Wait(period) rather than using the Notifier class to schedule
exact runs of the CallCalculate command. Essentially a revert to bb50f4b134,
accounting for more recent changes.

For Java: A similar problem had developed; essentially, a TimerTask used
to be used and at some point was changed to a Runnable. The Runnable had
an infinite loop with a Wait; TimerTask actually schedules things reasonably
(although it is not strictly real-time). Also, there were some
Thread-safety issues which I fixed.

Although Java and C++ had similar issues, they seem to have developed
these issues independently.

Changes have been tested on the GearsBot in both C++ and Java (and it
    works).

Change-Id: I478cb8bfd77cd2d031f8e343d0b8193b602dcc2a
2014-10-31 17:01:44 -04:00
Kevin O'Connor
594d0d8029 Use ByteBuffer for conversion from raw sensor bytes to Java types (fixes artf2673)
Change-Id: Ic22c6569614a457cc4156541d79ed4ce05db8273
2014-10-31 14:03:20 -04:00
Fredric Silberberg
0f825b7179 Added ignore support for intellij
Change-Id: Ia55578c89fadb92d5bd0877d296305081ece0358
2014-10-30 14:48:31 -04:00
Fredric Silberberg
345ceafa0d DigitalInputs are now automatically added the LiveWindow in both C++ and Java
Change-Id: Ic3520737841f2901becfdc99e3900e4e63da8822
2014-10-30 14:46:59 -04:00
Kevin O'Connor
b030be68d3 Detect projects which are duplicates on Windows due to casing (fixes artf3487).
Change-Id: I5f1ecc657fea226ea0eb1429a0f394a3345264db
2014-10-29 16:30:24 -04:00
Kevin O'Connor
fba155804e Update Interrupt Javadocs (fixes artf3492 and artf3602)
Change-Id: Iad66841266a2d5ff606f7e27e90f7c975143245c
2014-10-29 15:23:55 -04:00
Kevin O'Connor
97f954aef6 Remove unimplemented sendErrorStreamToDriverStation method (fixes artf3617)
Change-Id: I35dc863b3318e22e503d95273812ab25a1ae0a70
2014-10-29 14:30:22 -04:00
Brad Miller (WPI)
80194e9809 Merge "Added message to notify when simulation is unsupported." 2014-10-28 13:48:04 -07:00
James Kuszmaul
767686ae2e [artf3717] Added isEnabled to Teleop Loops in Samples.
Anywhere in the sample programs where there was just a
isOperatorControl() in the while loop for Teleop, added an "&&
isEnabled()".

Change-Id: Ib81e8bab79923e262c314a073a591855cbf06846
2014-10-27 15:55:47 -04:00
Peter Johnson
7f30b6bff4 Don't raise exception for Joystick axis/POV out of active range. Shorten error message and change to Warning (filtered by DS by default)
Return 0.0 in this case (as it can be commonly caused by
the joystick not being plugged in).

Still raise exception (Java) / set error (C++) if the asked-for axis/POV
is higher than kMaxJoystickAxes/kMaxJoystickPOVs.

See artf3673.

Change-Id: I4847c5badb358ed08f01170724ec1446af2e4ab9
2014-10-27 15:36:48 -04:00
Kevin O'Connor
8c395ca292 Move user program to home\lvuser based on comments from Joe
Change-Id: I289cfb4603a4ead6641161191129cb5ca0ea9858
2014-10-27 13:43:07 -04:00
Brad Miller (WPI)
5b2520c35f Merge "Fixed building of the frcsim-libwpilibsim-cpp deb." 2014-10-27 09:40:22 -07:00
Alex Henning
fa8d7b843c Fixed building of the frcsim-libwpilibsim-cpp deb.
There is still a bug where the examples have been updated to use 0 based
joysticks, but the simulation libraries have not been updated. I'll fix
that as a separate commit focused on fixing the joystick APIs.

Change-Id: I3b358e67b7fa18b30d1fd2b53098659cfefdfd76
2014-10-26 20:43:50 -04:00
Brad Miller (WPI)
93100c0e67 Merge "Increases the runtime of the PID test to improve stability." 2014-10-24 14:01:04 -07:00
Brad Miller (WPI)
b80565d065 Merge "Decreases the amount of console spam during tests." 2014-10-24 14:00:25 -07:00
Jonathan Leitschuh
2d45cda74b Increases the runtime of the PID test to improve stability.
Change-Id: I852ac6115f0dfe4d39940fbecc34f1b52e6cc12a
2014-10-24 16:35:55 -04:00
Jonathan Leitschuh
e4d90c6cbe Decreases the amount of console spam during tests.
Change-Id: Ia2e3ac5850b4d2c184025779346118c8ac8a75b1
2014-10-24 16:31:55 -04:00
Brad Miller (WPI)
18bdb7fdec Merge "Added C++ Encoder samples to Eclipse Plugin." 2014-10-24 13:15:43 -07:00
Brad Miller (WPI)
f6e8db50f8 Merge "Fixed New Project Wizard to have a radio option always selected" 2014-10-24 13:13:10 -07:00
James Kuszmaul
20c60a5fe6 Added C++ Encoder samples to Eclipse Plugin.
Reads values from quadrature encoder and displays them on the
SmartDashbord.

Also added Encoder with Motor Control example, which is identical to the
Motor Control sample but displays an encoder value on the
SmartDashboard.
2014-10-24 16:01:11 -04:00
Brad Miller (WPI)
66b7a8b66e Merge "Use either DO PWM A or B not A and B and update javadoc to reflect 6 generators (artf3698)" 2014-10-24 12:10:42 -07:00
Peter Johnson
8ebf88b741 Java DriverStation.InTest: Set correct flag.
Change-Id: I99aa58f4fa4df13990cc310a0f21e9a9fd817eb0
2014-10-24 14:19:30 -04:00
Brad Miller (WPI)
b85b0c8eb2 Merge "Keep Notifier firing after FPGA rollover (fixes artf3582), simulation may still have an issue with counter rollover" 2014-10-24 11:07:09 -07:00
Peter Johnson
c58fde19f9 Increase the number of joystick ports to 6.
Change-Id: I18a29a3a8c8f38b3b21c3e76eead3526b9d02875
2014-10-24 13:59:59 -04:00
Kevin O'Connor
003dc0dc2b Pass errors to DS in C++ and Java
Squashed commit of the following:

commit f317b3522e312cf7e7bb9eb0494f2f96a7f6363c
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Mon Oct 20 17:15:46 2014 -0400

    Send unhandled exceptions back to the DS.

    Change-Id: I0e658fdb6d43593ee20457f20f71f4f4cd2d21c3

commit f834ef8c791945697ad483c27b4167eb917ac242
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Mon Oct 20 16:05:24 2014 -0400

    Add StackTrace to Java errors

    Change-Id: I83b162afcc5f294703705770fbcd8623b0895539

commit 02e040b0c79067ce046ada29e26004e0460fceb0
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Mon Oct 20 15:07:44 2014 -0400

    HAL Errors to DS in Java

    Change-Id: I5fb51e4066bbc26ea59ca513c03c5ec5ace98831

commit 03775ddc42b129c27fdf403f17f0796009311c3c
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Mon Oct 20 13:38:18 2014 -0400

    Update AnalogInput to report errors for getting and setting sample rate

    Change-Id: I00eb78f52fc5b17a60bc84456f0ec9842cc40ef7

commit 4c10cb79612ae81e3cbb6bd4d6da8cf3b8955821
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Mon Oct 20 11:46:03 2014 -0400

    Define errors in HAL

    Change-Id: I96595472e42ba61f0f3d0da17caf01a748d0422a

commit 56cb5dcd93e5e849a016f63ac9d0dc245a23eb2b
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Fri Oct 17 10:59:29 2014 -0400

    Throttle errors (1 report per second per error code) and fix issue with GetTime conflicting with GetTime from Timer.h/Timer.cpp

    Change-Id: Ibe4dc2e400fc4671b240b876a46959256ea65ad7

commit 71c78826e548682ecd0c1548255f8a6552cece32
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Thu Oct 16 16:41:04 2014 -0400

    Feed errors to DS from C++

    Change-Id: I009a7798499fd93e9fdd976ff00aa74c0bd094ae

commit 81030c6cee7f18a5ddf0e95c4e402a6cf7b5de6c
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Thu Oct 16 16:40:50 2014 -0400

    Don't try to de-mangle lines without any symbols in them

    Change-Id: Icea02494b68f2ec9116d6cbf20a35a3a132234f8

Change-Id: If7717025b03914183736ccd95da5c9d49819a6f3
2014-10-24 13:23:17 -04:00
Peter Johnson
26419ec209 Don't use "final" in command-based template RobotMap.
While final would seem to make sense for RobotMap values (as these values
should be constant at runtime), RobotMap values are often not truly final
in the Java sense of the word, as on real robots they often change between
project builds (e.g. they often can and will be changed by teams as wiring
changes on the physical robot).

Unfortunately, incremental compilation in Eclipse follows Java rules, and
doesn't track cross-module dependencies on final variable values, resulting
in very non-intuitive behavior when a final variable's value is changed:
other (unchanged) Java modules using the final variable are NOT recompiled
(as is necessary to pick up the new value), and there is no easy way to
force recompilation of every Java file in the project.

Change-Id: I75b13aaf4f4a687698f853d5e11eef5f904716ea
2014-10-24 00:07:30 -07:00
Brad Miller (WPI)
3834393698 Merge "Improves the general stability of the CANJaguarDefault tests" 2014-10-23 13:27:16 -07:00
Alex Henning
97be9765cd Changed the version to include time to fix issue with replacing.
Change-Id: I80654640207a8200354f4961c476a4f4fcf5c5a6
2014-10-23 13:55:45 -04:00
Alex Henning
0881ac0b24 Fixed issue where plugins don't show up on some installs.
Change-Id: I848930dc5516a36771e46c8d0e550763821bc057
2014-10-23 13:55:44 -04:00
Brad Miller (WPI)
1b7e5970f9 Merge "Added C++ sample for CAN monitoring of PDP." 2014-10-23 10:46:45 -07:00
Jonathan Leitschuh
bc84c7ac7c Improves the general stability of the CANJaguarDefault tests
Adds a poling wait to all of the tests to accommodate the CANJaguar

Change-Id: I15a64a5fe901cb775bf03ef0b08c2f83429ef9b5
2014-10-23 13:03:49 -04:00
Brad Miller (WPI)
fc34b9b803 Merge "Aggregate javadocs and use JavaFinal docs when building plugins (fixes artf3533)" 2014-10-23 09:06:29 -07:00
James Kuszmaul
9af070a4af Added C++ sample for CAN monitoring of PDP.
Uses CAN to monitor PDP and displays values on the SmartDashboard.

Change-Id: Icb06fec0b65ce02b7c396e7d4e379cee0d959095
2014-10-23 10:07:53 -04:00
Jonathan Leitschuh
93925bc025 Fixes the GyroTest
Change-Id: Ia72fcb0533ea4e91b5f7e469e1a0b367eebda3b7
2014-10-22 18:39:27 -04:00
Jonathan Leitschuh
132804a4ce Updates the test scripts to prevent a race time condition
The two run scripts now take an extra optional parameter [-m] that overrides the giving and taking of the mutex and lets the user handle it. This is used by the jenkins script to prevent other users from jumping in at any time while the script is running.

Change-Id: Iffcbeb7ce677b173b1e9b7d9953d5a35b2643436
2014-10-22 16:23:26 -04:00
Brad Miller (WPI)
9e6d683671 Merge "Increases tolerances for the PID tests" 2014-10-22 11:36:36 -07:00
Jonathan Leitschuh
f7e8b95a24 Increases tolerances for the PID tests
The tolerance is now a little bit more loose but still demonstrates that the PID works correctly.

Change-Id: I9ca74e66fd096c49be7de61f218d5651b0ca0586
2014-10-22 14:04:41 -04:00
Brad Miller (WPI)
213e73c43e Merge "v16 Image" 2014-10-22 10:46:43 -07:00
Brad Miller (WPI)
455654a95b Merge "Fix joystick issues [artf3707]" 2014-10-22 10:44:55 -07:00
Joe Ross
261b1857cd make getControlMode public. Was public in 2014.
Change-Id: I158f41e66407d47c50e3d632661a040c8cd68d14
2014-10-22 13:36:38 -04:00
Kevin O'Connor
f3fe64a60e Keep Notifier firing after FPGA rollover (fixes artf3582), simulation may still have an issue with counter rollover
Change-Id: I11d86bd65c1e0db123d93aa143b8c8c3b823737a
2014-10-22 13:36:17 -04:00
Brad Miller (WPI)
f108853e1b Merge "Added sample programs for Solenoids and Relays." 2014-10-22 09:00:59 -07:00
Thomas Clark
a56c0eb4af Fix joystick issues [artf3707]
Make axes and POVs 0-based like they are on the DS

Correct default joystick axis numbers to be 0-based

Fix array dimensions for joystick axis values

Increase the number of joystick ports to the maximum 6 that the DS supports

Change-Id: I16d0e6e636188cbdd9cd7bfa0453a62466a55093
2014-10-22 11:49:55 -04:00
Jonathan Leitschuh
8c01e9065a Fixes a bug with the test stand launch script
The Test Stand Serve launch script now runs the correct command.

Change-Id: I790b55fc24284665ec5f32effdd6fbc66c2d334a
2014-10-22 11:23:49 -04:00
Thomas Clark
be30d3ab1d Fix CANJaguar brownout recovery in Java
In Java, CANJaguar didn't set up periodic status messages again after
a brownout

Change-Id: Iaedd844a7627dd44eb5d769a106b220648f35023
2014-10-22 10:56:25 -04:00
Brad Miller (WPI)
53255a764f Merge "Relay: Allow "On" state to be set via SmartDashboard." 2014-10-22 07:30:29 -07:00
James Kuszmaul
3abd352be9 Added sample programs for Solenoids and Relays.
Added a sample program to the eclipse plugin which uses joystick buttons
in Operator Control mode in order to control the output of a single and
a double solenoid.
Also added a sample program which uses joystick buttons to control a
spike/Relay.

Bonus: The title on the window that you get when you are opening a sample in
C++ said "Java" instead of "C++". Fixed now.

Change-Id: I0d01c23003d1fba2dbb08cbe6977ec886d97a22f
2014-10-22 09:34:52 -04:00
Thomas Clark
70be534fe0 v16 Image
Change-Id: I054ce8fdeb904ef00e88ce9e3133a381da396b42
2014-10-21 16:41:24 -04:00
Jonathan Leitschuh
e677d52a21 Increases the allowed runtime for two network tables tests
This test has been causing the build system to fail to build occasionally
Tested 15 times with 0% failure rate

Change-Id: I8d335b368d95060630b1cd47926e5ba0898e78b7
2014-10-21 15:48:56 -04:00
Kevin O'Connor
62790c0f47 Use either DO PWM A or B not A and B and update javadoc to reflect 6 generators (artf3698)
Change-Id: Id8d29831c97accd54dd359c6f20a447d8eed59db
2014-10-21 14:33:02 -04:00
Brad Miller (WPI)
cd75dc71e8 Merge "Recover from signals in Wait() [artf3495]" 2014-10-21 08:46:54 -07:00
Brad Miller (WPI)
a381b60e32 Merge "Added sample program for Motor Controller." 2014-10-21 07:12:11 -07:00
James Kuszmaul
311a690262 Added sample program for Motor Controller.
Sample uses joystick output to directly control a motor controller.
Added to C++ eclipse plugin with in same way as Java MotorControl
sample.

Change-Id: I7ce36b8000fbeb94e637a820f82399462b1416e5
2014-10-21 10:03:02 -04:00
Brad Miller (WPI)
a2f015c25b Merge "Dynamically generates tools zip file." 2014-10-20 15:20:46 -07:00
Alex Henning
5c26b37d3b Dynamically generates tools zip file.
Currently the file only includes RobotBuilder and
SmartDashboard. Additionally, testing is necessary too make sure that
the unzipping is working properly.

Change-Id: I21c0ebef592891c7d27016db401ec69c35a62acd
2014-10-20 15:47:30 -04:00
Thomas Clark
8dba364bef Recover from signals in Wait() [artf3495]
Change-Id: I6e7e404b916d9fc35524998369272bc30131bb7b
2014-10-20 15:01:35 -04:00
Brad Miller (WPI)
76f9b3bbc2 Merge "Adding stdint.h to the Joystick.h makes the indexer work (fixes artf3505)" 2014-10-20 07:47:31 -07:00
Brad Miller (WPI)
bbeb0084a2 Merge "Set RobotBase instance in constructor [artf3652]" 2014-10-20 07:46:48 -07:00
Thomas Clark
e51c3daf00 Set RobotBase instance in constructor [artf3652]
Also, remove the dead code that appeared to set the singleton instance,
but isn't actually run.

Change-Id: I1967026295b97f0c5e64256f2c701569da2a2091
2014-10-20 10:41:01 -04:00
Brad Miller
dc89ec673a Adding stdint.h to the Joystick.h makes the indexer work (fixes artf3505)
Change-Id: I6fee6d8ae0089fd4ffc2f043270bc719058f4b2d
2014-10-19 20:16:51 -04:00
Joe Ross
fc7c015823 Fix warnings for javadocs
Change-Id: I818c2086d69eff098543b4d5a554ba9d703e01e8
2014-10-19 16:48:16 -07:00
Thomas Clark (WPI)
c52e29432c Merge "make preferences check for [ and ] in key" 2014-10-19 14:57:42 -07:00
Brad Miller (WPI)
53d50f470a Merge "updted licesne strings in eclipse plugins" 2014-10-19 14:53:59 -07:00
Brad Miller (WPI)
ca303e0169 Merge "fixed template on checkedin java examples" 2014-10-19 14:52:31 -07:00
Joe Ross
042a1dbc82 make preferences check for [ and ] in key
Change-Id: If60e87f1f141678ba261c7bf77aa26a12aa97a8b
2014-10-19 17:52:15 -04:00
Brad Miller (WPI)
3c91de56d3 Merge "Fix segfault in DIO PWM generators [artf3653]" 2014-10-19 14:49:10 -07:00
Thomas Clark (WPI)
0c2f3c19cc Merge "Fix Java Joystick.getPOV()." 2014-10-19 14:41:50 -07:00
Thomas Clark
023d20abc1 Fix segfault in DIO PWM generators [artf3653]
The HAL PWM generator functions tried to interpret ID numbers as int pointers
instead of ints, leading to segfaults whenever PWM generators were used.

Change-Id: I51d50162a8fc04a04795e7ca20a23de26b9e848d
2014-10-19 16:27:47 -04:00
Alex Henning
5c702edd8f Support for pushing NetworkTables (java) to the maven repository.
Change-Id: I1b5af460aa9aff078328506351f7434227ec43ad
2014-10-18 20:53:50 -04:00
Brad Miller (WPI)
d90bbc195c Merge "Removed vestigial POM file from NetworkTables" 2014-10-18 15:38:00 -07:00
Peter Johnson
3365d0dc18 Fix Java Joystick.getPOV().
It subtracts 1 from pov; this should not be done here as it is done in the
DriverStation class.

Change-Id: I7fba2c87fc4dcb2f693201346b0d935662a49678
2014-10-18 09:22:58 -07:00
Peter Johnson
615d62a219 Relay: Allow "On" state to be set via SmartDashboard.
Change-Id: I350be338045e6d27aaaea2740695930dcdd202fa
2014-10-18 08:24:11 -07:00
Alex Henning
78988584e3 Removed vestigial POM file from NetworkTables
Flattened networktables/java/Athena into networktables/java since Athena
+ Desktop builds are identical and we dropped Azalea support.

Change-Id: If965891c163394fed3bd1a3570b1f923cdd6fd56
2014-10-17 21:38:40 -04:00
Brad Miller (WPI)
294e224fcd Merge "allow installation on eclipse 3.8 (ubuntu 14.04)" 2014-10-17 14:12:55 -07:00
Brad Miller (WPI)
436c92961b Merge "Add new joystick features" 2014-10-17 14:08:49 -07:00
Brad Miller (WPI)
341abbfaaf Merge "Run the scheduler in disabled (fixes artf3631)" 2014-10-17 13:50:35 -07:00
Brad Miller (WPI)
eab34bbb88 Merge "Add SD methods with default values to match Java (fixes artf3648)" 2014-10-17 13:47:47 -07:00
Brad Miller (WPI)
5db5320793 Merge "Add method to get Device ID to Can Jaguar (fixes artf3613)" 2014-10-17 13:46:07 -07:00
Brad Miller (WPI)
54eaa913f6 Merge "Make Java ignore section headers in Preferences file and start file with [Preferences] to match C++ (fixes artf3629)" 2014-10-17 13:45:34 -07:00
Thomas Clark
8a541a67ca Add new joystick features
Axis counts other than six and POVs are both present in C++ and Java now

Add dynamic joystick axis counts, up to 12

Change-Id: Ieade5e61a89df822df8702cb32326e4635558778

Add support for POVs in C++

Change-Id: I12dc0fcaca605a256ddcf990eebde45767229171

Make POVs work in Java

Change-Id: Ie2d98adb416c1930f058bdd21c3e7d26289df503
2014-10-17 16:39:10 -04:00
Brad Miller (WPI)
7fa0eea492 Merge "ADXL345_SPI: Report usage." 2014-10-17 12:19:47 -07:00
Brad Miller (WPI)
cc431354b7 Merge "Counter::setUpSource(AnalogTrigger): actually set the source." 2014-10-17 11:40:35 -07:00
Kevin O'Connor
65c10cd469 Aggregate javadocs and use JavaFinal docs when building plugins (fixes artf3533)
Change-Id: I4c8ae68daa470bea52b4f9f3fb129f50d5f238e3
2014-10-16 14:57:50 -04:00
Kevin O'Connor
fea52a77a3 Add SD methods with default values to match Java (fixes artf3648)
Change-Id: Iee955f987ac1214d773cfd733ed99e3cbd1ac3d0
2014-10-15 17:03:04 -04:00
Kevin O'Connor
4e31b68008 Add method to get Device ID to Can Jaguar (fixes artf3613)
Change-Id: I7b0cb555a56ee97cf90ea32a3080b7c14bb5ca56
2014-10-15 16:11:29 -04:00
Kevin O'Connor
f99b57b1fe Run the scheduler in disabled (fixes artf3631)
Change-Id: Ib1614e2c96b4cda580110ea427398bcfe2ff6fbe
2014-10-15 15:32:38 -04:00
Kevin O'Connor
dad3b68f36 Make Java ignore section headers in Preferences file and start file with [Preferences] to match C++ (fixes artf3629)
Change-Id: Ia56cca061851727eee25d3996314a01022378a07
2014-10-15 14:37:25 -04:00
Kevin O'Connor
08c8723174 Merge "Add error message to new project wizard if project already exists" 2014-10-13 07:45:25 -07:00
Peter Johnson
ce768ae341 ADXL345_SPI: Report usage.
Change-Id: I369a3aecf36fc9071b10cbacc1ebac5f98c1dd39
2014-10-12 14:38:02 -07:00
Joe Ross
217c50c28f allow installation on eclipse 3.8 (ubuntu 14.04)
Change-Id: I5d0f6a05724debefecb562f8f0fb0c8acea8e2c2
2014-10-11 18:24:51 -07:00
Peter Johnson
fcc8230dbf Counter::setUpSource(AnalogTrigger): actually set the source.
Previously this created the output but didn't set up the source.

Change-Id: Ifac7ed589358e15bc70ba46ae4a756ce56683a8a
2014-10-10 09:15:42 -07:00
Evin Ugur
d2c1bc174f updted licesne strings in eclipse plugins
Change-Id: I9593e4dda3e8db8f1fd3d847285932affffcfd51
2014-10-09 19:33:10 -04:00
Evin Ugur
6fe638e977 Fixed New Project Wizard to have a radio option always selected 2014-10-09 19:21:36 -04:00
Evin Ugur
07837c4ab4 fixed template on checkedin java examples
Change-Id: I0a99aefc21e3cc2471f0ad75192c51def8bd5ba8
2014-10-09 14:15:58 -04:00
Brad Miller
daee45780d Added additional NI libraries to make C++ builds work
Change-Id: Id550b698451999a6c3d52313211798be5eddd47c
2014-10-09 09:43:12 -04:00
Patrick Plenefisch
8079482820 Create HOME on windows
Change-Id: Id16278b5280e25e383e474faf4b511c47e5d0751
2014-10-08 17:15:51 -04:00
Brad Miller (WPI)
0b828eec62 Merge "Disable CANJaguar current PID test" 2014-10-08 12:51:58 -07:00
Brad Miller (WPI)
49e06bd13b Merge "Move interrupt methods to InterruptableSensorBase" 2014-10-08 12:51:28 -07:00
Thomas Clark
eca4d36a4b Disable CANJaguar current PID test
The hardware setup makes this test basically useless

Change-Id: I40287313a1928dda897c8e35922216d44ab089d2
2014-10-08 15:02:01 -04:00
Thomas Clark
4d2a720f47 Move interrupt methods to InterruptableSensorBase
Analog interrupts work again now, and RequestInterrupts is no longer
duplicated three times.

Change-Id: I5244b76262d7620852141cd21b2429d627636793
2014-10-08 14:52:24 -04:00
Patrick Plenefisch
591e1de721 use WPILIB eclipse var & use luna to build
Change-Id: I5e8560329226fca3c60f337b6b4744c50a09cdc9
2014-10-08 10:39:06 -04:00
Brad Miller (WPI)
dc09233fca Merge "void* -> void by creating proxy fuction" 2014-10-07 14:21:45 -07:00
Patrick Plenefisch
037d3b2fb5 void* -> void by creating proxy fuction
Change-Id: I903c3d98f3210d1969b9aed6c84f5ccaa803a9ed
2014-10-07 17:19:32 -04:00
Kevin O'Connor
a3995a202d Fix bitfield indexing on PWM Latch
Change-Id: I63b423dbcab9f0f8b5b384654824f1c69b0fa052
2014-10-07 16:52:21 -04:00
Thomas Clark (WPI)
a71f07ed67 Merge "HAL: build shared library as well as static library." 2014-10-07 08:24:27 -07:00
Brad Miller (WPI)
cb81aa6fe9 Merge "Update headers and .sos to v15 image + most API changes" 2014-10-07 07:22:14 -07:00
Thomas Clark (WPI)
ace43a6a12 Merge "DigitalOutput: Fix enablePWM()." 2014-10-07 07:18:19 -07:00
Thomas Clark (WPI)
a4e8d65b71 Merge "Relay: In free(), set both forward and reverse to 0." 2014-10-07 07:17:10 -07:00
Brad Miller
bfd88f1dab Reserve network communications
Change-Id: Ie98e31baf9d5ce01056a89e009ec62c8bbb62f2e
2014-10-06 10:21:55 -04:00
Peter Johnson
a65cb500fb Relay: In free(), set both forward and reverse to 0.
Also, check status in between the two calls.

Change-Id: I5a6c24aefde3707a953a41cb7c56e8fb372e1ea0
2014-10-06 00:31:46 -07:00
Peter Johnson
f27df43b5b DigitalOutput: Fix enablePWM().
Previously enablePWM() wanted m_pwmGenerator to already be non-null on entry.
This is impossible as the only place m_pwmGenerator is set is later in this
function.

Also add correct m_pwmGenerator null checks to disablePWM() and
updateDutyCycle().

Change-Id: Ia5bbfdc62824e1cf4c2f503308313b7ef39ae2fe
2014-10-05 20:51:57 -07:00
Thomas Clark
7e9f183cf9 Update headers and .sos to v15 image + most API changes
Java still does not work

Change-Id: I172ac401a07b6703909068f82b7b6cc67e6075c0
2014-10-05 17:17:59 -04:00
Brad Miller
2f26361398 Added Mecanum drive sample program
Change-Id: I0538c21116cd6c8836f76b6d4446b83d8723a20f
2014-10-05 16:03:36 -04:00
Peter Johnson
52ecbd38ac HAL: build shared library as well as static library.
Change-Id: I02143d601dc1dc0a6f35d61b6d008340333ee98a
2014-10-03 19:13:34 -07:00
Brad Miller (WPI)
6089722c4f Merge "Too many bugs with LTO in GCC 4.9 & Binutils 2.24. Disabling. Maybe later." 2014-10-03 09:58:29 -07:00
Patrick Plenefisch
244ecd23ee Too many bugs with LTO in GCC 4.9 & Binutils 2.24. Disabling. Maybe later.
Change-Id: Id10ebb9768743e5f852275ae1f1d7a80094c99ed
2014-10-02 23:15:50 -04:00
Kevin O'Connor
8aeacac302 Set Start Mode to remote to allow Debug As->WPILib Deploy to launch without error on Windows
Change-Id: Ida1e12692f829f02eef5284b3cfbcbb7d63c88c3
2014-10-02 18:20:24 -04:00
Brad Miller (WPI)
45021c7f3d Merge "Figured out the madness: not launching properly (no copy)" 2014-10-02 15:07:07 -07:00
Brad Miller (WPI)
857a1abb01 Merge "Prevent leading zeroes in team number and warn user about them (fixes artf3429)" 2014-10-02 11:49:44 -07:00
Brad Miller (WPI)
c11f194cbf Merge "Allow dataRecieved to be null in I2C transaction (fixes artf3603)" 2014-10-02 11:48:22 -07:00
Brad Miller
8b806e11e2 Added Arcade C++ example and a hierarchy for C++ examples.
Change-Id: I31094dd4f158345103628aacd7de3cb86f27c483
2014-10-02 14:42:24 -04:00
Brad Miller
ba5111b994 Add a Motor Controller example java program
Change-Id: I7b0a7622fbf4cbe2ef541088bbe521d4cac9aa22
2014-10-02 14:12:16 -04:00
Brad Miller (WPI)
88bf4ee567 Merge "Added a hierarchy of example categories that looks very much like what's in LabVIEW and placed the one project in a bunch of categories as a proof of concept." 2014-10-02 10:46:24 -07:00
Brad Miller
76295a5746 Fix eclipse launching of tools (SmartDashboard, sfx, OutlineViewer, and RobotBuilder)
Change-Id: I8d0fbf2b25d29cd9645ee9e92c67316802a46490
2014-10-02 10:38:30 -04:00
Brad Miller
90a106ccfb Added a hierarchy of example categories that looks very much like what's in LabVIEW and placed the one project in a bunch of categories as a proof of concept.
Change-Id: If6e1f916ffbe7c0a36a8cccf5be46c36a1e6d6a6
2014-10-01 19:58:46 -04:00
Brad Miller
0fcef94904 Whoops, need to change the joystick port assignments to be zero based on the sample program.
Change-Id: I359e793ae13a1f3030a79f7cc19ffe10d93bbdfd
2014-10-01 19:23:22 -04:00
Brad Miller
3f38f3e84f Added a tank drive example for java
Change-Id: Id1a2a57d768251ace45a30977d335f8b6ce2ba8f
2014-10-01 19:04:03 -04:00
Kevin O'Connor
64abdb8223 Allow dataRecieved to be null in I2C transaction (fixes artf3603)
Change-Id: I02fb5ba8c5e0677b710a8bd63e98a4851c52883e
2014-10-01 14:47:16 -04:00
Kevin O'Connor
aaa7eabd03 Prevent leading zeroes in team number and warn user about them (fixes artf3429)
Change-Id: I722351d78dc53a4919bcda0ba31b188caa2d38d8
2014-10-01 14:20:03 -04:00
Brad Miller
1cef27134e Changed joystick port numbers to be zero-based for C++ and Java.
Change-Id: Ifd55e8654be3b15abbe7460d2e9e6fff8acd9977
2014-10-01 11:25:51 -04:00
Patrick Plenefisch
aaab77cdbc Figured out the madness: not launching properly (no copy)
Change-Id: I8127a9ae4cce5109d2373edfdb60ba212dfb70cb
2014-09-30 18:56:57 -04:00
Kevin O'Connor
7e2c68214d Set debug flag user to lvuser to allow it to be deleted (fixes artf3415)
Change-Id: I8931427f447e2e0b443e4b6c82dddfe9d50ef553
2014-09-29 16:05:48 -04:00
Brad Miller (WPI)
ad906da673 Merge "Squashed commit of the following:" 2014-09-27 12:24:03 -07:00
Patrick Plenefisch
a6ea51ad02 Fix simulator builds (and don't clean, dh does that also)
Change-Id: I921c7d6d56e439592b0d94e85f16cb090095caca
2014-09-26 17:58:26 -04:00
Kevin O'Connor
d72ee199fe Squashed commit of the following:
commit a3ccfab0a42414aa169792356bfc47ee8d0d2d7b
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Tue Sep 23 13:56:59 2014 -0400

    Implement zero latch (used to reduce brownout latency) in Java

    Change-Id: I3bf4ffbf20cf3d8a42da4fa1755b4306c49ede34

commit 0af37dfcc0d1172974519c44126973c302385d55
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Tue Sep 23 13:03:07 2014 -0400

    Implement zero latch (used to improve brownout latency) in C++

    Change-Id: I62bedd1af65d367c32e2ab0b5a4fc679776eecb5

Change-Id: Ic27f37a9ab45aad82c1f7154d4edfbccfaa19229
2014-09-26 17:20:57 -04:00
Patrick Plenefisch
19b2d05236 Fix simulator builds (dh knows how to CMake)
Change-Id: Id78d1d58d160a5f54d63aa91627cd406621d467b
2014-09-26 16:37:11 -04:00
Patrick Plenefisch
26d789b89f Copy to the correct folder name
Change-Id: Id78d1d58d160a5f54d63aa91627cd406621d467b
2014-09-26 14:11:51 -04:00
Brad Miller (WPI)
f50b058457 Merge changes I6b5d2767,I6f4b94d1,Iada981fc
* changes:
  JNI should ignore -lfrc and installing the new ld scripts
  Renaming and merging WPILibC++ into Devices and simulator files
  Initial linker script to abstract away the massive library list
2014-09-26 09:35:57 -07:00
Patrick Plenefisch
39da9d67ba JNI should ignore -lfrc and installing the new ld scripts
Change-Id: I6b5d2767a0148bd01246c6a205ba32d30440b3d5
2014-09-26 12:13:28 -04:00
Patrick Plenefisch
b6475d0503 Renaming and merging WPILibC++ into Devices and simulator files
Change-Id: I6f4b94d1f2cbf4196ebcef8bc45799a97bcde1d8
2014-09-25 20:36:59 -04:00
Brad Miller
295f212c8e Change digital input to return boolean values to match Java
Change-Id: I5cfa1d300b8185ef7a32413b7f9626229d309cac
2014-09-25 18:35:25 -04:00
Patrick Plenefisch
fa4a39dcc6 Initial linker script to abstract away the massive library list
Change-Id: Iada981fc9d50c640d4c519f5024f48f6b3df7433
2014-09-25 17:13:37 -04:00
Brad Miller
66c653a21f Get the simulator build to accept c++11 languge
Change-Id: I7406cc3815f0086e66c8a8973062d8fb7b2030f2
2014-09-25 15:31:41 -04:00
Patrick Plenefisch
340a3d492c Fixing pedantics and using RTTI for command name
Change-Id: I16dc33faa229bc83af21ecf55011108245f67141
2014-09-25 14:43:40 -04:00
Patrick Plenefisch
6710ac3a2f fixing all warnings and making sure they will stay fixed
Change-Id: Iff55ea18976562f37d6cc2848abff20c2c59ad96
2014-09-25 14:43:27 -04:00
Brad Miller (WPI)
9e62e60e6f Merge "Remove CPP Preferences page from WPILib preferences (code has already been deleted)" 2014-09-25 10:14:24 -07:00
Alex Henning
e6c56e4446 Modified simulation debs to exclude building the toolchain.
Note: it currently doesn't seem to build due to a previous change that
needs further investigation.

Change-Id: I1a7f90a66d972b85541939f42e1afcb76f2fb9f4
2014-09-24 22:38:04 -04:00
Brad Miller (WPI)
35f1aded63 Merge "Change RobotState functions to return actual values (this time with nullptrs) [artf3611]" 2014-09-24 13:22:10 -07:00
Brad Miller
4904e1dc2c Change RobotState functions to return actual values (this time with nullptrs) [artf3611]
Change-Id: Icbe8fbf3d936ab696fed7f264bdf49b95d35c0de
2014-09-24 16:21:14 -04:00
Brad Miller (WPI)
28b9c18e22 Merge "Add a getDeviceNumber method to CANJaguar" 2014-09-24 12:43:06 -07:00
Thomas Clark
a548b14b7e Add a getDeviceNumber method to CANJaguar
[artf3613]

Change-Id: Idc01c0d27740bbb575f00de6065a7ced52f787e1
2014-09-24 14:37:07 -04:00
Thomas Clark
323022acfd Remove "using namespace std;" from headers
[artf3605]

Change-Id: I0dc6172114608eb5e52d341be8064758faa1c781
2014-09-24 14:13:29 -04:00
Brad Miller (WPI)
1bcdd301eb Merge "Fix changes where the default value was always being returned for many of the robot state status functions." 2014-09-24 08:03:42 -07:00
Patrick Plenefisch
21f728c802 Moving to arm-frc-linux-gnueabi in cproject and attempting to use gdb (overwritten)
Change-Id: I7dd5017f461bbff82c5ed6f64842880e4f0a44c9
2014-09-23 22:19:43 -04:00
Brad Miller (WPI)
49d440eccc Merge changes I4f5a36e6,I248d27cc,I55769599,I7688b8cd
* changes:
  Removing Toolchains!
  Enabling C++14 and removing path for new toolchains
  Remove unnecessary config for cproject/Simulate target
  Updating template .cproject to avoid specifiyng commands and defaults Fixes unknown GCC errors (supposedly)
2014-09-23 19:06:53 -07:00
Brad Miller
00486e2ec2 Fix changes where the default value was always being returned for many of the robot state status functions.
Change-Id: I50f11ce6d8ba4cbaa9ab7f44cd2f353e8bba72dd
2014-09-23 17:36:37 -04:00
Patrick Plenefisch
a3115dac19 Removing Toolchains!
Change-Id: I4f5a36e62a42c82cd2c23244bf3cdc62b2ed45d5
2014-09-23 15:26:08 -04:00
Patrick Plenefisch
1f35670a18 Enabling C++14 and removing path for new toolchains
Change-Id: I248d27cceeb16fd2b5690a9637245c7451f2c527
2014-09-23 15:23:48 -04:00
Patrick Plenefisch
d1d81e5e19 Remove unnecessary config for cproject/Simulate target
Change-Id: I5576959974bede623fb0fe267f0d8b163124c2c9
2014-09-23 15:20:45 -04:00
Kevin O'Connor
a7b166e3fd Remove CPP Preferences page from WPILib preferences (code has already been deleted)
Change-Id: I58a4df41fdd846187ecfc6e57f0c4239bd435d42
2014-09-23 13:04:09 -04:00
Brad Miller
6c28e09662 Updated bootstrap file to install the new toolchains
Change-Id: Ia9e254ed577517b191fee49bc55778636479be9c
2014-09-21 18:47:59 -04:00
Patrick Plenefisch
8199fb28d8 Updating template .cproject to avoid specifiyng commands and defaults
Fixes unknown GCC errors (supposedly)

Change-Id: I7688b8cd66f8ea70195a7e60500e212766415eb2
2014-09-21 16:38:42 -04:00
Patrick Plenefisch
f2920fd77f Enable C++14 and Wextra
Change-Id: I7548ffe02def72d1204f533fc118523f7dbff5e0
2014-09-20 23:09:20 -04:00
Patrick Plenefisch
ebd9667ba6 Expose and fix error where old subsystems were being referended after use in tests
Change-Id: I50e66b3d61f5c70dee653ab3e9899f2286f3741c
2014-09-20 23:08:44 -04:00
Patrick Plenefisch
3f0f7931b8 Changing cmake to test the tests (Jenkins)
Change-Id: I4f499c6325cdab399a51385c5acb73a665d9a9ae
2014-09-20 15:41:38 -04:00
Brad Miller
cad83ed3ca Bump the version number for the windows toolchains to force them to reload.
Change-Id: Ib095d5c1caf51739cc1b5bee1680592e0cfc34de
2014-09-18 17:18:03 -04:00
Kevin O'Connor
62d6579428 Add missing semi-colon to cproject file
Change-Id: I540730c3a4be32c6a636296ce36aab5b230afc8a
2014-09-16 00:50:43 -04:00
Brad Miller (WPI)
1d7b17a2ba Merge "Add quotes around linker flag path to libs (fixes artf2390 / artf3453)" 2014-09-15 09:17:01 -07:00
Brad Miller
738859c4ea Fixed bug where mac toolchains always reinstall on Eclipse start
Change-Id: Id94631162efe5766feedac2979264fe17e09b5eb
2014-09-14 15:31:56 -04:00
Patrick Plenefisch
127ff0ac0a Fixing extraction recursion: use provided version
Change-Id: I0aa0a66eae85a43df308b4c0dafbe6b953ffad5c
2014-09-14 15:31:50 -04:00
Patrick Plenefisch
472f51fc73 Add version=current to global wpilib.properties file on any property save
Change-Id: I6dc6eeac27ab97be567450c90f50ace7da6679b7
2014-09-13 18:36:02 -04:00
Kevin O'Connor
887a4e94f3 Add error message to new project wizard if project already exists
Change-Id: Ifeeaf25954261ff2ba1287103f6ca2f8186aeee8
2014-09-11 15:22:12 -04:00
Brad Miller (WPI)
0f0850ca95 Merge "Update to v14 headers and libraries" 2014-09-11 08:12:45 -07:00
Thomas Clark
ab27f795b7 Update to v14 headers and libraries
Change-Id: Ibc28fc73c36acf6d9d15b3f255cbf93ad6ad70a8
2014-09-10 14:43:53 -04:00
Thomas Clark
b16a037759 Store preferences in a directory writable by lvuser
Change-Id: I1ed43968c2be76bfcb050a115f59517c398efff3
2014-09-10 14:05:51 -04:00
Brad Miller
1e812ac4d9 Added comments to the compressor class per artf3527.
Change-Id: I48d0d16242da064e8502e6fbddccca82dc680044

Updated comments with a few more details

Change-Id: Icab1698f2ea4e2032e50cbf5ac63341ba5ee1dcf
2014-09-10 12:02:13 -04:00
Brad Miller (WPI)
ecc6815f68 Merge "Fix status buffer allocation in SolenoidBase" 2014-09-10 08:57:53 -07:00
Brad Miller (WPI)
ca9f5a676d Merge "Make all channel errors throw IndexOutOfBounds" 2014-09-10 08:57:35 -07:00
Thomas Clark
debf9e0ee9 Make all channel errors throw IndexOutOfBounds
Only relay and PWM channels out of range used to throw
IndexOutOfBoundsExceptions, but Resource would catch the error
first in most cases.

Change-Id: I8feb0daf378e181f982203d46bf5a10dbde4a02e
2014-09-10 11:54:57 -04:00
Thomas Clark
15abbb36c2 Fix status buffer allocation in SolenoidBase
This fixes [artf3488] and [artf3506]

Change-Id: I6e89fc7bfc8d6c38a4bbf364a0fad412ab54e225
2014-09-10 11:36:50 -04:00
Kevin O'Connor
d9b974300f Add quotes around linker flag path to libs (fixes artf2390 / artf3453)
Change-Id: I0d4aac49edb0e93f0bfd2cc8937eca476deafc4c
2014-09-08 14:45:08 -04:00
Brad Miller
e60baf41a9 Added the "version=current" property to allow projects to correctly reference the updated installation
Change-Id: Ia6f45fab6b1d279e89129d9a0350b8aa7cf8c98a
2014-09-06 23:50:06 +00:00
Brad Miller (WPI)
09cb3a22cd Merge "Change the tail command for capturing the logs on deployment to check the file every second instead of continuously to avoid the 100% CPU time problem from artf3524" 2014-09-06 15:47:07 -07:00
Brad Miller
27ecd35834 Change the tail command for capturing the logs on deployment to check the file every second instead of continuously to avoid the 100% CPU time problem from artf3524 2014-09-06 18:41:05 -04:00
Patrick Plenefisch
ff6d180305 Revert "Fixing java version number to be current"
This reverts commit 410b739c23.
2014-09-06 18:19:25 -04:00
Patrick Plenefisch
410b739c23 Fixing java version number to be current
Change-Id: I4d124921f5735cc2a7ff24eba10246eb9e57a67b
2014-09-06 17:23:06 -04:00
Thomas Clark
2144b853d1 Set the cpp-version variable per-project
Set cpp-version in the build.properties of each C++ project, instead of
globally in wpilib.properties.  It's 'current' by default.

Change-Id: I4618131be14390f51763b39aa751aa110f7af56f
2014-09-03 16:37:33 -04:00
Thomas Clark (WPI)
f87c517e6d Merge "Remove Version number from zips" 2014-08-31 14:56:00 -07:00
Patrick Plenefisch
77dac9bd77 Remove Version number from zips
Change-Id: Ifc9ba2e47a61f2d545b7c4b40c327b661b4f48ba
2014-08-31 17:55:19 -04:00
Thomas Clark (WPI)
56cf287b39 Merge "require pthread and rt lib for Itests" 2014-08-31 13:29:36 -07:00
Patrick Plenefisch
dc970d9a6b require pthread and rt lib for Itests
Fixing simulation flags

Change-Id: I33dcd07096bf7a4813248bb9dd809144661a78fd
2014-08-31 15:42:57 -04:00
Joe Ross
da2ea9ea87 remove/fix references to cRIO documentation.
Edited comments related to sidecar, breakout, 9472. Some references were
to unused methods in simulation that were removed.

Change-Id: I99b6fe9e8cb982831ffbf29177f84e2f9f71ef47
2014-08-30 08:56:06 -07:00
Jonathan Leitschuh
b1ace79379 Fixes the MotorEncoderTest sometimes failing because a counter registers movement from the jaguar after reset.
Change-Id: I65b24e59a902637b19b24c08f0a02b86621c5590
2014-08-29 16:46:08 -04:00
Jonathan Leitschuh
2a8ade093a Adds the ability to run test classes with --repeat rule.
Fixes a bug in several tests where --repeat wouldn't work due to multiple teardown calls.

Change-Id: I26f9350e9c7da6e9b0aefd1ecefb7e8d8975a641
2014-08-29 16:34:03 -04:00
Brad Miller (WPI)
b7458e7ba6 Merge "Make Talon the default speed controller for RobotDrive" 2014-08-29 10:53:30 -07:00
Thomas Clark
3fddee51c2 Make Talon the default speed controller for RobotDrive
Change-Id: I87047e11efb26f5081a3e23dc8f36fa9bb76a88c
2014-08-29 13:00:48 -04:00
Brad Miller (WPI)
21967fcb24 Merge "Fixes testing framework typos & adds rule to keep unix line endings for .sh" 2014-08-29 09:56:51 -07:00
Thomas Clark
9b896eab70 Make DoubleSolenoid work in Java [artf3457]
Make DoubleSolenoid and Solenoid use SolenoidBase, like in C++.

Add an integration tests for double solenoids.

Change-Id: I9a7ff562d65a564c5adabfa73f85f23ad466215b
2014-08-29 12:50:44 -04:00
Thomas Clark (WPI)
f439adc2a3 Merge "fix for Artifact artf3431 : Solenoids initialize to random/arbitrary stat" 2014-08-29 09:38:51 -07:00
Jonathan Leitschuh
67cb854676 Fixes testing framework typos & adds rule to keep unix line endings for .sh
Change-Id: I33826b879ba2dce7da88aa399d37f711a6612d86
2014-08-29 11:40:03 -04:00
Brad Miller (WPI)
ef7c554029 Merge "Wrap CPP Lib and Include paths in quotes (fixes artf2390)" 2014-08-27 13:07:52 -07:00
Brad Miller (WPI)
359b4ec86b Merge "Added support for 32-bit builds." 2014-08-27 13:06:30 -07:00
Brad Miller (WPI)
21153fc63f Merge "Fix artf3476 move RobotState and HLReporting implementation set to somewhere they will get called" 2014-08-27 13:05:04 -07:00
Alex Henning
daa8bd67ef Added support for 32-bit builds.
Change-Id: I609844b3c72ca9d016a43a7b0e288abb4dc2400e
Note: Jenkins probably needs to be restarted to get proper sbuild permissions.
2014-08-27 15:46:41 -04:00
Kevin O'Connor
e5e568fa73 Wrap CPP Lib and Include paths in quotes (fixes artf2390)
Change-Id: Ied08c559140ecb28a41f61d968a37cd772255b8c
2014-08-27 15:27:18 -04:00
Kevin O'Connor
c9f6fcd969 Fix artf3447 Java only runs teleop - Correct off by one error in Control Word compares
Change-Id: I5965008ac75a9c3cc3a3473fa775729421b8957c
2014-08-27 15:22:20 -04:00
Kevin O'Connor
778620b0a9 Fix artf3476 move RobotState and HLReporting implementation set to somewhere they will get called
Change-Id: I863ba263b822a60f46a04f4de2e3c570df5f317d
2014-08-27 15:14:22 -04:00
Kevin O'Connor
d58c6f0c0f Merge "Kill program before debugging C++ so file upload doesn't fail" 2014-08-27 11:44:45 -07:00
Jonathan Leitschuh
a14d854211 Cpp tests without color for jenkins. Fixes startDS to not kill the driver station.
Change-Id: I538aae4e2d6d94f0f510203d2d4cb9f40ffa4303
2014-08-26 14:26:11 -04:00
Fred Silberberg (WPI)
c5fc1dc5be Merge "Change SampleRobot template to use 0 based PWM" 2014-08-26 10:35:43 -07:00
Jonathan Leitschuh
cded5351df Test scripts have permission to run and fixes sshpass.
Updates vagrant file to have sshpass by default.
Adds configuration for setting up the network in bridged mode so that the scripts can use mdns to connect to the roboRIO.

Change-Id: I7274a24c772790c9495e8a1c083385ef528044a6
2014-08-26 12:56:10 -04:00
Jonathan Leitschuh
47169e0ce1 Adds test scripts to deploy, run and retrieve results from integration tests.
Adds a simple script for jenkins to run to retrieve the test results from.
Adds a script that allows developers to download and run tests from a specific language easily.
Adds a script that allows the tests to be run from within an ssh session on the roborio.

Change-Id: Ibe6ddc4e1dcbb8192e6552c3901e96f6907a8020
2014-08-26 11:20:02 -04:00
Brad Miller (WPI)
4ef798a0c0 Merge "Updates gitignore to use a file generated using http://www.gitignore.io" 2014-08-26 08:08:11 -07:00
Jonathan Leitschuh
7ec8d4e9a3 Updates gitignore to use a file generated using http://www.gitignore.io
Removes more OSX/Windows/Linux files.
Adds gitignores for cmake, Gradle, and Maven

Change-Id: I96ada2ef360770975f4afc068985cd6a21880a5f
2014-08-26 11:05:43 -04:00
Omar Zrien
17e7fc8f20 fix for Artifact artf3431 : Solenoids initialize to random/arbitrary stat
Change-Id: I0bdcf073637a47a9e6864f6d561cc812a1d5b021
2014-08-24 19:57:40 -04:00
Joe Ross
023f955a56 Change SampleRobot template to use 0 based PWM
Change-Id: Ia299db32ba724e5a5ddc2e9a3c0dbb5d8acbb08f
2014-08-23 15:06:31 -07:00
Alex Henning (WPI)
52e358c180 Merge "Add Preferences to simulation" 2014-08-23 11:12:34 -07:00
Kevin O'Connor
7638e2b6e5 Kill program before debugging C++ so file upload doesn't fail
Change-Id: Ibd4fdb6cbf491f20d66f36c4fb84753a1abbfd1e
2014-08-21 17:19:23 -04:00
Jonathan Leitschuh
f9ab84d912 Integration tests now run with the Ant Junit test framework.
Removes TestNG as it wasn't reporting all of the tests correctly. Adds Ant as a dependency and uses it to run the JUnit tests so that tests are output in a way that Jenkins understands.

Change-Id: Ie98358476cebe94f233e687195a0fced8723a878
2014-08-21 15:29:17 -04:00
Joe Ross
04fadb85f5 Add Preferences to simulation
Change-Id: Id2891dac25ab6a929b5b90164cc5ecef49f40906
2014-08-20 21:07:12 -07:00
Brad Miller (WPI)
698b371b16 Merge "Add OI and RobotMap files to Command Project template (fixes artf2407)" 2014-08-20 13:41:50 -07:00
Brad Miller (WPI)
6dde2c2b4c Merge "Adds interrupts to Java" 2014-08-20 13:39:47 -07:00
Jonathan Leitschuh
8ba0eada17 Adds interrupts to Java
Implements the JNI bindings for java
Adds integration tests for Digital Inputs and AnalogTriggers.
Adds the ability to get the value and message from errno in java using the HALUtil JNI class.

Change-Id: I853529fdab9744ce95ee15d4cc73dc3953265552
2014-08-20 16:10:40 -04:00
Kevin O'Connor
bf5eaf657e Add OI and RobotMap files to Command Project template (fixes artf2407)
Change-Id: Ia3fb2a03b6435ae74bd70ad856a41a2c15f22f5a
2014-08-20 14:35:04 -04:00
Kevin O'Connor
3baaea5a44 Squashed commit of the following:
commit b4589d75b682d5bb99a98e9af975dd5c03a574dc
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Tue Aug 19 17:15:12 2014 -0400

    Make CPP debugging from menu item work.

    Change-Id: I5bda07e088560adabbb9bc5fbfce9bd9456f7e1f

commit aaa832376700156abb1002ce7ad9334c4983be43
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Tue Aug 19 17:13:22 2014 -0400

    Change CPP debug to use mDNS (artf3410)

    Change-Id: I01b97e1754c2abd4d18b41ab2f890b1b5470d616

Change-Id: I405bd1808d301f650f9293c60db161205ee6e704
2014-08-19 17:20:15 -04:00
Jonathan Leitschuh
2cc937f5e1 Fixes debugging in Java
When deploying a Java program in debug mode any previous running programs should be properly removed. [artf3408]
This should link with (https://usfirst.collab.net/sf/go/artf3408?nav=1&_pagenum=2&returnUrlKey=1408475631056)

[artf3415] is still an issue until NI resolves it.
This should link with (https://usfirst.collab.net/sf/go/artf3415?nav=1&_pagenum=1&returnUrlKey=1408475758258)

Change-Id: Ica9639b5a406b70be4d51aa4e45ffef56baddc93
2014-08-19 15:16:55 -04:00
Brad Miller (WPI)
23b6a980c2 Merge "Uses ${ant.java.version} for javac when compiling" 2014-08-18 14:32:10 -07:00
Thomas Clark
89b80db2d0 Merge "Fix PIDError property" 2014-08-18 13:32:52 -07:00
Thomas Clark
1f27d36884 Fix PIDError property
Change-Id: I3ea040ae4e0520a231bab95390746eba4315fd8d
2014-08-18 16:29:41 -04:00
Thomas Clark
125dfac8b4 Merge "Fix Java IT build" 2014-08-18 13:00:12 -07:00
Thomas Clark
4215d1c79b Fix Java IT build
The Java ITs should have jcommander as a dependency

Change-Id: Ide03fb245d21b21643bf7a9de6248db12dc54460
2014-08-18 15:52:13 -04:00
Kevin O'Connor
dddba82d18 Fix artf3337 - add include to define int32_t in CounterBase.h
Change-Id: Ia6ce4e57a36d628fb9f61e1ac8c3d3101e22f165
2014-08-18 14:19:13 -04:00
Jonathan Leitschuh
78e2a8d1b9 Uses ${ant.java.version} for javac when compiling
This uses the ant jvm version variable to compile teams robot projects.

Change-Id: I4f5b704e5230c1bd09323abea6c4044c709c3eff
2014-08-18 11:42:28 -04:00
Thomas Clark
687bc44ae5 Add new CTRE classes and update PDP tests
Change-Id: I489091c5b8b0f1f9890e5104bf01e40ae53cf6ce
2014-08-18 10:32:26 -04:00
Jonathan Leitschuh (WPI)
c82a94b268 Merge "Make Java tests run with TestNG" 2014-08-18 07:17:11 -07:00
Alex Henning (WPI)
d407fe546f Merge "Fixes for simulation parallel builds." 2014-08-17 17:23:44 -07:00
Alex Henning
699949fdf4 Fixes for simulation parallel builds.
Change-Id: I2b2385b6677a892fd1fd8a0c4b6f995418c33900
2014-08-17 19:48:08 -04:00
Thomas Clark
6d89974016 Make Java tests run with TestNG
TestNG generates xml reports that Jenkins can use, JUnit does not without
Ant or Maven.

To run the tests, deploy the Jar and run:
    /usr/local/frc/JRE/bin/java -jar wpilibJavaIntegrationTests-0.1.0-SNAPSHOT.jar -junit -testclass edu.wpi.first.wpilibj.test.TestSuite

Change-Id: I9e8a7dcab775f9c5ad1905afa798cd9191e25438
2014-08-15 16:40:56 -04:00
Brad Miller (WPI)
e523157507 Merge "Fixed bug with joystick buttons/axes out of range." 2014-08-15 10:03:02 -07:00
Brad Miller (WPI)
3eba1c4688 Merge "Add delays to make C++ ITs more reliable" 2014-08-15 10:00:30 -07:00
Thomas Clark
d466d17edd Add delays to make C++ ITs more reliable
Also disable PCM tests until it's actually wired right

Change-Id: I431031f66aaaa87fa201e577fedef5a1952c1bb4
2014-08-15 11:22:01 -04:00
Jonathan Leitschuh
9dfd6bde9d Adds a Vagrant configuration file and setup script
Vagrant allows developers to install Vagrant and their choice of virtual box in which to develop.
This provides a consistent environment where anyone can devlop WPIlib without having to go through a lengthy setup process.

Change-Id: Iced863d307f0e6a761441f17c3de377594197c38
2014-08-15 10:56:31 -04:00
Alex Henning
eded28ebfa Fixed bug with joystick buttons/axes out of range.
Change-Id: I85f0a9f47dfbb786f850c1f382c0e18a4e4b8254
2014-08-15 10:29:39 -04:00
Alex Henning
c68ee3001e Added message to notify when simulation is unsupported.
Also links to screensteps instructions to set it up.

Change-Id: I61bca3ad773d5e08b3a4f8fa6bc0fd2cd1c04c59
2014-08-14 11:37:02 -04:00
Thomas Clark (WPI)
777dc2113d Merge "Updated installer to point to the new location." 2014-08-14 08:01:56 -07:00
Thomas Clark (WPI)
174f2c0e23 Merge "Increased build speed + caching of debs." 2014-08-14 08:01:23 -07:00
Thomas Clark (WPI)
434caf81d7 Merge "Add back SampleRobot Template Add GettingStarted example based on IterativeRobot" 2014-08-14 08:00:53 -07:00
Thomas Clark (WPI)
9327170069 Merge "Beginning of gradle conversion." 2014-08-14 08:00:03 -07:00
Kevin O'Connor
597e209c09 Add back SampleRobot Template
Add GettingStarted example based on IterativeRobot

Change-Id: Ic8caec4f62b7bdbaae7fafedfec5859b2f936809
2014-08-14 07:51:20 -04:00
Alex Henning
ad1ace1022 Increased build speed + caching of debs.
Make sure to add -j to improve build time by 10 minutes or more.

Change-Id: If2838a4042592fbfd1a0f40882efd7dd70270266
2014-08-13 18:22:40 -04:00
Alex Henning
70d09de2e9 Fixed frcsim script to have the proper LOAD_LIBRARY_PATH.
Change-Id: I83bdf3edcf5e69e1b5b358f92af26b8749039c7d
2014-08-13 15:22:36 -04:00
Thomas Clark
f7e1753e03 Fix C++ linker settings
Change-Id: I980e00968b0b465e6bba26a6586e23cc4e20f320
2014-08-13 11:56:36 -04:00
Alex Henning
df3f3cc0e1 Updated installer to point to the new location.
Change-Id: Id5f11a2952511bb781a4b4b38bcdcac1ec3ae2b0
2014-08-13 11:16:22 -04:00
Alex Henning
25308e2442 Beginning of gradle conversion.
Change-Id: Ic9690af60cd53b5237cd8c05d41598a94f6025f1
2014-08-12 17:25:10 -04:00
Alex Henning
6b3e2690d0 Fixed placement of libWPILibAthena.a
Change-Id: Ie50de30bcf911149d18d96e2b510b34424177e15
2014-08-12 17:15:44 -04:00
Alex Henning
ae10d43900 Fixes for examples and Gazebo 3.1.
Change-Id: Ie41a29b4b8f5cee87357f44adb45f54e03487622
2014-08-12 15:47:10 -04:00
Thomas Clark (WPI)
d4e377fc0e Merge "Adds the Trigger template and adds WPILib.h import to all templates" 2014-08-12 12:33:46 -07:00
Jonathan Leitschuh
9126646fef Adds the Trigger template and adds WPILib.h import to all templates
Change-Id: Ibaecc4802822cf4c0a4a5bf9ddc960b96e40d1e9
2014-08-12 15:32:29 -04:00
Thomas Clark (WPI)
d3f632486f Merge "Added support for Jenkins to generate doxygen." 2014-08-12 12:22:53 -07:00
Alex Henning
268459206f Added support for Jenkins to generate doxygen.
Change-Id: I2febfe42cc9301446f796376cfe8e1ef6744f19a
2014-08-12 15:22:16 -04:00
Thomas Clark (WPI)
df390c275d Merge "Merged sources in wpilibJavaFinal." 2014-08-12 12:09:31 -07:00
Jonathan Leitschuh (WPI)
1742634a96 Merge "Fix the example programs" 2014-08-12 12:06:42 -07:00
Alex Henning
0f8f83500b Merged sources in wpilibJavaFinal.
Change-Id: Iab8d079716eae3e5631cf7a62d6e88340e55e03c
2014-08-12 14:59:16 -04:00
Thomas Clark
d5c73c95dc Fix the example programs
Remove the test examples that don't do anything helpful

Fix the PacGoat and GearsBot examples to compile

Change-Id: Ic11ca7a97a5b52524fe60dc24fcec6ecfae7ebb7
2014-08-12 14:52:22 -04:00
Alex Henning
ca7dc5d6ac Removed excessive linking.
Change-Id: Iffc8517da2a4d6b67612b6076023211c07768714
2014-08-12 12:07:09 -04:00
Alex Henning
66e1f2a184 Fixed a few bugs with C++ due to the merge.
Change-Id: I6c5120ff502b40ecba0884f5a3631fa91822cfd4
2014-08-12 10:12:55 -04:00
Alex Henning
1301d76d61 Fixes for HLUsageReporting due to Jonathan's exceptions.
Change-Id: I28d6719d0b8f5a71186f6a764c9541277aea6237
2014-08-11 14:59:21 -04:00
Thomas Clark
a72ea14f92 Removed Simple Robot template option
Remove the option in Eclipse to make a "Simple Robot" project, since
there is no more simple robot template and the resulting project isn't
even generated correctly.

Change-Id: I06a9db8c7f5fb82b7be3eadb1f91813321a36119
2014-08-11 12:01:38 -04:00
Thomas Clark
14b2f14669 Merge "Implement DriverStation::GetBatteryVoltage" 2014-08-11 08:56:52 -07:00
Thomas Clark
d2cd5f3571 Implement DriverStation::GetBatteryVoltage
Make the GetBatteryVoltage method work using the new tPower header

Change-Id: If504f8a46f3f7f737f0b729b72fc6b5da0d29ff9
2014-08-11 11:56:10 -04:00
Jonathan Leitschuh (WPI)
7ecde3a33a Merge "Fix the default C++ linker settings" 2014-08-11 08:55:50 -07:00
Alex Henning (WPI)
81143fc534 Merge "Adds Exception throwing the basic robot systems are not properly initialized." 2014-08-11 08:53:37 -07:00
Thomas Clark
c58a86a3ab Fix the default C++ linker settings
Change-Id: I839b67fa6e9798f980db05f5a4ff9c8f47c32424
2014-08-11 11:27:48 -04:00
Alex Henning (WPI)
2f655bb49d Merge "Fixed bug with plugins not including all simulation dependencies." 2014-08-11 08:22:15 -07:00
Alex Henning
657054c9e2 Fixed bug with plugins not including all simulation dependencies.
Change-Id: I34c84c6cd4d918039726aa2efb81efbcf98dd593
2014-08-11 11:20:07 -04:00
Kacper Puczydlowski
f4d542b212 Add FakeEncoderTest for C++
Change-Id: Ic030a1d055a03f5b245e19e6466af05e72dd7deb
2014-08-11 11:15:42 -04:00
Alex Henning
8db11a4c6c Fix to deal with the certificates on collabnet having expired.
Change-Id: I0c7580f06107d59dfc32b343304529b17763c7fa
2014-08-11 08:13:08 -04:00
Joe Ross
14d784bca1 Fix import, resolves artf3339
Change-Id: I0abed3495ffc35161793f3a6140fb21872004866
2014-08-10 17:01:31 -07:00
Alex Henning
7c8124d76c Allowed sharing of common C++ code between RoboRIO and Simulation.
Change-Id: I8bf2bda9df389c13ae0567a62dbf0ca931ceb6f8
2014-08-08 18:36:03 -04:00
Thomas Clark (WPI)
b371600f0f Merge "Completed artf2675 - rename SimpleRobot -> SampleRobot." 2014-08-08 12:39:14 -07:00
Thomas Clark (WPI)
6c3b002a87 Merge "Refactors the CANJaguar tests to be more straightforward." 2014-08-08 12:14:24 -07:00
Colby Skeggs
0f93247641 Completed artf2675 - rename SimpleRobot -> SampleRobot.
Change-Id: I23fc503f64fa6a715867f4b92f9d03e21f6c5f82
2014-08-08 10:50:16 -07:00
Jonathan Leitschuh
54439e7198 Refactors the CANJaguar tests to be more straightforward.
Adds a brownout test from C++ (Ignored)

Change-Id: I81e04e20fb08cd9da7401d9c0e9fa6faf1fff0de
2014-08-08 12:10:56 -04:00
Thomas Clark
5b8279f404 Remove old driver station code
We don't need to send status data from the user program anymore

Change-Id: Ifbdb037cfb4e36681914dd7a3a2f5c56cbead6a2
2014-08-08 11:23:03 -04:00
Thomas Clark
8abbcf53f4 Update to the v13 headers and libraries
Add all of the most recent headers and .SOs

Also make DriverStation work with the new FRC comm protocol, using the new
functions for getting status data

Change-Id: I1c7fc5f90e72c5fbebf87d9923ce0967ed0ef3bc

Initial HAL support for v13 ds

Change-Id: I9a7f37ef8e24241598fa3981cb3df30c07c52e0f

New ds stuff in the HAL

Change-Id: I025910625453baf63f79f49bbc70ba8b2f093f50

New ds stuff in C++

Joysticks are still todo

Driver station IO is pulled out

Change-Id: I1bb59037c097713bd943e7bef00e12f67f13c3ac

New ds works in C++ and Java.  Joysticks still todo

Change-Id: Ic93f8686856761badc592eceaf05964f52355578

Make joysticks work again with the v13 image protocol

Change-Id: Ief7ee95d3398c2262ca07ab7d60499af3c8f60f7
2014-08-07 16:37:02 -04:00
Thomas Clark (WPI)
b8eeeabbb5 Merge "Removes encoder.start() from the example programs" 2014-08-07 13:18:42 -07:00
Jonathan Leitschuh
9a2bd8c49b Removes encoder.start() from the example programs
Change-Id: I26a9901a978481bb37fdb6eac6a2457c2ca990b8
2014-08-07 16:17:35 -04:00
Thomas Clark
4db634b342 Fix PCM channel indexes
The channels are fixed to correspond with the little-endian beta firmware

Change-Id: I1de0588c74a0e070c647fc2e5e629e47df3b663d
2014-08-07 13:20:39 -04:00
Thomas Clark (WPI)
57e670c18d Merge "Move PWM allocation to HAL to allow for checking against DIO allocation Re-number MXP DIO to match pinout (include SPI and I2C pins) (fixes artf2664) Change PWM MXP mapping to accommodate DIO re-mapping This re-implementation also fixes artf2668 for C++ and Java Change the test bench to reflect this change also" 2014-08-07 07:45:28 -07:00
Kevin O'Connor
59473ab7a7 Move PWM allocation to HAL to allow for checking against DIO allocation
Re-number MXP DIO to match pinout (include SPI and I2C pins) (fixes artf2664)
Change PWM MXP mapping to accommodate DIO re-mapping
This re-implementation also fixes artf2668 for C++ and Java
Change the test bench to reflect this change also

Change-Id: If30bd6a85a9f1f619fbde06a4ecd595a15fd28f7
2014-08-07 10:43:50 -04:00
Jonathan Leitschuh (WPI)
d1d4c75210 Merge "Fixed interrupt freeing in C++" 2014-08-06 06:57:11 -07:00
Thomas Clark
2356008d8c Fixed interrupt freeing in C++
When interrupts are cancelled on any interruptable class, the resource is now
freed.  Previously, the resource was only freed if the object is destructed
before CancelInterrupts() is called, so it was impossible to create and
destruct more than 8 interrupts.

The interrupts resource object is now in InterruptableSensorBase instead of
SensorBase.

A synchronous interrupt integration test was added.

Change-Id: I0806176340cecd4c1480dd8f043474cc05919f24
2014-08-06 09:46:50 -04:00
Thomas Clark
deb335d96d Fixed DoubleSolenoid, added a double solenoid test
Change-Id: I161337c8b528be7662650889d6ab7bcd2bbe2704

Fixed double solenoid, added a C++ test

Change-Id: Ib0821155efce85be87d354fc8e197fcc4deabd7c
2014-08-05 15:29:02 -04:00
Thomas Clark
1ce03b9c46 DoubleSolenoid works in C++ now
Change-Id: I75130f816efe8ef9c82e936bba834609c470f379
2014-08-05 14:42:37 -04:00
Thomas Clark
a09f75934a The output range can be set on a PIDSubSystem
Also, mimimum -> minimum in PIDController.h

Change-Id: I0cdfdca6ca2bdf2c2a40ee524cc925281069fcf4
2014-08-05 14:03:02 -04:00
Jonathan Leitschuh
aab98c0638 Adds Exception throwing the basic robot systems are not properly initialized.
Adds a BaseSystemNotInitalizedException to be thrown in the event that HLUsageRepoting, RobotState or Timer does not have its static implementation set.

Change-Id: I66fde262baa1a9d32d1df9fafa08ba3173bcbb72
2014-08-05 13:44:21 -04:00
Jonathan Leitschuh (WPI)
741e28b855 Merge "Added version numbers to maven plugins" 2014-08-05 10:29:31 -07:00
Thomas Clark
f817f6d041 Added version numbers to maven plugins
The version numbers for several maven plugins were unspecified before, which
caused a bunch of warnings before.

Change-Id: I7e2e05ccf3e2f10b24010576eb78192e9d891120
2014-08-05 13:29:01 -04:00
Thomas Clark (WPI)
7442a7ed7d Merge "Only update FRC Java Projects (fixes artf2627)" 2014-08-05 10:19:01 -07:00
Jonathan Leitschuh (WPI)
765198f5f5 Merge "Updated some comments that mention the cRIO" 2014-08-05 10:18:25 -07:00
Thomas Clark
ed08ab2989 Fixed voltage range checking and error message
Change-Id: I7ba05eb27f3d82bfd37f6b407fe39e0ab9cf5bf0
2014-08-05 13:16:10 -04:00
Jonathan Leitschuh (WPI)
4b22742cdc Merge "Cleaned up C++ compiler warnings" 2014-08-05 09:13:40 -07:00
Alex Henning (WPI)
45f93e9aba Merge "Added support for building debs on jenkins." 2014-08-05 09:04:04 -07:00
Alex Henning
049377c9ea Added support for building debs on jenkins.
Change-Id: Iec732b3a0d036e53e02e377b830f8af6b8eaf731
2014-08-05 11:54:15 -04:00
Thomas Clark
f4ace4a36d Cleaned up C++ compiler warnings
All C++ projects now build without warnings with -Wall and -Wextra

Change-Id: Idb6cf8b78274a30453e98c1e8edabcfb2a7fffb6
2014-08-05 11:51:00 -04:00
Thomas Clark
9ff420547a Updated some comments that mention the cRIO
Change-Id: Ib5e3c34fa2db83f48ca88153e8f4c834b31291f5
2014-08-05 11:17:38 -04:00
Jonathan Leitschuh (WPI)
1be31431bc Merge "Removed the User LED functions" 2014-08-05 07:37:03 -07:00
Thomas Clark
32cafd0efc Removed the User LED functions
There is no "User" LED on the RoboRIO, these functions didn't
do anything.

Change-Id: I8d2eaf0efde90cc444503a79f26d591ddaaa6322
2014-08-05 10:35:00 -04:00
Jonathan Leitschuh (WPI)
0216d1b336 Merge "Gyro deadband defaults to 0" 2014-08-05 07:31:29 -07:00
Thomas Clark
43c566bd86 Gyro deadband defaults to 0
The gyro class no longer attempts to set a default deadband, but it still
has an optional SetDeadband() method.

The gyro integration tests were modified and still pass consistently.

Change-Id: I08a97b00b98b49b0a3c63306fcc809857523af2b
2014-08-05 10:25:42 -04:00
Thomas Clark
b86c747226 Only set up once in the C++ tests
TestEnvironment::SetUp() will only initialize the first time it's called.
This allows the --gtest_repeat flag to be used to automatically repeat
the tests.

Change-Id: I20c857a37a88f48114d74ae68518d4a9d724d012
2014-08-05 09:29:07 -04:00
Thomas Clark
60a3fd0698 Added gyro deadbands
During calibration, the Gyro class sets the accumulator deadband to contain
whatever the farthest sample from the center was.  The integration test
passes now.

A SetDeadBand method was added to the Gyro class for teams to set their own
deadbands.

Change-Id: Idbe4c279e2991b4daed4d4cf3bfaf605d4ee25c0
2014-08-04 17:44:04 -04:00
Kevin O'Connor
b86c114939 Only update FRC Java Projects (fixes artf2627)
Change-Id: I62715ab5ed01d1d6c6ee1a877fad3d12a5c0219b
2014-08-04 16:35:28 -04:00
Jonathan Leitschuh (WPI)
14f201cd36 Merge "getAnalogAverageValue should use a 32-bit int" 2014-08-04 13:17:07 -07:00
Thomas Clark
c49ea255b9 getAnalogAverageValue should use a 32-bit int
getAnalogAverageValue gets a 32-bit integer and returns it as an int32_t,
but previously it stored the intermediate value as a 16-bit int.

Change-Id: I0a8b0cd3b3ff9b1ff40ad7942170f633c44c127b
2014-08-04 16:08:58 -04:00
Kevin O'Connor
065e1c24eb Update plugin menu text and make template menu options only show for correct language (fixes artf2408)
Change-Id: I13b80ab43aa79bd1aa8d12b7a8331a602a976bd0
2014-08-04 16:05:24 -04:00
Kevin O'Connor
ecdb77e4be Update plugin target to use mDNS (causes Java debug to now use mDNS)
Change-Id: I570b6e99282583b343e3dcb7f072a707726804e3
2014-08-04 16:01:53 -04:00
Jonathan Leitschuh (WPI)
10aad6d1c8 Merge "Fixed a few more small TODOs" 2014-08-04 12:41:34 -07:00
Thomas Clark
e73c8d06eb Fixed a few more small TODOs
Timer::Get now compensates for the FPGA time rolling over after 71 minutes

UltraSonic::Ping doesn't bother disabling automatic mode, since it asserts
that it's not in automatic mode on the line before.

Change-Id: I6b0f45327c453abd8a846ec8da0f9676e210d909
2014-08-04 15:25:41 -04:00
Thomas Clark
dc341a448e Fixed a few simple SmartDashboard FIXMEs and TODOs
SmartDashboard does usage reporting now (or will when it's implemented
in the HAL).

Global errors are raised in C++ when problems happen, since there is
no SmartDashboard instance.  Previously, no error reporting was done
at all.

GetData was uncommented.

Change-Id: I3331eb9f09924d1d0028e3fa041f0cf68caa5cf5
2014-08-04 14:43:31 -04:00
Thomas Clark
d521eb79b9 Analog interrupts in C++
Analog interrupts now work in C++.

The interrupts Resource was moved from a global in DigitalInput
to a static member of SensorBase.

An analog interrupt IT was added, and the digital interrupt one modified
to prevent a linker error.

Change-Id: I9a300daafed15e9666a4ccb405a509615e3dbb06
2014-08-04 13:45:16 -04:00
Thomas Clark (WPI)
f57a2dc5a9 Merge "Change deploys to use MDNS and to retry tail on missing file (fixes artf2663)" 2014-08-04 07:54:23 -07:00
Kevin O'Connor
7006d1ebc4 Change deploys to use MDNS and to retry tail on missing file (fixes artf2663)
Change-Id: I3223868968ae1d55314d76018a5dd98eaac14255
2014-08-04 10:52:37 -04:00
Thomas Clark (WPI)
c32e5707d4 Merge "Remove extra semi-colon" 2014-08-04 07:47:26 -07:00
Jonathan Leitschuh (WPI)
c27da3587d Merge "Added an interrupt test for C++" 2014-08-04 07:25:30 -07:00
Joe Ross
f18cccbc30 Remove extra semi-colon
Change-Id: I90052addd8ea499ce794d110b6945e9c7d7379cf
2014-08-03 18:08:03 -07:00
Thomas Clark
b91b681430 Added an interrupt test for C++
Change-Id: Ib2f3c575907848082c5d382144bb0462efa64107
2014-08-01 18:11:02 -04:00
Thomas Clark
b26667f866 Fixed the PCM test solenoid numbers
The numbering of the PCM channels is different in the latest firmware

Change-Id: Ib7cb5e69f7b6f076a424358ff61653a4c8ad33af
2014-08-01 17:18:46 -04:00
Thomas Clark
792e3b6ccc Removed modules from the HAL and JNI bindings
Modules aren't used anymore in wpilibc and wpilibj, so the hal functions
that references them and and JNI bindings for these functions have been
pulled out.

Both Counter classes were also modified because they still referenced
modules.

Change-Id: Ic01feb145a4ed5f08cd55f140867c721f5ee7b10
2014-08-01 15:01:28 -04:00
Jonathan Leitschuh
fd4379a946 Makes the Counter.Mode an enum and adds Null Checking
Adds null checking to the AnalogTrigger, AnalogTriggerOutput, and Counter classes

Change-Id: I09e962db36dbde0479a73a47c9998de03cd6bbb5
2014-08-01 13:41:34 -04:00
Jonathan Leitschuh
a40cdf5197 Implements the AnalogTriggerType as an enumeration
Change-Id: I411104a0bec733dc0b3854470c36366f3aec7bd6
2014-08-01 12:51:26 -04:00
Thomas Clark
ba4e74d299 AnalogTrigger support in Java
Analog triggers now work in Java.

Integration tests for analog triggers are included.

A message in the C++ analog trigger IT was fixed.

Change-Id: I50007c6901b8391d32c0e81becdbe18e48a7840f
2014-08-01 12:39:19 -04:00
Jonathan Leitschuh
38583789be Fixes the TiltPanCamera test (now GyroTest)
Change-Id: I3e954e60162ce84372a2dea39803437589aaaf00
2014-07-31 16:08:14 -04:00
Thomas Clark (WPI)
45e43b627f Merge "Changes the name of the AccelerometerTest to BuiltInAccelerometerTest" 2014-07-31 13:03:48 -07:00
Jonathan Leitschuh
e837d9083a Changes the name of the AccelerometerTest to BuiltInAccelerometerTest
Change-Id: Iabbfa8c4f3688a126443993b861018068f1969c4
2014-07-31 16:03:11 -04:00
Jonathan Leitschuh (WPI)
e0e2b498a5 Merge "Accumulators wait for the next sample after reset" 2014-07-31 12:54:26 -07:00
Thomas Clark
8fe888dbc9 Accumulators wait for the next sample after reset
Analog accumulators now wait for the amount of time a full sample
(including oversampling and averaging) lasts after
AnalogInput::ResetAccumulator() is called, so they don't return
old values after being reset.

This delay should be microseconds long and will only happen
when an accumulator is reset.

A new test is is the C++ TiltPanCameraTest that tests this behavior
with the Gyro class.

Change-Id: I1b3ffdeec187959f95c5e637a6d428c9a4bc2cf4
2014-07-31 15:46:14 -04:00
Thomas Clark (WPI)
41bb0da4e6 Merge "Fixes bugs with the Gyro" 2014-07-31 12:41:40 -07:00
Jonathan Leitschuh
97ade3606e Fixes bugs with the Gyro
If the gyro was initialized with an analog input the gyro class would not be calibrated properly.
Removes unnecessary type casting.

Change-Id: I6baa72919019a33cce7d3074f8477104cbe65396
2014-07-31 15:32:03 -04:00
Jonathan Leitschuh (WPI)
2735406bfb Merge "Added a Java internal accelerometer test" 2014-07-31 11:25:26 -07:00
Thomas Clark
ab04e19aae Added a Java internal accelerometer test
Change-Id: I9cae930bbae97af6461d13776cbfc9bb87e0cac4
2014-07-31 10:59:41 -04:00
Thomas Clark (WPI)
a58288ae6d Merge "Refactors the RobotBase Setup into a method." 2014-07-31 07:39:35 -07:00
Jonathan Leitschuh
7905259e21 Refactors the RobotBase Setup into a method.
This allows the robot base setup to be used for the robot base as well as the setup for the test system.

Change-Id: I2f8e37d42c84001f4b4eff2afd7c3e1d73785d7c
2014-07-31 10:37:39 -04:00
Thomas Clark (WPI)
f018689d0e Merge "Completed artf2662: removed Start()/Stop() in Encoders and Counters." 2014-07-31 07:32:35 -07:00
Colby Skeggs
0bb13d86ea Completed artf2662: removed Start()/Stop() in Encoders and Counters.
Change-Id: I11954bb5f66e54461455637d79013c1071f5d00f
2014-07-31 10:31:36 -04:00
Jonathan Leitschuh (WPI)
526df3679a Merge "Added a C++ Preferences test" 2014-07-31 06:36:20 -07:00
Thomas Clark
d8da3e5f1f Added a C++ Preferences test
Change-Id: I6c210535dcfad7c75ff4c04ee6446147efb2fc57
2014-07-30 17:33:26 -04:00
Jonathan Leitschuh
c0af235050 Removes the dependency-reduced-pom.xml from the repository.
Also adds this file to the .gitignore

Change-Id: I731c58d4f8a96531e61598e281a769e6b13e2e86
2014-07-30 14:08:21 -04:00
Jonathan Leitschuh (WPI)
7f6ca6824e Merge "HALInitialize should be the first thing called" 2014-07-30 08:50:09 -07:00
Thomas Clark
231bb55b2a HALInitialize should be the first thing called
Constructing a new HardwareTimer before HALInitialize is called
causes segfaults sometimes in user programs, since getFPGATime assumes
that the tGlobal objected was constructed.  This problem did not appear
in integration tests, where the calls were in the correct order.

Change-Id: I95471e9e8ad7bc5d48a65893856089e35c0b091a
2014-07-30 11:26:50 -04:00
Thomas Clark
76e488061d Removed cRIO tests, NetBeans stuff, and Ant stuff
Change-Id: I066e73916ac944e3145554a49051fb3a92d8c16d
2014-07-30 10:45:58 -04:00
Thomas Clark (WPI)
5e8ea38465 Merge "Fixes the PDP test." 2014-07-30 07:35:15 -07:00
Thomas Clark
a5b72d62a1 Remove the last obsolete interface
Change-Id: I5921968b3064af53f716858092c2da3ea7522362
2014-07-29 18:01:17 -04:00
Jonathan Leitschuh
a5e15b16fd Fixes the PDP test.
Switches the PDP test to use the MotorEncoderFixture.
Also adds helpful output information when running MotorEncoderTests by displaying the current MotorEncoder under test

Change-Id: I1d14986a6ff0ebfffa87d2fd8077d7dd1eef50e3
2014-07-29 18:01:00 -04:00
Jonathan Leitschuh (WPI)
264c38a674 Merge "Removed the old "parsing" interfaces" 2014-07-29 14:45:55 -07:00
Thomas Clark (WPI)
20de3abe80 Merge "Updates the TimerTest to give a clearer output." 2014-07-29 14:42:51 -07:00
Jonathan Leitschuh
3536d47835 Updates the TimerTest to give a clearer output.
Change-Id: I4d6685392e4e3cb21b8a24607904d0c888658855
2014-07-29 17:41:57 -04:00
Thomas Clark
60a294fbad Removed the old "parsing" interfaces
Change-Id: I94ff79f36d5b61f90c2f242fa06816bf3a3b7ac2
2014-07-29 17:34:39 -04:00
Jonathan Leitschuh (WPI)
dc42a1129f Merge "The LiveWindow instance isn't a global static" 2014-07-29 14:00:31 -07:00
Thomas Clark
386dc1f16b Added AnalogTrigger tests
Change-Id: I60c3e576e100632635278e80743975daf238e904
2014-07-29 16:48:28 -04:00
Thomas Clark
038478e437 The LiveWindow instance isn't a global static
The LiveWindow singleton instance shouldn't be a global static
variable, since the order that global statics are constructed is
undefined, and it's required by other constructors.

Change-Id: I2edccc1f723f0ea41b1347379b3e3778a50afcdc
2014-07-29 16:12:23 -04:00
Thomas Clark (WPI)
26e90a988b Merge "Adds/Updates CANJava Testing Framework." 2014-07-29 12:57:08 -07:00
Jonathan Leitschuh (WPI)
d5cd47bfa1 Merge "Minor updates to the C++ CANJaguar ITs" 2014-07-29 12:52:17 -07:00
Jonathan Leitschuh
1e35ef7802 Adds/Updates CANJava Testing Framework.
Change-Id: Iabd80ebd365a05063985fa45ce62849ced17c096
2014-07-29 15:50:31 -04:00
Jonathan Leitschuh (WPI)
65607b5bc1 Merge "Fixed CANJaguar::GetOutputVoltage for negative voltages" 2014-07-29 12:48:56 -07:00
Thomas Clark
30c0cc0561 Minor updates to the C++ CANJaguar ITs
Some tests are more explicitly named now, and negative values are
tested with both voltage and current control.

Change-Id: I316ccfb7670a341e2f13f4ed3a514f283625409e
2014-07-29 15:47:45 -04:00
Jonathan Leitschuh
92bd697417 Fixes a bug where the testing framework would never set the implementation for the libraries.
Change-Id: I8f745ebd870c8dacf28b0459e3d5128195fcbb87
2014-07-29 15:30:33 -04:00
Thomas Clark
ed0df5432f Fixed CANJaguar::GetOutputVoltage for negative voltages
Previously, negative output voltages were unpacked incorrectly.

Now, they're requested as percentages, unpacked, and then scaled
in software based on the bus voltage.  The output voltage and
bus voltage shouldn't ever be out of sync, since they're in
the same message.

Change-Id: I745fffd0faa6cbaab967240271e6cfa8653212e2
2014-07-29 15:25:35 -04:00
Thomas Clark
6deb196e90 Support for the "USER" button on the RoboRIO
You can get the state of the USER button with GetUserButton() in
C++ or Utility.getUserButton() in java.

Change-Id: I923e62cab5e621ef43fed503acab5c0d751264fb
2014-07-29 14:42:08 -04:00
Jonathan Leitschuh (WPI)
8b612f713b Merge "CANJaguar::Disable stops periodic setpoints" 2014-07-29 08:39:12 -07:00
Thomas Clark
d66bafb687 CANJaguar::Disable stops periodic setpoints
Calling CANJaguar::Disable() now makes NetComms stop periodic
setpoint messages, so the motor actually stops until EnableControl()
is called again.

Change-Id: Ib4eb4ad5f729be5c74e799f02ed000511de1e03d
2014-07-29 11:09:37 -04:00
Alex Henning (WPI)
78d2ccd299 Merge "Added stack traces and better error reporting in C++" 2014-07-29 07:27:12 -07:00
Thomas Clark (WPI)
06d59447be Merge "Adds missing Javadocs and @Overrides annotations to the PIDController in Java" 2014-07-29 07:25:34 -07:00
Jonathan Leitschuh
3475a4a8c6 Adds missing Javadocs and @Overrides annotations to the PIDController in Java
Change-Id: I61bf9a31c238b44012d01d4fae11971cc7951d54
2014-07-29 10:19:54 -04:00
Thomas Clark (WPI)
6af242b556 Merge "Fixes for javadoc eclipse plugin." 2014-07-29 07:13:00 -07:00
Alex Henning
c72e704396 Fixes for javadoc eclipse plugin.
Change-Id: I629a8b22acc2073b97b3b478c8b9d52b03cfa353
2014-07-29 10:01:23 -04:00
Thomas Clark
89fe909ae6 Added stack traces and better error reporting in C++
When an error is reported or an assertion fails in C++, a line is now
printed with information about where the error occured, and a stack trace
is printed.

The stacktrace isn't implemented in the HAL because it's not
hardware-dependent, so StackTrace.hpp and StackTrace.cpp are gone.

The Eclipse project template is modified to include "-export-dynamic" in
the linker options, which is necessary for stack traces.

Change-Id: Ie86c14185b13ed603d0fe6467e87ba4f731b1913
2014-07-28 16:35:45 -04:00
Joe Ross
c1d8e4ef4b Make AnalogInput PIDGet return an average voltage. artf2391 for Java.
Equivalent to Ia7f06ca2
Previously it returned a raw value instead of a voltage.

Change-Id: I6f1bcf8fdd7f98ae62ed991f29fec35f4ffb4098
2014-07-28 08:04:10 -07:00
Alex Henning (WPI)
338120c3a5 Merge "Fixed wpi_setErrnoError to print the error name" 2014-07-28 07:05:51 -07:00
Alex Henning (WPI)
a7efbe0d7a Merge "Fixed Preferences in C++" 2014-07-28 07:04:13 -07:00
Thomas Clark (WPI)
4c78280308 Merge "Correct voltage range in javadocs for RoboRIO" 2014-07-28 06:37:02 -07:00
Joe Ross
5a3889a3aa Correct voltage range in javadocs for RoboRIO
Change-Id: I6049fac62bb4f1fb15364bd26d0511d0603c0aee
2014-07-28 09:34:48 -04:00
Thomas Clark (WPI)
2fd4964b62 Merge "ADXL345_I2C: Make constructor explicit." 2014-07-28 06:26:10 -07:00
Thomas Clark (WPI)
6ae6394548 Merge "AnalogPotentiometer: Make constructors explicit." 2014-07-28 06:25:43 -07:00
Peter Johnson
310151132d AnalogPotentiometer: Make constructors explicit.
The second and third arguments have default values, so it needs to
be explicit.

Change-Id: I893a45d750291f96983bef6b753d91f10c44d2ab
2014-07-28 00:01:42 -07:00
Peter Johnson
7f4e1e39ae ADXL345_I2C: Make constructor explicit.
The second argument has a default value, so it needs to be explicit.

Change-Id: I5c38f8f55f9c21576835c005acd8d80fe6864140
2014-07-27 23:59:59 -07:00
Peter Johnson
eebdc3d20c BuiltInAccelerometer: Add virtual destructor.
Change-Id: I38e5ca92ba6c5b395366cfd8ea35acd2a08dbdac
2014-07-27 23:52:00 -07:00
Thomas Clark
980ea96b05 Fixed Preferences in C++
The file name was never updated from the old path, a deadlock occured
sometimes.  A "resource not found" message was also set when fopen()
returns an error, which should be an errno message because it's a C
library error.

Change-Id: Ic913a08f6f5d73219cb6625198f5a4519c039956
2014-07-25 17:03:28 -04:00
Thomas Clark
1038f98e83 Fixed wpi_setErrnoError to print the error name
Previously, wpi_setErrnoError and wpi_setErrnoErrorWithContext
always printed "Unknown errno" whenever a C library error
occured.

Change-Id: Ib235138eea0e83b0d7462dfd6e834e3499e3b0c5
2014-07-25 16:52:00 -04:00
Thomas Clark
326aa2e85c Fixed a typo with the tGlobal commit
Change-Id: Ic801e9f73235cd24e9f57484c8af892c9c125075
2014-07-25 13:08:52 -04:00
Thomas Clark
6071fc7fb3 Fixed CANJaguar percent scaling issue [artf2637]
Percent mode used to be scaled incorrectly in Java because the
max output voltage was initialized to a wrong value.

Change-Id: If88bb2f1d198e13b1724afc62a522fbf91a14b5b
2014-07-25 13:01:24 -04:00
thomasclark
f958b65ba6 CANJaguar can be disabled [artf2647]
The CANJaguar class now stores a controlEnabled flag.  When disabled, it
won't verify the control mode, which involves sending enable messages.

Change-Id: I8baa48eec31de6b4d3fee2b5a074320542a1bbef
2014-07-25 12:59:47 -04:00
Brad Miller (WPI)
f4f7588cfb Merge "A few small changes to the C++ ITs" 2014-07-25 08:54:42 -07:00
Brad Miller (WPI)
80ecff6bdb Merge "AnalogInput::PIDGet returns an average voltage[artf2391]" 2014-07-25 08:52:16 -07:00
Brad Miller (WPI)
e487c950e9 Merge "Only create one tGlobal object" 2014-07-25 08:51:32 -07:00
Thomas Clark
191e9d5d6b AnalogInput::PIDGet returns an average voltage[artf2391]
Previously it returned a raw value instead of a voltage.

Change-Id: Ia7f06ca24a6c79468c7be89a07c615d7015ffef9
2014-07-25 09:41:06 -04:00
thomasclark
40fc8326aa Only create one tGlobal object
This fixes a problem with getFPGATime() blocking for around 1 second
each time it's called.

Change-Id: I8aafb725889c231ffb2c91e7cb4bbb8110474a9d
2014-07-24 18:30:13 -04:00
thomasclark
fdbe750d3d A few small changes to the C++ ITs
A PDP channel number is correct now, the deploy script was changed to
kill Java programs before running and ignore useless messages,
the "Waiting for enable" message is only printed once, and the accelerometer
test is more robust.

Change-Id: I2226140d8c3e44c452e039c27f4f1cf11c952c42
2014-07-24 18:22:31 -04:00
Jonathan Leitschuh
3ec797a8cf Updates the CANJaguar to free itself before throwing an exception in the constructor. This allows it to be allocated later without throwing an Allocation exception.
Change-Id: Ifbd15fecad92fa17a1c4b92d444b67221dacb4b5
2014-07-24 16:55:27 -04:00
Jonathan Leitschuh
78e6cf7208 Updates the AbstractComsSetup message to report JUnits multiple exceptions correctly.
Adds a simple logger to the AbstractComsSetup that prints messages to the console based on the log level.
Replaces all System.out prints with TestBench.out()

Change-Id: Ieb7acfe51aa2febe9cfd3883f8a33094c9b72a6e
2014-07-24 15:01:44 -04:00
Jonathan Leitschuh
2481e98bc8 Fixes a deallocation of the Relay resource when calling free. Changes fake "Enum Classes" into real Enumerations
Change-Id: I9d5a4760235adc9e02e41040c9973316e1f32da2
2014-07-24 13:59:21 -04:00
thomasclark
c81d510ebe CANJaguar::ChangeControlMode marks the controlmode as unverified
This previous caused a bug where the Jaguar would sometimes
behave as if it were in the wrong mode, even when everything was
verfied.

Change-Id: Id5b96e0f7e64066eaaa0e5be4ba53fca76ba0703
2014-07-24 13:54:01 -04:00
Thomas Clark (WPI)
3fb4159101 Merge "Added missing call to m_ds.waitForData()" 2014-07-24 10:41:17 -07:00
Alex Henning
2e1bd171a5 Added missing call to m_ds.waitForData()
It was accidentally deleted in a previous commit[1] and none of our
tests caught it. As a result iterative robot loops run too fast (using
extra CPU).

[1] https://usfirst.collab.net/gerrit/gitweb?p=wpilibj.git;a=blobdiff;f=WPILibJ/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java;h=0e936de8ec86a76e0a63ddbfc65ec2b88bc71725;hp=d4c5d38a14e29c926389ba1ae84fcbd09ee51f19;hb=HEAD;hpb=726ac3a3d272310b367b25f3c7e15ba6d07b957d;tflink=projects.wpilib/scm.WPILibJ

Change-Id: I663f8619406f26b7fa6fc12bce4444657b829d9f
2014-07-24 12:02:50 -04:00
Alex Henning (WPI)
25e7a077c1 Merge "Implemented FRCSim artf2628, fixed bugs in non-sim Relay.java and sim PWM.cpp." 2014-07-24 08:59:51 -07:00
Colby Skeggs
dc48dc7f7b Implemented FRCSim artf2628, fixed bugs in non-sim Relay.java and sim PWM.cpp.
Change-Id: Ic00fcd5026ce0570c79a65be178e45eeb94b3deb
2014-07-24 11:54:46 -04:00
Colby Skeggs
2dd45c3ea6 Fixed FRCSim artf2619, and misc reformatting.
Change-Id: I7133f46f88f7e2cb2451c2a6714daa8f3f368b40
2014-07-23 14:43:11 -07:00
Jonathan Leitschuh (WPI)
461e359484 Merge "Remove the Kinect code from C++" 2014-07-23 13:57:20 -07:00
thomasclark
78dac49cf6 Remove the Kinect code from C++
Change-Id: Ifef909a8948f1d0f881bf394b9a3ba925644306f
2014-07-23 16:55:45 -04:00
thomasclark
66ba9a728e Fixed some bugs with CANJaguar verification in Java
Change-Id: I5f6510d53c806845f6bae5eb8fd9ebbc8fde054e
2014-07-23 16:33:57 -04:00
Jonathan Leitschuh (WPI)
c3d1e80a62 Merge "Fixed some bugs with CANJaguar verification in C++" 2014-07-23 12:48:17 -07:00
Jonathan Leitschuh (WPI)
01ca19f78f Merge "Added a Jaguar brownout test in C++, cleaned up some C++ tests" 2014-07-23 12:46:27 -07:00
thomasclark
202bfb2959 Added a Jaguar brownout test in C++, cleaned up some C++ tests
Change-Id: I8fe26c0c3fab35bf783f6c5dfe0c16a991ec06cd
2014-07-23 15:24:39 -04:00
thomasclark
b0369342e9 Fixed some bugs with CANJaguar verification in C++
Change-Id: I3f17c090e26c6019523eb92eb47714464aa01baf
2014-07-23 15:22:26 -04:00
Alex Henning
26d101caf9 Restructure WPILibJ to share code.
wpilibJavaDevices now contains RoboRIO specific code and wpilibJava has
shared high level information. The restructuring was mostly just copy
and paste. The three big exceptions are Timer, RobotState and
HLUsageReporting. Those require some dependencies injection since that
appears to be the cleanest way to share the code.

Change-Id: Ie7011e32bc95953a87801a9905b3bfec7f8de285
2014-07-23 14:11:52 -04:00
Jonathan Leitschuh
e84e0ebab8 Updates the TestBench to use parameters to run specific test methods or test/suite classes.
Updates the test bench to only print "Waiting for enable" on one line with a counter.
Updates all SubSuites to extend the AbstractTestSuite class.
Also includes a small set of tests to prove the validity of the base AbstractTestSuite

Change-Id: I447ca2537a08c84ab1d69fa200cb8125b448a589
2014-07-23 10:43:42 -04:00
Jonathan Leitschuh (WPI)
0704a697ce Merge "Updated the C++ TiltPanCameraTest" 2014-07-23 07:02:46 -07:00
Jonathan Leitschuh (WPI)
13f97bb6e3 Merge "Added an Accelerometer interface" 2014-07-23 06:57:42 -07:00
thomasclark
5eddb69aa0 Updated the C++ TiltPanCameraTest
The gyro sensitivity is fixed, the Accelerometer interface is
now used, and some tolerances are adjusted.

Change-Id: Iac1f3c4fbae3be923bd97692684ff72cd2f623f9
2014-07-23 09:36:27 -04:00
thomasclark
41c2b9402c Added an Accelerometer interface
ADXL345_I2C, ADXL345_SPI, and BuiltInAccelerometer implement this interface.

The analog accelerometer class Accelerometer was renamed to
AnalogAccelerometer.

Change-Id: Iaae79d582a24c36c372f5fd4ea6df37be289b9c1
2014-07-22 18:04:00 -04:00
Jonathan Leitschuh (WPI)
99632e003b Merge "Fixed the Command-Based Robot template [artf2550]" 2014-07-22 11:00:46 -07:00
thomasclark
fe12394c93 Fixed the Command-Based Robot template [artf2550]
Change-Id: I49361a70fd19d59fbeb9e22a8f65de875fa5a04a
2014-07-22 13:57:45 -04:00
Jonathan Leitschuh (WPI)
fbf196763f Merge "Removed AnalogModule, DigitalModule, and Module from C++" 2014-07-22 10:53:21 -07:00
thomasclark
b5fb35c0c4 Removed AnalogModule, DigitalModule, and Module from Java
Change-Id: I42c58237f1e14d0ebae1c7266aecda00d51eeae1
2014-07-22 13:33:00 -04:00
Alex Henning (WPI)
48e8b2136e Merge "Add support for downloading models hosted on FIRSTForge." 2014-07-22 09:54:23 -07:00
Alex Henning (WPI)
e962c770bb Merge "Fixed installation of frc_gazebo_plugins and a few minor fixes." 2014-07-21 14:12:38 -07:00
Alex Henning
1b7a352cbb Add support for downloading models hosted on FIRSTForge.
Change-Id: I191dc2620b5907316fbc38275d68c568656fa863
Completes: artf2620
2014-07-21 17:09:29 -04:00
thomasclark
1a77cea13a Removed AnalogModule, DigitalModule, and Module from C++
The HAL calls from Analog/DigitalModule are now directly in the classes
that use them.

Change-Id: I1cf879ab2979be903d03ab8282dfe5a5e7ae9443
2014-07-21 16:32:36 -04:00
Alex Henning
afa39deec5 Fixed installation of frc_gazebo_plugins and a few minor fixes.
Change-Id: I1cb30acb69526455469ad890dfee8edd42958a5d
2014-07-21 14:55:43 -04:00
Jonathan Leitschuh
f27e16735f Adds resource tracking to CANJaguar in C++
Change-Id: I0d562af5e9f4f50f79d61db15ff25eaf4dae00d5
2014-07-21 14:36:43 -04:00
Thomas Clark (WPI)
d8a5ced015 Merge "Fixes a bug with ErrorBase where the correct error code would not be set when using wpi_setWPIErrorWithContext()" 2014-07-21 08:23:59 -07:00
Jonathan Leitschuh
8fe606a4b1 Fixes a bug with ErrorBase where the correct error code would not be set when using wpi_setWPIErrorWithContext()
Change-Id: I6ed75428d31df219daf55969e9cd019bf9e0e117
2014-07-21 11:21:36 -04:00
thomasclark
6053a0cc24 Added BuiltInAccelerometer in Java and updated C++
Change-Id: I5a3360c51334e85da6a15fd640f9420bc3b64dca
2014-07-21 10:09:41 -04:00
Jonathan Leitschuh (WPI)
be106b3527 Merge "Added a C++ built-in accelerometer class" 2014-07-21 06:11:59 -07:00
Jonathan Leitschuh (WPI)
ebaf2ef058 Merge "Added HAL methods for using the built-in accelerometer" 2014-07-21 06:02:32 -07:00
thomasclark
9f1a9a07c9 Added a C++ built-in accelerometer class
Change-Id: I80cee788912277f06ac4bdda40261f160de0cbaa
2014-07-21 08:57:03 -04:00
thomasclark
ec2a455bc7 Added HAL methods for using the built-in accelerometer
Change-Id: I5372f5df9b29c546dab3913fcf983a7a9a5427dc
2014-07-21 08:49:51 -04:00
Jonathan Leitschuh
3d740a9a25 Adds Resource tracking to CANJaguar
Change-Id: Ic5da91d378d997f57c65b3bace5fcfd24485dddb
2014-07-18 15:00:59 -04:00
Thomas Clark (WPI)
1dd1e0be1e Merge "Adds a Unit Test for the Resource object in Java. Fixes a bug in the Resource class caused by allocating a negative resource value." 2014-07-17 12:55:24 -07:00
Jonathan Leitschuh
437e3ff266 Adds a Unit Test for the Resource object in Java. Fixes a bug in the Resource class caused by allocating a negative resource value.
Change-Id: I3a3b368d429dc5cd00baf94ccd80a676a10cbb48
2014-07-17 15:51:01 -04:00
Jonathan Leitschuh (WPI)
f373c8708d Merge "The camera fixture tests now include an SPI accelerometer test" 2014-07-17 12:48:32 -07:00
thomasclark
54a657a7d4 The camera fixture tests now include an SPI accelerometer test
Change-Id: I5dae746541d1d0e29f7d7c140a8fed8418502f45
2014-07-17 15:44:51 -04:00
Kevin O'Connor
60d8508a65 Fix artf2636 Don't consume ByteBuffer when checking class specific status
Change-Id: I94e46bd436cc8fd41c7550f1135287027e8be9c4
2014-07-17 15:22:53 -04:00
Kevin O'Connor
02a28c8f04 Add allocation checking for I2C MXP. Update DIO counts in Lib layer until resource checking moves down to HAL
Change-Id: I0abe80bcbe9cbbc81f0887a1cd1a3aa0862df5f1
2014-07-17 15:22:53 -04:00
Kevin O'Connor
b128828977 Update Digital Pin count to reflect full 16 DIO on MXP
Change-Id: I180dee11c2c2a7e0585f153ba4b1832bce2bd6d3
2014-07-17 15:22:52 -04:00
Kevin O'Connor
1a1a12316b Remove JNA hack no longer being used
Change-Id: If85d24003524af71d47115ac0ef31ebc88b70f42
2014-07-17 15:22:51 -04:00
Thomas Clark (WPI)
d0fdb3e704 Merge "Port SPI to roboRIO. Java SPIDevice renamed to SPI and rewritten to match C++ API." 2014-07-17 12:16:14 -07:00
Jonathan Leitschuh (WPI)
5d2e20eaec Merge "More CANJaguar integration tests" 2014-07-17 11:39:26 -07:00
Jonathan Leitschuh
fc0eb4e956 Adds/updates the documentation for the CANJaguar Classes for C++ & Java.
Also removes private unused methods in Java and an unused constructor.

Change-Id: I0a810a4839a5c6752872d947239dd9305141672e
2014-07-17 14:36:51 -04:00
thomasclark
968b69d37d More CANJaguar integration tests
Change-Id: I92e6bb7ee0e7d43c1468650e2c69bb8f46a0154d
2014-07-16 16:45:52 -04:00
Kevin O'Connor
343c7f4f3e Port SPI to roboRIO. Java SPIDevice renamed to SPI and rewritten to match C++ API.
Change-Id: I9b2c05a05cbe443331a5b6da6a6d7c7be751a5e7
2014-07-16 16:34:37 -04:00
Jonathan Leitschuh (WPI)
80c5c09f77 Merge "Encoders and counters work on the MXP" 2014-07-16 12:10:30 -07:00
thomasclark
cb9df310dc Encoders and counters work on the MXP
Change-Id: Ifeb0533dde53a1ccba841b29e2b86f6f4a1bb33f
2014-07-16 15:06:08 -04:00
thomasclark
f566c087dc Fix a few wrong messages in CANJaguar
Change-Id: I8e1a8fa9b0c20a40e060a8319dbbd605173dc407
2014-07-16 10:27:17 -04:00
Brad Miller (WPI)
7ca1b498e4 Merge "Added generic CAN methods to the HAL" 2014-07-11 12:09:46 -07:00
thomasclark
8bba58b9ab Added generic CAN methods to the HAL
Packing, unpacking, caching, receiving, and sending CAN messages can be done
with a thin wrapper around CANSessionMux now, removing the need for duplicated
code between different CAN devices and languages.

Change-Id: If40181e479f45a443db7a1c264437f7f89ff54d9
2014-07-11 11:38:22 -04:00
Colby Skeggs
8ae64a12ea Removed modules from the simulation infrastructure and refactored FRCPlugin.
Pneumatics still have CAN modules. The refactored code is now eight
plugins for sensors and actuators. There is some code reuse that should
be refactored out, but that level of abstraction will wait until we
figure out how these plugins are integrating with gazebo proper.

Change-Id: I357e695ef05af6dda83a39ba60380686bd57d11a
Closes: artf2610, artf2623
2014-07-07 13:33:34 -07:00
Alex Henning (WPI)
3b4718fc92 Merge "Fixed FRCSim artf2609 - double ports handled wrong." 2014-07-07 12:22:39 -07:00
Alex Henning (WPI)
5800af49bc Merge "Fixed FRCSim artf2599." 2014-07-07 11:46:49 -07:00
Thomas Clark (WPI)
63fc4f6cfb Merge "Makes the tests take parameters at runtime so that you can selectively run a suite without having to run the entire framework." 2014-07-03 13:20:50 -07:00
Jonathan Leitschuh
8b770ffb41 Makes the tests take parameters at runtime so that you can selectively run a suite without having to run the entire framework.
Change-Id: I1452cace993a5ea8bdd87797d3125cd353b9218f
2014-07-03 15:38:04 -04:00
Colby Skeggs
55fde6b616 Fixed FRCSim artf2609 - double ports handled wrong.
Change-Id: I2dc59c8d3113f3024d237763eb4e2f94bb85ff1a
2014-07-03 12:23:29 -07:00
Colby Skeggs
5ddacb43c1 Fixed FRCSim artf2599.
Made the wpilibC++Sim codebase's motor control as
similar to the wpilibC++ motor control as possible.

Change-Id: I5510d952cb40c4a3def210f46a566d7102d604ee
2014-07-02 15:43:12 -07:00
Brad Miller (WPI)
65c3c0ba09 Merge "Updated the HAL, wpilibj, and wpilibc for PCM and PDP" 2014-07-02 14:04:51 -07:00
Brad Miller (WPI)
fc3ed33f77 Merge "PDP and PCM updated to rely on CtreCanNode parent class, which uses new CAN API. CtreCanNode registers the periodic tx messages and provides an rx function to child classes for easy getters and setters. Some template magic to make the PDP and PCM getters/setters easy to stamp out." 2014-07-02 14:04:35 -07:00
thomasclark
255a3a5b12 Updated the HAL, wpilibj, and wpilibc for PCM and PDP
Removed #if 0...#endif from PCM.cpp

Change-Id: I2d117c87a3fa10bddebf83706f79c2e767d22a0d

Update the HAL to the PCM/PDP changes

Change-Id: If554b650e263f174e90864f1e9ffba91daf20f7e

Update C++ to the PCM/PDP changes

Change-Id: Ia3114d4526be1dc5cc2f74fd8f7ab44f204d15f2

Updated PCM/PDP in Java

Change-Id: I8fe03afbcb1739d555e86abc0eaae1e12313d490
2014-07-02 16:49:36 -04:00
Omar Zrien
0ef5c3adfa PDP and PCM updated to rely on CtreCanNode parent class, which uses new CAN API.
CtreCanNode registers the periodic tx messages and provides an rx function to child classes for easy getters and setters.
Some template magic to make the PDP and PCM getters/setters easy to stamp out.

Change-Id: Ibdd0745af070756a282df5074504491fadfde336
2014-07-02 16:48:55 -04:00
Brad Miller (WPI)
37ebcabc4a Merge "Fixed periodic voltage status message" 2014-07-02 10:42:04 -07:00
Brad Miller (WPI)
244ee8d920 Merge "Fixed C++ deploy in Eclipse" 2014-07-02 10:41:36 -07:00
thomasclark
b97d2eb0c3 Fixed periodic voltage status message
Previously, the voltage was requested as a percentage and decoded as
a number of volts, which resulted in values being scaled wrong. The
correct message is requested now.

Change-Id: I5e81c7a4a2e2698f2e8a84ba747217e0e14f7676
2014-07-02 12:14:49 -04:00
thomasclark
ae8d22b0f2 Fixed C++ deploy in Eclipse
Eclipse now runs an ant script to deploy C++ programs, which runs the
robot program with the run-at-startup system

Change-Id: I3e63967ebc40ad3c38aa561fd303ca3c577fd2a2
2014-07-01 17:04:28 -04:00
Brad Miller (WPI)
ff8016c088 Merge "Fixes CounterTest for C++" 2014-07-01 13:01:10 -07:00
Brad Miller (WPI)
f0fb3023ad Merge "CANJaguar uses periodic status updates [artf2621]" 2014-07-01 13:00:15 -07:00
Kacper Puczydlowski
1d33edffee Fixes CounterTest for C++
Change-Id: I3446561cd255c56edd3f284a45ec4fd7efaf84e6
2014-07-01 14:16:53 -04:00
thomasclark
5bd546f1fd CANJaguar uses periodic status updates [artf2621]
All status data is now in 3 messages automatically sent periodically
by the Jaguar, removing the need to send several hundred requests
every second.

The C++ integration test was also updated to be more robust against
timing problems.

Change-Id: I13bacc6c8173ea1a2291a96ad3bd80ff5b18d16f
2014-07-01 12:02:44 -04:00
6383 changed files with 746600 additions and 469240 deletions

165
.clang-format Normal file
View File

@@ -0,0 +1,165 @@
---
BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
- Regex: '^<.*'
Priority: 2
SortPriority: 0
- Regex: '.*'
Priority: 3
SortPriority: 0
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: c++20
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
...

71
.clang-tidy Normal file
View File

@@ -0,0 +1,71 @@
Checks:
'bugprone-assert-side-effect,
bugprone-bool-pointer-implicit-conversion,
bugprone-copy-constructor-init,
bugprone-dangling-handle,
bugprone-dynamic-static-initializers,
bugprone-forward-declaration-namespace,
bugprone-forwarding-reference-overload,
bugprone-inaccurate-erase,
bugprone-incorrect-roundings,
bugprone-integer-division,
bugprone-lambda-function-name,
bugprone-misplaced-operator-in-strlen-in-alloc,
bugprone-misplaced-widening-cast,
bugprone-move-forwarding-reference,
bugprone-multiple-statement-macro,
bugprone-parent-virtual-call,
bugprone-posix-return,
bugprone-sizeof-container,
bugprone-sizeof-expression,
bugprone-spuriously-wake-up-functions,
bugprone-string-constructor,
bugprone-string-integer-assignment,
bugprone-string-literal-with-embedded-nul,
bugprone-suspicious-enum-usage,
bugprone-suspicious-include,
bugprone-suspicious-memset-usage,
bugprone-suspicious-missing-comma,
bugprone-suspicious-semicolon,
bugprone-suspicious-string-compare,
bugprone-throw-keyword-missing,
bugprone-too-small-loop-variable,
bugprone-undefined-memory-manipulation,
bugprone-undelegated-constructor,
bugprone-unhandled-self-assignment,
bugprone-unused-raii,
bugprone-virtual-near-miss,
cert-dcl58-cpp,
cert-err52-cpp,
cert-err60-cpp,
cert-mem57-cpp,
cert-oop57-cpp,
cert-oop58-cpp,
clang-diagnostic-*,
-clang-diagnostic-deprecated-declarations,
-clang-diagnostic-#warnings,
-clang-diagnostic-pedantic,
clang-analyzer-*,
cppcoreguidelines-slicing,
google-build-namespaces,
google-explicit-constructor,
google-global-names-in-headers,
google-readability-avoid-underscore-in-googletest-name,
google-readability-casting,
google-runtime-operator,
misc-definitions-in-headers,
misc-misplaced-const,
misc-new-delete-overloads,
misc-non-copyable-objects,
modernize-avoid-bind,
modernize-concat-nested-namespaces,
modernize-make-shared,
modernize-make-unique,
modernize-pass-by-value,
modernize-use-default-member-init,
modernize-use-noexcept,
modernize-use-nullptr,
modernize-use-override,
modernize-use-using,
readability-braces-around-statements'
FormatStyle: file

4
.gitattributes vendored Normal file
View File

@@ -0,0 +1,4 @@
*.gradle text eol=lf
*.java text eol=lf
*.md text eol=lf
*.xml text eol=lf

38
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1,38 @@
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.
# More details are here: https://help.github.com/articles/about-codeowners/
# The '*' pattern is global owners.
# Order is important. The last matching pattern has the most precedence.
# The folders are ordered as a tree: by depth then alphabetically.
# This should make it easy to add new rules without breaking existing ones.
# Global rule:
* @wpilibsuite/wpilib
/cameraserver/ @wpilibsuite/camera-server
/cscore/ @wpilibsuite/camera-server
/hal/ @wpilibsuite/hardware
/hal/src/main/java/**/sim/ @wpilibsuite/simulation
/hal/src/main/native/include/mockdata/ @wpilibsuite/simulation
/hal/src/main/native/include/simulation/ @wpilibsuite/simulation
/hal/src/main/native/sim/ @wpilibsuite/simulation
/ntcore/ @wpilibsuite/network-tables
/simulation/ @wpilibsuite/simulation
/wpilibNewCommands/ @wpilibsuite/commandbased
/wpilibOldCommands/ @wpilibsuite/commandbased
/wpilibcExamples/ @wpilibsuite/wpilib @wpilibsuite/documentation
/wpilibjExamples/ @wpilibsuite/wpilib @wpilibsuite/documentation
/wpiutil/ @PeterJohnson

31
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. ...
2. ...
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- WPILib Version: [e.g. 2021.3.1]
- OS: [e.g. Windows 11]
- Java version [e.g. 1.10.2]
- C++ version [e.g. 17]
**Additional context**
Add any other context about the problem here.

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

20
.github/ISSUE_TEMPLATE/question.md vendored Normal file
View File

@@ -0,0 +1,20 @@
---
name: Question
about: Ask about features or parts of this project
title: ''
labels: ''
assignees: ''
---
**Describe the question you have.**
A clear and concise description of what you want clarification on.
**Describe the reason for your confusion.**
A clear and concise description of why the question requires clarification and what's confusing.
**Is your question related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Additional context**
Add any other context or screenshots about the question here.

56
.github/workflows/cmake.yml vendored Normal file
View File

@@ -0,0 +1,56 @@
name: CMake
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
name: Linux
container: wpilib/roborio-cross-ubuntu:2023-22.04
flags: ""
- os: macOS-11
name: macOS
container: ""
flags: "-DWITH_JAVA=OFF"
name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v3
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libopencv-dev libopencv4.5-java python-is-python3
- name: Install opencv (macOS)
run: brew install opencv
if: runner.os == 'macOS'
- name: Set up Python 3.8 (macOS)
if: runner.os == 'macOS'
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install jinja
run: python -m pip install jinja2
- name: configure
run: mkdir build && cd build && cmake ${{ matrix.flags }} ..
- name: build
working-directory: build
run: cmake --build . --parallel $(nproc)
- name: test
working-directory: build
run: ctest --output-on-failure

64
.github/workflows/comment-command.yml vendored Normal file
View File

@@ -0,0 +1,64 @@
name: Comment Commands
on:
issue_comment:
types: [ created ]
jobs:
format:
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/format')
runs-on: ubuntu-22.04
steps:
- name: React Rocket
uses: actions/github-script@v4
with:
script: |
const {owner, repo} = context.issue
github.reactions.createForIssueComment({
owner,
repo,
comment_id: context.payload.comment.id,
content: "rocket",
});
- uses: actions/checkout@v3
with:
token: ${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}
- name: Fetch all history and metadata
run: |
git fetch --prune --unshallow
git checkout -b pr
git branch -f main origin/main
- name: Checkout PR
run: |
gh pr checkout $NUMBER
env:
GITHUB_TOKEN: "${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}"
NUMBER: ${{ github.event.issue.number }}
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- name: Install clang-format
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo sh -c "echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list"
sudo apt-get update -q
sudo apt-get install -y clang-format-14
- name: Install wpiformat
run: pip3 install wpiformat
- name: Run wpiformat
run: wpiformat -clang 14
- name: Run spotlessApply
run: ./gradlew spotlessApply
- name: Commit
run: |
# Set credentials
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Commit
git commit -am "Formatting fixes"
git push

64
.github/workflows/documentation.yml vendored Normal file
View File

@@ -0,0 +1,64 @@
name: Documentation
on: [push, workflow_dispatch]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
BASE_PATH: allwpilib/docs
jobs:
publish:
name: "Documentation - Publish"
runs-on: ubuntu-22.04
if: github.repository_owner == 'wpilibsuite' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
concurrency: ci-docs-publish
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 13
- name: Set environment variables (Development)
run: |
echo "TARGET_FOLDER=$BASE_PATH/development" >> $GITHUB_ENV
if: github.ref == 'refs/heads/main'
- name: Set environment variables (Tag)
run: |
echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
echo "TARGET_FOLDER=$BASE_PATH/beta" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: Set environment variables (Release)
run: |
echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
echo "TARGET_FOLDER=$BASE_PATH/release" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'alpha') && !contains(github.ref, 'beta')
- name: Build with Gradle
run: ./gradlew docs:generateJavaDocs docs:doxygen -PbuildServer ${{ env.EXTRA_GRADLE_ARGS }}
- name: Install SSH Client 🔑
uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.GH_DEPLOY_KEY }}
- name: Deploy Java 🚀
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
SSH: true
REPOSITORY_NAME: wpilibsuite/wpilibsuite.github.io
BRANCH: main
CLEAN: true
FOLDER: docs/build/docs/javadoc
TARGET_FOLDER: ${{ env.TARGET_FOLDER }}/java
- name: Deploy C++ 🚀
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
SSH: true
REPOSITORY_NAME: wpilibsuite/wpilibsuite.github.io
BRANCH: main
CLEAN: true
FOLDER: docs/build/docs/doxygen/html
TARGET_FOLDER: ${{ env.TARGET_FOLDER }}/cpp

View File

@@ -0,0 +1,14 @@
name: "Validate Gradle Wrapper"
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1

194
.github/workflows/gradle.yml vendored Normal file
View File

@@ -0,0 +1,194 @@
name: Gradle
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build-docker:
strategy:
fail-fast: false
matrix:
include:
- container: wpilib/roborio-cross-ubuntu:2023-22.04
artifact-name: Athena
build-options: "-Ponlylinuxathena"
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04
artifact-name: Arm32
build-options: "-Ponlylinuxarm32"
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04
artifact-name: Arm64
build-options: "-Ponlylinuxarm64"
- container: wpilib/ubuntu-base:22.04
artifact-name: Linux
build-options: "-Ponlylinuxx86-64"
name: "Build - ${{ matrix.artifact-name }}"
runs-on: ubuntu-22.04
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set release environment variable
run: echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: Build with Gradle
run: ./gradlew build --build-cache -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
env:
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact-name }}
path: build/allOutputs
build-host:
env:
MACOSX_DEPLOYMENT_TARGET: 10.15
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
artifact-name: Win64Debug
architecture: x64
task: "build"
build-options: "-PciDebugOnly --max-workers 1"
outputs: "build/allOutputs"
- os: windows-2022
artifact-name: Win64Release
architecture: x64
build-options: "-PciReleaseOnly --max-workers 1"
task: "copyAllOutputs"
outputs: "build/allOutputs"
- os: macOS-11
artifact-name: macOS
architecture: x64
task: "build"
outputs: "build/allOutputs"
- os: windows-2022
artifact-name: Win32
architecture: x86
task: ":ntcoreffi:build"
outputs: "ntcoreffi/build/outputs"
name: "Build - ${{ matrix.artifact-name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
architecture: ${{ matrix.architecture }}
- name: Import Developer ID Certificate
uses: wpilibsuite/import-signing-certificate@v1
with:
certificate-data: ${{ secrets.APPLE_CERTIFICATE_DATA }}
certificate-passphrase: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
keychain-password: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
if: |
matrix.artifact-name == 'macOS' && (github.repository_owner == 'wpilibsuite' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
- name: Set Keychain Lock Timeout
run: security set-keychain-settings -lut 3600
if: |
matrix.artifact-name == 'macOS' && (github.repository_owner == 'wpilibsuite' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
- name: Set release environment variable
run: echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
shell: bash
if: startsWith(github.ref, 'refs/tags/v')
- name: Set Java Heap Size
run: sed -i 's/-Xmx2g/-Xmx1g/g' gradle.properties
if: matrix.artifact-name == 'Win32'
- name: Build with Gradle
run: ./gradlew ${{ matrix.task }} --build-cache -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
env:
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: Sign Libraries with Developer ID
run: ./gradlew copyAllOutputs --build-cache -PbuildServer -PskipJavaFormat -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }} ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
if: |
matrix.artifact-name == 'macOS' && (github.repository_owner == 'wpilibsuite' &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.outputs }}
build-documentation:
name: "Build - Documentation"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 13
- name: Set release environment variable
run: echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: Build with Gradle
run: ./gradlew docs:zipDocs --build-cache -PbuildServer ${{ env.EXTRA_GRADLE_ARGS }}
env:
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- uses: actions/upload-artifact@v3
with:
name: Documentation
path: docs/build/outputs
combine:
name: Combine
needs: [build-docker, build-host, build-documentation]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
repository: wpilibsuite/build-tools
- uses: actions/download-artifact@v3
with:
path: combiner/products/build/allOutputs
- name: Flatten Artifacts
run: rsync -a --delete combiner/products/build/allOutputs/*/* combiner/products/build/allOutputs/
- name: Check version number exists
run: |
cat combiner/products/build/allOutputs/version.txt
test -s combiner/products/build/allOutputs/version.txt
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- name: Combine
if: |
!startsWith(github.ref, 'refs/tags/v') &&
github.ref != 'refs/heads/main'
run: cd combiner && ./gradlew publish -Pallwpilib
- name: Combine (Master)
if: |
github.repository_owner == 'wpilibsuite' &&
github.ref == 'refs/heads/main'
run: cd combiner && ./gradlew publish -Pallwpilib
env:
RUN_AZURE_ARTIFACTORY_RELEASE: "TRUE"
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: Combine (Release)
if: |
github.repository_owner == 'wpilibsuite' &&
startsWith(github.ref, 'refs/tags/v')
run: cd combiner && ./gradlew publish -Pallwpilib -PreleaseRepoPublish
env:
RUN_AZURE_ARTIFACTORY_RELEASE: "TRUE"
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
- uses: actions/upload-artifact@v3
with:
name: Maven
path: ~/releases

118
.github/workflows/lint-format.yml vendored Normal file
View File

@@ -0,0 +1,118 @@
name: Lint and Format
on:
pull_request:
push:
branches-ignore:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
wpiformat:
name: "wpiformat"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Fetch all history and metadata
run: |
git config --global --add safe.directory /__w/allwpilib/allwpilib
git fetch --prune --unshallow
git checkout -b pr
git branch -f main origin/main
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install clang-format
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo sh -c "echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list"
sudo apt-get update -q
sudo apt-get install -y clang-format-14
- name: Install wpiformat
run: pip3 install wpiformat
- name: Run
run: wpiformat -clang 14
- name: Check output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > wpiformat-fixes.patch
if: ${{ failure() }}
- uses: actions/upload-artifact@v3
with:
name: wpiformat fixes
path: wpiformat-fixes.patch
if: ${{ failure() }}
- name: Write to job summary
run: |
echo '```diff' >> $GITHUB_STEP_SUMMARY
cat wpiformat-fixes.patch >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
if: ${{ failure() }}
tidy:
name: "clang-tidy"
runs-on: ubuntu-22.04
container: wpilib/roborio-cross-ubuntu:2023-22.04
steps:
- uses: actions/checkout@v3
- name: Fetch all history and metadata
run: |
git config --global --add safe.directory /__w/allwpilib/allwpilib
git fetch --prune --unshallow
git checkout -b pr
git branch -f main origin/main
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install clang-tidy
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo sh -c "echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list"
sudo apt-get update -q
sudo apt-get install -y clang-tidy-14 clang-format-14
- name: Install wpiformat
run: pip3 install wpiformat
- name: Create compile_commands.json
run: ./gradlew generateCompileCommands -Ptoolchain-optional-roboRio
- name: List changed files
run: wpiformat -list-changed-files
- name: Run clang-tidy
run: wpiformat -clang 14 -no-format -tidy-changed -compile-commands=build/compile_commands/linuxx86-64 -vv
javaformat:
name: "Java format"
runs-on: ubuntu-22.04
container: wpilib/ubuntu-base:22.04
steps:
- uses: actions/checkout@v3
- name: Fetch all history and metadata
run: |
git config --global --add safe.directory /__w/allwpilib/allwpilib
git fetch --prune --unshallow
git checkout -b pr
git branch -f main origin/main
- name: Run Java format
run: ./gradlew javaFormat spotbugsMain spotbugsTest spotbugsDev
- name: Check output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
run: git diff HEAD > javaformat-fixes.patch
if: ${{ failure() }}
documentation:
name: "Documentation"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 13
- name: Build with Gradle
run: ./gradlew docs:zipDocs -PbuildServer -PdocWarningsAsErrors ${{ env.EXTRA_GRADLE_ARGS }}

48
.github/workflows/sanitizers.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: Sanitizers
on: [pull_request, push]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- name: asan
cmake-flags: "-DCMAKE_BUILD_TYPE=Asan"
ctest-env: ""
ctest-flags: "-E 'wpilibc'"
- name: tsan
cmake-flags: "-DCMAKE_BUILD_TYPE=Tsan"
ctest-env: "TSAN_OPTIONS=second_deadlock_stack=1"
ctest-flags: "-E 'cscore|cameraserver|wpilibc|wpilibNewCommands'"
- name: ubsan
cmake-flags: "-DCMAKE_BUILD_TYPE=Ubsan"
ctest-env: ""
ctest-flags: ""
name: "${{ matrix.name }}"
runs-on: ubuntu-22.04
container: wpilib/roborio-cross-ubuntu:2023-22.04
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get install -y libopencv-dev libopencv4.5-java python-is-python3 clang-14
- name: Install jinja
run: python -m pip install jinja2
- name: configure
run: mkdir build && cd build && cmake -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang-14 -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++-14 ${{ matrix.cmake-flags }} ..
- name: build
working-directory: build
run: cmake --build . --parallel $(nproc)
- name: test
working-directory: build
run: ${{ matrix.ctest-env }} ctest --output-on-failure ${{ matrix.ctest-flags }}

67
.github/workflows/upstream-utils.yml vendored Normal file
View File

@@ -0,0 +1,67 @@
name: Upstream utils
on:
pull_request:
push:
branches-ignore:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
update:
name: "Update"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Fetch all history and metadata
run: |
git fetch --prune --unshallow
git checkout -b pr
git branch -f main origin/main
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Configure committer identity
run: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
- name: Run update_drake.py
run: |
cd upstream_utils
./update_drake.py
- name: Run update_eigen.py
run: |
cd upstream_utils
./update_eigen.py
- name: Run update_fmt.py
run: |
cd upstream_utils
./update_fmt.py
- name: Run update_libuv.py
run: |
cd upstream_utils
./update_libuv.py
- name: Run update_llvm.py
run: |
cd upstream_utils
./update_llvm.py
- name: Run update_mpack.py
run: |
cd upstream_utils
./update_mpack.py
- name: Run update_stack_walker.py
run: |
cd upstream_utils
./update_stack_walker.py
- name: Run update_memory.py
run: |
cd upstream_utils
./update_memory.py
- name: Add untracked files to index so they count as changes
run: git add -A
- name: Check output
run: git --no-pager diff --exit-code HEAD

246
.gitignore vendored
View File

@@ -1,20 +1,86 @@
wpilibc/build/
hal/build/
networktables/cpp/build/
build/
networktables/OutlineViewer/nbproject/private
*~
target/
dist/
bin/
.project
.cproject
.settings/
.classpath
# WPIlib Specific
#Java File extentions
dependency-reduced-pom.xml
doxygen.log
build*/
!buildSrc/
simgui-ds.json
simgui-window.json
simgui.json
networktables.json
# Created by the jenkins test script
test-reports
# IntelliJ
*.iml
*.ipr
*.iws
.idea/
out/
# Fleet
.fleet
# Created by http://www.gitignore.io
### Linux ###
*~
# KDE directory preferences
.directory
### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Java ###
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
@@ -22,3 +88,155 @@ bin/
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### C++ ###
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Compiled Dynamic libraries
*.dylib
*.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
### CMake ###
CMakeCache.txt
CMakeFiles
cmake_install.cmake
install_manifest.txt
### Gradle ###
.gradle
build/
# Ignore Gradle GUI config
gradle-app.setting
### Vagrant ###
.vagrant/
### Eclipse ###
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
### Python ###
*.pyc
__pycache__
# Gradle wrapper
!gradle-wrapper.jar
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
# sbteclipse plugin
.target
# TeXlipse plugin
.texlipse
#catkin stuff
package.xml
# Doxygen stuff
NO
# Simulation folder stuff
!simulation/install_resources/*
# VSCode
.vscode/
#classpaths and projects
.project
.classpath
#Visual Studio
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.cachefile
*.VC.db
*.VC.VC.opendb
*.VC.db-shm
*.VC.db-wal
*.sln
*.vcxproj
*.vcxproj.filters
# Visual Studio 2015 cache/options directory
.vs/
# compile_commands
compile_commands.json
# clang configuration and clangd cache
.clang
.clangd/
.cache/
imgui.ini
# Bazel
/.ijwb/
/bazel-*
user.bazelrc
coverage_report/

View File

@@ -1,5 +0,0 @@
[gerrit]
host=usfirst.collab.net
port=29418
project=allwpilib
defaultbranch=master

View File

@@ -1,13 +0,0 @@
syntax: re
^\.hgignore$
.*/target(?:/|$)
.*/dist(?:/|$)
eclipse-plugins/.*/bin(?:/|$)
syntax: glob
wpilibc/build/
hal/build/
networktables/cpp/build/
build/
networktables/OutlineViewer/nbproject/private
*~

49
.styleguide Normal file
View File

@@ -0,0 +1,49 @@
cppHeaderFileInclude {
\.h$
\.hpp$
\.inc$
\.inl$
}
cppSrcFileInclude {
\.cpp$
}
modifiableFileExclude {
\.patch$
gradlew
}
generatedFileExclude {
FRCNetComm\.java$
simulation/gz_msgs/src/include/simulation/gz_msgs/msgs\.h$
fieldImages/src/main/native/resources/
apriltag/src/test/resources/
}
repoRootNameOverride {
wpilib
}
includeOtherLibs {
^Eigen/
^cameraserver/
^cscore
^drake/
^fmt/
^hal/
^imgui
^implot
^mockdata/
^networktables/
^ntcore
^opencv2/
^support/
^units/
^unsupported/
^vision/
^wpi/
^wpigui
^wpimath/
^wpinet/
}

3
.styleguide-license Normal file
View File

@@ -0,0 +1,3 @@
// 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.

View File

@@ -0,0 +1,6 @@
{
"enableCppIntellisense": true,
"currentLanguage": "cpp",
"projectYear": "intellisense",
"teamNumber": 0
}

View File

@@ -1,29 +0,0 @@
Building everything requires Maven
mvn package -DembeddedJDKHome=/home/patrick/Downloads/arm-jdk1.7.0_45/
TODO... Explain maven....
TODO.. how to import into eclipse correctly...
Building C++ only
------------------
C++ requires cmake if not run from maven, and is much faster.
Make a new directory and then run:
```
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../arm-toolchain.cmake
make # multicore add -j(num of cpu cores + 1), so -j3 on dual core for faster compile
make install DESTDIR=/some/dir/you/want/to/put/all/headers/and/libs #optional
``
Alternatively, if you like IDEs, you can import it directly into QtDeveloper, or a number of other IDEs such as Code::Blocks or Eclipse. See CMake documentation for details.
Eclipse demo:
```
cd ..
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../allwpilib/arm-toolchain.cmake .. -G "Eclipse CDT4 - Unix Makefiles"
```
and then import that directory into eclipse. Eclipse will detect a CDT project and standard tools will work.
GCC versions
------------
Update arm-toolchain.cmake if the triplet changes (eg using Ubuntu repo arm compiler is arm-linux-gnueabi) or in a non-standard location. Currently it assumes that the compiler is on the path.

View File

@@ -1,12 +1,333 @@
cmake_minimum_required(VERSION 2.8)
project(All-WPILib)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=2 -Wextra -Wno-unused-parameter -fPIC")
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
# Disable in-source builds to prevent source tree corruption.
if(" ${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL " ${CMAKE_CURRENT_BINARY_DIR}")
message(FATAL_ERROR "
FATAL: In-source builds are not allowed.
You should create a separate directory for build files.
")
endif()
file(GLOB_RECURSE NI_LIBS ni-libraries/*.so*)
get_filename_component(HAL_API_INCLUDES hal/include REALPATH)
get_filename_component(NWT_API_INCLUDES networktables/cpp/include REALPATH)
add_subdirectory(hal)
add_subdirectory(networktables/cpp)
add_subdirectory(wpilibc)
if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
set(CMAKE_SYSTEM_VERSION 10.0.18362.0 CACHE STRING INTERNAL FORCE)
set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION 10.0.18362.0 CACHE STRING INTERNAL FORCE)
endif()
project(allwpilib)
cmake_minimum_required(VERSION 3.3.0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
message(STATUS "Platform version: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
set(WPILIB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
INCLUDE(CPack)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${WPILIB_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${WPILIB_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${WPILIB_BINARY_DIR}/bin)
set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${WPILIB_BINARY_DIR}/jar)
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")
# Options for building certain parts of the repo. Everything is built by default.
option(BUILD_SHARED_LIBS "Build with shared libs (needed for JNI)" ON)
option(WITH_JAVA "Include java and JNI in the build" ON)
option(WITH_CSCORE "Build cscore (needs OpenCV)" ON)
option(WITH_NTCORE "Build ntcore" ON)
option(WITH_WPIMATH "Build wpimath" ON)
option(WITH_WPILIB "Build hal, wpilibc/j, and myRobot (needs OpenCV)" ON)
option(WITH_EXAMPLES "Build examples" OFF)
option(WITH_TESTS "Build unit tests (requires internet connection)" ON)
option(WITH_GUI "Build GUI items" ON)
option(WITH_SIMULATION_MODULES "Build simulation modules" ON)
# Options for external HAL.
option(WITH_EXTERNAL_HAL "Use a separately built HAL" OFF)
set(EXTERNAL_HAL_FILE "" CACHE FILEPATH "Location to look for an external HAL CMake File")
# Options for using a package manager (e.g., vcpkg) for certain dependencies.
option(USE_SYSTEM_FMTLIB "Use system fmtlib" OFF)
option(USE_SYSTEM_LIBUV "Use system libuv" OFF)
option(USE_SYSTEM_EIGEN "Use system eigen" OFF)
# Options for installation.
option(WITH_FLAT_INSTALL "Use a flat install directory" OFF)
# Options for location of OpenCV Java.
set(OPENCV_JAVA_INSTALL_DIR "" CACHE PATH "Location to search for the OpenCV jar file")
# Set default build type to release with debug info (i.e. release mode optimizations
# are performed, but debug info still exists).
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "" FORCE)
endif()
# We always want flat install with MSVC.
if (MSVC)
set(WITH_FLAT_INSTALL ON)
endif()
if (WITH_JAVA AND NOT BUILD_SHARED_LIBS)
message(FATAL_ERROR "
FATAL: Cannot build static libs with Java enabled.
Static libs requires both BUILD_SHARED_LIBS=OFF and
WITH_JAVA=OFF
")
endif()
if (WITH_SIMULATION_MODULES AND NOT BUILD_SHARED_LIBS)
message(FATAL_ERROR "
FATAL: Cannot build static libs with simulation modules enabled.
Static libs requires both BUILD_SHARED_LIBS=OFF and
WITH_SIMULATION_MODULES=OFF
")
endif()
if (NOT WITH_JAVA OR NOT WITH_CSCORE)
if(NOT "${OPENCV_JAVA_INSTALL_DIR}" STREQUAL "")
message(WARNING "
WARNING: OpenCV Java dir set but java is not enabled!
It will be ignored.
")
endif()
endif()
if (NOT WITH_WPILIB AND WITH_SIMULATION_MODULES)
message(FATAL_ERROR "
FATAL: Cannot build simulation modules with wpilib disabled.
Enable wpilib by setting WITH_WPILIB=ON
")
endif()
if (NOT WITH_NTCORE AND WITH_CSCORE)
message(FATAL_ERROR "
FATAL: Cannot build cameraserver without ntcore.
Enable ntcore by setting WITH_NTCORE=ON
")
endif()
if (NOT WITH_NTCORE AND WITH_GUI)
message(FATAL_ERROR "
FATAL: Cannot build GUI modules without ntcore.
Enable ntcore by setting WITH_NTCORE=ON
")
endif()
if (NOT WITH_NTCORE AND WITH_SIMULATION_MODULES)
message(FATAL_ERROR "
FATAL: Cannot build simulation modules without ntcore.
Enable ntcore by setting WITH_NTCORE=ON
")
endif()
if (NOT WITH_NTCORE AND WITH_WPILIB)
message(FATAL_ERROR "
FATAL: Cannot build wpilib without ntcore.
Enable ntcore by setting WITH_NTCORE=ON
")
endif()
if (NOT WITH_WPIMATH AND WITH_WPILIB)
message(FATAL_ERROR "
FATAL: Cannot build wpilib without wpimath.
Enable wpimath by setting WITH_WPIMATH=ON
")
endif()
set( wpilib_dest "")
set( include_dest include )
set( main_lib_dest lib )
set( java_lib_dest java )
set( jni_lib_dest jni )
if (WITH_FLAT_INSTALL)
set (wpilib_config_dir ${wpilib_dest})
else()
set (wpilib_config_dir share/wpilib)
endif()
if (USE_SYSTEM_LIBUV)
set (LIBUV_SYSTEM_REPLACE "
find_package(PkgConfig REQUIRED)
pkg_check_modules(libuv REQUIRED IMPORTED_TARGET libuv)
")
endif()
if (USE_SYSTEM_EIGEN)
set (EIGEN_SYSTEM_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(WPINET_DEP_REPLACE "include($\{SELF_DIR\}/wpinet-config.cmake)")
set(NTCORE_DEP_REPLACE "include($\{SELF_DIR\}/ntcore-config.cmake)")
set(CSCORE_DEP_REPLACE_IMPL "include(\${SELF_DIR}/cscore-config.cmake)")
set(CAMERASERVER_DEP_REPLACE_IMPL "include(\${SELF_DIR}/cameraserver-config.cmake)")
set(HAL_DEP_REPLACE_IMPL "include(\${SELF_DIR}/hal-config.cmake)")
set(WPIMATH_DEP_REPLACE "include($\{SELF_DIR\}/wpimath-config.cmake)")
set(WPILIBC_DEP_REPLACE_IMPL "include(\${SELF_DIR}/wpilibc-config.cmake)")
set(WPILIBNEWCOMMANDS_DEP_REPLACE "include(\${SELF_DIR}/wpilibNewcommands-config.cmake)")
else()
set(WPIUTIL_DEP_REPLACE "find_dependency(wpiutil)")
set(WPINET_DEP_REPLACE "find_dependency(wpinet)")
set(NTCORE_DEP_REPLACE "find_dependency(ntcore)")
set(CSCORE_DEP_REPLACE_IMPL "find_dependency(cscore)")
set(CAMERASERVER_DEP_REPLACE_IMPL "find_dependency(cameraserver)")
set(HAL_DEP_REPLACE_IMPL "find_dependency(hal)")
set(WPIMATH_DEP_REPLACE "find_dependency(wpimath)")
set(WPILIBC_DEP_REPLACE_IMPL "find_dependency(wpilibc)")
set(WPILIBNEWCOMMANDS_DEP_REPLACE "find_dependency(wpilibNewCommands)")
endif()
set(FILENAME_DEP_REPLACE "get_filename_component(SELF_DIR \"$\{CMAKE_CURRENT_LIST_FILE\}\" PATH)")
set(SELF_DIR "$\{SELF_DIR\}")
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(isMultiConfig)
if(NOT "Asan" IN_LIST CMAKE_CONFIGURATION_TYPES)
list(APPEND CMAKE_CONFIGURATION_TYPES Asan)
endif()
if(NOT "Tsan" IN_LIST CMAKE_CONFIGURATION_TYPES)
list(APPEND CMAKE_CONFIGURATION_TYPES Tsan)
endif()
if(NOT "Ubsan" IN_LIST CMAKE_CONFIGURATION_TYPES)
list(APPEND CMAKE_CONFIGURATION_TYPES Ubsan)
endif()
else()
set(allowedBuildTypes Asan Tsan Ubsan Debug Release RelWithDebInfo MinSizeRel)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${allowedBuildTypes}")
if(CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE IN_LIST allowedBuildTypes)
message(FATAL_ERROR "Invalid build type: ${CMAKE_BUILD_TYPE}")
endif()
endif()
set(CMAKE_C_FLAGS_ASAN
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C compiler for Asan build type or configuration." FORCE)
set(CMAKE_CXX_FLAGS_ASAN
"${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C++ compiler for Asan build type or configuration." FORCE)
set(CMAKE_EXE_LINKER_FLAGS_ASAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address" CACHE STRING
"Linker flags to be used to create executables for Asan build type." FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_ASAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address" CACHE STRING
"Linker lags to be used to create shared libraries for Asan build type." FORCE)
set(CMAKE_C_FLAGS_TSAN
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=thread -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C compiler for Tsan build type or configuration." FORCE)
set(CMAKE_CXX_FLAGS_TSAN
"${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=thread -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C++ compiler for Tsan build type or configuration." FORCE)
set(CMAKE_EXE_LINKER_FLAGS_TSAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=thread" CACHE STRING
"Linker flags to be used to create executables for Tsan build type." FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_TSAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=thread" CACHE STRING
"Linker lags to be used to create shared libraries for Tsan build type." FORCE)
set(CMAKE_C_FLAGS_UBSAN
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C compiler for Ubsan build type or configuration." FORCE)
set(CMAKE_CXX_FLAGS_UBSAN
"${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C++ compiler for Ubsan build type or configuration." FORCE)
set(CMAKE_EXE_LINKER_FLAGS_UBSAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=undefined -fno-sanitize-recover=all" CACHE STRING
"Linker flags to be used to create executables for Ubsan build type." FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_UBSAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=undefined" CACHE STRING
"Linker lags to be used to create shared libraries for Ubsan build type." FORCE)
if (WITH_TESTS)
enable_testing()
add_subdirectory(googletest)
include(GoogleTest)
endif()
add_subdirectory(wpiutil)
if (WITH_NTCORE)
add_subdirectory(wpinet)
add_subdirectory(ntcore)
endif()
if (WITH_WPIMATH)
add_subdirectory(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)
add_subdirectory(datalogtool)
endif()
endif()
if (WITH_WPILIB OR WITH_SIMULATION_MODULES)
set(HAL_DEP_REPLACE ${HAL_DEP_REPLACE_IMPL})
add_subdirectory(hal)
endif()
if (WITH_CSCORE)
set(CSCORE_DEP_REPLACE ${CSCORE_DEP_REPLACE_IMPL})
set(CAMERASERVER_DEP_REPLACE ${CAMERASERVER_DEP_REPLACE_IMPL})
add_subdirectory(cscore)
add_subdirectory(cameraserver)
endif()
if (WITH_WPILIB)
set(WPILIBC_DEP_REPLACE ${WPILIBC_DEP_REPLACE_IMPL})
add_subdirectory(apriltag)
add_subdirectory(wpilibj)
add_subdirectory(wpilibc)
add_subdirectory(wpilibNewCommands)
if (WITH_EXAMPLES)
add_subdirectory(wpilibcExamples)
endif()
add_subdirectory(myRobot)
endif()
if (WITH_SIMULATION_MODULES AND NOT WITH_EXTERNAL_HAL)
add_subdirectory(simulation)
endif()
configure_file(wpilib-config.cmake.in ${WPILIB_BINARY_DIR}/wpilib-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/wpilib-config.cmake DESTINATION ${wpilib_config_dir})

131
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,131 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Exhibiting Gracious Professionalism® at all times. Gracious Professionalism
is a way of doing things that encourages high-quality work, emphasizes the
value of others, and respects individuals and the community.
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[conduct@wpilib.org](mailto:conduct@wpilib.org).
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

88
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,88 @@
# Contributing to WPILib
So you want to contribute your changes back to WPILib. Great! We have a few contributing rules that will help you make sure your changes will be accepted into the project. Please remember to follow the rules in the [code of conduct](https://github.com/wpilibsuite/allwpilib/blob/main/CODE_OF_CONDUCT.md), and behave with Gracious Professionalism.
- [General Contribution Rules](#general-contribution-rules)
- [What to Contribute](#what-to-contribute)
- [Coding Guidelines](#coding-guidelines)
- [Submitting Changes](#submitting-changes)
- [Pull Request Format](#pull-request-format)
- [Merge Process](#merge-process)
- [Licensing](#licensing)
## General Contribution Rules
- Everything in the library must work for the 3000+ teams that will be using it.
- We need to be able to maintain submitted changes, even if you are no longer working on the project.
- Tool suite changes must be generally useful to a broad range of teams
- Excluding bug fixes, changes in one language generally need to have corresponding changes in other languages.
- Some features, such the addition of C++11 for WPILibC or Functional Interfaces for WPILibJ, are specific to that version of WPILib only.
- Substantial changes often need to have corresponding LabVIEW changes. To do this, we will work with NI on these large changes.
- Changes should have tests.
- Code should be well documented.
- This involves writing tutorials and/or usage guides for your submitted feature. These articles are then hosted on the [WPILib](https://docs.wpilib.org/) documentation website. See the [frc-docs repository](https://github.com/wpilibsuite/frc-docs) for more information.
## What to Contribute
- Bug reports and fixes
- We will generally accept bug fixes without too much question. If they are only implemented for one language, we will implement them for any other necessary languages. Bug reports are also welcome, please submit them to our GitHub issue tracker.
- While we do welcome improvements to the API, there are a few important rules to consider:
- Features must be added to both WPILibC and WPILibJ, with rare exceptions.
- During competition season, we will not merge any new feature additions. We want to ensure that the API is stable during the season to help minimize issues for teams.
- Ask about large changes before spending a bunch of time on them! You can create a new issue on our GitHub tracker for feature request/discussion and talk about it with us there.
- Features that make it easier for teams with less experience to be more successful are more likely to be accepted.
- Features in WPILib should be broadly applicable to all teams. Anything that is team specific should not be submitted.
- As a rule, we are happy with the general structure of WPILib. We are not interested in major rewrites of all of WPILib. We are open to talking about ideas, but backwards compatibility is very important for WPILib, so be sure to keep this in mind when proposing major changes.
- Generally speaking, we do not accept code for specific sensors. We have to be able to test the sensor in hardware on the WPILib test bed. Additionally, hardware availability for teams is important. Therefore, as a general rule, the library only directly supports hardware that is in the Kit of Parts. If you are a company interested in getting a sensor into the Kit of Parts, please contact FIRST directly at frcparts@firstinspires.org.
## Coding Guidelines
WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running wpiformat is required for all contributions and is enforced by our continuous integration system.
While the library should be fully formatted according to the styles, additional elements of the style guide were not followed when the library was initially created. All new code should follow the guidelines. If you are looking for some easy ramp-up tasks, finding areas that don't follow the style guide and fixing them is very welcome.
### Math documentation
When writing math expressions in documentation, use https://www.unicodeit.net/ to convert LaTeX to a Unicode equivalent that's easier to read. Not all expressions will translate (e.g., superscripts of superscripts) so focus on making it readable by someone who isn't familiar with LaTeX. If content on multiple lines needs to be aligned in Doxygen/Javadoc comments (e.g., integration/summation limits, matrices packed with square brackets and superscripts for them), put them in @verbatim/@endverbatim blocks in Doxygen or `<pre>` tags in Javadoc so they render with monospace font.
The LaTeX to Unicode conversions can also be done locally via the unicodeit Python package. To install it, execute:
```bash
pip install --user unicodeit
```
Here's example usage:
```bash
$ python -m unicodeit.cli 'x_{k+1} = Ax_k + Bu_k'
xₖ₊₁ = Axₖ + Buₖ
```
On Linux, this process can be streamlined further by adding the following Bash function to your .bashrc (requires `wl-clipboard` on Wayland or `xclip` on X11):
```bash
# Converts LaTeX to Unicode, prints the result, and copies it to the clipboard
uc() {
if [ $WAYLAND_DISPLAY ]; then
python -m unicodeit.cli $@ | tee >(wl-copy -n)
else
python -m unicodeit.cli $@ | tee >(xclip -sel)
fi
}
```
Here's example usage:
```bash
$ uc 'x_{k+1} = Ax_k + Bu_k'
xₖ₊₁ = Axₖ + Buₖ
```
## Submitting Changes
### Pull Request Format
Changes should be submitted as a Pull Request against the main branch of WPILib. For most changes, commits will be squashed upon merge. For particularly large changes, multiple commits are ok, but assume one commit unless asked otherwise. We may ask you to break a PR into multiple standalone PRs or commits for rebase within one PR to separate unrelated changes. No change will be merged unless it is up to date with the current main branch. We do this to make sure that the git history isn't too cluttered.
### Merge Process
When you first submit changes, GitHub Actions will attempt to run `./gradlew check` on your change. If this fails, you will need to fix any issues that it sees. Once Actions passes, we will begin the review process in more earnest. One or more WPILib team members will review your change. This will be a back-and-forth process with the WPILib team and the greater community. Once we are satisfied that your change is ready, we will allow our hosted instance to test it. This will run the full gamut of checks, including integration tests on actual hardware. Once all tests have passed and the team is satisfied, we will merge your change into the WPILib repository.
## Licensing
By contributing to WPILib, you agree that your code will be distributed with WPILib, and licensed under the license for the WPILib project. You should not contribute code that you do not have permission to relicense in this manner. This includes code that is licensed under the GPL that you do not have permission to relicense, as WPILib is not released under a copyleft license. Our license is the 3-clause BSD license, which you can find [here](LICENSE.md).

98
DevelopmentBuilds.md Normal file
View File

@@ -0,0 +1,98 @@
# Installing Development Builds
This article contains instructions on building projects using a development build and a local WPILib build.
**Note:** This only applies to Java/C++ teams.
## Development Build
Development builds are the per-commit build hosted every time a commit is pushed to the [allwpilib](https://github.com/wpilibsuite/allwpilib/) repository. These builds are then hosted on [artifactory](https://frcmaven.wpi.edu/artifactory/webapp/#/home).
To build a project using a development build, find the build.gradle file and open it. Then, add the following code below the plugin section and replace YEAR with the year of the development version. It is also necessary to use a 2023 GradleRIO version, ie `2023.0.0-alpha-1`
```groovy
wpi.maven.useLocal = false
wpi.maven.useDevelopment = true
wpi.versions.wpilibVersion = 'YEAR.+'
wpi.versions.wpimathVersion = 'YEAR.+
```
The top of your ``build.gradle`` file should now look similar to the code below. Ignore any differences in versions.
Java
```groovy
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2023.0.0-alpha-1"
}
wpi.maven.useLocal = false
wpi.maven.useDevelopment = true
wpi.versions.wpilibVersion = '2023.+'
wpi.versions.wpimathVersion = '2023.+'
```
C++
```groovy
plugins {
id "cpp"
id "google-test-test-suite"
id "edu.wpi.first.GradleRIO" version "2023.0.0-alpha-1"
}
wpi.maven.useLocal = false
wpi.maven.useDevelopment = true
wpi.versions.wpilibVersion = '2023.+'
wpi.versions.wpimathVersion = '2023.+'
```
### Development Build Documentation
* C++: https://github.wpilib.org/allwpilib/docs/development/cpp/
* Java: https://github.wpilib.org/allwpilib/docs/development/java/
## Local Build
Building with a local build is very similar to building with a development build. Ensure you have built and published WPILib by following the instructions attached [here](https://github.com/wpilibsuite/allwpilib#building-wpilib). Next, find the ``build.gradle`` file in your robot project and open it. Then, add the following code below the plugin section and replace ``YEAR`` with the year of the local version.
Java
```groovy
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2023.0.0-alpha-1"
}
wpi.maven.useLocal = false
wpi.maven.useFrcMavenLocalDevelopment = true
wpi.versions.wpilibVersion = 'YEAR.424242.+'
wpi.versions.wpimathVersion = 'YEAR.424242.+'
```
C++
```groovy
plugins {
id "cpp"
id "google-test-test-suite"
id "edu.wpi.first.GradleRIO" version "2023.0.0-alpha-1"
}
wpi.maven.useLocal = false
wpi.maven.useFrcMavenLocalDevelopment = true
wpi.versions.wpilibVersion = 'YEAR.424242.+'
wpi.versions.wpimathVersion = 'YEAR.424242.+'
```
# roboRIO Development
This repo contains a myRobot project built in way to do full project development without needing to do a full publish into GradleRIO. These also only require building the minimum amount of binaries for the roboRIO, so the builds are much faster as well.
The setup only works if the roboRIO is USB connected. If an alternate IP address is preferred, the `address` block in myRobot\build.gradle can be changed to point to another address.
The following 3 tasks can be used for deployment:
* `:myRobot:deployShared` deploys the C++ project using shared dependencies. Prefer this one for most C++ development.
* `:myRobot:deployStatic` deploys the C++ project with all dependencies statically linked.
* `:myRobot:deployJava` deploys the Java project and all required dependencies. Also installs the JRE if not currently installed.
Deploying any of these to the roboRIO will disable the current startup project until it is redeployed.
From here, ssh into the roboRIO using the `lvuser` account and run `frcRunRobot.sh` (It's in path).

24
LICENSE.md Normal file
View File

@@ -0,0 +1,24 @@
Copyright (c) 2009-2023 FIRST and other WPILib contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of FIRST, WPILib, nor the names of other WPILib
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS 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.

27
MAINTAINERS.md Normal file
View File

@@ -0,0 +1,27 @@
## Publishing Third Party Dependencies
Currently the 3rd party deps are imgui, opencv, and google test
For publishing these dependencies, the version needs to be manually updated in the publish.gradle file of their respective repository.
Then, in the azure build for the dependency you want to build for, manually start a pipeline build (As of current, this is the `Run Pipeline` button).
A variable needs to be added called `RUN_AZURE_ARTIFACTORY_RELEASE`, with a value of `true`. Then when the pipeline gets started, the final build outputs will be updated to artifactory.
To use newer versions of C++ dependencies, in `shared/config.gradle`, update the version related to the specific dependency.
For Java dependencies, there is likely a file related to the specific dependency in the shared folder. Update the version in there.
Note, changing artifact locations (This includes changing the artifact year currently, I have an issue open to change this) requires updating the `native-utils` plugin
## Publishing allwpilib
allwpilib publishes to the development repo on every push to main. To publish a release build, upload a new tag, and a release will automatically be built and published.
## Publishing desktop tools
Desktop tools publish to the development repo on every push to main. To publish a release build, upload a new tag, and a release will automatically be built and published.
## Publishing VS Code
Before publishing, make sure to update the gradlerio version in `vscode-wpilib/resources/gradle/version.txt` Also make sure the gradle wrapper version matches the wrapper required by gradlerio.
Upon pushing a tag, a release will be built, and the files will be uploaded to the releases on GitHub. For publishing to the marketplace, you need a Microsoft account and to be added as a maintainer.
## Publishing GradleRIO
Before publishing, make sure to update the version in build.gradle. Publishing must happen locally, using the command `./gradlew publishPlugin`. This does require your API key for publishing to be set.
## Building the installer
Update the GradleRIO version in gradle.properties, and in the scripts folder in vscode, update the vscode extension. Then push, it will build the installer on azure.

158
MavenArtifacts.md Normal file
View File

@@ -0,0 +1,158 @@
# WPILib Maven Artifacts
WPILib publishes its built artifacts to our Maven server for use by downstream projects. This document explains these locations, and the meanings of artifact names, classifiers, and versions.
## Repositories
We provide two repositories. These repositories are:
* (Release) https://frcmaven.wpi.edu/artifactory/release/
* (Development) https://frcmaven.wpi.edu/artifactory/development/
The release repository is where official WPILib releases are pushed.
The development repository is where development releases of every commit to [main](https://github.com/wpilibsuite/allwpilib/tree/main) is pushed.
## Artifact classifiers
We provide two base types of artifacts.
The first types are Java artifacts. These are usually published as `jar` files. Usually, the actual jar file is published with no classifier. The sources are published with the `-sources` classifier, and the javadocs are published with the `-javadoc` classifier.
The second types are native artifacts. These are usually published as `zip` files (except for the `JNI` artifact types, which are `jar` files. See below for information on this). The `-sources` and `-headers` classifiers contain the sources and headers respectively for the library. Each artifact also contains a classifier for each platform we publish. This platform is in the format `{os}{arch}`. The platform artifact only contains the binaries for a specific platform. In addition, we provide a `-all` classifier. This classifier combines all of the platform artifacts into a single artifact. This is useful for tools that cannot determine what version to use during builds. However, we recommend using the platform specific classifier when possible. Note that the binary artifacts never contain the headers, you always need the `-headers` classifier to get those.
## Artifact Names
WPILib builds four different types of artifacts.
##### C++ Only Libraries
When we publish C++ only libraries, they are published with the base artifact name as their artifact name, with a `-cpp` extension. All dependencies for the library are linked as shared libraries to the binary.
Example:
```
edu.wpi.first.wpilibc:wpilibc-cpp:version:classifier@zip
```
#### Java Only Libraries
When we publish Java only libraries, they are published with the base artifact name as their artifact name, with a `-java` extension.
Example:
```
edu.wpi.first.wpilibj:wpilibj-java:version
```
#### C++/Java Libraries without JNI
For libraries that are both C++ and Java, but without a JNI component, the C++ component is published with the `basename-cpp` artifact name, and the Java component is published with the `basename-java` artifact name.
Example:
```
edu.wpi.first.wpiutil:wpiutil-cpp:version:classifier@zip (C++)
edu.wpi.first.wpiutil:wpiutil-java:version (Java)
```
#### C++/Java Libraries with JNI
For libraries that are both C++ and Java with a JNI component there are three different artifact names. For Java, the component is published as `basename-java`. For C++, the `basename-cpp` artifact contains the C++ artifacts with all dependencies linked as shared libraries to the binary. These binaries DO contain the JNI entry points. The `basename-jni` artifact contains identical C++ binaries to the `-cpp` artifact, however all of its dependencies are statically linked, and only the JNI and C entry points are exported.
The `-jni` artifact should only be used in cases where you want to create a self contained Java application where the native artifacts are embedded in the jar. Note in an extraction scenario, extending off of the library is never supported, which is why the C++ entry points are not exposed. The name of the library is randomly generated during extraction. For pretty much all cases, and if you ever want to extend from a native library, you should use the `-cpp` artifacts. GradleRIO uses the `-cpp` artifacts for all platforms, even desktop, for this reason.
Example:
```
edu.wpi.first.ntcore:ntcore-cpp:version:classifier@zip (C++)
edu.wpi.first.ntcore:ntcore-jni:version:classifier (JNI jar library)
edu.wpi.first.ntcore:ntcore-java:version (Java)
```
## Provided Artifacts
This repository provides the following artifacts. Below each artifact is its dependencies. Note if ever using the `-jni` artifacts, no dependencies are needed for native binaries.
For C++, if building with static dependencies, the listed order should be the link order in your linker.
All artifacts are based at `edu.wpi.first.artifactname` in the repository.
* wpiutil
* wpigui
* imgui
* wpimath
* wpiutil
* wpinet
* wpiutil
* ntcore
* wpiutil
* wpinet
* glass/libglass
* wpiutil
* wpimath
* wpigui
* glass/libglassnt
* wpiutil
* wpinet
* ntcore
* wpimath
* wpigui
* hal
* wpiutil
* halsim
* wpiutil
* wpinet
* ntcore
* wpimath
* wpigui
* libglass
* libglassnt
* cscore
* opencv
* wpinet
* wpiutil
* cameraserver
* ntcore
* cscore
* opencv
* wpinet
* wpiutil
* wpilibj
* hal
* cameraserver
* ntcore
* cscore
* wpinet
* wpiutil
* wpilibc
* hal
* cameraserver
* ntcore
* cscore
* wpimath
* wpinet
* wpiutil
* wpilibNewCommands
* wpilibc
* hal
* cameraserver
* ntcore
* cscore
* wpimath
* wpinet
* wpiutil
### Third Party Artifacts
This repository provides the builds of the following third party software.
All artifacts are based at `edu.wpi.first.thirdparty.frcYEAR` in the repository.
* googletest
* imgui
* opencv
* libssh

157
README-CMAKE.md Normal file
View File

@@ -0,0 +1,157 @@
# WPILib CMake Support
WPILib is normally built with Gradle, however for some systems, such as Linux based coprocessors, Gradle doesn't work correctly, especially if cscore is needed, which requires OpenCV. Furthermore, the CMake build can be used for C++ development because it provides better build caching compared to Gradle. We provide the CMake build for these cases. Although it is supported on Windows, these docs will only go over Linux builds.
## Libraries that get built
* wpiutil
* ntcore
* cscore
* cameraserver
* hal
* wpilib
* halsim
* wpigui
* wpimath
By default, all libraries except for the HAL and WPILib get built with a default CMake setup. The libraries are built as shared libraries, and include the JNI libraries as well as building the Java JARs.
## Prerequisites
The most common prerequisite is going to be OpenCV. OpenCV needs to be findable by CMake. On systems like the Jetson, this is installed by default. Otherwise, you will need to build OpenCV from source and install it.
In addition, if you want JNI and Java, you will need a JDK of at least version 11 installed. In addition, you need a `JAVA_HOME` environment variable set properly and set to the JDK directory.
If you are building with unit tests or simulation modules, you will also need an Internet connection for the initial setup process, as CMake will clone google-test and imgui from GitHub.
## Build Options
The following build options are available:
* `WITH_JAVA` (ON Default)
* This option will enable Java and JNI builds. If this is on, `WITH_SHARED_LIBS` must be on. Otherwise CMake will error.
* `WITH_SHARED_LIBS` (ON Default)
* This option will cause cmake to build static libraries instead of shared libraries. If this is off, `WITH_JAVA` must be off. Otherwise CMake will error.
* `WITH_CSCORE` (ON Default)
* This option will cause cscore to be built. Turning this off will implicitly disable cameraserver, the hal and wpilib as well, irrespective of their specific options. If this is off, the OpenCV build requirement is removed.
* `WITH_NTCORE` (ON Default)
* This option will cause ntcore to be built. Turning this off will implicitly disable wpinet and wpilib as well, irrespective of their specific options.
* `WITH_WPIMATH` (ON Default)
* This option will build the wpimath library. This option must be on to build wpilib.
* `WITH_WPILIB` (ON Default)
* This option will build the hal and wpilibc/j during the build. The HAL is the simulator hal, unless the external hal options are used. The cmake build has no capability to build for the RoboRIO.
* `WITH_EXAMPLES` (ON Default)
* This option will build C++ examples.
* `WITH_TESTS` (ON Default)
* This option will build C++ unit tests. These can be run via `make test`.
* `WITH_GUI` (ON Default)
* This option will build GUI items.
* `WITH_SIMULATION_MODULES` (ON Default)
* This option will build simulation modules, including wpigui and the HALSim plugins.
* `WITH_EXTERNAL_HAL` (OFF Default)
* TODO
* `EXTERNAL_HAL_FILE`
* TODO
* `OPENCV_JAVA_INSTALL_DIR`
* Set this option to the location of the archive of the OpenCV Java bindings (it should be called opencv-xxx.jar, with the x'es being version numbers). NOTE: set it to the LOCATION of the file, not the file itself!
## Build Setup
The WPILib CMake build does not allow in source builds. Because the `build` directory is used by Gradle, we recommend a `build-cmake` directory in the root. This folder is included in the gitignore.
Once you have a build folder, run CMake configuration in that build directory with the following command.
```
cmake path/to/allwpilib/root
```
If you want to change any of the options, add `-DOPTIONHERE=VALUE` to the `cmake` command. This will check for any dependencies. If everything works properly this will succeed. If not, please check out the troubleshooting section for help.
If you want, you can also use `ccmake` in order to visually set these properties as well. [Here](https://cmake.org/cmake/help/v3.0/manual/ccmake.1.html) is the link to the documentation for that program.
## Building
Once you have cmake setup. run `make` from the directory you configured CMake in. This will build all libraries possible. If you have a multicore system, we recommend running `make` with multiple jobs. The usual rule of thumb is 1.5x the number of cores you have. To run a multiple job build, run the following command with x being the number of jobs you want.
```
make -jx
```
The `ninja` generator is also supported, and can be enabled by passing `-GNinja` to the initial `cmake` command.
## Installing
After build, the easiest way to use the libraries is to install them. Run the following command to install the libraries. This will install them so that they can be used from external cmake projects.
```
sudo make install
```
## Using the installed libraries for C++.
Using the libraries from C++ is the easiest way to use the built libraries.
To do so, create a new folder to contain your project. Add the following code below to a `CMakeLists.txt` file in that directory.
```
cmake_minimum_required(VERSION 3.5)
project(vision_app) # Project Name Here
find_package(wpilib REQUIRED)
add_executable(my_vision_app main.cpp) # executable name as first parameter
target_link_libraries(my_vision_app cameraserver ntcore cscore wpiutil)
```
If you are using them, `wpilibc` and `hal` should be added before the `cameraserver` declaration in the `target_link_libraries` function.
Add a `main.cpp` file to contain your code, and create a build folder. Move into the build folder, and run
```
cmake /path/to/folder/containing/CMakeLists
```
After that, run `make`. That will create your executable. Then you should be able to run `./my_vision_app` to run your application.
## Using the installed libraries for Java
TODO
## Troubleshooting
Below are some common issues that are run into when building.
#### Missing OpenCV
If you are missing OpenCV, you will get an error message similar to this.
```
CMake Error at cscore/CMakeLists.txt:3 (find_package):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
```
If you get that, you need make sure opencv was installed, and then reattempt to configure. If that doesn't work, set the `OpenCV_DIR` variable to the directory where you built OpenCV.
#### Missing Java
If you are missing Java, you will get a message like the following.
```
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find Java (missing: Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE
Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE)
```
If this happens, make sure you have a JDK of at least version 8 installed, and that your JAVA_HOME variable is set properly to point to the JDK.
In addition, if you do not need Java, you can disable it with `-DWITH_JAVA=OFF`.

159
README.md Normal file
View File

@@ -0,0 +1,159 @@
# WPILib Project
[![Gradle](https://github.com/wpilibsuite/allwpilib/actions/workflows/gradle.yml/badge.svg?branch=main)](https://github.com/wpilibsuite/allwpilib/actions/workflows/gradle.yml)
[![C++ Documentation](https://img.shields.io/badge/documentation-c%2B%2B-blue)](https://github.wpilib.org/allwpilib/docs/development/cpp/)
[![Java Documentation](https://img.shields.io/badge/documentation-java-orange)](https://github.wpilib.org/allwpilib/docs/development/java/)
Welcome to the WPILib project. This repository contains the HAL, WPILibJ, and WPILibC projects. These are the core libraries for creating robot programs for the roboRIO.
- [WPILib Project](#wpilib-project)
- [WPILib Mission](#wpilib-mission)
- [Building WPILib](#building-wpilib)
- [Requirements](#requirements)
- [Setup](#setup)
- [Building](#building)
- [Faster builds](#faster-builds)
- [Using Development Builds](#using-development-builds)
- [Custom toolchain location](#custom-toolchain-location)
- [Formatting/Linting](#formattinglinting)
- [CMake](#cmake)
- [Publishing](#publishing)
- [Structure and Organization](#structure-and-organization)
- [Contributing to WPILib](#contributing-to-wpilib)
## WPILib Mission
The WPILib Mission is to enable FIRST Robotics teams to focus on writing game-specific software rather than focusing on hardware details - "raise the floor, don't lower the ceiling". We work to enable teams with limited programming knowledge and/or mentor experience to be as successful as possible, while not hampering the abilities of teams with more advanced programming capabilities. We support Kit of Parts control system components directly in the library. We also strive to keep parity between major features of each language (Java, C++, and NI's LabVIEW), so that teams aren't at a disadvantage for choosing a specific programming language. WPILib is an open source project, licensed under the BSD 3-clause license. You can find a copy of the license [here](LICENSE.md).
# Quick Start
Below is a list of instructions that guide you through cloning, building, publishing and using local allwpilib binaries in a robot project. This quick start is not intended as a replacement for the information further listed in this document.
1. Clone the repository with `git clone https://github.com/wpilibsuite/allwpilib.git`
2. Build the repository with `./gradlew build` or `./gradlew build --build-cache` if you have an internet connection
3. Publish the artifacts locally by running `./gradlew publish`
4. [Update your](DevelopmentBuilds.md) `build.gradle` [to use the artifacts](DevelopmentBuilds.md)
# Building WPILib
Using Gradle makes building WPILib very straightforward. It only has a few dependencies on outside tools, such as the ARM cross compiler for creating roboRIO binaries.
## Requirements
- [JDK 11](https://adoptium.net/temurin/releases/?version=11)
- Note that the JRE is insufficient; the full JDK is required
- On Ubuntu, run `sudo apt install openjdk-11-jdk`
- On Windows, install the JDK 11 .msi from the link above
- On macOS, install the JDK 11 .pkg from the link above
- C++ compiler
- On Linux, install GCC 11 or greater
- On Windows, install [Visual Studio Community 2022](https://visualstudio.microsoft.com/vs/community/) and select the C++ programming language during installation (Gradle can't use the build tools for Visual Studio)
- On macOS, install the Xcode command-line build tools via `xcode-select --install`. Xcode 13 or later is required.
- ARM compiler toolchain
- Run `./gradlew installRoboRioToolchain` after cloning this repository
- If the WPILib installer was used, this toolchain is already installed
- Raspberry Pi toolchain (optional)
- Run `./gradlew installArm32Toolchain` after cloning this repository
On macOS ARM, run `softwareupdate --install-rosetta`. This is necessary to be able to use the macOS x86 roboRIO toolchain on ARM.
## Setup
Clone the WPILib repository and follow the instructions above for installing any required tooling.
See the [styleguide README](https://github.com/wpilibsuite/styleguide/blob/main/README.md) for wpiformat setup instructions. We use clang-format 14.
## Building
All build steps are executed using the Gradle wrapper, `gradlew`. Each target that Gradle can build is referred to as a task. The most common Gradle task to use is `build`. This will build all the outputs created by WPILib. To run, open a console and cd into the cloned WPILib directory. Then:
```bash
./gradlew build
```
To build a specific subproject, such as WPILibC, you must access the subproject and run the build task only on that project. Accessing a subproject in Gradle is quite easy. Simply use `:subproject_name:task_name` with the Gradle wrapper. For example, building just WPILibC:
```bash
./gradlew :wpilibc:build
```
The gradlew wrapper only exists in the root of the main project, so be sure to run all commands from there. All of the subprojects have build tasks that can be run. Gradle automatically determines and rebuilds dependencies, so if you make a change in the HAL and then run `./gradlew :wpilibc:build`, the HAL will be rebuilt, then WPILibC.
There are a few tasks other than `build` available. To see them, run the meta-task `tasks`. This will print a list of all available tasks, with a description of each task.
If opening from a fresh clone, generated java dependencies will not exist. Most IDEs will not run the generation tasks, which will cause lots of IDE errors. Manually run `./gradlew compileJava` from a terminal to run all the compile tasks, and then refresh your IDE's configuration (In VS Code open settings.gradle and save).
### Faster builds
`./gradlew build` builds _everything_, which includes debug and release builds for desktop and all installed cross compilers. Many developers don't need or want to build all of this. Therefore, common tasks have shortcuts to only build necessary components for common development and testing tasks.
`./gradlew testDesktopCpp` and `./gradlew testDesktopJava` will build and run the tests for `wpilibc` and `wpilibj` respectively. They will only build the minimum components required to run the tests.
`testDesktopCpp` and `testDesktopJava` tasks also exist for the projects `wpiutil`, `ntcore`, `cscore`, `hal` `wpilibNewCommands` and `cameraserver`. These can be ran with `./gradlew :projectName:task`.
`./gradlew buildDesktopCpp` and `./gradlew buildDesktopJava` will compile `wpilibcExamples` and `wpilibjExamples` respectively. The results can't be ran, but they can compile.
### Build Cache
Run with `--build-cache` on the command-line to use the shared [build cache](https://docs.gradle.org/current/userguide/build_cache.html) artifacts generated by the continuous integration server. Example:
```bash
./gradlew build --build-cache
```
### Using Development Builds
Please read the documentation available [here](DevelopmentBuilds.md)
### Custom toolchain location
If you have installed the FRC Toolchain to a directory other than the default, or if the Toolchain location is not on your System PATH, you can pass the `toolChainPath` property to specify where it is located. Example:
```bash
./gradlew build -PtoolChainPath=some/path/to/frc/toolchain/bin
```
### Formatting/linting
Once a PR has been submitted, formatting can be run in CI by commenting `/format` on the PR. A new commit will be pushed with the formatting changes.
#### wpiformat
wpiformat can be executed anywhere in the repository via `py -3 -m wpiformat -clang 14` on Windows or `python3 -m wpiformat -clang 14` on other platforms.
#### Java Code Quality Tools
The Java code quality tools Checkstyle, PMD, and Spotless can be run via `./gradlew javaFormat`. SpotBugs can be run via the `spotbugsMain`, `spotbugsTest`, and `spotbugsDev` tasks. These tools will all be run automatically by the `build` task. To disable this behavior, pass the `-PskipJavaFormat` flag.
If you only want to run the Java autoformatter, run `./gradlew spotlessApply`.
### CMake
CMake is also supported for building. See [README-CMAKE.md](README-CMAKE.md).
## Publishing
If you are building to test with other dependencies or just want to export the build as a Maven-style dependency, simply run the `publish` task. This task will publish all available packages to ~/releases/maven/development. If you need to publish the project to a different repo, you can specify it with `-Prepo=repo_name`. Valid options are:
- development - The default repo.
- beta - Publishes to ~/releases/maven/beta.
- stable - Publishes to ~/releases/maven/stable.
- release - Publishes to ~/releases/maven/release.
The maven artifacts are described in [MavenArtifacts.md](MavenArtifacts.md)
## Structure and Organization
The main WPILib code you're probably looking for is in WPILibJ and WPILibC. Those directories are split into shared, sim, and athena. Athena contains the WPILib code meant to run on your roboRIO. Sim is WPILib code meant to run on your computer, and shared is code shared between the two. Shared code must be platform-independent, since it will be compiled with both the ARM cross-compiler and whatever desktop compiler you are using (g++, msvc, etc...).
The integration test directories for C++ and Java contain test code that runs on our test-system. When you submit code for review, it is tested by those programs. If you add new functionality you should make sure to write tests for it so we don't break it in the future.
The hal directory contains more C++ code meant to run on the roboRIO. HAL is an acronym for "Hardware Abstraction Layer", and it interfaces with the NI Libraries. The NI Libraries contain the low-level code for controlling devices on your robot. The NI Libraries are found in the [ni-libraries](https://github.com/wpilibsuite/ni-libraries) project.
The upstream_utils directory contains scripts for updating copies of thirdparty code in the repository.
The [styleguide repository](https://github.com/wpilibsuite/styleguide) contains our style guides for C++ and Java code. Anything submitted to the WPILib project needs to follow the code style guides outlined in there. For details about the style, please see the contributors document [here](CONTRIBUTING.md#coding-guidelines).
# Contributing to WPILib
See [CONTRIBUTING.md](CONTRIBUTING.md).

1244
ThirdPartyNotices.txt Normal file

File diff suppressed because it is too large Load Diff

118
apriltag/CMakeLists.txt Normal file
View File

@@ -0,0 +1,118 @@
project(apriltag)
include(CompileWarnings)
include(GenResources)
include(FetchContent)
FetchContent_Declare(
apriltaglib
GIT_REPOSITORY https://github.com/wpilibsuite/apriltag.git
GIT_TAG ad31e33d20f9782b7239cb15cde57c56c91383ad
)
# Don't use apriltag's CMakeLists.txt due to conflicting naming and JNI
FetchContent_GetProperties(apriltaglib)
if(NOT apriltaglib_POPULATED)
FetchContent_Populate(apriltaglib)
endif()
aux_source_directory(${apriltaglib_SOURCE_DIR}/common APRILTAGLIB_COMMON_SRC)
file(GLOB TAG_FILES ${apriltaglib_SOURCE_DIR}/tag*.c)
set(APRILTAGLIB_SRCS ${apriltaglib_SOURCE_DIR}/apriltag.c ${apriltaglib_SOURCE_DIR}/apriltag_pose.c ${apriltaglib_SOURCE_DIR}/apriltag_quad_thresh.c)
file(GLOB apriltag_jni_src src/main/native/cpp/jni/AprilTagJNI.cpp)
if (WITH_JAVA)
find_package(Java REQUIRED)
find_package(JNI REQUIRED)
include(UseJava)
set(CMAKE_JAVA_COMPILE_FLAGS "-encoding" "UTF8" "-Xlint:unchecked")
set(CMAKE_JNI_TARGET true)
file(GLOB EJML_JARS "${WPILIB_BINARY_DIR}/wpimath/thirdparty/ejml/*.jar")
file(GLOB JACKSON_JARS "${WPILIB_BINARY_DIR}/wpiutil/thirdparty/jackson/*.jar")
find_file(OPENCV_JAR_FILE
NAMES opencv-${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.jar
PATHS ${OPENCV_JAVA_INSTALL_DIR} ${OpenCV_INSTALL_PATH}/bin ${OpenCV_INSTALL_PATH}/share/java
NO_DEFAULT_PATH)
set(CMAKE_JAVA_INCLUDE_PATH apriltag.jar ${EJML_JARS} ${JACKSON_JARS})
file(GLOB_RECURSE JAVA_SOURCES src/main/java/*.java)
file(GLOB_RECURSE JAVA_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/main/native/resources/*.json)
add_jar(apriltag_jar
SOURCES ${JAVA_SOURCES}
RESOURCES NAMESPACE "edu/wpi/first/apriltag" ${JAVA_RESOURCES}
INCLUDE_JARS wpimath_jar ${EJML_JARS} wpiutil_jar ${OPENCV_JAR_FILE}
OUTPUT_NAME apriltag
GENERATE_NATIVE_HEADERS apriltag_jni_headers)
get_property(APRILTAG_JAR_FILE TARGET apriltag_jar PROPERTY JAR_FILE)
install(FILES ${APRILTAG_JAR_FILE} DESTINATION "${java_lib_dest}")
set_property(TARGET apriltag_jar PROPERTY FOLDER "java")
add_library(apriltagjni ${apriltag_jni_src})
wpilib_target_warnings(apriltagjni)
target_link_libraries(apriltagjni PUBLIC apriltag)
set_property(TARGET apriltagjni PROPERTY FOLDER "libraries")
target_link_libraries(apriltagjni PRIVATE apriltag_jni_headers)
add_dependencies(apriltagjni apriltag_jar)
if (MSVC)
install(TARGETS apriltagjni RUNTIME DESTINATION "${jni_lib_dest}" COMPONENT Runtime)
endif()
install(TARGETS apriltagjni EXPORT apriltagjni DESTINATION "${main_lib_dest}")
endif()
GENERATE_RESOURCES(src/main/native/resources/edu/wpi/first/apriltag generated/main/cpp APRILTAG frc apriltag_resources_src)
file(GLOB apriltag_native_src src/main/native/cpp/*.cpp)
add_library(apriltag ${apriltag_native_src} ${apriltag_resources_src} ${APRILTAGLIB_SRCS} ${APRILTAGLIB_COMMON_SRC} ${TAG_FILES})
set_target_properties(apriltag PROPERTIES DEBUG_POSTFIX "d")
set_property(TARGET apriltag PROPERTY FOLDER "libraries")
target_compile_features(apriltag PUBLIC cxx_std_20)
wpilib_target_warnings(apriltag)
# disable warnings that apriltaglib can't handle
if (MSVC)
target_compile_options(apriltag PRIVATE /wd4018)
else()
target_compile_options(apriltag PRIVATE -Wno-sign-compare -Wno-gnu-zero-variadic-macro-arguments)
endif()
target_link_libraries(apriltag wpimath)
target_include_directories(apriltag PUBLIC
$<BUILD_INTERFACE:${apriltaglib_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
$<INSTALL_INTERFACE:${include_dest}/apriltag>)
install(TARGETS apriltag EXPORT apriltag DESTINATION "${main_lib_dest}")
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/apriltag")
if (WITH_JAVA AND MSVC)
install(TARGETS apriltag RUNTIME DESTINATION "${jni_lib_dest}" COMPONENT Runtime)
endif()
if (WITH_FLAT_INSTALL)
set (apriltag_config_dir ${wpilib_dest})
else()
set (apriltag_config_dir share/apriltag)
endif()
configure_file(apriltag-config.cmake.in ${WPILIB_BINARY_DIR}/apriltag-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/apriltag-config.cmake DESTINATION ${apriltag_config_dir})
install(EXPORT apriltag DESTINATION ${apriltag_config_dir})
if (WITH_TESTS)
wpilib_add_test(apriltag src/test/native/cpp)
target_include_directories(apriltag_test PRIVATE src/test/native/include)
target_link_libraries(apriltag_test apriltag gmock_main)
endif()

View File

@@ -0,0 +1,7 @@
include(CMakeFindDependencyMacro)
@FILENAME_DEP_REPLACE@
@WPIMATH_DEP_REPLACE@
@WPIUTIL_DEP_REPLACE@
@FILENAME_DEP_REPLACE@
include(${SELF_DIR}/apriltag.cmake)

88
apriltag/build.gradle Normal file
View File

@@ -0,0 +1,88 @@
apply from: "${rootDir}/shared/resources.gradle"
ext {
nativeName = 'apriltag'
devMain = 'edu.wpi.first.apriltag.DevMain'
useJava = true
useCpp = true
sharedCvConfigs = [
apriltagDev : [],
apriltagTest: []]
staticCvConfigs = []
def generateTask = createGenerateResourcesTask('main', 'APRILTAG', 'frc', project)
tasks.withType(CppCompile) {
dependsOn generateTask
}
splitSetup = {
it.sources {
resourcesCpp(CppSourceSet) {
source {
srcDirs "$buildDir/generated/main/cpp", "$rootDir/shared/singlelib"
include '*.cpp'
}
}
}
}
}
evaluationDependsOn(':wpimath')
apply from: "${rootDir}/shared/jni/setupBuild.gradle"
apply from: "${rootDir}/shared/apriltaglib.gradle"
apply from: "${rootDir}/shared/opencv.gradle"
dependencies {
implementation project(':wpimath')
devImplementation project(':wpimath')
}
sourceSets {
main {
resources {
srcDirs 'src/main/native/resources'
}
}
}
model {
components {}
binaries {
all {
if (!it.buildable || !(it instanceof NativeBinarySpec)) {
return
}
it.cppCompiler.define 'WPILIB_EXPORTS'
if (it.component.name == "${nativeName}JNI") {
lib project: ':wpimath', library: 'wpimath', linkage: 'static'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'static'
} else {
lib project: ':wpimath', library: 'wpimath', linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
}
nativeUtils.useRequiredLibrary(it, 'apriltaglib')
}
}
tasks {
def c = $.components
def found = false
def systemArch = getCurrentArch()
c.each {
if (it in NativeExecutableSpec && it.name == "${nativeName}Dev") {
it.binaries.each {
if (!found) {
def arch = it.targetPlatform.name
if (arch == systemArch) {
def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + 'lib'
found = true
}
}
}
}
}
}
}

View File

@@ -0,0 +1,20 @@
// 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.
package edu.wpi.first.apriltag;
public final class DevMain {
/** Main entry point. */
public static void main(String[] args) {
System.out.println("Hello World!");
AprilTagDetector detector = new AprilTagDetector();
detector.addFamily("tag16h5");
AprilTagDetector.Config config = new AprilTagDetector.Config();
config.refineEdges = false;
detector.setConfig(config);
detector.close();
}
private DevMain() {}
}

View File

@@ -0,0 +1,11 @@
// 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.
#include "frc/apriltag/AprilTagDetector.h"
int main() {
frc::AprilTagDetector detector;
detector.AddFamily("tag16h5");
detector.SetConfig({.refineEdges = false});
}

View File

@@ -0,0 +1,47 @@
// 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.
package edu.wpi.first.apriltag;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import edu.wpi.first.math.geometry.Pose3d;
import java.util.Objects;
@SuppressWarnings("MemberName")
public class AprilTag {
@JsonProperty(value = "ID")
public int ID;
@JsonProperty(value = "pose")
public Pose3d pose;
@SuppressWarnings("ParameterName")
@JsonCreator
public AprilTag(
@JsonProperty(required = true, value = "ID") int ID,
@JsonProperty(required = true, value = "pose") Pose3d pose) {
this.ID = ID;
this.pose = pose;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof AprilTag) {
var other = (AprilTag) obj;
return ID == other.ID && pose.equals(other.pose);
}
return false;
}
@Override
public int hashCode() {
return Objects.hash(ID, pose);
}
@Override
public String toString() {
return "AprilTag(ID: " + ID + ", pose: " + pose + ")";
}
}

View File

@@ -0,0 +1,190 @@
// 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.
package edu.wpi.first.apriltag;
import edu.wpi.first.math.MatBuilder;
import edu.wpi.first.math.Matrix;
import edu.wpi.first.math.Nat;
import edu.wpi.first.math.numbers.N3;
import java.util.Arrays;
/** A detection of an AprilTag tag. */
public class AprilTagDetection {
/**
* Gets the decoded tag's family name.
*
* @return Decoded family name
*/
public String getFamily() {
return m_family;
}
/**
* Gets the decoded ID of the tag.
*
* @return Decoded ID
*/
public int getId() {
return m_id;
}
/**
* Gets how many error bits were corrected. Note: accepting large numbers of corrected errors
* leads to greatly increased false positive rates. NOTE: As of this implementation, the detector
* cannot detect tags with a hamming distance greater than 2.
*
* @return Hamming distance (number of corrected error bits)
*/
public int getHamming() {
return m_hamming;
}
/**
* Gets a measure of the quality of the binary decoding process: the average difference between
* the intensity of a data bit versus the decision threshold. Higher numbers roughly indicate
* better decodes. This is a reasonable measure of detection accuracy only for very small tags--
* not effective for larger tags (where we could have sampled anywhere within a bit cell and still
* gotten a good detection.)
*
* @return Decision margin
*/
public float getDecisionMargin() {
return m_decisionMargin;
}
/**
* Gets the 3x3 homography matrix describing the projection from an "ideal" tag (with corners at
* (-1,1), (1,1), (1,-1), and (-1, -1)) to pixels in the image.
*
* @return Homography matrix data
*/
@SuppressWarnings("PMD.MethodReturnsInternalArray")
public double[] getHomography() {
return m_homography;
}
/**
* Gets the 3x3 homography matrix describing the projection from an "ideal" tag (with corners at
* (-1,1), (1,1), (1,-1), and (-1, -1)) to pixels in the image.
*
* @return Homography matrix
*/
public Matrix<N3, N3> getHomographyMatrix() {
return new MatBuilder<>(Nat.N3(), Nat.N3()).fill(m_homography);
}
/**
* Gets the center of the detection in image pixel coordinates.
*
* @return Center point X coordinate
*/
public double getCenterX() {
return m_centerX;
}
/**
* Gets the center of the detection in image pixel coordinates.
*
* @return Center point Y coordinate
*/
public double getCenterY() {
return m_centerY;
}
/**
* Gets a corner of the tag in image pixel coordinates. These always wrap counter-clock wise
* around the tag.
*
* @param ndx Corner index (range is 0-3, inclusive)
* @return Corner point X coordinate
*/
public double getCornerX(int ndx) {
return m_corners[ndx * 2];
}
/**
* Gets a corner of the tag in image pixel coordinates. These always wrap counter-clock wise
* around the tag.
*
* @param ndx Corner index (range is 0-3, inclusive)
* @return Corner point Y coordinate
*/
public double getCornerY(int ndx) {
return m_corners[ndx * 2 + 1];
}
/**
* Gets the corners of the tag in image pixel coordinates. These always wrap counter-clock wise
* around the tag.
*
* @return Corner point array (X and Y for each corner in order)
*/
@SuppressWarnings("PMD.MethodReturnsInternalArray")
public double[] getCorners() {
return m_corners;
}
private final String m_family;
private final int m_id;
private final int m_hamming;
private final float m_decisionMargin;
private final double[] m_homography;
private final double m_centerX;
private final double m_centerY;
private final double[] m_corners;
/**
* Constructs a new detection result. Used from JNI.
*
* @param family family
* @param id id
* @param hamming hamming
* @param decisionMargin dm
* @param homography homography
* @param centerX centerX
* @param centerY centerY
* @param corners corners
*/
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
public AprilTagDetection(
String family,
int id,
int hamming,
float decisionMargin,
double[] homography,
double centerX,
double centerY,
double[] corners) {
m_family = family;
m_id = id;
m_hamming = hamming;
m_decisionMargin = decisionMargin;
m_homography = homography;
m_centerX = centerX;
m_centerY = centerY;
m_corners = corners;
}
@Override
public String toString() {
return "DetectionResult [centerX="
+ m_centerX
+ ", centerY="
+ m_centerY
+ ", corners="
+ Arrays.toString(m_corners)
+ ", decisionMargin="
+ m_decisionMargin
+ ", hamming="
+ m_hamming
+ ", homography="
+ Arrays.toString(m_homography)
+ ", family="
+ m_family
+ ", id="
+ m_id
+ "]";
}
}

View File

@@ -0,0 +1,281 @@
// 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.
package edu.wpi.first.apriltag;
import edu.wpi.first.apriltag.jni.AprilTagJNI;
import org.opencv.core.Mat;
/**
* An AprilTag detector engine. This is expensive to set up and tear down, so most use cases should
* only create one of these, add a family to it, set up any other configuration, and repeatedly call
* Detect().
*/
public class AprilTagDetector implements AutoCloseable {
/** Detector configuration. */
@SuppressWarnings("MemberName")
public static class Config {
/**
* How many threads should be used for computation. Default is single-threaded operation (1
* thread).
*/
public int numThreads = 1;
/**
* Quad decimation. Detection of quads can be done on a lower-resolution image, improving speed
* at a cost of pose accuracy and a slight decrease in detection rate. Decoding the binary
* payload is still done at full resolution. Default is 2.0.
*/
public float quadDecimate = 2.0f;
/**
* What Gaussian blur should be applied to the segmented image (used for quad detection). Very
* noisy images benefit from non-zero values (e.g. 0.8). Default is 0.0.
*/
public float quadSigma;
/**
* When true, the edges of the each quad are adjusted to "snap to" strong gradients nearby. This
* is useful when decimation is employed, as it can increase the quality of the initial quad
* estimate substantially. Generally recommended to be on (true). Default is true.
*
* <p>Very computationally inexpensive. Option is ignored if quad_decimate = 1.
*/
public boolean refineEdges = true;
/**
* How much sharpening should be done to decoded images. This can help decode small tags but may
* or may not help in odd lighting conditions or low light conditions. Default is 0.25.
*/
public double decodeSharpening = 0.25;
/**
* Debug mode. When true, the decoder writes a variety of debugging images to the current
* working directory at various stages through the detection process. This is slow and should
* *not* be used on space-limited systems such as the RoboRIO. Default is disabled (false).
*/
public boolean debug;
public Config() {}
Config(
int numThreads,
float quadDecimate,
float quadSigma,
boolean refineEdges,
double decodeSharpening,
boolean debug) {
this.numThreads = numThreads;
this.quadDecimate = quadDecimate;
this.quadSigma = quadSigma;
this.refineEdges = refineEdges;
this.decodeSharpening = decodeSharpening;
this.debug = debug;
}
@Override
public int hashCode() {
return numThreads
+ Float.hashCode(quadDecimate)
+ Float.hashCode(quadSigma)
+ Boolean.hashCode(refineEdges)
+ Double.hashCode(decodeSharpening)
+ Boolean.hashCode(debug);
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Config)) {
return false;
}
Config other = (Config) obj;
return numThreads == other.numThreads
&& quadDecimate == other.quadDecimate
&& quadSigma == other.quadSigma
&& refineEdges == other.refineEdges
&& decodeSharpening == other.decodeSharpening
&& debug == other.debug;
}
}
/** Quad threshold parameters. */
@SuppressWarnings("MemberName")
public static class QuadThresholdParameters {
/** Threshold used to reject quads containing too few pixels. Default is 5 pixels. */
public int minClusterPixels = 5;
/**
* How many corner candidates to consider when segmenting a group of pixels into a quad. Default
* is 10.
*/
public int maxNumMaxima = 10;
/**
* Critical angle, in radians. The detector will reject quads where pairs of edges have angles
* that are close to straight or close to 180 degrees. Zero means that no quads are rejected.
* Default is 10 degrees.
*/
public double criticalAngle = 10 * Math.PI / 180.0;
/**
* When fitting lines to the contours, the maximum mean squared error allowed. This is useful in
* rejecting contours that are far from being quad shaped; rejecting these quads "early" saves
* expensive decoding processing. Default is 10.0.
*/
public float maxLineFitMSE = 10.0f;
/**
* Minimum brightness offset. When we build our model of black &amp; white pixels, we add an
* extra check that the white model must be (overall) brighter than the black model. How much
* brighter? (in pixel values, [0,255]). Default is 5.
*/
public int minWhiteBlackDiff = 5;
/**
* Whether the thresholded image be should be deglitched. Only useful for very noisy images.
* Default is disabled (false).
*/
public boolean deglitch;
public QuadThresholdParameters() {}
QuadThresholdParameters(
int minClusterPixels,
int maxNumMaxima,
double criticalAngle,
float maxLineFitMSE,
int minWhiteBlackDiff,
boolean deglitch) {
this.minClusterPixels = minClusterPixels;
this.maxNumMaxima = maxNumMaxima;
this.criticalAngle = criticalAngle;
this.maxLineFitMSE = maxLineFitMSE;
this.minWhiteBlackDiff = minWhiteBlackDiff;
this.deglitch = deglitch;
}
@Override
public int hashCode() {
return minClusterPixels
+ maxNumMaxima
+ Double.hashCode(criticalAngle)
+ Float.hashCode(maxLineFitMSE)
+ minWhiteBlackDiff
+ Boolean.hashCode(deglitch);
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof QuadThresholdParameters)) {
return false;
}
QuadThresholdParameters other = (QuadThresholdParameters) obj;
return minClusterPixels == other.minClusterPixels
&& maxNumMaxima == other.maxNumMaxima
&& criticalAngle == other.criticalAngle
&& maxLineFitMSE == other.maxLineFitMSE
&& minWhiteBlackDiff == other.minWhiteBlackDiff
&& deglitch == other.deglitch;
}
}
public AprilTagDetector() {
m_native = AprilTagJNI.createDetector();
}
@Override
public void close() {
if (m_native != 0) {
AprilTagJNI.destroyDetector(m_native);
}
m_native = 0;
}
/**
* Sets detector configuration.
*
* @param config Configuration
*/
public void setConfig(Config config) {
AprilTagJNI.setDetectorConfig(m_native, config);
}
/**
* Gets detector configuration.
*
* @return Configuration
*/
public Config getConfig() {
return AprilTagJNI.getDetectorConfig(m_native);
}
/**
* Sets quad threshold parameters.
*
* @param params Parameters
*/
public void setQuadThresholdParameters(QuadThresholdParameters params) {
AprilTagJNI.setDetectorQTP(m_native, params);
}
/**
* Gets quad threshold parameters.
*
* @return Parameters
*/
public QuadThresholdParameters getQuadThresholdParameters() {
return AprilTagJNI.getDetectorQTP(m_native);
}
/**
* Adds a family of tags to be detected.
*
* @param fam Family name, e.g. "tag16h5"
* @throws IllegalArgumentException if family name not recognized
*/
public void addFamily(String fam) {
addFamily(fam, 2);
}
/**
* Adds a family of tags to be detected.
*
* @param fam Family name, e.g. "tag16h5"
* @param bitsCorrected maximum number of bits to correct
* @throws IllegalArgumentException if family name not recognized
*/
public void addFamily(String fam, int bitsCorrected) {
if (!AprilTagJNI.addFamily(m_native, fam, bitsCorrected)) {
throw new IllegalArgumentException("unknown family name '" + fam + "'");
}
}
/**
* Removes a family of tags from the detector.
*
* @param fam Family name, e.g. "tag16h5"
*/
public void removeFamily(String fam) {
AprilTagJNI.removeFamily(m_native, fam);
}
/** Unregister all families. */
public void clearFamilies() {
AprilTagJNI.clearFamilies(m_native);
}
/**
* Detect tags from an 8-bit image.
*
* @param img 8-bit OpenCV Mat image
* @return Results (array of AprilTagDetection)
*/
public AprilTagDetection[] detect(Mat img) {
return AprilTagJNI.detect(m_native, img.cols(), img.rows(), img.cols(), img.dataAddr());
}
private long m_native;
}

View File

@@ -0,0 +1,241 @@
// 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.
package edu.wpi.first.apriltag;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import edu.wpi.first.math.geometry.Pose3d;
import edu.wpi.first.math.geometry.Rotation3d;
import edu.wpi.first.math.geometry.Translation3d;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
/**
* Class for representing a layout of AprilTags on a field and reading them from a JSON format.
*
* <p>The JSON format contains two top-level objects, "tags" and "field". The "tags" object is a
* list of all AprilTags contained within a layout. Each AprilTag serializes to a JSON object
* containing an ID and a Pose3d. The "field" object is a descriptor of the size of the field in
* meters with "width" and "length" values. This is to account for arbitrary field sizes when
* transforming the poses.
*
* <p>Pose3ds in the JSON are measured using the normal FRC coordinate system, NWU with the origin
* at the bottom-right corner of the blue alliance wall. {@link #setOrigin(OriginPosition)} can be
* used to change the poses returned from {@link AprilTagFieldLayout#getTagPose(int)} to be from the
* perspective of a specific alliance.
*
* <p>Tag poses represent the center of the tag, with a zero rotation representing a tag that is
* upright and facing away from the (blue) alliance wall (that is, towards the opposing alliance).
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE)
public class AprilTagFieldLayout {
public enum OriginPosition {
kBlueAllianceWallRightSide,
kRedAllianceWallRightSide,
}
private final Map<Integer, AprilTag> m_apriltags = new HashMap<>();
@JsonProperty(value = "field")
private FieldDimensions m_fieldDimensions;
private Pose3d m_origin;
/**
* Construct a new AprilTagFieldLayout with values imported from a JSON file.
*
* @param path Path of the JSON file to import from.
* @throws IOException If reading from the file fails.
*/
public AprilTagFieldLayout(String path) throws IOException {
this(Path.of(path));
}
/**
* Construct a new AprilTagFieldLayout with values imported from a JSON file.
*
* @param path Path of the JSON file to import from.
* @throws IOException If reading from the file fails.
*/
public AprilTagFieldLayout(Path path) throws IOException {
AprilTagFieldLayout layout =
new ObjectMapper().readValue(path.toFile(), AprilTagFieldLayout.class);
m_apriltags.putAll(layout.m_apriltags);
m_fieldDimensions = layout.m_fieldDimensions;
setOrigin(OriginPosition.kBlueAllianceWallRightSide);
}
/**
* Construct a new AprilTagFieldLayout from a list of {@link AprilTag} objects.
*
* @param apriltags List of {@link AprilTag}.
* @param fieldLength Length of the field the layout is representing in meters.
* @param fieldWidth Width of the field the layout is representing in meters.
*/
public AprilTagFieldLayout(List<AprilTag> apriltags, double fieldLength, double fieldWidth) {
this(apriltags, new FieldDimensions(fieldLength, fieldWidth));
}
@JsonCreator
private AprilTagFieldLayout(
@JsonProperty(required = true, value = "tags") List<AprilTag> apriltags,
@JsonProperty(required = true, value = "field") FieldDimensions fieldDimensions) {
// To ensure the underlying semantics don't change with what kind of list is passed in
for (AprilTag tag : apriltags) {
m_apriltags.put(tag.ID, tag);
}
m_fieldDimensions = fieldDimensions;
setOrigin(OriginPosition.kBlueAllianceWallRightSide);
}
/**
* Returns a List of the {@link AprilTag AprilTags} used in this layout.
*
* @return The {@link AprilTag AprilTags} used in this layout.
*/
@JsonProperty("tags")
public List<AprilTag> getTags() {
return new ArrayList<>(m_apriltags.values());
}
/**
* Sets the origin based on a predefined enumeration of coordinate frame origins. The origins are
* calculated from the field dimensions.
*
* <p>This transforms the Pose3d objects returned by {@link #getTagPose(int)} to return the
* correct pose relative to a predefined coordinate frame.
*
* @param origin The predefined origin
*/
@JsonIgnore
public void setOrigin(OriginPosition origin) {
switch (origin) {
case kBlueAllianceWallRightSide:
setOrigin(new Pose3d());
break;
case kRedAllianceWallRightSide:
setOrigin(
new Pose3d(
new Translation3d(m_fieldDimensions.fieldLength, m_fieldDimensions.fieldWidth, 0),
new Rotation3d(0, 0, Math.PI)));
break;
default:
throw new IllegalArgumentException("Unsupported enum value");
}
}
/**
* Sets the origin for tag pose transformation.
*
* <p>This transforms the Pose3d objects returned by {@link #getTagPose(int)} to return the
* correct pose relative to the provided origin.
*
* @param origin The new origin for tag transformations
*/
@JsonIgnore
public void setOrigin(Pose3d origin) {
m_origin = origin;
}
/**
* Gets an AprilTag pose by its ID.
*
* @param ID The ID of the tag.
* @return The pose corresponding to the ID passed in or an empty optional if a tag with that ID
* was not found.
*/
@SuppressWarnings("ParameterName")
public Optional<Pose3d> getTagPose(int ID) {
AprilTag tag = m_apriltags.get(ID);
if (tag == null) {
return Optional.empty();
}
return Optional.of(tag.pose.relativeTo(m_origin));
}
/**
* Serializes a AprilTagFieldLayout to a JSON file.
*
* @param path The path to write to.
* @throws IOException If writing to the file fails.
*/
public void serialize(String path) throws IOException {
serialize(Path.of(path));
}
/**
* Serializes a AprilTagFieldLayout to a JSON file.
*
* @param path The path to write to.
* @throws IOException If writing to the file fails.
*/
public void serialize(Path path) throws IOException {
new ObjectMapper().writeValue(path.toFile(), this);
}
/**
* Deserializes a field layout from a resource within a internal jar file.
*
* <p>Users should use {@link AprilTagFields#loadAprilTagLayoutField()} to load official layouts
* and {@link #AprilTagFieldLayout(String)} for custom layouts.
*
* @param resourcePath The absolute path of the resource
* @return The deserialized layout
* @throws IOException If the resource could not be loaded
*/
public static AprilTagFieldLayout loadFromResource(String resourcePath) throws IOException {
try (InputStream stream = AprilTagFieldLayout.class.getResourceAsStream(resourcePath);
InputStreamReader reader = new InputStreamReader(stream)) {
return new ObjectMapper().readerFor(AprilTagFieldLayout.class).readValue(reader);
}
}
@Override
public boolean equals(Object obj) {
if (obj instanceof AprilTagFieldLayout) {
var other = (AprilTagFieldLayout) obj;
return m_apriltags.equals(other.m_apriltags) && m_origin.equals(other.m_origin);
}
return false;
}
@Override
public int hashCode() {
return Objects.hash(m_apriltags, m_origin);
}
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE)
private static class FieldDimensions {
@SuppressWarnings("MemberName")
@JsonProperty(value = "length")
public double fieldLength;
@SuppressWarnings("MemberName")
@JsonProperty(value = "width")
public double fieldWidth;
@JsonCreator()
FieldDimensions(
@JsonProperty(required = true, value = "length") double fieldLength,
@JsonProperty(required = true, value = "width") double fieldWidth) {
this.fieldLength = fieldLength;
this.fieldWidth = fieldWidth;
}
}
}

View File

@@ -0,0 +1,33 @@
// 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.
package edu.wpi.first.apriltag;
import java.io.IOException;
public enum AprilTagFields {
k2022RapidReact("2022-rapidreact.json"),
k2023ChargedUp("2023-chargedup.json");
public static final String kBaseResourceDir = "/edu/wpi/first/apriltag/";
/** Alias to the current game. */
public static final AprilTagFields kDefaultField = k2023ChargedUp;
public final String m_resourceFile;
AprilTagFields(String resourceFile) {
m_resourceFile = kBaseResourceDir + resourceFile;
}
/**
* Get a {@link AprilTagFieldLayout} from the resource JSON.
*
* @return AprilTagFieldLayout of the field
* @throws IOException If the layout does not exist
*/
public AprilTagFieldLayout loadAprilTagLayoutField() throws IOException {
return AprilTagFieldLayout.loadFromResource(m_resourceFile);
}
}

View File

@@ -0,0 +1,55 @@
// 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.
package edu.wpi.first.apriltag;
import edu.wpi.first.math.geometry.Transform3d;
/** A pair of AprilTag pose estimates. */
@SuppressWarnings("MemberName")
public class AprilTagPoseEstimate {
/**
* Constructs a pose estimate.
*
* @param pose1 first pose
* @param pose2 second pose
* @param error1 error of first pose
* @param error2 error of second pose
*/
public AprilTagPoseEstimate(Transform3d pose1, Transform3d pose2, double error1, double error2) {
this.pose1 = pose1;
this.pose2 = pose2;
this.error1 = error1;
this.error2 = error2;
}
/**
* Get the ratio of pose reprojection errors, called ambiguity. Numbers above 0.2 are likely to be
* ambiguous.
*
* @return The ratio of pose reprojection errors.
*/
public double getAmbiguity() {
double min = Math.min(error1, error2);
double max = Math.max(error1, error2);
if (max > 0) {
return min / max;
} else {
return -1;
}
}
/** Pose 1. */
public final Transform3d pose1;
/** Pose 2. */
public final Transform3d pose2;
/** Object-space error of pose 1. */
public final double error1;
/** Object-space error of pose 2. */
public final double error2;
}

View File

@@ -0,0 +1,190 @@
// 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.
package edu.wpi.first.apriltag;
import edu.wpi.first.apriltag.jni.AprilTagJNI;
import edu.wpi.first.math.geometry.Transform3d;
/** Pose estimators for AprilTag tags. */
public class AprilTagPoseEstimator {
/** Configuration for the pose estimator. */
@SuppressWarnings("MemberName")
public static class Config {
/**
* Creates a pose estimator configuration.
*
* @param tagSize tag size, in meters
* @param fx camera horizontal focal length, in pixels
* @param fy camera vertical focal length, in pixels
* @param cx camera horizontal focal center, in pixels
* @param cy camera vertical focal center, in pixels
*/
public Config(double tagSize, double fx, double fy, double cx, double cy) {
this.tagSize = tagSize;
this.fx = fx;
this.fy = fy;
this.cx = cx;
this.cy = cy;
}
public double tagSize;
public double fx;
public double fy;
public double cx;
public double cy;
@Override
public int hashCode() {
return Double.hashCode(tagSize)
+ Double.hashCode(fx)
+ Double.hashCode(fy)
+ Double.hashCode(cx)
+ Double.hashCode(cy);
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Config)) {
return false;
}
Config other = (Config) obj;
return tagSize == other.tagSize
&& fx == other.fx
&& fy == other.fy
&& cx == other.cx
&& cy == other.cy;
}
}
/**
* Creates estimator.
*
* @param config Configuration
*/
public AprilTagPoseEstimator(Config config) {
m_config = new Config(config.tagSize, config.fx, config.fy, config.cx, config.cy);
}
/**
* Sets estimator configuration.
*
* @param config Configuration
*/
public void setConfig(Config config) {
m_config.tagSize = config.tagSize;
m_config.fx = config.fx;
m_config.fy = config.fy;
m_config.cx = config.cx;
m_config.cy = config.cy;
}
/**
* Gets estimator configuration.
*
* @return Configuration
*/
public Config getConfig() {
return new Config(m_config.tagSize, m_config.fx, m_config.fy, m_config.cx, m_config.cy);
}
/**
* Estimates the pose of the tag using the homography method described in [1].
*
* @param detection Tag detection
* @return Pose estimate
*/
public Transform3d estimateHomography(AprilTagDetection detection) {
return estimateHomography(detection.getHomography());
}
/**
* Estimates the pose of the tag using the homography method described in [1].
*
* @param homography Homography 3x3 matrix data
* @return Pose estimate
*/
public Transform3d estimateHomography(double[] homography) {
return AprilTagJNI.estimatePoseHomography(
homography, m_config.tagSize, m_config.fx, m_config.fy, m_config.cx, m_config.cy);
}
/**
* Estimates the pose of the tag. This returns one or two possible poses for the tag, along with
* the object-space error of each.
*
* <p>This uses the homography method described in [1] for the initial estimate. Then Orthogonal
* Iteration [2] is used to refine this estimate. Then [3] is used to find a potential second
* local minima and Orthogonal Iteration is used to refine this second estimate.
*
* <p>[1]: E. Olson, “Apriltag: A robust and flexible visual fiducial system,” in 2011 IEEE
* International Conference on Robotics and Automation, May 2011, pp. 34003407.
*
* <p>[2]: Lu, G. D. Hager and E. Mjolsness, "Fast and globally convergent pose estimation from
* video images," in IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 22, no.
* 6, pp. 610-622, June 2000. doi: 10.1109/34.862199
*
* <p>[3]: Schweighofer and A. Pinz, "Robust Pose Estimation from a Planar Target," in IEEE
* Transactions on Pattern Analysis and Machine Intelligence, vol. 28, no. 12, pp. 2024-2030, Dec.
* 2006. doi: 10.1109/TPAMI.2006.252
*
* @param detection Tag detection
* @param nIters Number of iterations
* @return Initial and (possibly) second pose estimates
*/
public AprilTagPoseEstimate estimateOrthogonalIteration(AprilTagDetection detection, int nIters) {
return estimateOrthogonalIteration(detection.getHomography(), detection.getCorners(), nIters);
}
/**
* Estimates the pose of the tag. This returns one or two possible poses for the tag, along with
* the object-space error of each.
*
* @param homography Homography 3x3 matrix data
* @param corners Corner point array (X and Y for each corner in order)
* @param nIters Number of iterations
* @return Initial and (possibly) second pose estimates
*/
public AprilTagPoseEstimate estimateOrthogonalIteration(
double[] homography, double[] corners, int nIters) {
return AprilTagJNI.estimatePoseOrthogonalIteration(
homography,
corners,
m_config.tagSize,
m_config.fx,
m_config.fy,
m_config.cx,
m_config.cy,
nIters);
}
/**
* Estimates tag pose. This method is an easier to use interface to
* EstimatePoseOrthogonalIteration(), running 50 iterations and returning the pose with the lower
* object-space error.
*
* @param detection Tag detection
* @return Pose estimate
*/
public Transform3d estimate(AprilTagDetection detection) {
return estimate(detection.getHomography(), detection.getCorners());
}
/**
* Estimates tag pose. This method is an easier to use interface to
* EstimatePoseOrthogonalIteration(), running 50 iterations and returning the pose with the lower
* object-space error.
*
* @param homography Homography 3x3 matrix data
* @param corners Corner point array (X and Y for each corner in order)
* @return Pose estimate
*/
public Transform3d estimate(double[] homography, double[] corners) {
return AprilTagJNI.estimatePose(
homography, corners, m_config.tagSize, m_config.fx, m_config.fy, m_config.cx, m_config.cy);
}
private final Config m_config;
}

View File

@@ -0,0 +1,90 @@
// 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.
package edu.wpi.first.apriltag.jni;
import edu.wpi.first.apriltag.AprilTagDetection;
import edu.wpi.first.apriltag.AprilTagDetector;
import edu.wpi.first.apriltag.AprilTagPoseEstimate;
import edu.wpi.first.math.geometry.Transform3d;
import edu.wpi.first.util.RuntimeLoader;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
public class AprilTagJNI {
static boolean libraryLoaded = false;
static RuntimeLoader<AprilTagJNI> loader = null;
public static class Helper {
private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true);
public static boolean getExtractOnStaticLoad() {
return extractOnStaticLoad.get();
}
public static void setExtractOnStaticLoad(boolean load) {
extractOnStaticLoad.set(load);
}
}
static {
if (Helper.getExtractOnStaticLoad()) {
try {
loader =
new RuntimeLoader<>(
"apriltagjni", RuntimeLoader.getDefaultExtractionRoot(), AprilTagJNI.class);
loader.loadLibrary();
} catch (IOException ex) {
ex.printStackTrace();
System.exit(1);
}
libraryLoaded = true;
}
}
public static native long createDetector();
public static native void destroyDetector(long det);
public static native void setDetectorConfig(long det, AprilTagDetector.Config config);
public static native AprilTagDetector.Config getDetectorConfig(long det);
public static native void setDetectorQTP(
long det, AprilTagDetector.QuadThresholdParameters params);
public static native AprilTagDetector.QuadThresholdParameters getDetectorQTP(long det);
public static native boolean addFamily(long det, String fam, int bitsCorrected);
public static native void removeFamily(long det, String fam);
public static native void clearFamilies(long det);
public static native AprilTagDetection[] detect(
long det, int width, int height, int stride, long bufAddr);
public static native Transform3d estimatePoseHomography(
double[] homography, double tagSize, double fx, double fy, double cx, double cy);
public static native AprilTagPoseEstimate estimatePoseOrthogonalIteration(
double[] homography,
double[] corners,
double tagSize,
double fx,
double fy,
double cx,
double cy,
int nIters);
public static native Transform3d estimatePose(
double[] homography,
double[] corners,
double tagSize,
double fx,
double fy,
double cx,
double cy);
}

View File

@@ -0,0 +1,18 @@
// 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.
#include "frc/apriltag/AprilTag.h"
#include <wpi/json.h>
using namespace frc;
void frc::to_json(wpi::json& json, const AprilTag& apriltag) {
json = wpi::json{{"ID", apriltag.ID}, {"pose", apriltag.pose}};
}
void frc::from_json(const wpi::json& json, AprilTag& apriltag) {
apriltag.ID = json.at("ID").get<int>();
apriltag.pose = json.at("pose").get<Pose3d>();
}

View File

@@ -0,0 +1,37 @@
// 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.
#include "frc/apriltag/AprilTagDetection.h"
#include <type_traits>
#ifdef _WIN32
#pragma warning(disable : 4200)
#elif defined(__clang__)
#pragma clang diagnostic ignored "-Wc99-extensions"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#include "apriltag.h"
using namespace frc;
static_assert(sizeof(AprilTagDetection) == sizeof(apriltag_detection_t),
"structure sizes don't match");
static_assert(std::is_standard_layout_v<AprilTagDetection>,
"AprilTagDetection is not standard layout?");
std::string_view AprilTagDetection::GetFamily() const {
return static_cast<const apriltag_family_t*>(family)->name;
}
std::span<const double, 9> AprilTagDetection::GetHomography() const {
return std::span<const double, 9>{static_cast<matd_t*>(H)->data, 9};
}
Eigen::Matrix3d AprilTagDetection::GetHomographyMatrix() const {
return Eigen::Map<Eigen::Matrix<double, 3, 3, Eigen::RowMajor>>{
static_cast<matd_t*>(H)->data};
}

View File

@@ -0,0 +1,200 @@
// 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.
#include "frc/apriltag/AprilTagDetector.h"
#include <cmath>
#include <numbers>
#ifdef _WIN32
#pragma warning(disable : 4200)
#elif defined(__clang__)
#pragma clang diagnostic ignored "-Wc99-extensions"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#include "apriltag.h"
#include "tag16h5.h"
#include "tag25h9.h"
#include "tag36h11.h"
#include "tagCircle21h7.h"
#include "tagCircle49h12.h"
#include "tagCustom48h12.h"
#include "tagStandard41h12.h"
#include "tagStandard52h13.h"
using namespace frc;
AprilTagDetector::Results::Results(void* impl, const private_init&)
: span{reinterpret_cast<AprilTagDetection**>(
static_cast<zarray_t*>(impl)->data),
static_cast<size_t>(static_cast<zarray_t*>(impl)->size)},
m_impl{impl} {}
AprilTagDetector::Results& AprilTagDetector::Results::operator=(Results&& rhs) {
Destroy();
m_impl = rhs.m_impl;
rhs.m_impl = nullptr;
return *this;
}
void AprilTagDetector::Results::Destroy() {
if (m_impl) {
apriltag_detections_destroy(static_cast<zarray_t*>(m_impl));
}
}
AprilTagDetector::AprilTagDetector() : m_impl{apriltag_detector_create()} {}
AprilTagDetector& AprilTagDetector::operator=(AprilTagDetector&& rhs) {
Destroy();
m_impl = rhs.m_impl;
rhs.m_impl = nullptr;
m_families = std::move(rhs.m_families);
rhs.m_families.clear();
m_qtpCriticalAngle = rhs.m_qtpCriticalAngle;
return *this;
}
void AprilTagDetector::SetConfig(const Config& config) {
auto& impl = *static_cast<apriltag_detector_t*>(m_impl);
impl.nthreads = config.numThreads;
impl.quad_decimate = config.quadDecimate;
impl.quad_sigma = config.quadSigma;
impl.refine_edges = config.refineEdges;
impl.decode_sharpening = config.decodeSharpening;
impl.debug = config.debug;
}
AprilTagDetector::Config AprilTagDetector::GetConfig() const {
auto& impl = *static_cast<apriltag_detector_t*>(m_impl);
return {
.numThreads = impl.nthreads,
.quadDecimate = impl.quad_decimate,
.quadSigma = impl.quad_sigma,
.refineEdges = impl.refine_edges,
.decodeSharpening = impl.decode_sharpening,
.debug = impl.debug,
};
}
void AprilTagDetector::SetQuadThresholdParameters(
const QuadThresholdParameters& params) {
auto& qtp = static_cast<apriltag_detector_t*>(m_impl)->qtp;
qtp.min_cluster_pixels = params.minClusterPixels;
qtp.max_nmaxima = params.maxNumMaxima;
qtp.critical_rad = params.criticalAngle.value();
qtp.cos_critical_rad = std::cos(params.criticalAngle.value());
qtp.max_line_fit_mse = params.maxLineFitMSE;
qtp.min_white_black_diff = params.minWhiteBlackDiff;
qtp.deglitch = params.deglitch;
m_qtpCriticalAngle = params.criticalAngle;
}
AprilTagDetector::QuadThresholdParameters
AprilTagDetector::GetQuadThresholdParameters() const {
auto& qtp = static_cast<apriltag_detector_t*>(m_impl)->qtp;
return {
.minClusterPixels = qtp.min_cluster_pixels,
.maxNumMaxima = qtp.max_nmaxima,
.criticalAngle = m_qtpCriticalAngle,
.maxLineFitMSE = qtp.max_line_fit_mse,
.minWhiteBlackDiff = qtp.min_white_black_diff,
.deglitch = qtp.deglitch != 0,
};
}
bool AprilTagDetector::AddFamily(std::string_view fam, int bitsCorrected) {
auto& data = m_families[fam];
if (data) {
return true; // already detecting
}
// create the family
if (fam == "tag16h5") {
data = tag16h5_create();
} else if (fam == "tag25h9") {
data = tag25h9_create();
} else if (fam == "tag36h11") {
data = tag36h11_create();
} else if (fam == "tagCircle21h7") {
data = tagCircle21h7_create();
} else if (fam == "tagCircle49h12") {
data = tagCircle49h12_create();
} else if (fam == "tagStandard41h12") {
data = tagStandard41h12_create();
} else if (fam == "tagStandard52h13") {
data = tagStandard52h13_create();
} else if (fam == "tagCustom48h12") {
data = tagCustom48h12_create();
}
if (!data) {
m_families.erase(fam); // don't keep null value
return false; // can't add
}
apriltag_detector_add_family_bits(static_cast<apriltag_detector_t*>(m_impl),
static_cast<apriltag_family_t*>(data),
bitsCorrected);
return true;
}
void AprilTagDetector::RemoveFamily(std::string_view fam) {
auto it = m_families.find(fam);
if (it != m_families.end()) {
apriltag_detector_remove_family(
static_cast<apriltag_detector_t*>(m_impl),
static_cast<apriltag_family_t*>(it->second));
DestroyFamily(it->getKey(), it->second);
m_families.erase(it);
}
}
void AprilTagDetector::ClearFamilies() {
apriltag_detector_clear_families(static_cast<apriltag_detector_t*>(m_impl));
DestroyFamilies();
m_families.clear();
}
AprilTagDetector::Results AprilTagDetector::Detect(int width, int height,
int stride, uint8_t* buf) {
image_u8_t img{width, height, stride, buf};
return {
apriltag_detector_detect(static_cast<apriltag_detector_t*>(m_impl), &img),
Results::private_init{}};
}
void AprilTagDetector::Destroy() {
if (m_impl) {
apriltag_detector_destroy(static_cast<apriltag_detector_t*>(m_impl));
}
DestroyFamilies();
}
void AprilTagDetector::DestroyFamilies() {
for (auto&& entry : m_families) {
DestroyFamily(entry.getKey(), entry.second);
}
}
void AprilTagDetector::DestroyFamily(std::string_view name, void* data) {
auto fam = static_cast<apriltag_family_t*>(data);
if (name == "tag16h5") {
tag16h5_destroy(fam);
} else if (name == "tag25h9") {
tag25h9_destroy(fam);
} else if (name == "tag36h11") {
tag36h11_destroy(fam);
} else if (name == "tagCircle21h7") {
tagCircle21h7_destroy(fam);
} else if (name == "tagCircle49h12") {
tagCircle49h12_destroy(fam);
} else if (name == "tagStandard41h12") {
tagStandard41h12_destroy(fam);
} else if (name == "tagStandard52h13") {
tagStandard52h13_destroy(fam);
} else if (name == "tagCustom48h12") {
tagCustom48h12_destroy(fam);
}
}

View File

@@ -0,0 +1,107 @@
// 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.
#include "frc/apriltag/AprilTagFieldLayout.h"
#include <system_error>
#include <units/angle.h>
#include <units/length.h>
#include <wpi/json.h>
#include <wpi/raw_istream.h>
#include <wpi/raw_ostream.h>
using namespace frc;
AprilTagFieldLayout::AprilTagFieldLayout(std::string_view path) {
std::error_code error_code;
wpi::raw_fd_istream input{path, error_code};
if (error_code) {
throw std::runtime_error(fmt::format("Cannot open file: {}", path));
}
wpi::json json;
input >> json;
for (const auto& tag : json.at("tags").get<std::vector<AprilTag>>()) {
m_apriltags[tag.ID] = tag;
}
m_fieldWidth = units::meter_t{json.at("field").at("width").get<double>()};
m_fieldLength = units::meter_t{json.at("field").at("length").get<double>()};
}
AprilTagFieldLayout::AprilTagFieldLayout(std::vector<AprilTag> apriltags,
units::meter_t fieldLength,
units::meter_t fieldWidth)
: m_fieldLength(std::move(fieldLength)),
m_fieldWidth(std::move(fieldWidth)) {
for (const auto& tag : apriltags) {
m_apriltags[tag.ID] = tag;
}
}
void AprilTagFieldLayout::SetOrigin(OriginPosition origin) {
switch (origin) {
case OriginPosition::kBlueAllianceWallRightSide:
SetOrigin(Pose3d{});
break;
case OriginPosition::kRedAllianceWallRightSide:
SetOrigin(Pose3d{Translation3d{m_fieldLength, m_fieldWidth, 0_m},
Rotation3d{0_deg, 0_deg, 180_deg}});
break;
default:
throw std::invalid_argument("Invalid origin");
}
}
void AprilTagFieldLayout::SetOrigin(const Pose3d& origin) {
m_origin = origin;
}
std::optional<frc::Pose3d> AprilTagFieldLayout::GetTagPose(int ID) const {
const auto& it = m_apriltags.find(ID);
if (it == m_apriltags.end()) {
return std::nullopt;
}
return it->second.pose.RelativeTo(m_origin);
}
void AprilTagFieldLayout::Serialize(std::string_view path) {
std::error_code error_code;
wpi::raw_fd_ostream output{path, error_code};
if (error_code) {
throw std::runtime_error(fmt::format("Cannot open file: {}", path));
}
wpi::json json = *this;
output << json;
output.flush();
}
void frc::to_json(wpi::json& json, const AprilTagFieldLayout& layout) {
std::vector<AprilTag> tagVector;
tagVector.reserve(layout.m_apriltags.size());
for (const auto& pair : layout.m_apriltags) {
tagVector.push_back(pair.second);
}
json = wpi::json{{"field",
{{"length", layout.m_fieldLength.value()},
{"width", layout.m_fieldWidth.value()}}},
{"tags", tagVector}};
}
void frc::from_json(const wpi::json& json, AprilTagFieldLayout& layout) {
layout.m_apriltags.clear();
for (const auto& tag : json.at("tags").get<std::vector<AprilTag>>()) {
layout.m_apriltags[tag.ID] = tag;
}
layout.m_fieldLength =
units::meter_t{json.at("field").at("length").get<double>()};
layout.m_fieldWidth =
units::meter_t{json.at("field").at("width").get<double>()};
}

View File

@@ -0,0 +1,32 @@
// 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.
#include "frc/apriltag/AprilTagFields.h"
#include <wpi/json.h>
namespace frc {
// C++ generated from resource files
std::string_view GetResource_2022_rapidreact_json();
std::string_view GetResource_2023_chargedup_json();
AprilTagFieldLayout LoadAprilTagLayoutField(AprilTagField field) {
std::string_view fieldString;
switch (field) {
case AprilTagField::k2022RapidReact:
fieldString = GetResource_2022_rapidreact_json();
break;
case AprilTagField::k2023ChargedUp:
fieldString = GetResource_2023_chargedup_json();
break;
case AprilTagField::kNumFields:
throw std::invalid_argument("Invalid Field");
}
wpi::json json = wpi::json::parse(fieldString);
return json.get<AprilTagFieldLayout>();
}
} // namespace frc

View File

@@ -0,0 +1,20 @@
// 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.
#include "frc/apriltag/AprilTagPoseEstimate.h"
#include <algorithm>
using namespace frc;
double AprilTagPoseEstimate::GetAmbiguity() const {
auto min = (std::min)(error1, error2);
auto max = (std::max)(error1, error2);
if (max > 0) {
return min / max;
} else {
return -1;
}
}

View File

@@ -0,0 +1,154 @@
// 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.
#include "frc/apriltag/AprilTagPoseEstimator.h"
#include <Eigen/QR>
#include "frc/apriltag/AprilTagDetection.h"
#ifdef _WIN32
#pragma warning(disable : 4200)
#elif defined(__clang__)
#pragma clang diagnostic ignored "-Wc99-extensions"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
#include "apriltag.h"
#include "apriltag_pose.h"
using namespace frc;
static Eigen::Matrix3d OrthogonalizeRotationMatrix(
const Eigen::Matrix3d& input) {
Eigen::HouseholderQR<Eigen::Matrix3d> qr{input};
Eigen::Matrix3d Q = qr.householderQ();
Eigen::Matrix3d R = qr.matrixQR().triangularView<Eigen::Upper>();
// Fix signs in R if they're < 0 so it's close to an identity matrix
// (our QR decomposition implementation sometimes flips the signs of
// columns)
for (int colR = 0; colR < 3; ++colR) {
if (R(colR, colR) < 0) {
for (int rowQ = 0; rowQ < 3; ++rowQ) {
Q(rowQ, colR) = -Q(rowQ, colR);
}
}
}
return Q;
}
static Transform3d MakePose(const apriltag_pose_t& pose) {
if (!pose.R || !pose.t) {
return {};
}
return {Translation3d{units::meter_t{pose.t->data[0]},
units::meter_t{pose.t->data[1]},
units::meter_t{pose.t->data[2]}},
Rotation3d{OrthogonalizeRotationMatrix(
Eigen::Map<Eigen::Matrix<double, 3, 3, Eigen::RowMajor>>{
pose.R->data})}};
}
static apriltag_detection_info_t MakeDetectionInfo(
const apriltag_detection_t* det,
const AprilTagPoseEstimator::Config& config) {
return {const_cast<apriltag_detection_t*>(det),
config.tagSize.value(),
config.fx,
config.fy,
config.cx,
config.cy};
}
static apriltag_detection_t MakeBasicDet(
std::span<const double, 9> homography,
const std::span<const double, 8>* corners) {
apriltag_detection_t detection;
detection.H = matd_create(3, 3);
std::memcpy(detection.H->data, homography.data(), 9 * sizeof(double));
if (corners) {
for (int i = 0; i < 4; i++) {
detection.p[i][0] = (*corners)[i * 2];
detection.p[i][1] = (*corners)[i * 2 + 1];
}
}
return detection;
}
static Transform3d DoEstimateHomography(
const apriltag_detection_t* detection,
const AprilTagPoseEstimator::Config& config) {
auto info = MakeDetectionInfo(detection, config);
apriltag_pose_t pose;
estimate_pose_for_tag_homography(&info, &pose);
return MakePose(pose);
}
Transform3d AprilTagPoseEstimator::EstimateHomography(
const AprilTagDetection& detection) const {
return DoEstimateHomography(
reinterpret_cast<const apriltag_detection_t*>(&detection), m_config);
}
Transform3d AprilTagPoseEstimator::EstimateHomography(
std::span<const double, 9> homography) const {
auto detection = MakeBasicDet(homography, nullptr);
auto rv = DoEstimateHomography(&detection, m_config);
matd_destroy(detection.H);
return rv;
}
static AprilTagPoseEstimate DoEstimateOrthogonalIteration(
const apriltag_detection_t* detection,
const AprilTagPoseEstimator::Config& config, int nIters) {
auto info = MakeDetectionInfo(detection, config);
apriltag_pose_t pose1, pose2;
double err1, err2;
estimate_tag_pose_orthogonal_iteration(&info, &err1, &pose1, &err2, &pose2,
nIters);
return {MakePose(pose1), MakePose(pose2), err1, err2};
}
AprilTagPoseEstimate AprilTagPoseEstimator::EstimateOrthogonalIteration(
const AprilTagDetection& detection, int nIters) const {
return DoEstimateOrthogonalIteration(
reinterpret_cast<const apriltag_detection_t*>(&detection), m_config,
nIters);
}
AprilTagPoseEstimate AprilTagPoseEstimator::EstimateOrthogonalIteration(
std::span<const double, 9> homography, std::span<const double, 8> corners,
int nIters) const {
auto detection = MakeBasicDet(homography, &corners);
auto rv = DoEstimateOrthogonalIteration(&detection, m_config, nIters);
matd_destroy(detection.H);
return rv;
}
static Transform3d DoEstimate(const apriltag_detection_t* detection,
const AprilTagPoseEstimator::Config& config) {
auto info = MakeDetectionInfo(detection, config);
apriltag_pose_t pose;
estimate_tag_pose(&info, &pose);
return MakePose(pose);
}
Transform3d AprilTagPoseEstimator::Estimate(
const AprilTagDetection& detection) const {
return DoEstimate(reinterpret_cast<const apriltag_detection_t*>(&detection),
m_config);
}
Transform3d AprilTagPoseEstimator::Estimate(
std::span<const double, 9> homography,
std::span<const double, 8> corners) const {
auto detection = MakeBasicDet(homography, &corners);
auto rv = DoEstimate(&detection, m_config);
matd_destroy(detection.H);
return rv;
}

View File

@@ -0,0 +1,595 @@
// 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.
#include <cstdio>
#include <cstring>
#include <wpi/jni_util.h>
#include "edu_wpi_first_apriltag_jni_AprilTagJNI.h"
#include "frc/apriltag/AprilTagDetector.h"
#include "frc/apriltag/AprilTagPoseEstimator.h"
using namespace frc;
using namespace wpi::java;
static JavaVM* jvm = nullptr;
static JClass detectionCls;
static JClass detectorConfigCls;
static JClass detectorQTPCls;
static JClass poseEstimateCls;
static JClass quaternionCls;
static JClass rotation3dCls;
static JClass transform3dCls;
static JClass translation3dCls;
static JException illegalArgEx;
static JException nullPointerEx;
static const JClassInit classes[] = {
{"edu/wpi/first/apriltag/AprilTagDetection", &detectionCls},
{"edu/wpi/first/apriltag/AprilTagDetector$Config", &detectorConfigCls},
{"edu/wpi/first/apriltag/AprilTagDetector$QuadThresholdParameters",
&detectorQTPCls},
{"edu/wpi/first/apriltag/AprilTagPoseEstimate", &poseEstimateCls},
{"edu/wpi/first/math/geometry/Quaternion", &quaternionCls},
{"edu/wpi/first/math/geometry/Rotation3d", &rotation3dCls},
{"edu/wpi/first/math/geometry/Transform3d", &transform3dCls},
{"edu/wpi/first/math/geometry/Translation3d", &translation3dCls}};
static const JExceptionInit exceptions[] = {
{"java/lang/IllegalArgumentException", &illegalArgEx},
{"java/lang/NullPointerException", &nullPointerEx}};
extern "C" {
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
jvm = vm;
JNIEnv* env;
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
return JNI_ERR;
}
// Cache references to classes
for (auto& c : classes) {
*c.cls = JClass(env, c.name);
if (!*c.cls) {
std::fprintf(stderr, "could not load class %s\n", c.name);
return JNI_ERR;
}
}
for (auto& c : exceptions) {
*c.cls = JException(env, c.name);
if (!*c.cls) {
std::fprintf(stderr, "could not load exception %s\n", c.name);
return JNI_ERR;
}
}
return JNI_VERSION_1_6;
}
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* vm, void* reserved) {
JNIEnv* env;
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
return;
}
// Delete global references
for (auto& c : classes) {
c.cls->free(env);
}
for (auto& c : exceptions) {
c.cls->free(env);
}
jvm = nullptr;
}
} // extern "C"
//
// Conversions from Java to C++ objects
//
static AprilTagDetector::Config FromJavaDetectorConfig(JNIEnv* env,
jobject jconfig) {
if (!jconfig) {
return {};
}
#define FIELD(name, sig) \
static jfieldID name##Field = nullptr; \
if (!name##Field) { \
name##Field = env->GetFieldID(detectorConfigCls, #name, sig); \
}
FIELD(numThreads, "I");
FIELD(quadDecimate, "F");
FIELD(quadSigma, "F");
FIELD(refineEdges, "Z");
FIELD(decodeSharpening, "D");
FIELD(debug, "Z");
#undef FIELD
#define FIELD(ctype, jtype, name) \
.name = static_cast<ctype>(env->Get##jtype##Field(jconfig, name##Field))
return {
FIELD(int, Int, numThreads),
FIELD(float, Float, quadDecimate),
FIELD(float, Float, quadSigma),
FIELD(bool, Boolean, refineEdges),
FIELD(double, Double, decodeSharpening),
FIELD(bool, Boolean, debug),
};
#undef GET
#undef FIELD
}
static AprilTagDetector::QuadThresholdParameters FromJavaDetectorQTP(
JNIEnv* env, jobject jparams) {
if (!jparams) {
return {};
}
#define FIELD(name, sig) \
static jfieldID name##Field = nullptr; \
if (!name##Field) { \
name##Field = env->GetFieldID(detectorQTPCls, #name, sig); \
}
FIELD(minClusterPixels, "I");
FIELD(maxNumMaxima, "I");
FIELD(criticalAngle, "D");
FIELD(maxLineFitMSE, "F");
FIELD(minWhiteBlackDiff, "I");
FIELD(deglitch, "Z");
#undef FIELD
#define FIELD(ctype, jtype, name) \
.name = static_cast<ctype>(env->Get##jtype##Field(jparams, name##Field))
return {
FIELD(int, Int, minClusterPixels),
FIELD(int, Int, maxNumMaxima),
.criticalAngle = units::radian_t{static_cast<double>(
env->GetDoubleField(jparams, criticalAngleField))},
FIELD(float, Float, maxLineFitMSE),
FIELD(int, Int, minWhiteBlackDiff),
FIELD(bool, Boolean, deglitch),
};
#undef GET
#undef FIELD
}
//
// Conversions from C++ to Java objects
//
static jobject MakeJObject(JNIEnv* env, const AprilTagDetection& detect) {
static jmethodID constructor = env->GetMethodID(
detectionCls, "<init>", "(Ljava/lang/String;IIF[DDD[D)V");
if (!constructor) {
return nullptr;
}
JLocal<jstring> fam{env, MakeJString(env, detect.GetFamily())};
auto homography = detect.GetHomography();
JLocal<jdoubleArray> harr{
env, MakeJDoubleArray(
env, {reinterpret_cast<const jdouble*>(homography.data()),
homography.size()})};
double cornersBuf[8];
auto corners = detect.GetCorners(cornersBuf);
JLocal<jdoubleArray> carr{
env,
MakeJDoubleArray(env, {reinterpret_cast<const jdouble*>(corners.data()),
corners.size()})};
auto center = detect.GetCenter();
return env->NewObject(detectionCls, constructor, fam.obj(),
static_cast<jint>(detect.GetId()),
static_cast<jint>(detect.GetHamming()),
static_cast<jfloat>(detect.GetDecisionMargin()),
harr.obj(), static_cast<jdouble>(center.x),
static_cast<jdouble>(center.y), carr.obj());
}
static jobjectArray MakeJObject(JNIEnv* env,
std::span<const AprilTagDetection* const> arr) {
jobjectArray jarr = env->NewObjectArray(arr.size(), detectionCls, nullptr);
if (!jarr) {
return nullptr;
}
for (size_t i = 0; i < arr.size(); ++i) {
JLocal<jobject> elem{env, MakeJObject(env, *arr[i])};
env->SetObjectArrayElement(jarr, i, elem.obj());
}
return jarr;
}
static jobject MakeJObject(JNIEnv* env,
const AprilTagDetector::Config& config) {
static jmethodID constructor =
env->GetMethodID(detectorConfigCls, "<init>", "(IFFZDZ)V");
if (!constructor) {
return nullptr;
}
return env->NewObject(detectorConfigCls, constructor,
static_cast<jint>(config.numThreads),
static_cast<jfloat>(config.quadDecimate),
static_cast<jfloat>(config.quadSigma),
static_cast<jboolean>(config.refineEdges),
static_cast<jdouble>(config.decodeSharpening),
static_cast<jboolean>(config.debug));
}
static jobject MakeJObject(
JNIEnv* env, const AprilTagDetector::QuadThresholdParameters& params) {
static jmethodID constructor =
env->GetMethodID(detectorQTPCls, "<init>", "(IIDFIZ)V");
if (!constructor) {
return nullptr;
}
return env->NewObject(detectorQTPCls, constructor,
static_cast<jint>(params.minClusterPixels),
static_cast<jint>(params.maxNumMaxima),
static_cast<jdouble>(params.criticalAngle),
static_cast<jfloat>(params.maxLineFitMSE),
static_cast<jint>(params.minWhiteBlackDiff),
static_cast<jboolean>(params.deglitch));
}
static jobject MakeJObject(JNIEnv* env, const Translation3d& xlate) {
static jmethodID constructor =
env->GetMethodID(translation3dCls, "<init>", "(DDD)V");
if (!constructor) {
return nullptr;
}
return env->NewObject(
translation3dCls, constructor, static_cast<jdouble>(xlate.X()),
static_cast<jdouble>(xlate.Y()), static_cast<jdouble>(xlate.Z()));
}
static jobject MakeJObject(JNIEnv* env, const Quaternion& q) {
static jmethodID constructor =
env->GetMethodID(quaternionCls, "<init>", "(DDDD)V");
if (!constructor) {
return nullptr;
}
return env->NewObject(quaternionCls, constructor, static_cast<jdouble>(q.W()),
static_cast<jdouble>(q.X()),
static_cast<jdouble>(q.Y()),
static_cast<jdouble>(q.Z()));
}
static jobject MakeJObject(JNIEnv* env, const Rotation3d& rot) {
static jmethodID constructor = env->GetMethodID(
rotation3dCls, "<init>", "(Ledu/wpi/first/math/geometry/Quaternion;)V");
if (!constructor) {
return nullptr;
}
JLocal<jobject> q{env, MakeJObject(env, rot.GetQuaternion())};
return env->NewObject(rotation3dCls, constructor, q.obj());
}
static jobject MakeJObject(JNIEnv* env, const Transform3d& xform) {
static jmethodID constructor =
env->GetMethodID(transform3dCls, "<init>",
"(Ledu/wpi/first/math/geometry/Translation3d;"
"Ledu/wpi/first/math/geometry/Rotation3d;)V");
if (!constructor) {
return nullptr;
}
JLocal<jobject> xlate{env, MakeJObject(env, xform.Translation())};
JLocal<jobject> rot{env, MakeJObject(env, xform.Rotation())};
return env->NewObject(transform3dCls, constructor, xlate.obj(), rot.obj());
}
static jobject MakeJObject(JNIEnv* env, const AprilTagPoseEstimate& est) {
static jmethodID constructor =
env->GetMethodID(poseEstimateCls, "<init>",
"(Ledu/wpi/first/math/geometry/Transform3d;"
"Ledu/wpi/first/math/geometry/Transform3d;DD)V");
if (!constructor) {
return nullptr;
}
JLocal<jobject> pose1{env, MakeJObject(env, est.pose1)};
JLocal<jobject> pose2{env, MakeJObject(env, est.pose2)};
return env->NewObject(poseEstimateCls, constructor, pose1.obj(), pose2.obj(),
static_cast<jdouble>(est.error1),
static_cast<jdouble>(est.error2));
}
extern "C" {
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: createDetector
* Signature: ()J
*/
JNIEXPORT jlong JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_createDetector
(JNIEnv* env, jclass)
{
return reinterpret_cast<jlong>(new AprilTagDetector);
}
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: destroyDetector
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_destroyDetector
(JNIEnv* env, jclass, jlong det)
{
delete reinterpret_cast<AprilTagDetector*>(det);
}
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: setDetectorConfig
* Signature: (JLjava/lang/Object;)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_setDetectorConfig
(JNIEnv* env, jclass, jlong det, jobject config)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return;
}
reinterpret_cast<AprilTagDetector*>(det)->SetConfig(
FromJavaDetectorConfig(env, config));
}
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: getDetectorConfig
* Signature: (J)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_getDetectorConfig
(JNIEnv* env, jclass, jlong det)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return nullptr;
}
return MakeJObject(env,
reinterpret_cast<AprilTagDetector*>(det)->GetConfig());
}
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: setDetectorQTP
* Signature: (JLjava/lang/Object;)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_setDetectorQTP
(JNIEnv* env, jclass, jlong det, jobject params)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return;
}
reinterpret_cast<AprilTagDetector*>(det)->SetQuadThresholdParameters(
FromJavaDetectorQTP(env, params));
}
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: getDetectorQTP
* Signature: (J)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_getDetectorQTP
(JNIEnv* env, jclass, jlong det)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return nullptr;
}
return MakeJObject(
env,
reinterpret_cast<AprilTagDetector*>(det)->GetQuadThresholdParameters());
}
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: addFamily
* Signature: (JLjava/lang/String;I)Z
*/
JNIEXPORT jboolean JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_addFamily
(JNIEnv* env, jclass, jlong det, jstring fam, jint bitsCorrected)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return false;
}
if (!fam) {
nullPointerEx.Throw(env, "fam cannot be null");
return false;
}
return reinterpret_cast<AprilTagDetector*>(det)->AddFamily(
JStringRef{env, fam}, bitsCorrected);
}
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: removeFamily
* Signature: (JLjava/lang/String;)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_removeFamily
(JNIEnv* env, jclass, jlong det, jstring fam)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return;
}
if (!fam) {
nullPointerEx.Throw(env, "fam cannot be null");
return;
}
reinterpret_cast<AprilTagDetector*>(det)->RemoveFamily(JStringRef{env, fam});
}
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: clearFamilies
* Signature: (J)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_clearFamilies
(JNIEnv* env, jclass, jlong det)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return;
}
reinterpret_cast<AprilTagDetector*>(det)->ClearFamilies();
}
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: detect
* Signature: (JIIIJ)[Ljava/lang/Object;
*/
JNIEXPORT jobjectArray JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_detect
(JNIEnv* env, jclass, jlong det, jint width, jint height, jint stride,
jlong bufAddr)
{
if (det == 0) {
nullPointerEx.Throw(env, "det cannot be null");
return nullptr;
}
if (bufAddr == 0) {
nullPointerEx.Throw(env, "bufAddr cannot be null");
return nullptr;
}
return MakeJObject(
env, reinterpret_cast<AprilTagDetector*>(det)->Detect(
width, height, stride, reinterpret_cast<uint8_t*>(bufAddr)));
}
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: estimatePoseHomography
* Signature: ([DDDDDD)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_estimatePoseHomography
(JNIEnv* env, jclass, jdoubleArray homography, jdouble tagSize, jdouble fx,
jdouble fy, jdouble cx, jdouble cy)
{
if (!homography) {
nullPointerEx.Throw(env, "homography cannot be null");
return nullptr;
}
JDoubleArrayRef harr{env, homography};
if (harr.size() != 9) {
illegalArgEx.Throw(env, "homography array must be size 9");
return nullptr;
}
AprilTagPoseEstimator estimator({units::meter_t{tagSize}, fx, fy, cx, cy});
return MakeJObject(env, estimator.EstimateHomography(
std::span<const double, 9>{harr.array()}));
}
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: estimatePoseOrthogonalIteration
* Signature: ([D[DDDDDDI)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_estimatePoseOrthogonalIteration
(JNIEnv* env, jclass, jdoubleArray homography, jdoubleArray corners,
jdouble tagSize, jdouble fx, jdouble fy, jdouble cx, jdouble cy, jint nIters)
{
// homography
if (!homography) {
nullPointerEx.Throw(env, "homography cannot be null");
return nullptr;
}
JDoubleArrayRef harr{env, homography};
if (harr.size() != 9) {
illegalArgEx.Throw(env, "homography array must be size 9");
return nullptr;
}
// corners
if (!corners) {
nullPointerEx.Throw(env, "corners cannot be null");
return nullptr;
}
JDoubleArrayRef carr{env, corners};
if (carr.size() != 8) {
illegalArgEx.Throw(env, "corners array must be size 8");
return nullptr;
}
AprilTagPoseEstimator estimator({units::meter_t{tagSize}, fx, fy, cx, cy});
return MakeJObject(env,
estimator.EstimateOrthogonalIteration(
std::span<const double, 9>{harr.array()},
std::span<const double, 8>{carr.array()}, nIters));
}
/*
* Class: edu_wpi_first_apriltag_jni_AprilTagJNI
* Method: estimatePose
* Signature: ([D[DDDDDD)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL
Java_edu_wpi_first_apriltag_jni_AprilTagJNI_estimatePose
(JNIEnv* env, jclass, jdoubleArray homography, jdoubleArray corners,
jdouble tagSize, jdouble fx, jdouble fy, jdouble cx, jdouble cy)
{
// homography
if (!homography) {
nullPointerEx.Throw(env, "homography cannot be null");
return nullptr;
}
JDoubleArrayRef harr{env, homography};
if (harr.size() != 9) {
illegalArgEx.Throw(env, "homography array must be size 9");
return nullptr;
}
// corners
if (!corners) {
nullPointerEx.Throw(env, "corners cannot be null");
return nullptr;
}
JDoubleArrayRef carr{env, corners};
if (carr.size() != 8) {
illegalArgEx.Throw(env, "corners array must be size 8");
return nullptr;
}
AprilTagPoseEstimator estimator({units::meter_t{tagSize}, fx, fy, cx, cy});
return MakeJObject(
env, estimator.Estimate(std::span<const double, 9>{harr.array()},
std::span<const double, 8>{carr.array()}));
}
} // extern "C"

View File

@@ -0,0 +1,34 @@
// 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 <wpi/SymbolExports.h>
#include "frc/geometry/Pose3d.h"
namespace wpi {
class json;
} // namespace wpi
namespace frc {
struct WPILIB_DLLEXPORT AprilTag {
int ID;
Pose3d pose;
/**
* Checks equality between this AprilTag and another object.
*/
bool operator==(const AprilTag&) const = default;
};
WPILIB_DLLEXPORT
void to_json(wpi::json& json, const AprilTag& apriltag);
WPILIB_DLLEXPORT
void from_json(const wpi::json& json, AprilTag& apriltag);
} // namespace frc

View File

@@ -0,0 +1,160 @@
// 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 <stdint.h>
#include <span>
#include <string_view>
#include <wpi/SymbolExports.h>
#include "frc/EigenCore.h"
namespace frc {
/**
* A detection of an AprilTag tag.
*/
class WPILIB_DLLEXPORT AprilTagDetection final {
public:
AprilTagDetection() = delete;
AprilTagDetection(const AprilTagDetection&) = delete;
AprilTagDetection& operator=(const AprilTagDetection&) = delete;
/** A point. Used for center and corner points. */
struct Point {
double x;
double y;
};
/**
* Gets the decoded tag's family name.
*
* @return Decoded family name
*/
std::string_view GetFamily() const;
/**
* Gets the decoded ID of the tag.
*
* @return Decoded ID
*/
int GetId() const { return id; }
/**
* Gets how many error bits were corrected. Note: accepting large numbers of
* corrected errors leads to greatly increased false positive rates.
* NOTE: As of this implementation, the detector cannot detect tags with
* a hamming distance greater than 2.
*
* @return Hamming distance (number of corrected error bits)
*/
int GetHamming() const { return hamming; }
/**
* Gets a measure of the quality of the binary decoding process: the
* average difference between the intensity of a data bit versus
* the decision threshold. Higher numbers roughly indicate better
* decodes. This is a reasonable measure of detection accuracy
* only for very small tags-- not effective for larger tags (where
* we could have sampled anywhere within a bit cell and still
* gotten a good detection.)
*
* @return Decision margin
*/
float GetDecisionMargin() const { return decision_margin; }
/**
* Gets the 3x3 homography matrix describing the projection from an
* "ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1,
* -1)) to pixels in the image.
*
* @return Homography matrix data
*/
std::span<const double, 9> GetHomography() const;
/**
* Gets the 3x3 homography matrix describing the projection from an
* "ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1,
* -1)) to pixels in the image.
*
* @return Homography matrix
*/
Eigen::Matrix3d GetHomographyMatrix() const;
/**
* Gets the center of the detection in image pixel coordinates.
*
* @return Center point
*/
const Point& GetCenter() const { return *reinterpret_cast<const Point*>(c); }
/**
* Gets a corner of the tag in image pixel coordinates. These always
* wrap counter-clock wise around the tag.
*
* @param ndx Corner index (range is 0-3, inclusive)
* @return Corner point
*/
const Point& GetCorner(int ndx) const {
return *reinterpret_cast<const Point*>(p[ndx]);
}
/**
* Gets the corners of the tag in image pixel coordinates. These always
* wrap counter-clock wise around the tag.
*
* @param cornersBuf Corner point array (X and Y for each corner in order)
* @return Corner point array (copy of cornersBuf span)
*/
std::span<double, 8> GetCorners(std::span<double, 8> cornersBuf) const {
for (int i = 0; i < 4; i++) {
cornersBuf[i * 2] = p[i][0];
cornersBuf[i * 2 + 1] = p[i][1];
}
return cornersBuf;
}
private:
// This class *must* be standard-layout-compatible with apriltag_detection
// as we use reinterpret_cast from that structure. This means the below
// members must exactly match the contents of the apriltag_detection struct.
// The tag family.
void* family;
// The decoded ID of the tag.
int id;
// How many error bits were corrected? Note: accepting large numbers of
// corrected errors leads to greatly increased false positive rates.
// NOTE: As of this implementation, the detector cannot detect tags with
// a hamming distance greater than 2.
int hamming;
// A measure of the quality of the binary decoding process: the
// average difference between the intensity of a data bit versus
// the decision threshold. Higher numbers roughly indicate better
// decodes. This is a reasonable measure of detection accuracy
// only for very small tags-- not effective for larger tags (where
// we could have sampled anywhere within a bit cell and still
// gotten a good detection.)
float decision_margin;
// The 3x3 homography matrix describing the projection from an
// "ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1,
// -1)) to pixels in the image.
void* H;
// The center of the detection in image pixel coordinates.
double c[2];
// The corners of the tag in image pixel coordinates. These always
// wrap counter-clock wise around the tag.
double p[4][2];
};
} // namespace frc

View File

@@ -0,0 +1,260 @@
// 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 <stdint.h>
#include <memory>
#include <span>
#include <string_view>
#include <utility>
#include <units/angle.h>
#include <wpi/StringMap.h>
#include <wpi/SymbolExports.h>
#include "frc/apriltag/AprilTagDetection.h"
namespace frc {
/**
* An AprilTag detector engine. This is expensive to set up and tear down, so
* most use cases should only create one of these, add a family to it, set up
* any other configuration, and repeatedly call Detect().
*/
class WPILIB_DLLEXPORT AprilTagDetector {
public:
/** Detector configuration. */
struct Config {
bool operator==(const Config&) const = default;
/**
* How many threads should be used for computation. Default is
* single-threaded operation (1 thread).
*/
int numThreads = 1;
/**
* Quad decimation. Detection of quads can be done on a lower-resolution
* image, improving speed at a cost of pose accuracy and a slight decrease
* in detection rate. Decoding the binary payload is still done at full
* resolution. Default is 2.0.
*/
float quadDecimate = 2.0f;
/**
* What Gaussian blur should be applied to the segmented image (used for
* quad detection). Very noisy images benefit from non-zero values (e.g.
* 0.8). Default is 0.0.
*/
float quadSigma = 0.0f;
/**
* When true, the edges of the each quad are adjusted to "snap to" strong
* gradients nearby. This is useful when decimation is employed, as it can
* increase the quality of the initial quad estimate substantially.
* Generally recommended to be on (true). Default is true.
*
* Very computationally inexpensive. Option is ignored if
* quad_decimate = 1.
*/
bool refineEdges = true;
/**
* How much sharpening should be done to decoded images. This can help
* decode small tags but may or may not help in odd lighting conditions or
* low light conditions. Default is 0.25.
*/
double decodeSharpening = 0.25;
/**
* Debug mode. When true, the decoder writes a variety of debugging images
* to the current working directory at various stages through the detection
* process. This is slow and should *not* be used on space-limited systems
* such as the RoboRIO. Default is disabled (false).
*/
bool debug = false;
};
/** Quad threshold parameters. */
struct QuadThresholdParameters {
bool operator==(const QuadThresholdParameters&) const = default;
/**
* Threshold used to reject quads containing too few pixels. Default is 5
* pixels.
*/
int minClusterPixels = 5;
/**
* How many corner candidates to consider when segmenting a group of pixels
* into a quad. Default is 10.
*/
int maxNumMaxima = 10;
/**
* Critical angle. The detector will reject quads where pairs of edges have
* angles that are close to straight or close to 180 degrees. Zero means
* that no quads are rejected. Default is 10 degrees.
*/
units::radian_t criticalAngle = 10_deg;
/**
* When fitting lines to the contours, the maximum mean squared error
* allowed. This is useful in rejecting contours that are far from being
* quad shaped; rejecting these quads "early" saves expensive decoding
* processing. Default is 10.0.
*/
float maxLineFitMSE = 10.0f;
/**
* Minimum brightness offset. When we build our model of black & white
* pixels, we add an extra check that the white model must be (overall)
* brighter than the black model. How much brighter? (in pixel values,
* [0,255]). Default is 5.
*/
int minWhiteBlackDiff = 5;
/**
* Whether the thresholded image be should be deglitched. Only useful for
* very noisy images. Default is disabled (false).
*/
bool deglitch = false;
};
/**
* Array of detection results. Each array element is a pointer to an
* AprilTagDetection.
*/
class WPILIB_DLLEXPORT Results
: public std::span<AprilTagDetection const* const> {
struct private_init {};
friend class AprilTagDetector;
public:
Results() = default;
Results(void* impl, const private_init&);
~Results() { Destroy(); }
Results(const Results&) = delete;
Results& operator=(const Results&) = delete;
Results(Results&& rhs) : span{std::move(rhs)}, m_impl{rhs.m_impl} {
rhs.m_impl = nullptr;
}
Results& operator=(Results&& rhs);
private:
void Destroy();
void* m_impl = nullptr;
};
AprilTagDetector();
~AprilTagDetector() { Destroy(); }
AprilTagDetector(const AprilTagDetector&) = delete;
AprilTagDetector& operator=(const AprilTagDetector&) = delete;
AprilTagDetector(AprilTagDetector&& rhs)
: m_impl{rhs.m_impl},
m_families{std::move(rhs.m_families)},
m_qtpCriticalAngle{rhs.m_qtpCriticalAngle} {
rhs.m_impl = nullptr;
}
AprilTagDetector& operator=(AprilTagDetector&& rhs);
/**
* @{
* @name Configuration functions
*/
/**
* Sets detector configuration.
*
* @param config Configuration
*/
void SetConfig(const Config& config);
/**
* Gets detector configuration.
*
* @return Configuration
*/
Config GetConfig() const;
/**
* Sets quad threshold parameters.
*
* @param params Parameters
*/
void SetQuadThresholdParameters(const QuadThresholdParameters& params);
/**
* Gets quad threshold parameters.
*
* @return Parameters
*/
QuadThresholdParameters GetQuadThresholdParameters() const;
/** @} */
/**
* @{
* @name Tag family functions
*/
/**
* Adds a family of tags to be detected.
*
* @param fam Family name, e.g. "tag16h5"
* @param bitsCorrected
* @return False if family can't be found
*/
bool AddFamily(std::string_view fam, int bitsCorrected = 2);
/**
* Removes a family of tags from the detector.
*
* @param fam Family name, e.g. "tag16h5"
*/
void RemoveFamily(std::string_view fam);
/**
* Unregister all families.
*/
void ClearFamilies();
/** @} */
/**
* Detect tags from an 8-bit image.
*
* @param width width of the image
* @param height height of the image
* @param stride number of bytes between image rows (often the same as width)
* @param buf image buffer
* @return Results (array of AprilTagDetection pointers)
*/
Results Detect(int width, int height, int stride, uint8_t* buf);
/**
* Detect tags from an 8-bit image.
*
* @param width width of the image
* @param height height of the image
* @param buf image buffer
* @return Results (array of AprilTagDetection pointers)
*/
Results Detect(int width, int height, uint8_t* buf) {
return Detect(width, height, width, buf);
}
private:
void Destroy();
void DestroyFamilies();
void DestroyFamily(std::string_view name, void* data);
void* m_impl;
wpi::StringMap<void*> m_families;
units::radian_t m_qtpCriticalAngle = 10_deg;
};
} // namespace frc

View File

@@ -0,0 +1,18 @@
// 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 <opencv2/core/mat.hpp>
#include "frc/apriltag/AprilTagDetector.h"
namespace frc {
inline AprilTagDetector::Results AprilTagDetect(AprilTagDetector& detector,
cv::Mat& image) {
return detector.Detect(image.cols, image.rows, image.data);
}
} // namespace frc

View File

@@ -0,0 +1,129 @@
// 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 <optional>
#include <string_view>
#include <unordered_map>
#include <vector>
#include <units/length.h>
#include <wpi/SymbolExports.h>
#include "frc/apriltag/AprilTag.h"
#include "frc/geometry/Pose3d.h"
namespace wpi {
class json;
} // namespace wpi
namespace frc {
/**
* Class for representing a layout of AprilTags on a field and reading them from
* a JSON format.
*
* The JSON format contains two top-level objects, "tags" and "field".
* The "tags" object is a list of all AprilTags contained within a layout. Each
* AprilTag serializes to a JSON object containing an ID and a Pose3d. The
* "field" object is a descriptor of the size of the field in meters with
* "width" and "length" values. This is to account for arbitrary field sizes
* when transforming the poses.
*
* Pose3ds in the JSON are measured using the normal FRC coordinate system, NWU
* with the origin at the bottom-right corner of the blue alliance wall.
* SetOrigin(OriginPosition) can be used to change the poses returned from
* GetTagPose(int) to be from the perspective of a specific alliance.
*
* Tag poses represent the center of the tag, with a zero rotation representing
* a tag that is upright and facing away from the (blue) alliance wall (that is,
* towards the opposing alliance). */
class WPILIB_DLLEXPORT AprilTagFieldLayout {
public:
enum class OriginPosition {
kBlueAllianceWallRightSide,
kRedAllianceWallRightSide,
};
AprilTagFieldLayout() = default;
/**
* Construct a new AprilTagFieldLayout with values imported from a JSON file.
*
* @param path Path of the JSON file to import from.
*/
explicit AprilTagFieldLayout(std::string_view path);
/**
* Construct a new AprilTagFieldLayout from a vector of AprilTag objects.
*
* @param apriltags Vector of AprilTags.
* @param fieldLength Length of field the layout is representing.
* @param fieldWidth Width of field the layout is representing.
*/
AprilTagFieldLayout(std::vector<AprilTag> apriltags,
units::meter_t fieldLength, units::meter_t fieldWidth);
/**
* Sets the origin based on a predefined enumeration of coordinate frame
* origins. The origins are calculated from the field dimensions.
*
* This transforms the Pose3ds returned by GetTagPose(int) to return the
* correct pose relative to a predefined coordinate frame.
*
* @param origin The predefined origin
*/
void SetOrigin(OriginPosition origin);
/**
* Sets the origin for tag pose transformation.
*
* This transforms the Pose3ds returned by GetTagPose(int) to return the
* correct pose relative to the provided origin.
*
* @param origin The new origin for tag transformations
*/
void SetOrigin(const Pose3d& origin);
/**
* Gets an AprilTag pose by its ID.
*
* @param ID The ID of the tag.
* @return The pose corresponding to the ID that was passed in or an empty
* optional if a tag with that ID is not found.
*/
std::optional<Pose3d> GetTagPose(int ID) const;
/**
* Serializes an AprilTagFieldLayout to a JSON file.
*
* @param path The path to write the JSON file to.
*/
void Serialize(std::string_view path);
/*
* Checks equality between this AprilTagFieldLayout and another object.
*/
bool operator==(const AprilTagFieldLayout&) const = default;
private:
std::unordered_map<int, AprilTag> m_apriltags;
units::meter_t m_fieldLength;
units::meter_t m_fieldWidth;
Pose3d m_origin;
friend WPILIB_DLLEXPORT void to_json(wpi::json& json,
const AprilTagFieldLayout& layout);
friend WPILIB_DLLEXPORT void from_json(const wpi::json& json,
AprilTagFieldLayout& layout);
};
WPILIB_DLLEXPORT
void to_json(wpi::json& json, const AprilTagFieldLayout& layout);
WPILIB_DLLEXPORT
void from_json(const wpi::json& json, AprilTagFieldLayout& layout);
} // namespace frc

View File

@@ -0,0 +1,32 @@
// 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>
#include <wpi/SymbolExports.h>
#include "frc/apriltag/AprilTagFieldLayout.h"
namespace frc {
enum class AprilTagField {
k2022RapidReact,
k2023ChargedUp,
// This is a placeholder for denoting the last supported field. This should
// always be the last entry in the enum and should not be used by users
kNumFields,
};
/**
* Loads an AprilTagFieldLayout from a predefined field
*
* @param field The predefined field
*/
WPILIB_DLLEXPORT AprilTagFieldLayout
LoadAprilTagLayoutField(AprilTagField field);
} // namespace frc

View File

@@ -0,0 +1,36 @@
// 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 <wpi/SymbolExports.h>
#include "frc/geometry/Transform3d.h"
namespace frc {
/** A pair of AprilTag pose estimates. */
struct WPILIB_DLLEXPORT AprilTagPoseEstimate {
/** Pose 1. */
Transform3d pose1;
/** Pose 2. */
Transform3d pose2;
/** Object-space error of pose 1. */
double error1;
/** Object-space error of pose 2. */
double error2;
/**
* Gets the ratio of pose reprojection errors, called ambiguity. Numbers
* above 0.2 are likely to be ambiguous.
*
* @return The ratio of pose reprojection errors.
*/
double GetAmbiguity() const;
};
} // namespace frc

View File

@@ -0,0 +1,145 @@
// 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 <span>
#include <units/length.h>
#include <wpi/SymbolExports.h>
#include "frc/apriltag/AprilTagPoseEstimate.h"
#include "frc/geometry/Transform3d.h"
namespace frc {
class AprilTagDetection;
/** Pose estimators for AprilTag tags. */
class WPILIB_DLLEXPORT AprilTagPoseEstimator {
public:
/** Configuration for the pose estimator. */
struct Config {
bool operator==(const Config&) const = default;
/** The tag size. */
units::meter_t tagSize;
/** Camera horizontal focal length, in pixels. */
double fx;
/** Camera vertical focal length, in pixels. */
double fy;
/** Camera horizontal focal center, in pixels. */
double cx;
/** Camera vertical focal center, in pixels. */
double cy;
};
/**
* Creates estimator.
*
* @param config Configuration
*/
explicit AprilTagPoseEstimator(const Config& config) : m_config{config} {}
/**
* Sets estimator configuration.
*
* @param config Configuration
*/
void SetConfig(const Config& config) { m_config = config; }
/**
* Gets estimator configuration.
*
* @return Configuration
*/
const Config& GetConfig() const { return m_config; }
/**
* Estimates the pose of the tag using the homography method described in [1].
*
* @param detection Tag detection
* @return Pose estimate
*/
Transform3d EstimateHomography(const AprilTagDetection& detection) const;
/**
* Estimates the pose of the tag using the homography method described in [1].
*
* @param homography Homography 3x3 matrix data
* @return Pose estimate
*/
Transform3d EstimateHomography(std::span<const double, 9> homography) const;
/**
* Estimates the pose of the tag. This returns one or two possible poses for
* the tag, along with the object-space error of each.
*
* This uses the homography method described in [1] for the initial estimate.
* Then Orthogonal Iteration [2] is used to refine this estimate. Then [3] is
* used to find a potential second local minima and Orthogonal Iteration is
* used to refine this second estimate.
*
* [1]: E. Olson, “Apriltag: A robust and flexible visual fiducial system,” in
* 2011 IEEE International Conference on Robotics and Automation,
* May 2011, pp. 34003407.
* [2]: Lu, G. D. Hager and E. Mjolsness, "Fast and globally convergent pose
* estimation from video images," in IEEE Transactions on Pattern
* Analysis and Machine Intelligence, vol. 22, no. 6, pp. 610-622, June 2000.
* doi: 10.1109/34.862199
* [3]: Schweighofer and A. Pinz, "Robust Pose Estimation from a Planar
* Target," in IEEE Transactions on Pattern Analysis and Machine Intelligence,
* vol. 28, no. 12, pp. 2024-2030, Dec. 2006. doi: 10.1109/TPAMI.2006.252
*
* @param detection Tag detection
* @param nIters Number of iterations
* @return Initial and (possibly) second pose estimates
*/
AprilTagPoseEstimate EstimateOrthogonalIteration(
const AprilTagDetection& detection, int nIters) const;
/**
* Estimates the pose of the tag. This returns one or two possible poses for
* the tag, along with the object-space error of each.
*
* @param homography Homography 3x3 matrix data
* @param corners Corner point array (X and Y for each corner in order)
* @param nIters Number of iterations
* @return Initial and (possibly) second pose estimates
*/
AprilTagPoseEstimate EstimateOrthogonalIteration(
std::span<const double, 9> homography, std::span<const double, 8> corners,
int nIters) const;
/**
* Estimates tag pose. This method is an easier to use interface to
* EstimatePoseOrthogonalIteration(), running 50 iterations and returning the
* pose with the lower object-space error.
*
* @param detection Tag detection
* @return Pose estimate
*/
Transform3d Estimate(const AprilTagDetection& detection) const;
/**
* Estimates tag pose. This method is an easier to use interface to
* EstimatePoseOrthogonalIteration(), running 50 iterations and returning the
* pose with the lower object-space error.
*
* @param homography Homography 3x3 matrix data
* @param corners Corner point array (X and Y for each corner in order)
* @return Pose estimate
*/
Transform3d Estimate(std::span<const double, 9> homography,
std::span<const double, 8> corners) const;
private:
Config m_config;
};
} // namespace frc

View File

@@ -0,0 +1,440 @@
{
"tags": [
{
"ID": 0,
"pose": {
"translation": {
"x": -0.0035306,
"y": 7.578928199999999,
"z": 0.8858503999999999
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 1,
"pose": {
"translation": {
"x": 3.2327088,
"y": 5.486654,
"z": 1.7254728
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 2,
"pose": {
"translation": {
"x": 3.067812,
"y": 5.3305202,
"z": 1.3762228
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": -0.7071067811865475
}
}
}
},
{
"ID": 3,
"pose": {
"translation": {
"x": 0.0039878,
"y": 5.058536999999999,
"z": 0.80645
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 4,
"pose": {
"translation": {
"x": 0.0039878,
"y": 3.5124898,
"z": 0.80645
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 5,
"pose": {
"translation": {
"x": 0.12110719999999998,
"y": 1.7178274,
"z": 0.8906002000000001
},
"rotation": {
"quaternion": {
"W": 0.9196502204050923,
"X": 0.0,
"Y": 0.0,
"Z": 0.39273842708457407
}
}
}
},
{
"ID": 6,
"pose": {
"translation": {
"x": 0.8733027999999999,
"y": 0.9412985999999999,
"z": 0.8906002000000001
},
"rotation": {
"quaternion": {
"W": 0.9196502204050923,
"X": 0.0,
"Y": 0.0,
"Z": 0.39273842708457407
}
}
}
},
{
"ID": 7,
"pose": {
"translation": {
"x": 1.6150844,
"y": 0.15725139999999999,
"z": 0.8906002000000001
},
"rotation": {
"quaternion": {
"W": 0.9196502204050923,
"X": 0.0,
"Y": 0.0,
"Z": 0.39273842708457407
}
}
}
},
{
"ID": 10,
"pose": {
"translation": {
"x": 16.4627306,
"y": 0.6506718,
"z": 0.8858503999999999
},
"rotation": {
"quaternion": {
"W": 6.123233995736766E-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 11,
"pose": {
"translation": {
"x": 13.2350002,
"y": 2.743454,
"z": 1.7254728
},
"rotation": {
"quaternion": {
"W": 6.123233995736766E-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 12,
"pose": {
"translation": {
"x": 13.391388000000001,
"y": 2.8998418,
"z": 1.3762228
},
"rotation": {
"quaternion": {
"W": 0.7071067811865476,
"X": 0.0,
"Y": 0.0,
"Z": 0.7071067811865475
}
}
}
},
{
"ID": 13,
"pose": {
"translation": {
"x": 16.4552122,
"y": 3.1755079999999998,
"z": 0.80645
},
"rotation": {
"quaternion": {
"W": 6.123233995736766E-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 14,
"pose": {
"translation": {
"x": 16.4552122,
"y": 4.7171356,
"z": 0.80645
},
"rotation": {
"quaternion": {
"W": 6.123233995736766E-17,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 15,
"pose": {
"translation": {
"x": 16.3350194,
"y": 6.5149729999999995,
"z": 0.8937752
},
"rotation": {
"quaternion": {
"W": -0.37298778257580906,
"X": -0.0,
"Y": 0.0,
"Z": 0.9278362538989199
}
}
}
},
{
"ID": 16,
"pose": {
"translation": {
"x": 15.5904946,
"y": 7.292695599999999,
"z": 0.8906002000000001
},
"rotation": {
"quaternion": {
"W": -0.37298778257580906,
"X": -0.0,
"Y": 0.0,
"Z": 0.9278362538989199
}
}
}
},
{
"ID": 17,
"pose": {
"translation": {
"x": 14.847188999999998,
"y": 8.0691228,
"z": 0.8906002000000001
},
"rotation": {
"quaternion": {
"W": -0.37298778257580906,
"X": -0.0,
"Y": 0.0,
"Z": 0.9278362538989199
}
}
}
},
{
"ID": 40,
"pose": {
"translation": {
"x": 7.874127,
"y": 4.9131728,
"z": 0.7032752
},
"rotation": {
"quaternion": {
"W": 0.5446390350150271,
"X": 0.0,
"Y": 0.0,
"Z": 0.838670567945424
}
}
}
},
{
"ID": 41,
"pose": {
"translation": {
"x": 7.4312271999999995,
"y": 3.759327,
"z": 0.7032752
},
"rotation": {
"quaternion": {
"W": -0.20791169081775934,
"X": -0.0,
"Y": 0.0,
"Z": 0.9781476007338057
}
}
}
},
{
"ID": 42,
"pose": {
"translation": {
"x": 8.585073,
"y": 3.3164272,
"z": 0.7032752
},
"rotation": {
"quaternion": {
"W": 0.838670567945424,
"X": 0.0,
"Y": 0.0,
"Z": -0.5446390350150271
}
}
}
},
{
"ID": 43,
"pose": {
"translation": {
"x": 9.0279728,
"y": 4.470273,
"z": 0.7032752
},
"rotation": {
"quaternion": {
"W": 0.9781476007338057,
"X": 0.0,
"Y": 0.0,
"Z": 0.20791169081775934
}
}
}
},
{
"ID": 50,
"pose": {
"translation": {
"x": 7.6790296,
"y": 4.3261534,
"z": 2.4177244
},
"rotation": {
"quaternion": {
"W": 0.17729273396782605,
"X": -0.22744989571511945,
"Y": 0.04215534644161733,
"Z": 0.9565859910053995
}
}
}
},
{
"ID": 51,
"pose": {
"translation": {
"x": 8.0182466,
"y": 3.5642296,
"z": 2.4177244
},
"rotation": {
"quaternion": {
"W": -0.5510435465842192,
"X": -0.19063969497246985,
"Y": -0.13102303230819815,
"Z": 0.8017733354717242
}
}
}
},
{
"ID": 52,
"pose": {
"translation": {
"x": 8.7801704,
"y": 3.9034466,
"z": 2.4177244
},
"rotation": {
"quaternion": {
"W": -0.9565859910053994,
"X": -0.04215534644161739,
"Y": -0.22744989571511942,
"Z": 0.17729273396782633
}
}
}
},
{
"ID": 53,
"pose": {
"translation": {
"x": 8.4409534,
"y": 4.6653704,
"z": 2.4177244
},
"rotation": {
"quaternion": {
"W": 0.8017733354717241,
"X": -0.1310230323081982,
"Y": 0.19063969497246983,
"Z": 0.5510435465842194
}
}
}
}
],
"field": {
"length": 16.4592,
"width": 8.2296
}
}

View File

@@ -0,0 +1,152 @@
{
"tags": [
{
"ID": 1,
"pose": {
"translation": {
"x": 15.513558,
"y": 1.071626,
"z": 0.462788
},
"rotation": {
"quaternion": {
"W": 0.0,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 2,
"pose": {
"translation": {
"x": 15.513558,
"y": 2.748026,
"z": 0.462788
},
"rotation": {
"quaternion": {
"W": 0.0,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 3,
"pose": {
"translation": {
"x": 15.513558,
"y": 4.424426,
"z": 0.462788
},
"rotation": {
"quaternion": {
"W": 0.0,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 4,
"pose": {
"translation": {
"x": 16.178784,
"y": 6.749796,
"z": 0.695452
},
"rotation": {
"quaternion": {
"W": 0.0,
"X": 0.0,
"Y": 0.0,
"Z": 1.0
}
}
}
},
{
"ID": 5,
"pose": {
"translation": {
"x": 0.36195,
"y": 6.749796,
"z": 0.695452
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 6,
"pose": {
"translation": {
"x": 1.02743,
"y": 4.424426,
"z": 0.462788
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 7,
"pose": {
"translation": {
"x": 1.02743,
"y": 2.748026,
"z": 0.462788
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
},
{
"ID": 8,
"pose": {
"translation": {
"x": 1.02743,
"y": 1.071626,
"z": 0.462788
},
"rotation": {
"quaternion": {
"W": 1.0,
"X": 0.0,
"Y": 0.0,
"Z": 0.0
}
}
}
}
],
"field": {
"length": 16.54175,
"width": 8.0137
}
}

View File

@@ -0,0 +1,264 @@
// 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.
package edu.wpi.first.apriltag;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import edu.wpi.first.math.geometry.Transform3d;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.util.RuntimeLoader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
@SuppressWarnings("PMD.MutableStaticState")
class AprilTagDetectorTest {
@SuppressWarnings("MemberName")
AprilTagDetector detector;
static RuntimeLoader<Core> loader;
@BeforeAll
static void beforeAll() {
try {
loader =
new RuntimeLoader<>(
Core.NATIVE_LIBRARY_NAME, RuntimeLoader.getDefaultExtractionRoot(), Core.class);
loader.loadLibrary();
} catch (IOException ex) {
fail(ex);
}
}
@BeforeEach
void beforeEach() {
detector = new AprilTagDetector();
}
@AfterEach
void afterEach() {
detector.close();
}
@Test
void testConfigDefaults() {
var config = detector.getConfig();
assertEquals(new AprilTagDetector.Config(), config);
}
@Test
void testQtpDefaults() {
var params = detector.getQuadThresholdParameters();
assertEquals(new AprilTagDetector.QuadThresholdParameters(), params);
}
@Test
void testSetConfigNumThreads() {
var newConfig = new AprilTagDetector.Config();
newConfig.numThreads = 2;
detector.setConfig(newConfig);
var config = detector.getConfig();
assertEquals(2, config.numThreads);
}
@Test
void testQtpMinClusterPixels() {
var newParams = new AprilTagDetector.QuadThresholdParameters();
newParams.minClusterPixels = 8;
detector.setQuadThresholdParameters(newParams);
var params = detector.getQuadThresholdParameters();
assertEquals(8, params.minClusterPixels);
}
@Test
void testAdd16h5() {
assertDoesNotThrow(() -> detector.addFamily("tag16h5"));
// duplicate addition is also okay
assertDoesNotThrow(() -> detector.addFamily("tag16h5"));
}
@Test
void testAdd25h9() {
assertDoesNotThrow(() -> detector.addFamily("tag25h9"));
}
@Test
void testAdd36h11() {
assertDoesNotThrow(() -> detector.addFamily("tag36h11"));
}
@Test
void testAddMultiple() {
assertDoesNotThrow(() -> detector.addFamily("tag16h5"));
assertDoesNotThrow(() -> detector.addFamily("tag36h11"));
}
@Test
void testRemoveFamily() {
// okay to remove non-existent family
detector.removeFamily("tag16h5");
// add and remove
detector.addFamily("tag16h5");
detector.removeFamily("tag16h5");
}
@SuppressWarnings("PMD.AssignmentInOperand")
public Mat loadImage(String resource) throws IOException {
Mat encoded;
try (InputStream is = getClass().getResource(resource).openStream()) {
try (ByteArrayOutputStream os = new ByteArrayOutputStream(is.available())) {
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = is.read(buffer)) != -1) {
os.write(buffer, 0, bytesRead);
}
encoded = new Mat(1, os.size(), CvType.CV_8U);
encoded.put(0, 0, os.toByteArray());
}
}
Mat image = Imgcodecs.imdecode(encoded, Imgcodecs.IMREAD_COLOR);
encoded.release();
Imgproc.cvtColor(image, image, Imgproc.COLOR_BGR2GRAY);
return image;
}
@Test
void testDecodeAndPose() {
detector.addFamily("tag16h5");
detector.addFamily("tag36h11");
Mat image;
try {
image = loadImage("tag1_640_480.jpg");
} catch (IOException ex) {
fail(ex);
return;
}
try {
AprilTagDetection[] results = detector.detect(image);
assertEquals(1, results.length);
assertEquals("tag36h11", results[0].getFamily());
assertEquals(1, results[0].getId());
assertEquals(0, results[0].getHamming());
var estimator =
new AprilTagPoseEstimator(new AprilTagPoseEstimator.Config(0.2, 500, 500, 320, 240));
AprilTagPoseEstimate est = estimator.estimateOrthogonalIteration(results[0], 50);
assertEquals(new Transform3d(), est.pose2);
Transform3d pose = estimator.estimate(results[0]);
assertEquals(est.pose1, pose);
} finally {
image.release();
}
}
/**
* This tag is rotated such that the top is closer to the camera than the bottom. In the camera
* frame, with +x to the right, this is a rotation about +X by 45 degrees.
*/
@Test
void testPoseRotatedX() {
detector.addFamily("tag16h5");
Mat image;
try {
image = loadImage("tag2_45deg_X.png");
} catch (IOException ex) {
fail(ex);
return;
}
try {
AprilTagDetection[] results = detector.detect(image);
assertEquals(1, results.length);
var estimator =
new AprilTagPoseEstimator(
new AprilTagPoseEstimator.Config(
0.2, 500, 500, image.cols() / 2.0, image.rows() / 2.0));
AprilTagPoseEstimate est = estimator.estimateOrthogonalIteration(results[0], 50);
assertEquals(Units.degreesToRadians(45), est.pose1.getRotation().getX(), 0.1);
assertEquals(Units.degreesToRadians(0), est.pose1.getRotation().getY(), 0.1);
assertEquals(Units.degreesToRadians(0), est.pose1.getRotation().getZ(), 0.1);
} finally {
image.release();
}
}
/**
* This tag is rotated such that the right is closer to the camera than the left. In the camera
* frame, with +y down, this is a rotation of 45 degrees about +y.
*/
@Test
void testPoseRotatedY() {
detector.addFamily("tag16h5");
Mat image;
try {
image = loadImage("tag2_45deg_y.png");
} catch (IOException ex) {
fail(ex);
return;
}
try {
AprilTagDetection[] results = detector.detect(image);
assertEquals(1, results.length);
var estimator =
new AprilTagPoseEstimator(
new AprilTagPoseEstimator.Config(
0.2, 500, 500, image.cols() / 2.0, image.rows() / 2.0));
AprilTagPoseEstimate est = estimator.estimateOrthogonalIteration(results[0], 50);
assertEquals(Units.degreesToRadians(0), est.pose1.getRotation().getX(), 0.1);
assertEquals(Units.degreesToRadians(45), est.pose1.getRotation().getY(), 0.1);
assertEquals(Units.degreesToRadians(0), est.pose1.getRotation().getZ(), 0.1);
} finally {
image.release();
}
}
/** This tag is facing right at the camera -- no rotation should be observed. */
@Test
void testPoseStraightOn() {
detector.addFamily("tag16h5");
Mat image;
try {
image = loadImage("tag2_16h5_straight.png");
} catch (IOException ex) {
fail(ex);
return;
}
try {
AprilTagDetection[] results = detector.detect(image);
assertEquals(1, results.length);
var estimator =
new AprilTagPoseEstimator(
new AprilTagPoseEstimator.Config(
0.2, 500, 500, image.cols() / 2.0, image.rows() / 2.0));
AprilTagPoseEstimate est = estimator.estimateOrthogonalIteration(results[0], 50);
assertEquals(Units.degreesToRadians(0), est.pose1.getRotation().getX(), 0.1);
assertEquals(Units.degreesToRadians(0), est.pose1.getRotation().getY(), 0.1);
assertEquals(Units.degreesToRadians(0), est.pose1.getRotation().getZ(), 0.1);
} finally {
image.release();
}
}
}

View File

@@ -0,0 +1,46 @@
// 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.
package edu.wpi.first.apriltag;
import static org.junit.jupiter.api.Assertions.assertEquals;
import edu.wpi.first.math.geometry.Pose3d;
import edu.wpi.first.math.geometry.Rotation3d;
import edu.wpi.first.math.geometry.Translation3d;
import edu.wpi.first.math.util.Units;
import java.util.List;
import org.junit.jupiter.api.Test;
class AprilTagPoseSetOriginTest {
@Test
void transformationMatches() {
var layout =
new AprilTagFieldLayout(
List.of(
new AprilTag(1, new Pose3d(new Translation3d(0, 0, 0), new Rotation3d(0, 0, 0))),
new AprilTag(
2,
new Pose3d(
new Translation3d(
Units.feetToMeters(4.0), Units.feetToMeters(4), Units.feetToMeters(4)),
new Rotation3d(0, 0, Units.degreesToRadians(180))))),
Units.feetToMeters(54.0),
Units.feetToMeters(27.0));
layout.setOrigin(AprilTagFieldLayout.OriginPosition.kRedAllianceWallRightSide);
assertEquals(
new Pose3d(
new Translation3d(Units.feetToMeters(54.0), Units.feetToMeters(27.0), 0.0),
new Rotation3d(0.0, 0.0, Units.degreesToRadians(180.0))),
layout.getTagPose(1).orElse(null));
assertEquals(
new Pose3d(
new Translation3d(
Units.feetToMeters(50.0), Units.feetToMeters(23.0), Units.feetToMeters(4)),
new Rotation3d(0.0, 0.0, 0)),
layout.getTagPose(2).orElse(null));
}
}

View File

@@ -0,0 +1,38 @@
// 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.
package edu.wpi.first.apriltag;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import com.fasterxml.jackson.databind.ObjectMapper;
import edu.wpi.first.math.geometry.Pose3d;
import edu.wpi.first.math.geometry.Rotation3d;
import edu.wpi.first.math.util.Units;
import java.util.List;
import org.junit.jupiter.api.Test;
class AprilTagSerializationTest {
@Test
void deserializeMatches() {
var layout =
new AprilTagFieldLayout(
List.of(
new AprilTag(1, new Pose3d(0, 0, 0, new Rotation3d(0, 0, 0))),
new AprilTag(3, new Pose3d(0, 1, 0, new Rotation3d(0, 0, 0)))),
Units.feetToMeters(54.0),
Units.feetToMeters(27.0));
var objectMapper = new ObjectMapper();
var deserialized =
assertDoesNotThrow(
() ->
objectMapper.readValue(
objectMapper.writeValueAsString(layout), AprilTagFieldLayout.class));
assertEquals(layout, deserialized);
}
}

View File

@@ -0,0 +1,71 @@
// 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.
package edu.wpi.first.apriltag;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import edu.wpi.first.math.geometry.Pose3d;
import edu.wpi.first.math.geometry.Rotation3d;
import edu.wpi.first.math.util.Units;
import java.io.IOException;
import java.util.Optional;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
class LoadConfigTest {
@ParameterizedTest
@EnumSource(AprilTagFields.class)
void testLoad(AprilTagFields field) {
AprilTagFieldLayout layout = Assertions.assertDoesNotThrow(field::loadAprilTagLayoutField);
assertNotNull(layout);
}
@Test
void test2022RapidReact() throws IOException {
AprilTagFieldLayout layout = AprilTagFields.k2022RapidReact.loadAprilTagLayoutField();
// Blue Hangar Truss - Hub
Pose3d expectedPose =
new Pose3d(
Units.inchesToMeters(127.272),
Units.inchesToMeters(216.01),
Units.inchesToMeters(67.932),
new Rotation3d(0, 0, 0));
Optional<Pose3d> maybePose = layout.getTagPose(1);
assertTrue(maybePose.isPresent());
assertEquals(expectedPose, maybePose.get());
// Blue Terminal Near Station
expectedPose =
new Pose3d(
Units.inchesToMeters(4.768),
Units.inchesToMeters(67.631),
Units.inchesToMeters(35.063),
new Rotation3d(0, 0, Math.toRadians(46.25)));
maybePose = layout.getTagPose(5);
assertTrue(maybePose.isPresent());
assertEquals(expectedPose, maybePose.get());
// Upper Hub Blue-Near
expectedPose =
new Pose3d(
Units.inchesToMeters(332.321),
Units.inchesToMeters(183.676),
Units.inchesToMeters(95.186),
new Rotation3d(0, Math.toRadians(26.75), Math.toRadians(69)));
maybePose = layout.getTagPose(53);
assertTrue(maybePose.isPresent());
assertEquals(expectedPose, maybePose.get());
// Doesn't exist
maybePose = layout.getTagPose(54);
assertFalse(maybePose.isPresent());
}
}

View File

@@ -0,0 +1,67 @@
// 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.
#include "frc/apriltag/AprilTagDetector.h"
#include "gtest/gtest.h"
using namespace frc;
TEST(AprilTagDetectorTest, ConfigDefaults) {
AprilTagDetector detector;
auto config = detector.GetConfig();
ASSERT_EQ(config, AprilTagDetector::Config{});
}
TEST(AprilTagDetectorTest, QtpDefaults) {
AprilTagDetector detector;
auto params = detector.GetQuadThresholdParameters();
ASSERT_EQ(params, AprilTagDetector::QuadThresholdParameters{});
}
TEST(AprilTagDetectorTest, SetConfigNumThreads) {
AprilTagDetector detector;
detector.SetConfig({.numThreads = 2});
auto config = detector.GetConfig();
ASSERT_EQ(config.numThreads, 2);
}
TEST(AprilTagDetectorTest, QtpMinClusterPixels) {
AprilTagDetector detector;
detector.SetQuadThresholdParameters({.minClusterPixels = 8});
auto params = detector.GetQuadThresholdParameters();
ASSERT_EQ(params.minClusterPixels, 8);
}
TEST(AprilTagDetectorTest, Add16h5) {
AprilTagDetector detector;
ASSERT_TRUE(detector.AddFamily("tag16h5"));
// duplicate addition is also okay
ASSERT_TRUE(detector.AddFamily("tag16h5"));
}
TEST(AprilTagDetectorTest, Add25h9) {
AprilTagDetector detector;
ASSERT_TRUE(detector.AddFamily("tag25h9"));
}
TEST(AprilTagDetectorTest, Add36h11) {
AprilTagDetector detector;
ASSERT_TRUE(detector.AddFamily("tag36h11"));
}
TEST(AprilTagDetectorTest, AddMultiple) {
AprilTagDetector detector;
ASSERT_TRUE(detector.AddFamily("tag16h5"));
ASSERT_TRUE(detector.AddFamily("tag36h11"));
}
TEST(AprilTagDetectorTest, RemoveFamily) {
AprilTagDetector detector;
// okay to remove non-existent family
detector.RemoveFamily("tag16h5");
// add and remove
detector.AddFamily("tag16h5");
detector.RemoveFamily("tag16h5");
}

View File

@@ -0,0 +1,27 @@
// 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.
#include <vector>
#include <wpi/json.h>
#include "frc/apriltag/AprilTag.h"
#include "frc/apriltag/AprilTagFieldLayout.h"
#include "frc/geometry/Pose3d.h"
#include "gtest/gtest.h"
using namespace frc;
TEST(AprilTagJsonTest, DeserializeMatches) {
auto layout = AprilTagFieldLayout{
std::vector{
AprilTag{1, Pose3d{}},
AprilTag{3, Pose3d{0_m, 1_m, 0_m, Rotation3d{0_deg, 0_deg, 0_deg}}}},
54_ft, 27_ft};
AprilTagFieldLayout deserialized;
wpi::json json = layout;
EXPECT_NO_THROW(deserialized = json.get<AprilTagFieldLayout>());
EXPECT_EQ(layout, deserialized);
}

View File

@@ -0,0 +1,33 @@
// 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.
#include <vector>
#include <wpi/json.h>
#include "frc/apriltag/AprilTag.h"
#include "frc/apriltag/AprilTagFieldLayout.h"
#include "frc/geometry/Pose3d.h"
#include "gtest/gtest.h"
using namespace frc;
TEST(AprilTagPoseSetOriginTest, TransformationMatches) {
auto layout = AprilTagFieldLayout{
std::vector<AprilTag>{
AprilTag{1,
Pose3d{0_ft, 0_ft, 0_ft, Rotation3d{0_deg, 0_deg, 0_deg}}},
AprilTag{
2, Pose3d{4_ft, 4_ft, 4_ft, Rotation3d{0_deg, 0_deg, 180_deg}}}},
54_ft, 27_ft};
layout.SetOrigin(
AprilTagFieldLayout::OriginPosition::kRedAllianceWallRightSide);
auto mirrorPose =
Pose3d{54_ft, 27_ft, 0_ft, Rotation3d{0_deg, 0_deg, 180_deg}};
EXPECT_EQ(mirrorPose, *layout.GetTagPose(1));
mirrorPose = Pose3d{50_ft, 23_ft, 4_ft, Rotation3d{0_deg, 0_deg, 0_deg}};
EXPECT_EQ(mirrorPose, *layout.GetTagPose(2));
}

View File

@@ -0,0 +1,61 @@
// 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.
#include "frc/apriltag/AprilTagFields.h"
#include "gtest/gtest.h"
namespace frc {
std::vector<AprilTagField> GetAllFields() {
std::vector<AprilTagField> output;
for (int i = 0; i < static_cast<int>(AprilTagField::kNumFields); ++i) {
output.push_back(static_cast<AprilTagField>(i));
}
return output;
}
TEST(AprilTagFieldsTest, TestLoad2022RapidReact) {
AprilTagFieldLayout layout =
LoadAprilTagLayoutField(AprilTagField::k2022RapidReact);
// Blue Hangar Truss - Hub
auto expectedPose =
Pose3d{127.272_in, 216.01_in, 67.932_in, Rotation3d{0_deg, 0_deg, 0_deg}};
auto maybePose = layout.GetTagPose(1);
EXPECT_TRUE(maybePose);
EXPECT_EQ(expectedPose, *maybePose);
// Blue Terminal Near Station
expectedPose = Pose3d{4.768_in, 67.631_in, 35.063_in,
Rotation3d{0_deg, 0_deg, 46.25_deg}};
maybePose = layout.GetTagPose(5);
EXPECT_TRUE(maybePose);
EXPECT_EQ(expectedPose, *maybePose);
// Upper Hub Blue-Near
expectedPose = Pose3d{332.321_in, 183.676_in, 95.186_in,
Rotation3d{0_deg, 26.75_deg, 69_deg}};
maybePose = layout.GetTagPose(53);
EXPECT_TRUE(maybePose);
EXPECT_EQ(expectedPose, *maybePose);
// Doesn't exist
maybePose = layout.GetTagPose(54);
EXPECT_FALSE(maybePose);
}
// Test all of the fields in the enum
class AllFieldsFixtureTest : public ::testing::TestWithParam<AprilTagField> {};
TEST_P(AllFieldsFixtureTest, CheckEntireEnum) {
AprilTagField field = GetParam();
EXPECT_NO_THROW(LoadAprilTagLayoutField(field));
}
INSTANTIATE_TEST_SUITE_P(ValuesEnumTestInstTests, AllFieldsFixtureTest,
::testing::ValuesIn(GetAllFields()));
} // namespace frc

View File

@@ -0,0 +1,11 @@
// 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.
#include "gtest/gtest.h"
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
return ret;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,10 +0,0 @@
cmake_minimum_required(VERSION 2.8)
INCLUDE(CMakeForceCompiler)
set(ARM_PREFIX arm-none-linux-gnueabi)
set(CMAKE_SYSTEM_NAME Linux)
CMAKE_FORCE_CXX_COMPILER(${ARM_PREFIX}-g++ GNU)
CMAKE_FORCE_C_COMPILER(${ARM_PREFIX}-gcc GNU)
set(CMAKE_CXX_FLAGS "-march=armv7-a -mcpu=cortex-a9 -mfloat-abi=softfp -Wall -Wno-psabi" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g" CACHE STRING "" FORCE) # still want debugging for release?
SET(CMAKE_FIND_ROOT_PATH $ENV{USER_HOME}/wpilib/toolchains/arm-none-linux-gnueabi-4.4.1/arm-none-linux-gnueabi/libc)

View File

@@ -0,0 +1,92 @@
# Testing steps for real hardware
trigger:
batch: true
branches:
include:
- master
stages:
- stage: Build
jobs:
- job: IntegrationTests
displayName: Integration Tests
pool:
vmImage: 'ubuntu-latest'
container:
image: wpilib/roborio-cross-ubuntu:2023-22.04
timeoutInMinutes: 0
steps:
- task: Gradle@2
condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v')))
inputs:
workingDirectory: ""
gradleWrapperFile: "gradlew"
gradleOptions: "-Xmx3072m"
publishJUnitResults: false
testResultsFiles: "**/TEST-*.xml"
tasks: "copyWpilibJIntegrationTestJarToOutput copyWpilibCTestLibrariesToOutput"
options: "-Ponlylinuxathena -PbuildServer -PskipJavaFormat"
- task: PublishPipelineArtifact@0
inputs:
artifactName: "Integration Tests"
targetPath: "build/integrationTestFiles"
- stage: TestBench
displayName: Test Bench
condition: false
jobs:
- job: Cpp
displayName: C++
pool: RoboRioConnections
timeoutInMinutes: 30
workspace:
clean: all
steps:
- task: DownloadPipelineArtifact@0
inputs:
artifactName: "Integration Tests"
targetPath: "build/integrationTestFiles"
- task: ShellScript@2
displayName: Run C++ Tests
inputs:
scriptPath: test-scripts/deploy-and-run-test-on-robot.sh
args: 'cpp -A "--gtest_output=xml:/home/admin/testResults/cppreport.xml"'
- task: PublishTestResults@2
displayName: Publish C++ Test Results
inputs:
testResultsFormat: "JUnit"
testResultsFiles: "*.xml"
testRunTitle: "C++ Test Report"
searchFolder: "$(System.DefaultWorkingDirectory)/test-reports"
- job: Java
pool: RoboRioConnections
timeoutInMinutes: 30
workspace:
clean: all
steps:
- task: DownloadPipelineArtifact@0
inputs:
artifactName: "Integration Tests"
targetPath: "build/integrationTestFiles"
- task: ShellScript@2
displayName: Run Java Tests
inputs:
scriptPath: test-scripts/deploy-and-run-test-on-robot.sh
args: "java"
- task: PublishTestResults@2
displayName: Publish Java Test Results
inputs:
testResultsFormat: "JUnit"
testResultsFiles: "*.xml"
testRunTitle: "Java Test Report"
searchFolder: "$(System.DefaultWorkingDirectory)/test-reports"

171
build.gradle Normal file
View File

@@ -0,0 +1,171 @@
import edu.wpi.first.toolchain.*
buildscript {
repositories {
maven {
url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn'
}
}
dependencies {
classpath 'com.hubspot.jinjava:jinjava:2.6.0'
}
}
plugins {
id 'base'
id 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' version '2023.0.1'
id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2020.2'
id 'edu.wpi.first.NativeUtils' apply false
id 'edu.wpi.first.GradleJni' version '1.1.0'
id 'edu.wpi.first.GradleVsCode'
id 'idea'
id 'visual-studio'
id 'net.ltgt.errorprone' version '2.0.2' apply false
id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
id 'com.diffplug.spotless' version '6.12.0' apply false
id 'com.github.spotbugs' version '5.0.8' apply false
}
wpilibVersioning.buildServerMode = project.hasProperty('buildServer')
wpilibVersioning.releaseMode = project.hasProperty('releaseMode')
allprojects {
repositories {
maven {
url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn'
}
}
if (project.hasProperty('releaseMode')) {
wpilibRepositories.addAllReleaseRepositories(it)
} else {
wpilibRepositories.addAllDevelopmentRepositories(it)
}
}
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
publishAlways()
}
ext.licenseFile = files("$rootDir/LICENSE.md", "$rootDir/ThirdPartyNotices.txt")
if (project.hasProperty("publishVersion")) {
wpilibVersioning.version.set(project.publishVersion)
}
wpilibVersioning.version.finalizeValue()
def outputsFolder = file("$buildDir/allOutputs")
def versionFile = file("$outputsFolder/version.txt")
task outputVersions() {
description = 'Prints the versions of wpilib to a file for use by the downstream packaging project'
group = 'Build'
outputs.files(versionFile)
doFirst {
buildDir.mkdir()
outputsFolder.mkdir()
}
doLast {
versionFile.write wpilibVersioning.version.get()
}
}
task libraryBuild() {}
build.dependsOn outputVersions
task copyAllOutputs(type: Copy) {
destinationDir outputsFolder
}
build.dependsOn copyAllOutputs
copyAllOutputs.dependsOn outputVersions
def copyReleaseOnly = project.hasProperty('ciReleaseOnly')
ext.addTaskToCopyAllOutputs = { task ->
if (copyReleaseOnly && task.name.contains('debug')) {
return
}
copyAllOutputs.dependsOn task
copyAllOutputs.inputs.file task.archivePath
copyAllOutputs.from task.archivePath
}
subprojects {
apply plugin: 'eclipse'
apply plugin: 'idea'
def subproj = it
plugins.withType(NativeComponentPlugin) {
subproj.apply plugin: MultiBuilds
}
plugins.withType(JavaPlugin) {
sourceCompatibility = 11
targetCompatibility = 11
}
apply from: "${rootDir}/shared/java/javastyle.gradle"
// Disables doclint in java 8.
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
if (project.name != "docs") {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
}
// Enables UTF-8 support in Javadoc
tasks.withType(Javadoc) {
options.addStringOption("charset", "utf-8")
options.addStringOption("docencoding", "utf-8")
options.addStringOption("encoding", "utf-8")
}
// Sign outputs with Developer ID
tasks.withType(AbstractLinkTask) { task ->
task.inputs.property "HasDeveloperId", project.hasProperty("developerID")
if (project.hasProperty("developerID")) {
// Don't sign any executables because codesign complains
// about relative rpath.
if (!(task instanceof LinkExecutable)) {
doLast {
// Get path to binary.
String path = task.getLinkedFile().getAsFile().get().getAbsolutePath()
exec {
workingDir rootDir
def args = [
"sh",
"-c",
"codesign --force --strict --timestamp --options=runtime " +
"--verbose -s ${project.findProperty("developerID")} ${path}"
]
commandLine args
}
}
}
}
}
}
ext.getCurrentArch = {
return NativePlatforms.desktop
}
wrapper {
gradleVersion = '7.5.1'
}

13
buildSrc/build.gradle Normal file
View File

@@ -0,0 +1,13 @@
repositories {
maven {
mavenLocal()
maven {
url = 'https://frcmaven.wpi.edu/artifactory/ex-gradle'
}
mavenCentral()
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
implementation "edu.wpi.first:native-utils:2023.11.1"
}

View File

@@ -0,0 +1,70 @@
import org.gradle.api.GradleException;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.file.FileTree;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.language.base.internal.ProjectLayout;
import org.gradle.language.base.plugins.ComponentModelBasePlugin;
import org.gradle.language.nativeplatform.tasks.AbstractNativeSourceCompileTask;
import org.gradle.model.ModelMap;
import edu.wpi.first.toolchain.ToolchainExtension
import org.gradle.model.Mutate;
import org.gradle.api.plugins.ExtensionContainer;
import org.gradle.nativeplatform.test.googletest.GoogleTestTestSuiteBinarySpec;
import org.gradle.model.RuleSource;
import org.gradle.model.Validate;
import org.gradle.nativeplatform.NativeExecutableBinarySpec
import org.gradle.nativeplatform.NativeBinarySpec;
import org.gradle.nativeplatform.NativeComponentSpec;
import org.gradle.nativeplatform.NativeLibrarySpec;
import org.gradle.nativeplatform.SharedLibraryBinarySpec;
import org.gradle.nativeplatform.StaticLibraryBinarySpec;
import org.gradle.nativeplatform.platform.internal.NativePlatformInternal;
import org.gradle.nativeplatform.toolchain.NativeToolChain;
import org.gradle.nativeplatform.toolchain.NativeToolChainRegistry;
import org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider;
import org.gradle.nativeplatform.toolchain.internal.ToolType;
import org.gradle.nativeplatform.toolchain.internal.gcc.AbstractGccCompatibleToolChain;
import org.gradle.nativeplatform.toolchain.internal.msvcpp.VisualCppToolChain;
import org.gradle.nativeplatform.toolchain.internal.tools.ToolRegistry;
import org.gradle.platform.base.BinarySpec;
import org.gradle.platform.base.ComponentSpec;
import org.gradle.platform.base.ComponentSpecContainer;
import org.gradle.platform.base.BinaryContainer;
import org.gradle.platform.base.ComponentType;
import org.gradle.platform.base.TypeBuilder;
import org.gradle.nativeplatform.tasks.ObjectFilesToBinary;
import groovy.transform.CompileStatic;
import groovy.transform.CompileDynamic
import org.gradle.nativeplatform.BuildTypeContainer
@CompileStatic
class DisableBuildingGTest implements Plugin<Project> {
@CompileStatic
public void apply(Project project) {
}
@CompileStatic
static class Rules extends RuleSource {
@CompileDynamic
private static void setBuildableFalseDynamically(NativeBinarySpec binary) {
binary.buildable = false
}
@Validate
@CompileStatic
// TODO: Move this to tc plugin
void disableCrossTests(BinaryContainer binaries, ExtensionContainer extContainer) {
final ToolchainExtension ext = extContainer.getByType(ToolchainExtension.class);
for (GoogleTestTestSuiteBinarySpec binary : binaries.withType(GoogleTestTestSuiteBinarySpec.class)) {
if (ext.getCrossCompilers().findByName(binary.getTargetPlatform().getName()) != null) {
setBuildableFalseDynamically(binary)
}
}
}
}
}

View File

@@ -0,0 +1,88 @@
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import org.gradle.api.GradleException;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.file.FileTree;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.language.base.internal.ProjectLayout;
import org.gradle.language.base.plugins.ComponentModelBasePlugin;
import org.gradle.language.nativeplatform.tasks.AbstractNativeSourceCompileTask;
import org.gradle.model.ModelMap;
import org.gradle.model.Mutate;
import org.gradle.model.RuleSource;
import org.gradle.model.Validate;
import org.gradle.nativeplatform.NativeBinarySpec;
import org.gradle.nativeplatform.NativeComponentSpec;
import org.gradle.nativeplatform.NativeLibrarySpec;
import org.gradle.nativeplatform.SharedLibraryBinarySpec;
import org.gradle.nativeplatform.StaticLibraryBinarySpec;
import org.gradle.nativeplatform.platform.internal.NativePlatformInternal;
import org.gradle.nativeplatform.toolchain.NativeToolChain;
import org.gradle.nativeplatform.toolchain.NativeToolChainRegistry;
import org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider;
import org.gradle.nativeplatform.toolchain.internal.ToolType;
import org.gradle.nativeplatform.toolchain.internal.gcc.AbstractGccCompatibleToolChain;
import org.gradle.nativeplatform.toolchain.internal.msvcpp.VisualCppToolChain;
import org.gradle.nativeplatform.toolchain.internal.tools.ToolRegistry;
import org.gradle.nativeplatform.test.googletest.GoogleTestTestSuiteBinarySpec;
import org.gradle.platform.base.BinarySpec;
import org.gradle.platform.base.ComponentSpec;
import org.gradle.platform.base.ComponentSpecContainer;
import org.gradle.platform.base.ComponentType;
import org.gradle.platform.base.TypeBuilder;
import org.gradle.nativeplatform.test.tasks.RunTestExecutable;
import org.gradle.platform.base.BinaryContainer;
import groovy.transform.CompileStatic;
@CompileStatic
class ExtraTasks implements Plugin<Project> {
@CompileStatic
public void apply(Project project) {
}
@CompileStatic
static class Rules extends RuleSource {
@Mutate
@CompileStatic
void createNativeCompileTask(ModelMap<Task> tasks, BinaryContainer binaries) {
tasks.create('compileCpp', Task) { oTask ->
def task = (Task) oTask
task.group = 'build'
task.description = 'Uber task to compile all native code for this project'
binaries.each { binary ->
if (binary instanceof NativeBinarySpec && binary.buildable) {
binary.tasks.withType(AbstractNativeSourceCompileTask) { compileTask ->
task.dependsOn compileTask
}
}
}
}
}
@Mutate
@CompileStatic
void createNativeTestTask(ModelMap<Task> tasks, BinaryContainer binaries) {
tasks.create('testCpp', Task) { oTask ->
def task = (Task) oTask
task.group = 'build'
task.description = 'Uber task to run all native tests for project'
binaries.each { binary ->
if (binary instanceof GoogleTestTestSuiteBinarySpec && binary.buildable) {
binary.tasks.withType(RunTestExecutable) { testTask ->
task.dependsOn testTask
}
}
}
}
}
}
}

View File

@@ -0,0 +1,74 @@
import org.gradle.api.GradleException;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.file.FileTree;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.language.base.internal.ProjectLayout;
import org.gradle.language.base.plugins.ComponentModelBasePlugin;
import org.gradle.language.nativeplatform.tasks.AbstractNativeSourceCompileTask;
import org.gradle.model.ModelMap;
import edu.wpi.first.toolchain.ToolchainExtension
import org.gradle.model.Mutate;
import org.gradle.api.plugins.ExtensionContainer;
import org.gradle.nativeplatform.test.googletest.GoogleTestTestSuiteBinarySpec;
import org.gradle.model.RuleSource;
import org.gradle.model.Validate;
import org.gradle.nativeplatform.test.tasks.RunTestExecutable
import org.gradle.nativeplatform.NativeExecutableBinarySpec
import org.gradle.nativeplatform.NativeBinarySpec;
import org.gradle.nativeplatform.NativeComponentSpec;
import org.gradle.nativeplatform.NativeLibrarySpec;
import org.gradle.nativeplatform.SharedLibraryBinarySpec;
import org.gradle.nativeplatform.StaticLibraryBinarySpec;
import org.gradle.nativeplatform.platform.internal.NativePlatformInternal;
import org.gradle.nativeplatform.toolchain.NativeToolChain;
import org.gradle.nativeplatform.toolchain.NativeToolChainRegistry;
import org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider;
import org.gradle.nativeplatform.toolchain.internal.ToolType;
import org.gradle.nativeplatform.toolchain.internal.gcc.AbstractGccCompatibleToolChain;
import org.gradle.nativeplatform.toolchain.internal.msvcpp.VisualCppToolChain;
import org.gradle.nativeplatform.toolchain.internal.tools.ToolRegistry;
import org.gradle.platform.base.BinarySpec;
import org.gradle.platform.base.ComponentSpec;
import org.gradle.platform.base.ComponentSpecContainer;
import org.gradle.platform.base.BinaryContainer;
import org.gradle.platform.base.ComponentType;
import org.gradle.platform.base.TypeBuilder;
import org.gradle.nativeplatform.tasks.ObjectFilesToBinary;
import groovy.transform.CompileStatic;
import groovy.transform.CompileDynamic
import org.gradle.nativeplatform.BuildTypeContainer
@CompileStatic
class MultiBuilds implements Plugin<Project> {
@CompileStatic
public void apply(Project project) {
}
@CompileStatic
static class Rules extends RuleSource {
@CompileDynamic
private static void setBuildableFalseDynamically(NativeBinarySpec binary) {
binary.buildable = false
}
@Mutate
@CompileStatic
void disableReleaseGoogleTest(BinaryContainer binaries, ProjectLayout projectLayout) {
def project = (Project) projectLayout.projectIdentifier
if (project.hasProperty('testRelease')) {
return
}
binaries.withType(GoogleTestTestSuiteBinarySpec) { oSpec ->
GoogleTestTestSuiteBinarySpec spec = (GoogleTestTestSuiteBinarySpec) oSpec
if (spec.buildType.name == 'release') {
Rules.setBuildableFalseDynamically(spec)
}
}
}
}
}

View File

@@ -0,0 +1,172 @@
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import org.gradle.api.tasks.Delete
import org.gradle.api.GradleException;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.tasks.Copy;
import org.gradle.api.file.CopySpec;
import org.gradle.api.file.FileTree;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.language.base.internal.ProjectLayout;
import org.gradle.language.base.plugins.ComponentModelBasePlugin;
import org.gradle.language.nativeplatform.tasks.AbstractNativeSourceCompileTask;
import org.gradle.model.ModelMap;
import org.gradle.model.Mutate;
import org.gradle.model.RuleSource;
import org.gradle.model.Validate;
import org.gradle.nativeplatform.NativeBinarySpec;
import org.gradle.nativeplatform.NativeComponentSpec;
import org.gradle.nativeplatform.NativeLibrarySpec;
import org.gradle.nativeplatform.SharedLibraryBinarySpec;
import org.gradle.nativeplatform.StaticLibraryBinarySpec;
import org.gradle.nativeplatform.platform.internal.NativePlatformInternal;
import org.gradle.nativeplatform.toolchain.NativeToolChain;
import org.gradle.nativeplatform.toolchain.NativeToolChainRegistry;
import org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider;
import org.gradle.nativeplatform.toolchain.internal.ToolType;
import org.gradle.nativeplatform.toolchain.internal.gcc.AbstractGccCompatibleToolChain;
import org.gradle.nativeplatform.toolchain.internal.msvcpp.VisualCppToolChain;
import org.gradle.nativeplatform.toolchain.internal.tools.ToolRegistry;
import org.gradle.nativeplatform.tasks.CreateStaticLibrary;
import org.gradle.nativeplatform.tasks.AbstractLinkTask;
import org.gradle.platform.base.BinarySpec;
import org.gradle.platform.base.ComponentSpec;
import org.gradle.platform.base.ComponentSpecContainer;
import org.gradle.platform.base.BinaryContainer;
import org.gradle.platform.base.ComponentType;
import org.gradle.platform.base.TypeBuilder;
import org.gradle.nativeplatform.tasks.ObjectFilesToBinary;
import groovy.transform.CompileStatic;
import edu.wpi.first.nativeutils.exports.ExportsGenerationTask
@CompileStatic
class SingleNativeBuild implements Plugin<Project> {
@CompileStatic
public void apply(Project project) {
}
@CompileStatic
static class Rules extends RuleSource {
@Mutate
@CompileStatic
void removeMacSystemIncludes(ModelMap<Task> tasks, BinaryContainer binaries) {
binaries.each {
if (!(it instanceof NativeBinarySpec)) {
return
}
NativeBinarySpec nativeBin = (NativeBinarySpec)it
if (nativeBin.targetPlatform.operatingSystem.isMacOsX()) {
nativeBin.tasks.withType(AbstractNativeSourceCompileTask) { AbstractNativeSourceCompileTask compileTask->
compileTask.getSystemIncludes().setFrom()
}
}
}
}
@Mutate
@CompileStatic
void setupSingleNativeBuild(ModelMap<Task> tasks, ComponentSpecContainer components, BinaryContainer binaryContainer, ProjectLayout projectLayout) {
Project project = (Project) projectLayout.projectIdentifier;
def nativeName = project.extensions.extraProperties.get('nativeName')
NativeLibrarySpec base = null
def subs = []
components.each { component ->
if (component.name == "${nativeName}Base") {
base = (NativeLibrarySpec) component
} else if (component.name == "${nativeName}" || component.name == "${nativeName}JNI" || component.name == "${nativeName}JNICvStatic") {
subs << component
}
}
Delete deleteObjects = null
if (project.hasProperty('buildServer')) {
deleteObjects = project.tasks.create('deleteObjects', Delete)
project.tasks.named('build').configure { Task t ->
t.dependsOn deleteObjects
return
}
}
subs.each {
((NativeLibrarySpec) it).binaries.each { oBinary ->
if (oBinary.buildable == false) {
return
}
NativeBinarySpec binary = (NativeBinarySpec) oBinary
NativeBinarySpec baseBin = null
base.binaries.each { oTmpBaseBin ->
if (oTmpBaseBin.buildable == false) {
return
}
def tmpBaseBin = (NativeBinarySpec) oTmpBaseBin
if (tmpBaseBin.targetPlatform.name == binary.targetPlatform.name &&
tmpBaseBin.buildType == binary.buildType) {
baseBin = tmpBaseBin
}
}
if (binary instanceof StaticLibraryBinarySpec) {
File intoDir = ((CreateStaticLibrary)((StaticLibraryBinarySpec)binary).tasks.createStaticLib).outputFile.get().asFile.parentFile
File fromDir = ((CreateStaticLibrary)((StaticLibraryBinarySpec)baseBin).tasks.createStaticLib).outputFile.get().asFile.parentFile
def copyBasePdbName = "copyBasePdbFor" + binary.buildTask.name
def copyTask = project.tasks.register(copyBasePdbName, Copy) { Copy t ->
t.from (fromDir)
t.include '*.pdb'
t.into intoDir
t.dependsOn (((StaticLibraryBinarySpec)baseBin).tasks.createStaticLib)
}
((CreateStaticLibrary)((StaticLibraryBinarySpec)binary).tasks.createStaticLib).dependsOn(copyTask)
}
baseBin.tasks.withType(AbstractNativeSourceCompileTask) { oCompileTask ->
def compileTask = (AbstractNativeSourceCompileTask) oCompileTask
if (binary instanceof SharedLibraryBinarySpec) {
def sBinary = (SharedLibraryBinarySpec) binary
ObjectFilesToBinary link = (ObjectFilesToBinary) sBinary.tasks.link
ExportsGenerationTask exportsTask = binary.tasks.withType(ExportsGenerationTask)[0]
if (exportsTask != null) {
exportsTask.dependsOn compileTask
}
link.dependsOn compileTask
link.inputs.dir compileTask.objectFileDir
def tree = project.fileTree(compileTask.objectFileDir)
tree.include '**/*.o'
tree.include '**/*.obj'
link.source tree
if (project.hasProperty('buildServer')) {
deleteObjects.dependsOn link
deleteObjects.delete tree
}
} else if (binary instanceof StaticLibraryBinarySpec) {
def sBinary = (StaticLibraryBinarySpec) binary
ObjectFilesToBinary assemble = (ObjectFilesToBinary) sBinary.tasks.createStaticLib
assemble.dependsOn compileTask
assemble.inputs.dir compileTask.objectFileDir
def tree = project.fileTree(compileTask.objectFileDir)
tree.include '**/*.o'
tree.include '**/*.obj'
assemble.source tree
if (project.hasProperty('buildServer')) {
deleteObjects.dependsOn assemble
deleteObjects.delete tree
}
}
}
}
}
}
}
}

View File

@@ -0,0 +1,77 @@
import groovy.transform.CompileStatic;
import javax.inject.Inject;
import org.gradle.api.Project;
import edu.wpi.first.deployutils.deploy.CommandDeployResult;
import edu.wpi.first.deployutils.deploy.artifact.MavenArtifact;
import edu.wpi.first.deployutils.deploy.context.DeployContext;
import edu.wpi.first.deployutils.deploy.target.RemoteTarget;
import edu.wpi.first.deployutils.PredicateWrapper;
import edu.wpi.first.deployutils.ActionWrapper;
@CompileStatic
public class WPIJREArtifact extends MavenArtifact {
private final String configName;
public String getConfigName() {
return configName;
}
public boolean isCheckJreVersion() {
return checkJreVersion;
}
public void setCheckJreVersion(boolean checkJreVersion) {
this.checkJreVersion = checkJreVersion;
}
private boolean checkJreVersion = true;
private final String artifactLocation = "edu.wpi.first.jdk:roborio-2023:17.0.5u7-1"
@Inject
public WPIJREArtifact(String name, RemoteTarget target) {
super(name, target);
String configName = name + "frcjre";
this.configName = configName;
Project project = target.getProject();
getConfiguration().set(project.getConfigurations().create(configName));
getDependency().set(project.getDependencies().add(configName, artifactLocation));
setOnlyIf(new PredicateWrapper({ DeployContext ctx ->
return jreMissing(ctx) || jreOutOfDate(ctx) || project.hasProperty("force-redeploy-jre");
}));
getDirectory().set("/tmp");
getFilename().set("frcjre.ipk");
getPostdeploy().add(new ActionWrapper({ DeployContext ctx ->
ctx.getLogger().log("Installing JRE...");
ctx.execute("opkg remove frc*-openjdk*; opkg install /tmp/frcjre.ipk; rm /tmp/frcjre.ipk");
ctx.getLogger().log("JRE Deployed!");
}));
}
private boolean jreMissing(DeployContext ctx) {
return ctx.execute("if [[ -f \"/usr/local/frc/JRE/bin/java\" ]]; then echo OK; else echo MISSING; fi").getResult().contains("MISSING");
}
private boolean jreOutOfDate(DeployContext ctx) {
if (!checkJreVersion) {
return false;
}
String version = getDependency().get().getVersion();
CommandDeployResult cmdResult = ctx.execute("opkg list-installed | grep openjdk");
if (cmdResult.getExitCode() != 0) {
ctx.getLogger().log("JRE not found");
return false;
}
String result = cmdResult.getResult().trim();
ctx.getLogger().log("Searching for JRE " + version);
ctx.getLogger().log("Found JRE " + result);
boolean matches = result.contains(version);
ctx.getLogger().log(matches ? "JRE Is Correct Version" : "JRE is mismatched. Reinstalling");
return !matches;
}
}

25
cameraserver/.styleguide Normal file
View File

@@ -0,0 +1,25 @@
cppHeaderFileInclude {
\.h$
\.inc$
}
cppSrcFileInclude {
\.cpp$
}
repoRootNameOverride {
cameraserver
}
includeOtherLibs {
^fmt/
^hal/
^networktables/
^opencv2/
^support/
^wpi/
}
includeGuardRoots {
cameraserver/src/main/native/include/
}

View File

@@ -0,0 +1,70 @@
project(cameraserver)
include(CompileWarnings)
include(AddTest)
find_package( OpenCV REQUIRED )
# Java bindings
if (WITH_JAVA)
find_package(Java REQUIRED)
include(UseJava)
set(CMAKE_JAVA_COMPILE_FLAGS "-encoding" "UTF8" "-Xlint:unchecked")
#find java files, copy them locally
set(OPENCV_JAVA_INSTALL_DIR ${OpenCV_INSTALL_PATH}/share/OpenCV/java/)
find_file(OPENCV_JAR_FILE NAMES opencv-${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.jar PATHS ${OPENCV_JAVA_INSTALL_DIR} ${OpenCV_INSTALL_PATH}/bin NO_DEFAULT_PATH)
file(GLOB_RECURSE JAVA_SOURCES src/main/java/*.java)
add_jar(cameraserver_jar ${JAVA_SOURCES} INCLUDE_JARS wpiutil_jar cscore_jar ntcore_jar ${OPENCV_JAR_FILE} OUTPUT_NAME cameraserver)
get_property(CAMERASERVER_JAR_FILE TARGET cameraserver_jar PROPERTY JAR_FILE)
install(FILES ${CAMERASERVER_JAR_FILE} DESTINATION "${java_lib_dest}")
set_property(TARGET cameraserver_jar PROPERTY FOLDER "java")
endif()
file(GLOB_RECURSE
cameraserver_native_src src/main/native/cpp/*.cpp)
add_library(cameraserver ${cameraserver_native_src})
set_target_properties(cameraserver PROPERTIES DEBUG_POSTFIX "d")
target_include_directories(cameraserver PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
$<INSTALL_INTERFACE:${include_dest}/cameraserver>)
wpilib_target_warnings(cameraserver)
target_link_libraries(cameraserver PUBLIC ntcore cscore wpiutil ${OpenCV_LIBS})
set_property(TARGET cameraserver PROPERTY FOLDER "libraries")
install(TARGETS cameraserver EXPORT cameraserver DESTINATION "${main_lib_dest}")
install(DIRECTORY src/main/native/include/ DESTINATION "${include_dest}/cameraserver")
if (WITH_JAVA AND MSVC)
install(TARGETS cameraserver RUNTIME DESTINATION "${jni_lib_dest}" COMPONENT Runtime)
endif()
if (WITH_FLAT_INSTALL)
set (cameraserver_config_dir ${wpilib_dest})
else()
set (cameraserver_config_dir share/cameraserver)
endif()
configure_file(cameraserver-config.cmake.in ${WPILIB_BINARY_DIR}/cameraserver-config.cmake )
install(FILES ${WPILIB_BINARY_DIR}/cameraserver-config.cmake DESTINATION ${cameraserver_config_dir})
install(EXPORT cameraserver DESTINATION ${cameraserver_config_dir})
file(GLOB multiCameraServer_src multiCameraServer/src/main/native/cpp/*.cpp)
add_executable(multiCameraServer ${multiCameraServer_src})
wpilib_target_warnings(multiCameraServer)
target_link_libraries(multiCameraServer cameraserver)
set_property(TARGET multiCameraServer PROPERTY FOLDER "examples")
if (WITH_TESTS)
wpilib_add_test(cameraserver src/test/native/cpp)
target_link_libraries(cameraserver_test cameraserver gtest)
endif()

85
cameraserver/build.gradle Normal file
View File

@@ -0,0 +1,85 @@
ext {
nativeName = 'cameraserver'
devMain = 'edu.wpi.first.cameraserver.DevMain'
}
evaluationDependsOn(':ntcore')
evaluationDependsOn(':cscore')
evaluationDependsOn(':hal')
apply from: "${rootDir}/shared/javacpp/setupBuild.gradle"
dependencies {
implementation project(':wpiutil')
implementation project(':wpinet')
implementation project(':ntcore')
implementation project(':cscore')
devImplementation project(':wpiutil')
devImplementation project(':wpinet')
devImplementation project(':ntcore')
devImplementation project(':cscore')
}
ext {
sharedCvConfigs = [cameraserver : [],
cameraserverBase: [],
cameraserverDev : [],
cameraserverTest: []]
staticCvConfigs = [:]
useJava = true
useCpp = true
}
apply from: "${rootDir}/shared/opencv.gradle"
nativeUtils.exportsConfigs {
cameraserver {
x64ExcludeSymbols = [
'_CT??_R0?AV_System_error',
'_CT??_R0?AVexception',
'_CT??_R0?AVfailure',
'_CT??_R0?AVruntime_error',
'_CT??_R0?AVsystem_error',
'_CTA5?AVfailure',
'_TI5?AVfailure',
'_CT??_R0?AVout_of_range',
'_CTA3?AVout_of_range',
'_TI3?AVout_of_range',
'_CT??_R0?AVbad_cast'
]
}
}
model {
components {}
binaries {
all {
if (!it.buildable || !(it instanceof NativeBinarySpec)) {
return
}
project(':ntcore').addNtcoreDependency(it, 'shared')
lib project: ':cscore', library: 'cscore', linkage: 'shared'
lib project: ':wpinet', library: 'wpinet', linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
}
}
tasks {
def c = $.components
def found = false
def systemArch = getCurrentArch()
c.each {
if (it in NativeExecutableSpec && it.name == "${nativeName}Dev") {
it.binaries.each {
if (!found) {
def arch = it.targetPlatform.name
if (arch == systemArch) {
def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + 'lib'
found = true
}
}
}
}
}
}
}

View File

@@ -0,0 +1,9 @@
include(CMakeFindDependencyMacro)
@FILENAME_DEP_REPLACE@
@WPIUTIL_DEP_REPLACE@
@NTCORE_DEP_REPLACE@
@CSCORE_DEP_REPLACE@
find_dependency(OpenCV)
@FILENAME_DEP_REPLACE@
include(${SELF_DIR}/cameraserver.cmake)

View File

@@ -0,0 +1,65 @@
plugins {
id 'java'
id 'application'
id 'cpp'
id 'visual-studio'
}
apply plugin: 'edu.wpi.first.NativeUtils'
apply from: "${rootDir}/shared/config.gradle"
ext {
staticCvConfigs = [multiCameraServerCpp: []]
useJava = true
useCpp = true
skipDev = true
}
apply from: "${rootDir}/shared/opencv.gradle"
mainClassName = 'edu.wpi.Main'
apply plugin: 'com.github.johnrengelman.shadow'
repositories {
maven {
url = 'https://frcmaven.wpi.edu/artifactory/ex-mvn'
}
}
dependencies {
implementation 'com.google.code.gson:gson:2.8.9'
implementation project(':wpiutil')
implementation project(':wpinet')
implementation project(':ntcore')
implementation project(':cscore')
implementation project(':cameraserver')
}
model {
components {
multiCameraServerCpp(NativeExecutableSpec) {
sources {
cpp {
source {
srcDirs = ['src/main/native/cpp']
includes = ['**/*.cpp']
}
exportedHeaders {
srcDirs = ['src/main/native/include']
includes = ['**/*.h']
}
}
}
binaries.all { binary ->
lib project: ':cameraserver', library: 'cameraserver', linkage: 'static'
project(':ntcore').addNtcoreDependency(binary, 'static')
lib project: ':cscore', library: 'cscore', linkage: 'static'
lib project: ':wpinet', library: 'wpinet', linkage: 'static'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'static'
}
}
}
}

View File

@@ -0,0 +1,196 @@
// 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.
package edu.wpi;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.cscore.VideoSource;
import edu.wpi.first.networktables.NetworkTableInstance;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
/*
JSON format:
{
"team": <team number>,
"ntmode": <"client" or "server", "client" if unspecified>
"cameras": [
{
"name": <camera name>
"path": <path, e.g. "/dev/video0">
"pixel format": <"MJPEG", "YUYV", etc> // optional
"width": <video mode width> // optional
"height": <video mode height> // optional
"fps": <video mode fps> // optional
"brightness": <percentage brightness> // optional
"white balance": <"auto", "hold", value> // optional
"exposure": <"auto", "hold", value> // optional
"properties": [ // optional
{
"name": <property name>
"value": <property value>
}
]
}
]
}
*/
public final class Main {
private static String configFile = "/boot/frc.json";
@SuppressWarnings("MemberName")
public static class CameraConfig {
public String name;
public String path;
public JsonObject config;
}
private static int team;
private static boolean server;
private static List<CameraConfig> cameras = new ArrayList<>();
private Main() {}
/** Report parse error. */
public static void parseError(String str) {
System.err.println("config error in '" + configFile + "': " + str);
}
/** Read single camera configuration. */
public static boolean readCameraConfig(JsonObject config) {
CameraConfig cam = new CameraConfig();
// name
JsonElement nameElement = config.get("name");
if (nameElement == null) {
parseError("could not read camera name");
return false;
}
cam.name = nameElement.getAsString();
// path
JsonElement pathElement = config.get("path");
if (pathElement == null) {
parseError("camera '" + cam.name + "': could not read path");
return false;
}
cam.path = pathElement.getAsString();
cam.config = config;
cameras.add(cam);
return true;
}
/** Read configuration file. */
public static boolean readConfig() {
// parse file
JsonElement top;
try {
top = new JsonParser().parse(Files.newBufferedReader(Paths.get(configFile)));
} catch (IOException ex) {
System.err.println("could not open '" + configFile + "': " + ex);
return false;
}
// top level must be an object
if (!top.isJsonObject()) {
parseError("must be JSON object");
return false;
}
JsonObject obj = top.getAsJsonObject();
// team number
JsonElement teamElement = obj.get("team");
if (teamElement == null) {
parseError("could not read team number");
return false;
}
team = teamElement.getAsInt();
// ntmode (optional)
if (obj.has("ntmode")) {
String str = obj.get("ntmode").getAsString();
if ("client".equalsIgnoreCase(str)) {
server = false;
} else if ("server".equalsIgnoreCase(str)) {
server = true;
} else {
parseError("could not understand ntmode value '" + str + "'");
}
}
// cameras
JsonElement camerasElement = obj.get("cameras");
if (camerasElement == null) {
parseError("could not read cameras");
return false;
}
JsonArray cameras = camerasElement.getAsJsonArray();
for (JsonElement camera : cameras) {
if (!readCameraConfig(camera.getAsJsonObject())) {
return false;
}
}
return true;
}
/** Start running the camera. */
public static void startCamera(CameraConfig config) {
System.out.println("Starting camera '" + config.name + "' on " + config.path);
VideoSource camera = CameraServer.startAutomaticCapture(config.name, config.path);
Gson gson = new GsonBuilder().create();
camera.setConfigJson(gson.toJson(config.config));
}
/** Main. */
public static void main(String... args) {
if (args.length > 0) {
configFile = args[0];
}
// read configuration
if (!readConfig()) {
return;
}
// start NetworkTables
NetworkTableInstance ntinst = NetworkTableInstance.getDefault();
if (server) {
System.out.println("Setting up NetworkTables server");
ntinst.startServer();
} else {
System.out.println("Setting up NetworkTables client for team " + team);
ntinst.setServerTeam(team);
ntinst.startClient4("multicameraserver");
}
// start cameras
for (CameraConfig camera : cameras) {
startCamera(camera);
}
// loop forever
for (; ; ) {
try {
Thread.sleep(10000);
} catch (InterruptedException ex) {
return;
}
}
}
}

View File

@@ -0,0 +1,199 @@
// 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.
#include <cstdio>
#include <string>
#include <string_view>
#include <thread>
#include <vector>
#include <networktables/NetworkTableInstance.h>
#include <wpi/StringExtras.h>
#include <wpi/fmt/raw_ostream.h>
#include <wpi/json.h>
#include <wpi/raw_istream.h>
#include <wpi/raw_ostream.h>
#include "cameraserver/CameraServer.h"
/*
JSON format:
{
"team": <team number>,
"ntmode": <"client" or "server", "client" if unspecified>
"cameras": [
{
"name": <camera name>
"path": <path, e.g. "/dev/video0">
"pixel format": <"MJPEG", "YUYV", etc> // optional
"width": <video mode width> // optional
"height": <video mode height> // optional
"fps": <video mode fps> // optional
"brightness": <percentage brightness> // optional
"white balance": <"auto", "hold", value> // optional
"exposure": <"auto", "hold", value> // optional
"properties": [ // optional
{
"name": <property name>
"value": <property value>
}
]
}
]
}
*/
#ifdef __RASPBIAN__
static const char* configFile = "/boot/frc.json";
#else
static const char* configFile = "frc.json";
#endif
namespace {
unsigned int team;
bool server = false;
struct CameraConfig {
std::string name;
std::string path;
wpi::json config;
};
std::vector<CameraConfig> cameras;
wpi::raw_ostream& ParseError() {
return wpi::errs() << "config error in '" << configFile << "': ";
}
bool ReadCameraConfig(const wpi::json& config) {
CameraConfig c;
// name
try {
c.name = config.at("name").get<std::string>();
} catch (const wpi::json::exception& e) {
ParseError() << "could not read camera name: " << e.what() << '\n';
return false;
}
// path
try {
c.path = config.at("path").get<std::string>();
} catch (const wpi::json::exception& e) {
ParseError() << "camera '" << c.name
<< "': could not read path: " << e.what() << '\n';
return false;
}
c.config = config;
cameras.emplace_back(std::move(c));
return true;
}
bool ReadConfig() {
// open config file
std::error_code ec;
wpi::raw_fd_istream is(configFile, ec);
if (ec) {
wpi::errs() << "could not open '" << configFile << "': " << ec.message()
<< '\n';
return false;
}
// parse file
wpi::json j;
try {
j = wpi::json::parse(is);
} catch (const wpi::json::parse_error& e) {
fmt::print(ParseError(), "byte {}: {}\n", e.byte, e.what());
return false;
}
// top level must be an object
if (!j.is_object()) {
ParseError() << "must be JSON object\n";
return false;
}
// team number
try {
team = j.at("team").get<unsigned int>();
} catch (const wpi::json::exception& e) {
ParseError() << "could not read team number: " << e.what() << '\n';
return false;
}
// ntmode (optional)
if (j.count("ntmode") != 0) {
try {
auto str = j.at("ntmode").get<std::string>();
if (wpi::equals_lower(str, "client")) {
server = false;
} else if (wpi::equals_lower(str, "server")) {
server = true;
} else {
ParseError() << "could not understand ntmode value '" << str << "'\n";
}
} catch (const wpi::json::exception& e) {
ParseError() << "could not read ntmode: " << e.what() << '\n';
}
}
// cameras
try {
for (auto&& camera : j.at("cameras")) {
if (!ReadCameraConfig(camera)) {
return false;
}
}
} catch (const wpi::json::exception& e) {
ParseError() << "could not read cameras: " << e.what() << '\n';
return false;
}
return true;
}
void StartCamera(const CameraConfig& config) {
fmt::print("Starting camera '{}' on {}\n", config.name, config.path);
auto camera =
frc::CameraServer::StartAutomaticCapture(config.name, config.path);
camera.SetConfigJson(config.config);
}
} // namespace
int main(int argc, char* argv[]) {
if (argc >= 2) {
configFile = argv[1];
}
// read configuration
if (!ReadConfig()) {
return EXIT_FAILURE;
}
// start NetworkTables
auto ntinst = nt::NetworkTableInstance::GetDefault();
if (server) {
std::puts("Setting up NetworkTables server");
ntinst.StartServer();
} else {
fmt::print("Setting up NetworkTables client for team {}\n", team);
ntinst.StartClient4("multicameraserver");
ntinst.SetServerTeam(team);
}
// start cameras
for (auto&& camera : cameras) {
StartCamera(camera);
}
// loop forever
for (;;) {
std::this_thread::sleep_for(std::chrono::seconds(10));
}
}

View File

@@ -0,0 +1,11 @@
// 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.
package edu.wpi.first.cameraserver;
public final class DevMain {
public static void main(String[] args) {}
private DevMain() {}
}

View File

@@ -0,0 +1,5 @@
// 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.
int main() {}

View File

@@ -0,0 +1,885 @@
// 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.
package edu.wpi.first.cameraserver;
import edu.wpi.first.cscore.AxisCamera;
import edu.wpi.first.cscore.CameraServerJNI;
import edu.wpi.first.cscore.CvSink;
import edu.wpi.first.cscore.CvSource;
import edu.wpi.first.cscore.MjpegServer;
import edu.wpi.first.cscore.UsbCamera;
import edu.wpi.first.cscore.VideoEvent;
import edu.wpi.first.cscore.VideoException;
import edu.wpi.first.cscore.VideoListener;
import edu.wpi.first.cscore.VideoMode;
import edu.wpi.first.cscore.VideoMode.PixelFormat;
import edu.wpi.first.cscore.VideoSink;
import edu.wpi.first.cscore.VideoSource;
import edu.wpi.first.networktables.BooleanEntry;
import edu.wpi.first.networktables.BooleanPublisher;
import edu.wpi.first.networktables.IntegerEntry;
import edu.wpi.first.networktables.IntegerPublisher;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableInstance;
import edu.wpi.first.networktables.StringArrayPublisher;
import edu.wpi.first.networktables.StringArrayTopic;
import edu.wpi.first.networktables.StringEntry;
import edu.wpi.first.networktables.StringPublisher;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Singleton class for creating and keeping camera servers. Also publishes camera information to
* NetworkTables.
*/
public final class CameraServer {
public static final int kBasePort = 1181;
private static final String kPublishName = "/CameraPublisher";
private static final class PropertyPublisher implements AutoCloseable {
@SuppressWarnings({"PMD.MissingBreakInSwitch", "PMD.ImplicitSwitchFallThrough", "fallthrough"})
PropertyPublisher(NetworkTable table, VideoEvent event) {
String name;
String infoName;
if (event.name.startsWith("raw_")) {
name = "RawProperty/" + event.name;
infoName = "RawPropertyInfo/" + event.name;
} else {
name = "Property/" + event.name;
infoName = "PropertyInfo/" + event.name;
}
try {
switch (event.propertyKind) {
case kBoolean:
m_booleanValueEntry = table.getBooleanTopic(name).getEntry(false);
m_booleanValueEntry.setDefault(event.value != 0);
break;
case kEnum:
m_choicesTopic = table.getStringArrayTopic(infoName + "/choices");
// fall through
case kInteger:
m_integerValueEntry = table.getIntegerTopic(name).getEntry(0);
m_minPublisher = table.getIntegerTopic(infoName + "/min").publish();
m_maxPublisher = table.getIntegerTopic(infoName + "/max").publish();
m_stepPublisher = table.getIntegerTopic(infoName + "/step").publish();
m_defaultPublisher = table.getIntegerTopic(infoName + "/default").publish();
m_integerValueEntry.setDefault(event.value);
m_minPublisher.set(CameraServerJNI.getPropertyMin(event.propertyHandle));
m_maxPublisher.set(CameraServerJNI.getPropertyMax(event.propertyHandle));
m_stepPublisher.set(CameraServerJNI.getPropertyStep(event.propertyHandle));
m_defaultPublisher.set(CameraServerJNI.getPropertyDefault(event.propertyHandle));
break;
case kString:
m_stringValueEntry = table.getStringTopic(name).getEntry("");
m_stringValueEntry.setDefault(event.valueStr);
break;
default:
break;
}
} catch (VideoException ignored) {
// ignore
}
}
void update(VideoEvent event) {
switch (event.propertyKind) {
case kBoolean:
if (m_booleanValueEntry != null) {
m_booleanValueEntry.set(event.value != 0);
}
break;
case kInteger:
case kEnum:
if (m_integerValueEntry != null) {
m_integerValueEntry.set(event.value);
}
break;
case kString:
if (m_stringValueEntry != null) {
m_stringValueEntry.set(event.valueStr);
}
break;
default:
break;
}
}
@Override
public void close() throws Exception {
if (m_booleanValueEntry != null) {
m_booleanValueEntry.close();
}
if (m_integerValueEntry != null) {
m_integerValueEntry.close();
}
if (m_stringValueEntry != null) {
m_stringValueEntry.close();
}
if (m_minPublisher != null) {
m_minPublisher.close();
}
if (m_maxPublisher != null) {
m_maxPublisher.close();
}
if (m_stepPublisher != null) {
m_stepPublisher.close();
}
if (m_defaultPublisher != null) {
m_defaultPublisher.close();
}
if (m_choicesPublisher != null) {
m_choicesPublisher.close();
}
}
BooleanEntry m_booleanValueEntry;
IntegerEntry m_integerValueEntry;
StringEntry m_stringValueEntry;
IntegerPublisher m_minPublisher;
IntegerPublisher m_maxPublisher;
IntegerPublisher m_stepPublisher;
IntegerPublisher m_defaultPublisher;
StringArrayTopic m_choicesTopic;
StringArrayPublisher m_choicesPublisher;
}
private static final class SourcePublisher implements AutoCloseable {
SourcePublisher(NetworkTable table, int sourceHandle) {
this.m_table = table;
m_sourcePublisher = table.getStringTopic("source").publish();
m_descriptionPublisher = table.getStringTopic("description").publish();
m_connectedPublisher = table.getBooleanTopic("connected").publish();
m_streamsPublisher = table.getStringArrayTopic("streams").publish();
m_modeEntry = table.getStringTopic("mode").getEntry("");
m_modesPublisher = table.getStringArrayTopic("modes").publish();
m_sourcePublisher.set(makeSourceValue(sourceHandle));
m_descriptionPublisher.set(CameraServerJNI.getSourceDescription(sourceHandle));
m_connectedPublisher.set(CameraServerJNI.isSourceConnected(sourceHandle));
m_streamsPublisher.set(getSourceStreamValues(sourceHandle));
try {
VideoMode mode = CameraServerJNI.getSourceVideoMode(sourceHandle);
m_modeEntry.setDefault(videoModeToString(mode));
m_modesPublisher.set(getSourceModeValues(sourceHandle));
} catch (VideoException ignored) {
// Do nothing. Let the other event handlers update this if there is an error.
}
}
@Override
public void close() throws Exception {
m_sourcePublisher.close();
m_descriptionPublisher.close();
m_connectedPublisher.close();
m_streamsPublisher.close();
m_modeEntry.close();
m_modesPublisher.close();
for (PropertyPublisher pp : m_properties.values()) {
pp.close();
}
}
final NetworkTable m_table;
final StringPublisher m_sourcePublisher;
final StringPublisher m_descriptionPublisher;
final BooleanPublisher m_connectedPublisher;
final StringArrayPublisher m_streamsPublisher;
final StringEntry m_modeEntry;
final StringArrayPublisher m_modesPublisher;
final Map<Integer, PropertyPublisher> m_properties = new HashMap<>();
}
private static final AtomicInteger m_defaultUsbDevice = new AtomicInteger();
private static String m_primarySourceName;
private static final Map<String, VideoSource> m_sources = new HashMap<>();
private static final Map<String, VideoSink> m_sinks = new HashMap<>();
private static final Map<Integer, SourcePublisher> m_publishers =
new HashMap<>(); // indexed by source handle
// source handle indexed by sink handle
private static final Map<Integer, Integer> m_fixedSources = new HashMap<>();
private static final NetworkTable m_publishTable =
NetworkTableInstance.getDefault().getTable(kPublishName);
// We publish sources to NetworkTables using the following structure:
// "/CameraPublisher/{Source.Name}/" - root
// - "source" (string): Descriptive, prefixed with type (e.g. "usb:0")
// - "streams" (string array): URLs that can be used to stream data
// - "description" (string): Description of the source
// - "connected" (boolean): Whether source is connected
// - "mode" (string): Current video mode
// - "modes" (string array): Available video modes
// - "Property/{Property}" - Property values
// - "PropertyInfo/{Property}" - Property supporting information
// Listener for video events
@SuppressWarnings({"PMD.UnusedPrivateField", "PMD.AvoidCatchingGenericException"})
private static final VideoListener m_videoListener =
new VideoListener(
event -> {
synchronized (CameraServer.class) {
switch (event.kind) {
case kSourceCreated:
{
// Create subtable for the camera
NetworkTable table = m_publishTable.getSubTable(event.name);
m_publishers.put(
event.sourceHandle, new SourcePublisher(table, event.sourceHandle));
break;
}
case kSourceDestroyed:
{
SourcePublisher publisher = m_publishers.remove(event.sourceHandle);
if (publisher != null) {
try {
publisher.close();
} catch (Exception e) {
// ignore (nothing we can do about it)
}
}
break;
}
case kSourceConnected:
{
SourcePublisher publisher = m_publishers.get(event.sourceHandle);
if (publisher != null) {
// update the description too (as it may have changed)
publisher.m_descriptionPublisher.set(
CameraServerJNI.getSourceDescription(event.sourceHandle));
publisher.m_connectedPublisher.set(true);
}
break;
}
case kSourceDisconnected:
{
SourcePublisher publisher = m_publishers.get(event.sourceHandle);
if (publisher != null) {
publisher.m_connectedPublisher.set(false);
}
break;
}
case kSourceVideoModesUpdated:
{
SourcePublisher publisher = m_publishers.get(event.sourceHandle);
if (publisher != null) {
publisher.m_modesPublisher.set(getSourceModeValues(event.sourceHandle));
}
break;
}
case kSourceVideoModeChanged:
{
SourcePublisher publisher = m_publishers.get(event.sourceHandle);
if (publisher != null) {
publisher.m_modeEntry.set(videoModeToString(event.mode));
}
break;
}
case kSourcePropertyCreated:
{
SourcePublisher publisher = m_publishers.get(event.sourceHandle);
if (publisher != null) {
publisher.m_properties.put(
event.propertyHandle, new PropertyPublisher(publisher.m_table, event));
}
break;
}
case kSourcePropertyValueUpdated:
{
SourcePublisher publisher = m_publishers.get(event.sourceHandle);
if (publisher != null) {
PropertyPublisher pp = publisher.m_properties.get(event.propertyHandle);
if (pp != null) {
pp.update(event);
}
}
break;
}
case kSourcePropertyChoicesUpdated:
{
SourcePublisher publisher = m_publishers.get(event.sourceHandle);
if (publisher != null) {
PropertyPublisher pp = publisher.m_properties.get(event.propertyHandle);
if (pp != null && pp.m_choicesTopic != null) {
try {
String[] choices =
CameraServerJNI.getEnumPropertyChoices(event.propertyHandle);
if (pp.m_choicesPublisher == null) {
pp.m_choicesPublisher = pp.m_choicesTopic.publish();
}
pp.m_choicesPublisher.set(choices);
} catch (VideoException ignored) {
// ignore (just don't publish choices if we can't get them)
}
}
}
break;
}
case kSinkSourceChanged:
case kSinkCreated:
case kSinkDestroyed:
case kNetworkInterfacesChanged:
{
m_addresses = CameraServerJNI.getNetworkInterfaces();
updateStreamValues();
break;
}
default:
break;
}
}
},
0x4fff,
true);
private static int m_nextPort = kBasePort;
private static String[] m_addresses = new String[0];
/**
* Return URI of source with the given index.
*
* @param source Source index.
*/
private static String makeSourceValue(int source) {
switch (VideoSource.getKindFromInt(CameraServerJNI.getSourceKind(source))) {
case kUsb:
return "usb:" + CameraServerJNI.getUsbCameraPath(source);
case kHttp:
{
String[] urls = CameraServerJNI.getHttpCameraUrls(source);
if (urls.length > 0) {
return "ip:" + urls[0];
} else {
return "ip:";
}
}
case kCv:
return "cv:";
default:
return "unknown:";
}
}
/**
* Return URI of stream with the given address and port.
*
* @param address Stream IP address.
* @param port Stream remote port.
*/
private static String makeStreamValue(String address, int port) {
return "mjpg:http://" + address + ":" + port + "/?action=stream";
}
/**
* Return URI of sink stream with the given index.
*
* @param sink Sink index.
*/
private static synchronized String[] getSinkStreamValues(int sink) {
// Ignore all but MjpegServer
if (VideoSink.getKindFromInt(CameraServerJNI.getSinkKind(sink)) != VideoSink.Kind.kMjpeg) {
return new String[0];
}
// Get port
int port = CameraServerJNI.getMjpegServerPort(sink);
// Generate values
ArrayList<String> values = new ArrayList<>(m_addresses.length + 1);
String listenAddress = CameraServerJNI.getMjpegServerListenAddress(sink);
if (!listenAddress.isEmpty()) {
// If a listen address is specified, only use that
values.add(makeStreamValue(listenAddress, port));
} else {
// Otherwise generate for hostname and all interface addresses
values.add(makeStreamValue(CameraServerJNI.getHostname() + ".local", port));
for (String addr : m_addresses) {
if ("127.0.0.1".equals(addr)) {
continue; // ignore localhost
}
values.add(makeStreamValue(addr, port));
}
}
return values.toArray(new String[0]);
}
/**
* Return list of stream source URIs for the given source index.
*
* @param source Source index.
*/
private static synchronized String[] getSourceStreamValues(int source) {
// Ignore all but HttpCamera
if (VideoSource.getKindFromInt(CameraServerJNI.getSourceKind(source))
!= VideoSource.Kind.kHttp) {
return new String[0];
}
// Generate values
String[] values = CameraServerJNI.getHttpCameraUrls(source);
for (int j = 0; j < values.length; j++) {
values[j] = "mjpg:" + values[j];
}
if (CameraServerSharedStore.getCameraServerShared().isRoboRIO()) {
// Look to see if we have a passthrough server for this source
// Only do this on the roboRIO
for (VideoSink i : m_sinks.values()) {
int sink = i.getHandle();
int sinkSource = CameraServerJNI.getSinkSource(sink);
if (source == sinkSource
&& VideoSink.getKindFromInt(CameraServerJNI.getSinkKind(sink))
== VideoSink.Kind.kMjpeg) {
// Add USB-only passthrough
String[] finalValues = Arrays.copyOf(values, values.length + 1);
int port = CameraServerJNI.getMjpegServerPort(sink);
finalValues[values.length] = makeStreamValue("172.22.11.2", port);
return finalValues;
}
}
}
return values;
}
/** Update list of stream URIs. */
private static synchronized void updateStreamValues() {
// Over all the sinks...
for (VideoSink i : m_sinks.values()) {
int sink = i.getHandle();
// Get the source's subtable (if none exists, we're done)
int source =
Objects.requireNonNullElseGet(
m_fixedSources.get(sink), () -> CameraServerJNI.getSinkSource(sink));
if (source == 0) {
continue;
}
SourcePublisher publisher = m_publishers.get(source);
if (publisher != null) {
// Don't set stream values if this is a HttpCamera passthrough
if (VideoSource.getKindFromInt(CameraServerJNI.getSourceKind(source))
== VideoSource.Kind.kHttp) {
continue;
}
// Set table value
String[] values = getSinkStreamValues(sink);
if (values.length > 0) {
publisher.m_streamsPublisher.set(values);
}
}
}
// Over all the sources...
for (VideoSource i : m_sources.values()) {
int source = i.getHandle();
// Get the source's subtable (if none exists, we're done)
SourcePublisher publisher = m_publishers.get(source);
if (publisher != null) {
// Set table value
String[] values = getSourceStreamValues(source);
if (values.length > 0) {
publisher.m_streamsPublisher.set(values);
}
}
}
}
/** Provide string description of pixel format. */
private static String pixelFormatToString(PixelFormat pixelFormat) {
switch (pixelFormat) {
case kMJPEG:
return "MJPEG";
case kYUYV:
return "YUYV";
case kRGB565:
return "RGB565";
case kBGR:
return "BGR";
case kGray:
return "Gray";
default:
return "Unknown";
}
}
/**
* Provide string description of video mode.
*
* <p>The returned string is "{width}x{height} {format} {fps} fps".
*/
private static String videoModeToString(VideoMode mode) {
return mode.width
+ "x"
+ mode.height
+ " "
+ pixelFormatToString(mode.pixelFormat)
+ " "
+ mode.fps
+ " fps";
}
/**
* Get list of video modes for the given source handle.
*
* @param sourceHandle Source handle.
*/
private static String[] getSourceModeValues(int sourceHandle) {
VideoMode[] modes = CameraServerJNI.enumerateSourceVideoModes(sourceHandle);
String[] modeStrings = new String[modes.length];
for (int i = 0; i < modes.length; i++) {
modeStrings[i] = videoModeToString(modes[i]);
}
return modeStrings;
}
private CameraServer() {}
/**
* Start automatically capturing images to send to the dashboard.
*
* <p>You should call this method to see a camera feed on the dashboard. If you also want to
* perform vision processing on the roboRIO, use getVideo() to get access to the camera images.
*
* <p>The first time this overload is called, it calls {@link #startAutomaticCapture(int)} with
* device 0, creating a camera named "USB Camera 0". Subsequent calls increment the device number
* (e.g. 1, 2, etc).
*
* @return The USB camera capturing images.
*/
public static UsbCamera startAutomaticCapture() {
UsbCamera camera = startAutomaticCapture(m_defaultUsbDevice.getAndIncrement());
CameraServerSharedStore.getCameraServerShared().reportUsbCamera(camera.getHandle());
return camera;
}
/**
* Start automatically capturing images to send to the dashboard.
*
* <p>This overload calls {@link #startAutomaticCapture(String, int)} with a name of "USB Camera
* {dev}".
*
* @param dev The device number of the camera interface
* @return The USB camera capturing images.
*/
public static UsbCamera startAutomaticCapture(int dev) {
UsbCamera camera = new UsbCamera("USB Camera " + dev, dev);
startAutomaticCapture(camera);
CameraServerSharedStore.getCameraServerShared().reportUsbCamera(camera.getHandle());
return camera;
}
/**
* Start automatically capturing images to send to the dashboard.
*
* @param name The name to give the camera
* @param dev The device number of the camera interface
* @return The USB camera capturing images.
*/
public static UsbCamera startAutomaticCapture(String name, int dev) {
UsbCamera camera = new UsbCamera(name, dev);
startAutomaticCapture(camera);
CameraServerSharedStore.getCameraServerShared().reportUsbCamera(camera.getHandle());
return camera;
}
/**
* Start automatically capturing images to send to the dashboard.
*
* @param name The name to give the camera
* @param path The device path (e.g. "/dev/video0") of the camera
* @return The USB camera capturing images.
*/
public static UsbCamera startAutomaticCapture(String name, String path) {
UsbCamera camera = new UsbCamera(name, path);
startAutomaticCapture(camera);
CameraServerSharedStore.getCameraServerShared().reportUsbCamera(camera.getHandle());
return camera;
}
/**
* Start automatically capturing images to send to the dashboard from an existing camera.
*
* @param camera Camera
* @return The MJPEG server serving images from the given camera.
*/
public static MjpegServer startAutomaticCapture(VideoSource camera) {
addCamera(camera);
MjpegServer server = addServer("serve_" + camera.getName());
server.setSource(camera);
return server;
}
/**
* Adds an Axis IP camera.
*
* <p>This overload calls {@link #addAxisCamera(String, String)} with name "Axis Camera".
*
* @param host Camera host IP or DNS name (e.g. "10.x.y.11")
* @return The Axis camera capturing images.
*/
public static AxisCamera addAxisCamera(String host) {
return addAxisCamera("Axis Camera", host);
}
/**
* Adds an Axis IP camera.
*
* <p>This overload calls {@link #addAxisCamera(String, String[])} with name "Axis Camera".
*
* @param hosts Array of Camera host IPs/DNS names
* @return The Axis camera capturing images.
*/
public static AxisCamera addAxisCamera(String[] hosts) {
return addAxisCamera("Axis Camera", hosts);
}
/**
* Adds an Axis IP camera.
*
* @param name The name to give the camera
* @param host Camera host IP or DNS name (e.g. "10.x.y.11")
* @return The Axis camera capturing images.
*/
public static AxisCamera addAxisCamera(String name, String host) {
AxisCamera camera = new AxisCamera(name, host);
// Create a passthrough MJPEG server for USB access
startAutomaticCapture(camera);
CameraServerSharedStore.getCameraServerShared().reportAxisCamera(camera.getHandle());
return camera;
}
/**
* Adds an Axis IP camera.
*
* @param name The name to give the camera
* @param hosts Array of Camera host IPs/DNS names
* @return The Axis camera capturing images.
*/
public static AxisCamera addAxisCamera(String name, String[] hosts) {
AxisCamera camera = new AxisCamera(name, hosts);
// Create a passthrough MJPEG server for USB access
startAutomaticCapture(camera);
CameraServerSharedStore.getCameraServerShared().reportAxisCamera(camera.getHandle());
return camera;
}
/**
* Adds a virtual camera for switching between two streams. Unlike the other addCamera methods,
* this returns a VideoSink rather than a VideoSource. Calling setSource() on the returned object
* can be used to switch the actual source of the stream.
*
* @param name The name to give the camera
* @return The MJPEG server serving images from the given camera.
*/
public static MjpegServer addSwitchedCamera(String name) {
// create a dummy CvSource
CvSource source = new CvSource(name, VideoMode.PixelFormat.kMJPEG, 160, 120, 30);
MjpegServer server = startAutomaticCapture(source);
synchronized (CameraServer.class) {
m_fixedSources.put(server.getHandle(), source.getHandle());
}
return server;
}
/**
* Get OpenCV access to the primary camera feed. This allows you to get images from the camera for
* image processing on the roboRIO.
*
* <p>This is only valid to call after a camera feed has been added with startAutomaticCapture()
* or addServer().
*
* @return OpenCV sink for the primary camera feed
*/
public static CvSink getVideo() {
VideoSource source;
synchronized (CameraServer.class) {
if (m_primarySourceName == null) {
throw new VideoException("no camera available");
}
source = m_sources.get(m_primarySourceName);
}
if (source == null) {
throw new VideoException("no camera available");
}
return getVideo(source);
}
/**
* Get OpenCV access to the specified camera. This allows you to get images from the camera for
* image processing on the roboRIO.
*
* @param camera Camera (e.g. as returned by startAutomaticCapture).
* @return OpenCV sink for the specified camera
*/
public static CvSink getVideo(VideoSource camera) {
String name = "opencv_" + camera.getName();
synchronized (CameraServer.class) {
VideoSink sink = m_sinks.get(name);
if (sink != null) {
VideoSink.Kind kind = sink.getKind();
if (kind != VideoSink.Kind.kCv) {
throw new VideoException("expected OpenCV sink, but got " + kind);
}
return (CvSink) sink;
}
}
CvSink newsink = new CvSink(name);
newsink.setSource(camera);
addServer(newsink);
return newsink;
}
/**
* Get OpenCV access to the specified camera. This allows you to get images from the camera for
* image processing on the roboRIO.
*
* @param name Camera name
* @return OpenCV sink for the specified camera
*/
public static CvSink getVideo(String name) {
VideoSource source;
synchronized (CameraServer.class) {
source = m_sources.get(name);
if (source == null) {
throw new VideoException("could not find camera " + name);
}
}
return getVideo(source);
}
/**
* Create a MJPEG stream with OpenCV input. This can be called to pass custom annotated images to
* the dashboard.
*
* @param name Name to give the stream
* @param width Width of the image being sent
* @param height Height of the image being sent
* @return OpenCV source for the MJPEG stream
*/
public static CvSource putVideo(String name, int width, int height) {
CvSource source = new CvSource(name, VideoMode.PixelFormat.kMJPEG, width, height, 30);
startAutomaticCapture(source);
return source;
}
/**
* Adds a MJPEG server at the next available port.
*
* @param name Server name
* @return The MJPEG server
*/
public static MjpegServer addServer(String name) {
int port;
synchronized (CameraServer.class) {
port = m_nextPort;
m_nextPort++;
}
return addServer(name, port);
}
/**
* Adds a MJPEG server.
*
* @param name Server name
* @param port Server port
* @return The MJPEG server
*/
public static MjpegServer addServer(String name, int port) {
MjpegServer server = new MjpegServer(name, port);
addServer(server);
return server;
}
/**
* Adds an already created server.
*
* @param server Server
*/
public static void addServer(VideoSink server) {
synchronized (CameraServer.class) {
m_sinks.put(server.getName(), server);
}
}
/**
* Removes a server by name.
*
* @param name Server name
*/
public static void removeServer(String name) {
synchronized (CameraServer.class) {
m_sinks.remove(name);
}
}
/**
* Get server for the primary camera feed.
*
* <p>This is only valid to call after a camera feed has been added with startAutomaticCapture()
* or addServer().
*
* @return The server for the primary camera feed
*/
public static VideoSink getServer() {
synchronized (CameraServer.class) {
if (m_primarySourceName == null) {
throw new VideoException("no camera available");
}
return getServer("serve_" + m_primarySourceName);
}
}
/**
* Gets a server by name.
*
* @param name Server name
* @return The server
*/
public static VideoSink getServer(String name) {
synchronized (CameraServer.class) {
return m_sinks.get(name);
}
}
/**
* Adds an already created camera.
*
* @param camera Camera
*/
public static void addCamera(VideoSource camera) {
String name = camera.getName();
synchronized (CameraServer.class) {
if (m_primarySourceName == null) {
m_primarySourceName = name;
}
m_sources.put(name, camera);
}
}
/**
* Removes a camera by name.
*
* @param name Camera name
*/
public static void removeCamera(String name) {
synchronized (CameraServer.class) {
m_sources.remove(name);
}
}
}

View File

@@ -0,0 +1,51 @@
// 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.
package edu.wpi.first.cameraserver;
public interface CameraServerShared {
/**
* get the main thread id func.
*
* @return the robotMainThreadId
*/
Long getRobotMainThreadId();
/**
* Report an error to the driver station.
*
* @param error the error to set
*/
void reportDriverStationError(String error);
/**
* Report an video server usage.
*
* @param id the usage id
*/
void reportVideoServer(int id);
/**
* Report a usb camera usage.
*
* @param id the usage id
*/
void reportUsbCamera(int id);
/**
* Report an axis camera usage.
*
* @param id the usage id
*/
void reportAxisCamera(int id);
/**
* Get if running on a roboRIO.
*
* @return true if on roboRIO
*/
default boolean isRoboRIO() {
return false;
}
}

View File

@@ -0,0 +1,50 @@
// 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.
package edu.wpi.first.cameraserver;
public final class CameraServerSharedStore {
private static CameraServerShared cameraServerShared;
private CameraServerSharedStore() {}
/**
* Get the CameraServerShared object.
*
* @return The CameraServerSharedObject
*/
public static synchronized CameraServerShared getCameraServerShared() {
if (cameraServerShared == null) {
cameraServerShared =
new CameraServerShared() {
@Override
public void reportVideoServer(int id) {}
@Override
public void reportUsbCamera(int id) {}
@Override
public void reportDriverStationError(String error) {}
@Override
public void reportAxisCamera(int id) {}
@Override
public Long getRobotMainThreadId() {
return null;
}
};
}
return cameraServerShared;
}
/**
* Set the CameraServerShared object.
*
* @param shared The CameraServerShared object.
*/
public static synchronized void setCameraServerShared(CameraServerShared shared) {
cameraServerShared = shared;
}
}

View File

@@ -0,0 +1,24 @@
// 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.
package edu.wpi.first.vision;
import org.opencv.core.Mat;
/**
* A vision pipeline is responsible for running a group of OpenCV algorithms to extract data from an
* image.
*
* @see VisionRunner
* @see VisionThread
*/
public interface VisionPipeline {
/**
* Processes the image input and sets the result objects. Implementations should make these
* objects accessible.
*
* @param image The image to process.
*/
void process(Mat image);
}

View File

@@ -0,0 +1,121 @@
// 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.
package edu.wpi.first.vision;
import edu.wpi.first.cameraserver.CameraServerSharedStore;
import edu.wpi.first.cscore.CvSink;
import edu.wpi.first.cscore.VideoSource;
import org.opencv.core.Mat;
/**
* A vision runner is a convenient wrapper object to make it easy to run vision pipelines from robot
* code. The easiest way to use this is to run it in a {@link VisionThread} and use the listener to
* take snapshots of the pipeline's outputs.
*
* @see VisionPipeline
* @see VisionThread
* @see <a href="package-summary.html">vision</a>
*/
public class VisionRunner<P extends VisionPipeline> {
private final CvSink m_cvSink = new CvSink("VisionRunner CvSink");
private final P m_pipeline;
private final Mat m_image = new Mat();
private final Listener<? super P> m_listener;
private volatile boolean m_enabled = true;
/**
* Listener interface for a callback that should run after a pipeline has processed its input.
*
* @param <P> the type of the pipeline this listener is for
*/
@FunctionalInterface
public interface Listener<P extends VisionPipeline> {
/**
* Called when the pipeline has run. This shouldn't take much time to run because it will delay
* later calls to the pipeline's {@link VisionPipeline#process process} method. Copying the
* outputs and code that uses the copies should be <i>synchronized</i> on the same mutex to
* prevent multiple threads from reading and writing to the same memory at the same time.
*
* @param pipeline the vision pipeline that ran
*/
void copyPipelineOutputs(P pipeline);
}
/**
* Creates a new vision runner. It will take images from the {@code videoSource}, send them to the
* {@code pipeline}, and call the {@code listener} when the pipeline has finished to alert user
* code when it is safe to access the pipeline's outputs.
*
* @param videoSource the video source to use to supply images for the pipeline
* @param pipeline the vision pipeline to run
* @param listener a function to call after the pipeline has finished running
*/
public VisionRunner(VideoSource videoSource, P pipeline, Listener<? super P> listener) {
this.m_pipeline = pipeline;
this.m_listener = listener;
m_cvSink.setSource(videoSource);
}
/**
* Runs the pipeline one time, giving it the next image from the video source specified in the
* constructor. This will block until the source either has an image or throws an error. If the
* source successfully supplied a frame, the pipeline's image input will be set, the pipeline will
* run, and the listener specified in the constructor will be called to notify it that the
* pipeline ran.
*
* <p>This method is exposed to allow teams to add additional functionality or have their own ways
* to run the pipeline. Most teams, however, should just use {@link #runForever} in its own thread
* using a {@link VisionThread}.
*/
public void runOnce() {
Long id = CameraServerSharedStore.getCameraServerShared().getRobotMainThreadId();
if (id != null && Thread.currentThread().getId() == id) {
throw new IllegalStateException(
"VisionRunner.runOnce() cannot be called from the main robot thread");
}
runOnceInternal();
}
private void runOnceInternal() {
long frameTime = m_cvSink.grabFrame(m_image);
if (frameTime == 0) {
// There was an error, report it
String error = m_cvSink.getError();
CameraServerSharedStore.getCameraServerShared().reportDriverStationError(error);
} else {
// No errors, process the image
m_pipeline.process(m_image);
m_listener.copyPipelineOutputs(m_pipeline);
}
}
/**
* A convenience method that calls {@link #runOnce()} in an infinite loop. This must be run in a
* dedicated thread, and cannot be used in the main robot thread because it will freeze the robot
* program.
*
* <p><strong>Do not call this method directly from the main thread.</strong>
*
* @throws IllegalStateException if this is called from the main robot thread
* @see VisionThread
*/
public void runForever() {
Long id = CameraServerSharedStore.getCameraServerShared().getRobotMainThreadId();
if (id != null && Thread.currentThread().getId() == id) {
throw new IllegalStateException(
"VisionRunner.runForever() cannot be called from the main robot thread");
}
while (m_enabled && !Thread.interrupted()) {
runOnceInternal();
}
}
/** Stop a RunForever() loop. */
public void stop() {
m_enabled = false;
}
}

View File

@@ -0,0 +1,42 @@
// 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.
package edu.wpi.first.vision;
import edu.wpi.first.cscore.VideoSource;
/**
* A vision thread is a special thread that runs a vision pipeline. It is a <i>daemon</i> thread; it
* does not prevent the program from exiting when all other non-daemon threads have finished
* running.
*
* @see VisionPipeline
* @see VisionRunner
* @see Thread#setDaemon(boolean)
*/
public class VisionThread extends Thread {
/**
* Creates a vision thread that continuously runs a {@link VisionPipeline}.
*
* @param visionRunner the runner for a vision pipeline
*/
public VisionThread(VisionRunner<?> visionRunner) {
super(visionRunner::runForever, "WPILib Vision Thread");
setDaemon(true);
}
/**
* Creates a new vision thread that continuously runs the given vision pipeline. This is
* equivalent to {@code new VisionThread(new VisionRunner<>(videoSource, pipeline, listener))}.
*
* @param videoSource the source for images the pipeline should process
* @param pipeline the pipeline to run
* @param listener the listener to copy outputs from the pipeline after it runs
* @param <P> the type of the pipeline
*/
public <P extends VisionPipeline> VisionThread(
VideoSource videoSource, P pipeline, VisionRunner.Listener<? super P> listener) {
this(new VisionRunner<>(videoSource, pipeline, listener));
}
}

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