Commit Graph

1228 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Brad Miller (WPI)
bb52c2441e Merge "Update the library version string for the driver station (artf4708)" 2015-11-02 12:20:06 -08:00