Commit Graph

31 Commits

Author SHA1 Message Date
Austin Shalit
ed1a94531a Update license headers to 2017 (#434) 2017-01-01 00:05:57 -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
77f664a6b1 Fixes simulator HAL builds (#391) 2016-12-06 19:56:31 -08: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
Tyler Veness
5dfae8d6bd Fixed include order (#245)
See wpilibsuite/styleguide (#11).
2016-09-25 16:50:13 -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
Tyler Veness
087eeec760 C standard library functions and types are now prefixed with std:: (#227) 2016-09-14 20:52:06 -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
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
0901ae0808 Switches the HAL structs to use unique_ptr (#183) 2016-07-20 22:05:17 -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
Thad House
ea6876e81f Some general HAL cleanups (#153) 2016-07-09 17:38:18 -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
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
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
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
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
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
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
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
James Kuszmaul
4b575e3e7e Replaced ::std with std for readability/consistency.
Change-Id: I65f9673c237d3513f99827e28963eb22ae9df0c2
2015-07-29 16:48:04 -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
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
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
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
Alex Henning
cb56c9a144 Initial commit of the WPILib simulation support in an alpha quality state.
Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.

Added Omar's changes to the compressor interface

Fixes to make C++ plugin compile on linux.

Added import of the WPILibSim code from the graduate class. It shows up as wpilibJavaSim to follow the convention set by wpilibJava, wpilibJavaJNI and wpilibJavaFinal.

Fixed wpilibJavaSim artifactId to mirror the new convention.

Modified the build of the java plugin to pull in the simulation dependencies.

Added stacktrace printing.

Fixed support for creating projects.

Added support for the isReal() and isSimulation() methods along with the AnalogPotentiometer object to support simulating GearsBot.

Added support for a "WPILib Simulate" button.

Added GearsBot to the built in examples.

Added support for specifying the world file during project creation and switched the default from BluntObjectBot to GearsBot.

Removed unused import.

Added file browser for world files.

Added support for debugging in simulation.

Change simulate icon to be a Gazebo icon.

Switched over to the gazebo messaging system.

Updated location of default world file.

Reverted cmake change.

Fixed bug in WPILibJSim, added better logging and cleaned up code.

Made the frc_gazebo_plugin build using raw cmake instead of catkin, breaking the final ROS dependencies.

Added installation to frc_gazebo_plugin Makefile.

Fixed running of simulation to actually use frcsim.

Initial commit of simulation library for C++. Has the minimal subset of features necessary for having a Simple Robot run in teleoperated mode.

Added notes for generating protobuf messages.

Import of the debuild process into the main repository.

Moved frc_gazebo_plugin under simulation and removed the gazebo folder.

Updated the gazebo plugin to remove excessive printing and limit motor signal to [-1,1].

Updated WPILibJSim to support latching messages and to sleep for 20ms in iterative robot.

Reduced delay between starting frcsim and the users program to 1 second.

Updated GearsBot example.

Fixed a few minor issues for demoable state.

Added simulator support for Victors, Jaguars and Talons.

Added NetworkTables, SmartDashboard and LiveWindow to the simulator.

Added AnalogPotentiometer for simulation.

Added support for simulating encoders.

Added simulation support for Gyro.

Added IterativeRobot, Fixed Timers, Notifiers, PIDControllers and other minor fixes + cleanup.

Added RobotDrive support to simulation.

Separated out JavaGazebo so that SimDS will be able to reuse it.

Separated out SimDS into its own application..

Fixes so that the SimDS is distributed and runs properly for Java with the eclipse plugins.

Added DriverStation support to WPILibCSim

Cleanup of DriverStation, WaitUntilCommand and AnalogPotentiometer for WPILibCSim.

Cleanup of includes for WPILibCSim

Added AnalogPotentiometer to the real WPILibC.

Added AnalogPotentiometer to the real WPILibC.

Added GearsBot example to C++ eclipse plugin.

WPILibCSim fixes to work with launching from the plugin.

Package libwpilibsim in a deb file.

Added includes to plugin distribution.

Added support for external-limit-switches to Gazebo, Java and C++.

Added support for Gazebo Rangefinders and Analog channels to read their values in C++ and Java.

Added support for internal limit switches.

Updated GearsBot programs to use limit switches + range finders.

Added disabling of motors when robot is disabled to more closely mimic the real robot.

Fixes to deal with the switch to .hpp files in the HAL and other misc problems due to rebasing.

Change-Id: I624c5f4d0f28282616a7c92083575bf68adcdce2
2014-06-13 09:31:32 -04:00
Patrick Plenefisch
9b831ed34c Reverting back to static .a files for C++ and fixing lots of other assorted items 2014-05-27 21:26:10 -04:00
Brad Miller
69d9ad70ab CMake Changes
This is the changes made by Patrick Plenefisch converting the native
code to use CMake and the CMake Maven Plugin, as opposed to the
native Maven plugin. This is to allow for compatibility with newer
versions of the GCC toolchain. All the cpp sources were moved from
maven style directories to cpp style directories for CMake.

Change-Id: I67f5e3608948f37c83b0990d232105a3784f8593
2014-04-01 11:18:29 -04:00