Commit Graph

130 Commits

Author SHA1 Message Date
James Kuszmaul
e017f93f16 Fixed examples to build/run with new WPILib versions.
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
2015-08-13 11:26:28 -07:00
James Kuszmaul
534ea134a4 artf4154: Get rid of raw pointers in C++.
This deals with the majority of the user-facing code
in wpilibC++Devices and a substantial portion of it in
wpilibC++. wpilibC++Sim and wpilibC++IntegrationTests
are untouched except where it is necessary to make them
work with the rest of the libraries.

There is still a lot to do in the following areas:
-The HAL (which we may not want to touch at all).
-The I2C, Serial, and SPI interfaces in wpilibC++Devices,
  which I haven't gotten around to doing yet.
-Most wpilibC++Devices classes have void* pointers
  for interacting with the HAL.
-InterruptableSensorBase passes a void *params for
  the interrupt handler.
-I haven't converted all the const char* to std::strings.
-There are plenty of other cases of raw pointers still
  existing.
-This doesn't fall directly under raw pointer stuff,
  but move syntax and rvalue references could be introduced
  in many places.
-I haven't touched vision code.
-The Resource classes conflict (one is in the hal, the other
  in wpilibC++). Someone should figure out a more
  permanent fix (eg, just renaming them), then doing
  what I did (making a new namespace for one of them,
  essentially the same as renaming it).

A few other things:
-I created a NullDeleter class which is marked as deprecated.
  What this does is it can be passed as the deleter to a
  std::shared_ptr so that when you are converting raw pointers
  to shared_ptrs the shared_ptr doesn't do any deletion if
  someone else owns the raw pointer. This should only be
  used in making old raw pointer UIs.
