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.
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.
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>
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).
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.
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).
- 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.
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.
* 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
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.
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.
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.
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.
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.
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?
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).
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.
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.
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.
- 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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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().
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.
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.
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.
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.
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.
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.
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.
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
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).
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.
Instead of being called asynchronously by NetworkTables, they are now called by updateValues() synchronously with the main loop, just like the getters.
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.
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.
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.
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.
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.
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.
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).
SampleRobot provides no benefits over RobotBase to advanced teams and
TimedRobot is recommended for everyone else.
A skeleton template for RobotBase was added.
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.
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.
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.
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.
* Renamed LinearDigitalFilter to LinearFilter
* Filter base class removed since it wasn't useful
* C++: std::shared_ptr<> replaced with double parameter
* 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.
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.
* 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
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.
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.
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.
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.
* 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
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.
Resetting the flag should only occur in Enable() and Reset().
IterativeRobotBase needs the flag to remain set to print epochs after
disabling the Watchdog.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
- Build both debug and release binaries
- Append "d" to debug libraries in the style of opencv
- Split shared and static classifiers
- Add raspbian support
Originally, the command was restarted every time the scheduler was
executed if the button was pressed. #1340 changed this behavior in a
breaking manner.
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.
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.
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.
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.
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.
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.
This makes callback registration completely thread safe.
This patch also uses templates and macros to dramatically reduce the amount of
manual boilerplate.
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.
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.
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.
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()
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.
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.
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.
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.
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.
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).
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.
The old headers were moved into folders because doing so avoids polluting
the system include directories.
Folder names were also normalized to lowercase.
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.
* 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.
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.
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.
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.
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.
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: #476Closes: #535
Ref: #1122
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.
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.
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.
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.
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.
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.
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)
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
* Fix SmartDashboard PutData to hook setters.
Also update all PutData values in main periodic loop (same as LiveWindow).
* Improve SmartDashboard.putData() repeat call handling.
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.
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.
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.
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.
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.
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.
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.
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.
* 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().
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.
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.
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.
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.
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.
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.
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.
* 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
* 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.
* 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
Sendable's "Name" is now ".name"
Sendable's "Subsystem" is now ".subsystem"
Command's "name" is now ".name"
Command's "isParented" is now ".isParented"
* 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
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.
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.
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
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.
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.
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.
* 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
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.
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.
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.
* 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
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).
Added newline before comment block and replaced angle brackets around includes
with quotation marks. All other integration tests use quotation marks for WPILib
includes.
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.
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>.
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
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
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
Allows us to control multithreaded access and spurious wakeups easier.
closes#509
Switches DS to use new waitForData functionality
Adds a few new functions
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.
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.
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)
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.
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.
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.
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.
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).
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.
* 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
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.
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.
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.
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.
* 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
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.
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.
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.
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.
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.
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.
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).
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)
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)
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
* 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.
* 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.
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.
* 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.
* Updated the image version and dependent libraries to 2017 v5.
* Updated version for beta 1
* Some additional library updates, task updates, and rpath updates
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.
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.
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.
* 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.
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.
wpilibsuite/styleguide is going to use extensions specified in .styleguide instead of hardcoded extensions. This patch should be merged first to maintain correct operation.
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.
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.
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.
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.
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.
* Reorder wpilibc PIDController's SetAbsoluteTolerance() and SetPercentTolerance() implementations to be consistent with header and wpilibj
* Added std:: prefix to fabs() calls in wpilibc PIDController
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.
* Converted enumerated constants in wpilibj to enums and made their implementation more consistent
* Reflowed text in JNI calls and updated JNI signatures
* 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
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.
* 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
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
Removed delayTicks(), delayMillis(), delaySeconds(), HAL_NO_WAIT, HAL_WAIT_FOREVER,
niTimestamp32(), and niTimestamp64().
Replaced clock_gettime() and usleep() with std::chrono.
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.
* 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.
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.
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.
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.
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.
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.
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.
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.
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.
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
{@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
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
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
Ensure the POR, PWR, and CST error bits are not set when reading the sample.
Reported by: Jared Russell, Austin Schuh
Change-Id: Ib38178d6b51880480aee86e13c16f9ba89a80693
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
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
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
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
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
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
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.
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
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
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.
maven caches are not stored in maven local, and searching here can
cause problems for building simulation.
Change-Id: Id106e80cfb9129431fd43500b06f879e7c682115
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
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
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
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
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
apparently `ln -sf` does not overwrite existing symlinks
so we use `rm -f` first, then use `ls -s`
Change-Id: I033839e50b942cc3508004c84837e9090f1b4f5c
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
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
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
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
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.
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).
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
This turns accidental parameter mismatches between header and implementation
into compiler errors.
Change-Id: Ic26fabb82b2fd5f79407a11435cdbd35348af15f
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
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.
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
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
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
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
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
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).
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
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
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
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
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.
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).
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
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
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
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
- 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 digital gyro interfaced via SPI. Uses the HAL SPI accumulator.
Basic code function successfully tested on a ADXRS453.
Change-Id: Ibc0c7db9964c041fb1e04af4db17e3310ea83c04
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.
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++.
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
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
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
Also, the pressure switch test is wired correctly now,
so it should be working again in Java as well.
Change-Id: I066bc969c2e946d79df7c967cd000acfe840dd04
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
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
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
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
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
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
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
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
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
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
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.
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
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
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
Previously this was not initializing maxOutput.
Fixes artf4699.
Patch provided by: rossbach.ron@gmail.com
Change-Id: I8de5e4a508412d3ca51c58ea87e490916c3bd67c
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
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.
Renamed RelayCrossConnectFxiture to RelayCrossConnectFixture and fixed spelling of variable in PIDCommand class prototype
Change-Id: I2e0970c9b14f58b7fa5ad70024b29e7a54524f0c
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
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
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
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
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
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
Change-Id: If2218df082bca93d25b88088696d6c2897732efd
Adding FRC Local new mdns name
Change-Id: I53d206879663b96009ba3a12de161b7a425ffd10
Adding rpath for new libstdc++
Change-Id: I0c022efb0b15f094d153b44f60215ca00d5f1924
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).
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.
using findAll form instead off whenAdded
fixed instances of network tables versions from 0.1.0 to 3.0.0
Change-Id: I01054d727259ea5dbf3ba8fae49764337d4f6cf9
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.
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
This updates our Gradle wrapper to version 2.5. The Gradle update
requires no changes to developer systems.
Change-Id: Ia2846600579b182c1a8e12889cdcaa8ffd82a812
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).
These are GPL-licensed. This removes the dependency on the ARM JDK being
installed in order to build wpilibj.
Change-Id: I6ea89f601a2e8210acaf9ae257ddc289c548d7f3
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
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
- Ignore no-op calls to setServerMode() / setClientMode().
- Duplicate calls to initialize() act as a restart.
- shutdown() silently does nothing if not running.
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.
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
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
Previously they returned references to the strings/arrays within the passed
NT_Value, which is different from the GetEntry* functions and risks
double-frees.
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
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.
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.
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.
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
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
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
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
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
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
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
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
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
- 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
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).
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
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.
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.
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.
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
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
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
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
Removed unused variable from DigitalInput class
Removed extraneous explicit std::string conversions in Preferences class
Change-Id: Ia445abfd136a7b3e7f0491ed22aaa057814bcc8f
* 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
They were either replaced with delegating constructors or merged into the only constructor in the class.
Change-Id: I3d35139f6ab23c719433a9f76942b02a3b07ddac
C++11 guarantees construction of static variables to be atomic, so this patch takes advantage of that.
Change-Id: I4a3db0f19c5fa5461fef3b6b63d7b8fec596c962
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
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
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
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
Although I have tested this on my machine, further testing
to ensure that the problem really is solved may be helpful.
Change-Id: I892ad7d9f8fa7e791390a38036dafdba00d3a670
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
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
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
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
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
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
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
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
- 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
- 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
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
Rewrote CameraServer to use the new USBCamera implementation and get rid
of some unnecessary copying of the entire image.
Change-Id: I877750e990b6159c0aaf829df62b253a171fbada
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
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
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
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
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
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
Ported the NIVision libraries from the old NIVision implementation to
the new autogenerated JNI bindings.
Change-Id: I7c68ca6abef1185d59a9787e9a269d720c825e2f
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
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
They already existed in Labview, so this will keep parity
New C++/Java funcs
ConfigFwdLimitSwitchNormallyOpen
ConfigRevLimitSwitchNormallyOpen
Change-Id: Ifd65ead827838e7158f7261c67adc3738c72eabf
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
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
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
The other remaining closeloopramprate changes are also merged into this commit, so they may be redundant on gerrit.
Change-Id: Ic3108bb3669e487009b8f52412da3c2f44c42f6f
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
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
Change-Id: I4c41b560d879ffc6d8aa4681cad8f75297fe6cda
Fixed some issues with the camera server class
Change-Id: Ifda524b55f84053be004a404a2890905ded7b266
- 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
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
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.
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
Adds isEnabled and getSetpoint functions to CANTalon classes.
Sets m_controlEnabled=false in Java if changeControlMode(Disabled) is
called.
Change-Id: I08fd0972df22ad83c5578dd43dd6b3536f3b365b
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
Used to be that if you called Set less than ~20 ms after changing the
mode, potentially unwanted behavior could ensue.
Change-Id: I27cb3603286d8fddd894649787d88c0446b00615
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
Tested analog PID in Java and C++.
Changed to default to controlEnabled.
Loosely wrapped a bunch of CanTalonSRX functions in Java.
Change-Id: I9da380e2368d9a72f08be4434ac63b5710a9f90f
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
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
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
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
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
Lanucher immediately attempts to attach 20 times before giving up
and waits 2 seconds between attempts.
Change-Id: Ib0a70b8bbf5e90d5a733ea4e0d6b17d91b36db87
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
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
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
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
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
Plugin was retrieved from https://github.com/mstoeckl/riolog.git with minimal changes to
make it compile.
Change-Id: I340d77c69fe7598595deeaba8d4cd9414b971399
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
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
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
Anywhere in the sample programs where there was just a
isOperatorControl() in the while loop for Teleop, added an "&&
isEnabled()".
Change-Id: Ib81e8bab79923e262c314a073a591855cbf06846
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
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
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.
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
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
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
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
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
This test has been causing the build system to fail to build occasionally
Tested 15 times with 0% failure rate
Change-Id: I8d335b368d95060630b1cd47926e5ba0898e78b7
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
Currently the file only includes RobotBuilder and
SmartDashboard. Additionally, testing is necessary too make sure that
the unzipping is working properly.
Change-Id: I21c0ebef592891c7d27016db401ec69c35a62acd
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
Flattened networktables/java/Athena into networktables/java since Athena
+ Desktop builds are identical and we dropped Azalea support.
Change-Id: If965891c163394fed3bd1a3570b1f923cdd6fd56
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
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
* 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
Note: it currently doesn't seem to build due to a previous change that
needs further investigation.
Change-Id: I1a7f90a66d972b85541939f42e1afcb76f2fb9f4
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
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
Edited comments related to sidecar, breakout, 9472. Some references were
to unused methods in simulation that were removed.
Change-Id: I99b6fe9e8cb982831ffbf29177f84e2f9f71ef47
Make DoubleSolenoid and Solenoid use SolenoidBase, like in C++.
Add an integration tests for double solenoids.
Change-Id: I9a7ff562d65a564c5adabfa73f85f23ad466215b
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
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
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
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
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
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
Remove the test examples that don't do anything helpful
Fix the PacGoat and GearsBot examples to compile
Change-Id: Ic11ca7a97a5b52524fe60dc24fcec6ecfae7ebb7
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
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
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
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
Adds a BaseSystemNotInitalizedException to be thrown in the event that HLUsageRepoting, RobotState or Timer does not have its static implementation set.
Change-Id: I66fde262baa1a9d32d1df9fafa08ba3173bcbb72
The version numbers for several maven plugins were unspecified before, which
caused a bunch of warnings before.
Change-Id: I7e2e05ccf3e2f10b24010576eb78192e9d891120
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
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
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
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
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
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
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
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
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
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
If the gyro was initialized with an analog input the gyro class would not be calibrated properly.
Removes unnecessary type casting.
Change-Id: I6baa72919019a33cce7d3074f8477104cbe65396
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
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
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
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
Some tests are more explicitly named now, and negative values are
tested with both voltage and current control.
Change-Id: I316ccfb7670a341e2f13f4ed3a514f283625409e
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
You can get the state of the USER button with GetUserButton() in
C++ or Utility.getUserButton() in java.
Change-Id: I923e62cab5e621ef43fed503acab5c0d751264fb
Calling CANJaguar::Disable() now makes NetComms stop periodic
setpoint messages, so the motor actually stops until EnableControl()
is called again.
Change-Id: Ib4eb4ad5f729be5c74e799f02ed000511de1e03d
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
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
Percent mode used to be scaled incorrectly in Java because the
max output voltage was initialized to a wrong value.
Change-Id: If88bb2f1d198e13b1724afc62a522fbf91a14b5b
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
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
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
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
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
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
The gyro sensitivity is fixed, the Accelerometer interface is
now used, and some tolerances are adjusted.
Change-Id: Iac1f3c4fbae3be923bd97692684ff72cd2f623f9
ADXL345_I2C, ADXL345_SPI, and BuiltInAccelerometer implement this interface.
The analog accelerometer class Accelerometer was renamed to
AnalogAccelerometer.
Change-Id: Iaae79d582a24c36c372f5fd4ea6df37be289b9c1
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
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
Made the wpilibC++Sim codebase's motor control as
similar to the wpilibC++ motor control as possible.
Change-Id: I5510d952cb40c4a3def210f46a566d7102d604ee
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
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
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
Eclipse now runs an ant script to deploy C++ programs, which runs the
robot program with the run-at-startup system
Change-Id: I3e63967ebc40ad3c38aa561fd303ca3c577fd2a2
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
* changes:
Adds/Formats the CANJaguar.set() Javadocs
Adds CANJaguar integration tests testing that in every control mode the motors can be rotated Adds a separate test suite for explicitly testing CAN
-Makes the MotorEncoderFixture Generic for a specific motor type
-Adds Methods on the FakePotentiometerSource to allow raw values to be set
-Adds Runtime Printing of the Tests to indicate where we are in the program if something unexpected happens
Change-Id: I34c398b7852f1ff07efe1ead6a1169d9222af96a
2014-06-26 15:53:05 -04:00
4988 changed files with 472241 additions and 468347 deletions
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.
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.
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 written here, and behave with Gracious Professionalism.
- 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. We currently use clang-format 6.0 with wpiformat.
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.
## Submitting Changes
### Pull Request Format
Changes should be submitted as a Pull Request against the master branch of WPILib. For most changes, we ask that you squash your changes down to a single commit. For particularly large changes, multiple commits are ok, but assume one commit unless asked otherwise. No change will be merged unless it is up to date with the current master. We will also not merge any changes with merge commits in them; please rebase off of master before submitting a pull request. We do this to make sure that the git history isn't too cluttered.
### Merge Process
When you first submit changes, Travis-CI will attempt to run `./gradlew check` on your change. If this fails, you will need to fix any issues that it sees. Once Travis 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 Jenkins 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.txt).
When you run `./gradlew build`, it builds EVERYTHING. This means debug and release builds for desktop and all installed cross compilers. For many developers, this is way too much, and causes much developer pain.
To help with some of these things, common tasks have shortcuts to only build necessary things for common development and testing tasks.
## Development (Desktop)
For projects `wpiutil`, `ntcore`, `cscore`, `hal``wpilibOldCommands`, `wpilibNewCommands` and `cameraserver`, a `testDesktopJava` and a `testDesktopCpp` task exists. These can be ran with `./gradlew :projectName:task`, and will only build the minimum things required to run those tests.
For `wpilibc`, a `testDesktopCpp` task exists. For `wpilibj`, a `testDesktopJava` task exists.
For `wpilibcExamples`, a `buildDesktopCpp` task exists (These can't be ran, but they can compile).
For `wpilibjExamples`, a `buildDesktopJava` task exists.
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:
The release repository is where official WPILib releases are pushed.
The development repository is where development releases of every commit to [master](https://github.com/wpilibsuite/allwpilib/tree/master) 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 respecively 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 classifer 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.
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.
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.
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.
WPILib is normally built with Gradle, however for some systems, such a linux based coprocessors, Gradle doesn't work correctly, especially if cscore is needed, which requires OpenCV. 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
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 cmake from source and install it.
In addition, if you want JNI and Java, you will need a JDK of at least version 8 installed. In addition, you need a `JAVA_HOME` environment variable set properly and set to the jdk directory.
## Build Options
The following build options are available:
* WITHOUT_JAVA (OFF Default)
* Enabling this option will disable Java and JNI builds. If this is off, `BUILD_SHARED_LIBS` must be on. Otherwise cmake will error.
* BUILD_SHARED_LIBS (ON Default)
* Disabling this option will cause cmake to build static libraries instead of shared libraries. If this is off, `WITHOUT_JAVA` must be on. Otherwise cmake will error.
* WITHOUT_CSCORE (OFF Default)
* Enabling this option will cause cscore to not be built. This will also implicitly disable cameraserver, the hal and wpilib as well, irrespective of their specific options. If this is on, the opencv build requirement is removed.
* WITHOUT_ALLWPILIB (ON Default)
* Disabling this option will build the hal and wpilib 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.
* USE_EXTERNAL_HAL (OFF Default)
* TODO
* EXTERNAL_HAL_FILE
* TODO
## Build Setup
The WPILib CMake build does not allow in source builds. Because the `build` directory is used by gradle, we recommend a `buildcmake` 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 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
```
## 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) # exectuable name as first parameter
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
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 Mission](#wpilib-mission)
- [Building WPILib](#building-wpilib)
- [Requirements](#requirements)
- [Setup](#setup)
- [Building](#building)
- [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.txt).
# 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
- A C++ compiler
- On Linux, GCC works fine
- On Windows, you need Visual Studio 2019 (the free community edition works fine).
Make sure to select the C++ Programming Language for installation
* Note that for 2020 and beyond, you should use version 7 or greater of GCC
- Doxygen (Only required if you want to build the C++ documentation)
## Setup
Clone the WPILib repository. If the toolchains are not installed, install them, and make sure they are available on the system PATH.
See the [styleguide README](https://github.com/wpilibsuite/styleguide/blob/master/README.md) for wpiformat setup instructions.
## 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
```
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:
If you also want simulation to be built, add -PmakeSim. This requires gazebo_transport. We have tested on 14.04 and 15.05, but any correct install of Gazebo should work, even on Windows if you build Gazebo from source. Correct means CMake needs to be able to find gazebo-config.cmake. See [The Gazebo website](https://gazebosim.org/) for installation instructions.
```bash
./gradlew build -PmakeSim
```
If you prefer to use CMake directly, the you can still do so.
The common CMake tasks are wpilibcSim, frc_gazebo_plugins, and gz_msgs
```bash
mkdir build #run this in the root of allwpilib
cd build
cmake ..
make
```
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.
wpiformat can be executed anywhere in the repository via `py -3 -m wpiformat` on Windows or `python3 -m wpiformat` on other platforms.
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 with Gazebo, 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 Simulation directory contains extra simulation tools and libraries, such as gz_msgs and JavaGazebo. See sub-directories for more information.
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 folder.
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).
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.