Implement GetAllSolenoids in the HAL so that SolenoidBase doesn't have to
read each solenoid individually.
Change-Id: I85559565949f7a7119ead410187235636a63f0ed
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>
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
New functions were added to CanTalonSRX in the HAL, however they were
not added to the C side of the library.
Change-Id: I15197e5dce5db0f5ff207d1318c21be485c90741
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
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
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
Change-Id: If2218df082bca93d25b88088696d6c2897732efd
Adding FRC Local new mdns name
Change-Id: I53d206879663b96009ba3a12de161b7a425ffd10
Adding rpath for new libstdc++
Change-Id: I0c022efb0b15f094d153b44f60215ca00d5f1924
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
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
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
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
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
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
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
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
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
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
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