-I had to alter the build.gradle so that it did not
  emit errors when deprecated functions called deprecated
  functions. Unfortunately, gradle doesn't appear to be
  actually printing out gcc warnigns for some reason.
  The best way I have found to fix this is to patch
  the toolchains (https://bitbucket.org/byteit101/toolchain-builder/pull-request/5/make-gcc-not-throw-warnings-for-nested/diff)
  so that a deprecated function calling a deprecated
  function is fine but a non-deprecated function calling
  a deprecated function will throw a warning (which we
  then elevate with -Werror). I believe that clang
  deals with this properly, although I have not
  tried it myself.

Change-Id: Ib8090c66893576fe73654f4e9d268f9d37be06a2
2015-07-20 13:18:29 -04:00
Joseph
2c392d1813 Fixed comment problem in GyroMecanum cpp and made other small fixes to sample
programs.

Change-Id: Id6ee60085fa369ce3eb2e8261c0352b24886e2ae
2015-06-26 09:39:36 -04:00
Brad Miller (WPI)
6fefcc779a Merge "Added new sample programs to the eclipse plugins for C++ and Java. Modified examples.xml for the corresponding added programs." 2015-06-25 12:19:26 -07:00
Joseph
ae90e5f6d3 Added new sample programs to the eclipse plugins for C++ and Java.
Modified examples.xml for the corresponding added programs.

Change-Id: I3d86c570f446ec8cf3013c58dd94215f2907bbb1
2015-06-25 14:31:51 -04:00
Brad Miller (WPI)
2d71c1c1c7 Merge "[artf4062] Eclipse now throws error on bad build." 2015-06-25 10:26:46 -07:00
Brad Miller (WPI)
6ce98056d3 Merge "Added Ultrasonic example program in Java and C++, updated examples XML." 2015-06-25 08:51:28 -07:00
Kevin O'Connor
9c0df8c8fa Add check for CPP Perspective to CPP Launch Shortcuts. Fixes artf2627
Change-Id: I56f73c41d3266a557d6d42e5b6f7d7c97ce845b0
2015-06-25 09:43:44 -04:00
Joseph
c357d1dcae Added Ultrasonic example program in Java and C++, updated examples XML.
Change-Id: I510bef33d8565d124894d926d6634b04b1b6ca28
2015-06-24 16:30:55 -04:00
James Kuszmaul
d252ed5283 [artf4062] Eclipse now throws error on bad build.
Although I have tested this on my machine, further testing
to ensure that the problem really is solved may be helpful.

Change-Id: I892ad7d9f8fa7e791390a38036dafdba00d3a670
2015-06-22 14:03:32 -04:00
Brad Miller (WPI)
269bf9db64 Merge "Removed confusing error on deploy." 2015-06-03 05:59:59 -07:00
James Kuszmaul
90f05dd31a Removed confusing error on deploy.
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
2015-06-02 16:04:25 -04:00
Kevin O'Connor
5a094879b6 Add DisabledInit to C++ Command Based template. Move and modify comment on Java version. Fixes artf3840
Change-Id: I2371fc9cf64588e38f35b17715773604df6c2392
2015-06-02 10:00:34 -04:00
Fredric Silberberg
1e4e0bacde Gradle Build
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
2015-05-20 16:22:17 -04:00
Brad Miller
e614217d41 New netconsole-host that overwrites the old one on every deploy
Change-Id: I9f9e94a67810b1b40b354a2bfc511f44a05b858a
2015-01-16 21:03:52 -05:00
Kevin O'Connor
9b7042a51a Fix errors in Vision examples.
Change-Id: I752a99ff7b8872a0fc8926e3633c2b521383bbd0
2015-01-16 15:35:48 -05:00
Kevin O'Connor
91ccc5d10b 2015 Color and Retroreflective vision samples for C++ and Java
Change-Id: Id95925ced100b25d591c40995bb016780737312d
2015-01-14 12:45:17 -05:00
Alex Henning
05cd0627b2 Update to point to Gazebo3.2 header location.
Change-Id: Ifebb31a375e8b7a6136115748c3634757fb732b8
2015-01-02 18:34:35 -05:00
Joe Ross
0368322385 Update Camera templates to make C++ and Java more similar.
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
2014-12-29 13:48:11 -05:00
Brad Miller
32f3bea465 Axis camera C++ example program
Change-Id: I60a14ce91fc09831b497ccdaaa7bb1bb26c8d945
2014-12-28 15:47:08 -05:00
Fredric Silberberg
22c4207553 Image v23
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
2014-12-17 11:04:21 -05:00
Brad Miller (WPI)
ac60198842 Merge "Change vision defaults from "cam1" to cam0". Add some error reporting to Intermediate Vision example" 2014-12-12 14:01:26 -08:00
Fredric Silberberg
745489fec7 Image v22
Added the v22 libraries and headers, and updated the minimum version number to version 22

Change-Id: Ie89dcde0212f164296c01e906b3ee9f332fb0b02
2014-12-12 15:15:45 -05:00
Kevin O'Connor
04f9ca4feb Change vision defaults from "cam1" to cam0". Add some error reporting to Intermediate Vision example
Change-Id: If0bb60611c6c5e6f2411ad5d0432c712b24efb24
2014-12-12 15:08:07 -05:00
James Kuszmaul
4833316571 Added more Talon SRX documentation and PID samples.
Change-Id: I2b1326c11452c6895846ded1277dbf4d38a5222d
2014-12-05 17:21:36 -05:00
Fred Silberberg (WPI)
c57d01af94 Merge "Add USB IP to deploy fallbacks and make fallbacks work." 2014-12-05 11:48:44 -08:00
Kevin O'Connor
ec03c3068d Add USB IP to deploy fallbacks and make fallbacks work.
Change-Id: Iae28b1bc883e65cd6f3a88858405d43815c7323b
2014-12-05 13:53:44 -05:00
Fredric Silberberg
cd01945908 Image v20
This adds the updated v20 libraries, and bumps the image version number
in the ant build scripts

Change-Id: I7c4431c167dd77763d4004709454767daefccbf0
2014-12-04 14:50:21 -05:00
Fredric Silberberg
cdbe80315f Image v19
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
2014-12-03 18:19:25 -05:00
Brad Miller
3d897cef58 Make robot programs deploy as lvuser for correct permissions (artf3860)
Change-Id: Ia996f9c1b910c5c9cf33ca8a4305acd8b141b40c
2014-12-03 11:40:35 -05:00
Brad Miller
a9d30c0389 Fixed a typo in the SRX sample project to correct a variable name error
Change-Id: I68f9cf33062bf2ef5df88247af8a5ee470a28d77
2014-11-28 11:07:08 -05:00
Brad Miller
c00d9f1523 Updated the names and descriptions for the c++ vision examples
Change-Id: I7f4e72ddd3e5f5ad20012ed81bd74fa5373e0ebd
2014-11-26 14:26:32 -05:00
Brad Miller (WPI)
29f36b0eac Merge "Overwrite instead of append during version check. Fixes artf3818" 2014-11-26 09:10:17 -08:00
Brad Miller (WPI)
020d97580a Merge "Fixed bug with SDFormat version changing." 2014-11-26 09:01:36 -08:00
James Kuszmaul
28a41e4ac2 Added support for CAN Talon SRX in C++ and Java.
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
2014-11-26 11:55:37 -05:00
Joe Ross
c98f54dbbc match templates with robot builder.
Change-Id: Iedb8b9efc58ca73bc654b119d5d1aed5b4eb5553
2014-11-26 07:41:56 -08:00
Kevin O'Connor
b9913d3e12 Overwrite instead of append during version check. Fixes artf3818
Change-Id: I05bde0997e13318c113a7f7ee228fa1c007bfd2f
2014-11-22 14:32:13 -05:00
Alex Henning
e86312cd6f Fixed bug with SDFormat version changing.
Change-Id: Ia2d17fc60763678ad4971d108861988157537fc3
2014-11-20 16:07:00 -05:00
Brad Miller (WPI)
99dc3c90ed Merge "Removed the tail command" 2014-11-19 16:57:01 -08:00
Brad Miller
4ad8818a8a Added vision samples
Change-Id: Ieb482d072ae15817be40477f187f081c9f7fe19f
2014-11-19 19:39:35 -05:00
Fredric Silberberg
e4babbe4d6 Removed the tail command
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
2014-11-19 14:20:53 -05:00
Kevin O'Connor
4be9732e9c Moves C++ global build properties to properties file to match Java.
Adds host reachability check and static IP fallback
Adds roboRIO Image check
Adds JRE check for Java

Change-Id: I07f3a0863bde0ebec7e7d8f48270e45758bddba5
2014-11-19 09:20:35 -05:00
Thomas Clark
6f4d6ed998 Add support for vision in C++
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
2014-11-16 13:06:49 -05:00
Brad Miller
655ade6436 Using netconsole-host to start programs and get output directed to netconsole and the log file (fixes artf3777, artf3750)
Change-Id: I904989f94132dd0031b5bec9cca2c8dee46070fe
2014-11-15 19:19:36 -05:00
Brad Miller
c883c9e2fc Removed release configuration from template (fixes artf3688)
Change-Id: I4e6d1abc68f23f870911b7d871b5a835cc26afef
2014-11-12 15:41:55 -05:00
Brad Miller (WPI)
eb536ba340 Merge "Added default world files to examples." 2014-11-12 11:40:13 -08:00
Brad Miller
1d0a6b8ace Fix all the samples to build with the C++11/14 language features (constexpr) 2014-11-11 09:15:46 -05:00
Alex Henning
08fdf45f6e Added default world files to examples.
This saves a step and prevents one of the biggest user errors with the
pacgoat example.

Change-Id: Icdceb1da37c4b456f1a34daa815f3bbe2a47e18e
2014-11-09 14:26:23 -05:00
Brad Miller (WPI)
cd3db9631e Merge "Move user program to home\lvuser based on comments from Joe" 2014-11-05 05:23:22 -08:00
Brad Miller (WPI)
b14ca08474 Merge "[artf3717] Added isEnabled to Teleop Loops in Samples." 2014-11-04 13:48:46 -08:00