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
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
- 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
Also fix DigitalGlitchFilter usage reporting for C++ (only report on
construction rather than on each call) and add for Java.
Change-Id: I73758b16d81c40442c4acec43e0aa6804b2ba250
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
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
- 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
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
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
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
Add the interrupt code for MXP mapping and analog triggers
Took out the unneeded static definition
Change-Id: I9a3483ee8f806b46b4349845e7a189f497c36916
Note: power and thus energy will still be wrong until PDP firmware 1.39
or later is used. See artf3939.
Change-Id: Ic68b8a28c78f1b5d524fa5fb45e3bc0d9cd4a76a