diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 97b12d00e3..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "networktables/ntcore"] - path = networktables/ntcore - url = ../ntcore diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c66469d0e..107a338296 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,6 @@ if(WIN32) # get rid of min max macros on windows add_definitions(-DNOMINMAX) - # aww yea add_definitions(-DWIN32_LEAN_AND_MEAN) SET(CMAKE_FIND_LIBRARY_PREFIXES "") @@ -55,6 +54,6 @@ endif() include_directories("build") add_subdirectory(simulation/gz_msgs) -add_subdirectory(wpilibc/wpilibC++Sim) +add_subdirectory(wpilibc/simulation) add_subdirectory(simulation/frc_gazebo_plugins) -add_subdirectory(networktables/ntcore) +add_subdirectory(ntcore) diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index 3490780228..0000000000 --- a/Vagrantfile +++ /dev/null @@ -1,125 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! -VAGRANTFILE_API_VERSION = "2" - -Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - # All Vagrant configuration is done here. The most common configuration - # options are documented and commented below. For a complete reference, - # please see the online documentation at vagrantup.com. - - # Every Vagrant virtual environment requires a box to build off of. - config.vm.box = "puphpet/ubuntu1404-x64" - - # Run the bootstrap.sh shell script to setup the enviroment - config.vm.provision :shell, path: "bootstrap.sh" - - # Disable automatic box update checking. If you disable this, then - # boxes will only be checked for updates when the user runs - # `vagrant box outdated`. This is not recommended. - # config.vm.box_check_update = false - - # Create a forwarded port mapping which allows access to a specific port - # within the machine from a port on the host machine. In the example below, - # accessing "localhost:8080" will access port 80 on the guest machine. - # config.vm.network "forwarded_port", guest: 80, host: 8080 - - # Create a private network, which allows host-only access to the machine - # using a specific IP. - # config.vm.network "private_network", ip: "192.168.33.10" - - # Create a public network, which generally matched to bridged network. - # Bridged networks make the machine appear as another physical device on - # your network. - config.vm.network "public_network", bridge: 'en0' - - # If true, then any SSH connections made will enable agent forwarding. - # Default value: false - config.ssh.forward_agent = true - - # Share an additional folder to the guest VM. The first argument is - # the path on the host to the actual folder. The second argument is - # the path on the guest to mount the folder. And the optional third - # argument is a set of non-required options. - # config.vm.synced_folder "../data", "/vagrant_data" - - # Provider-specific configuration so you can fine-tune various - # backing providers for Vagrant. These expose provider-specific options. - # Example for VirtualBox: - # - # config.vm.provider "virtualbox" do |vb| - # # Don't boot with headless mode - # vb.gui = true - # - # # Use VBoxManage to customize the VM. For example to change memory: - # vb.customize ["modifyvm", :id, "--memory", "1024"] - # end - # - # View the documentation for the provider you're using for more - # information on available options. - - # Enable provisioning with CFEngine. CFEngine Community packages are - # automatically installed. For example, configure the host as a - # policy server and optionally a policy file to run: - # - # config.vm.provision "cfengine" do |cf| - # cf.am_policy_hub = true - # # cf.run_file = "motd.cf" - # end - # - # You can also configure and bootstrap a client to an existing - # policy server: - # - # config.vm.provision "cfengine" do |cf| - # cf.policy_server_address = "10.0.2.15" - # end - - # Enable provisioning with Puppet stand alone. Puppet manifests - # are contained in a directory path relative to this Vagrantfile. - # You will need to create the manifests directory and a manifest in - # the file default.pp in the manifests_path directory. - # - # config.vm.provision "puppet" do |puppet| - # puppet.manifests_path = "manifests" - # puppet.manifest_file = "site.pp" - # end - - # Enable provisioning with chef solo, specifying a cookbooks path, roles - # path, and data_bags path (all relative to this Vagrantfile), and adding - # some recipes and/or roles. - # - # config.vm.provision "chef_solo" do |chef| - # chef.cookbooks_path = "../my-recipes/cookbooks" - # chef.roles_path = "../my-recipes/roles" - # chef.data_bags_path = "../my-recipes/data_bags" - # chef.add_recipe "mysql" - # chef.add_role "web" - # - # # You may also specify custom JSON attributes: - # chef.json = { mysql_password: "foo" } - # end - - # Enable provisioning with chef server, specifying the chef server URL, - # and the path to the validation key (relative to this Vagrantfile). - # - # The Opscode Platform uses HTTPS. Substitute your organization for - # ORGNAME in the URL and validation key. - # - # If you have your own Chef Server, use the appropriate URL, which may be - # HTTP instead of HTTPS depending on your configuration. Also change the - # validation key to validation.pem. - # - # config.vm.provision "chef_client" do |chef| - # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME" - # chef.validation_key_path = "ORGNAME-validator.pem" - # end - # - # If you're using the Opscode platform, your validator client is - # ORGNAME-validator, replacing ORGNAME with your organization name. - # - # If you have your own Chef Server, the default validation client name is - # chef-validator, unless you changed the configuration. - # - # chef.validation_client_name = "ORGNAME-validator" -end diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100644 index 52010713cb..0000000000 --- a/bootstrap.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -# Update the apt-get repository list -apt --yes --force-yes install software-properties-common -apt-add-repository --yes ppa:byteit101/frc-toolchain -apt-get update - - -# Download and install Java -apt-get --yes --force-yes install default-jre default-jdk maven python-pip python-setuptools g++-arm-frc-linux-gnueabi sshpass libc6-i386 - -easy_install pip -yes | pip install git-review - - -# Install the jdk-linux-arm-vfp-sflt -# Create the target directory for the jdk -mkdir -p /home/vagrant/jdk-linux-arm-vfp-sflt/ -# Unzip the jdk into this new directory -tar -xzf /vagrant/jdk-7u45-linux-arm-vfp-sflt.gz -C /home/vagrant/jdk-linux-arm-vfp-sflt/ - - -# Keep this at the end of this file -printf "\n\n" -printf "Your virtual enviroment is now nearly set-up.\n" -printf "You can access your enviroment using 'vagrant ssh'.\n" -printf "Please run 'cd /vagrant' to navigate to the repository.\n" -printf "Once you have navigated there please run 'git review -s' to complete the setup of git review.\n" diff --git a/build.gradle b/build.gradle index e5723e0a1a..04e9c35c3c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,227 +1,53 @@ -import org.apache.tools.ant.taskdefs.condition.Os +def enableSimulation = hasProperty('enableSimulation') -// This regex matches either a Windows or Unix style file separator, then the lib part of the library, -// then the name of the library itself, and finally the .so extension at the end. The name of the library -// is in the libName capture group, which is extracted and used for the linker flags -def libPattern = /.*((\\/|\\).*)+lib(?.+).so$/ -def niLibraryArgs = [] -def wpiLibraryArgs = [] -def niLibraryPath = file('ni-libraries').path +def repoBaseUrl = 'http://first.wpi.edu/FRC/roborio/maven' +def publishUrl = "${System.getProperty('user.home')}/releases/maven/" -// The NI Library tree includes all non-wpi libraries, which is everything that doesn't have libwpi in the name -def niLibraryTree = fileTree(niLibraryPath) -niLibraryTree.include '*.so' -niLibraryTree.exclude '*libwpi*.so' - -// This adds all linker flags to the list of ni library linker flags -niLibraryTree.each { lib -> - def nameMatcher = (lib.path =~ libPattern) - if (nameMatcher[0].size() > 1) { - def name = nameMatcher.group('libName') - niLibraryArgs << '-l' + name - } +// If we have the repo property, we want to delete the cached version of the networktables +// dependency and redownload it from the given repo +if (!hasProperty('repo')) { + ext.repo = 'development' } -// The WPI libraries are libraries in the ni-libraries folder that have libwpi in their names -def wpiLibraryTree = fileTree(niLibraryPath) -wpiLibraryTree.include '*libwpi*.so' +allprojects { + ext.enableSimulation = enableSimulation + ext.repo = repo + ext.useExtension = 'release' != repo -// This adds all linker flags to the list of wpi library linker flags -wpiLibraryTree.each { lib -> - def nameMatcher = (lib.path =~ libPattern) - if (nameMatcher[0].size() > 1) { - def name = nameMatcher[0][1] - wpiLibraryArgs << '-l' + name + repositories { + mavenCentral() + maven { + url publishUrl + } + mavenLocal() + maven { + url repoBaseUrl + } } -} -// Shells out to maven for generates the eclipse plugins. -// TODO: Get gradle to build this natively, rather than relying on maven. A plugin exists to do this, called Wuff, but this needs more investigation -// https://github.com/akhikhl/wuff -task eclipsePlugins(type: Exec) { - description = 'Executes the maven build of the eclipse plugins' - group = 'WPILib' - workingDir 'eclipse-plugins' - if (Os.isFamily(Os.FAMILY_WINDOWS)) { - executable 'mvn.cmd' - } else { - executable 'mvn' + ext.getClassifier = { + return useExtension ? "-$repo" : '' } - args 'package' -} - -// Rather than a normal clean, which executes whenever the clean task is run, this must be manually invoked. This -// is because the maven processes is very verbose and takes a long time, checking all of the eclipse repositories -task cleanEclipsePlugins(type: Exec) { - description = 'Cleans the maven build of the eclipse plugins' - group = 'WPILib' - workingDir 'eclipse-plugins' - if (Os.isFamily(Os.FAMILY_WINDOWS)) { - executable 'mvn.cmd' - } else { - executable 'mvn' - } - args 'clean' } subprojects { apply plugin: 'eclipse' apply plugin: 'idea' - repositories { - mavenCentral() - mavenLocal() - } ext.armBuild = true // Disables doclint in java 8. if (JavaVersion.current().isJava8Compatible()) { - allprojects { - tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } + tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:none', '-quiet') } } - // Make sure that all maven publishing routines are run before the maven process starts - plugins.withType(MavenPublishPlugin).whenPluginAdded { - eclipsePlugins.dependsOn publishToMavenLocal - } - - plugins.withType(CppPlugin).whenPluginAdded { - model { - buildTypes { - debug - } - // Adds a custom toolchain for our compiler prefix and options - toolChains { - gcc(Gcc) { - target('arm') { - // We use a custom-built cross compiler with the prefix arm-frc-linux-gnueabi- - // If this ever changes, the prefix will need to be changed here - def compilerPrefix = 'arm-frc-linux-gnueabi-' - cppCompiler.executable = compilerPrefix + cppCompiler.executable - linker.executable = compilerPrefix + linker.executable - assembler.executable = compilerPrefix + assembler.executable - // Gradle auto-adds the -m32 argument to the linker and compiler. Our compiler only supports - // arm, and doesn't understand this flag, so it is removed from both - cppCompiler.withArguments { args -> - args << '-std=c++1y' << '-Wformat=2' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic' - args << '-Wno-psabi' << '-Wno-unused-parameter' << '-fPIC' << '-O0' << '-g3' << '-rdynamic' - //TODO: When the compiler allows us to actually call deprecated functions from within - // deprecated function, remove this line (this will cause calling deprecated functions - // to be treated as a warning rather than an error). - args << '-Wno-error=deprecated-declarations' - args.remove('-m32') - } - linker.withArguments { args -> - args << '-rdynamic' - args.remove('-m32') - } - staticLibArchiver.executable = compilerPrefix + staticLibArchiver.executable - } - } - // Workaround for OS X. Macs for some reason want to use Xcode's gcc - // (which just wraps Clang), so we have to explicitly make it so - // that trying to compile with Clang will call gcc instead - macGcc(Clang) { - target('arm') { - // We use a custom-built cross compiler with the prefix arm-frc-linux-gnueabi- - // If this ever changes, the prefix will need to be changed here - def compilerPrefix = 'arm-frc-linux-gnueabi-' - cppCompiler.executable = compilerPrefix + 'g++' - linker.executable = compilerPrefix + 'g++' - assembler.executable = compilerPrefix + 'gcc' - // Gradle auto-adds the -m32 argument to the linker and compiler. Our compiler only supports - // arm, and doesn't understand this flag, so it is removed from both - cppCompiler.withArguments { args -> - args << '-std=c++1y' << '-Wformat=2' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic' - args << '-Wno-psabi' << '-Wno-unused-parameter' << '-fPIC' << '-O0' << '-g3' << '-rdynamic' - //TODO: When the compiler allows us to actually call deprecated functions from within - // deprecated function, remove this line (this will cause calling deprecated functions - // to be treated as a warning rather than an error). - args << '-Wno-error=deprecated-declarations' - args.remove('-m32') - } - linker.withArguments { args -> - args << '-rdynamic' - args.remove('-m32') - } - staticLibArchiver.executable = compilerPrefix + 'ar' - } - } - } - - // The only platform is arm linux - platforms { - arm { - architecture 'arm' - operatingSystem 'linux' - } - } + ext.setupWpilibRepo = { publishing -> + publishing.repositories.maven { + url = "${System.getProperty('user.home')}/releases/maven/" } - - // This task adds the appropriate linker flags for the NI libraries - task addNiLibraryLinks() { - description = 'Adds the linker flags for the NI libraries in the ni-library folders' - group = 'WPILib' - doLast { - binaries.all { - tasks.withType(CppCompile) { - // desktop version doesn't use all the NI libraries - // so only do this for arm libraries - String architecture = targetPlatform.architecture - if (architecture.contains('arm')){ - linker.args << '-L' + niLibraryPath - linker.args.addAll(niLibraryArgs) - } - } - } - model { - repositories { - libs(PrebuiltLibraries) { libs -> - // Loops through all .so files (except files matching *libwpi*.so) in ../ni-libraries - // and includes them for linking - niLibraryTree.each { niLib -> - libs.create(niLib) { - binaries.withType(SharedLibraryBinary) { - sharedLibraryFile = file(niLib.path) - } - } - } - } - } - } - } - } - - // This task adds the appropriate linker flags for the WPI libraries - task addWpiLibraryLinks() { - description = 'Adds the linker flags for the WPI libraries in the ni-library folders' - group = 'WPILib' - doLast { - binaries.all { - linker.args.addAll(wpiLibraryArgs) - } - model { - repositories { - libs(PrebuiltLibraries) { libs -> - // Loops through all libwpi*.so files in ../ni-libraries and includes them for linking - wpiLibraryTree.each { niLib -> - libs.create(niLib) { - binaries.withType(SharedLibraryBinary) { - sharedLibraryFile = file(niLib.path) - } - } - } - } - } - } - } - } - - // Whenever we add the WPI library links, we'll also need the ni libraries, so set up that dependency - addWpiLibraryLinks.dependsOn addNiLibraryLinks } } +apply from: 'cppSettings.gradle' \ No newline at end of file diff --git a/cppSettings.gradle b/cppSettings.gradle new file mode 100644 index 0000000000..fa4dc5dbfa --- /dev/null +++ b/cppSettings.gradle @@ -0,0 +1,179 @@ +// This regex matches either a Windows or Unix style file separator, then the lib part of the library, +// then the name of the library itself, and finally the .so extension at the end. The name of the library +// is in the libName capture group, which is extracted and used for the linker flags +def libPattern = /.*((\\/|\\).*)+lib(?.+).so$/ +def niLibraryArgs = [] +def niLibraryPath = file('ni-libraries').path + +// The NI Library tree includes all non-wpi libraries, which is everything that doesn't have libwpi in the name +def niLibraryTree = fileTree(niLibraryPath) +niLibraryTree.include '*.so' +niLibraryTree.exclude '*wpi*.so' + +// This adds all linker flags to the list of ni library linker flags +niLibraryTree.each { lib -> + def nameMatcher = (lib.path =~ libPattern) + if (nameMatcher[0].size() > 1) { + def name = nameMatcher.group('libName') + niLibraryArgs << '-l' + name + } +} + +def ntDependency = + project.dependencies.create("edu.wpi.first.wpilib.networktables.cpp:NetworkTables:3.0.0-SNAPSHOT:arm${getClassifier()}@zip") +def config = project.configurations.detachedConfiguration(ntDependency) +config.setTransitive(false) +def netTables = config.files[0].canonicalFile + +def netTablesUnzipLocation = "$buildDir/networktables" + +// Create a task that will unzip the networktables files into a temporary build directory +task unzipNetworkTables(type: Copy) { + description = 'Unzips the networktables maven dependency so that the include files and libraries can be used' + group = 'WPILib' + from zipTree(netTables) + into netTablesUnzipLocation +} + +task clean(type: Delete) { + description = "Deletes the build directory" + group = "Build" + delete buildDir +} + +subprojects { + plugins.withType(CppPlugin).whenPluginAdded { + // This defines a project property that projects depending on network tables can use to setup that dependency. + ext.defineNetworkTablesProperties = { + ext.netTables = netTablesUnzipLocation + ext.netTablesInclude = "$netTablesUnzipLocation/include" + ext.netLibLocation = "$netTablesUnzipLocation/Linux/arm" + ext.netSharedLib = "$netLibLocation/libntcore.so" + ext.netStaticLib = "$netLibLocation/libntcore.a" + + task addNetworkTablesLibraryLinks() { + description = 'Adds the linker flags for the networktables libraries retreived from maven' + group = 'WPILib' + dependsOn project(':').unzipNetworkTables + doLast { + binaries.all { + tasks.withType(CppCompile) { + // desktop version doesn't use all the NI libraries + // so only do this for arm libraries + String architecture = targetPlatform.architecture + if (architecture.contains('arm')){ + linker.args netStaticLib + } + } + } + } + } + } + + model { + buildTypes { + debug + } + // Adds a custom toolchain for our compiler prefix and options + toolChains { + gcc(Gcc) { + target('arm') { + // We use a custom-built cross compiler with the prefix arm-frc-linux-gnueabi- + // If this ever changes, the prefix will need to be changed here + def compilerPrefix = 'arm-frc-linux-gnueabi-' + cppCompiler.executable = compilerPrefix + cppCompiler.executable + linker.executable = compilerPrefix + linker.executable + assembler.executable = compilerPrefix + assembler.executable + // Gradle auto-adds the -m32 argument to the linker and compiler. Our compiler only supports + // arm, and doesn't understand this flag, so it is removed from both + cppCompiler.withArguments { args -> + args << '-std=c++1y' << '-Wformat=2' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic' + args << '-Wno-psabi' << '-Wno-unused-parameter' << '-fPIC' << '-O0' << '-g3' << '-rdynamic' + //TODO: When the compiler allows us to actually call deprecated functions from within + // deprecated function, remove this line (this will cause calling deprecated functions + // to be treated as a warning rather than an error). + args << '-Wno-error=deprecated-declarations' + args.remove('-m32') + } + linker.withArguments { args -> + args << '-rdynamic' + args.remove('-m32') + } + staticLibArchiver.executable = compilerPrefix + staticLibArchiver.executable + } + } + // Workaround for OS X. Macs for some reason want to use Xcode's gcc + // (which just wraps Clang), so we have to explicitly make it so + // that trying to compile with Clang will call gcc instead + macGcc(Clang) { + target('arm') { + // We use a custom-built cross compiler with the prefix arm-frc-linux-gnueabi- + // If this ever changes, the prefix will need to be changed here + def compilerPrefix = 'arm-frc-linux-gnueabi-' + cppCompiler.executable = compilerPrefix + 'g++' + linker.executable = compilerPrefix + 'g++' + assembler.executable = compilerPrefix + 'gcc' + // Gradle auto-adds the -m32 argument to the linker and compiler. Our compiler only supports + // arm, and doesn't understand this flag, so it is removed from both + cppCompiler.withArguments { args -> + args << '-std=c++1y' << '-Wformat=2' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic' + args << '-Wno-psabi' << '-Wno-unused-parameter' << '-fPIC' << '-O0' << '-g3' << '-rdynamic' + //TODO: When the compiler allows us to actually call deprecated functions from within + // deprecated function, remove this line (this will cause calling deprecated functions + // to be treated as a warning rather than an error). + args << '-Wno-error=deprecated-declarations' + args.remove('-m32') + } + linker.withArguments { args -> + args << '-rdynamic' + args.remove('-m32') + } + staticLibArchiver.executable = compilerPrefix + 'ar' + } + } + } + + // The only platform is arm linux + platforms { + arm { + architecture 'arm' + operatingSystem 'linux' + } + } + } + + // This task adds the appropriate linker flags for the NI libraries + task addNiLibraryLinks() { + description = 'Adds the linker flags for the NI libraries in the ni-library folders' + group = 'WPILib' + doLast { + binaries.all { + tasks.withType(CppCompile) { + // desktop version doesn't use all the NI libraries + // so only do this for arm libraries + String architecture = targetPlatform.architecture + if (architecture.contains('arm')){ + linker.args << '-L' + niLibraryPath + linker.args.addAll(niLibraryArgs) + } + } + } + model { + repositories { + libs(PrebuiltLibraries) { libs -> + // Loops through all .so files (except files matching *libwpi*.so) in ../ni-libraries + // and includes them for linking + niLibraryTree.each { niLib -> + libs.create(niLib) { + binaries.withType(SharedLibraryBinary) { + sharedLibraryFile = file(niLib.path) + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/driver-station/build.gradle b/driver-station/build.gradle deleted file mode 100644 index 6a12fe2281..0000000000 --- a/driver-station/build.gradle +++ /dev/null @@ -1,4 +0,0 @@ -apply plugin: 'java' -apply plugin: 'application' - -mainClassName = 'edu.wpi.first.driverstation.DriverStation' \ No newline at end of file diff --git a/driver-station/pom.xml b/driver-station/pom.xml deleted file mode 100644 index 2bac5f2186..0000000000 --- a/driver-station/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - 4.0.0 - edu.wpi.first - driver-station - jar - 0.1.0-SNAPSHOT - - - docline-java8-disable - - [1.8, - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - - - edu.wpi.first.driverstation.DriverStation - - - - - - - - diff --git a/driver-station/src/main/java/edu/wpi/first/driverstation/DriverStation.java b/driver-station/src/main/java/edu/wpi/first/driverstation/DriverStation.java deleted file mode 100644 index 9d5bbae4ba..0000000000 --- a/driver-station/src/main/java/edu/wpi/first/driverstation/DriverStation.java +++ /dev/null @@ -1,248 +0,0 @@ -package edu.wpi.first.driverstation; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.ServerSocket; -import java.net.Socket; -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.logging.ConsoleHandler; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.Logger; - -import edu.wpi.first.driverstation.fms.FMSController; -import edu.wpi.first.driverstation.fms.FMSInterface; -import edu.wpi.first.driverstation.robotcoms.ControlMode; -import edu.wpi.first.driverstation.robotcoms.RobotComm; - -/** - * Driver station implementation for the test stand. This is based heavily on - * code done by Brendan McLeod, modified for command line argument and local - * socket input. - * - * @author Fredric Silberberg - */ -public class DriverStation { - - protected static final Logger log = Logger.getLogger(DriverStation.class - .getName()); - protected static DriverStation station; - - public static void main(String[] args) { - int team = 190, port = 6190; - List commandQueue = new LinkedList<>(); - - // If there are command line arguments, then input them - if (args.length > 0) { - for (int i = 0; i < args.length; i++) { - String command = args[i]; - switch (command) { - case "-t": - // Get the team number if there is still an argument - if (i + 1 < args.length) { - try { - team = Integer.parseInt(args[++i]); - } catch (NumberFormatException ex) { - log.log(Level.WARNING, - "Error, non-integer team number " + args[i]); - displayUsage(); - System.exit(-1); - } - } else { - log.log(Level.WARNING, - "Error, no team number provided."); - displayUsage(); - System.exit(-1); - } - log.log(Level.INFO, "Team number is set to " + team); - break; - case "-h": - // Display help - displayUsage(); - return; - // TODO: Support networked commands - // case "-p": - // // Get the port number - // // Get the team number if there is still an argument - // if (i + 1 < args.length) { - // try { - // port = Integer.parseInt(args[++i]); - // } catch (NumberFormatException ex) { - // log.log(Level.WARNING, - // "Error, non-integer port number " + args[i]); - // displayUsage(); - // System.exit(-1); - // } - // } else { - // log.log(Level.WARNING, - // "Error, no port number provided."); - // displayUsage(); - // System.exit(-1); - // } - // log.log(Level.INFO, "Port number is set to " + port); - // break; - case "enable": - case "disable": - case "teleop": - case "auto": - case "estop": - case "reboot": - case "test": - // Add the command to the queue of commands - commandQueue.add(command); - break; - default: - log.log(Level.SEVERE, "Unknown input " + command); - displayUsage(); - System.exit(-1); - } - } - } - station = new DriverStation(team, port); - for (String command : commandQueue) { - station.addCommand(command); - } - - station.run(); - } - - public static void displayUsage() { - System.out.println("The Java FRC Driverstation"); - System.out.println("To Use: java -jar [commands]"); - System.out.println("-h: Print this display and exit"); - System.out.println("-t [team]: Specify the team number (default 190)"); - System.out - .println("enable, disable, teleop, auto, test, estop, reboot"); - System.out.println("Run the given commands on startup"); - } - - RobotComm robot; - FMSInterface fms; - LinkedBlockingQueue queue; - Thread netThread, sysThread; - - public DriverStation(final int team, final int port) { - queue = new LinkedBlockingQueue<>(); - robot = new RobotComm(team); - fms = new FMSController(team); - robot.setFMSController(fms); - robot.setDaemon(true); - sysThread = new Thread(new Runnable() { - public void run() { - BufferedReader sysIn = new BufferedReader( - new InputStreamReader(System.in)); - while (!Thread.interrupted()) { - try { - String com = sysIn.readLine(); - log.log(Level.FINE, "Recieved stdin command " + com); - station.addCommand(com); - } catch (IOException ex) { - log.log(Level.WARNING, "Error in system read thread", - ex); - } - } - } - }); - sysThread.setDaemon(true); - - // TODO: Test the networking protocol - // netThread = new Thread(new Runnable() { - // public void run() { - // ServerSocket servSock = null; - // List connections = new LinkedList<>(); - // try { - // servSock = new ServerSocket(port); - // while (!Thread.interrupted()) { - // Socket sock = servSock.accept(); - // Thread newCon = new Thread(new ReadThread(sock, station)); - // newCon.run(); - // connections.add(newCon); - // log.log(Level.INFO, "Accepted new network connection"); - // } - // } catch (IOException ex) { - // log.log(Level.WARNING, "Error with the network thread", ex); - // } finally { - // try { - // for (Thread t : connections) { - // t.interrupt(); - // } - // servSock.close(); - // } catch (IOException | NullPointerException e) { - // log.log(Level.SEVERE, - // "Error when closing the server socket", e); - // } - // } - // } - // }); - // netThread.setDaemon(true); - } - - public void run() { - System.out.println("Activating driver station"); - robot.start(); - System.out - .println("The driverstation supports the following commands:"); - System.out - .println("enable, disable, teleop, auto, test, reboot, estop, quit"); - sysThread.start(); - // netThread.start(); - while (true) { - try { - String command = queue.take(); - log.log(Level.FINE, "Received command " + command); - switch (command) { - case "enable": - log.log(Level.INFO, "Enabling robot"); - robot.setEnabled(true); - break; - case "disable": - log.log(Level.INFO, "Disabling robot"); - robot.setEnabled(false); - break; - case "teleop": - log.log(Level.INFO, "Setting robot to teleop mode"); - robot.setControlMode(ControlMode.TELEOP); - break; - case "auto": - log.log(Level.INFO, "Setting robot to auto mode"); - robot.setControlMode(ControlMode.AUTO); - break; - case "test": - log.log(Level.INFO, "Setting robot to test mode"); - robot.setControlMode(ControlMode.TEST_MODE); - break; - case "estop": - log.log(Level.INFO, "Estoping robot"); - robot.eStopRobot(); - break; - case "reboot": - log.log(Level.INFO, "Rebooting robot"); - robot.rebootRobot(); - break; - case "quit": - log.log(Level.INFO, "Shutting down"); - sysThread.interrupt(); - // netThread.interrupt(); - return; - default: - log.log(Level.WARNING, "Unknown input " + command); - break; - } - } catch (InterruptedException e) { - log.log(Level.WARNING, "Error when taking command", e); - } - } - } - - public void addCommand(String command) { - try { - queue.put(command); - } catch (InterruptedException e) { - log.log(Level.WARNING, "Error when added an element to the queue", - e); - } - } -} diff --git a/driver-station/src/main/java/edu/wpi/first/driverstation/ReadThread.java b/driver-station/src/main/java/edu/wpi/first/driverstation/ReadThread.java deleted file mode 100644 index 0c00f9273d..0000000000 --- a/driver-station/src/main/java/edu/wpi/first/driverstation/ReadThread.java +++ /dev/null @@ -1,42 +0,0 @@ -package edu.wpi.first.driverstation; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.Socket; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class ReadThread implements Runnable { - - private final Logger log = Logger.getLogger(DriverStation.class.getName()); - Socket sock; - DriverStation ds; - - public ReadThread(Socket sock, DriverStation ds) { - this.sock = sock; - this.ds = ds; - } - - @Override - public void run() { - try { - BufferedReader netIn = new BufferedReader(new InputStreamReader( - sock.getInputStream())); - while (!Thread.interrupted()) { - String com = netIn.readLine(); - log.log(Level.FINE, "Received command " + com); - ds.addCommand(com); - } - } catch (IOException e) { - log.log(Level.WARNING, "IO Exception in net thread", e); - } finally { - try { - sock.close(); - } catch (IOException | NullPointerException ex) { - log.log(Level.SEVERE, "Error when closing the socket", ex); - } - } - } - -} diff --git a/driver-station/src/main/java/edu/wpi/first/driverstation/fms/FMSController.java b/driver-station/src/main/java/edu/wpi/first/driverstation/fms/FMSController.java deleted file mode 100644 index 793082992c..0000000000 --- a/driver-station/src/main/java/edu/wpi/first/driverstation/fms/FMSController.java +++ /dev/null @@ -1,249 +0,0 @@ -package edu.wpi.first.driverstation.fms; - -import edu.wpi.first.driverstation.DriverStation; -import edu.wpi.first.driverstation.fms.FMSInterface; - -import java.net.DatagramPacket; -import java.net.DatagramSocket; -import java.net.InetAddress; -import java.net.SocketException; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.zip.CRC32; - -import edu.wpi.first.driverstation.robotcoms.ControlMode; - -/** - * - * @author Brendan - */ -public class FMSController extends Thread implements FMSInterface { - - private static final Logger log = Logger.getLogger(DriverStation.class - .getName()); - - private class FMSDataIn extends Thread { - - private FMSController fmsController; - private int FMSreceivePort = 1120; - private DatagramSocket FMSreceiveSocket; - - public FMSDataIn(FMSController fmsController) { - this.fmsController = fmsController; - try { - FMSreceiveSocket = new DatagramSocket(FMSreceivePort); - } catch (SocketException ex) { - log.log(Level.WARNING, "Error creating Robot Sockets", ex); - } - } - - @Override - public void run() { - while (true) { - try { - byte[] receiveData = new byte[74];// the size of the data - DatagramPacket receivePacket = new DatagramPacket( - receiveData, receiveData.length); - FMSreceiveSocket.receive(receivePacket); - fmsController - .setIP(receivePacket.getAddress().getAddress()); - fmsController.receiveFMSpacket(receiveData); - } catch (Exception ex) { - log.log(Level.INFO, "Receive error", ex); - } - } - } - } - - private FMSDataIn dataInput; - private DatagramSocket FMSsendingSocket; - private int teamNumber; - private int FMSsendPort = 1160; - private byte[] ipFMS = new byte[4]; - private boolean[] controlState = new boolean[8]; - // {auto, test, mode, enabled, not-estopped} - private boolean[] fromRobot = new boolean[] { false, false, false, true }; - private char[] batteryData = new char[] { 13, 13 }; - private long lastFMS = 0; - private long lastFMSSent = 0; - char[] stationID = new char[2]; - private boolean isRobotConnected; - - /* - * controlState[0] //null controlState[1] //WAP link controlState[2] //check - * version #s controlState[3] //request DS info? controlState[4] - * //auto-teleop controlState[5] //enabled-disabled controlState[6] //not - * estop controlState[7] //null - */ - - public FMSController(int team) { - teamNumber = team; - try { - FMSsendingSocket = new DatagramSocket(FMSsendPort); - } catch (SocketException ex) { - log.log(Level.WARNING, "Error creating FMS Sockets", ex); - } - for (int i = 0; i < 4; i++) { - ipFMS[i] = (byte) 0xFF; - } - dataInput = new FMSDataIn(this); - dataInput.setDaemon(true); - setDaemon(true); - start(); - } - - @Override - public void start() { - dataInput.start(); - super.start(); - } - - @Override - public void run() { - while (true) { - if ((System.currentTimeMillis() > (lastFMSSent + 100))) { - lastFMSSent = System.currentTimeMillis(); - sendFMSData(); - - } - } - } - - private void setIP(byte[] ipIn) { - ipFMS = ipIn; - } - - @Override - public boolean isFMSConnected() { - - return ((lastFMS + 1000) > System.currentTimeMillis()); - } - - private void receiveFMSpacket(byte[] receiveData) { - - lastFMS = System.currentTimeMillis(); - // reveive data 0, 1 are useless - // 2 contains control data - for (int i = 0; i < 8; i++) { - controlState[i] = (receiveData[2] & (1 << (i))) > 0; - } - stationID[0] = (char) receiveData[3]; - stationID[1] = (char) receiveData[4]; - - } - - private void sendFMSData() { - CRC32 crctest = new CRC32(); - byte[] sendData = new byte[50]; - - for (int i = 0; i < 50; i++) { - sendData[i] = 0x00; - } - - if (isRobotConnected)// {auto, test mode, enabled, not-estopped} - { - sendData[2] += 0x02; - } - if (fromRobot[0])// 0 holds the mode (1=auto 0=teleop) - { - sendData[2] += 0x10; - } - if (fromRobot[2])// 1 holds enabled (1=enabled) - { - sendData[2] += 0x20; - } - if (fromRobot[3])// 2 holds not e-stoped (1=good, 0=bad) - { - sendData[2] += 0x40; - } - - byte teamHigh = (byte) ((teamNumber - (teamNumber % 100)) / 100); - byte teamLow = (byte) (teamNumber % 100); - sendData[6] = 10;// IP address - sendData[7] = teamHigh; - sendData[8] = teamLow; - sendData[9] = 5;// make this variable!!!! - - sendData[10] = (byte) stationID[0];// the alliance color - sendData[11] = (byte) stationID[1]; // the station number - - sendData[26] = 0x00;// amount of dropped packets - sendData[27] = 0x00;// amount of dropped packets - - sendData[28] = 0x00;// number of packets received - sendData[29] = 0x00;// number of packets received - - sendData[30] = 0x00;// trip time - sendData[31] = 0x00;// trip time - sendData[32] = 0x00;// trip time - sendData[33] = 0x00;// trip time - - // need to capture actual voltage - sendData[40] = (byte) batteryData[0]; - sendData[41] = (byte) batteryData[1]; - /* - * get CRC - */ - crctest.reset(); - crctest.update(sendData); - - /* - * convert CRC to byte format - */ - long crccheck = crctest.getValue(); - sendData[46] = (byte) ((crccheck >> 24) & 0xff); - sendData[47] = (byte) ((crccheck >> 16) & 0xff); - sendData[48] = (byte) ((crccheck >> 8) & 0xff); - sendData[49] = (byte) ((crccheck) & 0xff); - - log.log(Level.FINE, "Sending FMS Data"); - /* - * send packet - */ - try { - DatagramPacket sendPacket = new DatagramPacket(sendData, - sendData.length, InetAddress.getByAddress(ipFMS), - FMSsendPort); - FMSsendingSocket.send(sendPacket); - } catch (Exception e) { - } - } - - @Override - public char getAllianceColor() { - return stationID[0]; - } - - @Override - public char getDSNumber() { - return stationID[1]; - } - - @Override - public boolean isEnabled() { - return controlState[5]; - } - - @Override - public ControlMode getControlMode() { - if (!controlState[4]) { - return ControlMode.TELEOP; - } - return ControlMode.AUTO; - } - - @Override - public void updateBattery(char[] batteryData) { - this.batteryData = batteryData; - } - - @Override - public void updateRobotFeedback(boolean[] fromRobot) { - this.fromRobot = fromRobot; - } - - @Override - public void setRobotConnected(boolean connected) { - isRobotConnected = connected; - } -} diff --git a/driver-station/src/main/java/edu/wpi/first/driverstation/fms/FMSInterface.java b/driver-station/src/main/java/edu/wpi/first/driverstation/fms/FMSInterface.java deleted file mode 100644 index a6f6bd6800..0000000000 --- a/driver-station/src/main/java/edu/wpi/first/driverstation/fms/FMSInterface.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package edu.wpi.first.driverstation.fms; - -import edu.wpi.first.driverstation.robotcoms.ControlMode; - -/** - * - * @author Brendan - */ -public interface FMSInterface { - - public char getAllianceColor(); - public char getDSNumber(); - public boolean isFMSConnected(); - public boolean isEnabled(); - public ControlMode getControlMode(); - public void updateBattery(char[] batteryData); - public void updateRobotFeedback(boolean[] fromRobot); - public void setRobotConnected(boolean connected); - - -} diff --git a/driver-station/src/main/java/edu/wpi/first/driverstation/fms/NoFMSController.java b/driver-station/src/main/java/edu/wpi/first/driverstation/fms/NoFMSController.java deleted file mode 100644 index 58fcace45d..0000000000 --- a/driver-station/src/main/java/edu/wpi/first/driverstation/fms/NoFMSController.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package edu.wpi.first.driverstation.fms; - -import edu.wpi.first.driverstation.robotcoms.ControlMode; - -/** - * - * @author Brendan - */ -public class NoFMSController implements FMSInterface { - - @Override - public char getAllianceColor() { - return 'B'; - } - - @Override - public char getDSNumber() { - return '1'; - } - - @Override - public boolean isFMSConnected() { - return false; - } - - @Override - public boolean isEnabled() { - return false; - } - - @Override - public ControlMode getControlMode() { - return ControlMode.TELEOP; - } - - @Override - public void updateBattery(char[] batteryData) { - return; - } - - @Override - public void updateRobotFeedback(boolean[] fromRobot) { - return; - } - - @Override - public void setRobotConnected(boolean connected) { - return; - } -} diff --git a/driver-station/src/main/java/edu/wpi/first/driverstation/robotcoms/ControlMode.java b/driver-station/src/main/java/edu/wpi/first/driverstation/robotcoms/ControlMode.java deleted file mode 100644 index b143c0b87d..0000000000 --- a/driver-station/src/main/java/edu/wpi/first/driverstation/robotcoms/ControlMode.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package edu.wpi.first.driverstation.robotcoms; - -/** - * - * @author Brendan - */ -public enum ControlMode { - AUTO("AUTO"), TELEOP("TELEOP"), TEST_MODE("TEST"); - private String name; - - private ControlMode(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; //To change body of generated methods, choose Tools | Templates. - } - -} diff --git a/driver-station/src/main/java/edu/wpi/first/driverstation/robotcoms/RobotComm.java b/driver-station/src/main/java/edu/wpi/first/driverstation/robotcoms/RobotComm.java deleted file mode 100644 index 116ee12e70..0000000000 --- a/driver-station/src/main/java/edu/wpi/first/driverstation/robotcoms/RobotComm.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package edu.wpi.first.driverstation.robotcoms; - -import edu.wpi.first.driverstation.DriverStation; -import edu.wpi.first.driverstation.fms.FMSInterface; -import edu.wpi.first.driverstation.fms.NoFMSController; - -import java.net.*; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.zip.CRC32; - -/** - * - * @author Brendan - */ -public class RobotComm extends Thread { - - private static final Logger log = Logger.getLogger(DriverStation.class - .getName()); - - private class RobotDataIn extends Thread { - - RobotComm theRobotComm; - private DatagramSocket robotReceiveSocket; - private int robotReceivePort = 1150; - - public RobotDataIn(RobotComm robotComm) { - theRobotComm = robotComm; - try { - robotReceiveSocket = new DatagramSocket(robotReceivePort); - } catch (SocketException ex) { - log.log(Level.WARNING, "Error creating Robot Sockets", ex); - } - } - - public void run() { - while (true) { - try { - byte[] receiveData = new byte[1024];// the size of the data - DatagramPacket receivePacket = new DatagramPacket( - receiveData, receiveData.length); - robotReceiveSocket.receive(receivePacket); - theRobotComm.receiveRobotpacket(receiveData); - Thread.yield(); - } catch (Exception ex) { - } - } - } - } - - private DatagramSocket robotSendingSocket; - private RobotDataIn inputSocket; - private final int robotSendPortNormal = 1110; - // private final int robotSendPortNormal = 1115;//actually for sending on - // the field (used for robot sim) - private final int robotSendPortFMS = 1115; - private int sentPackets;// the current packet ID that is being sent to the - // robot - private int lastRobotPacket;// the last packet ID to have been recieved by - // the robot - private long lastRobotTime;// the time stamp when the robot was seen - private boolean[] controlDataToSend;// {auto, test mode, enabled, - // not-estopped, reboot} - private boolean[] controlFromRobot;// {auto, test mode, enabled, - // not-estopped} - private byte[] stationID = new byte[2]; - private char[] batteryData = new char[2]; - private int robotTeam = 0; - private long lastSentTime = 0; - private int packetOffset = 0; - private FMSInterface fmsController; - - public RobotComm(int team) { - - robotTeam = team; - try { - robotSendingSocket = new DatagramSocket();// robotSendPortNormal); - } catch (SocketException ex) { - log.log(Level.WARNING, "Error creating Robot Sockets", ex); - } - sentPackets = 0; - controlFromRobot = new boolean[] { false, false, false, true };// {auto, - // test - // mode, - // enabled, - // not-estopped} - - controlDataToSend = new boolean[] { false, false, false, true, false };// {auto, - // test - // mode, - // enabled, - // not-estopped, - // reboot} - fmsController = new NoFMSController(); - inputSocket = new RobotDataIn(this); - inputSocket.setDaemon(true); - } - - @Override - public void start() { - inputSocket.start(); - super.start(); - } - - @Override - public void run() { - while (true) { - if ((lastSentTime + 20) < System.currentTimeMillis()) { - lastSentTime = System.currentTimeMillis(); - sendRobotData(); - } - - } - } - - public void rebootRobot() { - setEnabled(false); - controlDataToSend[4] = true; - } - - public void setControlMode(ControlMode theMode) { - if (theMode == ControlMode.AUTO) {// {auto, test mode, enabled, - // not-estopped} - controlDataToSend[0] = true; - controlDataToSend[1] = false; - } else if (theMode == ControlMode.TELEOP) {// {auto, test mode, enabled, - // not-estopped} - controlDataToSend[0] = false; - controlDataToSend[1] = false; - } else if (theMode == ControlMode.TEST_MODE) {// {auto, test mode, - // enabled, - // not-estopped} - controlDataToSend[0] = false; - controlDataToSend[1] = true; - } - } - - public void setEnabled(boolean enabled) {// {auto, test mode, enabled, - // not-estopped, reboot} - controlDataToSend[2] = enabled; - } - - public void eStopRobot() { - - controlDataToSend[3] = false; - } - - public void setAllianceInfo(byte allianceColor, byte allianceStation) { - stationID = new byte[] { allianceColor, allianceStation }; - } - - public void setTeamNumber(int newTeam) { - robotTeam = newTeam; - } - - public void setFMSController(FMSInterface newFMS) { - fmsController = newFMS; - } - - /** - * Packs up all the data and sends the packet to the robot - */ - private void sendRobotData() { - sentPackets++; - sentPackets = sentPackets % 0xFFFF;// makes it overflow properly - packetOffset = sentPackets - lastRobotPacket; - CRC32 crctest = new CRC32(); - byte[] sendData = new byte[1024]; - - for (int i = 0; i < 1024; i++) { - sendData[i] = 0x00; - } - - // Construct the pacet counts - sendData[0] = (byte) ((sentPackets >> 8) & 0xFF); - sendData[1] = (byte) (sentPackets & 0xFF); - // {auto, test mode, enabled, not-estopped, reboot} - if (controlDataToSend[4]) {// reboot bit - sendData[2] += 0x80; - - controlDataToSend[4] = false; - } - if (controlDataToSend[3]) {// not e-stop bit - sendData[2] += 0x40; - } else { - controlDataToSend[3] = true; - } - if (controlDataToSend[2])// if enabled - { - sendData[2] += 0x20; - } - if (controlDataToSend[0])// 1 holds the mode (1=auto 0=teleop) - { - sendData[2] += 0x10; - } - if (fmsController.isFMSConnected()) { - sendData[2] += 0x08; - } - - if (!isConnected()) { - sendData[2] += 0x04; - } - - sendData[3] = (byte) 0xFF;// make all digial inputs high - - sendData[4] = (byte) ((robotTeam >> 8) & 0xFF);// packs up and sends - // team number - sendData[5] = (byte) ((robotTeam) & 0xFF); - - sendData[6] = stationID[0];// the alliance color - sendData[7] = stationID[1]; // the station number - - sendData[72] = (byte) 0x31; - sendData[73] = (byte) 0x31; - sendData[74] = (byte) 0x33; - sendData[75] = (byte) 0x30; - sendData[76] = (byte) 0x21; - sendData[77] = (byte) 0x21; - sendData[78] = (byte) 0x30; - sendData[79] = (byte) 0x30; - - crctest.reset(); - crctest.update(sendData); - long crccheck = crctest.getValue(); - sendData[1020] = (byte) ((crccheck >> 24) & 0xff); - sendData[1021] = (byte) ((crccheck >> 16) & 0xff); - sendData[1022] = (byte) ((crccheck >> 8) & 0xff); - sendData[1023] = (byte) ((crccheck >> 0) & 0xff); - - byte teamHigh = (byte) ((robotTeam - robotTeam % 100) / 100); - byte teamLow = (byte) (robotTeam % 100); - /* - * send packet - */ - try { - DatagramPacket sendPacket; - if (!fmsController.isFMSConnected()) { - sendPacket = new DatagramPacket(sendData, sendData.length, - InetAddress.getByAddress(new byte[] { 10, teamHigh, - teamLow, 2 }), robotSendPortNormal); - } else { - sendPacket = new DatagramPacket(sendData, sendData.length, - InetAddress.getByAddress(new byte[] { 10, teamHigh, - teamLow, 2 }), robotSendPortFMS); - } - robotSendingSocket.send(sendPacket); - } catch (Exception e) { - log.log(Level.WARNING, "Failed to send", e); - } - - fmsController.setRobotConnected(isConnected()); - - } - - public boolean isConnected() { - - if (!(lastRobotTime + 100 > System.currentTimeMillis())) { - return (false); - } - - if (packetOffset > 25) { - return (false); - } - - return (true); - } - - public char[] getBatteryData() { - return batteryData; - } - - /** - * Return the control data that it has gathered from the robot in the - * format: {auto, test mode, enabled, not-estopped} - * - * @return The data from the robot - */ - public boolean[] getControlDataFromRobot() { - return controlFromRobot; - } - - public double getBatteryVoltage() { - return Double.parseDouble(getBatteryString()); - } - - public String getBatteryString() { - return (String.format("%x", getBatteryData()[0]) + "." + String.format( - "%x", getBatteryData()[1])); - } - - protected void receiveRobotpacket(byte[] dataIn) {// this gets called - // whenever a new robot - // packet is recieved - int teamNumber = 0; - teamNumber += dataIn[8] & 0xFF; - teamNumber = ((teamNumber << 8) + (dataIn[9] & 0xFF)) & 0xFFFF; - if (robotTeam == teamNumber) { - lastRobotTime = System.currentTimeMillis(); - batteryData[0] = (char) dataIn[1]; - batteryData[1] = (char) dataIn[2]; - lastRobotPacket = 0; - lastRobotPacket += dataIn[30] & 0xFF; - lastRobotPacket = ((lastRobotPacket << 8) + (dataIn[31] & 0xFF)) & 0xFFFF; - controlFromRobot[0] = ((0x10 & dataIn[0]) > 0);// auto - controlFromRobot[2] = ((0x20 & dataIn[0]) > 0);// enabled - controlFromRobot[3] = true;// robot isn't estopped yet - - } else { - log.log(Level.INFO, "Data from different team..."); - } - fmsController.updateRobotFeedback(controlFromRobot); - fmsController.updateBattery(batteryData); - - } -} diff --git a/eclipse-plugins/.gitattributes b/eclipse-plugins/.gitattributes deleted file mode 100644 index ddb7938ff9..0000000000 --- a/eclipse-plugins/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -*runcppprogram text eol=lf -*runjavaprogram text eol=lf -*robotCommand text eol=lf -*robotDebugCommand text eol=lf diff --git a/eclipse-plugins/.gitignore b/eclipse-plugins/.gitignore deleted file mode 100644 index 0a395394eb..0000000000 --- a/eclipse-plugins/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*~ -target/ -bin/ -.settings/ \ No newline at end of file diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core.feature/build.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core.feature/build.properties deleted file mode 100644 index 64f93a9f0b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core.feature/build.properties +++ /dev/null @@ -1 +0,0 @@ -bin.includes = feature.xml diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core.feature/feature.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core.feature/feature.xml deleted file mode 100644 index bb6555d64f..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core.feature/feature.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - * Copyright (c) 2015 FIRST and WPI -* All rights reserved. - - - - * Copyright (c) 2015 FIRST and WPI -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or -* without modification, are permitted provided that the following -* conditions are met: -* Redistributions of source code must retain the above -* copyright notice, this list of conditions and the following -* disclaimer. Redistributions in binary form must reproduce the -* above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided -* with the distribution. Neither the name of the FIRST nor the -* names of its contributors may be used to endorse or promote -* products derived from this software without specific prior -* written permission. -* -* THIS SOFTWARE IS PROVIDED BY FIRST AND CONTRIBUTORS``AS IS'' -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT -* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -* EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core.feature/pom.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core.feature/pom.xml deleted file mode 100644 index 35a98728ba..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core.feature/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - edu.wpi.first.wpilib.plugins.core.feature - eclipse-feature - - - edu.wpi.first.wpilib.plugins - edu.wpi.first.wpilib.plugins - 0.1.0.qualifier - .. - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/META-INF/MANIFEST.MF b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/META-INF/MANIFEST.MF deleted file mode 100644 index 28c81899dd..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/META-INF/MANIFEST.MF +++ /dev/null @@ -1,35 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: edu.wpi.first.wpilib.plugins.core -Bundle-SymbolicName: edu.wpi.first.wpilib.plugins.core;singleton:=true -Bundle-Version: 0.1.0.qualifier -Bundle-Activator: edu.wpi.first.wpilib.plugins.core.WPILibCore -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - org.eclipse.jface.text, - org.eclipse.core.resources, - org.eclipse.ui.editors, - org.eclipse.ui.ide, - org.eclipse.ant.core;bundle-version="3.2.400", - org.eclipse.ant.launching;bundle-version="1.0.200", - org.eclipse.debug.core;bundle-version="3.7.100", - org.eclipse.core.externaltools;bundle-version="1.0.100", - org.eclipse.debug.ui;bundle-version="3.8.1", - org.eclipse.ui.externaltools;bundle-version="3.2.100", - org.eclipse.ant.ui;bundle-version="3.5.300", - org.eclipse.ui.console;bundle-version="3.5.100", - org.eclipse.ui.navigator;bundle-version="3.5.200", - org.eclipse.ui.navigator.resources;bundle-version="3.4.400", - org.eclipse.ui.intro, - org.eclipse.ui.intro.universal, - org.eclipse.core.expressions;bundle-version="3.4.400", - org.eclipse.core.variables -Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 -Export-Package: edu.wpi.first.wpilib.plugins.core, - edu.wpi.first.wpilib.plugins.core.ant, - edu.wpi.first.wpilib.plugins.core.installer, - edu.wpi.first.wpilib.plugins.core.launching, - edu.wpi.first.wpilib.plugins.core.nature, - edu.wpi.first.wpilib.plugins.core.preferences, - edu.wpi.first.wpilib.plugins.core.wizards diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/WPILib Intro/css/graphics/sample.gif b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/WPILib Intro/css/graphics/sample.gif deleted file mode 100644 index 5ff1ffc674..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/WPILib Intro/css/graphics/sample.gif and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/WPILib Intro/css/graphics/sample_hov.gif b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/WPILib Intro/css/graphics/sample_hov.gif deleted file mode 100644 index 6874164f5b..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/WPILib Intro/css/graphics/sample_hov.gif and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/WPILib Intro/css/sample.css b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/WPILib Intro/css/sample.css deleted file mode 100644 index 9a094d3b51..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/WPILib Intro/css/sample.css +++ /dev/null @@ -1,3 +0,0 @@ - -a#WPILibRobotDevelopment-introLink img { background-image : url(graphics/sample.gif); } -a#WPILibRobotDevelopment-introLink:hover img { background-image : url(graphics/sample_hov.gif); } \ No newline at end of file diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/WPILib Intro/sample.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/WPILib Intro/sample.xml deleted file mode 100644 index ac8bf973f0..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/WPILib Intro/sample.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - Documentation of how WPILib and it's associated tools work. (Internet Connection Needed) - - - - \ No newline at end of file diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/build.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/build.properties deleted file mode 100644 index 6bf048fba1..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -source.. = src/main/java/ -output.. = bin/ -bin.includes = plugin.xml,\ - META-INF/,\ - .,\ - icons/,\ - resources/ -buildDirectory = build/ -plugin.destination = ${basedir}/repository -eclipse.home = /usr/lib/eclipse diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/outlineviewer16x16.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/outlineviewer16x16.png deleted file mode 100644 index 630829e4d7..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/outlineviewer16x16.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/robotbuilder.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/robotbuilder.png deleted file mode 100644 index feb6e2b768..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/robotbuilder.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/robotbuilder16x16.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/robotbuilder16x16.png deleted file mode 100644 index 042c16252b..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/robotbuilder16x16.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/sample.gif b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/sample.gif deleted file mode 100644 index 34fb3c9d8c..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/sample.gif and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/sfxdashboard16x16.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/sfxdashboard16x16.png deleted file mode 100644 index 82fcb87d56..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/sfxdashboard16x16.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/smartdashboard16x16.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/smartdashboard16x16.png deleted file mode 100644 index 6caef2380f..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/smartdashboard16x16.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/wpi.ico b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/wpi.ico deleted file mode 100644 index a6de9245f9..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/icons/wpi.ico and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/plugin.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/plugin.xml deleted file mode 100644 index fc7f9c49c7..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/plugin.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/pom.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/pom.xml deleted file mode 100644 index d8a0fd24b2..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/pom.xml +++ /dev/null @@ -1,233 +0,0 @@ - - - 4.0.0 - edu.wpi.first.wpilib.plugins.core - eclipse-plugin - - - edu.wpi.first.wpilib.plugins - edu.wpi.first.wpilib.plugins - 0.1.0.qualifier - .. - - - - DEVELOPMENT - ${project.build.directory}/tools-zip - - - - - WPILib Maven Repository - http://first.wpi.edu/FRC/roborio/maven/ - - - - - - - . - - resources/configuration.properties - - true - - - - - maven-resources-plugin - 2.6 - - - copy-ant-resources-to-tools-zip - generate-sources - - copy-resources - - - ${tools-zip} - - - src/main/resources/tools-zip - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.8 - - - - - fetch-jar-zip-dependencies - compile - - copy - - - - - edu.wpi.first.wpilib - RobotBuilder - 2.0.0-SNAPSHOT - ${tools-zip} - RobotBuilder.jar - - - edu.wpi.first.wpilib - SmartDashboard - 1.0.0-SNAPSHOT - ${tools-zip} - SmartDashboard.jar - - - edu.wpi.first.wpilib - sfx - zip - zip - ${tools-zip}/../ - sfx.zip - - - edu.wpi.first.wpilib.networktables - OutlineViewer - 1.0.0-SNAPSHOT - ${tools-zip} - OutlineViewer.jar - - - edu.wpi.first.wpilib - java-installer - 1.0-SNAPSHOT - ${tools-zip} - java-installer.jar - - - - false - true - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.7 - - - - - set-version-info - - run - - process-sources - - - - - - - - - - - true - - - - - - generate-jar-zip - compile - - run - - - - - - - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.apache.maven.plugins - - - maven-dependency-plugin - - [2.8,) - - copy - - - - - - - - - - - - - - - - - - - - edu.wpi.first.wpilib - RobotBuilder - 2.0.0-SNAPSHOT - - - edu.wpi.first.wpilib - SmartDashboard - 1.0.0-SNAPSHOT - - - edu.wpi.first.wpilib - sfx - zip - LATEST - - - edu.wpi.first.wpilib.networktables - OutlineViewer - 1.0.0-SNAPSHOT - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/resources/configuration.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/resources/configuration.properties deleted file mode 100644 index cbfaca2ede..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/resources/configuration.properties +++ /dev/null @@ -1,2 +0,0 @@ -timestamp=${timestamp} -version=${version} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/WPILibCore.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/WPILibCore.java deleted file mode 100644 index 129dec5e8e..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/WPILibCore.java +++ /dev/null @@ -1,162 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -import edu.wpi.first.wpilib.plugins.core.ant.AntPropertiesParser; -import edu.wpi.first.wpilib.plugins.core.installer.ToolsInstaller; -import edu.wpi.first.wpilib.plugins.core.preferences.PreferenceConstants; - -/** - * The activator class controls the plug-in life cycle - */ -public class WPILibCore extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "edu.wpi.first.wpilib.plugins.core"; //$NON-NLS-1$ - - // The shared instance - private static WPILibCore plugin; - - /** - * The constructor - */ - public WPILibCore() { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - - new ToolsInstaller(getDefaultVersion()).installIfNecessary(); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static WPILibCore getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given plug-in - * relative path - * - * @param path - * the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - return imageDescriptorFromPlugin(PLUGIN_ID, path); - } - - public Properties getProjectProperties(IProject project) { - List streams = new ArrayList(); - try { - if (project != null) { - try { - streams.add(project.getFile("build.properties") - .getContents()); - } catch (CoreException e) { - } // No properties file - } - File file = new File(getWPILibBaseDir() + "/wpilib.properties"); - streams.add(new FileInputStream(file)); - return new AntPropertiesParser(streams).getProperties(); - } catch (Exception e) { - WPILibCore.logError("Error loading project properties.", e); - return new Properties(); - } - } - - public void saveGlobalProperties(Properties props) { - try { - props.setProperty("version", "current"); - props.store(new FileOutputStream(new File(WPILibCore.getDefault() - .getWPILibBaseDir() + "/wpilib.properties")), - "Don't add new properties, they will be deleted by the eclipse plugin."); - } catch (IOException e) { - WPILibCore.logError("Error saving global properties.", e); - } - } - - public int getTeamNumber(IProject project) { - return Integer.parseInt(getProjectProperties(project).getProperty( - "team-number", "0")); - } - - public String getTargetIP(IProject project) { - String target = getProjectProperties(project).getProperty("target"); - if (target != null) - return target; - else { - int teamNumber = getTeamNumber(project); - return "roborio-" + teamNumber + "-FRC.local"; - } - } - - public String getWPILibBaseDir() { - return System.getProperty("user.home") + "/wpilib"; - } - - public String getDefaultVersion() { - try { - Properties props = new AntPropertiesParser(WPILibCore.class.getResourceAsStream("/resources/configuration.properties")).getProperties(); - if (props.getProperty("version").startsWith("$")) { - return "DEVELOPMENT"; - } else { - return props.getProperty("version"); - } - } catch (CoreException e) { - WPILibCore.logError("Error getting properties.", e); - return "DEVELOPMENT"; - } - } - - public String getCurrentVersion() { - return getPreferenceStore() - .getString(PreferenceConstants.TOOLS_VERSION); - } - - public static void logInfo(String msg) { - getDefault().getLog().log(new Status(Status.INFO, PLUGIN_ID, Status.OK, msg, null)); - } - - public static void logError(String msg, Exception e) { - getDefault().getLog().log(new Status(Status.ERROR, PLUGIN_ID, Status.OK, msg, e)); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunOutlineViewerAction.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunOutlineViewerAction.java deleted file mode 100644 index d44e947312..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunOutlineViewerAction.java +++ /dev/null @@ -1,77 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.actions; - -import java.io.File; -import java.io.FilenameFilter; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -/** - * Our sample action implements workbench action delegate. - * The action proxy will be created by the workbench and - * shown in the UI. When the user tries to use the action, - * this delegate will be created and execution will be - * delegated to it. - * @see IWorkbenchWindowActionDelegate - */ -public class RunOutlineViewerAction implements IWorkbenchWindowActionDelegate { - /** - * The constructor. - */ - public RunOutlineViewerAction() { - } - - /** - * The action has been activated. The argument of the - * method represents the 'real' action sitting - * in the workbench UI. - * @see IWorkbenchWindowActionDelegate#run - */ - public void run(IAction action) { - File dir = new File(WPILibCore.getDefault().getWPILibBaseDir()+File.separator+"tools"); - File[] files = dir.listFiles(new FilenameFilter() { - @Override public boolean accept(File dir, String name) { - return name.startsWith("OutlineViewer") && name.endsWith(".jar"); - } - }); - if (files == null || files.length < 1) return; - String[] cmd = {"java", "-jar", files[0].getAbsolutePath()}; - try { - DebugPlugin.exec(cmd, new File(System.getProperty("user.home"))); - } catch (CoreException e) { - WPILibCore.logError("Error running OutlineViewer.", e); - } - } - - /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() { - } - - /** - * We will cache window object in order to - * be able to provide parent shell for the message dialog. - * @see IWorkbenchWindowActionDelegate#init - */ - public void init(IWorkbenchWindow window) { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunRobotBuilderAction.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunRobotBuilderAction.java deleted file mode 100644 index a812f27d65..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunRobotBuilderAction.java +++ /dev/null @@ -1,77 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.actions; - -import java.io.File; -import java.io.FilenameFilter; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -/** - * Our sample action implements workbench action delegate. - * The action proxy will be created by the workbench and - * shown in the UI. When the user tries to use the action, - * this delegate will be created and execution will be - * delegated to it. - * @see IWorkbenchWindowActionDelegate - */ -public class RunRobotBuilderAction implements IWorkbenchWindowActionDelegate { - /** - * The constructor. - */ - public RunRobotBuilderAction() { - } - - /** - * The action has been activated. The argument of the - * method represents the 'real' action sitting - * in the workbench UI. - * @see IWorkbenchWindowActionDelegate#run - */ - public void run(IAction action) { - File dir = new File(WPILibCore.getDefault().getWPILibBaseDir()+File.separator+"tools"); - File[] files = dir.listFiles(new FilenameFilter() { - @Override public boolean accept(File dir, String name) { - return name.startsWith("RobotBuilder") && name.endsWith(".jar"); - } - }); - if (files == null || files.length < 1) return; - String[] cmd = {"java", "-jar", files[0].getAbsolutePath()}; - try { - DebugPlugin.exec(cmd, new File(System.getProperty("user.home"))); - } catch (CoreException e) { - WPILibCore.logError("Error running RobotBuilder.", e); - } - } - - /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() { - } - - /** - * We will cache window object in order to - * be able to provide parent shell for the message dialog. - * @see IWorkbenchWindowActionDelegate#init - */ - public void init(IWorkbenchWindow window) { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunSFXDashboardAction.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunSFXDashboardAction.java deleted file mode 100644 index 8b184f64c8..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunSFXDashboardAction.java +++ /dev/null @@ -1,77 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.actions; - -import java.io.File; -import java.io.FilenameFilter; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -/** - * Our sample action implements workbench action delegate. - * The action proxy will be created by the workbench and - * shown in the UI. When the user tries to use the action, - * this delegate will be created and execution will be - * delegated to it. - * @see IWorkbenchWindowActionDelegate - */ -public class RunSFXDashboardAction implements IWorkbenchWindowActionDelegate { - /** - * The constructor. - */ - public RunSFXDashboardAction() { - } - - /** - * The action has been activated. The argument of the - * method represents the 'real' action sitting - * in the workbench UI. - * @see IWorkbenchWindowActionDelegate#run - */ - public void run(IAction action) { - File dir = new File(WPILibCore.getDefault().getWPILibBaseDir()+File.separator+"tools"+File.separator+"sfx-2014.11.01"); - File[] files = dir.listFiles(new FilenameFilter() { - @Override public boolean accept(File dir, String name) { - return name.startsWith("sfx") && name.endsWith(".jar"); - } - }); - if (files == null || files.length < 1) return; - String[] cmd = {"java", "-jar", files[0].getAbsolutePath()}; - try { - DebugPlugin.exec(cmd, new File(System.getProperty("user.home"))); - } catch (CoreException e) { - WPILibCore.logError("Error running SFX Dashboard.", e); - } - } - - /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() { - } - - /** - * We will cache window object in order to - * be able to provide parent shell for the message dialog. - * @see IWorkbenchWindowActionDelegate#init - */ - public void init(IWorkbenchWindow window) { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunSimulationSmartDashboardAction.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunSimulationSmartDashboardAction.java deleted file mode 100644 index edbe5d5f42..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunSimulationSmartDashboardAction.java +++ /dev/null @@ -1,77 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.actions; - -import java.io.File; -import java.io.FilenameFilter; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -/** - * Our sample action implements workbench action delegate. - * The action proxy will be created by the workbench and - * shown in the UI. When the user tries to use the action, - * this delegate will be created and execution will be - * delegated to it. - * @see IWorkbenchWindowActionDelegate - */ -public class RunSimulationSmartDashboardAction implements IWorkbenchWindowActionDelegate { - /** - * The constructor. - */ - public RunSimulationSmartDashboardAction() { - } - - /** - * The action has been activated. The argument of the - * method represents the 'real' action sitting - * in the workbench UI. - * @see IWorkbenchWindowActionDelegate#run - */ - public void run(IAction action) { - File dir = new File(WPILibCore.getDefault().getWPILibBaseDir()+File.separator+"tools"); - File[] files = dir.listFiles(new FilenameFilter() { - @Override public boolean accept(File dir, String name) { - return name.startsWith("SmartDashboard") && name.endsWith(".jar"); - } - }); - if (files == null || files.length < 1) return; - String[] cmd = {"java", "-jar", files[0].getAbsolutePath(), "-ip", "localhost"}; - try { - DebugPlugin.exec(cmd, new File(System.getProperty("user.home"))); - } catch (CoreException e) { - WPILibCore.logError("Error running SmartDashboard.", e); - } - } - - /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() { - } - - /** - * We will cache window object in order to - * be able to provide parent shell for the message dialog. - * @see IWorkbenchWindowActionDelegate#init - */ - public void init(IWorkbenchWindow window) { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunSmartDashboardAction.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunSmartDashboardAction.java deleted file mode 100644 index 94c3a03280..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/actions/RunSmartDashboardAction.java +++ /dev/null @@ -1,77 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.actions; - -import java.io.File; -import java.io.FilenameFilter; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -/** - * Our sample action implements workbench action delegate. - * The action proxy will be created by the workbench and - * shown in the UI. When the user tries to use the action, - * this delegate will be created and execution will be - * delegated to it. - * @see IWorkbenchWindowActionDelegate - */ -public class RunSmartDashboardAction implements IWorkbenchWindowActionDelegate { - /** - * The constructor. - */ - public RunSmartDashboardAction() { - } - - /** - * The action has been activated. The argument of the - * method represents the 'real' action sitting - * in the workbench UI. - * @see IWorkbenchWindowActionDelegate#run - */ - public void run(IAction action) { - File dir = new File(WPILibCore.getDefault().getWPILibBaseDir()+File.separator+"tools"); - File[] files = dir.listFiles(new FilenameFilter() { - @Override public boolean accept(File dir, String name) { - return name.startsWith("SmartDashboard") && name.endsWith(".jar"); - } - }); - if (files == null || files.length < 1) return; - String[] cmd = {"java", "-jar", files[0].getAbsolutePath()}; - try { - DebugPlugin.exec(cmd, new File(System.getProperty("user.home"))); - } catch (CoreException e) { - WPILibCore.logError("Error running SmartDashboard.", e); - } - } - - /** - * Selection in the workbench has been changed. We - * can change the state of the 'real' action here - * if we want, but this can only happen after - * the delegate has been created. - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - /** - * We can use this method to dispose of any system - * resources we previously allocated. - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() { - } - - /** - * We will cache window object in order to - * be able to provide parent shell for the message dialog. - * @see IWorkbenchWindowActionDelegate#init - */ - public void init(IWorkbenchWindow window) { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/ant/AntPropertiesParser.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/ant/AntPropertiesParser.java deleted file mode 100644 index 6ea0e180f5..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/ant/AntPropertiesParser.java +++ /dev/null @@ -1,83 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.ant; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Status; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -public class AntPropertiesParser { - List files; - - public AntPropertiesParser(List files) { - this.files = files; - } - - @SuppressWarnings("serial") - public AntPropertiesParser(final InputStream file) { - this(new ArrayList() {{add(file);}}); - } - - public Properties getProperties() throws CoreException { - return getProperties(null); - } - - - public Properties getProperties(Properties defaults) throws CoreException { - Properties props = defaults; - - for (int i = files.size()-1; i >= 0; i--) { - props = getPropertyFile(files.get(i), props); - } - - return props; - } - - public Properties getPropertyFile(InputStream resource, Properties defaults) throws CoreException { - Properties props; - if (defaults == null) props = new Properties(); - else props = new Properties(defaults); - try { - props.load(resource); - } catch (IOException e) { - WPILibCore.logError("Error loading property file: "+resource, e); - return null; - } - - // TODO: Improve parsing of ant properties - boolean overflow = false; - for (Object key : props.keySet().toArray()) { - int count = 0; - while (props.getProperty((String) key).toString().contains("$") && count < 10) { - Pattern pattern = Pattern.compile( "\\$\\{(.*?)\\}" ); - Matcher matcher = pattern.matcher( props.getProperty((String) key).toString() ); - StringBuffer sb = new StringBuffer(); - while ( matcher.find() ) { - String prop = matcher.group().substring(2, matcher.group().length()-1); - if (props.getProperty(prop) != null) { - matcher.appendReplacement(sb, Matcher.quoteReplacement(props.getProperty(prop))); - } else if (prop.equals("user.home")) { - matcher.appendReplacement(sb, Matcher.quoteReplacement(System.getProperty("user.home"))); - } else { - matcher.appendReplacement(sb, Matcher.quoteReplacement(matcher.group())); - } - } - matcher.appendTail( sb ); - props.setProperty((String) key, sb.toString()); - - count++; - } - if (count >= 50) overflow = true; - } - if (overflow) throw new CoreException(new Status(0, "WPI", "Could not parse build.properties file")); - - return props; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/installer/AbstractInstaller.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/installer/AbstractInstaller.java deleted file mode 100644 index a597bdec30..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/installer/AbstractInstaller.java +++ /dev/null @@ -1,280 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.installer; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.jface.dialogs.MessageDialog; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -public abstract class AbstractInstaller { - protected File installLocation; - protected String version, installedVersion; - - public AbstractInstaller(String version, String installedVersion, String path) { - this.installLocation = new File(path); - this.version = version; - this.installedVersion = installedVersion; - } - - /** - * @return The name of the feature being installed. - */ - protected abstract String getFeatureName(); - - /** - * Update the installed version to the latest version. - * @param version The latest version installed. - */ - protected abstract void updateInstalledVersion(String version); - - /** - * @return The input stream to the zip file being installed. - */ - protected abstract InputStream getInstallResourceStream(); - - /** - * - * @param sourcePath the file location of the zip file EX "/resources/simuation.zip" - * @param destinationPath the file location to unzip into EX "/home/peter/wpilib/simulation/plugins" - */ - public void installIfNecessary(String sourcePath, String destinationPath){ - //we're installing from this directory - InputStream sourceStream; - try { - sourceStream = new FileInputStream(sourcePath); - File destFile = new File(destinationPath); - installIfNecessary(sourceStream, destFile); - } catch (FileNotFoundException e) { - WPILibCore.logInfo("source zip file was not found: "+sourcePath); - } - } - - /** - * This function will delete an old wpilib subfolder if necessary and then copy - * the resource stream to the intended directory. - * - * @throws InstallException if bad things happen ... - */ - public void installIfNecessary(){ - installIfNecessary(getInstallResourceStream(), installLocation); - } - - /** - * I'm thinking maybe instead of final things, - * create a UnzipJob class to extend Job and have these as parameters to the constructor* - */ - public void installIfNecessary(final InputStream sourceStream,final File destination) { - final Job installJob = new Job("Install " + getFeatureName()) { - - @Override - protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask(getTaskMessage(), IProgressMonitor.UNKNOWN); - WPILibCore.logInfo("Installing "+getFeatureName()+" if necessary"); - - if (!isInstalled()) { - WPILibCore.logInfo("Install necessary for " + getFeatureName()); - try { - install(sourceStream,destination); - } catch (InstallException e) { - WPILibCore.logError("Error installing "+getFeatureName(), e); - return new Status(IStatus.ERROR, WPILibCore.PLUGIN_ID, - getErrorMessage(e)); - } - } - - updateInstalledVersion(version); - WPILibCore.logInfo("Installed" + getFeatureName()); - - return Status.OK_STATUS; - } - - private String getErrorMessage(InstallException ex) { - String message = "Unable to install " + getFeatureName(); - if (ex.getCause() != null) { - message += ": " + ex.getCause().getMessage(); - } else if (ex.getMessage() != null) { - message += ": " + ex.getMessage(); - } - - message += ". See console for details."; - return message; - } - - private String getTaskMessage() { - try { - return "Extracting to " + installLocation.getCanonicalPath(); - } catch (IOException ex) { - WPILibCore.logError("installIfNecessary().getTaskMessage()", ex); - return "Extracting"; - } - } - }; - - installJob.setUser(true); - installJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); - installJob.schedule(); - } - - /** - * - * This function has been updated to guarantee that the wpilib folder date - * is older than the jar file being run, which ensures up to date tools. - * - * @return True for is there and newer, false otherwise. - */ - protected boolean isInstalled() { - return installLocation.exists() && !version.contains("DEVELOPMENT") && version.equals(installedVersion); - } - - /** - * - * @TODO this function is very long and complicated. If all it does is unzip, it shouldn't be so hard. - * - * @param sourceStream input stream of zip file - * @param destination desired location for output of unzipping - * @throws InstallException - */ - protected void install(InputStream sourceStream, File destination) throws InstallException { - if(destination.exists()) { - if(!removeFileHandler(destination, true)) { - MessageDialog.openError(null, "Error", - String.format("Could not update the old wpilib folder.%n" - + "Please close any WPILib tools and restart Eclipse.")); - } - - //removeFileHandler(installLocation, false); - } - - destination.mkdirs(); - final String osName = System.getProperty("os.name"); - try { - // Unix-like OSes must preserve the executable bit; call unzip - if (osName.startsWith("Mac OS X") || osName.startsWith("Linux")) { - final File tmpFile = File.createTempFile(getFeatureName()+"-", ".zip"); - try { - // Copy to temporary file - try (final InputStream zip = sourceStream; - final FileOutputStream fout = new FileOutputStream(tmpFile)) { - copyStreams(zip, fout); - } - - // Call 'unzip' - final String[] cmd = {"unzip", "-q", "-o", tmpFile.getAbsolutePath(), "-d", destination.getAbsolutePath()}; - WPILibCore.logInfo("unzip "+tmpFile.getAbsolutePath()+" -d "+destination.getAbsolutePath()); - final Process unzipProcess = DebugPlugin.exec(cmd, destination); - try (final InputStream is = unzipProcess.getInputStream()) { - copyStreams(is, System.out); // Copy output to console - } - - // Check result - final int exitCode = unzipProcess.waitFor(); - if (exitCode > 1 || exitCode < 0) { // Exit code 1 indicates success with warnings - throw new InstallException("Unzip process failed with code " + exitCode); - } - } finally { - tmpFile.delete(); - } - } else { - ZipInputStream zip = new ZipInputStream(sourceStream); - ZipEntry entry = zip.getNextEntry(); - while (entry != null) { - WPILibCore.logInfo("\tZipEntry " + entry + ": " + entry.getSize()); - File f = new File(destination, entry.getName()); - if (entry.isDirectory()) { - f.mkdirs(); - } else { - FileOutputStream fo = new FileOutputStream(f); - copyStreams(zip, fo); - fo.close(); - } - - zip.closeEntry(); - entry = zip.getNextEntry(); - } - zip.close(); - } - } catch (IOException | CoreException | InterruptedException ex) { - throw new InstallException("Install encountered a problem", ex); - } - } - - - private static void copyStreams(InputStream source, OutputStream destination) throws IOException { - byte[] buffer = new byte[1024]; - int len; - - while((len = source.read(buffer)) >= 0){ - destination.write(buffer,0,len); - } - } - - /** - * Recursively remove all of the files and folders described by this file handler. - * - * @param file The file to remove - * @param testRun True to just test if the files can be deleted - * @return True if this and all subFiles were removed, false otherwise. - */ - private static boolean removeFileHandler(File file, boolean testRun) { - // if normal files (data files and the like) - if(file.isFile()) { - if(testRun) return file.getParentFile().canWrite(); - else return file.delete(); - } - // if folders - else if(file.isDirectory()) { - for(File f : file.listFiles()) { - if(!removeFileHandler(f, testRun)) - return false; - } - if(testRun) return file.getParentFile().canWrite(); - else return file.delete(); - } - // I'm not sure what to do if the file is not normal or a directory ... - else return false; - } - - /** - * Indicates that an attempt to install a resource failed. - */ - private static class InstallException extends Exception { - private static final long serialVersionUID = 4883122446098399588L; - - /** - * @see Exception#Exception() - */ - @SuppressWarnings("unused") - public InstallException() { - super(); - } - - /** - * @see Exception#Exception(String) - */ - public InstallException(String message) { - super(message); - } - - /** - * @see Exception#Exception(String, Throwable) - */ - public InstallException(String message, Throwable cause) { - super(message, cause); - } - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/installer/ToolsInstaller.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/installer/ToolsInstaller.java deleted file mode 100644 index 4dff87bcbc..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/installer/ToolsInstaller.java +++ /dev/null @@ -1,31 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.installer; - -import java.io.InputStream; -import org.eclipse.jface.preference.IPreferenceStore; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; -import edu.wpi.first.wpilib.plugins.core.preferences.PreferenceConstants; - -public class ToolsInstaller extends AbstractInstaller { - - public ToolsInstaller(String version) { - super(version, WPILibCore.getDefault().getPreferenceStore().getString(PreferenceConstants.TOOLS_VERSION), WPILibCore.getDefault().getWPILibBaseDir() + "/tools"); - } - - @Override - protected String getFeatureName() { - return "tools"; - } - - @Override - protected void updateInstalledVersion(String version) { - IPreferenceStore prefs = WPILibCore.getDefault().getPreferenceStore(); - prefs.setValue(PreferenceConstants.TOOLS_VERSION, version); - - } - - @Override - protected InputStream getInstallResourceStream() { - return ToolsInstaller.class.getResourceAsStream("/resources/tools.zip"); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/launching/AntLauncher.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/launching/AntLauncher.java deleted file mode 100644 index c20456767b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/launching/AntLauncher.java +++ /dev/null @@ -1,148 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.launching; - -import java.io.File; -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchShortcut; -import org.eclipse.ant.launching.IAntLaunchConstants; -import org.eclipse.core.externaltools.internal.IExternalToolConstants; -import org.eclipse.core.runtime.Path; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.console.IConsoleConstants; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -/** - * Contains functions to launch ant scripts while having the output sent to the - * console. Allows for the use of arguments, the specification of targets, and - * the choice of launch modes - * - * @author Ryan O'Meara - */ -@SuppressWarnings("restriction") -public class AntLauncher { - private static boolean installing = false; - - /** - * Runs an ant script's target's with the given arguments, in the given launch mode - * @param antScript A java.io.File representation of the ant file to execute - * @param targets A String of the ant targets to run. For multiple targets, - * format if "target1,target2". For no targets, this argument can be null. This - * method will assume output should be sent to the console, same as calling - * runAntFile(antScript, targets, arguments, mode, true) - * @param arguments A String of arguments to run the file with. Format is - * "-argument1 -argument2". For no arguments, this argument can be null - * @param mode String, either "run" or "debug". If an invalid input is given, - * defaults to "run" - * @return The ILaunch started, or null if it failed to start - */ - public static ILaunch runAntFile(File antScript, String targets, String arguments, String mode){ - return runAntFile(antScript, targets, arguments, mode, true); - } - - /** - * Runs an ant script's target's with the given arguments, in the given launch mode - * @param antScript A java.io.File representation of the ant file to execute - * @param targets A String of the ant targets to run. For multiple targets, - * format if "target1,target2". For no targets, this argument can be null. Allows - * choice of outputting to the console - * @param arguments A String of arguments to run the file with. Format is - * "-argument1 -argument2". For no arguments, this argument can be null - * @param mode String, either "run" or "debug". If an invalid input is given, - * defaults to "run" - * @param outputToConsole If true, output will be sent to console, if false it will not - * @return The ILaunch started, or null if it failed to start - */ - public static ILaunch runAntFile(File antScript, String targets, String arguments, String mode, boolean outputToConsole){ - //Input error checking - if((mode == null)||(!mode.equalsIgnoreCase(ILaunchManager.DEBUG_MODE))){mode = ILaunchManager.RUN_MODE;} //Launcher only accepts run or debug - if((targets != null)&&(targets.equalsIgnoreCase(""))){targets = null;} //Standardize representation of "none" - if((arguments != null)&&(arguments.equalsIgnoreCase(""))){arguments = null;} - - if(antScript.getAbsolutePath().indexOf("install.xml") != -1){ - installing = true; - }else{ - installing = false; - } - - ILaunch ret = null; - - try{ - - //Show the console - if(outputToConsole){ - try{ - final IWorkbenchPage activePage = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow() - .getActivePage(); - activePage.showView(IConsoleConstants.ID_CONSOLE_VIEW); - }catch(Exception e){} - } - - //Get an ant launch config setup to use eclipse VM - which users will setup to be the jdk, - //allowing the use of javac. Also sets the location of the file to execute - ILaunchConfiguration launcher = AntLaunchShortcut.createDefaultLaunchConfiguration(new Path(antScript.getAbsolutePath()), null); - - //Get copy that can be edited - ILaunchConfigurationWorkingCopy workingCopy = launcher.getWorkingCopy(); - - //Prevent this configuration from appearing in history or dialogs - workingCopy.setAttribute(ILaunchManager.ATTR_PRIVATE, false); - - //Setup to show output on console - if(outputToConsole){ - workingCopy.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true); - workingCopy.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, true); - }else{ - workingCopy.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, false); - workingCopy.setAttribute(IExternalToolConstants.ATTR_SHOW_CONSOLE, false); - } - - - workingCopy.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, true); - - if(targets != null){ - workingCopy.setAttribute(IAntLaunchConstants.ATTR_ANT_TARGETS, targets); - } - - if(arguments != null){ - workingCopy.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments); - } - - if(mode.equals(ILaunchManager.DEBUG_MODE)){ - Set modes = new HashSet(); - modes.add(ILaunchManager.DEBUG_MODE); - workingCopy.addModes(modes); - } - - //Save/assert all changes - launcher = workingCopy.doSave(); - - //Launch the modified configuration in the specified mode - try { - ret = launcher.launch(mode, null, true, true); - } catch(Exception e) { - //Does not need Output, handled and resolved internally - WPILibCore.logError("Error running launch.", e); - return null; - } - } catch(Exception e) { - WPILibCore.logError("Error running ant file", e); - return null; - } - - return ret; - } - - public static boolean isInstalling(){ - return installing; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/launching/SimulationNotification.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/launching/SimulationNotification.java deleted file mode 100644 index c1d2756e2b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/launching/SimulationNotification.java +++ /dev/null @@ -1,40 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.launching; - -import java.awt.Desktop; -import java.io.File; -import java.io.IOException; -import java.lang.System; -import java.net.URI; -import java.net.URISyntaxException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.jface.dialogs.MessageDialog; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -public class SimulationNotification { - private static final String URL = "https://wpilib.screenstepslive.com/s/4485/m/23353"; - private static final String SIMULATION_UNSUPPORTED_MSG = - "Simulation may not be support on your operating system.\n" + - "For more information see: " + URL; - - public static void showUnsupported() { - String title = "Simulation Unsupported"; - String message = SIMULATION_UNSUPPORTED_MSG; - MessageDialog.openError(null, title, message); - try { - Desktop.getDesktop().browse(new URI(URL)); - } catch (IOException e) { - WPILibCore.logError("Can't open "+URL, e); - } catch (URISyntaxException e) { - WPILibCore.logError("Can't open "+URL, e); - } - } - - public static boolean supportsSimulation() { - String os = System.getProperty("os.name"); - //for now this is good enough, but we still need better handling if they have this OS but have not installed FRCSim - return (os.equals("Windows 8") || os.equals("Windows 7") || os.equals("Linux") || os.equals("Windows 8.1")); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/nature/FRCProjectNature.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/nature/FRCProjectNature.java deleted file mode 100644 index 085ee93420..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/nature/FRCProjectNature.java +++ /dev/null @@ -1,97 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.nature; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectNature; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - - -/** - * Project nature which configures any project which is given it to be an - * FRC Project, and designates it so FRC options will be enabled to act on - * it - * - */ -public class FRCProjectNature implements IProjectNature { - - public static final String FRC_PROJECT_NATURE = - "edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"; - - - private IProject internalProject; - - /** - * IStatus representing a failed configuration attempt - * - * @author Ryan O'Meara - */ - private class FRCProjectFailedStatus implements IStatus{ - String message; - - public FRCProjectFailedStatus(String message){ - this.message = message; - } - - @Override - public IStatus[] getChildren() {return null;} - - @Override - public int getCode() {return 0;} - - @Override - public Throwable getException() {return null;} - - @Override - public String getMessage() {return message;} - - @Override - public String getPlugin() {return WPILibCore.PLUGIN_ID;} - - @Override - public int getSeverity() {return ERROR;} - - @Override - public boolean isMultiStatus() {return false;} - - @Override - public boolean isOK() {return false;} - - @Override - public boolean matches(int severityMask) { - if((severityMask & ERROR) == ERROR){return true;} - return false; - } - } - - public FRCProjectNature(){ - internalProject = null; - } - - @Override - public void configure() throws CoreException { - if(internalProject == null){ - throw new CoreException( - new FRCProjectFailedStatus("No project set")); - } - } - - @Override - public void deconfigure() throws CoreException { - if(internalProject == null){ - throw new CoreException( - new FRCProjectFailedStatus("No project set")); - } - } - - @Override - public IProject getProject() { - return internalProject; - } - - @Override - public void setProject(IProject project) { - internalProject = project; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/preferences/ComboFieldEditor.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/preferences/ComboFieldEditor.java deleted file mode 100644 index 789d6c981c..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/preferences/ComboFieldEditor.java +++ /dev/null @@ -1,69 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.preferences; - -import java.util.List; - -import org.eclipse.jface.preference.FieldEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -public class ComboFieldEditor extends FieldEditor { - private List choices; - private Composite parent; - Combo comboDropDown; - - public ComboFieldEditor(String preference, String label, Composite parent, List choices) { - super(preference, label, parent); - this.choices = choices; - for (String choice : choices) { - comboDropDown.add(choice); - } - } - - public void setChoice(String item) { - comboDropDown.select(choices.indexOf(item)); - } - - public String getChoice() { - return choices.get(comboDropDown.getSelectionIndex()); - } - - @Override protected void adjustForNumColumns(int numColumns) { - ((GridData) parent.getLayoutData()).horizontalSpan = numColumns; - } - - @Override protected void doFillIntoGrid(Composite parent, int numColumns) { - this.parent = parent; - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = numColumns; - parent.setLayoutData(gd); - - Label label = getLabelControl(parent); - label.setText(getLabelText()); - - comboDropDown = new Combo(parent, SWT.DROP_DOWN | SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - comboDropDown.setLayoutData(gd); - } - - @Override protected void doLoad() { - String item = getPreferenceStore().getString(getPreferenceName()); - setChoice(item); - } - - @Override protected void doLoadDefault() { - String item = getPreferenceStore().getDefaultString(getPreferenceName()); - setChoice(item); - } - - @Override protected void doStore() { - getPreferenceStore().setValue(getPreferenceName(), getChoice()); - } - - @Override public int getNumberOfControls() { - return 2; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/preferences/PreferenceConstants.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/preferences/PreferenceConstants.java deleted file mode 100644 index 533a5e54b3..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/preferences/PreferenceConstants.java +++ /dev/null @@ -1,10 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.preferences; - -/** - * Constant definitions for plug-in preferences - */ -public class PreferenceConstants { - public static final String TEAM_NUMBER = "teamNumberPreference"; - public static final String TOOLS_VERSION = "toolsVersionPreference"; - public static final String UPDATE_TOOLS_VERSION = "udpateToolsVersionPreference"; -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/preferences/PreferenceInitializer.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/preferences/PreferenceInitializer.java deleted file mode 100644 index 20d88c7ce1..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/preferences/PreferenceInitializer.java +++ /dev/null @@ -1,26 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.preferences; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.preference.IPreferenceStore; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -/** - * Class used to initialize default preference values. - */ -public class PreferenceInitializer extends AbstractPreferenceInitializer { - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() - */ - public void initializeDefaultPreferences() { - IPreferenceStore store = WPILibCore.getDefault().getPreferenceStore(); - store.setDefault(PreferenceConstants.TEAM_NUMBER, - WPILibCore.getDefault().getProjectProperties(null).getProperty("team-number", "0")); - String val = store.getString(PreferenceConstants.TOOLS_VERSION); - if (!store.contains(PreferenceConstants.TOOLS_VERSION) && val != null) - store.setValue(PreferenceConstants.TOOLS_VERSION, "none"); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/preferences/WPILibPreferencePage.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/preferences/WPILibPreferencePage.java deleted file mode 100644 index 5ad346f1ff..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/preferences/WPILibPreferencePage.java +++ /dev/null @@ -1,98 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.preferences; - -import java.io.File; -import java.io.FileFilter; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Properties; - -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.IntegerFieldEditor; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -/** - * This class represents a preference page that - * is contributed to the Preferences dialog. By - * subclassing FieldEditorPreferencePage, we - * can use the field support built into JFace that allows - * us to create a page that is small and knows how to - * save, restore and apply itself. - *

- * This page is used to modify preferences only. They - * are stored in the preference store that belongs to - * the main plug-in class. That way, preferences can - * be accessed directly via the preference store. - */ - -public class WPILibPreferencePage - extends FieldEditorPreferencePage - implements IWorkbenchPreferencePage { - IntegerFieldEditor teamNumberEditor; - private ComboFieldEditor toolsVersionEditor; - private BooleanFieldEditor autoUpdateEditor; - - public WPILibPreferencePage() { - super(GRID); - setPreferenceStore(WPILibCore.getDefault().getPreferenceStore()); - setDescription("A preference page for changing all workspace level settings."); - } - - /** - * Creates the field editors. Field editors are abstractions of - * the common GUI blocks needed to manipulate various types - * of preferences. Each field editor knows how to save and - * restore itself. - */ - public void createFieldEditors() { - teamNumberEditor = new IntegerFieldEditor(PreferenceConstants.TEAM_NUMBER, - "&Team Number:", getFieldEditorParent()); - addField(teamNumberEditor); - toolsVersionEditor = new ComboFieldEditor(PreferenceConstants.TOOLS_VERSION, - "&Tools Version:", getFieldEditorParent(), getInstalledVersions()); - addField(toolsVersionEditor); - autoUpdateEditor = new BooleanFieldEditor(PreferenceConstants.UPDATE_TOOLS_VERSION, - "&Auto Update Tools Version", getFieldEditorParent()); - addField(autoUpdateEditor); - } - - private List getInstalledVersions() { - File[] dirs = new File(WPILibCore.getDefault().getWPILibBaseDir()+File.separator+"tools") - .listFiles(new FileFilter() { - @Override public boolean accept(File f) { - return f.isDirectory(); - } - }); - List versions = new ArrayList(); - for (File dir : dirs) { - versions.add(dir.getName()); - } - Collections.sort(versions); - return versions; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - public void init(IWorkbench workbench) { - WPILibCore.logInfo("Preferences initialized."); - Properties props = WPILibCore.getDefault().getProjectProperties(null); - getPreferenceStore().setValue(PreferenceConstants.TEAM_NUMBER, - Integer.parseInt(props.getProperty("team-number", "0"))); - } - - @Override public void performApply() { - performOk(); - } - - @Override public boolean performOk() { - Properties props = WPILibCore.getDefault().getProjectProperties(null); - props.setProperty("team-number", teamNumberEditor.getStringValue()); - WPILibCore.getDefault().saveGlobalProperties(props); - return super.performOk(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ExampleWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ExampleWizard.java deleted file mode 100644 index ce7bc890ff..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ExampleWizard.java +++ /dev/null @@ -1,90 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.wizards; - -import java.net.URL; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWizard; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -public abstract class ExampleWizard extends Wizard implements INewWizard { - private ExampleWizardChoicePage page1; - private IWizardPage page2; - protected ISelection selection; - private TeamNumberPage teamNumberPage; - - /** - * Constructor for SampleNewWizard. - */ - public ExampleWizard() { - super(); - setNeedsProgressMonitor(true); - } - - /** - * The worker method. It will find the container, create the - * file if missing or just replace its contents, and open - * the editor on the newly created file. - */ - protected abstract void doFinish(IExampleProject ex, String teamNumber) throws CoreException; - - protected abstract IWizardPage getDetailsPage(INewProjectInfo info); - - public abstract IExampleProject makeExampleProject(String name, String description, - List tags, String world, List folders, List files); - - public abstract URL getResourceURL(); - - public abstract String getXMLFile(); - - protected TeamNumberPage getTeamNumberPage() { - return teamNumberPage; - } - - /** - * Adding the page to the wizard. - */ - - public void addPages() { - if (TeamNumberPage.needsTeamNumberPage()) { - teamNumberPage = new TeamNumberPage(selection); - addPage(teamNumberPage); - } - page1 = new ExampleWizardChoicePage(this, selection); - addPage(page1); - page2 = getDetailsPage(page1); - addPage(page2); - } - - /** - * This method is called when 'Finish' button is pressed in - * the wizard. We will create an operation and run it - * using wizard as execution context. - */ - public boolean performFinish() { - try { - doFinish(page1.getExampleProject(), TeamNumberPage.getTeamNumberFromPage(teamNumberPage)); - } catch (CoreException e) { - WPILibCore.logError("Error finishing example.", e); - MessageDialog.openError(getShell(), "Error", e.getMessage()); - return false; - } - return true; - } - /** - * We will accept the selection in the workbench to see if - * we can initialize from it. - * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ExampleWizardChoicePage.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ExampleWizardChoicePage.java deleted file mode 100644 index 8bbdd2d106..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ExampleWizardChoicePage.java +++ /dev/null @@ -1,266 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.wizards; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.event.ChangeListener; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.eclipse.jface.dialogs.IDialogPage; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.browser.Browser; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -/** - * The "New" wizard page allows setting the container for the new file as well - * as the file name. The page will only accept file name without the extension - * OR with the extension that matches the expected one (mpe). - */ - -public class ExampleWizardChoicePage extends WizardPage implements INewProjectInfo { - private Tree exampleTree; - private Browser descriptionText; - private IExampleProject selectedExample; - private ExampleWizard parent; - private ChangeListener listener; - - /** - * Constructor for SampleNewWizardPage. - * - * @param pageName - */ - public ExampleWizardChoicePage(ExampleWizard parent, ISelection selection) { - super("wizardPage"); - this.parent = parent; - setTitle("Select Example Project to Create"); - setDescription("This wizard creates a new example project based on your selection."); - } - - /** - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite container = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 2; - layout.verticalSpacing = 9; - - exampleTree = new Tree(container, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); - gd.heightHint = 400; - exampleTree.setLayoutData(gd); - exampleTree.addSelectionListener(new SelectionListener() { - @Override - public void widgetSelected(SelectionEvent arg0) { - dialogChanged(); - } - @Override - public void widgetDefaultSelected(SelectionEvent arg0) { - dialogChanged(); - } - }); - - descriptionText = new Browser(container, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); - gd.heightHint = 400; - gd.widthHint = 300; - descriptionText.setLayoutData(gd); - - initialize(); - dialogChanged(); - setControl(container); - } - - public String getName() { - if (selectedExample != null) { - return selectedExample.getName(); - } - return ""; - } - - public String getWorld() { - if (selectedExample != null) { - return selectedExample.getWorld(); - } - return ""; - } - - /** - * Tests if the current workbench selection is a suitable container to use. - */ - - private void initialize() { - Document doc = loadXMLResource(parent.getXMLFile()); - - // Generate all of the tags - List tags = new ArrayList(); - NodeList nList = doc.getElementsByTagName("tagDescription"); - for (int i = 0; i < nList.getLength(); i++) { - if (nList.item(i).getNodeType() == Node.ELEMENT_NODE) { - tags.add(generateTagFromElement((Element) nList.item(i))); - } - } - - // Generate all of the example projects - List examples = new ArrayList(); - nList = doc.getElementsByTagName("example"); - for (int i = 0; i < nList.getLength(); i++) { - if (nList.item(i).getNodeType() == Node.ELEMENT_NODE) { - examples.add(generateExampleFromElement((Element) nList.item(i))); - } - } - - WPILibCore.logInfo(examples.toString()); - WPILibCore.logInfo(tags.toString()); - - // Generate the tags tree - for (Tag tag : tags) { - TreeItem tagItem = new TreeItem(exampleTree, SWT.NONE); - tagItem.setData(tag); - tagItem.setText(tag.getName()); - for (IExampleProject ex : examples) { - if (ex.getTags().contains(tag.getName())) { - TreeItem exItem = new TreeItem(tagItem, SWT.NONE); - exItem.setData(ex); - exItem.setText(ex.getName()); - } - } - tagItem.setExpanded(true); - } - } - - /** - * Ensures that both text fields are set. - */ - private void dialogChanged() { - if (exampleTree.getSelection().length > 0) { - Object selectedData = exampleTree.getSelection()[0].getData(); - if (selectedData instanceof IExampleProject) { - IExampleProject example = (IExampleProject) selectedData; - descriptionText.setText(example.getContent()); - selectedExample = example; - } else if (selectedData instanceof Tag) { - Tag tag = (Tag) selectedData; - descriptionText.setText(tag.getContent()); - selectedExample = null; - } else selectedExample = null; - } - - if (selectedExample == null) { - updateStatus("Must select a valid example before continuing."); - return; - } - - listener.stateChanged(null); - updateStatus(null); - } - - private void updateStatus(String message) { - setErrorMessage(message); - setPageComplete(message == null); - } - - private Document loadXMLResource(String filename) { - final URL installURL = parent.getResourceURL(); - URL url = null; - try { - url = new URL(installURL, filename); - } catch (final MalformedURLException e) { - WPILibCore.logError("loadXMLResource()", e); - return null; - } - DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder dBuilder; - Document doc; - try { - dBuilder = dbFactory.newDocumentBuilder(); - doc = dBuilder.parse(url.openStream()); - } catch (ParserConfigurationException e) { - WPILibCore.logError("Error parsing "+filename, e); - return null; - } catch (SAXException e) { - WPILibCore.logError("SAX issue with "+filename, e); - return null; - } catch (IOException e) { - WPILibCore.logError("Error reading "+filename, e); - return null; - } - doc.getDocumentElement().normalize(); - return doc; - } - - private Tag generateTagFromElement(Element element) { - String name = element.getElementsByTagName("name").item(0).getTextContent(); - String description = element.getElementsByTagName("description").item(0).getTextContent(); - return new Tag(name, description); - } - - private IExampleProject generateExampleFromElement(Element element) { - String name = element.getElementsByTagName("name").item(0).getTextContent(); - String description = element.getElementsByTagName("description").item(0).getTextContent(); - List tags = new ArrayList(); - Node tagsElement = element.getElementsByTagName("tags").item(0); - if (tagsElement.getNodeType() == Node.ELEMENT_NODE) { - NodeList tagElementList = ((Element) tagsElement).getElementsByTagName("tag"); - for (int i = 0; i < tagElementList.getLength(); i++) { - tags.add(tagElementList.item(i).getTextContent()); - } - } - String world = ""; - if (element.getElementsByTagName("world") != null && - element.getElementsByTagName("world").item(0) != null) { - world = element.getElementsByTagName("world").item(0).getTextContent(); - } - List packages = new ArrayList(); - tagsElement = element.getElementsByTagName("packages").item(0); - if (tagsElement.getNodeType() == Node.ELEMENT_NODE) { - NodeList elementList = ((Element) tagsElement).getElementsByTagName("package"); - for (int i = 0; i < elementList.getLength(); i++) { - packages.add(elementList.item(i).getTextContent()); - } - } - List files = new ArrayList(); - tagsElement = element.getElementsByTagName("files").item(0); - if (tagsElement.getNodeType() == Node.ELEMENT_NODE) { - NodeList elementList = ((Element) tagsElement).getElementsByTagName("file"); - for (int i = 0; i < elementList.getLength(); i++) { - if (elementList.item(i).getNodeType() == Node.ELEMENT_NODE) { - element = (Element) elementList.item(i); - files.add(new IExampleProject.ExportFile(element.getAttribute("source"), - element.getAttribute("destination"))); - } - } - } - return parent.makeExampleProject(name, description, tags, world, packages, files); - } - - public IExampleProject getExampleProject() { - return selectedExample; - } - - @Override - public void registerChangeListener(ChangeListener listener) { - this.listener = listener; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/IExampleProject.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/IExampleProject.java deleted file mode 100644 index 11803752dd..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/IExampleProject.java +++ /dev/null @@ -1,23 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.wizards; - -import java.util.List; - -public interface IExampleProject extends ProjectType { - public String getName(); - public String getContent(); - public List getTags(); - - static class ExportFile { - public String source, destination; - public ExportFile(String source, String destination) { - this.source = source; - this.destination = destination; - } - } - - /** - * @return The world file to use for simulation, if empty - * the default is used. - */ - String getWorld(); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/INewProjectInfo.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/INewProjectInfo.java deleted file mode 100644 index decc95bada..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/INewProjectInfo.java +++ /dev/null @@ -1,24 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.wizards; - -import javax.swing.event.ChangeListener; - -public interface INewProjectInfo { - String getName(); - String getWorld(); - void registerChangeListener(ChangeListener changeListener); - - public static INewProjectInfo Null = new INewProjectInfo() { - @Override - public String getWorld() { - return ""; - } - - @Override - public String getName() { - return ""; - } - - @Override - public void registerChangeListener(ChangeListener changeListener) {} - }; -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/IProjectCreator.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/IProjectCreator.java deleted file mode 100644 index 4b64ade470..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/IProjectCreator.java +++ /dev/null @@ -1,60 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.wizards; - -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; - -/** - * An interface for providing hooks into the project creation - * process. It provides necessary information and can perform - * both initialization and finalization of the project - * creation process. - * - * @author Alex Henning - */ -public interface IProjectCreator { - - /** - * @return The name of the project to create. - */ - String getName(); - - /** - * @return The main package to be created. Should be an - * empty string if irrelevant. - */ - String getPackageName(); - - /** - * @return Map of keys to be substituted with values - * during the creation process. - */ - Map getValues(); - - /** - * @return The natures that this project should have. - */ - List getNatures(); - - /** - * @return A project type object that provides files - * and directories to create. - */ - ProjectType getProjectType(); - - /** - * Run extra initialization code on the project. - * @param project The project being created - * @throws CoreException - */ - void initialize(IProject project) throws CoreException; - - /** - * Run extra finalization code on the project. - * @param project The project being created - * @throws CoreException - */ - void finalize(IProject project) throws CoreException; -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/IProjectFilter.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/IProjectFilter.java deleted file mode 100644 index 74b1e63745..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/IProjectFilter.java +++ /dev/null @@ -1,17 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.wizards; - -import org.eclipse.core.resources.IProject; - -/** - * A filter that can be used to select projects. - * - * @author alex - * - */ -public interface IProjectFilter { - /** - * @param project The project to check. - * @return Whether or to accept the project. - */ - boolean accept(IProject project); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/NewProjectMainPage.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/NewProjectMainPage.java deleted file mode 100644 index 53ca46a5a7..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/NewProjectMainPage.java +++ /dev/null @@ -1,255 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.wizards; - -import java.util.Map; - -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import org.eclipse.jface.dialogs.IDialogPage; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/** - * The "New" wizard page allows setting the container for the new file as well - * as the file name. The page will only accept file name without the extension - * OR with the extension that matches the expected one (mpe). - */ - -public class NewProjectMainPage extends WizardPage { - private Text projectNameText; - private Text packageText; - Map types; - private Text worldText; - private Button worldButton; - - Button iterativeRobot, commandRobot, sampleRobot; - private boolean showPackage; - private boolean showProjectTypes; - private TeamNumberPage teamNumberPage; - private INewProjectInfo info; - - /** - * Constructor for SampleNewWizardPage. - * @param teamNumberPage - * - * @param pageName - */ - public NewProjectMainPage(ISelection selection, TeamNumberPage teamNumberPage, INewProjectInfo info) { - super("wizardPage"); - this.teamNumberPage = teamNumberPage; - showPackage = true; - showProjectTypes = false; - this.info = info; - } - - /** - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - System.out.println(info.getName() +" -- "+ info.getWorld()); - - Composite container = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 2; - layout.verticalSpacing = 9; - Label label = new Label(container, SWT.NULL); - label.setText("Project &Name:"); - - projectNameText = new Text(container, SWT.BORDER | SWT.SINGLE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - projectNameText.setLayoutData(gd); - projectNameText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - if (showPackage) { - label = new Label(container, SWT.NULL); - label.setText("&Package:"); - - packageText = new Text(container, SWT.BORDER | SWT.SINGLE); - gd = new GridData(GridData.FILL_HORIZONTAL); - packageText.setLayoutData(gd); - packageText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - } - - if (showProjectTypes) { - Group projectTypeGroup = new Group(container, SWT.BORDER); - projectTypeGroup.setText("Project Type"); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - projectTypeGroup.setLayoutData(gd); - GridLayout groupLayout = new GridLayout(); - groupLayout.numColumns = 1; - projectTypeGroup.setLayout(groupLayout); - - commandRobot = new Button(projectTypeGroup, SWT.RADIO | SWT.WRAP); - commandRobot.setText("Command-Based Robot: A robot project that allows robots to be implemented using the command based model to allow complex functionality to be developed from simpler functionality."); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.widthHint = 300; - commandRobot.setLayoutData(gd); - commandRobot.setSelection(true); - - iterativeRobot = new Button(projectTypeGroup, SWT.RADIO | SWT.WRAP); - iterativeRobot.setText("Iterative Robot: A robot project that allows robots to be implemented in an iterative manner."); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.widthHint = 300; - iterativeRobot.setLayoutData(gd); - - sampleRobot = new Button(projectTypeGroup, SWT.RADIO | SWT.WRAP); - sampleRobot.setText("Sample Robot: A robot project used for small sample programs or for highly advanced programs with more complete control over program flow"); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.widthHint = 300; - sampleRobot.setLayoutData(gd); - } - - label = new Label(container, SWT.NULL); - label.setText("Simulation &World:"); - - - Composite comp = new Composite(container, SWT.NULL); - gd = new GridData(GridData.FILL_HORIZONTAL); - comp.setLayoutData(gd); - GridLayout groupLayout = new GridLayout(); - groupLayout.numColumns = 2; - comp.setLayout(groupLayout); - worldText = new Text(comp, SWT.BORDER | SWT.SINGLE); - worldText.setLayoutData(gd); - worldText.setText("/usr/share/frcsim/worlds/GearsBotDemo.world"); - worldText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - worldButton = new Button(comp, SWT.NULL); - worldButton.setText("Browse"); - worldButton.addSelectionListener(new SelectionAdapter() { - @Override public void widgetSelected(SelectionEvent e) { - browse(); - } - }); - - initialize(); - dialogChanged(); - setControl(container); - } - - /** - * Tests if the current workbench selection is a suitable container to use. - */ - private void initialize() { - String teamNumber = TeamNumberPage.getTeamNumberFromPage(teamNumberPage); - if (showPackage) { - packageText.setText("org.usfirst.frc.team"+teamNumber+".robot"); - if (teamNumberPage != null) { - teamNumberPage.registerChangeListener(new ChangeListener() { - @Override public void stateChanged(ChangeEvent e) { - String teamNumber = TeamNumberPage.getTeamNumberFromPage(teamNumberPage); - packageText.setText("org.usfirst.frc.team"+teamNumber+".robot"); - } - }); - } - } - info.registerChangeListener(new ChangeListener() { - @Override public void stateChanged(ChangeEvent e) { - projectNameText.setText(info.getName()); - if (!"".equals(info.getWorld())) { - worldText.setText(info.getWorld()); - } - } - }); - } - - /** - * Ensures that both text fields are set. - */ - private void dialogChanged() { - String projectName = getProjectName(); - - String packageString = ""; - if (showPackage) packageString = getPackage(); - - if (projectName.length() == 0) { - updateStatus("Project name must be specified"); - return; - } - if (showPackage && packageString.length() == 0) { - updateStatus("Package must be specified"); - return; - } - if (showPackage && !packageString.matches("^([a-zA-Z_]{1}[a-zA-Z0-9_]*(\\.[a-zA-Z_]{1}[a-zA-Z0-9_]*)*)$")) { - updateStatus("Must be valid java package"); - return; - } - - updateStatus(null); - } - - private void browse() { - FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); - dialog.setText("Pick a World to Simulate"); - dialog.setFileName(worldText.getText()); - dialog.setFilterNames(new String[] { "World Files", "All Files (*.*)" }); - dialog.setFilterExtensions(new String[] { "*.world", "*.*" }); - String result = dialog.open(); - if (result != null) { - worldText.setText(result); - } - } - - private void updateStatus(String message) { - setErrorMessage(message); - setPageComplete(message == null); - } - - public String getProjectName() { - return projectNameText.getText(); - } - - public String getPackage() { - return packageText.getText(); - } - - public ProjectType getProjectType() { - if (!showProjectTypes) return null; - else if (iterativeRobot.getSelection()) return types.get(ProjectType.ITERATIVE); - else if (sampleRobot.getSelection()) return types.get(ProjectType.SAMPLE); - else return types.get(ProjectType.COMMAND_BASED); - } - - public String getWorld() { - return worldText.getText().replace(System.getProperty("user.home"), "${user.home}"); - } - - public void setShowPackage(boolean bool) { - showPackage = bool; - } - - public void setShowProjectTypes(boolean bool) { - showProjectTypes = bool; - } - - public void setProjectTypes(Map types) { - showProjectTypes = true; - this.types = types; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ProjectComboField.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ProjectComboField.java deleted file mode 100644 index 82d7eafb86..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ProjectComboField.java +++ /dev/null @@ -1,56 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.wizards; - -import java.util.Arrays; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; - -public class ProjectComboField { - public static String NO_PROJECT = "No Project"; - - private Combo combo; - - public ProjectComboField(Composite composite, int config, IProjectFilter filter) { - combo = new Combo(composite, config); - - combo.add(NO_PROJECT); - combo.select(0); - IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - for (IProject project : projects) { - if (filter == null || filter.accept(project)) - combo.add(project.getName()); - } - } - - public void setProject(IProject project) { - if (project != null) - combo.select(Arrays.binarySearch(combo.getItems(), project.getName())); - else combo.select(0); - } - - public IProject getProject() { - return ResourcesPlugin.getWorkspace().getRoot().getProject(combo.getItem(combo.getSelectionIndex())); - } - - public boolean isValid() { - return combo.getSelectionIndex() != 0; - } - - public void setLayoutData(GridData gd) { - combo.setLayoutData(gd); - } - - public void addModifyListener(ModifyListener modifyListener) { - combo.addModifyListener(modifyListener); - } - - public void addSelectionListener(SelectionListener selectionListener) { - combo.addSelectionListener(selectionListener); - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ProjectCreationUtils.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ProjectCreationUtils.java deleted file mode 100644 index cc0fbbaf83..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ProjectCreationUtils.java +++ /dev/null @@ -1,209 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.wizards; - -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; -import java.util.Map.Entry; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Display; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -/** - * Utilities for creating a new project and files from templates. Uses - * IProjectCreator to provide hooks for generating the directory - * structure, initial files, initializing and finalizing the creation - * of the new project. - * - * @author Alex Henning - **/ -public class ProjectCreationUtils { - - /** - * Create a project using the given IProjectCreator. - * - * @param creator The creator that provides the necessary information - * to create the project. - * @return The newly created project. - */ - public static IProject createProject(IProjectCreator creator) { - IProject project = createBaseProject(creator.getName(), null); - - try { - creator.initialize(project); - for (String nature : creator.getNatures()) { - addNature(project, nature); - } - addToProjectStructure(project, creator); - addFilesToProject(project, creator); - creator.finalize(project); - } catch (CoreException e) { - WPILibCore.logError("Error creating project "+creator.getName(), e); - project = null; - } - - return project; - } - - private static IProject createBaseProject(String projectName, IPath location) { - IProject newProject = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - - if (!newProject.exists()) { - IPath projectLocation = location; - IProjectDescription desc = newProject.getWorkspace().newProjectDescription(newProject.getName()); - if (location != null && - ResourcesPlugin.getWorkspace().getRoot().getLocation().equals(location)) { - projectLocation = null; - } - desc.setLocation(projectLocation); - try { - newProject.create(desc, null); - if (!newProject.isOpen()) { - newProject.open(null); - } - } catch (CoreException e) { - WPILibCore.logError("Can't create new project.", e); - Display.getDefault().syncExec(new Runnable() { - @Override - public void run() { - MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "Error creating project! This may occur if a project of the same name with different case exists in the Workspace"); - } - }); - } - }else { - Display.getDefault().syncExec(new Runnable() { - @Override - public void run() { - MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "Error! A project of the same name already exists in the Workspace"); - } - }); - } - return newProject; - } - - private static void addNature(IProject project, String nature_id) throws CoreException { - if (!project.hasNature(nature_id)) { - IProjectDescription desc = project.getDescription(); - String[] prevNatures = desc.getNatureIds(); - String[] newNatures = new String[prevNatures.length + 1]; - System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); - newNatures[prevNatures.length] = nature_id; - desc.setNatureIds(newNatures); - - project.setDescription(desc, null); - } - } - - private static void addToProjectStructure(IProject project, IProjectCreator creator) throws CoreException { - String[] paths = creator.getProjectType().getFolders(creator.getPackageName()); - for (String path : paths) { - IFolder etcFolders = project.getFolder(path); - createFolder(etcFolders); - } - } - - private static void createFolder(IFolder folder) throws CoreException { - IContainer parent = folder.getParent(); - if (parent instanceof IFolder) { - createFolder((IFolder) parent); - } - if (!folder.exists()) { - folder.create(false, true, null); - } - folder.refreshLocal(IResource.DEPTH_INFINITE, null); - } - - private static void addFilesToProject(IProject project, IProjectCreator creator) throws CoreException { - Map files = creator.getProjectType().getFiles(creator.getPackageName()); - for (Entry e : files.entrySet()) { - try { - URL url = new URL(creator.getProjectType().getBaseURL(), e.getValue()); - createTemplateFile(project, e.getKey(), url, creator.getValues()); - } catch (MalformedURLException e1) { - WPILibCore.logError("Error adding file "+e.toString()+" to project.", e1); - } - } - } - - /** - * Create a file in the project from a template. Substituting as required. - * - * @param project The project to use create the file in. - * @param filepath The path of the created file. - * @param filesource The source of the template to use. - * @param vals The map of values to use for substitution. - * @throws CoreException - */ - public static void createTemplateFile(IProject project, String filepath, URL url, Map vals) throws CoreException { - IFile template = project.getFile(new Path(filepath)); - if (!template.exists()) { - InputStream in = openTemplateContentStream(project, url, vals); - template.create(in, true, null); - } - } - - private static InputStream openTemplateContentStream(IProject project, URL url, Map vals) { - //http://eclipse-javacc.cvs.sourceforge.net/viewvc/eclipse-javacc/sf.eclipse.javacc/src-plugin/sf/eclipse/javacc/wizards/JJNewWizard.java?view=markup - //eclipse plugin distributing template files - try { - return makeTemplateInputStream(url.openStream(), vals); - } catch (final MalformedURLException e) { - WPILibCore.logError("Malformed URL "+url, e); - } catch (final IOException e) { - WPILibCore.logError("Issue opening input stream.", e); - } - return null; - } - - private static InputStream makeTemplateInputStream(InputStream stream, Map vals) { - String str; - try { - str = readInput(stream); - stream.close(); - } catch (final IOException e) { - WPILibCore.logError("Error reading template.", e); - return null; - } - - // Instantiate template - for (Entry e : vals.entrySet()) - str = str.replace(e.getKey(), e.getValue()); - - return new ByteArrayInputStream(str.getBytes()); - } - - private static String readInput(InputStream stream) { - StringBuffer buffer = new StringBuffer(); - try { - InputStreamReader isr = new InputStreamReader(stream); - Reader in = new BufferedReader(isr); - int ch; - while ((ch = in.read()) > -1) { - buffer.append((char)ch); - } - in.close(); - return buffer.toString(); - } catch (IOException e) { - WPILibCore.logError("Error reading input.", e); - return null; - } - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ProjectType.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ProjectType.java deleted file mode 100644 index 794095be03..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/ProjectType.java +++ /dev/null @@ -1,14 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.wizards; - -import java.net.URL; -import java.util.Map; - -public interface ProjectType { - String SAMPLE = "SAMPLE"; - String ITERATIVE = "ITERATIVE"; - String COMMAND_BASED = "COMMAND_BASED"; - - String[] getFolders(String packageName); - Map getFiles(String packageName); - URL getBaseURL(); -} \ No newline at end of file diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/Tag.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/Tag.java deleted file mode 100644 index 221a27a430..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/Tag.java +++ /dev/null @@ -1,19 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.wizards; - - -public class Tag { - private String name, description; - - public Tag(String name, String description) { - this.name = name; - this.description = description; - } - - public String getName() { - return name; - } - - public String getContent() { - return "

"+name+"

"+description+"

"; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/TeamNumberPage.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/TeamNumberPage.java deleted file mode 100644 index 5345f48a36..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.core/src/main/java/edu/wpi/first/wpilib/plugins/core/wizards/TeamNumberPage.java +++ /dev/null @@ -1,111 +0,0 @@ -package edu.wpi.first.wpilib.plugins.core.wizards; - -import javax.swing.event.ChangeListener; - -import org.eclipse.jface.dialogs.IDialogPage; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; - -public class TeamNumberPage extends WizardPage { - private Text teamNumberText; - private ChangeListener listener; - - /** - * Constructor for SampleNewWizardPage. - * - * @param pageName - */ - public TeamNumberPage(ISelection selection) { - super("wizardPage"); - setTitle("Set Team Number"); - setDescription("This page lets you set your team number so that code can be loaded onto the right robot."); - } - - /** - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite container = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 2; - layout.verticalSpacing = 9; - Label label = new Label(container, SWT.NULL); - label.setText("Team &Number:"); - - teamNumberText = new Text(container, SWT.BORDER | SWT.SINGLE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - teamNumberText.setLayoutData(gd); - teamNumberText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - label = new Label(container, SWT.NULL); - label.setText("Team number is a global setting that can be changed in Window > Preferences > WPILib Preferences > Team Number"); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - label.setLayoutData(gd); - - initialize(); - dialogChanged(); - setControl(container); - } - - /** - * Tests if the current workbench selection is a suitable container to use. - */ - private void initialize() { - String teamNumber = Integer.toString(WPILibCore.getDefault().getTeamNumber(null)); - teamNumberText.setText(teamNumber); - } - - /** - * Ensures that both text fields are set. - */ - private void dialogChanged() { - String teamNumber = getTeamNumber(); - if (listener != null) listener.stateChanged(null); - if (!teamNumber.matches("^([1-9][0-9]*)$")) { - updateStatus("Team number must be a valid integer without leading zeroes."); - return; - } - updateStatus(null); - } - - private void updateStatus(String message) { - setErrorMessage(message); - setPageComplete(message == null); - } - - public String getTeamNumber() { - return teamNumberText.getText(); - } - - public static boolean needsTeamNumberPage() { - return WPILibCore.getDefault().getTeamNumber(null) == 0; - } - - public static String getTeamNumberFromPage(TeamNumberPage teamNumberPage) { - if (teamNumberPage != null) { - return teamNumberPage.getTeamNumber(); - } else { - return Integer.toString(WPILibCore.getDefault().getTeamNumber(null)); - } - } - - public void registerChangeListener(ChangeListener changeListener) { - listener = changeListener; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp.feature/build.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp.feature/build.properties deleted file mode 100644 index 64f93a9f0b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp.feature/build.properties +++ /dev/null @@ -1 +0,0 @@ -bin.includes = feature.xml diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp.feature/feature.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp.feature/feature.xml deleted file mode 100644 index 620fc42777..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp.feature/feature.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - FRC Robot C++ Program Development Environment. - - - - * Copyright (c) 2015 FIRST and WPI -* All rights reserved. - - - - * Copyright (c) 2015 FIRST and WPI -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or -* without modification, are permitted provided that the following -* conditions are met: -* Redistributions of source code must retain the above -* copyright notice, this list of conditions and the following -* disclaimer. Redistributions in binary form must reproduce the -* above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided -* with the distribution. Neither the name of the FIRST nor the -* names of its contributors may be used to endorse or promote -* products derived from this software without specific prior -* written permission. -* -* THIS SOFTWARE IS PROVIDED BY FIRST AND CONTRIBUTORS``AS IS'' -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT -* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -* EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp.feature/pom.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp.feature/pom.xml deleted file mode 100644 index ad3d876540..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp.feature/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - edu.wpi.first.wpilib.plugins.cpp.feature - eclipse-feature - - - edu.wpi.first.wpilib.plugins - edu.wpi.first.wpilib.plugins - 0.1.0.qualifier - .. - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/META-INF/MANIFEST.MF b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/META-INF/MANIFEST.MF deleted file mode 100644 index 7cff0305a8..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,34 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: WPILib_CPP_Robot_Development -Bundle-SymbolicName: edu.wpi.first.wpilib.plugins.cpp;singleton:=true -Bundle-Version: 0.1.0.qualifier -Bundle-Activator: edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - org.eclipse.core.resources;bundle-version="3.8.1", - edu.wpi.first.wpilib.plugins.core;bundle-version="0.1.0", - org.eclipse.cdt;bundle-version="8.1.0", - org.eclipse.cdt.build.crossgcc;bundle-version="1.1.0", - org.eclipse.cdt.core;bundle-version="5.4.0", - org.eclipse.cdt.ui;bundle-version="5.4.0", - org.eclipse.cdt.managedbuilder.core;bundle-version="8.1.0", - org.eclipse.cdt.managedbuilder.gnu.ui;bundle-version="8.1.0", - org.eclipse.cdt.managedbuilder.ui;bundle-version="8.1.0", - org.eclipse.ui.editors;bundle-version="3.8.0", - org.eclipse.ui.ide;bundle-version="3.8.1", - org.eclipse.debug.core;bundle-version="3.7.100", - org.eclipse.debug.ui;bundle-version="3.8.1", - org.eclipse.rse;bundle-version="3.1.0", - org.eclipse.rse.core;bundle-version="3.1.1", - org.eclipse.cdt.debug.core;bundle-version="7.2.0", - org.eclipse.cdt.debug.ui;bundle-version="7.2.0", - org.eclipse.cdt.launch;bundle-version="7.1.0", - org.eclipse.cdt.launch.remote;bundle-version="2.4.0", - org.eclipse.cdt.debug.mi.core;bundle-version="7.2.0", - org.eclipse.core.variables -Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 -Export-Package: edu.wpi.first.wpilib.plugins.cpp, - edu.wpi.first.wpilib.plugins.cpp.preferences -Bundle-Vendor: WPI & FIRST diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/build.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/build.properties deleted file mode 100644 index 85c3a2e7ac..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/build.properties +++ /dev/null @@ -1,9 +0,0 @@ -source.. = src/main/java/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - resources/ -src.includes = resources/**,\ - src/ -bin.excludes = resources/configuration.properties diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/plugin.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/plugin.xml deleted file mode 100644 index 03e4240516..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/plugin.xml +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/pom.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/pom.xml deleted file mode 100644 index 41d996c84a..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/pom.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - 4.0.0 - edu.wpi.first.wpilib.plugins.cpp - eclipse-plugin - - edu.wpi.first.wpilib.plugins - edu.wpi.first.wpilib.plugins - 0.1.0.qualifier - .. - - - DEVELOPMENT - ${project.build.directory}/cpp-zip - - - - - . - - resources/configuration.properties - - true - - - - - - maven-resources-plugin - 2.6 - - - copy-ant-resources-to-cpp-zip - generate-sources - - copy-resources - - - ${cpp-zip} - - - src/main/resources/cpp-zip - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.8 - - - - fetch-cpp-zip-dependencies - compile - - copy - - - - - edu.wpi.first.wpilib.cmake - cpp-root - 1.0.0 - zip - cpp-root.jar - - - edu.wpi.first.wpilibc.simulation - WPILibCSim - 0.1.0 - zip - sim-include.zip - - - ${project.build.directory} - false - true - true - - - - - - fetch-sim-jar-zip-dependencies - compile - - copy - - - ${cpp-zip}/sim/lib - false - true - - - - net.java.jinput - jinput-platform - 2.0.5 - natives-linux - jar - - - - edu.wpi.first.wpilibj.simulation - SimDS - 0.1.0-SNAPSHOT - SimDS.jar - ${cpp-zip}/sim/tools - - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.7 - - - - - set-version-info - - run - - process-sources - - - - - - - - - - - true - - - - - - unzip-cpp-includes - compile - - run - - - - - - - - - - - - - - - - unzip-jinput-libs - compile - - run - - - - - - - - - - - generate-cpp-zip - compile - - run - - - - - - - - - - - - - - edu.wpi.first.wpilib.cmake - cpp-root - 1.0.0 - zip - - - edu.wpi.first.wpilibc.simulation - WPILibCSim - 0.1.0 - zip - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/configuration.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/configuration.properties deleted file mode 100644 index cbfaca2ede..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/configuration.properties +++ /dev/null @@ -1,2 +0,0 @@ -timestamp=${timestamp} -version=${version} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/Button.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/Button.png deleted file mode 100644 index f6584ec823..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/Button.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/Command.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/Command.png deleted file mode 100644 index c3d9c2d991..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/Command.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/CommandGroup.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/CommandGroup.png deleted file mode 100644 index 1a027c85fd..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/CommandGroup.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/Gazebo.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/Gazebo.png deleted file mode 100644 index 3ad1d74440..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/Gazebo.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/PIDSubsystem.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/PIDSubsystem.png deleted file mode 100644 index 766fca1c3b..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/PIDSubsystem.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/Subsystem.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/Subsystem.png deleted file mode 100644 index 35ee694c8c..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/Subsystem.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/sample.gif b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/sample.gif deleted file mode 100644 index 34fb3c9d8c..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/sample.gif and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/wpi.ico b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/wpi.ico deleted file mode 100644 index a6de9245f9..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/icons/wpi.ico and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/.cproject b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/.cproject deleted file mode 100644 index de2f64aa57..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/.cproject +++ /dev/null @@ -1,284 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/build.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/build.properties deleted file mode 100644 index bbc581204b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/build.properties +++ /dev/null @@ -1,11 +0,0 @@ -# Build information -out=FRCUserProgram -src.dir=src -build.dir=build -out.exe=Debug/${out} - -# Simulation -simulation.world.file=$world - -# Use the current C++ library by default -cpp-version=current diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/build.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/build.xml deleted file mode 100644 index 82e7940194..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/build.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Command.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Command.cpp deleted file mode 100644 index 474040ab1b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Command.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "$classname.h" - -$classname::$classname() -{ - // Use Requires() here to declare subsystem dependencies - // eg. Requires(chassis); -} - -// Called just before this Command runs the first time -void $classname::Initialize() -{ - -} - -// Called repeatedly when this Command is scheduled to run -void $classname::Execute() -{ - -} - -// Make this return true when this Command no longer needs to run execute() -bool $classname::IsFinished() -{ - return false; -} - -// Called once after isFinished returns true -void $classname::End() -{ - -} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void $classname::Interrupted() -{ - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Command.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Command.h deleted file mode 100644 index 1cb0db42cb..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Command.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef $classname_H -#define $classname_H - -#include "../CommandBase.h" -#include "WPILib.h" - -class $classname: public CommandBase -{ -public: - $classname(); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandBase.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandBase.cpp deleted file mode 100644 index ebf342bbcf..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandBase.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "CommandBase.h" -#include "Subsystems/ExampleSubsystem.h" -#include "Commands/Scheduler.h" - -// Initialize a single static instance of all of your subsystems to NULL -std::unique_ptr CommandBase::examplesubsystem; -std::unique_ptr CommandBase::oi; - -CommandBase::CommandBase(const std::string &name) : - Command(name) -{ -} - -CommandBase::CommandBase() : - Command() -{ - -} - -void CommandBase::init() -{ - // Create a single static instance of all of your subsystems. The following - // line should be repeated for each subsystem in the project. - examplesubsystem.reset(new ExampleSubsystem()); - - oi.reset(new OI()); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandBase.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandBase.h deleted file mode 100644 index d4900a3fe1..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandBase.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef COMMAND_BASE_H -#define COMMAND_BASE_H - -#include -#include "Commands/Command.h" -#include "Subsystems/ExampleSubsystem.h" -#include "OI.h" -#include "WPILib.h" - -/** - * The base for all commands. All atomic commands should subclass CommandBase. - * CommandBase stores creates and stores each control system. To access a - * subsystem elsewhere in your code in your code use CommandBase.examplesubsystem - */ -class CommandBase: public Command -{ -public: - CommandBase(const std::string &name); - CommandBase(); - static void init(); - // Create a single static instance of all of your subsystems - static std::unique_ptr examplesubsystem; - static std::unique_ptr oi; -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandGroup.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandGroup.cpp deleted file mode 100644 index 664b44bdeb..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandGroup.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "$classname.h" - -$classname::$classname() -{ - // Add Commands here: - // e.g. AddSequential(new Command1()); - // AddSequential(new Command2()); - // these will run in order. - - // To run multiple commands at the same time, - // use AddParallel() - // e.g. AddParallel(new Command1()); - // AddSequential(new Command2()); - // Command1 and Command2 will run in parallel. - - // A command group will require all of the subsystems that each member - // would require. - // e.g. if Command1 requires chassis, and Command2 requires arm, - // a CommandGroup containing them would require both the chassis and the - // arm. -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandGroup.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandGroup.h deleted file mode 100644 index dfa979c266..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/CommandGroup.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef $classname_H -#define $classname_H - -#include "Commands/CommandGroup.h" -#include "WPILib.h" - -class $classname: public CommandGroup -{ -public: - $classname(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleCommand.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleCommand.cpp deleted file mode 100644 index e239f026fa..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleCommand.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "ExampleCommand.h" - -ExampleCommand::ExampleCommand() -{ - // Use Requires() here to declare subsystem dependencies - // eg. Requires(chassis); -} - -// Called just before this Command runs the first time -void ExampleCommand::Initialize() -{ - -} - -// Called repeatedly when this Command is scheduled to run -void ExampleCommand::Execute() -{ - -} - -// Make this return true when this Command no longer needs to run execute() -bool ExampleCommand::IsFinished() -{ - return false; -} - -// Called once after isFinished returns true -void ExampleCommand::End() -{ - -} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void ExampleCommand::Interrupted() -{ - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleCommand.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleCommand.h deleted file mode 100644 index 8e0b3d1b73..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleCommand.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef EXAMPLE_COMMAND_H -#define EXAMPLE_COMMAND_H - -#include "../CommandBase.h" -#include "WPILib.h" - -class ExampleCommand: public CommandBase -{ -public: - ExampleCommand(); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleSubsystem.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleSubsystem.cpp deleted file mode 100644 index 20518caa23..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleSubsystem.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "ExampleSubsystem.h" -#include "../RobotMap.h" - -ExampleSubsystem::ExampleSubsystem() : - Subsystem("ExampleSubsystem") -{ - -} - -void ExampleSubsystem::InitDefaultCommand() -{ - // Set the default command for a subsystem here. - //SetDefaultCommand(new MySpecialCommand()); -} - -// Put methods for controlling this subsystem -// here. Call these from Commands. - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleSubsystem.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleSubsystem.h deleted file mode 100644 index 06149d0ab8..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/ExampleSubsystem.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef EXAMPLE_SUBSYSTEM_H -#define EXAMPLE_SUBSYSTEM_H - -#include "Commands/Subsystem.h" -#include "WPILib.h" - -class ExampleSubsystem: public Subsystem -{ -private: - // It's desirable that everything possible under private except - // for methods that implement subsystem capabilities -public: - ExampleSubsystem(); - void InitDefaultCommand(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/OI.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/OI.cpp deleted file mode 100644 index 7c0a7c8f02..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/OI.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "OI.h" - -OI::OI() -{ - // Process operator interface input here. -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/OI.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/OI.h deleted file mode 100644 index 70855a103f..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/OI.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef OI_H -#define OI_H - -#include "WPILib.h" - -class OI -{ -private: - -public: - OI(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/PIDSubsystem.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/PIDSubsystem.cpp deleted file mode 100644 index 01dcf6a649..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/PIDSubsystem.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "$classname.h" -#include "../RobotMap.h" -#include "SmartDashboard/SmartDashboard.h" -#include "LiveWindow/LiveWindow.h" - -$classname::$classname() : - PIDSubsystem("$classname", 1.0, 0.0, 0.0) -{ - // Use these to get going: - // SetSetpoint() - Sets where the PID controller should move the system - // to - // Enable() - Enables the PID controller. -} - -double $classname::ReturnPIDInput() -{ - // Return your input value for the PID loop - // e.g. a sensor, like a potentiometer: - // yourPot->SetAverageVoltage() / kYourMaxVoltage; -} - -void $classname::UsePIDOutput(double output) -{ - // Use output to drive your system, like a motor - // e.g. yourMotor->Set(output); -} - -void $classname::InitDefaultCommand() -{ - // Set the default command for a subsystem here. - //setDefaultCommand(new MySpecialCommand()); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/PIDSubsystem.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/PIDSubsystem.h deleted file mode 100644 index ffb573a3de..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/PIDSubsystem.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef $classname_H -#define $classname_H - -#include "Commands/PIDSubsystem.h" -#include "WPILib.h" - -class $classname: public PIDSubsystem -{ -public: - $classname(); - double ReturnPIDInput(); - void UsePIDOutput(double output); - void InitDefaultCommand(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Robot.cpp deleted file mode 100644 index a41f36ab1e..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Robot.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "WPILib.h" -#include "Commands/Command.h" -#include "Commands/ExampleCommand.h" -#include "CommandBase.h" - -class Robot: public IterativeRobot -{ -private: - std::unique_ptr autonomousCommand; - - void RobotInit() - { - CommandBase::init(); - autonomousCommand.reset(new ExampleCommand()); - } - - /** - * This function is called once each time the robot enters Disabled mode. - * You can use it to reset any subsystem information you want to clear when - * the robot is disabled. - */ - void DisabledInit() - { - } - - void DisabledPeriodic() - { - Scheduler::GetInstance()->Run(); - } - - void AutonomousInit() - { - if (autonomousCommand != NULL) - autonomousCommand->Start(); - } - - void AutonomousPeriodic() - { - Scheduler::GetInstance()->Run(); - } - - void TeleopInit() - { - // This makes sure that the autonomous stops running when - // teleop starts running. If you want the autonomous to - // continue until interrupted by another command, remove - // this line or comment it out. - if (autonomousCommand != NULL) - autonomousCommand->Cancel(); - } - - void TeleopPeriodic() - { - Scheduler::GetInstance()->Run(); - } - - void TestPeriodic() - { - LiveWindow::GetInstance()->Run(); - } -}; - -START_ROBOT_CLASS(Robot) - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/RobotMap.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/RobotMap.h deleted file mode 100644 index 54742835fc..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/RobotMap.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef ROBOTMAP_H -#define ROBOTMAP_H - -#include "WPILib.h" - -/** - * The RobotMap is a mapping from the ports sensors and actuators are wired into - * to a variable name. This provides flexibility changing wiring, makes checking - * the wiring easier and significantly reduces the number of magic numbers - * floating around. - */ - -// For example to map the left and right motors, you could define the -// following variables to use with your drivetrain subsystem. -//const int LEFTMOTOR = 1; -//const int RIGHTMOTOR = 2; - -// If you are using multiple modules, make sure to define both the port -// number and the module. For example you with a rangefinder: -//const int RANGE_FINDER_PORT = 1; -//const int RANGE_FINDER_MODULE = 1; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Subsystem.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Subsystem.cpp deleted file mode 100644 index 0145f08d6f..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Subsystem.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "$classname.h" -#include "../RobotMap.h" - -$classname::$classname() : - Subsystem("ExampleSubsystem") -{ - -} - -void $classname::InitDefaultCommand() -{ - // Set the default command for a subsystem here. - //SetDefaultCommand(new MySpecialCommand()); -} - -// Put methods for controlling this subsystem -// here. Call these from Commands. diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Subsystem.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Subsystem.h deleted file mode 100644 index fbc88af275..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Subsystem.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef $classname_H -#define $classname_H - -#include "Commands/Subsystem.h" -#include "WPILib.h" - -class $classname: public Subsystem -{ -private: - // It's desirable that everything possible under private except - // for methods that implement subsystem capabilities -public: - $classname(); - void InitDefaultCommand(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.cpp deleted file mode 100644 index 0425fa10c9..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "$classname.h" - -$classname::$classname() -{ - -} - -bool $classname::Get() -{ - return false; -} - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.h deleted file mode 100644 index e2a666e0ba..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/command-based/Trigger.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef $classname_H -#define $classname_H - -#include "WPILib.h" - -class $classname: public Trigger -{ -public: - $classname(); - bool Get(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/2015Vision/Color_src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/2015Vision/Color_src/Robot.cpp deleted file mode 100644 index 45751e4c85..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/2015Vision/Color_src/Robot.cpp +++ /dev/null @@ -1,237 +0,0 @@ -#include "WPILib.h" -#include -#include - -/** - * Example of finding yellow totes based on color. - * This example utilizes an image file, which you need to copy to the roboRIO - * To use a camera you will have to integrate the appropriate camera details with this example. - * To use a USB camera instead, see the IntermediateVision example for details - * on using the USB camera. To use an Axis Camera, see the AxisCamera example for details on - * using an Axis Camera. - * - * Sample images can be found here: http://wp.wpi.edu/wpilib/2015/01/16/sample-images-for-vision-projects/ - */ -class VisionColor2015Sample : public SampleRobot -{ - //A structure to hold measurements of a particle - struct ParticleReport { - double PercentAreaToImageArea; - double Area; - double ConvexHullArea; - double BoundingRectLeft; - double BoundingRectTop; - double BoundingRectRight; - double BoundingRectBottom; - }; - - //Structure to represent the scores for the various tests used for target identification - struct Scores { - double Trapezoid; - double LongAspect; - double ShortAspect; - double AreaToConvexHullArea; - }; - - //Images - Image *frame; - Image *binaryFrame; - int imaqError; - - //Constants - Range TOTE_HUE_RANGE = {24, 49}; //Default hue range for yellow tote - Range TOTE_SAT_RANGE = {67, 255}; //Default saturation range for yellow tote - Range TOTE_VAL_RANGE = {49, 255}; //Default value range for yellow tote - double AREA_MINIMUM = 2; //Default Area minimum for particle as a percentage of total image area - double LONG_RATIO = 2.22; //Tote long side = 26.9 / Tote height = 12.1 = 2.22 - double SHORT_RATIO = 1.4; //Tote short side = 16.9 / Tote height = 12.1 = 1.4 - double SCORE_MIN = 75.0; //Minimum score to be considered a tote - double VIEW_ANGLE = 49.4; //View angle fo camera, set to Axis m1011 by default, 64 for m1013, 51.7 for 206, 52 for HD3000 square, 60 for HD3000 640x480 - ParticleFilterCriteria2 criteria[1]; - ParticleFilterOptions2 filterOptions = {0,0,1,1}; - Scores scores; - - -public: - void RobotInit() override { - // create images - frame = imaqCreateImage(IMAQ_IMAGE_RGB, 0); - binaryFrame = imaqCreateImage(IMAQ_IMAGE_U8, 0); - - //Put default values to SmartDashboard so fields will appear - SmartDashboard::PutNumber("Tote hue min", TOTE_HUE_RANGE.minValue); - SmartDashboard::PutNumber("Tote hue max", TOTE_HUE_RANGE.maxValue); - SmartDashboard::PutNumber("Tote sat min", TOTE_SAT_RANGE.minValue); - SmartDashboard::PutNumber("Tote sat max", TOTE_SAT_RANGE.maxValue); - SmartDashboard::PutNumber("Tote val min", TOTE_VAL_RANGE.minValue); - SmartDashboard::PutNumber("Tote val max", TOTE_VAL_RANGE.maxValue); - SmartDashboard::PutNumber("Area min %", AREA_MINIMUM); - } - - void Autonomous() override { - while (IsAutonomous() && IsEnabled()) - { - //read file in from disk. For this example to run you need to copy image20.jpg from the SampleImages folder to the - //directory shown below using FTP or SFTP: http://wpilib.screenstepslive.com/s/4485/m/24166/l/282299-roborio-ftp - imaqError = imaqReadFile(frame, "//home//lvuser//SampleImages//image20.jpg", NULL, NULL); - - //Update threshold values from SmartDashboard. For performance reasons it is recommended to remove this after calibration is finished. - TOTE_HUE_RANGE.minValue = SmartDashboard::GetNumber("Tote hue min", TOTE_HUE_RANGE.minValue); - TOTE_HUE_RANGE.maxValue = SmartDashboard::GetNumber("Tote hue max", TOTE_HUE_RANGE.maxValue); - TOTE_SAT_RANGE.minValue = SmartDashboard::GetNumber("Tote sat min", TOTE_SAT_RANGE.minValue); - TOTE_SAT_RANGE.maxValue = SmartDashboard::GetNumber("Tote sat max", TOTE_SAT_RANGE.maxValue); - TOTE_VAL_RANGE.minValue = SmartDashboard::GetNumber("Tote val min", TOTE_VAL_RANGE.minValue); - TOTE_VAL_RANGE.maxValue = SmartDashboard::GetNumber("Tote val max", TOTE_VAL_RANGE.maxValue); - - //Threshold the image looking for yellow (tote color) - imaqError = imaqColorThreshold(binaryFrame, frame, 255, IMAQ_HSV, &TOTE_HUE_RANGE, &TOTE_SAT_RANGE, &TOTE_VAL_RANGE); - - //Send particle count to dashboard - int numParticles = 0; - imaqError = imaqCountParticles(binaryFrame, 1, &numParticles); - SmartDashboard::PutNumber("Masked particles", numParticles); - - //Send masked image to dashboard to assist in tweaking mask. - SendToDashboard(binaryFrame, imaqError); - - //filter out small particles - float areaMin = SmartDashboard::GetNumber("Area min %", AREA_MINIMUM); - criteria[0] = {IMAQ_MT_AREA_BY_IMAGE_AREA, areaMin, 100, false, false}; - imaqError = imaqParticleFilter4(binaryFrame, binaryFrame, criteria, 1, &filterOptions, NULL, NULL); - - //Send particle count after filtering to dashboard - imaqError = imaqCountParticles(binaryFrame, 1, &numParticles); - SmartDashboard::PutNumber("Filtered particles", numParticles); - - if(numParticles > 0) - { - //Measure particles and sort by particle size - std::vector particles; - for(int particleIndex = 0; particleIndex < numParticles; particleIndex++) - { - ParticleReport par; - imaqMeasureParticle(binaryFrame, particleIndex, 0, IMAQ_MT_AREA_BY_IMAGE_AREA, &(par.PercentAreaToImageArea)); - imaqMeasureParticle(binaryFrame, particleIndex, 0, IMAQ_MT_AREA, &(par.Area)); - imaqMeasureParticle(binaryFrame, particleIndex, 0, IMAQ_MT_CONVEX_HULL_AREA, &(par.ConvexHullArea)); - imaqMeasureParticle(binaryFrame, particleIndex, 0, IMAQ_MT_BOUNDING_RECT_TOP, &(par.BoundingRectTop)); - imaqMeasureParticle(binaryFrame, particleIndex, 0, IMAQ_MT_BOUNDING_RECT_LEFT, &(par.BoundingRectLeft)); - imaqMeasureParticle(binaryFrame, particleIndex, 0, IMAQ_MT_BOUNDING_RECT_BOTTOM, &(par.BoundingRectBottom)); - imaqMeasureParticle(binaryFrame, particleIndex, 0, IMAQ_MT_BOUNDING_RECT_RIGHT, &(par.BoundingRectRight)); - particles.push_back(par); - } - sort(particles.begin(), particles.end(), CompareParticleSizes); - - //This example only scores the largest particle. Extending to score all particles and choosing the desired one is left as an exercise - //for the reader. Note that the long and short side scores expect a single tote and will not work for a stack of 2 or more totes. - //Modification of the code to accommodate 2 or more stacked totes is left as an exercise for the reader. - scores.Trapezoid = TrapezoidScore(particles.at(0)); - SmartDashboard::PutNumber("Trapezoid", scores.Trapezoid); - scores.LongAspect = LongSideScore(particles.at(0)); - SmartDashboard::PutNumber("Long Aspect", scores.LongAspect); - scores.ShortAspect = ShortSideScore(particles.at(0)); - SmartDashboard::PutNumber("Short Aspect", scores.ShortAspect); - scores.AreaToConvexHullArea = ConvexHullAreaScore(particles.at(0)); - SmartDashboard::PutNumber("Convex Hull Area", scores.AreaToConvexHullArea); - bool isTote = scores.Trapezoid > SCORE_MIN && (scores.LongAspect > SCORE_MIN || scores.ShortAspect > SCORE_MIN) && scores.AreaToConvexHullArea > SCORE_MIN; - bool isLong = scores.LongAspect > scores.ShortAspect; - - //Send distance and tote status to dashboard. The bounding rect, particularly the horizontal center (left - right) may be useful for rotating/driving towards a tote - SmartDashboard::PutBoolean("IsTote", isTote); - SmartDashboard::PutNumber("Distance", computeDistance(binaryFrame, particles.at(0), isLong)); - } else { - SmartDashboard::PutBoolean("IsTote", false); - } - - Wait(0.005); // wait for a motor update time - } - } - - void OperatorControl() override { - while(IsOperatorControl() && IsEnabled()) { - Wait(0.005); // wait for a motor update time - } - } - - - //Send image to dashboard if IMAQ has not thrown an error - void SendToDashboard(Image *image, int error) - { - if(error < ERR_SUCCESS) { - DriverStation::ReportError("Send To Dashboard error: " + std::to_string((long)imaqError) + "\n"); - } else { - CameraServer::GetInstance()->SetImage(image); - } - } - - //Comparator function for sorting particles. Returns true if particle 1 is larger - static bool CompareParticleSizes(ParticleReport particle1, ParticleReport particle2) - { - //we want descending sort order - return particle1.PercentAreaToImageArea > particle2.PercentAreaToImageArea; - } - - /** - * Converts a ratio with ideal value of 1 to a score. The resulting function is piecewise - * linear going from (0,0) to (1,100) to (2,0) and is 0 for all inputs outside the range 0-2 - */ - double ratioToScore(double ratio) - { - return (fmax(0, fmin(100*(1-fabs(1-ratio)), 100))); - } - - /** - * Method to score convex hull area. This scores how "complete" the particle is. Particles with large holes will score worse than a filled in shape - */ - double ConvexHullAreaScore(ParticleReport report) - { - return ratioToScore((report.Area/report.ConvexHullArea)*1.18); - } - - /** - * Method to score if the particle appears to be a trapezoid. Compares the convex hull (filled in) area to the area of the bounding box. - * The expectation is that the convex hull area is about 95.4% of the bounding box area for an ideal tote. - */ - double TrapezoidScore(ParticleReport report) - { - return ratioToScore(report.ConvexHullArea/((report.BoundingRectRight-report.BoundingRectLeft)*(report.BoundingRectBottom-report.BoundingRectTop)*.954)); - } - - /** - * Method to score if the aspect ratio of the particle appears to match the long side of a tote. - */ - double LongSideScore(ParticleReport report) - { - return ratioToScore(((report.BoundingRectRight-report.BoundingRectLeft)/(report.BoundingRectBottom-report.BoundingRectTop))/LONG_RATIO); - } - - /** - * Method to score if the aspect ratio of the particle appears to match the short side of a tote. - */ - double ShortSideScore(ParticleReport report){ - return ratioToScore(((report.BoundingRectRight-report.BoundingRectLeft)/(report.BoundingRectBottom-report.BoundingRectTop))/SHORT_RATIO); - } - - /** - * Computes the estimated distance to a target using the width of the particle in the image. For more information and graphics - * showing the math behind this approach see the Vision Processing section of the ScreenStepsLive documentation. - * - * @param image The image to use for measuring the particle estimated rectangle - * @param report The Particle Analysis Report for the particle - * @param isLong Boolean indicating if the target is believed to be the long side of a tote - * @return The estimated distance to the target in feet. - */ - double computeDistance (Image *image, ParticleReport report, bool isLong) { - double normalizedWidth, targetWidth; - int xRes, yRes; - - imaqGetImageSize(image, &xRes, &yRes); - normalizedWidth = 2*(report.BoundingRectRight - report.BoundingRectLeft)/xRes; - SmartDashboard::PutNumber("Width", normalizedWidth); - targetWidth = isLong ? 26.9 : 16.9; - - return targetWidth/(normalizedWidth*12*tan(VIEW_ANGLE*M_PI/(180*2))); - } -}; - -START_ROBOT_CLASS(VisionColor2015Sample) - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/2015Vision/Retro_src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/2015Vision/Retro_src/Robot.cpp deleted file mode 100644 index 00642a109f..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/2015Vision/Retro_src/Robot.cpp +++ /dev/null @@ -1,210 +0,0 @@ -#include "WPILib.h" -#include -#include - -/** - * Example of finding yellow totes based on retroreflective target. - * This example utilizes an image file, which you need to copy to the roboRIO - * To use a camera you will have to integrate the appropriate camera details with this example. - * To use a USB camera instead, see the IntermediateVision example for details - * on using the USB camera. To use an Axis Camera, see the AxisCamera example for details on - * using an Axis Camera. - * - * Sample images can be found here: http://wp.wpi.edu/wpilib/2015/01/16/sample-images-for-vision-projects/ - */ -class VisionRetro2015Sample : public SampleRobot -{ - //A structure to hold measurements of a particle - struct ParticleReport { - double PercentAreaToImageArea; - double Area; - double BoundingRectLeft; - double BoundingRectTop; - double BoundingRectRight; - double BoundingRectBottom; - }; - - //Structure to represent the scores for the various tests used for target identification - struct Scores { - double Area; - double Aspect; - }; - - //Images - Image *frame; - Image *binaryFrame; - int imaqError; - - //Constants - Range RING_HUE_RANGE = {101, 64}; //Default hue range for ring light - Range RING_SAT_RANGE = {88, 255}; //Default saturation range for ring light - Range RING_VAL_RANGE = {134, 255}; //Default value range for ring light - double AREA_MINIMUM = 0.5; //Default Area minimum for particle as a percentage of total image area - double LONG_RATIO = 2.22; //Tote long side = 26.9 / Tote height = 12.1 = 2.22 - double SHORT_RATIO = 1.4; //Tote short side = 16.9 / Tote height = 12.1 = 1.4 - double SCORE_MIN = 75.0; //Minimum score to be considered a tote - double VIEW_ANGLE = 49.4; //View angle fo camera, set to Axis m1011 by default, 64 for m1013, 51.7 for 206, 52 for HD3000 square, 60 for HD3000 640x480 - ParticleFilterCriteria2 criteria[1]; - ParticleFilterOptions2 filterOptions = {0,0,1,1}; - Scores scores; - - -public: - void RobotInit() override { - // create images - frame = imaqCreateImage(IMAQ_IMAGE_RGB, 0); - binaryFrame = imaqCreateImage(IMAQ_IMAGE_U8, 0); - - //Put default values to SmartDashboard so fields will appear - SmartDashboard::PutNumber("Tote hue min", RING_HUE_RANGE.minValue); - SmartDashboard::PutNumber("Tote hue max", RING_HUE_RANGE.maxValue); - SmartDashboard::PutNumber("Tote sat min", RING_SAT_RANGE.minValue); - SmartDashboard::PutNumber("Tote sat max", RING_SAT_RANGE.maxValue); - SmartDashboard::PutNumber("Tote val min", RING_VAL_RANGE.minValue); - SmartDashboard::PutNumber("Tote val max", RING_VAL_RANGE.maxValue); - SmartDashboard::PutNumber("Area min %", AREA_MINIMUM); - } - - void Autonomous() override { - while (IsAutonomous() && IsEnabled()) - { - //read file in from disk. For this example to run you need to copy image.jpg from the SampleImages folder to the - //directory shown below using FTP or SFTP: http://wpilib.screenstepslive.com/s/4485/m/24166/l/282299-roborio-ftp - imaqError = imaqReadFile(frame, "//home//lvuser//SampleImages//image.jpg", NULL, NULL); - - //Update threshold values from SmartDashboard. For performance reasons it is recommended to remove this after calibration is finished. - RING_HUE_RANGE.minValue = SmartDashboard::GetNumber("Tote hue min", RING_HUE_RANGE.minValue); - RING_HUE_RANGE.maxValue = SmartDashboard::GetNumber("Tote hue max", RING_HUE_RANGE.maxValue); - RING_SAT_RANGE.minValue = SmartDashboard::GetNumber("Tote sat min", RING_SAT_RANGE.minValue); - RING_SAT_RANGE.maxValue = SmartDashboard::GetNumber("Tote sat max", RING_SAT_RANGE.maxValue); - RING_VAL_RANGE.minValue = SmartDashboard::GetNumber("Tote val min", RING_VAL_RANGE.minValue); - RING_VAL_RANGE.maxValue = SmartDashboard::GetNumber("Tote val max", RING_VAL_RANGE.maxValue); - - //Threshold the image looking for ring light color - imaqError = imaqColorThreshold(binaryFrame, frame, 255, IMAQ_HSV, &RING_HUE_RANGE, &RING_SAT_RANGE, &RING_VAL_RANGE); - - //Send particle count to dashboard - int numParticles = 0; - imaqError = imaqCountParticles(binaryFrame, 1, &numParticles); - SmartDashboard::PutNumber("Masked particles", numParticles); - - //Send masked image to dashboard to assist in tweaking mask. - SendToDashboard(binaryFrame, imaqError); - - //filter out small particles - float areaMin = SmartDashboard::GetNumber("Area min %", AREA_MINIMUM); - criteria[0] = {IMAQ_MT_AREA_BY_IMAGE_AREA, areaMin, 100, false, false}; - imaqError = imaqParticleFilter4(binaryFrame, binaryFrame, criteria, 1, &filterOptions, NULL, NULL); - - //Send particle count after filtering to dashboard - imaqError = imaqCountParticles(binaryFrame, 1, &numParticles); - SmartDashboard::PutNumber("Filtered particles", numParticles); - - if(numParticles > 0) { - //Measure particles and sort by particle size - std::vector particles; - for(int particleIndex = 0; particleIndex < numParticles; particleIndex++) - { - ParticleReport par; - imaqMeasureParticle(binaryFrame, particleIndex, 0, IMAQ_MT_AREA_BY_IMAGE_AREA, &(par.PercentAreaToImageArea)); - imaqMeasureParticle(binaryFrame, particleIndex, 0, IMAQ_MT_AREA, &(par.Area)); - imaqMeasureParticle(binaryFrame, particleIndex, 0, IMAQ_MT_BOUNDING_RECT_TOP, &(par.BoundingRectTop)); - imaqMeasureParticle(binaryFrame, particleIndex, 0, IMAQ_MT_BOUNDING_RECT_LEFT, &(par.BoundingRectLeft)); - imaqMeasureParticle(binaryFrame, particleIndex, 0, IMAQ_MT_BOUNDING_RECT_BOTTOM, &(par.BoundingRectBottom)); - imaqMeasureParticle(binaryFrame, particleIndex, 0, IMAQ_MT_BOUNDING_RECT_RIGHT, &(par.BoundingRectRight)); - particles.push_back(par); - } - sort(particles.begin(), particles.end(), CompareParticleSizes); - - //This example only scores the largest particle. Extending to score all particles and choosing the desired one is left as an exercise - //for the reader. Note that this scores and reports information about a single particle (single L shaped target). To get accurate information - //about the location of the tote (not just the distance) you will need to correlate two adjacent targets in order to find the true center of the tote. - scores.Aspect = AspectScore(particles.at(0)); - SmartDashboard::PutNumber("Aspect", scores.Aspect); - scores.Area = AreaScore(particles.at(0)); - SmartDashboard::PutNumber("Area", scores.Area); - bool isTarget = scores.Area > SCORE_MIN && scores.Aspect > SCORE_MIN; - - //Send distance and tote status to dashboard. The bounding rect, particularly the horizontal center (left - right) may be useful for rotating/driving towards a tote - SmartDashboard::PutBoolean("IsTarget", isTarget); - SmartDashboard::PutNumber("Distance", computeDistance(binaryFrame, particles.at(0))); - } else { - SmartDashboard::PutBoolean("IsTarget", false); - } - - Wait(0.005); // wait for a motor update time - } - } - - void OperatorControl() override { - while(IsOperatorControl() && IsEnabled()) { - Wait(0.005); // wait for a motor update time - } - } - - - //Send image to dashboard if IMAQ has not thrown an error - void SendToDashboard(Image *image, int error) - { - if(error < ERR_SUCCESS) { - DriverStation::ReportError("Send To Dashboard error: " + std::to_string((long)imaqError) + "\n"); - } else { - CameraServer::GetInstance()->SetImage(binaryFrame); - } - } - - //Comparator function for sorting particles. Returns true if particle 1 is larger - static bool CompareParticleSizes(ParticleReport particle1, ParticleReport particle2) - { - //we want descending sort order - return particle1.PercentAreaToImageArea > particle2.PercentAreaToImageArea; - } - - /** - * Converts a ratio with ideal value of 1 to a score. The resulting function is piecewise - * linear going from (0,0) to (1,100) to (2,0) and is 0 for all inputs outside the range 0-2 - */ - double ratioToScore(double ratio) - { - return (fmax(0, fmin(100*(1-fabs(1-ratio)), 100))); - } - - - double AreaScore(ParticleReport report) - { - double boundingArea = (report.BoundingRectBottom - report.BoundingRectTop) * (report.BoundingRectRight - report.BoundingRectLeft); - //Tape is 7" edge so 49" bounding rect. With 2" wide tape it covers 24" of the rect. - return ratioToScore((49/24)*report.Area/boundingArea); - } - - /** - * Method to score if the aspect ratio of the particle appears to match the retro-reflective target. Target is 7"x7" so aspect should be 1 - */ - double AspectScore(ParticleReport report) - { - return ratioToScore(((report.BoundingRectRight-report.BoundingRectLeft)/(report.BoundingRectBottom-report.BoundingRectTop))); - } - - - /** - * Computes the estimated distance to a target using the width of the particle in the image. For more information and graphics - * showing the math behind this approach see the Vision Processing section of the ScreenStepsLive documentation. - * - * @param image The image to use for measuring the particle estimated rectangle - * @param report The Particle Analysis Report for the particle - * @return The estimated distance to the target in feet. - */ - double computeDistance (Image *image, ParticleReport report) { - double normalizedWidth, targetWidth; - int xRes, yRes; - - imaqGetImageSize(image, &xRes, &yRes); - normalizedWidth = 2*(report.BoundingRectRight - report.BoundingRectLeft)/xRes; - SmartDashboard::PutNumber("Width", normalizedWidth); - targetWidth = 7; - - return targetWidth/(normalizedWidth*12*tan(VIEW_ANGLE*M_PI/(180*2))); - } -}; - -START_ROBOT_CLASS(VisionRetro2015Sample) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/ArcadeDrive/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/ArcadeDrive/src/Robot.cpp deleted file mode 100755 index cb46a8f987..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/ArcadeDrive/src/Robot.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "WPILib.h" - -/** - * This is a demo program showing the use of the RobotDrive class. - * The SampleRobot class is the base of a robot application that will automatically call your - * Autonomous and OperatorControl methods at the right time as controlled by the switches on - * the driver station or the field controls. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -class Robot: public SampleRobot -{ - RobotDrive myRobot; // robot drive system - Joystick stick; // only joystick - -public: - Robot() : - myRobot(0, 1), // initialize the RobotDrive to use motor controllers on ports 0 and 1 - stick(0) - { - myRobot.SetExpiration(0.1); - } - - /** - * Runs the motors with arcade steering. - */ - void OperatorControl() - { - while (IsOperatorControl() && IsEnabled()) - { - myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick) - Wait(0.005); // wait for a motor update time - } - } - -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/AxisCameraSample/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/AxisCameraSample/src/Robot.cpp deleted file mode 100644 index 408859c58e..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/AxisCameraSample/src/Robot.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "WPILib.h" - -/** - * Uses AxisCamera class to manually acquire a new image each frame, and annotate the image by drawing - * a circle on it, and show it on the FRC Dashboard. - */ -class AxisCameraSample : public SampleRobot -{ - IMAQdxSession session; - Image *frame; - IMAQdxError imaqError; - std::unique_ptr camera; - -public: - void RobotInit() override { - // create an image - frame = imaqCreateImage(IMAQ_IMAGE_RGB, 0); - - // open the camera at the IP address assigned. This is the IP address that the camera - // can be accessed through the web interface. - camera.reset(new AxisCamera("axis-camera.local")); - } - - void OperatorControl() override { - // grab an image, draw the circle, and provide it for the camera server which will - // in turn send it to the dashboard. - while(IsOperatorControl() && IsEnabled()) { - camera->GetImage(frame); - imaqDrawShapeOnImage(frame, frame, { 10, 10, 100, 100 }, DrawMode::IMAQ_DRAW_VALUE, ShapeMode::IMAQ_SHAPE_OVAL, 0.0f); - CameraServer::GetInstance()->SetImage(frame); - Wait(0.05); - } - } -}; - -START_ROBOT_CLASS(AxisCameraSample) - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/CANPDP/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/CANPDP/src/Robot.cpp deleted file mode 100644 index 7376310a25..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/CANPDP/src/Robot.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "WPILib.h" - -/** - * This is a sample program showing how to retrieve information from - * the Power Distribution Panel via CAN. - * The information will be displayed under variables through the SmartDashboard. - */ -class Robot: public SampleRobot -{ - - // Object for dealing with the Power Distribution Panel (PDP). - PowerDistributionPanel m_pdp; - - // Update every 5milliseconds/0.005 seconds. - const double kUpdatePeriod = 0.005; - -public: - Robot() { - } - - /** - * Retrieve information from the PDP over CAN and - * displays it on the SmartDashboard interface. - * SmartDashboard::PutNumber takes a string (for a label) and a double; - * GetCurrent takes a channel number and returns a double for current, - * in Amperes. Channel numbers are printed on the PDP and range from 0-15. - */ - void OperatorControl() - { - while (IsOperatorControl() && IsEnabled()) - { - // Get the current going through channel 7, in Amperes. - // The PDP returns the current in increments of 0.125A. - // At low currents the current readings tend to be less accurate. - SmartDashboard::PutNumber("Current Channel 7", m_pdp.GetCurrent(7)); - // Get the voltage going into the PDP, in Volts. - // The PDP returns the voltage in increments of 0.05 Volts. - SmartDashboard::PutNumber("Voltage", m_pdp.GetVoltage()); - // Retrieves the temperature of the PDP, in degrees Celsius. - SmartDashboard::PutNumber("Temperature", m_pdp.GetTemperature()); - Wait(kUpdatePeriod); - } - } - -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/CANTalon/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/CANTalon/src/Robot.cpp deleted file mode 100644 index 4bd8a85a09..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/CANTalon/src/Robot.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "WPILib.h" - -/** - * This sample shows how to use the new CANTalon to just run a motor in a basic - * throttle mode, in the same manner as you might control a traditional PWM - * controlled motor. - * - */ -class Robot : public SampleRobot { - CANTalon m_motor; - - Joystick m_stick; - - // update every 0.01 seconds/10 milliseconds. - // The talon only receives control packets every 10ms. - double kUpdatePeriod = 0.010; - -public: - Robot() - : m_motor(1), // Initialize the Talon as device 1. Use the roboRIO web - // interface to change the device number on the talons. - m_stick(0) - {} - - /** - * Runs the motor from the output of a Joystick. - */ - void OperatorControl() { - while (IsOperatorControl() && IsEnabled()) { - // Takes a number from -1.0 (full reverse) to +1.0 (full forwards). - m_motor.Set(m_stick.GetY()); - - Wait(kUpdatePeriod); // Wait a bit so that the loop doesn't lock everything up. - } - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/CANTalonPID/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/CANTalonPID/src/Robot.cpp deleted file mode 100644 index 3831cdefcf..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/CANTalonPID/src/Robot.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include "WPILib.h" - -/** - * This is a quick sample program to show how to use the new Talon SRX over CAN. - * This particular sample demonstrates running a basic PID control loop with an - * analog potentiometer. - * - */ -class Robot : public SampleRobot { - CANTalon m_motor; - -public: - Robot() - : m_motor(1) // Initialize the Talon as device 1. Use the roboRIO web - // interface to change the device number on the m_motors. - { - // This sets the mode of the m_motor. The options are: - // kPercentVbus: basic throttle; no closed-loop. - // kCurrent: Runs the motor with the specified current if possible. - // kSpeed: Runs a PID control loop to keep the motor going at a constant - // speed using the specified sensor. - // kPosition: Runs a PID control loop to move the motor to a specified move - // the motor to a specified sensor position. - // kVoltage: Runs the m_motor at a constant voltage, if possible. - // kFollower: The m_motor will run at the same throttle as the specified other talon. - m_motor.SetControlMode(CANSpeedController::kPosition); - // This command allows you to specify which feedback device to use when doing - // closed-loop control. The options are: - // AnalogPot: Basic analog potentiometer - // QuadEncoder: Quadrature Encoder - // AnalogEncoder: Analog Encoder - // EncRising: Counts the rising edges of the QuadA pin (allows use of a - // non-quadrature encoder) - // EncFalling: Same as EncRising, but counts on falling edges. - m_motor.SetFeedbackDevice(CANTalon::AnalogPot); - // This sets the basic P, I , and D values (F, Izone, and rampRate can also - // be set, but are ignored here). - // These must all be positive floating point numbers (SetSensorDirection will - // multiply the sensor values by negative one in case your sensor is flipped - // relative to your motor). - // These values are in units of throttle / sensor_units where throttle ranges - // from -1023 to +1023 and sensor units are from 0 - 1023 for analog - // potentiometers, encoder ticks for encoders, and position / 10ms for - // speeds. - m_motor.SetPID(1.0, 0.0, 0.0); - } - - /** - * Runs the motor from the output of a Joystick. - */ - void OperatorControl() { - while (IsOperatorControl() && IsEnabled()) { - // In closed loop mode, this sets the goal in the units mentioned above. - // Since we are using an analog potentiometer, this will try to go to - // the middle of the potentiometer range. - m_motor.Set(512); - - Wait(5.0); - } - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Encoder/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Encoder/src/Robot.cpp deleted file mode 100644 index 57797b251a..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Encoder/src/Robot.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include "WPILib.h" - -/** - * Sample program displaying the value of a quadrature encoder on the SmartDashboard. - * Quadrature Encoders are digital sensors which can detect the amount the encoder - * has rotated since starting as well as the direction in which the encoder - * shaft is rotating. However, encoders can not tell you the absolute - * position of the encoder shaft (ie, it considers where it starts to be the - * zero position, no matter where it starts), and so can only tell you how - * much the encoder has rotated since starting. - * Depending on the precision of an encoder, it will have fewer or greater - * ticks per revolution; the number of ticks per revolution will affect the - * conversion between ticks and distance, as specified by DistancePerPulse. - * One of the most common uses of encoders is in the drivetrain, so that the - * distance that the robot drives can be precisely controlled during the - * autonomous mode. - */ -class Robot: public SampleRobot -{ - Encoder m_encoder; - - /** - * Time to wait between updating SmartDashboard values. - * It is generally a good idea to stick a short wait in these loops - * to avoid hogging CPU power, especially as there will be no - * perceivable difference in the SmartDashboard display. - */ - const double kUpdatePeriod = 0.005; // 5milliseconds / 0.005 seconds. - -public: - /** - * The Encoder object is constructed with 4 parameters, the last two being optional. - * The first two parameters (1, 2 in this case) refer to the ports on the - * roboRIO which the encoder uses. Because a quadrature encoder has - * two signal wires, the signal from two DIO ports on the roboRIO are used. - * The third (optional) parameter is a boolean which defaults to false. - * If you set this parameter to true, the direction of the encoder will - * be reversed, in case it makes more sense mechanically. - * The final (optional) parameter specifies encoding rate (k1X, k2X, or k4X) - * and defaults to k4X. Faster (k4X) encoding gives greater positional - * precision but more noise in the rate. - */ - Robot() : m_encoder(1, 2, false, Encoder::k4X) - { - // Defines the number of samples to average when determining the rate. - // On a quadrature encoder, values range from 1-255; larger values - // result in smoother but potentially less accurate rates than lower values. - m_encoder.SetSamplesToAverage(5); - - // Defines how far the mechanism attached to the encoder moves per pulse. - // In this case, we assume that a 360 count encoder is directly attached - // to a 3 inch diameter (1.5inch radius) wheel, and that we want to - // measure distance in inches. - m_encoder.SetDistancePerPulse(1.0 / 360.0 * 2.0 * 3.1415 * 1.5); - - // Defines the lowest rate at which the encoder will not be considered - // stopped, for the purposes of the GetStopped() method. - // Units are in distance / second, where distance refers to the units - // of distance that you are using, in this case inches. - m_encoder.SetMinRate(1.0); - } - - /** - * Retrieve various information from the encoder and display it - * on the SmartDashboard. - */ - void OperatorControl() - { - while (IsOperatorControl() && IsEnabled()) - { - // Retrieve the net displacement of the Encoder since the lsat Reset. - SmartDashboard::PutNumber("Encoder Distance", m_encoder.GetDistance()); - - // Retrieve the current rate of the encoder. - SmartDashboard::PutNumber("Encoder Rate", m_encoder.GetRate()); - - Wait(kUpdatePeriod); // Wait a short bit before updating again. - } - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Autonomous.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Autonomous.cpp deleted file mode 100644 index fd5077762d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Autonomous.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "Autonomous.h" -#include "PrepareToPickup.h" -#include "Pickup.h" -#include "Place.h" -#include "SetDistanceToBox.h" -#include "DriveStraight.h" -#include "SetWristSetpoint.h" -#include "CloseClaw.h" - -#include - -Autonomous::Autonomous() : CommandGroup("Autonomous") { - AddSequential(new PrepareToPickup()); - AddSequential(new Pickup()); - AddSequential(new SetDistanceToBox(0.10)); - // AddSequential(new DriveStraight(4)); // Use Encoders if ultrasonic is broken - AddSequential(new Place()); - AddSequential(new SetDistanceToBox(0.60)); - // addSequential(new DriveStraight(-2)); // Use Encoders if ultrasonic is broken - AddParallel(new SetWristSetpoint(-45)); - AddSequential(new CloseClaw()); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Autonomous.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Autonomous.h deleted file mode 100644 index 143f89401c..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Autonomous.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef Autonomous_H -#define Autonomous_H - -#include "Commands/CommandGroup.h" - -/** - * The main autonomous command to pickup and deliver the - * soda to the box. - */ -class Autonomous: public CommandGroup { -public: - Autonomous(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/CloseClaw.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/CloseClaw.cpp deleted file mode 100644 index 9b4262fc00..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/CloseClaw.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "CloseClaw.h" -#include "Robot.h" - -CloseClaw::CloseClaw() : Command("CloseClaw") { - Requires(Robot::claw.get()); -} - -// Called just before this Command runs the first time -void CloseClaw::Initialize() { - Robot::claw->Close(); -} - -// Called repeatedly when this Command is scheduled to run -void CloseClaw::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool CloseClaw::IsFinished() { - return Robot::claw->IsGripping() ; -} - -// Called once after isFinished returns true -void CloseClaw::End() { - // NOTE: Doesn't stop in simulation due to lower friction causing the can to fall out - // + there is no need to worry about stalling the motor or crushing the can. - #ifdef REAL - Robot::claw->Stop(); - #endif -} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void CloseClaw::Interrupted() { - End(); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/CloseClaw.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/CloseClaw.h deleted file mode 100644 index d265091495..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/CloseClaw.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef CloseClaw_H -#define CloseClaw_H - -#include "Commands/Command.h" - -/** - * Opens the claw for one second. Real robots should use sensors, stalling - * motors is BAD! - */ -class CloseClaw: public Command { -public: - CloseClaw(); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/DriveStraight.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/DriveStraight.cpp deleted file mode 100644 index 9945514ab6..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/DriveStraight.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "DriveStraight.h" -#include "Robot.h" - -DriveStraight::DriveStraight(double distance) { - Requires(Robot::drivetrain.get()); - pid = new PIDController(4, 0, 0, new DriveStraightPIDSource(), - new DriveStraightPIDOutput()); - pid->SetAbsoluteTolerance(0.01); - pid->SetSetpoint(distance); -} - -// Called just before this Command runs the first time -void DriveStraight::Initialize() { - // Get everything in a safe starting state. - Robot::drivetrain->Reset(); - pid->Reset(); - pid->Enable(); -} - -// Called repeatedly when this Command is scheduled to run -void DriveStraight::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool DriveStraight::IsFinished() { - return pid->OnTarget(); -} - -// Called once after isFinished returns true -void DriveStraight::End() { - // Stop PID and the wheels - pid->Disable(); - Robot::drivetrain->Drive(0, 0); -} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void DriveStraight::Interrupted() { - End(); -} - - -DriveStraightPIDSource::~DriveStraightPIDSource() {} -double DriveStraightPIDSource::PIDGet() { - return Robot::drivetrain->GetDistance(); -} - -DriveStraightPIDOutput::~DriveStraightPIDOutput() {} -void DriveStraightPIDOutput::PIDWrite(float d) { - Robot::drivetrain->Drive(d, d); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/DriveStraight.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/DriveStraight.h deleted file mode 100644 index 50cd0b8e60..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/DriveStraight.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef DriveStraight_H -#define DriveStraight_H - -#include "WPILib.h" -#include "Commands/Command.h" - -/** - * Drive the given distance straight (negative values go backwards). - * Uses a local PID controller to run a simple PID loop that is only - * enabled while this command is running. The input is the averaged - * values of the left and right encoders. - */ -class DriveStraight: public Command { -public: - DriveStraight(double distance); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -private: - PIDController* pid; -}; - -class DriveStraightPIDSource: public PIDSource { -public: - virtual ~DriveStraightPIDSource(); - double PIDGet(); -}; - -class DriveStraightPIDOutput: public PIDOutput { -public: - virtual ~DriveStraightPIDOutput(); - void PIDWrite(float d); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/OpenClaw.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/OpenClaw.cpp deleted file mode 100644 index 16ece43b9d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/OpenClaw.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "OpenClaw.h" -#include "Robot.h" - -OpenClaw::OpenClaw() : Command("OpenClaw") { - Requires(Robot::claw.get()); - SetTimeout(1); -} - -// Called just before this Command runs the first time -void OpenClaw::Initialize() { - Robot::claw->Open(); -} - -// Called repeatedly when this Command is scheduled to run -void OpenClaw::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool OpenClaw::IsFinished() { - return IsTimedOut(); -} - -// Called once after isFinished returns true -void OpenClaw::End() { - Robot::claw->Stop(); -} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void OpenClaw::Interrupted() { - End(); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/OpenClaw.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/OpenClaw.h deleted file mode 100644 index 15a059c2d4..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/OpenClaw.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef OpenClaw_H -#define OpenClaw_H - -#include "Commands/Command.h" - -/** - * Opens the claw for one second. Real robots should use sensors, stalling - * motors is BAD! - */ -class OpenClaw: public Command { -public: - OpenClaw(); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Pickup.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Pickup.cpp deleted file mode 100644 index c8e8dbe3b8..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Pickup.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "Pickup.h" -#include "CloseClaw.h" -#include "SetWristSetpoint.h" -#include "SetElevatorSetpoint.h" - -#include - -Pickup::Pickup() : CommandGroup("Pickup") { - AddSequential(new CloseClaw()); - AddParallel(new SetWristSetpoint(-45)); - AddSequential(new SetElevatorSetpoint(0.25)); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Pickup.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Pickup.h deleted file mode 100644 index ba08500a09..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Pickup.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef Pickup_H -#define Pickup_H - -#include "Commands/CommandGroup.h" - -/** - * Pickup a soda can (if one is between the open claws) and - * get it in a safe state to drive around. - */ -class Pickup: public CommandGroup { -public: - Pickup(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Place.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Place.cpp deleted file mode 100644 index c535b4b4cc..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Place.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "Place.h" -#include "OpenClaw.h" -#include "SetWristSetpoint.h" -#include "SetElevatorSetpoint.h" - -#include - -Place::Place() : CommandGroup("Place") { - AddSequential(new SetElevatorSetpoint(0.25)); - AddSequential(new SetWristSetpoint(0)); - AddSequential(new OpenClaw()); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Place.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Place.h deleted file mode 100644 index d8fbc9b9ba..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/Place.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef Place_H -#define Place_H - -#include "Commands/CommandGroup.h" - -/** - * Place a held soda can onto the platform. - */ -class Place: public CommandGroup { -public: - Place(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/PrepareToPickup.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/PrepareToPickup.cpp deleted file mode 100644 index f63d242199..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/PrepareToPickup.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "PrepareToPickup.h" -#include "OpenClaw.h" -#include "SetWristSetpoint.h" -#include "SetElevatorSetpoint.h" - -#include - -PrepareToPickup::PrepareToPickup() : CommandGroup("PrepareToPickup") { - AddParallel(new OpenClaw()); - AddParallel(new SetWristSetpoint(0)); - AddSequential(new SetElevatorSetpoint(0)); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/PrepareToPickup.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/PrepareToPickup.h deleted file mode 100644 index ec336a0037..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/PrepareToPickup.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef PrepareToPickup_H -#define PrepareToPickup_H - -#include "Commands/CommandGroup.h" - -/** - * Make sure the robot is in a state to pickup soda cans. - */ -class PrepareToPickup: public CommandGroup { -public: - PrepareToPickup(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetDistanceToBox.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetDistanceToBox.cpp deleted file mode 100644 index 27f70f6f38..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetDistanceToBox.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "SetDistanceToBox.h" -#include "Robot.h" - -SetDistanceToBox::SetDistanceToBox(double distance) { - Requires(Robot::drivetrain.get()); - pid = new PIDController(-2, 0, 0, new SetDistanceToBoxPIDSource(), - new SetDistanceToBoxPIDOutput()); - pid->SetAbsoluteTolerance(0.01); - pid->SetSetpoint(distance); -} - -// Called just before this Command runs the first time -void SetDistanceToBox::Initialize() { - // Get everything in a safe starting state. - Robot::drivetrain->Reset(); - pid->Reset(); - pid->Enable(); -} - -// Called repeatedly when this Command is scheduled to run -void SetDistanceToBox::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool SetDistanceToBox::IsFinished() { - return pid->OnTarget(); -} - -// Called once after isFinished returns true -void SetDistanceToBox::End() { - // Stop PID and the wheels - pid->Disable(); - Robot::drivetrain->Drive(0, 0); -} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void SetDistanceToBox::Interrupted() { - End(); -} - - -SetDistanceToBoxPIDSource::~SetDistanceToBoxPIDSource() {} -double SetDistanceToBoxPIDSource::PIDGet() { - return Robot::drivetrain->GetDistanceToObstacle(); -} - -SetDistanceToBoxPIDOutput::~SetDistanceToBoxPIDOutput() {} -void SetDistanceToBoxPIDOutput::PIDWrite(float d) { - Robot::drivetrain->Drive(d, d); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetDistanceToBox.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetDistanceToBox.h deleted file mode 100644 index 1c284884db..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetDistanceToBox.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef SetDistanceToBox_H -#define SetDistanceToBox_H - -#include "WPILib.h" -#include "Commands/Command.h" - -/** - * Drive until the robot is the given distance away from the box. Uses a local - * PID controller to run a simple PID loop that is only enabled while this - * command is running. The input is the averaged values of the left and right - * encoders. - */ -class SetDistanceToBox: public Command { -public: - SetDistanceToBox(double distance); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -private: - PIDController* pid; -}; - -class SetDistanceToBoxPIDSource: public PIDSource { -public: - virtual ~SetDistanceToBoxPIDSource(); - double PIDGet(); -}; - -class SetDistanceToBoxPIDOutput: public PIDOutput { -public: - virtual ~SetDistanceToBoxPIDOutput(); - void PIDWrite(float d); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetElevatorSetpoint.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetElevatorSetpoint.cpp deleted file mode 100644 index d8f475e7a4..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetElevatorSetpoint.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "SetElevatorSetpoint.h" -#include "Robot.h" -#include - -SetElevatorSetpoint::SetElevatorSetpoint(double setpoint) : Command("SetElevatorSetpoint") { - this->setpoint = setpoint; - Requires(Robot::elevator.get()); -} - -// Called just before this Command runs the first time -void SetElevatorSetpoint::Initialize() { - Robot::elevator->SetSetpoint(setpoint); - Robot::elevator->Enable(); -} - -// Called repeatedly when this Command is scheduled to run -void SetElevatorSetpoint::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool SetElevatorSetpoint::IsFinished() { - return Robot::elevator->OnTarget(); -} - -// Called once after isFinished returns true -void SetElevatorSetpoint::End() {} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void SetElevatorSetpoint::Interrupted() {} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetElevatorSetpoint.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetElevatorSetpoint.h deleted file mode 100644 index 1c8454c7b4..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetElevatorSetpoint.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef SetElevatorSetpoint_H -#define SetElevatorSetpoint_H - -#include "Commands/Command.h" - -/** - * Move the elevator to a given location. This command finishes when it is within - * the tolerance, but leaves the PID loop running to maintain the position. Other - * commands using the elevator should make sure they disable PID! - */ -class SetElevatorSetpoint: public Command { -private: - double setpoint; -public: - SetElevatorSetpoint(double setpoint); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetWristSetpoint.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetWristSetpoint.cpp deleted file mode 100644 index 9648d33999..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetWristSetpoint.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "SetWristSetpoint.h" -#include "Robot.h" - -SetWristSetpoint::SetWristSetpoint(double setpoint) : Command("SetWristSetpoint") { - this->setpoint = setpoint; - Requires(Robot::wrist.get()); -} - -// Called just before this Command runs the first time -void SetWristSetpoint::Initialize() { - Robot::wrist->SetSetpoint(setpoint); - Robot::wrist->Enable(); -} - -// Called repeatedly when this Command is scheduled to run -void SetWristSetpoint::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool SetWristSetpoint::IsFinished() { - return Robot::wrist->OnTarget(); -} - -// Called once after isFinished returns true -void SetWristSetpoint::End() {} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void SetWristSetpoint::Interrupted() {} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetWristSetpoint.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetWristSetpoint.h deleted file mode 100644 index 87c9db506c..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/SetWristSetpoint.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef SetWristSetpoint_H -#define SetWristSetpoint_H - -#include "Commands/Command.h" - -/** - * Move the wrist to a given angle. This command finishes when it is within - * the tolerance, but leaves the PID loop running to maintain the position. - * Other commands using the wrist should make sure they disable PID! - */ -class SetWristSetpoint: public Command { -private: - double setpoint; -public: - SetWristSetpoint(double setpoint); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/TankDriveWithJoystick.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/TankDriveWithJoystick.cpp deleted file mode 100644 index a3c9e817ee..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/TankDriveWithJoystick.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "TankDriveWithJoystick.h" -#include "Robot.h" - -TankDriveWithJoystick::TankDriveWithJoystick() : Command("TankDriveWithJoystick") { - Requires(Robot::drivetrain.get()); -} - -// Called just before this Command runs the first time -void TankDriveWithJoystick::Initialize() {} - -// Called repeatedly when this Command is scheduled to run -void TankDriveWithJoystick::Execute() { - Robot::drivetrain->Drive(Robot::oi->GetJoystick()); -} - -// Make this return true when this Command no longer needs to run execute() -bool TankDriveWithJoystick::IsFinished() { - return false; -} - -// Called once after isFinished returns true -void TankDriveWithJoystick::End() { - Robot::drivetrain->Drive(0, 0); -} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void TankDriveWithJoystick::Interrupted() { - End(); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/TankDriveWithJoystick.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/TankDriveWithJoystick.h deleted file mode 100644 index 65cd935628..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Commands/TankDriveWithJoystick.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef TankDriveWithJoystick_H -#define TankDriveWithJoystick_H - -#include "Commands/Command.h" - -/** - * Have the robot drive tank style using the PS3 Joystick until interrupted. - */ -class TankDriveWithJoystick: public Command { -public: - TankDriveWithJoystick(); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/OI.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/OI.cpp deleted file mode 100644 index de47c3ae6d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/OI.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * OI.cpp - * - * Created on: Jun 3, 2014 - * Author: alex - */ - -#include "OI.h" - -#include "Commands/SetElevatorSetpoint.h" -#include "Commands/OpenClaw.h" -#include "Commands/CloseClaw.h" -#include "Commands/PrepareToPickup.h" -#include "Commands/Pickup.h" -#include "Commands/Place.h" -#include "Commands/Autonomous.h" - -OI::OI() { - SmartDashboard::PutData("Open Claw", new OpenClaw()); - SmartDashboard::PutData("Close Claw", new CloseClaw()); - - joy= new Joystick(0); - - - // Create some buttons - JoystickButton* d_up = new JoystickButton(joy, 5); - JoystickButton* d_right= new JoystickButton(joy, 6); - JoystickButton* d_down= new JoystickButton(joy, 7); - JoystickButton* d_left = new JoystickButton(joy, 8); - JoystickButton* l2 = new JoystickButton(joy, 9); - JoystickButton* r2 = new JoystickButton(joy, 10); - JoystickButton* l1 = new JoystickButton(joy, 11); - JoystickButton* r1 = new JoystickButton(joy, 12); - - // Connect the buttons to commands - d_up->WhenPressed(new SetElevatorSetpoint(0.2)); - d_down->WhenPressed(new SetElevatorSetpoint(-0.2)); - d_right->WhenPressed(new CloseClaw()); - d_left->WhenPressed(new OpenClaw()); - - r1->WhenPressed(new PrepareToPickup()); - r2->WhenPressed(new Pickup()); - l1->WhenPressed(new Place()); - l2->WhenPressed(new Autonomous()); -} - - -Joystick* OI::GetJoystick() { - return joy; -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/OI.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/OI.h deleted file mode 100644 index d5c56469c1..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/OI.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * OI.h - * - * Created on: Jun 3, 2014 - * Author: alex - */ - -#ifndef OI_H_ -#define OI_H_ - -#include "WPILib.h" - -class OI { -public: - OI(); - Joystick* GetJoystick(); - -private: - Joystick* joy; -}; - -#endif /* OI_H_ */ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Robot.cpp deleted file mode 100644 index 26a2a2076b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Robot.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -#include "Robot.h" - -std::shared_ptr Robot::drivetrain; -std::shared_ptr Robot::elevator; -std::shared_ptr Robot::wrist; -std::shared_ptr Robot::claw; - -std::unique_ptr Robot::oi; - -void Robot::RobotInit() { - drivetrain.reset(new DriveTrain()); - elevator.reset(new Elevator()); - wrist.reset(new Wrist()); - claw.reset(new Claw()); - - oi.reset(new OI()); - - // Show what command your subsystem is running on the SmartDashboard - SmartDashboard::PutData(drivetrain.get()); - SmartDashboard::PutData(elevator.get()); - SmartDashboard::PutData(wrist.get()); - SmartDashboard::PutData(claw.get()); -} - -void Robot::AutonomousInit() { - autonomousCommand.Start(); - std::cout << "Starting Auto" << std::endl; -} - -void Robot::AutonomousPeriodic() { - Scheduler::GetInstance()->Run(); -} - -void Robot::TeleopInit() { - // This makes sure that the autonomous stops running when - // teleop starts running. If you want the autonomous to - // continue until interrupted by another command, remove - // this line or comment it out. - autonomousCommand.Cancel(); - std::cout << "Starting Teleop" << std::endl; -} - -void Robot::TeleopPeriodic() { - Scheduler::GetInstance()->Run(); -} - -void Robot::TestPeriodic() { - lw->Run(); -} - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Robot.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Robot.h deleted file mode 100644 index ee98beb2d8..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Robot.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Robot.h - * - * Created on: Jun 3, 2014 - * Author: alex - */ - -#ifndef MY_ROBOT_H_ -#define MY_ROBOT_H_ - -#include "WPILib.h" -#include "Commands/Command.h" -#include "Commands/Autonomous.h" - -#include "Subsystems/DriveTrain.h" -#include "Subsystems/Elevator.h" -#include "Subsystems/Wrist.h" -#include "Subsystems/Claw.h" -#include "OI.h" - -class Robot: public IterativeRobot { -public: - static std::shared_ptr drivetrain; - static std::shared_ptr elevator; - static std::shared_ptr wrist; - static std::shared_ptr claw; - static std::unique_ptr oi; - -private: - Autonomous autonomousCommand; - LiveWindow *lw = LiveWindow::GetInstance(); - - void RobotInit(); - void AutonomousInit(); - void AutonomousPeriodic(); - void TeleopInit(); - void TeleopPeriodic(); - void TestPeriodic(); -}; - - -#endif /* ROBOT_H_ */ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Claw.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Claw.cpp deleted file mode 100644 index 938badd2ef..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Claw.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "Subsystems/Claw.h" - -Claw::Claw() : Subsystem("Claw") { - motor = new Victor(7); - contact = new DigitalInput(5); - - // Let's show everything on the LiveWindow - // TODO: LiveWindow::GetInstance()->AddActuator("Claw", "Motor", (Victor) motor); - // TODO: contact -} - -void Claw::Open() -{ - motor->Set(-1); -} - - -void Claw::Close() -{ - motor->Set(1); -} - - -void Claw::Stop() { - motor->Set(0); -} - -bool Claw::IsGripping() { - return contact->Get(); -} - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Claw.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Claw.h deleted file mode 100644 index 5a795a8724..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Claw.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef Claw_H -#define Claw_H - -#include "Commands/Subsystem.h" -#include "WPILib.h" - -/** - * The claw subsystem is a simple system with a motor for opening and closing. - * If using stronger motors, you should probably use a sensor so that the - * motors don't stall. - */ -class Claw: public Subsystem { -private: - SpeedController* motor; - DigitalInput* contact; - -public: - Claw(); - void InitDefaultCommand() {} - - /** - * Set the claw motor to move in the open direction. - */ - void Open(); - - /** - * Set the claw motor to move in the close direction. - */ - void Close(); - - /** - * Stops the claw motor from moving. - */ - void Stop(); - - /** - * Return true when the robot is grabbing an object hard enough - * to trigger the limit switch. - */ - bool IsGripping(); - - void Log() {} -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.cpp deleted file mode 100644 index adeb6e9db6..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include "DriveTrain.h" -#include "Commands/TankDriveWithJoystick.h" - -DriveTrain::DriveTrain() - : Subsystem("DriveTrain"), left_encoder(new Encoder(1, 2)), - right_encoder(new Encoder(3, 4)), rangefinder(new AnalogInput(6)), - gyro(new AnalogGyro(1)) { - drive = new RobotDrive(new Talon(1), new Talon(2), - new Talon(3), new Talon(4)); - - // Encoders may measure differently in the real world and in - // simulation. In this example the robot moves 0.042 barleycorns - // per tick in the real world, but the simulated encoders - // simulate 360 tick encoders. This if statement allows for the - // real robot to handle this difference in devices. - #ifdef REAL - left_encoder->SetDistancePerPulse(0.042); - right_encoder->SetDistancePerPulse(0.042); - #else - // Circumference in ft = 4in/12(in/ft)*PI - left_encoder->SetDistancePerPulse((double) (4.0/12.0*M_PI) / 360.0); - right_encoder->SetDistancePerPulse((double) (4.0/12.0*M_PI) / 360.0); - #endif - - // Let's show everything on the LiveWindow - // TODO: LiveWindow::GetInstance()->AddActuator("Drive Train", "Front_Left Motor", (Talon) front_left_motor); - // TODO: LiveWindow::GetInstance()->AddActuator("Drive Train", "Back Left Motor", (Talon) back_left_motor); - // TODO: LiveWindow::GetInstance()->AddActuator("Drive Train", "Front Right Motor", (Talon) front_right_motor); - // TODO: LiveWindow::GetInstance()->AddActuator("Drive Train", "Back Right Motor", (Talon) back_right_motor); - LiveWindow::GetInstance()->AddSensor("Drive Train", "Left Encoder", left_encoder); - LiveWindow::GetInstance()->AddSensor("Drive Train", "Right Encoder", right_encoder); - LiveWindow::GetInstance()->AddSensor("Drive Train", "Rangefinder", rangefinder); - LiveWindow::GetInstance()->AddSensor("Drive Train", "Gyro", gyro); -} - -/** - * When no other command is running let the operator drive around - * using the PS3 joystick. - */ -void DriveTrain::InitDefaultCommand() { - SetDefaultCommand(new TankDriveWithJoystick()); -} - -/** - * The log method puts interesting information to the SmartDashboard. - */ -void DriveTrain::Log() { - SmartDashboard::PutNumber("Left Distance", left_encoder->GetDistance()); - SmartDashboard::PutNumber("Right Distance", right_encoder->GetDistance()); - SmartDashboard::PutNumber("Left Speed", left_encoder->GetRate()); - SmartDashboard::PutNumber("Right Speed", right_encoder->GetRate()); - SmartDashboard::PutNumber("Gyro", gyro->GetAngle()); -} - -void DriveTrain::Drive(double left, double right) { - drive->TankDrive(left, right); -} - -void DriveTrain::Drive(Joystick* joy) { - Drive(-joy->GetY(), -joy->GetRawAxis(4)); -} - -double DriveTrain::GetHeading() { - return gyro->GetAngle(); -} - -void DriveTrain::Reset() { - gyro->Reset(); - left_encoder->Reset(); - right_encoder->Reset(); -} - -double DriveTrain::GetDistance() { - return (left_encoder->GetDistance() + right_encoder->GetDistance())/2; -} - -double DriveTrain::GetDistanceToObstacle() { - // Really meters in simulation since it's a rangefinder... - return rangefinder->GetAverageVoltage(); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.h deleted file mode 100644 index f931d6b4a2..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/DriveTrain.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef DriveTrain_H -#define DriveTrain_H - -#include "WPILib.h" - -/** - * The DriveTrain subsystem incorporates the sensors and actuators attached to - * the robots chassis. These include four drive motors, a left and right encoder - * and a gyro. - */ -class DriveTrain : public Subsystem { -private: - RobotDrive* drive; - std::shared_ptr left_encoder, right_encoder; - std::shared_ptr rangefinder; - std::shared_ptr gyro; - -public: - DriveTrain(); - - /** - * When no other command is running let the operator drive around - * using the PS3 joystick. - */ - void InitDefaultCommand(); - - /** - * The log method puts interesting information to the SmartDashboard. - */ - void Log(); - - /** - * Tank style driving for the DriveTrain. - * @param left Speed in range [-1,1] - * @param right Speed in range [-1,1] - */ - void Drive(double left, double right); - - /** - * @param joy The ps3 style joystick to use to drive tank style. - */ - void Drive(Joystick* joy); - - /** - * @return The robots heading in degrees. - */ - double GetHeading(); - - /** - * Reset the robots sensors to the zero states. - */ - void Reset(); - - /** - * @return The distance driven (average of left and right encoders). - */ - double GetDistance(); - - /** - * @return The distance to the obstacle detected by the rangefinder. - */ - double GetDistanceToObstacle(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Elevator.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Elevator.cpp deleted file mode 100644 index 02c558ffa5..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Elevator.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "Elevator.h" -#include "SmartDashboard/SmartDashboard.h" -#include "LiveWindow/LiveWindow.h" - -Elevator::Elevator() : PIDSubsystem("Elevator", kP_real, kI_real, 0.0) { - #ifdef SIMULATION // Check for simulation and update PID values - GetPIDController()->SetPID(kP_simulation, kI_simulation, 0, 0); - #endif - SetAbsoluteTolerance(0.005); - - motor = new Victor(5); - - // Conversion value of potentiometer varies between the real world and simulation - #ifdef REAL - pot = new AnalogPotentiometer(2, -2.0/5); - #else - pot = new AnalogPotentiometer(2); // Defaults to meters - #endif - - // Let's show everything on the LiveWindow - // TODO: LiveWindow::GetInstance()->AddActuator("Elevator", "Motor", (Victor) motor); - // TODO: LiveWindow::GetInstance()->AddSensor("Elevator", "Pot", (AnalogPotentiometer) pot); - LiveWindow::GetInstance()->AddActuator("Elevator", "PID", GetPIDController()); -} - -void Elevator::Log() { - // TODO: SmartDashboard::PutData("Wrist Pot", (AnalogPotentiometer) pot); -} - -double Elevator::ReturnPIDInput() { - return pot->Get(); -} - -void Elevator::UsePIDOutput(double d) { - motor->Set(d); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Elevator.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Elevator.h deleted file mode 100644 index d079de03b5..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Elevator.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef Elevator_H -#define Elevator_H - -#include "Commands/PIDSubsystem.h" -#include "WPILib.h" - -/** - * The elevator subsystem uses PID to go to a given height. Unfortunately, in it's current - * state PID values for simulation are different than in the real world do to minor differences. - */ -class Elevator : public PIDSubsystem { -private: - SpeedController* motor; - Potentiometer* pot; - - static constexpr double kP_real = 4, kI_real = 0.07, - kP_simulation = 18, kI_simulation = 0.2; - -public: - Elevator(); - void InitDefaultCommand() {} - - /** - * The log method puts interesting information to the SmartDashboard. - */ - void Log(); - - /** - * Use the potentiometer as the PID sensor. This method is automatically - * called by the subsystem. - */ - double ReturnPIDInput(); - - - /** - * Use the motor as the PID output. This method is automatically called by - * the subsystem. - */ - void UsePIDOutput(double d); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Wrist.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Wrist.cpp deleted file mode 100644 index f09fdbb790..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Wrist.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "Wrist.h" -#include "SmartDashboard/SmartDashboard.h" -#include "LiveWindow/LiveWindow.h" - -Wrist::Wrist() : PIDSubsystem("Wrist", kP_real, 0.0, 0.0) { - #ifdef SIMULATION // Check for simulation and update PID values - GetPIDController()->SetPID(kP_simulation, 0, 0, 0); - #endif - SetAbsoluteTolerance(2.5); - - motor = new Victor(6); - - // Conversion value of potentiometer varies between the real world and simulation - #ifdef REAL - pot = new AnalogPotentiometer(3, -270.0/5); - #else - pot = new AnalogPotentiometer(3); // Defaults to degrees - #endif - - // Let's show everything on the LiveWindow - // TODO: LiveWindow::GetInstance()->AddActuator("Wrist", "Motor", (Victor) motor); - // TODO: LiveWindow::GetInstance()->AddSensor("Wrist", "Pot", (AnalogPotentiometer) pot); - LiveWindow::GetInstance()->AddActuator("Wrist", "PID", GetPIDController()); -} - -void Wrist::Log() { - // TODO: SmartDashboard::PutData("Wrist Angle", (AnalogPotentiometer) pot); -} - -double Wrist::ReturnPIDInput() { - return pot->Get(); -} - -void Wrist::UsePIDOutput(double d) { - motor->Set(d); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Wrist.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Wrist.h deleted file mode 100644 index e80364e7cd..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GearsBot/src/Subsystems/Wrist.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef Wrist_H -#define Wrist_H - -#include "Commands/PIDSubsystem.h" -#include "WPILib.h" - -/** - * The wrist subsystem is like the elevator, but with a rotational joint instead - * of a linear joint. - */ -class Wrist : public PIDSubsystem { -private: - SpeedController* motor; - Potentiometer* pot; // TODO: Make Potentiometer - - static constexpr double kP_real = 1, kP_simulation = 0.05; - -public: - Wrist(); - void InitDefaultCommand() {} - - /** - * The log method puts interesting information to the SmartDashboard. - */ - void Log(); - - /** - * Use the potentiometer as the PID sensor. This method is automatically - * called by the subsystem. - */ - double ReturnPIDInput(); - - /** - * Use the motor as the PID output. This method is automatically called by - * the subsystem. - */ - void UsePIDOutput(double d); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GettingStarted/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GettingStarted/src/Robot.cpp deleted file mode 100644 index ccf2e587f9..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GettingStarted/src/Robot.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "WPILib.h" - -class Robot: public IterativeRobot -{ - - RobotDrive myRobot; // robot drive system - Joystick stick; // only joystick - LiveWindow *lw; - int autoLoopCounter; - -public: - Robot() : - myRobot(0, 1), // these must be initialized in the same order - stick(0), // as they are declared above. - lw(LiveWindow::GetInstance()), - autoLoopCounter(0) - { - myRobot.SetExpiration(0.1); - } - -private: - void AutonomousInit() - { - autoLoopCounter = 0; - } - - void AutonomousPeriodic() - { - if(autoLoopCounter < 100) //Check if we've completed 100 loops (approximately 2 seconds) - { - myRobot.Drive(-0.5, 0.0); // drive forwards half speed - autoLoopCounter++; - } else { - myRobot.Drive(0.0, 0.0); // stop robot - } - } - - void TeleopInit() - { - - } - - void TeleopPeriodic() - { - myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick) - } - - void TestPeriodic() - { - lw->Run(); - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Gyro/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Gyro/src/Robot.cpp deleted file mode 100644 index 7019c77c1b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Gyro/src/Robot.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "WPILib.h" - -/** - * This is a sample program to demonstrate how to use a gyro sensor to make a robot drive - * straight. This program uses a joystick to drive forwards and backwards while the gyro - * is used for direction keeping. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -class Robot: public SampleRobot { - const int gyroChannel = 0; //analog input - const int joystickChannel = 0; //usb number in DriverStation - - //channels for motors - const int leftMotorChannel = 1; - const int rightMotorChannel = 0; - const int leftRearMotorChannel = 3; - const int rightRearMotorChannel = 2; - - double angleSetpoint = 0.0; - const double pGain = .006; //propotional turning constant - - //gyro calibration constant, may need to be adjusted - //gyro value of 360 is set to correspond to one full revolution - const double voltsPerDegreePerSecond = .0128; - - RobotDrive myRobot; - AnalogGyro gyro; - Joystick joystick; - -public: - Robot() : - // Create the drivetrain from 4 CAN Talon SRXs. - myRobot(new CANTalon(leftMotorChannel), new CANTalon(leftRearMotorChannel), - new CANTalon(rightMotorChannel), new CANTalon(rightRearMotorChannel)), - // Assign the gyro and joystick channels. - gyro(gyroChannel), joystick(joystickChannel) {} - - /** - * Runs during autonomous. - */ - void Autonomous() - { - - } - - /** - * Sets the gyro sensitivity and drives the robot when the joystick is pushed. The - * motor speed is set from the joystick while the RobotDrive turning value is - * assigned from the error between the setpoint and the gyro angle. - */ - void OperatorControl() - { - double turningValue; - gyro.SetSensitivity(voltsPerDegreePerSecond); //calibrates gyro values to equal degrees - - while (IsOperatorControl() && IsEnabled()) - { - turningValue = (angleSetpoint - gyro.GetAngle()) * pGain; - if (joystick.GetY() <= 0) { - //forwards - myRobot.Drive(joystick.GetY(), turningValue); - } else { - //backwards - myRobot.Drive(joystick.GetY(), -turningValue); - } - } - } - - /** - * Runs during test mode. - */ - void Test() - { - - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GyroMecanum/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GyroMecanum/src/Robot.cpp deleted file mode 100644 index 9810e7ec59..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/GyroMecanum/src/Robot.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "WPILib.h" - -/** - * This is a sample program that uses mecanum drive with a gyro sensor to maintian - * rotation vectors in relation to the starting orientation of the robot (field-oriented controls). - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -class Robot: public SampleRobot { - Joystick joystick; - RobotDrive myRobot; - AnalogGyro gyro; - - //channels for motors - const int leftMotorChannel = 1; - const int rightMotorChannel = 0; - const int leftRearMotorChannel = 3; - const int rightRearMotorChannel = 2; - - const int gyroChannel = 0; //analog input - - //gyro calibration constant, may need to be adjusted so that a gyro value of 360 - //equals 360 degrees - const double voltsPerDegreePerSecond = .0128; - -public: - Robot() : - joystick(0), - // Create the robot using CANTalons; change as appropriate for different - // motors (eg, Victor, Jaguar, Talon, CANJaguar, etc.). - myRobot(new CANTalon(leftMotorChannel), new CANTalon(leftRearMotorChannel), - new CANTalon(rightMotorChannel), new CANTalon(rightRearMotorChannel)), - gyro(gyroChannel) { - myRobot.SetInvertedMotor(RobotDrive::kFrontLeftMotor, true);// invert the left side motors - myRobot.SetInvertedMotor(RobotDrive::kRearLeftMotor, true);// you may need to change or remove this to match your robot - } - - /** - * Runs during autonomous. - */ - void Autonomous() { - - } - - /** - * Runs the motors with arcade steering. - */ - void OperatorControl() { - gyro.SetSensitivity(voltsPerDegreePerSecond); //calibrate gyro to have the value equal to degrees - while (IsOperatorControl() && IsEnabled()) { - myRobot.MecanumDrive_Cartesian(joystick.GetX(), joystick.GetY(), - joystick.GetZ(), gyro.GetAngle()); - Wait(0.005); // wait 5ms to avoid hogging CPU cycles - } - } - - /** - * Runs during test mode. - */ - void Test() { - - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/IntermediateVision/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/IntermediateVision/src/Robot.cpp deleted file mode 100644 index f3458a959c..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/IntermediateVision/src/Robot.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "WPILib.h" - -/** - * Uses IMAQdx to manually acquire a new image each frame, and annotate the image by drawing - * a circle on it, and show it on the FRC Dashboard. - */ -class IntermediateVisionRobot : public SampleRobot -{ - IMAQdxSession session; - Image *frame; - IMAQdxError imaqError; - -public: - void RobotInit() override { - // create an image - frame = imaqCreateImage(IMAQ_IMAGE_RGB, 0); - //the camera name (ex "cam0") can be found through the roborio web interface - imaqError = IMAQdxOpenCamera("cam0", IMAQdxCameraControlModeController, &session); - if(imaqError != IMAQdxErrorSuccess) { - DriverStation::ReportError("IMAQdxOpenCamera error: " + std::to_string((long)imaqError) + "\n"); - } - imaqError = IMAQdxConfigureGrab(session); - if(imaqError != IMAQdxErrorSuccess) { - DriverStation::ReportError("IMAQdxConfigureGrab error: " + std::to_string((long)imaqError) + "\n"); - } - } - - void OperatorControl() override { - // acquire images - IMAQdxStartAcquisition(session); - - // grab an image, draw the circle, and provide it for the camera server which will - // in turn send it to the dashboard. - while(IsOperatorControl() && IsEnabled()) { - IMAQdxGrab(session, frame, true, NULL); - if(imaqError != IMAQdxErrorSuccess) { - DriverStation::ReportError("IMAQdxGrab error: " + std::to_string((long)imaqError) + "\n"); - } else { - imaqDrawShapeOnImage(frame, frame, { 10, 10, 100, 100 }, DrawMode::IMAQ_DRAW_VALUE, ShapeMode::IMAQ_SHAPE_OVAL, 0.0f); - CameraServer::GetInstance()->SetImage(frame); - } - Wait(0.005); // wait for a motor update time - } - // stop image acquisition - IMAQdxStopAcquisition(session); - } -}; - -START_ROBOT_CLASS(IntermediateVisionRobot) - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MecanumDrive/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MecanumDrive/src/Robot.cpp deleted file mode 100755 index 67635d28a8..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MecanumDrive/src/Robot.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "WPILib.h" - -/** - * This is a demo program showing how to use Mecanum control with the RobotDrive class. - */ -class Robot: public SampleRobot -{ - - // Channels for the wheels - const static int frontLeftChannel = 2; - const static int rearLeftChannel = 3; - const static int frontRightChannel = 1; - const static int rearRightChannel = 0; - - const static int joystickChannel = 0; - - RobotDrive robotDrive; // robot drive system - Joystick stick; // only joystick - -public: - Robot() : - robotDrive(frontLeftChannel, rearLeftChannel, - frontRightChannel, rearRightChannel), // these must be initialized in the same order - stick(joystickChannel) // as they are declared above. - { - robotDrive.SetExpiration(0.1); - robotDrive.SetInvertedMotor(RobotDrive::kFrontLeftMotor, true); // invert the left side motors - robotDrive.SetInvertedMotor(RobotDrive::kRearLeftMotor, true); // you may need to change or remove this to match your robot - } - - /** - * Runs the motors with Mecanum drive. - */ - void OperatorControl() - { - robotDrive.SetSafetyEnabled(false); - while (IsOperatorControl() && IsEnabled()) - { - // Use the joystick X axis for lateral movement, Y axis for forward movement, and Z axis for rotation. - // This sample does not use field-oriented drive, so the gyro input is set to zero. - robotDrive.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), stick.GetZ()); - - Wait(0.005); // wait 5ms to avoid hogging CPU cycles - } - } - -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControl/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControl/src/Robot.cpp deleted file mode 100644 index 338ba34e10..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControl/src/Robot.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "WPILib.h" - -/** - * This sample program shows how to control a motor using a joystick. In the operator - * control part of the program, the joystick is read and the value is written to the motor. - * - * Joystick analog values range from -1 to 1 and speed controller inputs as range from - * -1 to 1 making it easy to work together. The program also delays a short time in the loop - * to allow other threads to run. This is generally a good idea, especially since the joystick - * values are only transmitted from the Driver Station once every 20ms. - */ -class Robot : public SampleRobot { - Joystick m_stick; - - // The motor to control with the Joystick. - // This uses a Talon speed controller; use the Victor or Jaguar classes for - // other speed controllers. - Talon m_motor; - - // update every 0.005 seconds/5 milliseconds. - double kUpdatePeriod = 0.005; - -public: - Robot() : - m_stick(0), // Initialize Joystick on port 0. - m_motor(0) // Initialize the Talon on channel 0. - { - } - - /** - * Runs the motor from the output of a Joystick. - */ - void OperatorControl() { - while (IsOperatorControl() && IsEnabled()) { - // Set the motor controller's output. - // This takes a number from -1 (100% speed in reverse) to +1 (100% speed forwards). - m_motor.Set(m_stick.GetY()); - - Wait(kUpdatePeriod); // Wait 5ms for the next update. - } - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControlEncoder/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControlEncoder/src/Robot.cpp deleted file mode 100644 index f004578498..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/MotorControlEncoder/src/Robot.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "WPILib.h" - -/** - * This sample program shows how to control a motor using a joystick. In the operator - * control part of the program, the joystick is read and the value is written to the motor. - * An Encoder is then used to read the total distance that the motor has turned and - * to display it on the SmartDashboard. - * - * Joystick analog values range from -1 to 1 and speed controller inputs as range from - * -1 to 1 making it easy to work together. The program also delays a short time in the loop - * to allow other threads to run. This is generally a good idea, especially since the joystick - * values are only transmitted from the Driver Station once every 20ms. - */ -class Robot : public SampleRobot { - Joystick m_stick; - - // The motor to control with the Joystick. - // This uses a Talon speed controller; use the Victor or Jaguar classes for - // other speed controllers. - Talon m_motor; - - // update every 0.005 seconds/5 milliseconds. - double kUpdatePeriod = 0.005; - - Encoder m_encoder; - -public: - Robot() : - m_stick(0), // Initialize Joystick on port 0. - m_motor(2), // Initialize the Talon on channel 0. - m_encoder(1, 2) // Iniitialize encoder connected on DIO ports 1 and 2. - { - // Distance will give total rotations of the motor, assuming a 360 count encoder. - m_encoder.SetDistancePerPulse(1.0 / 360.0); - } - - /** - * Runs the motor from the output of a Joystick. - * Simultaneously displays encoder values on the SmartDashboard. - */ - void OperatorControl() { - while (IsOperatorControl() && IsEnabled()) { - // Set the motor controller's output. - // This takes a number from -1 (100% speed in reverse) to +1 (100% speed forwards). - m_motor.Set(m_stick.GetY()); - - // Display the total displacement of the encoder, in rotations. - SmartDashboard::PutNumber("Encoder Distance", m_encoder.GetDistance()); - - Wait(kUpdatePeriod); // Wait 5ms for the next update. - } - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CheckForHotGoal.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CheckForHotGoal.cpp deleted file mode 100644 index c4eeb845e4..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CheckForHotGoal.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "CheckForHotGoal.h" - -#include "Robot.h" - -CheckForHotGoal::CheckForHotGoal(double time) { - SetTimeout(time); -} - -// Called just before this Command runs the first time -void CheckForHotGoal::Initialize() {} - -// Called repeatedly when this Command is scheduled to run -void CheckForHotGoal::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool CheckForHotGoal::IsFinished() { - return IsTimedOut() || Robot::shooter->GoalIsHot(); -} - -// Called once after isFinished returns true -void CheckForHotGoal::End() {} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void CheckForHotGoal::Interrupted() {} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CheckForHotGoal.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CheckForHotGoal.h deleted file mode 100644 index d069045d44..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CheckForHotGoal.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef CheckForHotGoal_H -#define CheckForHotGoal_H - -#include "WPILib.h" - -/** - * This command looks for the hot goal and waits until it's detected or timed - * out. The timeout is because it's better to shoot and get some autonomous - * points than get none. When called sequentially, this command will block until - * the hot goal is detected or until it is timed out. - */ -class CheckForHotGoal : public Command { -public: - CheckForHotGoal(double time); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CloseClaw.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CloseClaw.cpp deleted file mode 100644 index 116b3a077e..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CloseClaw.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "CloseClaw.h" - -#include "Robot.h" - -CloseClaw::CloseClaw() { - Requires(Robot::collector.get()); -} - -// Called just before this Command runs the first time -void CloseClaw::Initialize() { - Robot::collector->Close(); -} - -// Called repeatedly when this Command is scheduled to run -void CloseClaw::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool CloseClaw::IsFinished() { - return true; -} - -// Called once after isFinished returns true -void CloseClaw::End() {} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void CloseClaw::Interrupted() {} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CloseClaw.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CloseClaw.h deleted file mode 100644 index dec6cc7b03..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/CloseClaw.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef CloseClaw_H -#define CloseClaw_H - -#include "WPILib.h" - -/** - * Close the claw. - * - * NOTE: It doesn't wait for the claw to close since there is no sensor to - * detect that. - */ -class CloseClaw: public Command { -public: - CloseClaw(); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Collect.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Collect.cpp deleted file mode 100644 index bb76efff0a..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Collect.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "Collect.h" - -#include "Robot.h" -#include "Commands/SetCollectionSpeed.h" -#include "Commands/CloseClaw.h" -#include "Commands/SetPivotSetpoint.h" -#include "Commands/WaitForBall.h" - -Collect::Collect() { - AddSequential(new SetCollectionSpeed(Collector::FORWARD)); - AddParallel(new CloseClaw()); - AddSequential(new SetPivotSetpoint(Pivot::COLLECT)); - AddSequential(new WaitForBall()); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Collect.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Collect.h deleted file mode 100644 index 974d2a0a24..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Collect.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef Collect_H -#define Collect_H - -#include "WPILib.h" - -/** - * Get the robot set to collect balls. - */ -class Collect: public CommandGroup { -public: - Collect(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveAndShootAutonomous.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveAndShootAutonomous.cpp deleted file mode 100644 index 5148bbc9b3..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveAndShootAutonomous.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "DriveAndShootAutonomous.h" - -#include "Robot.h" -#include "Commands/WaitForPressure.h" -#include "Commands/CloseClaw.h" -#include "Commands/SetPivotSetpoint.h" -#include "Commands/DriveForward.h" -#include "Commands/Shoot.h" -#include "Commands/CheckForHotGoal.h" - -DriveAndShootAutonomous::DriveAndShootAutonomous() { - AddSequential(new CloseClaw()); - AddSequential(new WaitForPressure(), 2); - #ifdef REAL - // NOTE: Simulation doesn't currently have the concept of hot. - AddSequential(new CheckForHotGoal(2)); - #endif - AddSequential(new SetPivotSetpoint(45)); - AddSequential(new DriveForward(8, 0.3)); - AddSequential(new Shoot()); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveAndShootAutonomous.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveAndShootAutonomous.h deleted file mode 100644 index 38a7c6e9c3..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveAndShootAutonomous.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef DriveAndShootAutonomous_H -#define DriveAndShootAutonomous_H - -#include "WPILib.h" - -/** - * Drive over the line and then shoot the ball. If the hot goal is not detected, - * it will wait briefly. - */ -class DriveAndShootAutonomous: public CommandGroup { -public: - DriveAndShootAutonomous(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveForward.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveForward.cpp deleted file mode 100644 index b945c4a0cc..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveForward.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "DriveForward.h" - -#include "Robot.h" - -void DriveForward::init(double dist, double maxSpeed) { - Requires(Robot::drivetrain.get()); - distance = dist; - driveForwardSpeed = maxSpeed; - error = 0; -} - -DriveForward::DriveForward() { - init(10, 0.5); -} - -DriveForward::DriveForward(double dist) { - init(dist, 0.5); -} - -DriveForward::DriveForward(double dist, double maxSpeed) { - init(dist, maxSpeed); -} - -// Called just before this Command runs the first time -void DriveForward::Initialize() { - Robot::drivetrain->GetRightEncoder()->Reset(); - SetTimeout(2); -} - -// Called repeatedly when this Command is scheduled to run -void DriveForward::Execute() { - error = (distance - Robot::drivetrain->GetRightEncoder()->GetDistance()); - if (driveForwardSpeed * KP * error >= driveForwardSpeed) { - Robot::drivetrain->TankDrive(driveForwardSpeed, driveForwardSpeed); - } else { - Robot::drivetrain->TankDrive(driveForwardSpeed * KP * error, - driveForwardSpeed * KP * error); - } -} - -// Make this return true when this Command no longer needs to run execute() -bool DriveForward::IsFinished() { - return (abs(error) <= TOLERANCE) || IsTimedOut(); -} - -// Called once after isFinished returns true -void DriveForward::End() { - Robot::drivetrain->Stop(); -} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void DriveForward::Interrupted() { - End(); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveForward.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveForward.h deleted file mode 100644 index bf069547d7..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveForward.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef DriveForward_H -#define DriveForward_H - -#include "WPILib.h" - -/** - * This command drives the robot over a given distance with simple proportional - * control This command will drive a given distance limiting to a maximum speed. - */ -class DriveForward: public Command { -private: - double driveForwardSpeed; - double distance; - double error; - static constexpr double TOLERANCE = .1; - static constexpr double KP = -1.0 / 5.0; - void init(double dist, double maxSpeed); -public: - DriveForward(); - DriveForward(double dist); - DriveForward(double dist, double maxSpeed); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveWithJoystick.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveWithJoystick.cpp deleted file mode 100644 index c244d7d617..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveWithJoystick.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "DriveWithJoystick.h" - -#include "Robot.h" - -DriveWithJoystick::DriveWithJoystick() { - Requires(Robot::drivetrain.get()); -} - -// Called just before this Command runs the first time -void DriveWithJoystick::Initialize() {} - -// Called repeatedly when this Command is scheduled to run -void DriveWithJoystick::Execute() { - Robot::drivetrain->TankDrive(Robot::oi->GetJoystick()); -} - -// Make this return true when this Command no longer needs to run execute() -bool DriveWithJoystick::IsFinished() { - return false; -} - -// Called once after isFinished returns true -void DriveWithJoystick::End() { - Robot::drivetrain->Stop(); -} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void DriveWithJoystick::Interrupted() { - End(); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveWithJoystick.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveWithJoystick.h deleted file mode 100644 index 0dff411d42..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/DriveWithJoystick.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef DriveWithJoystick_H -#define DriveWithJoystick_H - -#include "WPILib.h" - -/** - * This command allows PS3 joystick to drive the robot. It is always running - * except when interrupted by another command. - */ -class DriveWithJoystick: public Command { -public: - DriveWithJoystick(); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/ExtendShooter.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/ExtendShooter.cpp deleted file mode 100644 index e1acabc1df..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/ExtendShooter.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "ExtendShooter.h" - -#include "Robot.h" - -ExtendShooter::ExtendShooter() { - Requires(Robot::shooter.get()); - SetTimeout(1); -} - -// Called just before this Command runs the first time -void ExtendShooter::Initialize() { - Robot::shooter->ExtendBoth(); -} - -// Called repeatedly when this Command is scheduled to run -void ExtendShooter::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool ExtendShooter::IsFinished() { - return IsTimedOut(); -} - -// Called once after isFinished returns true -void ExtendShooter::End() { - Robot::shooter->RetractBoth(); -} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void ExtendShooter::Interrupted() { - End(); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/ExtendShooter.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/ExtendShooter.h deleted file mode 100644 index 7a8357235b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/ExtendShooter.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef ExtendShooter_H -#define ExtendShooter_H - -#include "WPILib.h" - -/** - * Extend the shooter and then retract it after a second. - */ -class ExtendShooter: public Command { -public: - ExtendShooter(); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/LowGoal.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/LowGoal.cpp deleted file mode 100644 index 35f90a66b2..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/LowGoal.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "LowGoal.h" - -#include "Robot.h" -#include "Commands/SetPivotSetpoint.h" -#include "Commands/SetCollectionSpeed.h" -#include "Commands/ExtendShooter.h" - -LowGoal::LowGoal() { - AddSequential(new SetPivotSetpoint(Pivot::LOW_GOAL)); - AddSequential(new SetCollectionSpeed(Collector::REVERSE)); - AddSequential(new ExtendShooter()); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/LowGoal.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/LowGoal.h deleted file mode 100644 index 398b88d3e7..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/LowGoal.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef LowGoal_H -#define LowGoal_H - -#include "WPILib.h" - -/** - * Spit the ball out into the low goal assuming that the robot is in front of it. - */ -class LowGoal: public CommandGroup { -public: - LowGoal(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/OpenClaw.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/OpenClaw.cpp deleted file mode 100644 index 74b042db31..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/OpenClaw.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "OpenClaw.h" - -#include "Robot.h" - -OpenClaw::OpenClaw() { - Requires(Robot::collector.get()); -} - -// Called just before this Command runs the first time -void OpenClaw::Initialize() { - Robot::collector->Open(); -} - -// Called repeatedly when this Command is scheduled to run -void OpenClaw::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool OpenClaw::IsFinished() { - return Robot::collector->IsOpen(); -} - -// Called once after isFinished returns true -void OpenClaw::End() {} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void OpenClaw::Interrupted() {} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/OpenClaw.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/OpenClaw.h deleted file mode 100644 index 47ef131e89..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/OpenClaw.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef OpenClaw_H -#define OpenClaw_H - -#include "WPILib.h" - -/** - * Opens the claw - */ -class OpenClaw: public Command { -public: - OpenClaw(); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetCollectionSpeed.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetCollectionSpeed.cpp deleted file mode 100644 index b50154d2db..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetCollectionSpeed.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "SetCollectionSpeed.h" - -#include "Robot.h" - -SetCollectionSpeed::SetCollectionSpeed(double speed) { - Requires(Robot::collector.get()); - this->speed = speed; -} - -// Called just before this Command runs the first time -void SetCollectionSpeed::Initialize() { - Robot::collector->SetSpeed(speed); -} - -// Called repeatedly when this Command is scheduled to run -void SetCollectionSpeed::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool SetCollectionSpeed::IsFinished() { - return true; -} - -// Called once after isFinished returns true -void SetCollectionSpeed::End() {} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void SetCollectionSpeed::Interrupted() {} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetCollectionSpeed.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetCollectionSpeed.h deleted file mode 100644 index b41fb75393..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetCollectionSpeed.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef SetCollectionSpeed_H -#define SetCollectionSpeed_H - -#include "WPILib.h" - -/** - * This command sets the collector rollers spinning at the given speed. Since - * there is no sensor for detecting speed, it finishes immediately. As a result, - * the spinners may still be adjusting their speed. - */ -class SetCollectionSpeed: public Command { -private: - double speed; -public: - SetCollectionSpeed(double speed); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetPivotSetpoint.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetPivotSetpoint.cpp deleted file mode 100644 index 0dad144e52..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetPivotSetpoint.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "SetPivotSetpoint.h" - -#include "Robot.h" - -SetPivotSetpoint::SetPivotSetpoint(double setpoint) { - this->setpoint = setpoint; - Requires(Robot::pivot.get()); -} - -// Called just before this Command runs the first time -void SetPivotSetpoint::Initialize() { - Robot::pivot->Enable(); - Robot::pivot->SetSetpoint(setpoint); -} - -// Called repeatedly when this Command is scheduled to run -void SetPivotSetpoint::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool SetPivotSetpoint::IsFinished() -{ - return Robot::pivot->OnTarget(); -} - -// Called once after isFinished returns true -void SetPivotSetpoint::End() {} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void SetPivotSetpoint::Interrupted() {} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetPivotSetpoint.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetPivotSetpoint.h deleted file mode 100644 index adfaca6d7d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/SetPivotSetpoint.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef SetPivotSetpoint_H -#define SetPivotSetpoint_H - -#include "WPILib.h" - -/** - * Moves the pivot to a given angle. This command finishes when it is within - * the tolerance, but leaves the PID loop running to maintain the position. - * Other commands using the pivot should make sure they disable PID! - */ -class SetPivotSetpoint: public Command { -public: - SetPivotSetpoint(double setpoint); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); - -private: - double setpoint; -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Shoot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Shoot.cpp deleted file mode 100644 index 5112484433..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Shoot.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "Shoot.h" - -#include "Robot.h" -#include "Commands/WaitForPressure.h" -#include "Commands/SetCollectionSpeed.h" -#include "Commands/OpenClaw.h" -#include "Commands/ExtendShooter.h" - -Shoot::Shoot() { - AddSequential(new WaitForPressure()); - AddSequential(new SetCollectionSpeed(Collector::STOP)); - AddSequential(new OpenClaw()); - AddSequential(new ExtendShooter()); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Shoot.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Shoot.h deleted file mode 100644 index 290045491d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/Shoot.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef Shoot_H -#define Shoot_H - -#include "WPILib.h" - -/** - * Shoot the ball at the current angle. - */ -class Shoot: public CommandGroup { -public: - Shoot(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForBall.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForBall.cpp deleted file mode 100644 index 8788692a14..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForBall.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "WaitForBall.h" - -#include "Robot.h" - -WaitForBall::WaitForBall() { - Requires(Robot::collector.get()); -} - -// Called just before this Command runs the first time -void WaitForBall::Initialize() {} - -// Called repeatedly when this Command is scheduled to run -void WaitForBall::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool WaitForBall::IsFinished() -{ - return Robot::collector->HasBall(); -} - -// Called once after isFinished returns true -void WaitForBall::End() {} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void WaitForBall::Interrupted() {} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForBall.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForBall.h deleted file mode 100644 index 3109b276a2..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForBall.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef WaitForBall_H -#define WaitForBall_H - -#include "WPILib.h" - -/** - * Wait until the collector senses that it has the ball. This command does - * nothing and is intended to be used in command groups to wait for this - * condition. - */ -class WaitForBall: public Command { -public: - WaitForBall(); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForPressure.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForPressure.cpp deleted file mode 100644 index 1a64be631d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForPressure.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "WaitForPressure.h" - -#include "Robot.h" - -WaitForPressure::WaitForPressure() -{ - Requires(Robot::pneumatics.get()); -} - -// Called just before this Command runs the first time -void WaitForPressure::Initialize() {} - -// Called repeatedly when this Command is scheduled to run -void WaitForPressure::Execute() {} - -// Make this return true when this Command no longer needs to run execute() -bool WaitForPressure::IsFinished() -{ - return Robot::pneumatics->IsPressurized(); -} - -// Called once after isFinished returns true -void WaitForPressure::End() {} - -// Called when another command which requires one or more of the same -// subsystems is scheduled to run -void WaitForPressure::Interrupted() {} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForPressure.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForPressure.h deleted file mode 100644 index d097b64681..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Commands/WaitForPressure.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef WaitForPressure_H -#define WaitForPressure_H - -#include "WPILib.h" - -/** - * Wait until the pneumatics are fully pressurized. This command does nothing - * and is intended to be used in command groups to wait for this condition. - */ -class WaitForPressure: public Command { -public: - WaitForPressure(); - void Initialize(); - void Execute(); - bool IsFinished(); - void End(); - void Interrupted(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/OI.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/OI.cpp deleted file mode 100644 index 249cb34224..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/OI.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "OI.h" - -#include "Subsystems/Pivot.h" -#include "Subsystems/Collector.h" -#include "Commands/LowGoal.h" -#include "Commands/Collect.h" -#include "Commands/SetPivotSetpoint.h" -#include "Commands/Shoot.h" -#include "Commands/DriveForward.h" -#include "Commands/SetCollectionSpeed.h" - -OI::OI() - : joystick(0), - L1(&joystick, 11), - L2(&joystick, 9), - R1(&joystick, 12), - R2(&joystick, 10), - sticks(&joystick, 2, 3) { - - R1.WhenPressed(new LowGoal()); - R2.WhenPressed(new Collect()); - - L1.WhenPressed(new SetPivotSetpoint(Pivot::SHOOT)); - L2.WhenPressed(new SetPivotSetpoint(Pivot::SHOOT_NEAR)); - - sticks.WhenActive(new Shoot()); - - - // SmartDashboard Buttons - SmartDashboard::PutData("Drive Forward", new DriveForward(2.25)); - SmartDashboard::PutData("Drive Backward", new DriveForward(-2.25)); - SmartDashboard::PutData("Start Rollers", new SetCollectionSpeed(Collector::FORWARD)); - SmartDashboard::PutData("Stop Rollers", new SetCollectionSpeed(Collector::STOP)); - SmartDashboard::PutData("Reverse Rollers", new SetCollectionSpeed(Collector::REVERSE)); -} - - -Joystick* OI::GetJoystick() { - return &joystick; -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/OI.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/OI.h deleted file mode 100644 index fdee45285c..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/OI.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef OI_H -#define OI_H - -#include "WPILib.h" -#include "Triggers/DoubleButton.h" - -class OI { -private: - Joystick joystick; - JoystickButton L1, L2, R1, R2; - DoubleButton sticks; -public: - OI(); - Joystick* GetJoystick(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Robot.cpp deleted file mode 100644 index 7ef891620e..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Robot.cpp +++ /dev/null @@ -1,84 +0,0 @@ - -#include "Robot.h" - -std::shared_ptr Robot::drivetrain; -std::shared_ptr Robot::pivot; -std::shared_ptr Robot::collector; -std::shared_ptr Robot::shooter; -std::shared_ptr Robot::pneumatics; - -std::unique_ptr Robot::oi; - -void Robot::RobotInit() { - drivetrain.reset(new DriveTrain()); - pivot.reset(new Pivot()); - collector.reset(new Collector()); - shooter.reset(new Shooter()); - pneumatics.reset(new Pneumatics()); - - oi.reset(new OI()); - - // Show what command your subsystem is running on the SmartDashboard - SmartDashboard::PutData(drivetrain.get()); - SmartDashboard::PutData(pivot.get()); - SmartDashboard::PutData(collector.get()); - SmartDashboard::PutData(shooter.get()); - SmartDashboard::PutData(pneumatics.get()); - - // instantiate the command used for the autonomous period - autoChooser.AddDefault("Drive and Shoot", driveAndShootAuto.get()); - autoChooser.AddObject("Drive Forward", driveForwardAuto.get()); - SmartDashboard::PutData("Auto Mode", &autoChooser); - - pneumatics->Start(); // Pressurize the pneumatics. -} - -void Robot::AutonomousInit() { - autonomousCommand = (Command *)autoChooser.GetSelected(); - autonomousCommand->Start(); -} - -void Robot::AutonomousPeriodic() { - Scheduler::GetInstance()->Run(); - Log(); -} - -void Robot::TeleopInit() { - // This makes sure that the autonomous stops running when - // teleop starts running. If you want the autonomous to - // continue until interrupted by another command, remove - // this line or comment it out. - if (autonomousCommand != nullptr) { - autonomousCommand->Cancel(); - } - std::cout << "Starting Teleop" << std::endl; -} - -void Robot::TeleopPeriodic() { - Scheduler::GetInstance()->Run(); - Log(); -} - -void Robot::TestPeriodic() { - LiveWindow::GetInstance()->Run(); -} - -void Robot::DisabledInit() { - shooter->Unlatch(); -} - -void Robot::DisabledPeriodic() { - Log(); -} - -/** - * Log interesting values to the SmartDashboard. - */ -void Robot::Log() { - Robot::pneumatics->WritePressure(); - SmartDashboard::PutNumber("Pivot Pot Value", pivot->GetAngle()); - SmartDashboard::PutNumber("Left Distance", drivetrain->GetLeftEncoder()->GetDistance()); - SmartDashboard::PutNumber("Right Distance", drivetrain->GetRightEncoder()->GetDistance()); -} - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Robot.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Robot.h deleted file mode 100644 index d4437cdef0..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Robot.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Robot.h - * - * Created on: Jun 3, 2014 - * Author: alex - */ - -#ifndef MY_ROBOT_H_ -#define MY_ROBOT_H_ - -#include "WPILib.h" -#include "Commands/Command.h" - -#include "Commands/DriveAndShootAutonomous.h" -#include "Commands/DriveForward.h" -#include "Subsystems/DriveTrain.h" -#include "Subsystems/Pivot.h" -#include "Subsystems/Collector.h" -#include "Subsystems/Shooter.h" -#include "Subsystems/Pneumatics.h" -#include "OI.h" - -class Robot: public IterativeRobot { -public: - static std::shared_ptr drivetrain; - static std::shared_ptr pivot; - static std::shared_ptr collector; - static std::shared_ptr shooter; - static std::shared_ptr pneumatics; - static std::unique_ptr oi; - -private: - Command* autonomousCommand = nullptr; - std::unique_ptr driveAndShootAuto{new DriveAndShootAutonomous()}, - driveForwardAuto{new DriveForward()}; - SendableChooser autoChooser; - - void RobotInit(); - void AutonomousInit(); - void AutonomousPeriodic(); - void TeleopInit(); - void TeleopPeriodic(); - void TestPeriodic(); - void DisabledInit(); - void DisabledPeriodic(); - - void Log(); -}; - -#endif /* ROBOT_H_ */ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Collector.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Collector.cpp deleted file mode 100644 index c296e0a84b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Collector.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "Collector.h" - -Collector::Collector() : - Subsystem("Collector"), - // Configure devices - rollerMotor(new Victor(6)), - ballDetector(new DigitalInput(10)), - piston(new Solenoid(1)), - openDetector(new DigitalInput(6)) -{ - - // Put everything to the LiveWindow for testing. - // XXX: LiveWindow::GetInstance()->AddActuator("Collector", "Roller Motor", (Victor) rollerMotor); - LiveWindow::GetInstance()->AddSensor("Collector", "Ball Detector", ballDetector); - LiveWindow::GetInstance()->AddSensor("Collector", "Claw Open Detector", openDetector); - LiveWindow::GetInstance()->AddActuator("Collector", "Piston", piston); -} - -bool Collector::HasBall() { - return ballDetector->Get(); // TODO: prepend ! to reflect real robot -} - -void Collector::SetSpeed(double speed) { - rollerMotor->Set(-speed); -} - -void Collector::Stop() { - rollerMotor->Set(0); -} - -bool Collector::IsOpen() { - return openDetector->Get(); // TODO: prepend ! to reflect real robot -} - -void Collector::Open() { - piston->Set(true); -} - -void Collector::Close() { - piston->Set(false); -} - -void Collector::InitDefaultCommand() {} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Collector.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Collector.h deleted file mode 100644 index f727709d3d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Collector.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef Collector_H -#define Collector_H - -#include "Commands/Subsystem.h" -#include "WPILib.h" - -/** - * The Collector subsystem has one motor for the rollers, a limit switch for ball - * detection, a piston for opening and closing the claw, and a reed switch to - * check if the piston is open. - */ -class Collector: public Subsystem -{ -public: - // Constants for some useful speeds - static constexpr double FORWARD = 1; - static constexpr double STOP = 0; - static constexpr double REVERSE = -1; - -private: - // Subsystem devices - std::shared_ptr rollerMotor; - std::shared_ptr ballDetector; - std::shared_ptr piston; - std::shared_ptr openDetector; - -public: - Collector(); - - /** - * NOTE: The current simulation model uses the the lower part of the claw - * since the limit switch wasn't exported. At some point, this will be - * updated. - * - * @return Whether or not the robot has the ball. - */ - bool HasBall(); - - /** - * @param speed The speed to spin the rollers. - */ - void SetSpeed(double speed); - - /** - * Stop the rollers from spinning - */ - void Stop(); - - /** - * @return Whether or not the claw is open. - */ - bool IsOpen(); - - /** - * Open the claw up. (For shooting) - */ - void Open(); - - /** - * Close the claw. (For collecting and driving) - */ - void Close(); - - /** - * No default command. - */ - void InitDefaultCommand(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/DriveTrain.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/DriveTrain.cpp deleted file mode 100644 index 26600008df..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/DriveTrain.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "DriveTrain.h" -#include "Commands/DriveWithJoystick.h" -#define _USE_MATH_DEFINES -#include - -DriveTrain::DriveTrain() - : Subsystem("DriveTrain"), - // Configure drive motors - frontLeftCIM(new Victor(1)), - frontRightCIM(new Victor(2)), - backLeftCIM(new Victor(3)), - backRightCIM(new Victor(4)), - drive(frontRightCIM, backLeftCIM, frontRightCIM, backRightCIM), - rightEncoder(new Encoder(1, 2, true, Encoder::k4X)), - leftEncoder(new Encoder(3, 4, false, Encoder::k4X)), - gyro(new AnalogGyro(0)) { - // XXX: LiveWindow::GetInstance()->AddActuator("DriveTrain", "Front Left CIM", (Victor) frontLeftCIM); - // XXX: LiveWindow::GetInstance()->AddActuator("DriveTrain", "Front Right CIM", (Victor) frontRightCIM); - // XXX: LiveWindow::GetInstance()->AddActuator("DriveTrain", "Back Left CIM", (Victor) backLeftCIM); - // XXX: LiveWindow::GetInstance()->AddActuator("DriveTrain", "Back Right CIM", (Victor) backRightCIM); - - // Configure the RobotDrive to reflect the fact that all our motors are - // wired backwards and our drivers sensitivity preferences. - drive.SetSafetyEnabled(false); - drive.SetExpiration(0.1); - drive.SetSensitivity(0.5); - drive.SetMaxOutput(1.0); - drive.SetInvertedMotor(RobotDrive::kFrontLeftMotor, true); - drive.SetInvertedMotor(RobotDrive::kRearLeftMotor, true); - drive.SetInvertedMotor(RobotDrive::kFrontRightMotor, true); - drive.SetInvertedMotor(RobotDrive::kRearRightMotor, true); - - // Configure encoders - rightEncoder->SetPIDSourceParameter(PIDSource::kDistance); - leftEncoder->SetPIDSourceParameter(PIDSource::kDistance); - - #ifdef REAL - // Converts to feet - rightEncoder->SetDistancePerPulse(0.0785398); - leftEncoder->SetDistancePerPulse(0.0785398); - #else - // Convert to feet 4in diameter wheels with 360 tick simulated encoders - rightEncoder->SetDistancePerPulse((4.0/*in*/*M_PI)/(360.0*12.0/*in/ft*/)); - leftEncoder->SetDistancePerPulse((4.0/*in*/*M_PI)/(360.0*12.0/*in/ft*/)); - #endif - - LiveWindow::GetInstance()->AddSensor("DriveTrain", "Right Encoder", rightEncoder); - LiveWindow::GetInstance()->AddSensor("DriveTrain", "Left Encoder", leftEncoder); - - // Configure gyro - #ifdef REAL - gyro->SetSensitivity(0.007); // TODO: Handle more gracefully? - #endif - LiveWindow::GetInstance()->AddSensor("DriveTrain", "Gyro", gyro); -} - -void DriveTrain::InitDefaultCommand() { - SetDefaultCommand(new DriveWithJoystick()); -} - -void DriveTrain::TankDrive(Joystick* joy) { - drive.TankDrive(joy->GetY(), joy->GetRawAxis(4)); -} - -void DriveTrain::TankDrive(double leftAxis, double rightAxis) { - drive.TankDrive(leftAxis, rightAxis); -} - -void DriveTrain::Stop() { - drive.TankDrive(0.0, 0.0); -} - -std::shared_ptr DriveTrain::GetLeftEncoder() { - return leftEncoder; -} - -std::shared_ptr DriveTrain::GetRightEncoder() { - return rightEncoder; -} - -double DriveTrain::GetAngle() { - return gyro->GetAngle(); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/DriveTrain.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/DriveTrain.h deleted file mode 100644 index a0ad62f62a..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/DriveTrain.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef DriveTrain_H -#define DriveTrain_H - -#include "Commands/Subsystem.h" -#include "WPILib.h" - -/** - * The DriveTrain subsystem controls the robot's chassis and reads in - * information about it's speed and position. - */ -class DriveTrain: public Subsystem -{ -private: - // Subsystem devices - std::shared_ptr frontLeftCIM, frontRightCIM; - std::shared_ptr backLeftCIM, backRightCIM; - RobotDrive drive; - std::shared_ptr rightEncoder, leftEncoder; - std::shared_ptr gyro; - -public: - DriveTrain(); - - /** - * When other commands aren't using the drivetrain, allow tank drive with - * the joystick. - */ - void InitDefaultCommand(); - - /** - * @param joy PS3 style joystick to use as the input for tank drive. - */ - void TankDrive(Joystick* joy); - - /** - * @param leftAxis Left sides value - * @param rightAxis Right sides value - */ - void TankDrive(double leftAxis, double rightAxis); - - /** - * Stop the drivetrain from moving. - */ - void Stop(); - - /** - * @return The encoder getting the distance and speed of left side of the drivetrain. - */ - std::shared_ptr GetLeftEncoder(); - - /** - * @return The encoder getting the distance and speed of right side of the drivetrain. - */ - std::shared_ptr GetRightEncoder(); - - /** - * @return The current angle of the drivetrain. - */ - double GetAngle(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pivot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pivot.cpp deleted file mode 100644 index d6fc1ef843..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pivot.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "Pivot.h" - -Pivot::Pivot() : - PIDSubsystem("Pivot", 7.0, 0.0, 8.0), - // Sensors for measuring the position of the pivot. - upperLimitSwitch(new DigitalInput(13)), - lowerLimitSwitch(new DigitalInput(12)), - // 0 degrees is vertical facing up. - // Angle increases the more forward the pivot goes. - pot(new AnalogPotentiometer(1)), - // Motor to move the pivot. - motor(new Victor(5)) -{ - SetAbsoluteTolerance(0.005); - GetPIDController()->SetContinuous(false); - #ifdef SIMULATION - // PID is different in simulation. - GetPIDController()->SetPID(0.5, 0.001, 2); - SetAbsoluteTolerance(5); - #endif - - // Put everything to the LiveWindow for testing. - LiveWindow::GetInstance()->AddSensor("Pivot", "Upper Limit Switch", upperLimitSwitch); - LiveWindow::GetInstance()->AddSensor("Pivot", "Lower Limit Switch", lowerLimitSwitch); - // XXX: LiveWindow::GetInstance()->AddSensor("Pivot", "Pot", (AnalogPotentiometer) pot); - // XXX: LiveWindow::GetInstance()->AddActuator("Pivot", "Motor", (Victor) motor); - LiveWindow::GetInstance()->AddActuator("Pivot", "PIDSubsystem Controller", GetPIDController()); -} - -void InitDefaultCommand() {} - -double Pivot::ReturnPIDInput() { - return pot->Get(); -} - -void Pivot::UsePIDOutput(double output) { - motor->PIDWrite(output); -} - -bool Pivot::IsAtUpperLimit() { - return upperLimitSwitch->Get(); // TODO: inverted from real robot (prefix with !) -} - -bool Pivot::IsAtLowerLimit() { - return lowerLimitSwitch->Get(); // TODO: inverted from real robot (prefix with !) -} - -double Pivot::GetAngle() { - return pot->Get(); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pivot.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pivot.h deleted file mode 100644 index d8f1783936..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pivot.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef Pivot_H -#define Pivot_H - -#include "Commands/PIDSubsystem.h" -#include "WPILib.h" - -/** - * The Pivot subsystem contains the Van-door motor and the pot for PID control - * of angle of the pivot and claw. - */ -class Pivot: public PIDSubsystem -{ -public: - // Constants for some useful angles - static constexpr double COLLECT = 105; - static constexpr double LOW_GOAL = 90; - static constexpr double SHOOT = 45; - static constexpr double SHOOT_NEAR = 30; - -private: - // Subsystem devices - std::shared_ptr upperLimitSwitch; - std::shared_ptr lowerLimitSwitch; - std::shared_ptr pot; - std::shared_ptr motor; - -public: - Pivot(); - - /** - * No default command, if PID is enabled, the current setpoint will be maintained. - */ - void InitDefaultCommand() {} - - /** - * @return The angle read in by the potentiometer - */ - double ReturnPIDInput(); - - /** - * Set the motor speed based off of the PID output - */ - void UsePIDOutput(double output); - - /** - * @return If the pivot is at its upper limit. - */ - bool IsAtUpperLimit(); - - /** - * @return If the pivot is at its lower limit. - */ - bool IsAtLowerLimit(); - - /** - * @return The current angle of the pivot. - */ - double GetAngle(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pneumatics.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pneumatics.cpp deleted file mode 100644 index a2b6bec31e..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pneumatics.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "Pneumatics.h" - -Pneumatics::Pneumatics() : - Subsystem("Pneumatics"), - pressureSensor(new AnalogInput(3)) -{ - #ifdef REAL - compressor = new Compressor(uint8_t(1)); // TODO: (1, 14, 1, 8); - #endif - - LiveWindow::GetInstance()->AddSensor("Pneumatics", "Pressure Sensor", pressureSensor); -} - -/** - * No default command - */ -void Pneumatics::InitDefaultCommand() {} - -/** - * Start the compressor going. The compressor automatically starts and stops as it goes above and below maximum pressure. - */ -void Pneumatics::Start() { - #ifdef REAL - compressor->Start(); - #endif -} - -/** - * @return Whether or not the system is fully pressurized. - */ -bool Pneumatics::IsPressurized() { - #ifdef REAL - return MAX_PRESSURE <= pressureSensor->GetVoltage(); - #else - return true; // NOTE: Simulation always has full pressure - #endif -} - -/** - * Puts the pressure on the SmartDashboard. - */ -void Pneumatics::WritePressure() { - SmartDashboard::PutNumber("Pressure", pressureSensor->GetVoltage()); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pneumatics.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pneumatics.h deleted file mode 100644 index 7cbcb7cb97..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Pneumatics.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef Pneumatics_H -#define Pneumatics_H - -#include "Commands/Subsystem.h" -#include "WPILib.h" - -/** - * The Pneumatics subsystem contains the compressor and a pressure sensor. - * - * NOTE: The simulator currently doesn't support the compressor or pressure sensors. - */ -class Pneumatics: public Subsystem -{ -private: - std::shared_ptr pressureSensor; - #ifdef REAL - Compressor* compressor; - #endif - - static constexpr double MAX_PRESSURE = 2.55; - -public: - Pneumatics(); - - /** - * No default command - */ - void InitDefaultCommand(); - - /** - * Start the compressor going. The compressor automatically starts and stops as it goes above and below maximum pressure. - */ - void Start(); - - /** - * @return Whether or not the system is fully pressurized. - */ - bool IsPressurized(); - - /** - * Puts the pressure on the SmartDashboard. - */ - void WritePressure(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Shooter.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Shooter.cpp deleted file mode 100644 index 8f10c41ad5..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Shooter.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include "Shooter.h" - -Shooter::Shooter() : - Subsystem("Shooter"), - // Configure Devices - piston1(new DoubleSolenoid(3, 4)), - piston2(new DoubleSolenoid(5, 6)), - latchPiston(new Solenoid(1, 2)), - piston1ReedSwitchFront(new DigitalInput(9)), - piston1ReedSwitchBack(new DigitalInput(11)), - hotGoalSensor(new DigitalInput(7)) -{ - - // Put everything to the LiveWindow for testing. - LiveWindow::GetInstance()->AddSensor("Shooter", "Hot Goal Sensor", hotGoalSensor); - LiveWindow::GetInstance()->AddSensor("Shooter", "Piston1 Reed Switch Front ", piston1ReedSwitchFront); - LiveWindow::GetInstance()->AddSensor("Shooter", "Piston1 Reed Switch Back ", piston1ReedSwitchBack); - LiveWindow::GetInstance()->AddActuator("Shooter", "Latch Piston", latchPiston); -} - -void Shooter::InitDefaultCommand() -{ - // Set the default command for a subsystem here. - //SetDefaultCommand(new MySpecialCommand()); -} - -void Shooter::ExtendBoth() { - piston1->Set(DoubleSolenoid::kForward); - piston2->Set(DoubleSolenoid::kForward); -} - -void Shooter::RetractBoth() { - piston1->Set(DoubleSolenoid::kReverse); - piston2->Set(DoubleSolenoid::kReverse); -} - -void Shooter::Extend1() { - piston1->Set(DoubleSolenoid::kForward); -} - -void Shooter::Retract1() { - piston1->Set(DoubleSolenoid::kReverse); -} - -void Shooter::Extend2() { - piston2->Set(DoubleSolenoid::kReverse); -} - -void Shooter::Retract2() { - piston2->Set(DoubleSolenoid::kForward); -} - -void Shooter::Off1() { - piston1->Set(DoubleSolenoid::kOff); -} - -void Shooter::Off2() { - piston2->Set(DoubleSolenoid::kOff); -} - -void Shooter::Unlatch() { - latchPiston->Set(true); -} - -void Shooter::Latch() { - latchPiston->Set(false); -} - -void Shooter::ToggleLatchPosition() { - latchPiston->Set(!latchPiston->Get()); -} - -bool Shooter::Piston1IsExtended() { - return !piston1ReedSwitchFront->Get(); -} - -bool Shooter::Piston1IsRetracted() { - return !piston1ReedSwitchBack->Get(); -} - -void Shooter::OffBoth() { - piston1->Set(DoubleSolenoid::kOff); - piston2->Set(DoubleSolenoid::kOff); -} - -bool Shooter::GoalIsHot() { - return hotGoalSensor->Get(); -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Shooter.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Shooter.h deleted file mode 100644 index a80f22a549..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Subsystems/Shooter.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef Shooter_H -#define Shooter_H - -#include "Commands/Subsystem.h" -#include "WPILib.h" - -/** - * The Shooter subsystem handles shooting. The mechanism for shooting is - * slightly complicated because it has to pneumatic cylinders for shooting, and - * a third latch to allow the pressure to partially build up and reduce the - * effect of the airflow. For shorter shots, when full power isn't needed, only - * one cylinder fires. - * - * NOTE: Simulation currently approximates this as as single pneumatic cylinder - * and ignores the latch. - */ -class Shooter: public Subsystem -{ -private: - // Devices - std::shared_ptr piston1; - std::shared_ptr piston2; - std::shared_ptr latchPiston; - std::shared_ptr piston1ReedSwitchFront; - std::shared_ptr piston1ReedSwitchBack; - std::shared_ptr hotGoalSensor; // NOTE: Currently ignored in simulation - -public: - Shooter(); - void InitDefaultCommand(); - - /** - * Extend both solenoids to shoot. - */ - void ExtendBoth(); - - /** - * Retract both solenoids to prepare to shoot. - */ - void RetractBoth(); - - /** - * Extend solenoid 1 to shoot. - */ - void Extend1(); - - - /** - * Retract solenoid 1 to prepare to shoot. - */ - void Retract1(); - - /** - * Extend solenoid 2 to shoot. - */ - void Extend2(); - - /** - * Retract solenoid 2 to prepare to shoot. - */ - void Retract2(); - - /** - * Turns off the piston1 double solenoid. This won't actuate anything - * because double solenoids preserve their state when turned off. This - * should be called in order to reduce the amount of time that the coils are - * powered. - */ - void Off1(); - - /** - * Turns off the piston1 double solenoid. This won't actuate anything - * because double solenoids preserve their state when turned off. This - * should be called in order to reduce the amount of time that the coils are - * powered. - */ - void Off2(); - - /** - * Release the latch so that we can shoot - */ - void Unlatch(); - - /** - * Latch so that pressure can build up and we aren't limited by air flow. - */ - void Latch(); - - /** - * Toggles the latch postions - */ - void ToggleLatchPosition(); - - /** - * @return Whether or not piston 1 is fully extended. - */ - bool Piston1IsExtended(); - - /** - * @return Whether or not piston 1 is fully retracted. - */ - bool Piston1IsRetracted(); - - /** - * Turns off all double solenoids. Double solenoids hold their position when - * they are turned off. We should turn them off whenever possible to extend - * the life of the coils - */ - void OffBoth(); - - /** - * @return Whether or not the goal is hot as read by the banner sensor - */ - bool GoalIsHot(); -}; - -#endif diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Triggers/DoubleButton.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Triggers/DoubleButton.cpp deleted file mode 100644 index a07d2f0b6b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Triggers/DoubleButton.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/* - * DoubleButton.cpp - * - * Created on: Jun 24, 2014 - * Author: alex - */ - -#include "DoubleButton.h" - -DoubleButton::DoubleButton(Joystick* joy, int button1, int button2) { - this->joy = joy; - this->button1 = button1; - this->button2 = button2; -} - -bool DoubleButton::Get() { - return joy->GetRawButton(button1) && joy->GetRawButton(button2); -} - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Triggers/DoubleButton.h b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Triggers/DoubleButton.h deleted file mode 100644 index 91ff2eb85a..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PacGoat/src/Triggers/DoubleButton.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * DoubleButton.h - * - * Created on: Jun 24, 2014 - * Author: alex - */ - -#ifndef DOUBLEBUTTON_H_ -#define DOUBLEBUTTON_H_ - -#include "WPILib.h" - -class DoubleButton : public Trigger { -private: - Joystick* joy; - int button1, button2; - -public: - DoubleButton(Joystick* joy, int button1, int button2); - - bool Get(); -}; - -#endif /* DOUBLEBUTTON_H_ */ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Potentiometer/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Potentiometer/src/Robot.cpp deleted file mode 100644 index a5a10f4f79..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Potentiometer/src/Robot.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include "WPILib.h" - -/** - * This is a sample program to demonstrate the use of a soft potentiometer and proportional - * control to reach and maintain position setpoints on an elevator mechanism. A joystick - * button is used to switch elevator setpoints. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -class Robot: public SampleRobot -{ - - const int potChannel = 1; //analog input pin - const int motorChannel = 7; //PWM channel - const int joystickChannel = 0; //usb number in DriverStation - const int buttonNumber = 4; //joystick button - - const double pGain = 1.0; //proportional speed constant - double motorSpeed; - double currentPosition; //sensor voltage reading corresponding to current elevator position - - AnalogInput potentiometer; - Victor elevatorMotor; - Joystick joystick; - -public: - Robot() : - potentiometer(potChannel), elevatorMotor(motorChannel), - joystick(joystickChannel) {} - - /** - * Runs during autonomous. - */ - void Autonomous() - { - - } - - /** - * - */ - void OperatorControl() { - bool buttonState; - bool prevButtonState = false; - - int index = 0; //setpoint array index - double currentSetpoint; //holds desired setpoint - const int size = 3; //number of setpoints - const double setpoints[size] = {1.0, 2.6, 4.3}; //bottom, middle, and top elevator setpoints - currentSetpoint = setpoints[0]; //set to first setpoint - - while (IsOperatorControl() && IsEnabled()) { - buttonState = joystick.GetRawButton(buttonNumber); //check if button is pressed - - //if button has been pressed and released once - if (buttonState && !prevButtonState) { - index = (index + 1) % size; //increment set point, reset if at maximum - currentSetpoint = setpoints[index]; //set setpoint - } - prevButtonState = buttonState; //record previous button state - - currentPosition = potentiometer.GetAverageVoltage(); //get position value - motorSpeed = (currentPosition - currentSetpoint)*pGain; //convert position error to speed - elevatorMotor.Set(motorSpeed); //drive elevator motor - } - } - - /** - * Runs during test mode. - */ - void Test() - { - - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PotentiometerPID/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PotentiometerPID/src/Robot.cpp deleted file mode 100644 index c1b151fd87..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/PotentiometerPID/src/Robot.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include "WPILib.h" - -/** - * This is a sample program to demonstrate how to use a soft potentiometer and a PID - * Controller to reach and maintain position setpoints on an elevator mechanism. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ - -class Robot: public SampleRobot { - const int potChannel = 1; //analog input pin - const int motorChannel = 7; //PWM channel - const int joystickChannel = 0; //usb number in DriverStation - const int buttonNumber = 4; //button on joystick - - const double setPoints[3] = { 1.0, 2.6, 4.3 }; //bottom, middle, and top elevator setpoints - - //proportional, integral, and derivative speed constants; motor inverted - //DANGER: when tuning PID constants, high/inappropriate values for pGain, iGain, - //and dGain may cause dangerous, uncontrollable, or undesired behavior! - const double pGain = -5.0, iGain = -0.02, dGain = -2.0; //these may need to be positive for a non-inverted motor - - AnalogInput potentiometer; - Victor elevatorMotor; - Joystick joystick; - PIDController pidController; - -public: - Robot() : - //make objects for potentiometer, the elevator motor controller, and the joystick - potentiometer(potChannel), elevatorMotor(motorChannel), joystick(joystickChannel), - //potentiometer (AnalogInput) and elevatorMotor (Victor) can be used as a - //PIDSource and PIDOutput respectively. - //The PIDController has to take a pointer to the PIDSource and PIDOutput, so - //you must call &potentiometer and &elevatorMotor to get their pointers. - pidController(pGain, iGain, dGain, &potentiometer, &elevatorMotor) {} - - /** - * Runs during autonomous. - */ - void Autonomous() { - - } - - /** - * Uses a PIDController and an array of setpoints to switch and maintain elevator positions. - * The elevator setpoint is selected by a joystick button. - */ - void OperatorControl() { - pidController.SetInputRange(0, 5); //0 to 5V - pidController.SetSetpoint(setPoints[0]); //set to first setpoint - - int index = 0; - bool currentValue; - bool previousValue = false; - - while (IsOperatorControl() && IsEnabled()) { - pidController.Enable(); //begin PID control - - //when the button is pressed once, the selected elevator setpoint is incremented - currentValue = joystick.GetRawButton(buttonNumber); - if (currentValue && !previousValue) { - pidController.SetSetpoint(setPoints[index]); - index = (index + 1) % (sizeof(setPoints)/8); //index of elevator setpoint wraps around - } - previousValue = currentValue; - } - } - - /** - * Runs during test mode. - */ - void Test() { - - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/QuickVision/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/QuickVision/src/Robot.cpp deleted file mode 100644 index 5cf80ad325..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/QuickVision/src/Robot.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "WPILib.h" - -/** - * Uses the CameraServer class to automatically capture video from a USB webcam - * and send it to the FRC dashboard without doing any vision processing. This - * is the easiest way to get camera images to the dashboard. Just add this to the - * RobotInit() method in your program. - */ -class QuickVisionRobot : public SampleRobot -{ -public: - void RobotInit() override { - CameraServer::GetInstance()->SetQuality(50); - //the camera name (ex "cam0") can be found through the roborio web interface - CameraServer::GetInstance()->StartAutomaticCapture("cam0"); - } - - void OperatorControl() - { - while (IsOperatorControl() && IsEnabled()) - { - /** robot code here! **/ - Wait(0.005); // wait for a motor update time - } - } -}; - -START_ROBOT_CLASS(QuickVisionRobot) - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Relay/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Relay/src/Robot.cpp deleted file mode 100644 index c9c42a4baf..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Relay/src/Robot.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "WPILib.h" - -/** - * This is a sample program which uses joystick buttons to control a relay. - * A Relay (generally a spike) has two outputs, each of which can be at either - * 0V or 12V and so can be used for actions such as turning a motor off, - * full forwards, or full reverse, and is generally used on the compressor. - * This program uses two buttons on a joystick and each button corresponds to - * one output; pressing the button sets the output to 12V and releasing sets - * it to 0V. - * During Operator Control, the loop waits for a brief time before continuing - * in order to allow other threads to run. This is generally a good idea, - * especially as joystick values are only received every 20ms. - */ -class Robot: public SampleRobot -{ - // Joystick with which to control the relay. - Joystick m_stick; - - // Relay to use for the - Relay m_relay; - - // Numbers of the buttons to be used for controlling the Relay. - const int kRelayForwardButton = 1; - const int kRelayReverseButton = 2; - - // Update every 5milliseconds/0.005 seconds. - const double kUpdatePeriod = 0.005; - -public: - Robot() : - m_stick(0), // Use joystick on port 0. - m_relay(0) // Relay on port 0. - { - } - - /** - * Control a Relay using Joystick buttons. - */ - void OperatorControl() - { - while (IsOperatorControl() && IsEnabled()) - { - // Retrieve the button values. GetRawButton will return - // true if the button is pressed and false if not. - bool forward = m_stick.GetRawButton(kRelayForwardButton); - bool reverse = m_stick.GetRawButton(kRelayReverseButton); - - // Depending on the button values, we want to use one of - // kOn, kOff, kForward, or kReverse. - // kOn sets both outputs to 12V, kOff sets both to 0V, - // kForward sets forward to 12V and reverse to 0V, and - // kReverse sets reverse to 12V and forward to 0V. - if (forward && reverse) - m_relay.Set(Relay::kOn); - else if (forward) - m_relay.Set(Relay::kForward); - else if (reverse) - m_relay.Set(Relay::kReverse); - else - m_relay.Set(Relay::kOff); - - // Insert 5ms delay in loop. - Wait(kUpdatePeriod); - } - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Solenoid/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Solenoid/src/Robot.cpp deleted file mode 100644 index f16faccb44..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Solenoid/src/Robot.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "WPILib.h" - -/** - * This is a sample program showing the use of the solenoid classes during - * operator control. - * Three buttons from a joystick will be used to control two solenoids: - * One button to control the position of a single solenoid and the other - * two buttons to control a double solenoid. - * Single solenoids can either be on or off, such that the air diverted through - * them goes through either one channel or the other. - * Double solenoids have three states: Off, Forward, and Reverse. Forward and - * Reverse divert the air through the two channels and correspond to the - * on and off of a single solenoid, but a double solenoid can also be "off", - * where both channels are diverted to exhaust such that there is no pressure - * in either channel. - * Additionally, double solenoids take up two channels on your PCM whereas - * single solenoids only take a single channel. - * During Operator Control, the loop waits for a brief time before continuing - * in order to allow other threads to run. This is generally a good idea, - * especially as joystick values are only received every 20ms. - */ -class Robot: public SampleRobot -{ - // Joystick with buttons to control solenoids with. - Joystick m_stick; - // Solenoids to control with the joystick. - // Solenoid corresponds to a single solenoid. - Solenoid m_solenoid; - // DoubleSolenoid corresponds to a double solenoid. - DoubleSolenoid m_doubleSolenoid; - - // Update every 5milliseconds/0.005 seconds. - const double kUpdatePeriod = 0.005; - - // Numbers of the buttons to use for triggering the solenoids. - const int kSolenoidButton = 1; - const int kDoubleSolenoidForward = 2; - const int kDoubleSolenoidReverse = 3; - -public: - Robot() : - m_stick(0), // Use joystick on port 0. - m_solenoid(0), // Use solenoid on channel 0. - // Use double solenoid with Forward Channel of 1 and Reverse of 2. - m_doubleSolenoid(1, 2) - { - } - - /** - * Sets the solenoids from the position of joystick buttons. - */ - void OperatorControl() - { - while (IsOperatorControl() && IsEnabled()) - { - // The output of GetRawButton is true/false depending on whether - // the button is pressed; Set takes a boolean for for whether to - // use the default (false) channel or the other (true). - m_solenoid.Set(m_stick.GetRawButton(kSolenoidButton)); - - // In order to set the double solenoid, we will say that if neither - // button is pressed, it is off, if just one button is pressed, - // set the solenoid to correspond to that button, and if both - // are pressed, set the solenoid to Forwards. - if (m_stick.GetRawButton(kDoubleSolenoidForward)) - m_doubleSolenoid.Set(DoubleSolenoid::kForward); - else if (m_stick.GetRawButton(kDoubleSolenoidReverse)) - m_doubleSolenoid.Set(DoubleSolenoid::kReverse); - else - m_doubleSolenoid.Set(DoubleSolenoid::kOff); - - Wait(kUpdatePeriod); // wait for a motor update time - } - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Ultrasonic/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Ultrasonic/src/Robot.cpp deleted file mode 100644 index 8b74316cc0..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/Ultrasonic/src/Robot.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "WPILib.h" - -/** - * This is a sample program demonstrating how to use an ultrasonic sensor and proportional - * control to maintain a set distance from an object. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -class Robot: public SampleRobot { - AnalogInput ultrasonic; //ultrasonic sensor - RobotDrive myRobot; - -public: - const int ultrasonicChannel = 3; //analog input pin - - //channels for motors - const int leftMotorChannel = 1; - const int rightMotorChannel = 0; - const int leftRearMotorChannel = 3; - const int rightRearMotorChannel = 2; - - int holdDistance = 12; //distance in inches the robot wants to stay from an object - const double valueToInches = 0.125; //factor to convert sensor values to a distance in inches - const double pGain = 0.05; //proportional speed constant - - - Robot() : - ultrasonic(ultrasonicChannel), - myRobot(new CANTalon(leftMotorChannel), new CANTalon(leftRearMotorChannel), - new CANTalon(rightMotorChannel), new CANTalon(rightRearMotorChannel)) {} - - /** - * Runs during autonomous. - */ - void Autonomous() { - - } - - /** - * Tells the robot to drive to a set distance (in inches) from an object using - * proportional control. - */ - void OperatorControl() { - - double currentDistance; //distance measured from the ultrasonic sensor values - double currentSpeed; //speed to set the drive train motors - - while (IsOperatorControl() && IsEnabled()) { - currentDistance = ultrasonic.GetValue() * valueToInches; //sensor returns a value from 0-4095 that is scaled to inches - currentSpeed = (holdDistance - currentDistance) * pGain; //convert distance error to a motor speed - myRobot.Drive(currentSpeed, 0); //drive robot - } - } - - /** - * Runs during test mode - */ - void Test() { - - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/UltrasonicPID/src/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/UltrasonicPID/src/Robot.cpp deleted file mode 100644 index ed5ca254c5..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/UltrasonicPID/src/Robot.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "WPILib.h" - -/** - * This is a sample program to demonstrate the use of a PID Controller with an ultrasonic - * sensor to reach and maintain a set distance from an object. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -class Robot: public SampleRobot { - AnalogInput ultrasonic; //ultrasonic sensor - RobotDrive myRobot; - PIDController pidController; - -public: - const int ultrasonicChannel = 3; //analog input - - //channels for motors - const int leftMotorChannel = 1; - const int rightMotorChannel = 0; - const int leftRearMotorChannel = 3; - const int rightRearMotorChannel = 2; - - int holdDistance = 12; //distance in inches the robot wants to stay from an object - - //proportional, integral, and derivative speed constants - //DANGER: when tuning PID constants, high/inappropriate values for pGain, iGain, - //and dGain may cause dangerous, uncontrollable, or undesired behavior! - const double pGain = 7, iGain = .018, dGain = 1.5; - - //conversion factor specific to the sensor being used. For this sensor, - //the sensor returned values from 0.0V to 5.0V with a resolution of 9.8mV/in. - const double VoltsToInches = 0.0098; - - //internal class to write to myRobot (a RobotDrive object) using a PIDOutput - class MyPIDOutput: public PIDOutput { - public: - RobotDrive &rd; - MyPIDOutput(RobotDrive &r) : rd(r) - { - rd.SetSafetyEnabled(false); - } - void PIDWrite(float output) { - rd.Drive(output, 0); //write to myRobot (RobotDrive) by reference - } - }; - - Robot() : - //make objects for sensor and drive train - ultrasonic(ultrasonicChannel), - myRobot(new CANTalon(leftMotorChannel), new CANTalon(leftRearMotorChannel), - new CANTalon(rightMotorChannel), new CANTalon(rightRearMotorChannel)), - //ultrasonic (AnalogInput) can be used as a PIDSource without modification, - //PIDOutput is an instance of the internal class MyPIDOutput made earlier - pidController(pGain, iGain, dGain, &ultrasonic, new MyPIDOutput(myRobot)) {} - - /** - * Runs during autonomous. - */ - void Autonomous() - { - - } - - /** - * Drives robot to set distance from an object using PID control and the ultrasonic - * sensor. - */ - void OperatorControl() { - pidController.SetSetpoint(holdDistance * VoltsToInches); //set setpoint to 12 inches - - //set expected range to 0-24 inches; e.g. at 24 inches from object go full - //forward, at 0 inches from object go full backward. - pidController.SetInputRange(0, 24 * VoltsToInches); - - while (IsOperatorControl() && IsEnabled()) { - pidController.Enable(); //begin PID control - } - } - - /** - * Runs during test mode. - */ - void Test() - { - - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/examples.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/examples.xml deleted file mode 100644 index a0d0a07f33..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/examples/examples.xml +++ /dev/null @@ -1,687 +0,0 @@ - - - - - - Getting Started with C++ - Examples for getting started with FRC C++ - - - - CommandBased Robot - Examples for CommandBased robot programs. - - - - Actuators - Example programs that demonstrate the use of various actuators - - - - Analog - Examples programs that show different uses of analog inputs, - outputs and various analog sensors - - - - CAN - Example programs that demonstrate the use of the CAN components in the control system - - - - Complete List - Complete list of all sample programs across all categories - - - - Digital - Example programs that demonstrate the sensors that use the digital I/O ports - - - - I2C - Example programs that demonstrate the use of I2C and various sensors that use it - - - - Joystick - Example programs that demonstate different uses of joysticks for robot driving - - - - Pneumatics - Example programs that demonstrate the use of the compressor and solenoids - - - - Robot and Motor - Example programs that demonstrate driving a robot and motors including safety, servos, etc. - - - - SPI - Example programs that demonstrate the use of the SPI bus and sensors that connect to it - - - - Safety - Example programs that demonstate the motor safety classes and how to use them with your programs - - - - Sensors - Example programs that demonstrate the use of the various commonly used sensors on FRC robots - - - - Vision - Example programs that demonstrate the use of a camera for image acquisition and processing - - - - Motor Controller - Demonstrate controlling a single motor with a Joystick. - - Robot and Motor - Actuators - Joystick - Complete List - - - src - - - - - - - - Motor Control With Encoder - Demonstrate controlling a single motor with a Joystick and displaying the net movement of the motor using an encoder. - - Robot and Motor - Digital - Sensors - Actuators - Joystick - Complete List - - - src - - - - - - - - CAN Talon SRX - Quick demo of running the SRX at a given throttle value. - - Robot and Motor - Digital - Actuators - Complete List - - - src - - - - - - - - CAN Talon SRX PID - Quick demo of running the SRX with a PID loop. - - Robot and Motor - Digital - Actuators - Complete List - - - src - - - - - - - - Relay - Demonstrate controlling a Relay from Joystick buttons. - - Actuators - Joystick - Complete List - - - src - - - - - - - - PDP CAN Monitoring - Demonstrate using CAN to monitor the voltage, current, and temperature in the Power Distribution Panel. - - Complete List - CAN - Sensors - - - src - - - - - - - - Solenoids - Demonstrate controlling a single and double solenoid from Joystick buttons. - - Actuators - Joystick - Pneumatics - Complete List - - - src - - - - - - - - Encoder - Demonstrate displaying the value of a quadrature encoder on the SmartDashboard. - - Complete List - Digital - Sensors - - - src - - - - - - - - Arcade Drive - An example program which the use of Arcade Drive with the RobotDrive class - - Getting Started with C++ - Robot and Motor - Joystick - Complete List - - - src - - - - - - - - - Mecanum Drive - An example program which the use of Mecanum Drive with the RobotDrive class - - Getting Started with C++ - Robot and Motor - Joystick - Complete List - - - src - - - - - - - - - Ultrasonic - Demonstrate maintaining a set distance using an ultrasonic sensor. - - Robot and Motor - CAN - Complete List - Sensors - Analog - - - src - - - - - - - - - UltrasonicPID - Demonstrate maintaining a set distance using an ultrasonic sensor and PID control. - - Robot and Motor - CAN - Complete List - Sensors - Analog - - - src - - - - - - - - - Gyro - An example program showing how to drive straight with using a gyro sensor. - - Robot and Motor - CAN - Complete List - Sensors - Analog - Joystick - - - src - - - - - - - - - Gyro Mecanum - An example program showing how to perform mecanum drive with field oriented controls. - - Robot and Motor - CAN - Complete List - Sensors - Analog - Joysitck - - - src - - - - - - - - - PotentiometerPID - An example to demonstrate the use of a potentiometer and PID control to reach elevator position setpoints. - - Joystick - Actuators - Complete List - Sensors - Analog - - - src - - - - - - - - - Potentiometer - An example to demonstrate the use of a potentiometer and basic proportional control to reach elevator position setpoints. - - Joystick - Actuators - Complete List - Sensors - Analog - - - src - - - - - - - - - Getting Started - An example program which demonstrates the simplest autonomous and - teleoperated routines. - - Getting Started with C++ - Complete List - - - src - - - - - - - - Simple Vision - The minimal program to acquire images from an attached USB camera on the robot - and send them to the dashboard. - - Vision - Complete List - - - src - - - - - - - - Intermediate Vision - An example program that acquires images from an attached USB camera and adds some - annotation to the image as you might do for showing operators the result of some image - recognition, and sends it to the dashboard for display. - - - Vision - Complete List - - - src - - - - - - - - Axis Camera Sample - An example program that acquires images from an Axis network camera and adds some - annotation to the image as you might do for showing operators the result of some image - recognition, and sends it to the dashboard for display. This demonstrates the use of the - AxisCamera class. - - - Vision - Complete List - - - src - - - - - - - - 2015 Vision Color Sample - An example program that demonstrates image processing to locate Yellow totes by color. - This example uses a file which must be copied over to the roboRIO via FTP to demonstrate processing. - To use this code with a camera, you must integrate the code for image acquisition from the appropriate - camera example; - - - Vision - Complete List - - - src - - - - - - - - 2015 Vision Retro Sample - An example program that demonstrates image processing to locate Yellow totes by the retroreflective target. - This example uses a file which must be copied over to the roboRIO via FTP to demonstrate processing. - To use this code with a camera, you must integrate the code for image acquisition from the appropriate - camera example; - - - Vision - Complete List - - - src - - - - - - - - GearsBot - A fully functional example CommandBased program for - WPIs GearsBot robot. This code can run on your computer if it - supports simulation. - - CommandBased Robot - Complete List - - /usr/share/frcsim/worlds/GearsBotDemo.world - - src - src/Commands - src/Subsystems - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PacGoat - A fully functional example CommandBased program for FRC Team 190's 2014 robot. This code can run on your computer if it supports simulation. - - CommandBased Robot - Complete List - - /usr/share/frcsim/worlds/PacGoat2014.world - - src - src/Commands - src/Subsystems - src/Triggers - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/iterative/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/iterative/Robot.cpp deleted file mode 100644 index 44af60fd59..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/iterative/Robot.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "WPILib.h" - -class Robot: public IterativeRobot -{ -private: - LiveWindow *lw = LiveWindow::GetInstance(); - - void RobotInit() - { - } - - void AutonomousInit() - { - - } - - void AutonomousPeriodic() - { - - } - - void TeleopInit() - { - - } - - void TeleopPeriodic() - { - - } - - void TestPeriodic() - { - lw->Run(); - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/sample/Robot.cpp b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/sample/Robot.cpp deleted file mode 100644 index c360da0671..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/resources/templates/sample/Robot.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "WPILib.h" - -/** - * This is a demo program showing the use of the RobotDrive class. - * The SampleRobot class is the base of a robot application that will automatically call your - * Autonomous and OperatorControl methods at the right time as controlled by the switches on - * the driver station or the field controls. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -class Robot: public SampleRobot -{ - RobotDrive myRobot; // robot drive system - Joystick stick; // only joystick - -public: - Robot() : - myRobot(0, 1), // these must be initialized in the same order - stick(0) // as they are declared above. - { - myRobot.SetExpiration(0.1); - } - - /** - * Drive left & right motors for 2 seconds then stop - */ - void Autonomous() - { - myRobot.SetSafetyEnabled(false); - myRobot.Drive(-0.5, 0.0); // drive forwards half speed - Wait(2.0); // for 2 seconds - myRobot.Drive(0.0, 0.0); // stop robot - } - - /** - * Runs the motors with arcade steering. - */ - void OperatorControl() - { - myRobot.SetSafetyEnabled(true); - while (IsOperatorControl() && IsEnabled()) - { - myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick) - Wait(0.005); // wait for a motor update time - } - } - - /** - * Runs during test mode - */ - void Test() - { - } -}; - -START_ROBOT_CLASS(Robot) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/WPILibCPPPlugin.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/WPILibCPPPlugin.java deleted file mode 100644 index 1022c37584..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/WPILibCPPPlugin.java +++ /dev/null @@ -1,92 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp; - -import java.io.File; -import java.util.Properties; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Status; -import org.eclipse.ui.IStartup; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; -import edu.wpi.first.wpilib.plugins.core.ant.AntPropertiesParser; -import edu.wpi.first.wpilib.plugins.cpp.installer.CPPInstaller; -import edu.wpi.first.wpilib.plugins.cpp.preferences.PreferenceConstants; - -/** - * The activator class controls the plug-in life cycle - */ -public class WPILibCPPPlugin extends AbstractUIPlugin implements IStartup { - - // The plug-in ID - public static final String PLUGIN_ID = "WPILib_CPP_Robot_Development"; //$NON-NLS-1$ - - // The shared instance - private static WPILibCPPPlugin plugin; - - /** - * The constructor - */ - public WPILibCPPPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static WPILibCPPPlugin getDefault() { - return plugin; - } - - public String getCurrentVersion() { - try { - Properties props = new AntPropertiesParser(WPILibCPPPlugin.class.getResourceAsStream("/resources/configuration.properties")).getProperties(); - if (props.getProperty("version").startsWith("$")) { - return "DEVELOPMENT"; - } else { - return props.getProperty("version"); - } - } catch (CoreException e) { - return "DEVELOPMENT"; - } - } - - public String getCPPDir() { - return WPILibCore.getDefault().getWPILibBaseDir() - + File.separator + "cpp" + File.separator + "current"; - } - - @Override - public void earlyStartup() { - new CPPInstaller(getCurrentVersion()).installIfNecessary(); - } - - - public static void logInfo(String msg) { - getDefault().getLog().log(new Status(Status.INFO, PLUGIN_ID, Status.OK, msg, null)); - } - - public static void logError(String msg, Exception e) { - getDefault().getLog().log(new Status(Status.ERROR, PLUGIN_ID, Status.OK, msg, e)); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/installer/CPPInstaller.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/installer/CPPInstaller.java deleted file mode 100644 index d4c487681a..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/installer/CPPInstaller.java +++ /dev/null @@ -1,62 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.installer; - -import java.io.InputStream; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.variables.IStringVariableManager; -import org.eclipse.core.variables.IValueVariable; -import org.eclipse.core.variables.VariablesPlugin; - -import edu.wpi.first.wpilib.plugins.core.installer.AbstractInstaller; -import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin; -import edu.wpi.first.wpilib.plugins.cpp.preferences.PreferenceConstants; - -/** - * Installs the given version of WPILib into the correct location. Where the - * install directory is usually ~/wpilib/cpp/version. - * - * @author alex - */ -public class CPPInstaller extends AbstractInstaller { - - public CPPInstaller(String version) { - super(version, - WPILibCPPPlugin.getDefault().getPreferenceStore().getString(PreferenceConstants.LIBRARY_INSTALLED), WPILibCPPPlugin.getDefault().getCPPDir()); - } - @Override - protected void updateInstalledVersion(String version) { - WPILibCPPPlugin.getDefault().getPreferenceStore().setValue(PreferenceConstants.LIBRARY_INSTALLED, - version); - - IStringVariableManager vm = VariablesPlugin.getDefault().getStringVariableManager(); - try - { - if (System.getProperty("os.name").startsWith("Windows")) - { - IValueVariable vv = vm.getValueVariable("HOME"); - if (vv == null) - vm.addVariables(new IValueVariable[]{vm.newValueVariable("HOME", "user.home directory", false,System.getProperty("user.home"))}); - else - { - if (!System.getProperty("user.home").equals(vm.performStringSubstitution("${HOME}"))) - vv.setValue(System.getProperty("user.home")); - } - } - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - @Override - protected InputStream getInstallResourceStream() { - return CPPInstaller.class.getResourceAsStream("/resources/cpp.zip"); - } - - @Override - protected String getFeatureName() - { - return "cpp"; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/launching/DeployLaunchShortcut.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/launching/DeployLaunchShortcut.java deleted file mode 100644 index 5f0dab4af8..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/launching/DeployLaunchShortcut.java +++ /dev/null @@ -1,225 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.launching; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.io.File; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.core.executables.Executable; -import org.eclipse.cdt.debug.core.executables.ExecutablesManager; -import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants; -import org.eclipse.cdt.launch.remote.IRemoteConnectionConfigurationConstants; -import org.eclipse.core.internal.resources.Resource; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.ILaunchShortcut; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PlatformUI; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; -import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin; -import edu.wpi.first.wpilib.plugins.core.launching.AntLauncher; - -/** - * Launch shortcut base functionality, common for deploying to the robot. - * Retrieves the project the operation is being called on, and runs the correct - * ant targets based on polymorphically determined data values - * - * @author Ryan O'Meara - * @author Alex Henning - */ -@SuppressWarnings("restriction") -public class DeployLaunchShortcut implements ILaunchShortcut -{ - // Class constants - used to delineate types for launch shortcuts - public static final String DEPLOY_TYPE = "edu.wpi.first.wpilib.plugins.core.deploy"; - - /** - * Returns the launch type of the shortcut that was used, one of the - * constants defined in BaseLaunchShortcut - * - * @return Launch shortcut type - */ - public String getLaunchType() - { - return DEPLOY_TYPE; - } - - @Override - public void launch(ISelection selection, String mode) - { - // Extract resource from selection - StructuredSelection sel = (StructuredSelection) selection; - IProject activeProject = null; - if (sel.getFirstElement() instanceof IProject) { - activeProject = (IProject) sel.getFirstElement(); - } else { - WPILibCPPPlugin.logError("Selection isn't a project: "+sel.toString(), null); - return; - } - - // Run config using project found in extracted resource, with indicated - // mode - runConfig(activeProject, mode, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); - } - - @Override - public void launch(IEditorPart editor, String mode) - { - // Extract resource from editor - if (editor != null) { - IFileEditorInput input = (IFileEditorInput) editor.getEditorInput(); - IFile file = input.getFile(); - IProject activeProject = file.getProject(); - - // If editor existed, run config using extracted resource in - // indicated mode - runConfig(activeProject, mode, editor.getSite().getWorkbenchWindow().getShell()); - } else { - WPILibCPPPlugin.logError("Editor was null.", null); - } - - } - - /** - * - * @param activeProj - * The project that the script will be run on/from - * @param mode - * The mode it will be run in (ILaunchManager.RUN_MODE or - * ILaunchManager.DEBUG_MODE) - */ - public void runConfig(IProject activeProj, String mode, Shell shell) { - - // Checks to see if there are any build errors remaining. - boolean buildSucceeded = true; - // Unfortunately, build() does not return whether or not the - // build succeded, so we instead must check the markers for - // errors and hope that we don't accidentally catch any - // false-positives. - try { - activeProj.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null); - } - catch (CoreException e) { - buildSucceeded = false; - WPILibCPPPlugin.logError("Build failed.", e); - } - - try { - IMarker[] problems = activeProj.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE); - for (int i = 0; i < problems.length; i++) { - if (problems[i].getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) - == IMarker.SEVERITY_ERROR - && problems[i].getType() == "org.eclipse.cdt.core.problem") { - buildSucceeded = false; - break; - } - } - } - catch (CoreException e) { - buildSucceeded = false; - WPILibCPPPlugin.logError("Failed to check whether the build worked.", e); - } - - if (!buildSucceeded) { - boolean cont = MessageDialog.openQuestion(shell, "Build Failed", - "The build failed; Are you sure that you want to continue the deploy?"); - if (!cont) return; - } - - // Check to ensure that there really is a binary file to upload; this is - // only really relevant if the build fails, but we check anyways. - Collection exes = - ExecutablesManager.getExecutablesManager().getExecutablesForProject(activeProj); - if (!(exes.size() > 1 - || new File(activeProj.getLocation().toOSString() + File.separator - + "Debug" + File.separator + "FRCUserProgram").isFile())) { - MessageDialog.openWarning(shell, "Bad Executable", - "No executable binary was found to upload to the robot."); - return; - } - - if(mode.equals(ILaunchManager.RUN_MODE)) { - // Regular deploys are done with an ant script for now, for both - // C++ and Java. - WPILibCPPPlugin.logInfo("Running ant file: " + activeProj.getLocation().toOSString() + File.separator + "build.xml"); - WPILibCPPPlugin.logInfo("Targets: deploy, Mode: " + mode); - AntLauncher.runAntFile(new File (activeProj.getLocation().toOSString() + File.separator + "build.xml"), "deploy", null, mode); - } else { - // Debug deploys are done with the Eclipse Remote System Explorer, - // which lets it work with Eclipse's C++ debugger. - - // Kill running program before using RSE as RSE can't - WPILibCPPPlugin.logInfo("Running ant file: " + activeProj.getLocation().toOSString() + File.separator + "build.xml"); - WPILibCPPPlugin.logInfo("Targets: kill-program, Mode: " + mode); - AntLauncher.runAntFile(new File (activeProj.getLocation().toOSString() + File.separator + "build.xml"), "kill-program", null, mode); - - // TODO: figure out UI issues. that's why this is undocumented - ILaunchConfigurationWorkingCopy config; - try { - config = getRemoteDebugConfig(activeProj); - DebugUITools.launch(config.doSave(), mode); - } catch (CoreException e) { - WPILibCPPPlugin.logError("Debug attach failed.", e); - } - - try { - activeProj.refreshLocal(Resource.DEPTH_INFINITE, null); - } catch (Exception e) {} - } - } - - private ILaunchConfigurationWorkingCopy getRemoteDebugConfig(IProject activeProj) throws CoreException - { - ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); - ILaunchConfigurationType type = manager.getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_REMOTE_APP); - int teamNumber = WPILibCore.getDefault().getTeamNumber(activeProj); - String remote_connection = RSEUtils.getTarget(teamNumber).getName(); - - ILaunchConfigurationWorkingCopy config = type.newInstance(null, activeProj.getName()); - config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, ""); - config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_REGISTER_BOOKKEEPING, false); - config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ENABLE_VARIABLE_BOOKKEEPING, false); - config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, "org.eclipse.rse.remotecdt.RemoteGDBDebugger"); - config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_REGISTER_GROUPS, ""); - config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, "remote"); - config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, false); - config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, true); - config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, activeProj.getName()); - Collection exes = ExecutablesManager.getExecutablesManager().getExecutablesForProject(activeProj); - config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, - exes.size() > 0 ? exes.toArray(new Executable[0])[0].getPath().makeRelativeTo(activeProj.getLocation()).toString(): - "Debug/FRCUserProgram"); - - config.setAttribute("org.eclipse.cdt.dsf.gdb.DEBUG_NAME", "arm-frc-linux-gnueabi-gdb"); - config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH, "/home/lvuser/FRCUserProgram"); - config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION, remote_connection); - config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_SKIP_DOWNLOAD_TO_TARGET, false); - config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_PORT, "2345"); - config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_GDBSERVER_COMMAND, "gdbserver"); - - List solibs = new ArrayList<>(); - solibs.add(WPILibCPPPlugin.getDefault().getCPPDir() + "/lib"); - config.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, solibs); - config.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB, true); - config.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS, false); - return config; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/launching/RSEUtils.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/launching/RSEUtils.java deleted file mode 100644 index df68dfaeaf..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/launching/RSEUtils.java +++ /dev/null @@ -1,56 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.launching; - -import java.util.Arrays; - -import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.PasswordPersistenceManager; -import org.eclipse.rse.core.RSECorePlugin; -import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemRegistry; -import org.eclipse.rse.core.model.SystemSignonInformation; - -import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin; - -public class RSEUtils { - - public static IHost getTarget(int teamNumber) { - // The ip address based on the team number - //String hostName = "10."+(teamNumber/100)+"."+(teamNumber%100)+".2"; - //String connectionName = hostName; //"Team "+teamNumber; - String hostName = "roboRIO-" + teamNumber + "-FRC.local"; - String connectionName = hostName; - - // get the singleton RSE registry - try { - RSECorePlugin.waitForInitCompletion(); - } catch (InterruptedException e) { - WPILibCPPPlugin.logError("Error initializing RSE", e); - } - ISystemRegistry registry = RSECorePlugin.getDefault().getSystemRegistry(); - - // get the default profile, used to store connections - WPILibCPPPlugin.logInfo("Profiles: "+Arrays.toString(registry.getActiveSystemProfiles())); - ISystemProfile profile = registry.getActiveSystemProfiles()[0]; - - // see if a host object already exists for "build.eclipse.org" - IHost host = registry.getHost(profile, connectionName); - if (host == null) { - // if there's no host then we will create it - try { - // create the host object as an SSH Only connection - IRSESystemType systemType = - RSECorePlugin.getTheCoreRegistry().getSystemTypeById("org.eclipse.rse.systemtype.ssh"); - host = registry.createHost(profile.getName(), systemType, connectionName, hostName, - "The remote target for debugging the robot for team "+teamNumber+"."); - host.setDefaultUserId("lvuser"); - SystemSignonInformation info = new SystemSignonInformation(hostName, "lvuser", - "", systemType); - PasswordPersistenceManager.getInstance().add(info, true, false); - } catch (Exception e) { - WPILibCPPPlugin.logError("Error connecting to RoboRIO.", e); - } - } - return host; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/launching/SimulateLaunchShortcut.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/launching/SimulateLaunchShortcut.java deleted file mode 100644 index 334c2ed621..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/launching/SimulateLaunchShortcut.java +++ /dev/null @@ -1,145 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.launching; - -import java.io.File; -import java.lang.reflect.Method; -import java.util.Vector; - -import org.eclipse.core.internal.resources.Resource; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.debug.ui.ILaunchShortcut; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PlatformUI; - -import edu.wpi.first.wpilib.plugins.core.launching.AntLauncher; -import edu.wpi.first.wpilib.plugins.core.launching.SimulationNotification; -import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin; - -/** - * Launch shortcut base functionality, common for deploying to the robot. - * Retrieves the project the operation is being called on, and runs the correct - * ant targets based on polymorphically determined data values - * - * @author Ryan O'Meara - * @author Alex Henning - */ -@SuppressWarnings("restriction") -public class SimulateLaunchShortcut implements ILaunchShortcut { - //Class constants - used to delineate types for launch shortcuts - public static final String DEPLOY_TYPE = "edu.wpi.first.wpilib.plugins.core.deploy"; - private static final String ANT_SERVER_THREAD_NAME = "Ant Build Server Connection"; - - private static ILaunch lastDeploy = null; - - /** - * Returns the launch type of the shortcut that was used, one of the constants - * defined in BaseLaunchShortcut - * @return Launch shortcut type - */ - public String getLaunchType() {return DEPLOY_TYPE;} - - @Override - public void launch(ISelection selection, String mode) { - //Extract resource from selection - StructuredSelection sel = (StructuredSelection)selection; - IProject activeProject = null; - if (sel.getFirstElement() instanceof IProject) { - activeProject = (IProject) sel.getFirstElement(); - } else { - return; - } - - //Run config using project found in extracted resource, with indicated mode - runConfig(activeProject, mode); - } - - @Override - public void launch(IEditorPart editor, String mode) { - //Extract resource from editor - if(editor != null){ - IFileEditorInput input = (IFileEditorInput)editor.getEditorInput(); - IFile file = input.getFile(); - IProject activeProject = file.getProject(); - - //If editor existed, run config using extracted resource in indicated mode - runConfig(activeProject, mode); - }else{ - System.err.println("editor was null"); - } - - } - - /** - * Runs the ant script using the correct target for the indicated mode (deploy to cRIO or just compile) - * @param activeProj The project that the script will be run on/from - * @param mode The mode it will be run in (ILaunchManager.RUN_MODE or ILaunchManager.DEBUG_MODE) - */ - public void runConfig(IProject activeProj, String mode) { - if (!SimulationNotification.supportsSimulation()) { - SimulationNotification.showUnsupported(); - return; - } - - String targets = "simulate"; - - if(mode.equals(ILaunchManager.RUN_MODE)){ - if(getLaunchType().equals(DEPLOY_TYPE)){ - targets = "simulate"; - } - } else if ((mode.equals(ILaunchManager.DEBUG_MODE))&&(getLaunchType().equals(DEPLOY_TYPE))) { - targets = "debug-simulate"; - try{ - PlatformUI.getWorkbench().showPerspective(IDebugUIConstants.ID_DEBUG_PERSPECTIVE, - PlatformUI.getWorkbench().getActiveWorkbenchWindow()); - - }catch(Exception e){} - } - - if((lastDeploy != null)&&(!lastDeploy.isTerminated())){ - WPILibCPPPlugin.logInfo("Last deploy running"); - // Find the server connection thread and kill it - Vector threadGroups = new Vector(); - ThreadGroup root = Thread.currentThread().getThreadGroup().getParent(); - while (root.getParent() != null) {root = root.getParent();} - threadGroups.add(root); - ThreadGroup threadGroup = threadGroups.remove(0); - int numThreads = threadGroup.activeCount(); - Thread[] threads = new Thread[numThreads*100]; - numThreads = threadGroup.enumerate(threads, true); - - for(Thread current: threads){ - if(current != null){ - if(current.getName().equals(ANT_SERVER_THREAD_NAME)){ - try { - // Manually end thread and then try terminating launch - Method stopMethod = current.getClass().getMethod("stop"); - stopMethod.invoke(current); - lastDeploy.terminate(); - break; - } catch(Exception e){ - WPILibCPPPlugin.logError("Error killing ant thread.", e); - } - } - } - } - - WPILibCPPPlugin.logInfo("Waiting"); - try{wait(1000);}catch(Exception e){} - } - - WPILibCPPPlugin.logInfo("Running ant file: " + activeProj.getLocation().toOSString() + File.separator + "build.xml"); - WPILibCPPPlugin.logInfo("Targets: " + targets + ", Mode: " + mode); - lastDeploy = AntLauncher.runAntFile(new File (activeProj.getLocation().toOSString() + File.separator + "build.xml"), targets, null, mode); - - try { - activeProj.refreshLocal(Resource.DEPTH_INFINITE, null); - } catch (Exception e) {} - } -} - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/preferences/PreferenceConstants.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/preferences/PreferenceConstants.java deleted file mode 100644 index 3598e5e32d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/preferences/PreferenceConstants.java +++ /dev/null @@ -1,8 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.preferences; - -/** - * Constant definitions for plug-in preferences - */ -public class PreferenceConstants { - public static final String LIBRARY_INSTALLED = "libraryVersion_current"; -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/preferences/PreferenceInitializer.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/preferences/PreferenceInitializer.java deleted file mode 100644 index b4241e92a2..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/preferences/PreferenceInitializer.java +++ /dev/null @@ -1,25 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.preferences; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.preference.IPreferenceStore; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; -import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin; - -/** - * Class used to initialize default preference values. - */ -public class PreferenceInitializer extends AbstractPreferenceInitializer { - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() - */ - public void initializeDefaultPreferences() { - IPreferenceStore store = WPILibCPPPlugin.getDefault().getPreferenceStore(); - if (!store.contains(PreferenceConstants.LIBRARY_INSTALLED)) - store.setValue(PreferenceConstants.LIBRARY_INSTALLED, - "none"); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/examples/ExampleCPPProject.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/examples/ExampleCPPProject.java deleted file mode 100644 index 734e6fd5b5..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/examples/ExampleCPPProject.java +++ /dev/null @@ -1,54 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.wizards.examples; - -import java.util.List; -import java.util.Map; - -import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject; -import edu.wpi.first.wpilib.plugins.cpp.wizards.newproject.CPPProjectType; - -public class ExampleCPPProject extends CPPProjectType implements IExampleProject { - private String name, description, world; - private List tags; - private List directories; - private List files; - - public ExampleCPPProject(String name, String description, List tags, - String world, List directories, List files) { - this.name = name; - this.description = description; - this.tags = tags; - this.world = world; - this.directories = directories; - this.files = files; - } - - public String getName() { - return name; - } - - public String getContent() { - return "

"+name+"

"+description+"

"; - } - - public List getTags() { - return tags; - } - - public String getWorld() { - return world; - } - - @Override - public String[] getFolders(String packageName) { - return directories.toArray(new String[0]); - } - - @Override - public Map getFiles(String packageName) { - Map files = super.getFiles(packageName); - for (ExportFile file : this.files) { - files.put(file.destination, file.source); - } - return files; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/examples/ExampleCPPWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/examples/ExampleCPPWizard.java deleted file mode 100644 index 845091d059..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/examples/ExampleCPPWizard.java +++ /dev/null @@ -1,66 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.wizards.examples; - -import java.net.URL; -import java.util.List; -import java.util.Properties; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.wizard.IWizardPage; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; -import edu.wpi.first.wpilib.plugins.core.wizards.ExampleWizard; -import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject; -import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject.ExportFile; -import edu.wpi.first.wpilib.plugins.core.wizards.INewProjectInfo; -import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage; -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils; -import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin; -import edu.wpi.first.wpilib.plugins.cpp.wizards.newproject.WPIRobotCPPProjectCreator; - -public class ExampleCPPWizard extends ExampleWizard { - private NewProjectMainPage detailsPage; - - /** - * Constructor for SampleNewWizard. - */ - public ExampleCPPWizard() { - super(); - setNeedsProgressMonitor(true); - } - - @Override - protected void doFinish(IExampleProject ex, String teamNumber) throws CoreException { - Properties props = WPILibCore.getDefault().getProjectProperties(null); - props.setProperty("team-number", teamNumber); - WPILibCore.getDefault().saveGlobalProperties(props); - - final String projectName = detailsPage.getProjectName(); - ProjectCreationUtils.createProject(new WPIRobotCPPProjectCreator(projectName, ex, detailsPage.getWorld())); - } - - @Override - protected IWizardPage getDetailsPage(INewProjectInfo info) { - if (detailsPage != null) return detailsPage; - detailsPage = new NewProjectMainPage(selection, getTeamNumberPage(), info); - detailsPage.setTitle("Create Example Robot C++ Project"); - detailsPage.setDescription("This wizard creates a new example project based on your selection."); - detailsPage.setShowPackage(false); - return detailsPage; - } - - @Override - public IExampleProject makeExampleProject(String name, String description, - List tags, String world, List folders, List files) { - return new ExampleCPPProject(name, description, tags, world, folders, files); - } - - @Override - public URL getResourceURL() { - return WPILibCPPPlugin.getDefault().getBundle().getEntry("/resources/templates/examples"); - } - - @Override - public String getXMLFile() { - return "examples.xml"; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/CommandGroupWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/CommandGroupWizard.java deleted file mode 100644 index b7b9e70c9f..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/CommandGroupWizard.java +++ /dev/null @@ -1,9 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template; - -public class CommandGroupWizard extends FileTemplateWizard { - - public CommandGroupWizard() { - super("CommandGroup", "command-based/CommandGroup", "Commands"); - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/CommandWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/CommandWizard.java deleted file mode 100644 index 649020a267..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/CommandWizard.java +++ /dev/null @@ -1,9 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template; - -public class CommandWizard extends FileTemplateWizard { - - public CommandWizard() { - super("Command", "command-based/Command", "Commands"); - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/FileTemplateWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/FileTemplateWizard.java deleted file mode 100644 index 3094b1aede..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/FileTemplateWizard.java +++ /dev/null @@ -1,134 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template; - -import java.io.File; -import java.lang.reflect.InvocationTargetException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.cdt.core.model.ICContainer; -import org.eclipse.cdt.core.model.ISourceRoot; -import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWizard; - -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils; -import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin; - -public class FileTemplateWizard extends Wizard implements INewWizard { - private String type, source, ending; - private FileTemplateWizardMainPage page; - private ISelection selection; - private IProject project; - - /** - * Constructor for SampleNewWizard. - */ - public FileTemplateWizard(String type, String source, String ending) { - super(); - setNeedsProgressMonitor(true); - this.type = type; - this.source = source; - this.ending = ending; - } - - /** - * Adding the page to the wizard. - */ - - public void addPages() { - page = new FileTemplateWizardMainPage(type, project, ending, selection); - addPage(page); - } - - /** - * This method is called when 'Finish' button is pressed in - * the wizard. We will create an operation and run it - * using wizard as execution context. - */ - public boolean performFinish() { - final IProject project = page.getProject(); - final String className = page.getClassName(); - final String folderName = page.getFolder(); - WPILibCPPPlugin.logInfo("Class: "+className+" Folder: "+folderName); - IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException { - try { - doFinish(project, className, folderName, monitor); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }; - try { - getContainer().run(true, false, op); - } catch (InterruptedException e) { - return false; - } catch (InvocationTargetException e) { - Throwable realException = e.getTargetException(); - MessageDialog.openError(getShell(), "Error", realException.getMessage()); - return false; - } - return true; - } - - /** - * The worker method. It will find the container, create the - * file if missing or just replace its contents, and open - * the editor on the newly created file. - */ - private void doFinish(IProject project, String className, String folderName, IProgressMonitor monitor) throws CoreException { - Map map = new HashMap(); - map.put("$classname", className); - map.put("$folder", folderName); - String filepath = folderName+File.separator+className; - try { - // Create Header - URL url = new URL(WPILibCPPPlugin.getDefault().getBundle().getEntry("/resources/templates/"), source+".h"); - ProjectCreationUtils.createTemplateFile(project, filepath+".h", url, map); - - // Create CPP file - url = new URL(WPILibCPPPlugin.getDefault().getBundle().getEntry("/resources/templates/"), source+".cpp"); - ProjectCreationUtils.createTemplateFile(project, filepath+".cpp", url, map); - } catch (MalformedURLException e) { - WPILibCPPPlugin.logError("Malforemd URL: "+WPILibCPPPlugin.getDefault().getBundle().getEntry("/resources/templates/")+"/"+source+".h", e); - } - } - - /** - * We will accept the selection in the workbench to see if - * we can initialize from it. - * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - WPILibCPPPlugin.logInfo(selection.toString()); - Object element = ((StructuredSelection) selection).getFirstElement(); - WPILibCPPPlugin.logInfo(element.getClass().toString()); - if (element instanceof IResource) { - project = ((IResource) element).getProject(); - } else if (element instanceof ISourceRoot) { - project = ((ISourceRoot) element).getCProject().getProject(); - } else if (element instanceof ITranslationUnit) { - project = ((ITranslationUnit) element).getCProject().getProject(); - } else if (element instanceof ISourceRoot) { - project = ((ISourceRoot) element).getCProject().getProject(); - } else if (element instanceof ICContainer) { - project = ((ICContainer) element).getCProject().getProject(); - } else WPILibCPPPlugin.logInfo("Element not instance of IResource: "+element.getClass()); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/FileTemplateWizardMainPage.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/FileTemplateWizardMainPage.java deleted file mode 100644 index b9a71a5e0d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/FileTemplateWizardMainPage.java +++ /dev/null @@ -1,180 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template; - -import java.io.File; - -import org.eclipse.cdt.core.CCProjectNature; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.dialogs.IDialogPage; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -import edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature; -import edu.wpi.first.wpilib.plugins.core.wizards.IProjectFilter; -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectComboField; -import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin; - -/** - * The "New" wizard page allows setting the container for the new file as well - * as the file name. The page will only accept file name without the extension - * OR with the extension that matches the expected one (mpe). - */ - -public class FileTemplateWizardMainPage extends WizardPage { - private IProject project; - private String ending; - private ProjectComboField projectsCombo; - private Text classNameText; - private Text folderText; - - /** - * Constructor for SampleNewWizardPage. - * - * @param pageName - */ - public FileTemplateWizardMainPage(String type, IProject project, String ending, ISelection selection) { - super("wizardPage"); - setTitle("Create New "+type); - setDescription("This wizard creates a new "+type.toLowerCase()+" from a template."); - this.project = project; - this.ending = ending; - } - - /** - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite container = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 2; - layout.verticalSpacing = 9; - - Label label = new Label(container, SWT.NULL); - label.setText("Pro&ject:"); - - projectsCombo = new ProjectComboField(container, SWT.BORDER | SWT.SINGLE, - new IProjectFilter() { - @Override public boolean accept(IProject project) { - try { - return project.hasNature(FRCProjectNature.FRC_PROJECT_NATURE) - && project.hasNature(CCProjectNature.C_NATURE_ID); - } catch (CoreException e) { - WPILibCPPPlugin.logError("Error checking for FRC C++ project.", e); - return false; - } - } - }); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - projectsCombo.setLayoutData(gd); - projectsCombo.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - label = new Label(container, SWT.NULL); - label.setText("Class &Name:"); - - classNameText = new Text(container, SWT.BORDER | SWT.SINGLE); - gd = new GridData(GridData.FILL_HORIZONTAL); - classNameText.setLayoutData(gd); - classNameText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - label = new Label(container, SWT.NULL); - label.setText("&Folder:"); - - folderText = new Text(container, SWT.BORDER | SWT.SINGLE); - gd = new GridData(GridData.FILL_HORIZONTAL); - folderText.setLayoutData(gd); - folderText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - initialize(); - dialogChanged(); - setControl(container); - } - - /** - * Tests if the current workbench selection is a suitable container to use. - */ - - private void initialize() { - projectsCombo.setProject(project); - folderText.setText(getDefaultFolder()); - } - - /** - * Ensures that both text fields are set. - */ - - private void dialogChanged() { - String className = getClassName(); - String folder = getFolder(); - - // Update the default package if necessary - if (project == null || !project.equals(projectsCombo.getProject())) { - String oldDefault = getDefaultFolder(); - project = projectsCombo.getProject(); - if (folder.equals(oldDefault)) { - folderText.setText(getDefaultFolder()); - } - } - - if (!projectsCombo.isValid()) { - updateStatus("Must select a project."); - return; - } - - if (className.length() == 0) { - updateStatus("Class name must be specified"); - return; - } - if (!className.matches("^([a-zA-Z_]{1}[a-zA-Z0-9_]*)$")) { - updateStatus("Must be a valid java class name"); - return; - } - if (folder.length() == 0) { - updateStatus("Package must be specified"); - return; - } - updateStatus(null); - } - - private void updateStatus(String message) { - setErrorMessage(message); - setPageComplete(message == null); - } - - public IProject getProject() { - return projectsCombo.getProject(); - } - - public String getClassName() { - return classNameText.getText(); - } - - public String getFolder() { - return folderText.getText(); - } - - public String getDefaultFolder() { - WPILibCPPPlugin.logInfo("Project: "+project); - return "src"+File.separator+ending; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/PIDSubsystemWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/PIDSubsystemWizard.java deleted file mode 100644 index 63e615831b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/PIDSubsystemWizard.java +++ /dev/null @@ -1,9 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template; - -public class PIDSubsystemWizard extends FileTemplateWizard { - - public PIDSubsystemWizard() { - super("PIDSubsystem", "command-based/PIDSubsystem", "Subsystems"); - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/SubsystemWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/SubsystemWizard.java deleted file mode 100644 index 2c60310329..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/SubsystemWizard.java +++ /dev/null @@ -1,9 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template; - -public class SubsystemWizard extends FileTemplateWizard { - - public SubsystemWizard() { - super("Subsystem", "command-based/Subsystem", "Subsystems"); - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/TriggerWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/TriggerWizard.java deleted file mode 100644 index 73d0d04407..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/file_template/TriggerWizard.java +++ /dev/null @@ -1,9 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.wizards.file_template; - -public class TriggerWizard extends FileTemplateWizard { - - public TriggerWizard() { - super("Trigger", "command-based/Trigger", "Triggers"); - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/newproject/CPPProjectType.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/newproject/CPPProjectType.java deleted file mode 100644 index 3c316d7dea..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/newproject/CPPProjectType.java +++ /dev/null @@ -1,75 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.wizards.newproject; - -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType; -import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin; - -public class CPPProjectType implements ProjectType { - static ProjectType ITERATIVE = new CPPProjectType() { - @Override public Map getFiles(String packageName) { - Map files = super.getFiles(packageName); - files.put("src/Robot.cpp", "iterative/Robot.cpp"); - return files; - } - }; - static ProjectType COMMAND_BASED = new CPPProjectType() { - @Override public String[] getFolders(String packageName) { - String[] paths = {"src", - "src/Commands", - "src/Subsystems", - "src/Triggers"}; - return paths; - } - @Override public Map getFiles(String packageName) { - Map files = super.getFiles(packageName); - files.put("src/Robot.cpp", "command-based/Robot.cpp"); - files.put("src/OI.h", "command-based/OI.h"); - files.put("src/OI.cpp", "command-based/OI.cpp"); - files.put("src/RobotMap.h", "command-based/RobotMap.h"); - files.put("src/CommandBase.cpp", "command-based/CommandBase.cpp"); - files.put("src/CommandBase.h", "command-based/CommandBase.h"); - files.put("src/Subsystems/ExampleSubsystem.h", "command-based/ExampleSubsystem.h"); - files.put("src/Subsystems/ExampleSubsystem.cpp", "command-based/ExampleSubsystem.cpp"); - files.put("src/Commands/ExampleCommand.h", "command-based/ExampleCommand.h"); - files.put("src/Commands/ExampleCommand.cpp", "command-based/ExampleCommand.cpp"); - return files; - } - }; - static ProjectType SAMPLE = new CPPProjectType() { - @Override public Map getFiles(String packageName) { - Map files = super.getFiles(packageName); - files.put("src/Robot.cpp", "sample/Robot.cpp"); - return files; - } - }; - @SuppressWarnings("serial") - static Map TYPES = new HashMap() {{ - put(ProjectType.ITERATIVE, ITERATIVE); - put(ProjectType.COMMAND_BASED, COMMAND_BASED); - put(ProjectType.SAMPLE, SAMPLE); - }}; - - @Override - public String[] getFolders(String packageName) { - String[] paths = {"src"}; - return paths; - } - - @Override - public Map getFiles(String packageName) { - HashMap files = new HashMap(); - files.put("build.xml", "build.xml"); - files.put("build.properties", "build.properties"); - files.put(".cproject", ".cproject"); - return files; - } - - - @Override - public URL getBaseURL() { - return WPILibCPPPlugin.getDefault().getBundle().getEntry("/resources/templates/"); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/newproject/NewCPPWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/newproject/NewCPPWizard.java deleted file mode 100644 index 329149c301..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/newproject/NewCPPWizard.java +++ /dev/null @@ -1,123 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.wizards.newproject; - -import java.lang.reflect.InvocationTargetException; -import java.util.Properties; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWizard; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; -import edu.wpi.first.wpilib.plugins.core.wizards.INewProjectInfo; -import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage; -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils; -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType; -import edu.wpi.first.wpilib.plugins.core.wizards.TeamNumberPage; -import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin; - -/** - * - * Example Docs: - * This is a sample new wizard. Its role is to create a new file - * resource in the provided container. If the container resource - * (a folder or a project) is selected in the workspace - * when the wizard is opened, it will accept it as the target - * container. The wizard creates one file with the extension - * "mpe". If a sample multi-page editor (also available - * as a template) is registered for the same extension, it will - * be able to open it. - */ - -public class NewCPPWizard extends Wizard implements INewWizard { - private NewProjectMainPage page; - private ISelection selection; - private TeamNumberPage teamNumberPage; - - /** - * Constructor for SampleNewWizard. - */ - public NewCPPWizard() { - super(); - setNeedsProgressMonitor(true); - } - - /** - * Adding the page to the wizard. - */ - - public void addPages() { - if (TeamNumberPage.needsTeamNumberPage()) { - teamNumberPage = new TeamNumberPage(selection); - addPage(teamNumberPage); - } - page = new NewProjectMainPage(selection, teamNumberPage, INewProjectInfo.Null); - page.setTitle("Create New Robot C++ Project"); - page.setDescription("This wizard creates a new Robot C++ Project configured to use WPILib for programming FRC robots."); - page.setShowPackage(false); - page.setProjectTypes(CPPProjectType.TYPES); - addPage(page); - } - - /** - * This method is called when 'Finish' button is pressed in - * the wizard. We will create an operation and run it - * using wizard as execution context. - */ - public boolean performFinish() { - final String projectName = page.getProjectName(); - final String teamNumber = TeamNumberPage.getTeamNumberFromPage(teamNumberPage); - final ProjectType projectType = page.getProjectType(); - final String worldName = page.getWorld(); - WPILibCPPPlugin.logInfo("Project: "+projectName+" Project Type: "+projectType); - IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException { - try { - doFinish(projectName, teamNumber, projectType, worldName, monitor); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }; - try { - getContainer().run(true, false, op); - } catch (InterruptedException e) { - return false; - } catch (InvocationTargetException e) { - Throwable realException = e.getTargetException(); - MessageDialog.openError(getShell(), "Error", realException.getMessage()); - return false; - } - return true; - } - - /** - * The worker method. It will find the container, create the - * file if missing or just replace its contents, and open - * the editor on the newly created file. - */ - - private void doFinish(String projectName, String teamNumber, ProjectType projectType, String worldName, IProgressMonitor monitor) throws CoreException { - Properties props = WPILibCore.getDefault().getProjectProperties(null); - props.setProperty("team-number", teamNumber); - WPILibCore.getDefault().saveGlobalProperties(props); - ProjectCreationUtils.createProject(new WPIRobotCPPProjectCreator(projectName, projectType, worldName)); - } - - /** - * We will accept the selection in the workbench to see if - * we can initialize from it. - * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/newproject/WPIRobotCPPProjectCreator.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/newproject/WPIRobotCPPProjectCreator.java deleted file mode 100644 index ba49801764..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/java/edu/wpi/first/wpilib/plugins/cpp/wizards/newproject/WPIRobotCPPProjectCreator.java +++ /dev/null @@ -1,90 +0,0 @@ -package edu.wpi.first.wpilib.plugins.cpp.wizards.newproject; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.build.core.scannerconfig.ScannerConfigNature; -import org.eclipse.cdt.core.CCProjectNature; -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.index.IIndexManager; -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; - -import edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature; -import edu.wpi.first.wpilib.plugins.core.wizards.IProjectCreator; -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType; -import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin; - -public class WPIRobotCPPProjectCreator implements IProjectCreator { - String projectName; - ProjectType projectType; - private String worldName; - - public WPIRobotCPPProjectCreator(String projectName, ProjectType projectType, String worldName) { - this.projectName = projectName; - this.projectType = projectType; - this.worldName = worldName; - } - - @Override - public String getName() { - return projectName; - } - - @Override - public String getPackageName() { - return ""; // C++ doesn't have the equivalent of a project name - } - - @Override - public Map getValues() { - Map vals = new HashMap(); - vals.put("$project", projectName); - vals.put("$cpp-location", WPILibCPPPlugin.getDefault().getCPPDir()); - vals.put("$world", worldName); - return vals; - } - - @Override - public List getNatures() { - List natures = new ArrayList<>(); - natures.add(CCProjectNature.C_NATURE_ID); - natures.add(CCProjectNature.CC_NATURE_ID); - natures.add(ManagedCProjectNature.MNG_NATURE_ID); - natures.add(ScannerConfigNature.NATURE_ID); - natures.add(FRCProjectNature.FRC_PROJECT_NATURE); - return natures; - } - - @Override - public ProjectType getProjectType() { - return projectType; - } - - @Override - public void initialize(IProject project) { - try { - CCorePlugin.getDefault().createCDTProject(project.getDescription(), project, null); - project.open(null); - } catch (CoreException e) { - WPILibCPPPlugin.logError("Error intializing FRC C++ project.", e); - } - } - - @Override - public void finalize(IProject project) throws CoreException { - updateVariables(project); - - // Freshen the index because otherwise it's red and angry - ICElement[] projects = {CCorePlugin.getDefault().getCoreModel().create(project)}; - CCorePlugin.getIndexManager().update(projects, IIndexManager.UPDATE_ALL | IIndexManager.UPDATE_EXTERNAL_FILES_FOR_PROJECT); - } - - private void updateVariables(IProject project) throws CoreException { - // TODO: implement C++ equivalent - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/ant-classloadertask.jar b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/ant-classloadertask.jar deleted file mode 100644 index d2f58d9f1d..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/ant-classloadertask.jar and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/ant-contrib.jar b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/ant-contrib.jar deleted file mode 100644 index ea817cd434..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/ant-contrib.jar and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/build.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/build.properties deleted file mode 100644 index 1d0c138b2e..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/build.properties +++ /dev/null @@ -1,22 +0,0 @@ -# Deployment information -username=lvuser -password= -deploy.dir=/home/lvuser -deploy.kill.command=/usr/local/frc/bin/frcKillRobot.sh -t -r -command.dir=/home/lvuser/ - -# Libraries to use -wpilib=${user.home}/wpilib/cpp/${cpp-version} -wpilib.lib=${wpilib}/lib -roboRIOAllowedImages=15 - -# Ant support -wpilib.ant.dir=${wpilib}/ant -jsch.jar=${wpilib.ant.dir}/jsch-0.1.50.jar -classloadertask.jar=${wpilib.ant.dir}/ant-classloadertask.jar - -#simulation stuff -sim.exe=Simulate/${out} -wpilib.sim=${wpilib}/sim -sim.tools=${wpilib.sim}/tools -sim.lib=${wpilib.sim}/lib diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/build.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/build.xml deleted file mode 100644 index dfcce86b9b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/build.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Trying Target: ${target} - - - - roboRIO found via mDNS - - - - roboRIO not found via mDNS, falling back to static USB - - - - - roboRIO found via static USB - - - - - - - roboRIO not found via USB, falling back to static address of ${target} - - - - - - roboRIO found via Ethernet static - - - - - - - - - - [athena-deploy] Copying code over. - - - - - - - - [athena-deploy] Starting program. - - - - - - - - - - - - - - - - - - - - [simulate] You may now run Gazebo - - - [simulate] You can now run your DriverStation! - - - - [simulate] Running Code. - - - - - - - - - - - - - - - - - - - - roboRIO image version validated - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/jsch-0.1.50.jar b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/jsch-0.1.50.jar deleted file mode 100644 index 85c044f216..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/jsch-0.1.50.jar and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/robotCommand b/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/robotCommand deleted file mode 100644 index 06757bd83d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.cpp/src/main/resources/cpp-zip/ant/robotCommand +++ /dev/null @@ -1 +0,0 @@ -/usr/local/frc/bin/netconsole-host /home/lvuser/FRCUserProgram diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java.feature/build.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java.feature/build.properties deleted file mode 100644 index 64f93a9f0b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java.feature/build.properties +++ /dev/null @@ -1 +0,0 @@ -bin.includes = feature.xml diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java.feature/feature.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java.feature/feature.xml deleted file mode 100644 index 632a1820a7..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java.feature/feature.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - FRC Robot Java Program Development Environment. - - - - * Copyright (c) 2015 FIRST and WPI -* All rights reserved. - - - - * Copyright (c) 2015 FIRST and WPI -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or -* without modification, are permitted provided that the following -* conditions are met: -* Redistributions of source code must retain the above -* copyright notice, this list of conditions and the following -* disclaimer. Redistributions in binary form must reproduce the -* above copyright notice, this list of conditions and the following -* disclaimer in the documentation and/or other materials provided -* with the distribution. Neither the name of the FIRST nor the -* names of its contributors may be used to endorse or promote -* products derived from this software without specific prior -* written permission. -* -* THIS SOFTWARE IS PROVIDED BY FIRST AND CONTRIBUTORS``AS IS'' -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT -* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -* EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java.feature/pom.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java.feature/pom.xml deleted file mode 100644 index 5d259ac0dd..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java.feature/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - edu.wpi.first.wpilib.plugins.java.feature - eclipse-feature - - - edu.wpi.first.wpilib.plugins - edu.wpi.first.wpilib.plugins - 0.1.0.qualifier - .. - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/.project b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/.project deleted file mode 100644 index 02b92fbf34..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/.project +++ /dev/null @@ -1,34 +0,0 @@ - - - edu.wpi.first.wpilib.plugins.java - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/META-INF/MANIFEST.MF b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/META-INF/MANIFEST.MF deleted file mode 100644 index c0e4927e75..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/META-INF/MANIFEST.MF +++ /dev/null @@ -1,23 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: WPILib_Java_Robot_Development -Bundle-SymbolicName: edu.wpi.first.wpilib.plugins.java;singleton:=true -Bundle-Version: 0.1.0.qualifier -Bundle-Activator: edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin -Bundle-Vendor: Worcester Polytechnic Institute -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - org.eclipse.core.resources;bundle-version="3.8.1", - edu.wpi.first.wpilib.plugins.core;bundle-version="0.1.0", - org.eclipse.jdt;bundle-version="3.8.0", - org.eclipse.jdt.core;bundle-version="3.8.2", - org.eclipse.jdt.debug;bundle-version="3.7.101", - org.eclipse.jdt.debug.ui;bundle-version="3.6.100", - org.eclipse.jdt.launching;bundle-version="3.6.100", - org.eclipse.jdt.ui;bundle-version="3.8.1", - org.eclipse.debug.core;bundle-version="3.7.100", - org.eclipse.debug.ui;bundle-version="3.8.1", - org.eclipse.ui.editors;bundle-version="3.8.0", - org.eclipse.ui.ide;bundle-version="3.8.1" -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 -Bundle-ActivationPolicy: lazy diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/build.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/build.properties deleted file mode 100644 index b91237bcf1..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -source.. = src/main/java/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - resources/ -src.includes = src/,\ - resources/ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/plugin.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/plugin.xml deleted file mode 100644 index 8e70003133..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/plugin.xml +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/pom.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/pom.xml deleted file mode 100644 index e58b6a88fc..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/pom.xml +++ /dev/null @@ -1,381 +0,0 @@ - - - 4.0.0 - edu.wpi.first.wpilib.plugins.java - eclipse-plugin - - - edu.wpi.first.wpilib.plugins - edu.wpi.first.wpilib.plugins - 0.1.0.qualifier - .. - - - - DEVELOPMENT - ${project.build.directory}/java-zip - - - - - - . - - resources/configuration.properties - - true - - - - - maven-resources-plugin - 2.6 - - - copy-ant-resources-to-java-zip - generate-sources - - copy-resources - - - ${java-zip} - - - src/main/resources/java-zip - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.8 - - - - - fetch-jar-zip-dependencies - compile - - copy - - - - - - edu.wpi.first.wpilib.networktables.java - NetworkTables - 3.0.0-SNAPSHOT - arm - jar - NetworkTables.jar - ${java-zip}/lib - - - edu.wpi.first.wpilibj - wpilibJavaFinal - 0.1.0-SNAPSHOT - jar - WPILib.jar - ${java-zip}/lib - - - - edu.wpi.first.wpilib.networktables.java - NetworkTables - 3.0.0-SNAPSHOT - sources - ${java-zip}/lib - NetworkTables-sources.jar - - - edu.wpi.first.wpilibj - wpilibJavaFinal - 0.1.0-SNAPSHOT - sources - ${java-zip}/lib - WPILib-sources.jar - - - - - edu.wpi.first.wpilibj - wpilibJavaFinal - 0.1.0-SNAPSHOT - javadoc - ${java-zip}/javadoc-jar - - - - false - true - - - - - - fetch-sim-jar-zip-dependencies - compile - - copy - - - ${java-zip}/sim/lib - false - true - - - - org.gazebosim - JavaGazebo - 0.1.0-SNAPSHOT - - - edu.wpi.first.wpilibj - wpilibJavaSim - 0.1.0-SNAPSHOT - jar - - - edu.wpi.first.wpilib.networktables.java - NetworkTables - 3.0.0-SNAPSHOT - arm - - - - net.java.jinput - jinput - 2.0.5 - - - net.java.jinput - jinput-platform - 2.0.5 - natives-linux - jar - - - net.java.jutils - jutils - 1.0.0 - - - - com.google.protobuf - protobuf-java - 2.5.0 - - - - edu.wpi.first.wpilibj.simulation - SimDS - 0.1.0-SNAPSHOT - SimDS.jar - ${java-zip}/sim/tools - - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.7 - - - - - set-version-info - - run - - process-sources - - - - - - - - - - - true - - - - - - unzip-javadocs - compile - - run - - - - - - - - - - - - - - - - unzip-jinput-libs - compile - - run - - - - - - - - - - - generate-jar-zip - compile - - run - - - - - - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.apache.maven.plugins - - - maven-dependency-plugin - - [2.8,) - - copy - - - - - - - - - - - - - - - - - - - edu.wpi.first.wpilib.networktables.java - NetworkTables - 3.0.0-SNAPSHOT - arm - jar - - - edu.wpi.first.wpilibj - wpilibJavaFinal - 0.1.0-SNAPSHOT - jar - - - edu.wpi.first.wpilibj - wpilibJavaSim - 0.1.0-SNAPSHOT - jar - - - edu.wpi.first.wpilibj - wpilibJavaFinal - 0.1.0-SNAPSHOT - sources - - - - - - - edu.wpi.first.wpilib.networktables.java - NetworkTables - 3.0.0-SNAPSHOT - sources - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/configuration.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/configuration.properties deleted file mode 100644 index cbfaca2ede..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/configuration.properties +++ /dev/null @@ -1,2 +0,0 @@ -timestamp=${timestamp} -version=${version} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/Button.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/Button.png deleted file mode 100644 index f6584ec823..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/Button.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/Command.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/Command.png deleted file mode 100644 index c3d9c2d991..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/Command.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/CommandGroup.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/CommandGroup.png deleted file mode 100644 index 1a027c85fd..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/CommandGroup.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/Gazebo.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/Gazebo.png deleted file mode 100644 index 3ad1d74440..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/Gazebo.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/PIDSubsystem.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/PIDSubsystem.png deleted file mode 100644 index 766fca1c3b..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/PIDSubsystem.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/Subsystem.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/Subsystem.png deleted file mode 100644 index 35ee694c8c..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/Subsystem.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/sample.gif b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/sample.gif deleted file mode 100644 index 34fb3c9d8c..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/sample.gif and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/wpi.ico b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/wpi.ico deleted file mode 100644 index a6de9245f9..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/icons/wpi.ico and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/.classpath b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/.classpath deleted file mode 100644 index daf6ebbf77..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/build.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/build.properties deleted file mode 100644 index 2a2ec518f6..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -# Project specific information -package=$package -robot.class=${package}.Robot -simulation.world.file=$world \ No newline at end of file diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/build.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/build.xml deleted file mode 100644 index 2182d373a5..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/build.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Command.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Command.java deleted file mode 100644 index ff7510756d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Command.java +++ /dev/null @@ -1,36 +0,0 @@ -package $package; - -import edu.wpi.first.wpilibj.command.Command; - -/** - * - */ -public class $classname extends Command { - - public $classname() { - // Use requires() here to declare subsystem dependencies - // eg. requires(chassis); - } - - // Called just before this Command runs the first time - protected void initialize() { - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() { - } - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return false; - } - - // Called once after isFinished returns true - protected void end() { - } - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/CommandGroup.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/CommandGroup.java deleted file mode 100644 index 29e66e86ea..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/CommandGroup.java +++ /dev/null @@ -1,28 +0,0 @@ -package $package; - -import edu.wpi.first.wpilibj.command.CommandGroup; - -/** - * - */ -public class $classname extends CommandGroup { - - public $classname() { - // Add Commands here: - // e.g. addSequential(new Command1()); - // addSequential(new Command2()); - // these will run in order. - - // To run multiple commands at the same time, - // use addParallel() - // e.g. addParallel(new Command1()); - // addSequential(new Command2()); - // Command1 and Command2 will run in parallel. - - // A command group will require all of the subsystems that each member - // would require. - // e.g. if Command1 requires chassis, and Command2 requires arm, - // a CommandGroup containing them would require both the chassis and the - // arm. - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/ExampleCommand.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/ExampleCommand.java deleted file mode 100644 index 7d04aa17c1..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/ExampleCommand.java +++ /dev/null @@ -1,39 +0,0 @@ - -package $package.commands; - -import edu.wpi.first.wpilibj.command.Command; - -import $package.Robot; - -/** - * - */ -public class ExampleCommand extends Command { - - public ExampleCommand() { - // Use requires() here to declare subsystem dependencies - requires(Robot.exampleSubsystem); - } - - // Called just before this Command runs the first time - protected void initialize() { - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() { - } - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return false; - } - - // Called once after isFinished returns true - protected void end() { - } - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/ExampleSubsystem.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/ExampleSubsystem.java deleted file mode 100644 index 6baed1bd73..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/ExampleSubsystem.java +++ /dev/null @@ -1,19 +0,0 @@ - -package $package.subsystems; - -import edu.wpi.first.wpilibj.command.Subsystem; - -/** - * - */ -public class ExampleSubsystem extends Subsystem { - - // Put methods for controlling this subsystem - // here. Call these from Commands. - - public void initDefaultCommand() { - // Set the default command for a subsystem here. - //setDefaultCommand(new MySpecialCommand()); - } -} - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/OI.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/OI.java deleted file mode 100644 index 16bfa8ebf4..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/OI.java +++ /dev/null @@ -1,38 +0,0 @@ -package $package; - -import edu.wpi.first.wpilibj.buttons.Button; -import $package.commands.ExampleCommand; - -/** - * This class is the glue that binds the controls on the physical operator - * interface to the commands and command groups that allow control of the robot. - */ -public class OI { - //// CREATING BUTTONS - // One type of button is a joystick button which is any button on a joystick. - // You create one by telling it which joystick it's on and which button - // number it is. - // Joystick stick = new Joystick(port); - // Button button = new JoystickButton(stick, buttonNumber); - - // There are a few additional built in buttons you can use. Additionally, - // by subclassing Button you can create custom triggers and bind those to - // commands the same as any other Button. - - //// TRIGGERING COMMANDS WITH BUTTONS - // Once you have a button, it's trivial to bind it to a button in one of - // three ways: - - // Start the command when the button is pressed and let it run the command - // until it is finished as determined by it's isFinished method. - // button.whenPressed(new ExampleCommand()); - - // Run the command while the button is being held down and interrupt it once - // the button is released. - // button.whileHeld(new ExampleCommand()); - - // Start the command when the button is released and let it run the command - // until it is finished as determined by it's isFinished method. - // button.whenReleased(new ExampleCommand()); -} - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/PIDSubsystem.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/PIDSubsystem.java deleted file mode 100644 index 1f468fce70..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/PIDSubsystem.java +++ /dev/null @@ -1,34 +0,0 @@ -package $package; - -import edu.wpi.first.wpilibj.command.PIDSubsystem; - -/** - * - */ -public class $classname extends PIDSubsystem { - - // Initialize your subsystem here - public $classname() { - // Use these to get going: - // setSetpoint() - Sets where the PID controller should move the system - // to - // enable() - Enables the PID controller. - } - - public void initDefaultCommand() { - // Set the default command for a subsystem here. - //setDefaultCommand(new MySpecialCommand()); - } - - protected double returnPIDInput() { - // Return your input value for the PID loop - // e.g. a sensor, like a potentiometer: - // yourPot.getAverageVoltage() / kYourMaxVoltage; - return 0.0; - } - - protected void usePIDOutput(double output) { - // Use output to drive your system, like a motor - // e.g. yourMotor.set(output); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Robot.java deleted file mode 100644 index 6073cf4d5d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Robot.java +++ /dev/null @@ -1,81 +0,0 @@ - -package $package; - -import edu.wpi.first.wpilibj.IterativeRobot; -import edu.wpi.first.wpilibj.command.Command; -import edu.wpi.first.wpilibj.command.Scheduler; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; -import $package.commands.ExampleCommand; -import $package.subsystems.ExampleSubsystem; - -/** - * The VM is configured to automatically run this class, and to call the - * functions corresponding to each mode, as described in the IterativeRobot - * documentation. If you change the name of this class or the package after - * creating this project, you must also update the manifest file in the resource - * directory. - */ -public class Robot extends IterativeRobot { - - public static final ExampleSubsystem exampleSubsystem = new ExampleSubsystem(); - public static OI oi; - - Command autonomousCommand; - - /** - * This function is run when the robot is first started up and should be - * used for any initialization code. - */ - public void robotInit() { - oi = new OI(); - // instantiate the command used for the autonomous period - autonomousCommand = new ExampleCommand(); - } - - /** - * This function is called once each time the robot enters Disabled mode. - * You can use it to reset any subsystem information you want to clear when - * the robot is disabled. - */ - public void disabledInit(){ - - } - - public void disabledPeriodic() { - Scheduler.getInstance().run(); - } - - public void autonomousInit() { - // schedule the autonomous command (example) - if (autonomousCommand != null) autonomousCommand.start(); - } - - /** - * This function is called periodically during autonomous - */ - public void autonomousPeriodic() { - Scheduler.getInstance().run(); - } - - public void teleopInit() { - // This makes sure that the autonomous stops running when - // teleop starts running. If you want the autonomous to - // continue until interrupted by another command, remove - // this line or comment it out. - if (autonomousCommand != null) autonomousCommand.cancel(); - } - - /** - * This function is called periodically during operator control - */ - public void teleopPeriodic() { - Scheduler.getInstance().run(); - } - - /** - * This function is called periodically during test mode - */ - public void testPeriodic() { - LiveWindow.run(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/RobotMap.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/RobotMap.java deleted file mode 100644 index 2a08cd36bc..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/RobotMap.java +++ /dev/null @@ -1,18 +0,0 @@ -package $package; -/** - * The RobotMap is a mapping from the ports sensors and actuators are wired into - * to a variable name. This provides flexibility changing wiring, makes checking - * the wiring easier and significantly reduces the number of magic numbers - * floating around. - */ -public class RobotMap { - // For example to map the left and right motors, you could define the - // following variables to use with your drivetrain subsystem. - // public static int leftMotor = 1; - // public static int rightMotor = 2; - - // If you are using multiple modules, make sure to define both the port - // number and the module. For example you with a rangefinder: - // public static int rangefinderPort = 1; - // public static int rangefinderModule = 1; -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Subsystem.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Subsystem.java deleted file mode 100644 index ae97a4ba8f..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Subsystem.java +++ /dev/null @@ -1,18 +0,0 @@ -package $package; - -import edu.wpi.first.wpilibj.command.Subsystem; - -/** - * - */ -public class $classname extends Subsystem { - - // Put methods for controlling this subsystem - // here. Call these from Commands. - - public void initDefaultCommand() { - // Set the default command for a subsystem here. - //setDefaultCommand(new MySpecialCommand()); - } -} - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Trigger.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Trigger.java deleted file mode 100644 index d399b201fb..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Trigger.java +++ /dev/null @@ -1,13 +0,0 @@ -package $package; - -import edu.wpi.first.wpilibj.buttons.Trigger; - -/** - * - */ -public class $classname extends Trigger { - - public boolean get() { - return false; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/2015Vision/Color_src/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/2015Vision/Color_src/Robot.java deleted file mode 100644 index 62a7f22b89..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/2015Vision/Color_src/Robot.java +++ /dev/null @@ -1,240 +0,0 @@ -package $package; - -import java.lang.Math; -import java.util.Comparator; -import java.util.Vector; - -import com.ni.vision.NIVision; -import com.ni.vision.NIVision.Image; -import com.ni.vision.NIVision.ImageType; - -import edu.wpi.first.wpilibj.CameraServer; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.Timer; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; - -/** - * Example of finding yellow totes based on color. - * This example utilizes an image file, which you need to copy to the roboRIO - * To use a camera you will have to integrate the appropriate camera details with this example. - * To use a USB camera instead, see the SimpelVision and AdvancedVision examples for details - * on using the USB camera. To use an Axis Camera, see the AxisCamera example for details on - * using an Axis Camera. - * - * Sample omages can be found here: http://wp.wpi.edu/wpilib/2015/01/16/sample-images-for-vision-projects/ - */ -public class Robot extends SampleRobot { - //A structure to hold measurements of a particle - public class ParticleReport implements Comparator, Comparable{ - double PercentAreaToImageArea; - double Area; - double ConvexHullArea; - double BoundingRectLeft; - double BoundingRectTop; - double BoundingRectRight; - double BoundingRectBottom; - - public int compareTo(ParticleReport r) - { - return (int)(r.Area - this.Area); - } - - public int compare(ParticleReport r1, ParticleReport r2) - { - return (int)(r1.Area - r2.Area); - } - }; - - //Structure to represent the scores for the various tests used for target identification - public class Scores { - double Trapezoid; - double LongAspect; - double ShortAspect; - double AreaToConvexHullArea; - }; - - //Images - Image frame; - Image binaryFrame; - int imaqError; - - //Constants - NIVision.Range TOTE_HUE_RANGE = new NIVision.Range(24, 49); //Default hue range for yellow tote - NIVision.Range TOTE_SAT_RANGE = new NIVision.Range(67, 255); //Default saturation range for yellow tote - NIVision.Range TOTE_VAL_RANGE = new NIVision.Range(49, 255); //Default value range for yellow tote - double AREA_MINIMUM = 0.5; //Default Area minimum for particle as a percentage of total image area - double LONG_RATIO = 2.22; //Tote long side = 26.9 / Tote height = 12.1 = 2.22 - double SHORT_RATIO = 1.4; //Tote short side = 16.9 / Tote height = 12.1 = 1.4 - double SCORE_MIN = 75.0; //Minimum score to be considered a tote - double VIEW_ANGLE = 49.4; //View angle fo camera, set to Axis m1011 by default, 64 for m1013, 51.7 for 206, 52 for HD3000 square, 60 for HD3000 640x480 - NIVision.ParticleFilterCriteria2 criteria[] = new NIVision.ParticleFilterCriteria2[1]; - NIVision.ParticleFilterOptions2 filterOptions = new NIVision.ParticleFilterOptions2(0,0,1,1); - Scores scores = new Scores(); - - public void robotInit() { - // create images - frame = NIVision.imaqCreateImage(ImageType.IMAGE_RGB, 0); - binaryFrame = NIVision.imaqCreateImage(ImageType.IMAGE_U8, 0); - criteria[0] = new NIVision.ParticleFilterCriteria2(NIVision.MeasurementType.MT_AREA_BY_IMAGE_AREA, AREA_MINIMUM, 100.0, 0, 0); - - //Put default values to SmartDashboard so fields will appear - SmartDashboard.putNumber("Tote hue min", TOTE_HUE_RANGE.minValue); - SmartDashboard.putNumber("Tote hue max", TOTE_HUE_RANGE.maxValue); - SmartDashboard.putNumber("Tote sat min", TOTE_SAT_RANGE.minValue); - SmartDashboard.putNumber("Tote sat max", TOTE_SAT_RANGE.maxValue); - SmartDashboard.putNumber("Tote val min", TOTE_VAL_RANGE.minValue); - SmartDashboard.putNumber("Tote val max", TOTE_VAL_RANGE.maxValue); - SmartDashboard.putNumber("Area min %", AREA_MINIMUM); - } - - public void autonomous() { - while (isAutonomous() && isEnabled()) - { - //read file in from disk. For this example to run you need to copy image20.jpg from the SampleImages folder to the - //directory shown below using FTP or SFTP: http://wpilib.screenstepslive.com/s/4485/m/24166/l/282299-roborio-ftp - NIVision.imaqReadFile(frame, "/home/lvuser/SampleImages/image20.jpg"); - - //Update threshold values from SmartDashboard. For performance reasons it is recommended to remove this after calibration is finished. - TOTE_HUE_RANGE.minValue = (int)SmartDashboard.getNumber("Tote hue min", TOTE_HUE_RANGE.minValue); - TOTE_HUE_RANGE.maxValue = (int)SmartDashboard.getNumber("Tote hue max", TOTE_HUE_RANGE.maxValue); - TOTE_SAT_RANGE.minValue = (int)SmartDashboard.getNumber("Tote sat min", TOTE_SAT_RANGE.minValue); - TOTE_SAT_RANGE.maxValue = (int)SmartDashboard.getNumber("Tote sat max", TOTE_SAT_RANGE.maxValue); - TOTE_VAL_RANGE.minValue = (int)SmartDashboard.getNumber("Tote val min", TOTE_VAL_RANGE.minValue); - TOTE_VAL_RANGE.maxValue = (int)SmartDashboard.getNumber("Tote val max", TOTE_VAL_RANGE.maxValue); - - //Threshold the image looking for yellow (tote color) - NIVision.imaqColorThreshold(binaryFrame, frame, 255, NIVision.ColorMode.HSV, TOTE_HUE_RANGE, TOTE_SAT_RANGE, TOTE_VAL_RANGE); - - //Send particle count to dashboard - int numParticles = NIVision.imaqCountParticles(binaryFrame, 1); - SmartDashboard.putNumber("Masked particles", numParticles); - - //Send masked image to dashboard to assist in tweaking mask. - CameraServer.getInstance().setImage(binaryFrame); - - //filter out small particles - float areaMin = (float)SmartDashboard.getNumber("Area min %", AREA_MINIMUM); - criteria[0].lower = areaMin; - imaqError = NIVision.imaqParticleFilter4(binaryFrame, binaryFrame, criteria, filterOptions, null); - - //Send particle count after filtering to dashboard - numParticles = NIVision.imaqCountParticles(binaryFrame, 1); - SmartDashboard.putNumber("Filtered particles", numParticles); - - if(numParticles > 0) - { - //Measure particles and sort by particle size - Vector particles = new Vector(); - for(int particleIndex = 0; particleIndex < numParticles; particleIndex++) - { - ParticleReport par = new ParticleReport(); - par.PercentAreaToImageArea = NIVision.imaqMeasureParticle(binaryFrame, particleIndex, 0, NIVision.MeasurementType.MT_AREA_BY_IMAGE_AREA); - par.Area = NIVision.imaqMeasureParticle(binaryFrame, particleIndex, 0, NIVision.MeasurementType.MT_AREA); - par.ConvexHullArea = NIVision.imaqMeasureParticle(binaryFrame, particleIndex, 0, NIVision.MeasurementType.MT_CONVEX_HULL_AREA); - par.BoundingRectTop = NIVision.imaqMeasureParticle(binaryFrame, particleIndex, 0, NIVision.MeasurementType.MT_BOUNDING_RECT_TOP); - par.BoundingRectLeft = NIVision.imaqMeasureParticle(binaryFrame, particleIndex, 0, NIVision.MeasurementType.MT_BOUNDING_RECT_LEFT); - par.BoundingRectBottom = NIVision.imaqMeasureParticle(binaryFrame, particleIndex, 0, NIVision.MeasurementType.MT_BOUNDING_RECT_BOTTOM); - par.BoundingRectRight = NIVision.imaqMeasureParticle(binaryFrame, particleIndex, 0, NIVision.MeasurementType.MT_BOUNDING_RECT_RIGHT); - particles.add(par); - } - particles.sort(null); - - //This example only scores the largest particle. Extending to score all particles and choosing the desired one is left as an exercise - //for the reader. Note that the long and short side scores expect a single tote and will not work for a stack of 2 or more totes. - //Modification of the code to accommodate 2 or more stacked totes is left as an exercise for the reader. - scores.Trapezoid = TrapezoidScore(particles.elementAt(0)); - SmartDashboard.putNumber("Trapezoid", scores.Trapezoid); - scores.LongAspect = LongSideScore(particles.elementAt(0)); - SmartDashboard.putNumber("Long Aspect", scores.LongAspect); - scores.ShortAspect = ShortSideScore(particles.elementAt(0)); - SmartDashboard.putNumber("Short Aspect", scores.ShortAspect); - scores.AreaToConvexHullArea = ConvexHullAreaScore(particles.elementAt(0)); - SmartDashboard.putNumber("Convex Hull Area", scores.AreaToConvexHullArea); - boolean isTote = scores.Trapezoid > SCORE_MIN && (scores.LongAspect > SCORE_MIN || scores.ShortAspect > SCORE_MIN) && scores.AreaToConvexHullArea > SCORE_MIN; - boolean isLong = scores.LongAspect > scores.ShortAspect; - - //Send distance and tote status to dashboard. The bounding rect, particularly the horizontal center (left - right) may be useful for rotating/driving towards a tote - SmartDashboard.putBoolean("IsTote", isTote); - SmartDashboard.putNumber("Distance", computeDistance(binaryFrame, particles.elementAt(0), isLong)); - } else { - SmartDashboard.putBoolean("IsTote", false); - } - - Timer.delay(0.005); // wait for a motor update time - } - } - - public void operatorControl() { - while(isOperatorControl() && isEnabled()) { - Timer.delay(0.005); // wait for a motor update time - } - } - - //Comparator function for sorting particles. Returns true if particle 1 is larger - static boolean CompareParticleSizes(ParticleReport particle1, ParticleReport particle2) - { - //we want descending sort order - return particle1.PercentAreaToImageArea > particle2.PercentAreaToImageArea; - } - - /** - * Converts a ratio with ideal value of 1 to a score. The resulting function is piecewise - * linear going from (0,0) to (1,100) to (2,0) and is 0 for all inputs outside the range 0-2 - */ - double ratioToScore(double ratio) - { - return (Math.max(0, Math.min(100*(1-Math.abs(1-ratio)), 100))); - } - - /** - * Method to score convex hull area. This scores how "complete" the particle is. Particles with large holes will score worse than a filled in shape - */ - double ConvexHullAreaScore(ParticleReport report) - { - return ratioToScore((report.Area/report.ConvexHullArea)*1.18); - } - - /** - * Method to score if the particle appears to be a trapezoid. Compares the convex hull (filled in) area to the area of the bounding box. - * The expectation is that the convex hull area is about 95.4% of the bounding box area for an ideal tote. - */ - double TrapezoidScore(ParticleReport report) - { - return ratioToScore(report.ConvexHullArea/((report.BoundingRectRight-report.BoundingRectLeft)*(report.BoundingRectBottom-report.BoundingRectTop)*.954)); - } - - /** - * Method to score if the aspect ratio of the particle appears to match the long side of a tote. - */ - double LongSideScore(ParticleReport report) - { - return ratioToScore(((report.BoundingRectRight-report.BoundingRectLeft)/(report.BoundingRectBottom-report.BoundingRectTop))/LONG_RATIO); - } - - /** - * Method to score if the aspect ratio of the particle appears to match the short side of a tote. - */ - double ShortSideScore(ParticleReport report){ - return ratioToScore(((report.BoundingRectRight-report.BoundingRectLeft)/(report.BoundingRectBottom-report.BoundingRectTop))/SHORT_RATIO); - } - - /** - * Computes the estimated distance to a target using the width of the particle in the image. For more information and graphics - * showing the math behind this approach see the Vision Processing section of the ScreenStepsLive documentation. - * - * @param image The image to use for measuring the particle estimated rectangle - * @param report The Particle Analysis Report for the particle - * @param isLong Boolean indicating if the target is believed to be the long side of a tote - * @return The estimated distance to the target in feet. - */ - double computeDistance (Image image, ParticleReport report, boolean isLong) { - double normalizedWidth, targetWidth; - NIVision.GetImageSizeResult size; - - size = NIVision.imaqGetImageSize(image); - normalizedWidth = 2*(report.BoundingRectRight - report.BoundingRectLeft)/size.width; - targetWidth = isLong ? 26.0 : 16.9; - - return targetWidth/(normalizedWidth*12*Math.tan(VIEW_ANGLE*Math.PI/(180*2))); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/2015Vision/Retro_src/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/2015Vision/Retro_src/Robot.java deleted file mode 100644 index 93633892b2..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/2015Vision/Retro_src/Robot.java +++ /dev/null @@ -1,214 +0,0 @@ -package $package; - -import java.lang.Math; -import java.util.Comparator; -import java.util.Vector; - -import com.ni.vision.NIVision; -import com.ni.vision.NIVision.Image; -import com.ni.vision.NIVision.ImageType; - -import edu.wpi.first.wpilibj.CameraServer; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.Timer; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; - -/** - * Example of finding yellow totes based on retroreflective target. - * This example utilizes an image file, which you need to copy to the roboRIO - * To use a camera you will have to integrate the appropriate camera details with this example. - * To use a USB camera instead, see the SimpelVision and AdvancedVision examples for details - * on using the USB camera. To use an Axis Camera, see the AxisCamera example for details on - * using an Axis Camera. - * - * Sample images can found here: http://wp.wpi.edu/wpilib/2015/01/16/sample-images-for-vision-projects/ - */ -public class Robot extends SampleRobot { - //A structure to hold measurements of a particle - public class ParticleReport implements Comparator, Comparable{ - double PercentAreaToImageArea; - double Area; - double BoundingRectLeft; - double BoundingRectTop; - double BoundingRectRight; - double BoundingRectBottom; - - public int compareTo(ParticleReport r) - { - return (int)(r.Area - this.Area); - } - - public int compare(ParticleReport r1, ParticleReport r2) - { - return (int)(r1.Area - r2.Area); - } - }; - - //Structure to represent the scores for the various tests used for target identification - public class Scores { - double Area; - double Aspect; - }; - - //Images - Image frame; - Image binaryFrame; - int imaqError; - - //Constants - NIVision.Range TOTE_HUE_RANGE = new NIVision.Range(101, 64); //Default hue range for yellow tote - NIVision.Range TOTE_SAT_RANGE = new NIVision.Range(88, 255); //Default saturation range for yellow tote - NIVision.Range TOTE_VAL_RANGE = new NIVision.Range(134, 255); //Default value range for yellow tote - double AREA_MINIMUM = 0.5; //Default Area minimum for particle as a percentage of total image area - double LONG_RATIO = 2.22; //Tote long side = 26.9 / Tote height = 12.1 = 2.22 - double SHORT_RATIO = 1.4; //Tote short side = 16.9 / Tote height = 12.1 = 1.4 - double SCORE_MIN = 75.0; //Minimum score to be considered a tote - double VIEW_ANGLE = 49.4; //View angle fo camera, set to Axis m1011 by default, 64 for m1013, 51.7 for 206, 52 for HD3000 square, 60 for HD3000 640x480 - NIVision.ParticleFilterCriteria2 criteria[] = new NIVision.ParticleFilterCriteria2[1]; - NIVision.ParticleFilterOptions2 filterOptions = new NIVision.ParticleFilterOptions2(0,0,1,1); - Scores scores = new Scores(); - - public void robotInit() { - // create images - frame = NIVision.imaqCreateImage(ImageType.IMAGE_RGB, 0); - binaryFrame = NIVision.imaqCreateImage(ImageType.IMAGE_U8, 0); - criteria[0] = new NIVision.ParticleFilterCriteria2(NIVision.MeasurementType.MT_AREA_BY_IMAGE_AREA, AREA_MINIMUM, 100.0, 0, 0); - - //Put default values to SmartDashboard so fields will appear - SmartDashboard.putNumber("Tote hue min", TOTE_HUE_RANGE.minValue); - SmartDashboard.putNumber("Tote hue max", TOTE_HUE_RANGE.maxValue); - SmartDashboard.putNumber("Tote sat min", TOTE_SAT_RANGE.minValue); - SmartDashboard.putNumber("Tote sat max", TOTE_SAT_RANGE.maxValue); - SmartDashboard.putNumber("Tote val min", TOTE_VAL_RANGE.minValue); - SmartDashboard.putNumber("Tote val max", TOTE_VAL_RANGE.maxValue); - SmartDashboard.putNumber("Area min %", AREA_MINIMUM); - } - - public void autonomous() { - while (isAutonomous() && isEnabled()) - { - //read file in from disk. For this example to run you need to copy image.jpg from the SampleImages folder to the - //directory shown below using FTP or SFTP: http://wpilib.screenstepslive.com/s/4485/m/24166/l/282299-roborio-ftp - NIVision.imaqReadFile(frame, "/home/lvuser/SampleImages/image.jpg"); - - //Update threshold values from SmartDashboard. For performance reasons it is recommended to remove this after calibration is finished. - TOTE_HUE_RANGE.minValue = (int)SmartDashboard.getNumber("Tote hue min", TOTE_HUE_RANGE.minValue); - TOTE_HUE_RANGE.maxValue = (int)SmartDashboard.getNumber("Tote hue max", TOTE_HUE_RANGE.maxValue); - TOTE_SAT_RANGE.minValue = (int)SmartDashboard.getNumber("Tote sat min", TOTE_SAT_RANGE.minValue); - TOTE_SAT_RANGE.maxValue = (int)SmartDashboard.getNumber("Tote sat max", TOTE_SAT_RANGE.maxValue); - TOTE_VAL_RANGE.minValue = (int)SmartDashboard.getNumber("Tote val min", TOTE_VAL_RANGE.minValue); - TOTE_VAL_RANGE.maxValue = (int)SmartDashboard.getNumber("Tote val max", TOTE_VAL_RANGE.maxValue); - - //Threshold the image looking for yellow (tote color) - NIVision.imaqColorThreshold(binaryFrame, frame, 255, NIVision.ColorMode.HSV, TOTE_HUE_RANGE, TOTE_SAT_RANGE, TOTE_VAL_RANGE); - - //Send particle count to dashboard - int numParticles = NIVision.imaqCountParticles(binaryFrame, 1); - SmartDashboard.putNumber("Masked particles", numParticles); - - //Send masked image to dashboard to assist in tweaking mask. - CameraServer.getInstance().setImage(binaryFrame); - - //filter out small particles - float areaMin = (float)SmartDashboard.getNumber("Area min %", AREA_MINIMUM); - criteria[0].lower = areaMin; - imaqError = NIVision.imaqParticleFilter4(binaryFrame, binaryFrame, criteria, filterOptions, null); - - //Send particle count after filtering to dashboard - numParticles = NIVision.imaqCountParticles(binaryFrame, 1); - SmartDashboard.putNumber("Filtered particles", numParticles); - - if(numParticles > 0) - { - //Measure particles and sort by particle size - Vector particles = new Vector(); - for(int particleIndex = 0; particleIndex < numParticles; particleIndex++) - { - ParticleReport par = new ParticleReport(); - par.PercentAreaToImageArea = NIVision.imaqMeasureParticle(binaryFrame, particleIndex, 0, NIVision.MeasurementType.MT_AREA_BY_IMAGE_AREA); - par.Area = NIVision.imaqMeasureParticle(binaryFrame, particleIndex, 0, NIVision.MeasurementType.MT_AREA); - par.BoundingRectTop = NIVision.imaqMeasureParticle(binaryFrame, particleIndex, 0, NIVision.MeasurementType.MT_BOUNDING_RECT_TOP); - par.BoundingRectLeft = NIVision.imaqMeasureParticle(binaryFrame, particleIndex, 0, NIVision.MeasurementType.MT_BOUNDING_RECT_LEFT); - par.BoundingRectBottom = NIVision.imaqMeasureParticle(binaryFrame, particleIndex, 0, NIVision.MeasurementType.MT_BOUNDING_RECT_BOTTOM); - par.BoundingRectRight = NIVision.imaqMeasureParticle(binaryFrame, particleIndex, 0, NIVision.MeasurementType.MT_BOUNDING_RECT_RIGHT); - particles.add(par); - } - particles.sort(null); - - //This example only scores the largest particle. Extending to score all particles and choosing the desired one is left as an exercise - //for the reader. Note that this scores and reports information about a single particle (single L shaped target). To get accurate information - //about the location of the tote (not just the distance) you will need to correlate two adjacent targets in order to find the true center of the tote. - scores.Aspect = AspectScore(particles.elementAt(0)); - SmartDashboard.putNumber("Aspect", scores.Aspect); - scores.Area = AreaScore(particles.elementAt(0)); - SmartDashboard.putNumber("Area", scores.Area); - boolean isTote = scores.Aspect > SCORE_MIN && scores.Area > SCORE_MIN; - - //Send distance and tote status to dashboard. The bounding rect, particularly the horizontal center (left - right) may be useful for rotating/driving towards a tote - SmartDashboard.putBoolean("IsTote", isTote); - SmartDashboard.putNumber("Distance", computeDistance(binaryFrame, particles.elementAt(0))); - } else { - SmartDashboard.putBoolean("IsTote", false); - } - - Timer.delay(0.005); // wait for a motor update time - } - } - - public void operatorControl() { - while(isOperatorControl() && isEnabled()) { - Timer.delay(0.005); // wait for a motor update time - } - } - - //Comparator function for sorting particles. Returns true if particle 1 is larger - static boolean CompareParticleSizes(ParticleReport particle1, ParticleReport particle2) - { - //we want descending sort order - return particle1.PercentAreaToImageArea > particle2.PercentAreaToImageArea; - } - - /** - * Converts a ratio with ideal value of 1 to a score. The resulting function is piecewise - * linear going from (0,0) to (1,100) to (2,0) and is 0 for all inputs outside the range 0-2 - */ - double ratioToScore(double ratio) - { - return (Math.max(0, Math.min(100*(1-Math.abs(1-ratio)), 100))); - } - - double AreaScore(ParticleReport report) - { - double boundingArea = (report.BoundingRectBottom - report.BoundingRectTop) * (report.BoundingRectRight - report.BoundingRectLeft); - //Tape is 7" edge so 49" bounding rect. With 2" wide tape it covers 24" of the rect. - return ratioToScore((49/24)*report.Area/boundingArea); - } - - /** - * Method to score if the aspect ratio of the particle appears to match the retro-reflective target. Target is 7"x7" so aspect should be 1 - */ - double AspectScore(ParticleReport report) - { - return ratioToScore(((report.BoundingRectRight-report.BoundingRectLeft)/(report.BoundingRectBottom-report.BoundingRectTop))); - } - - /** - * Computes the estimated distance to a target using the width of the particle in the image. For more information and graphics - * showing the math behind this approach see the Vision Processing section of the ScreenStepsLive documentation. - * - * @param image The image to use for measuring the particle estimated rectangle - * @param report The Particle Analysis Report for the particle - * @param isLong Boolean indicating if the target is believed to be the long side of a tote - * @return The estimated distance to the target in feet. - */ - double computeDistance (Image image, ParticleReport report) { - double normalizedWidth, targetWidth; - NIVision.GetImageSizeResult size; - - size = NIVision.imaqGetImageSize(image); - normalizedWidth = 2*(report.BoundingRectRight - report.BoundingRectLeft)/size.width; - targetWidth = 7; - - return targetWidth/(normalizedWidth*12*Math.tan(VIEW_ANGLE*Math.PI/(180*2))); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/AxisCameraSample/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/AxisCameraSample/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100755 index 72e34ce1fa..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/AxisCameraSample/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,55 +0,0 @@ -package $package; - -import com.ni.vision.NIVision; -import com.ni.vision.NIVision.DrawMode; -import com.ni.vision.NIVision.Image; -import com.ni.vision.NIVision.ShapeMode; - -import edu.wpi.first.wpilibj.CameraServer; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.Timer; -import edu.wpi.first.wpilibj.vision.AxisCamera; - -/** - * This demo shows the use of the AxisCamera class. - * Uses AxisCamera class to manually acquire a new image each frame, and annotate the image by drawing - * a circle on it, and show it on the FRC Dashboard. - */ - -public class Robot extends SampleRobot { - int session; - Image frame; - AxisCamera camera; - - public void robotInit() { - - frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0); - - // open the camera at the IP address assigned. This is the IP address that the camera - // can be accessed through the web interface. - camera = new AxisCamera("10.1.91.100"); - } - - public void operatorControl() { - - /** - * grab an image from the camera, draw the circle, and provide it for the camera server - * which will in turn send it to the dashboard. - */ - NIVision.Rect rect = new NIVision.Rect(10, 10, 100, 100); - - while (isOperatorControl() && isEnabled()) { - camera.getImage(frame); - NIVision.imaqDrawShapeOnImage(frame, frame, rect, - DrawMode.DRAW_VALUE, ShapeMode.SHAPE_OVAL, 0.0f); - - CameraServer.getInstance().setImage(frame); - - /** robot code here! **/ - Timer.delay(0.005); // wait for a motor update time - } - } - - public void test() { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/CANTalon/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/CANTalon/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100755 index 3d4dbb1145..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/CANTalon/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,37 +0,0 @@ -package $package; - - -import edu.wpi.first.wpilibj.SpeedController; -import edu.wpi.first.wpilibj.CANTalon; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.Timer; - -/** - * This is a short sample program demonstrating how to use the basic throttle - * mode of the new CAN Talon. - */ -public class Robot extends SampleRobot { - - CANTalon motor; - - public Robot() { - motor = new CANTalon(1); // Initialize the CanTalonSRX on device 1. - } - - /** - * Runs the motor. - */ - public void operatorControl() { - while (isOperatorControl() && isEnabled()) { - // Set the motor's output to half power. - // This takes a number from -1 (100% speed in reverse) to +1 (100% speed - // going forward) - motor.set(0.5); - - Timer.delay(0.01); // Note that the CANTalon only receives updates every - // 10ms, so updating more quickly would not gain you - // anything. - } - motor.disable(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/CANTalonPID/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/CANTalonPID/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100755 index 090e1d8226..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/CANTalonPID/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,62 +0,0 @@ -package $package; - - -import edu.wpi.first.wpilibj.SpeedController; -import edu.wpi.first.wpilibj.CANTalon; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.Timer; - -/** - * This is a short sample program demonstrating how to use the Talon SRX over - * CAN to run a closed-loop PID controller with an analog potentiometer. - */ -public class Robot extends SampleRobot { - - CANTalon motor; - - public Robot() { - motor = new CANTalon(1); // Initialize the CanTalonSRX on device 1. - - // This sets the mode of the m_motor. The options are: - // PercentVbus: basic throttle; no closed-loop. - // Current: Runs the motor with the specified current if possible. - // Speed: Runs a PID control loop to keep the motor going at a constant - // speed using the specified sensor. - // Position: Runs a PID control loop to move the motor to a specified move - // the motor to a specified sensor position. - // Voltage: Runs the m_motor at a constant voltage, if possible. - // Follower: The m_motor will run at the same throttle as the specified - // other talon. - motor.changeControlMode(CANTalon.ControlMode.Position); - // This command allows you to specify which feedback device to use when doing - // closed-loop control. The options are: - // AnalogPot: Basic analog potentiometer - // QuadEncoder: Quadrature Encoder - // AnalogEncoder: Analog Encoder - // EncRising: Counts the rising edges of the QuadA pin (allows use of a - // non-quadrature encoder) - // EncFalling: Same as EncRising, but counts on falling edges. - motor.setFeedbackDevice(CANTalon.FeedbackDevice.AnalogPot); - // This sets the basic P, I , and D values (F, Izone, and rampRate can also - // be set, but are ignored here). - // These must all be positive floating point numbers (reverseSensor will - // multiply the sensor values by negative one in case your sensor is flipped - // relative to your motor). - // These values are in units of throttle / sensor_units where throttle ranges - // from -1023 to +1023 and sensor units are from 0 - 1023 for analog - // potentiometers, encoder ticks for encoders, and position / 10ms for - // speeds. - motor.setPID(1.0, 0.0, 0.0); - } - - public void operatorControl() { - while (isOperatorControl() && isEnabled()) { - // In closed loop mode, this sets the goal in the units mentioned above. - // Since we are using an analog potentiometer, this will try to go to - // the middle of the potentiometer range. - motor.set(512); - - Timer.delay(5.0); - } - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/OI.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/OI.java deleted file mode 100644 index 19b93f17ed..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/OI.java +++ /dev/null @@ -1,57 +0,0 @@ - -package $package; - -import edu.wpi.first.wpilibj.Joystick; -import edu.wpi.first.wpilibj.buttons.JoystickButton; -import $package.commands.*; - -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; - -/** - * This class is the glue that binds the controls on the physical operator - * interface to the commands and command groups that allow control of the robot. - */ -public class OI { - private Joystick joy = new Joystick(0); - - public OI() { - // Put Some buttons on the SmartDashboard - SmartDashboard.putData("Elevator Bottom", new SetElevatorSetpoint(0)); - SmartDashboard.putData("Elevator Platform", new SetElevatorSetpoint(0.2)); - SmartDashboard.putData("Elevator Top", new SetElevatorSetpoint(0.3)); - - SmartDashboard.putData("Wrist Horizontal", new SetWristSetpoint(0)); - SmartDashboard.putData("Raise Wrist", new SetWristSetpoint(-45)); - - SmartDashboard.putData("Open Claw", new OpenClaw()); - SmartDashboard.putData("Close Claw", new CloseClaw()); - - SmartDashboard.putData("Deliver Soda", new Autonomous()); - - // Create some buttons - JoystickButton d_up = new JoystickButton(joy, 5); - JoystickButton d_right= new JoystickButton(joy, 6); - JoystickButton d_down= new JoystickButton(joy, 7); - JoystickButton d_left = new JoystickButton(joy, 8); - JoystickButton l2 = new JoystickButton(joy, 9); - JoystickButton r2 = new JoystickButton(joy, 10); - JoystickButton l1 = new JoystickButton(joy, 11); - JoystickButton r1 = new JoystickButton(joy, 12); - - // Connect the buttons to commands - d_up.whenPressed(new SetElevatorSetpoint(0.2)); - d_down.whenPressed(new SetElevatorSetpoint(-0.2)); - d_right.whenPressed(new CloseClaw()); - d_left.whenPressed(new OpenClaw()); - - r1.whenPressed(new PrepareToPickup()); - r2.whenPressed(new Pickup()); - l1.whenPressed(new Place()); - l2.whenPressed(new Autonomous()); - } - - public Joystick getJoystick() { - return joy; - } -} - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100644 index 4fe9902f3e..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,103 +0,0 @@ -/*----------------------------------------------------------------------------*/ -/* Copyright (c) FIRST 2008. All Rights Reserved. */ -/* Open Source Software - may be modified and shared by FRC teams. The code */ -/* must be accompanied by the FIRST BSD license file in the root directory of */ -/* the project. */ -/*----------------------------------------------------------------------------*/ - -package $package; - -import edu.wpi.first.wpilibj.IterativeRobot; -import edu.wpi.first.wpilibj.command.Command; -import edu.wpi.first.wpilibj.command.Scheduler; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; -import $package.commands.Autonomous; -import $package.subsystems.Claw; -import $package.subsystems.DriveTrain; -import $package.subsystems.Elevator; -import $package.subsystems.Wrist; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; - -/** - * The VM is configured to automatically run this class, and to call the - * functions corresponding to each mode, as described in the IterativeRobot - * documentation. If you change the name of this class or the package after - * creating this project, you must also update the manifest file in the resource - * directory. - */ -public class Robot extends IterativeRobot { - Command autonomousCommand; - - public static DriveTrain drivetrain; - public static Elevator elevator; - public static Wrist wrist; - public static Claw claw; - public static OI oi; - - /** - * This function is run when the robot is first started up and should be - * used for any initialization code. - */ - public void robotInit() { - // Initialize all subsystems - drivetrain = new DriveTrain(); - elevator = new Elevator(); - wrist = new Wrist(); - claw = new Claw(); - oi = new OI(); - - // instantiate the command used for the autonomous period - autonomousCommand = new Autonomous(); - - // Show what command your subsystem is running on the SmartDashboard - SmartDashboard.putData(drivetrain); - SmartDashboard.putData(elevator); - SmartDashboard.putData(wrist); - SmartDashboard.putData(claw); - } - - public void autonomousInit() { - autonomousCommand.start(); // schedule the autonomous command (example) - } - - /** - * This function is called periodically during autonomous - */ - public void autonomousPeriodic() { - Scheduler.getInstance().run(); - log(); - } - - public void teleopInit() { - // This makes sure that the autonomous stops running when - // teleop starts running. If you want the autonomous to - // continue until interrupted by another command, remove - // this line or comment it out. - autonomousCommand.cancel(); - } - - /** - * This function is called periodically during operator control - */ - public void teleopPeriodic() { - Scheduler.getInstance().run(); - log(); - } - - /** - * This function is called periodically during test mode - */ - public void testPeriodic() { - LiveWindow.run(); - } - - /** - * The log method puts interesting information to the SmartDashboard. - */ - private void log() { - wrist.log(); - elevator.log(); - drivetrain.log(); - claw.log(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/Autonomous.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/Autonomous.java deleted file mode 100644 index e2cfbe8f12..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/Autonomous.java +++ /dev/null @@ -1,22 +0,0 @@ - -package $package.commands; - -import edu.wpi.first.wpilibj.command.CommandGroup; - -/** - * The main autonomous command to pickup and deliver the - * soda to the box. - */ -public class Autonomous extends CommandGroup { - public Autonomous() { - addSequential(new PrepareToPickup()); - addSequential(new Pickup()); - addSequential(new SetDistanceToBox(0.10)); - // addSequential(new DriveStraight(4)); // Use Encoders if ultrasonic is broken - addSequential(new Place()); - addSequential(new SetDistanceToBox(0.60)); - // addSequential(new DriveStraight(-2)); // Use Encoders if ultrasonic is broken - addParallel(new SetWristSetpoint(-45)); - addSequential(new CloseClaw()); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/CloseClaw.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/CloseClaw.java deleted file mode 100644 index 4a4cdfdde4..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/CloseClaw.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package $package.commands; - -import edu.wpi.first.wpilibj.command.Command; -import $package.Robot; - -/** - * Closes the claw for one second. Real robots should use sensors, stalling - * motors is BAD! - */ -public class CloseClaw extends Command { - - public CloseClaw() { - requires(Robot.claw); - } - - // Called just before this Command runs the first time - protected void initialize() { - Robot.claw.close(); - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() { - } - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return Robot.claw.isGrabbing(); - } - - // Called once after isFinished returns true - protected void end() { - // NOTE: Doesn't stop in simulation due to lower friction causing the can to fall out - // + there is no need to worry about stalling the motor or crushing the can. - if (!Robot.isSimulation()) - Robot.claw.stop(); - } - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() { - end(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/DriveStraight.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/DriveStraight.java deleted file mode 100644 index 352856f038..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/DriveStraight.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package $package.commands; - -import edu.wpi.first.wpilibj.PIDController; -import edu.wpi.first.wpilibj.PIDOutput; -import edu.wpi.first.wpilibj.PIDSource; -import edu.wpi.first.wpilibj.command.Command; -import $package.Robot; - -/** - * Drive the given distance straight (negative values go backwards). - * Uses a local PID controller to run a simple PID loop that is only - * enabled while this command is running. The input is the averaged - * values of the left and right encoders. - */ -public class DriveStraight extends Command { - private PIDController pid; - - public DriveStraight(double distance) { - requires(Robot.drivetrain); - pid = new PIDController(4, 0, 0, - new PIDSource() { public double pidGet() { - return Robot.drivetrain.getDistance(); - }}, - new PIDOutput() { public void pidWrite(double d) { - Robot.drivetrain.drive(d, d); - }}); - pid.setAbsoluteTolerance(0.01); - pid.setSetpoint(distance); - } - - // Called just before this Command runs the first time - protected void initialize() { - // Get everything in a safe starting state. - Robot.drivetrain.reset(); - pid.reset(); - pid.enable(); - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() {} - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return pid.onTarget(); - } - - // Called once after isFinished returns true - protected void end() { - // Stop PID and the wheels - pid.disable(); - Robot.drivetrain.drive(0, 0); - } - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() { - end(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/OpenClaw.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/OpenClaw.java deleted file mode 100644 index ca8bfd1ce1..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/OpenClaw.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package $package.commands; - -import edu.wpi.first.wpilibj.command.Command; -import $package.Robot; - -/** - * Opens the claw for one second. Real robots should use sensors, stalling - * motors is BAD! - */ -public class OpenClaw extends Command { - - public OpenClaw() { - requires(Robot.claw); - setTimeout(1); - } - - // Called just before this Command runs the first time - protected void initialize() { - Robot.claw.open(); - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() { - } - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return isTimedOut(); - } - - // Called once after isFinished returns true - protected void end() { - Robot.claw.stop(); - } - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() { - end(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/Pickup.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/Pickup.java deleted file mode 100644 index 940d2015c4..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/Pickup.java +++ /dev/null @@ -1,15 +0,0 @@ -package $package.commands; - -import edu.wpi.first.wpilibj.command.CommandGroup; - -/** - * Pickup a soda can (if one is between the open claws) and - * get it in a safe state to drive around. - */ -public class Pickup extends CommandGroup { - public Pickup() { - addSequential(new CloseClaw()); - addParallel(new SetWristSetpoint(-45)); - addSequential(new SetElevatorSetpoint(0.25)); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/Place.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/Place.java deleted file mode 100644 index ca060b8ff5..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/Place.java +++ /dev/null @@ -1,14 +0,0 @@ -package $package.commands; - -import edu.wpi.first.wpilibj.command.CommandGroup; - -/** - * Place a held soda can onto the platform. - */ -public class Place extends CommandGroup { - public Place() { - addSequential(new SetElevatorSetpoint(0.25)); - addSequential(new SetWristSetpoint(0)); - addSequential(new OpenClaw()); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/PrepareToPickup.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/PrepareToPickup.java deleted file mode 100644 index 47c1f9e2d9..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/PrepareToPickup.java +++ /dev/null @@ -1,14 +0,0 @@ -package $package.commands; - -import edu.wpi.first.wpilibj.command.CommandGroup; - -/** - * Make sure the robot is in a state to pickup soda cans. - */ -public class PrepareToPickup extends CommandGroup { - public PrepareToPickup() { - addParallel(new OpenClaw()); - addParallel(new SetWristSetpoint(0)); - addSequential(new SetElevatorSetpoint(0)); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/SetDistanceToBox.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/SetDistanceToBox.java deleted file mode 100644 index c56e6c23d3..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/SetDistanceToBox.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package $package.commands; - -import edu.wpi.first.wpilibj.PIDController; -import edu.wpi.first.wpilibj.PIDOutput; -import edu.wpi.first.wpilibj.PIDSource; -import edu.wpi.first.wpilibj.command.Command; -import $package.Robot; - -/** - * Drive until the robot is the given distance away from the box. Uses a local - * PID controller to run a simple PID loop that is only enabled while this - * command is running. The input is the averaged values of the left and right - * encoders. - */ -public class SetDistanceToBox extends Command { - private PIDController pid; - - public SetDistanceToBox(double distance) { - requires(Robot.drivetrain); - pid = new PIDController(-2, 0, 0, new PIDSource() { - public double pidGet() { - return Robot.drivetrain.getDistanceToObstacle(); - } - }, new PIDOutput() { - public void pidWrite(double d) { - Robot.drivetrain.drive(d, d); - } - }); - pid.setAbsoluteTolerance(0.01); - pid.setSetpoint(distance); - } - - // Called just before this Command runs the first time - protected void initialize() { - // Get everything in a safe starting state. - Robot.drivetrain.reset(); - pid.reset(); - pid.enable(); - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() { - } - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return pid.onTarget(); - } - - // Called once after isFinished returns true - protected void end() { - // Stop PID and the wheels - pid.disable(); - Robot.drivetrain.drive(0, 0); - } - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() { - end(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/SetElevatorSetpoint.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/SetElevatorSetpoint.java deleted file mode 100644 index e4f9763e63..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/SetElevatorSetpoint.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package $package.commands; - -import edu.wpi.first.wpilibj.command.Command; -import $package.Robot; - -/** - * Move the elevator to a given location. This command finishes when it is within - * the tolerance, but leaves the PID loop running to maintain the position. Other - * commands using the elevator should make sure they disable PID! - */ -public class SetElevatorSetpoint extends Command { - private double setpoint; - - public SetElevatorSetpoint(double setpoint) { - this.setpoint = setpoint; - requires(Robot.elevator); - } - - // Called just before this Command runs the first time - protected void initialize() { - Robot.elevator.enable(); - Robot.elevator.setSetpoint(setpoint); - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() { - } - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return Robot.elevator.onTarget(); - } - - // Called once after isFinished returns true - protected void end() { - } - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/SetWristSetpoint.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/SetWristSetpoint.java deleted file mode 100644 index e2c95e6a84..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/SetWristSetpoint.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package $package.commands; - -import edu.wpi.first.wpilibj.command.Command; -import $package.Robot; - -/** - * Move the wrist to a given angle. This command finishes when it is within - * the tolerance, but leaves the PID loop running to maintain the position. - * Other commands using the wrist should make sure they disable PID! - */ -public class SetWristSetpoint extends Command { - private double setpoint; - - public SetWristSetpoint(double setpoint) { - this.setpoint = setpoint; - requires(Robot.wrist); - } - - // Called just before this Command runs the first time - protected void initialize() { - Robot.wrist.enable(); - Robot.wrist.setSetpoint(setpoint); - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() { - } - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return Robot.wrist.onTarget(); - } - - // Called once after isFinished returns true - protected void end() { - } - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/TankDriveWithJoystick.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/TankDriveWithJoystick.java deleted file mode 100644 index 8296c4fd78..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/commands/TankDriveWithJoystick.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package $package.commands; - -import $package.Robot; -import edu.wpi.first.wpilibj.command.Command; - -/** - * Have the robot drive tank style using the PS3 Joystick until interrupted. - */ -public class TankDriveWithJoystick extends Command { - - public TankDriveWithJoystick() { - requires(Robot.drivetrain); - } - - // Called just before this Command runs the f iirst time - protected void initialize() {} - - // Called repeatedly when this Command is scheduled to run - protected void execute() { - Robot.drivetrain.drive(Robot.oi.getJoystick()); - } - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return false; // Runs until interrupted - } - - // Called once after isFinished returns true - protected void end() { - Robot.drivetrain.drive(0, 0); - } - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() { - end(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/Claw.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/Claw.java deleted file mode 100644 index f199317440..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/Claw.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package $package.subsystems; - -import edu.wpi.first.wpilibj.DigitalInput; -import edu.wpi.first.wpilibj.SpeedController; -import edu.wpi.first.wpilibj.Victor; -import edu.wpi.first.wpilibj.command.Subsystem; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; - -/** - * The claw subsystem is a simple system with a motor for opening and closing. - * If using stronger motors, you should probably use a sensor so that the - * motors don't stall. - */ -public class Claw extends Subsystem { - private SpeedController motor; - private DigitalInput contact; - - public Claw() { - super(); - motor = new Victor(7); - contact = new DigitalInput(5); - - // Let's show everything on the LiveWindow - LiveWindow.addActuator("Claw", "Motor", (Victor) motor); - LiveWindow.addActuator("Claw", "Limit Switch", contact); - } - - public void initDefaultCommand() {} - public void log() {} - - /** - * Set the claw motor to move in the open direction. - */ - public void open() { - motor.set(-1); - } - - /** - * Set the claw motor to move in the close direction. - */ - public void close() { - motor.set(1); - } - - /** - * Stops the claw motor from moving. - */ - public void stop() { - motor.set(0); - } - - /** - * Return true when the robot is grabbing an object hard enough - * to trigger the limit switch. - */ - public boolean isGrabbing() { - return contact.get(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/DriveTrain.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/DriveTrain.java deleted file mode 100644 index cd23edf782..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/DriveTrain.java +++ /dev/null @@ -1,134 +0,0 @@ -package $package.subsystems; - -import edu.wpi.first.wpilibj.AnalogGyro; -import edu.wpi.first.wpilibj.AnalogInput; -import edu.wpi.first.wpilibj.Encoder; -import edu.wpi.first.wpilibj.Joystick.AxisType; -import edu.wpi.first.wpilibj.Joystick; -import edu.wpi.first.wpilibj.RobotDrive; -import edu.wpi.first.wpilibj.SpeedController; -import edu.wpi.first.wpilibj.Talon; -import edu.wpi.first.wpilibj.command.Subsystem; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; -import $package.Robot; -import $package.commands.TankDriveWithJoystick; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; - -/** - * The DriveTrain subsystem incorporates the sensors and actuators attached to - * the robots chassis. These include four drive motors, a left and right encoder - * and a gyro. - */ -public class DriveTrain extends Subsystem { - private SpeedController front_left_motor, back_left_motor, - front_right_motor, back_right_motor; - private RobotDrive drive; - private Encoder left_encoder, right_encoder; - private AnalogInput rangefinder; - private AnalogGyro gyro; - - public DriveTrain() { - super(); - front_left_motor = new Talon(1); - back_left_motor = new Talon(2); - front_right_motor = new Talon(3); - back_right_motor = new Talon(4); - drive = new RobotDrive(front_left_motor, back_left_motor, - front_right_motor, back_right_motor); - left_encoder = new Encoder(1, 2); - right_encoder = new Encoder(3, 4); - - // Encoders may measure differently in the real world and in - // simulation. In this example the robot moves 0.042 barleycorns - // per tick in the real world, but the simulated encoders - // simulate 360 tick encoders. This if statement allows for the - // real robot to handle this difference in devices. - if (Robot.isReal()) { - left_encoder.setDistancePerPulse(0.042); - right_encoder.setDistancePerPulse(0.042); - } else { - // Circumference in ft = 4in/12(in/ft)*PI - left_encoder.setDistancePerPulse((4.0/12.0*Math.PI) / 360.0); - right_encoder.setDistancePerPulse((4.0/12.0*Math.PI) / 360.0); - } - - rangefinder = new AnalogInput(6); - gyro = new AnalogGyro(1); - - // Let's show everything on the LiveWindow - LiveWindow.addActuator("Drive Train", "Front_Left Motor", (Talon) front_left_motor); - LiveWindow.addActuator("Drive Train", "Back Left Motor", (Talon) back_left_motor); - LiveWindow.addActuator("Drive Train", "Front Right Motor", (Talon) front_right_motor); - LiveWindow.addActuator("Drive Train", "Back Right Motor", (Talon) back_right_motor); - LiveWindow.addSensor("Drive Train", "Left Encoder", left_encoder); - LiveWindow.addSensor("Drive Train", "Right Encoder", right_encoder); - LiveWindow.addSensor("Drive Train", "Rangefinder", rangefinder); - LiveWindow.addSensor("Drive Train", "Gyro", gyro); - } - - /** - * When no other command is running let the operator drive around - * using the PS3 joystick. - */ - public void initDefaultCommand() { - setDefaultCommand(new TankDriveWithJoystick()); - } - - /** - * The log method puts interesting information to the SmartDashboard. - */ - public void log() { - SmartDashboard.putNumber("Left Distance", left_encoder.getDistance()); - SmartDashboard.putNumber("Right Distance", right_encoder.getDistance()); - SmartDashboard.putNumber("Left Speed", left_encoder.getRate()); - SmartDashboard.putNumber("Right Speed", right_encoder.getRate()); - SmartDashboard.putNumber("Gyro", gyro.getAngle()); - } - - /** - * Tank style driving for the DriveTrain. - * @param left Speed in range [-1,1] - * @param right Speed in range [-1,1] - */ - public void drive(double left, double right) { - drive.tankDrive(left, right); - } - - /** - * @param joy The ps3 style joystick to use to drive tank style. - */ - public void drive(Joystick joy) { - drive(-joy.getY(), -joy.getAxis(AxisType.kThrottle)); - } - - /** - * @return The robots heading in degrees. - */ - public double getHeading() { - return gyro.getAngle(); - } - - /** - * Reset the robots sensors to the zero states. - */ - public void reset() { - gyro.reset(); - left_encoder.reset(); - right_encoder.reset(); - } - - /** - * @return The distance driven (average of left and right encoders). - */ - public double getDistance() { - return (left_encoder.getDistance() + right_encoder.getDistance())/2; - } - - /** - * @return The distance to the obstacle detected by the rangefinder. - */ - public double getDistanceToObstacle() { - // Really meters in simulation since it's a rangefinder... - return rangefinder.getAverageVoltage(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/Elevator.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/Elevator.java deleted file mode 100644 index c14308f00a..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/Elevator.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package $package.subsystems; - -import edu.wpi.first.wpilibj.AnalogPotentiometer; -import edu.wpi.first.wpilibj.SpeedController; -import edu.wpi.first.wpilibj.Victor; -import edu.wpi.first.wpilibj.command.PIDSubsystem; -import edu.wpi.first.wpilibj.interfaces.Potentiometer; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; - -import $package.Robot; - -/** - * The elevator subsystem uses PID to go to a given height. Unfortunately, in it's current - * state PID values for simulation are different than in the real world do to minor differences. - */ -public class Elevator extends PIDSubsystem { - private SpeedController motor; - private Potentiometer pot; - - private static final double kP_real = 4, kI_real = 0.07, - kP_simulation = 18, kI_simulation = 0.2; - - public Elevator() { - super(kP_real, kI_real, 0); - if (Robot.isSimulation()) { // Check for simulation and update PID values - getPIDController().setPID(kP_simulation, kI_simulation, 0, 0); - } - setAbsoluteTolerance(0.005); - - motor = new Victor(5); - - // Conversion value of potentiometer varies between the real world and simulation - if (Robot.isReal()) { - pot = new AnalogPotentiometer(2, -2.0/5); - } else { - pot = new AnalogPotentiometer(2); // Defaults to meters - } - - // Let's show everything on the LiveWindow - LiveWindow.addActuator("Elevator", "Motor", (Victor) motor); - LiveWindow.addSensor("Elevator", "Pot", (AnalogPotentiometer) pot); - LiveWindow.addActuator("Elevator", "PID", getPIDController()); - } - - public void initDefaultCommand() {} - - /** - * The log method puts interesting information to the SmartDashboard. - */ - public void log() { - SmartDashboard.putData("Wrist Pot", (AnalogPotentiometer) pot); - } - - /** - * Use the potentiometer as the PID sensor. This method is automatically - * called by the subsystem. - */ - protected double returnPIDInput() { - return pot.get(); - } - - - /** - * Use the motor as the PID output. This method is automatically called by - * the subsystem. - */ - protected void usePIDOutput(double d) { - motor.set(d); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/Wrist.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/Wrist.java deleted file mode 100644 index b5ab894d30..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GearsBot/src/org/usfirst/frc/team190/robot/subsystems/Wrist.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package $package.subsystems; - -import edu.wpi.first.wpilibj.AnalogPotentiometer; -import edu.wpi.first.wpilibj.SpeedController; -import edu.wpi.first.wpilibj.Victor; -import edu.wpi.first.wpilibj.command.PIDSubsystem; -import edu.wpi.first.wpilibj.interfaces.Potentiometer; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; - -import $package.Robot; - -/** - * The wrist subsystem is like the elevator, but with a rotational joint instead - * of a linear joint. - */ -public class Wrist extends PIDSubsystem { - private SpeedController motor; - private Potentiometer pot; - - private static final double kP_real = 1, - kP_simulation = 0.05; - - public Wrist() { - super(kP_real, 0, 0); - if (Robot.isSimulation()) { // Check for simulation and update PID values - getPIDController().setPID(kP_simulation, 0, 0, 0); - } - setAbsoluteTolerance(2.5); - - motor = new Victor(6); - - // Conversion value of potentiometer varies between the real world and simulation - if (Robot.isReal()) { - pot = new AnalogPotentiometer(3, -270.0/5); - } else { - pot = new AnalogPotentiometer(3); // Defaults to degrees - } - - // Let's show everything on the LiveWindow - LiveWindow.addActuator("Wrist", "Motor", (Victor) motor); - LiveWindow.addSensor("Wrist", "Pot", (AnalogPotentiometer) pot); - LiveWindow.addActuator("Wrist", "PID", getPIDController()); - } - - public void initDefaultCommand() {} - - /** - * The log method puts interesting information to the SmartDashboard. - */ - public void log() { - SmartDashboard.putData("Wrist Angle", (AnalogPotentiometer) pot); - } - - /** - * Use the potentiometer as the PID sensor. This method is automatically - * called by the subsystem. - */ - protected double returnPIDInput() { - return pot.get(); - } - - /** - * Use the motor as the PID output. This method is automatically called by - * the subsystem. - */ - protected void usePIDOutput(double d) { - motor.set(d); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GettingStarted/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GettingStarted/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100644 index 9524c56547..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GettingStarted/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,69 +0,0 @@ -package $package; - -import edu.wpi.first.wpilibj.IterativeRobot; -import edu.wpi.first.wpilibj.Joystick; -import edu.wpi.first.wpilibj.RobotDrive; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; - -/** - * The VM is configured to automatically run this class, and to call the - * functions corresponding to each mode, as described in the IterativeRobot - * documentation. If you change the name of this class or the package after - * creating this project, you must also update the manifest file in the resource - * directory. - */ -public class Robot extends IterativeRobot { - RobotDrive myRobot; - Joystick stick; - int autoLoopCounter; - - /** - * This function is run when the robot is first started up and should be - * used for any initialization code. - */ - public void robotInit() { - myRobot = new RobotDrive(0,1); - stick = new Joystick(0); - } - - /** - * This function is run once each time the robot enters autonomous mode - */ - public void autonomousInit() { - autoLoopCounter = 0; - } - - /** - * This function is called periodically during autonomous - */ - public void autonomousPeriodic() { - if(autoLoopCounter < 100) //Check if we've completed 100 loops (approximately 2 seconds) - { - myRobot.drive(-0.5, 0.0); // drive forwards half speed - autoLoopCounter++; - } else { - myRobot.drive(0.0, 0.0); // stop robot - } - } - - /** - * This function is called once each time the robot enters tele-operated mode - */ - public void teleopInit(){ - } - - /** - * This function is called periodically during operator control - */ - public void teleopPeriodic() { - myRobot.arcadeDrive(stick); - } - - /** - * This function is called periodically during test mode - */ - public void testPeriodic() { - LiveWindow.run(); - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Gyro/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Gyro/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100644 index ac0163cb43..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Gyro/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,86 +0,0 @@ - -package $package; - -import edu.wpi.first.wpilibj.AnalogGyro; -import edu.wpi.first.wpilibj.CANTalon; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.RobotDrive; -import edu.wpi.first.wpilibj.Joystick; - -/** - * This is a sample program to demonstrate how to use a gyro sensor to make a robot drive - * straight. This program uses a joystick to drive forwards and backwards while the gyro - * is used for direction keeping. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -public class Robot extends SampleRobot { - - final int gyroChannel = 0; //analog input - final int joystickChannel = 0; //usb number in DriverStation - - //channels for motors - final int leftMotorChannel = 1; - final int rightMotorChannel = 0; - final int leftRearMotorChannel = 3; - final int rightRearMotorChannel = 2; - - double angleSetpoint = 0.0; - final double pGain = .006; //propotional turning constant - - //gyro calibration constant, may need to be adjusted; - //gyro value of 360 is set to correspond to one full revolution - final double voltsPerDegreePerSecond = .0128; - - RobotDrive myRobot; - AnalogGyro gyro; - Joystick joystick; - - public Robot() - { - //make objects for the drive train, gyro, and joystick - myRobot = new RobotDrive(new CANTalon(leftMotorChannel), new CANTalon( - leftRearMotorChannel), new CANTalon(rightMotorChannel), - new CANTalon(rightRearMotorChannel)); - gyro = new AnalogGyro(gyroChannel); - joystick = new Joystick(joystickChannel); - } - - /** - * Runs during autonomous. - */ - public void autonomous() { - - } - - /** - * Sets the gyro sensitivity and drives the robot when the joystick is pushed. The - * motor speed is set from the joystick while the RobotDrive turning value is assigned - * from the error between the setpoint and the gyro angle. - */ - public void operatorControl() { - double turningValue; - gyro.setSensitivity(voltsPerDegreePerSecond); //calibrates gyro values to equal degrees - while (isOperatorControl() && isEnabled()) { - - turningValue = (angleSetpoint - gyro.getAngle())*pGain; - if(joystick.getY() <= 0) - { - //forwards - myRobot.drive(joystick.getY(), turningValue); - } else { - //backwards - myRobot.drive(joystick.getY(), -turningValue); - } - } - } - - /** - * Runs during test mode. - */ - public void test(){ - - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GyroMecanum/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GyroMecanum/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100644 index ceffce0e64..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/GyroMecanum/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,71 +0,0 @@ - -package $package; - -import edu.wpi.first.wpilibj.AnalogGyro; -import edu.wpi.first.wpilibj.CANTalon; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.RobotDrive; -import edu.wpi.first.wpilibj.Joystick; -import edu.wpi.first.wpilibj.Timer; -import edu.wpi.first.wpilibj.RobotDrive.MotorType; - -/** - * This is a sample program that uses mecanum drive with a gyro sensor to maintian - * rotation vectorsin relation to the starting orientation of the robot (field-oriented controls). - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -public class Robot extends SampleRobot { - RobotDrive myRobot; - Joystick joystick; - AnalogGyro gyro; - - //channels for motors - final int leftMotorChannel = 1; - final int rightMotorChannel = 0; - final int leftRearMotorChannel = 3; - final int rightRearMotorChannel = 2; - - final int gyroChannel = 0; //analog input - - //gyro calibration constant, may need to be adjusted so that a gyro value of 360 - //equals 360 degrees - final double voltsPerDegreePerSecond = .0128; - - public Robot() { - //make objects for drive train, joystick, and gyro - myRobot = new RobotDrive(new CANTalon(leftMotorChannel), new CANTalon(leftRearMotorChannel), - new CANTalon(rightMotorChannel), new CANTalon(rightRearMotorChannel)); - myRobot.setInvertedMotor(MotorType.kFrontLeft, true); // invert the left side motors - myRobot.setInvertedMotor(MotorType.kRearLeft, true); // you may need to change or remove this to match your robot - - joystick = new Joystick(0); - gyro = new AnalogGyro(gyroChannel); - } - - /** - * Runs during autonomous. - */ - public void autonomous() { - - } - - /** - * Gyro sensitivity is set and mecanum drive is used with the gyro angle as an input. - */ - public void operatorControl() { - gyro.setSensitivity(voltsPerDegreePerSecond); //calibrate gyro to have the value equal to degrees - while (isOperatorControl() && isEnabled()) { - myRobot.mecanumDrive_Cartesian(joystick.getX(), joystick.getY(), joystick.getZ(), gyro.getAngle()); - Timer.delay(0.005); // wait 5ms to avoid hogging CPU cycles - } - } - - /** - * Runs during test mode - */ - public void test() { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/IntermediateVision/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/IntermediateVision/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100755 index f26661f198..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/IntermediateVision/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,57 +0,0 @@ -package $package; - -import com.ni.vision.NIVision; -import com.ni.vision.NIVision.DrawMode; -import com.ni.vision.NIVision.Image; -import com.ni.vision.NIVision.ShapeMode; - -import edu.wpi.first.wpilibj.CameraServer; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.Timer; - -/** - * This is a demo program showing the use of the NIVision class to do vision processing. - * The image is acquired from the USB Webcam, then a circle is overlayed on it. - * The NIVision class supplies dozens of methods for different types of processing. - * The resulting image can then be sent to the FRC PC Dashboard with setImage() - */ -public class Robot extends SampleRobot { - int session; - Image frame; - - public void robotInit() { - - frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0); - - // the camera name (ex "cam0") can be found through the roborio web interface - session = NIVision.IMAQdxOpenCamera("cam0", - NIVision.IMAQdxCameraControlMode.CameraControlModeController); - NIVision.IMAQdxConfigureGrab(session); - } - - public void operatorControl() { - NIVision.IMAQdxStartAcquisition(session); - - /** - * grab an image, draw the circle, and provide it for the camera server - * which will in turn send it to the dashboard. - */ - NIVision.Rect rect = new NIVision.Rect(10, 10, 100, 100); - - while (isOperatorControl() && isEnabled()) { - - NIVision.IMAQdxGrab(session, frame, 1); - NIVision.imaqDrawShapeOnImage(frame, frame, rect, - DrawMode.DRAW_VALUE, ShapeMode.SHAPE_OVAL, 0.0f); - - CameraServer.getInstance().setImage(frame); - - /** robot code here! **/ - Timer.delay(0.005); // wait for a motor update time - } - NIVision.IMAQdxStopAcquisition(session); - } - - public void test() { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MecanumDrive/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MecanumDrive/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100755 index 492e13a2f0..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MecanumDrive/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,52 +0,0 @@ -package $package; - - -import edu.wpi.first.wpilibj.Joystick; -import edu.wpi.first.wpilibj.RobotDrive; -import edu.wpi.first.wpilibj.RobotDrive.MotorType; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.Timer; - -/** - * This is a demo program showing how to use Mecanum control with the RobotDrive class. - */ -public class Robot extends SampleRobot { - - RobotDrive robotDrive; - Joystick stick; - - // Channels for the wheels - final int frontLeftChannel = 2; - final int rearLeftChannel = 3; - final int frontRightChannel = 1; - final int rearRightChannel = 0; - - // The channel on the driver station that the joystick is connected to - final int joystickChannel = 0; - - public Robot() { - robotDrive = new RobotDrive(frontLeftChannel, rearLeftChannel, frontRightChannel, rearRightChannel); - robotDrive.setInvertedMotor(MotorType.kFrontLeft, true); // invert the left side motors - robotDrive.setInvertedMotor(MotorType.kRearLeft, true); // you may need to change or remove this to match your robot - robotDrive.setExpiration(0.1); - - stick = new Joystick(joystickChannel); - } - - - /** - * Runs the motors with Mecanum drive. - */ - public void operatorControl() { - robotDrive.setSafetyEnabled(true); - while (isOperatorControl() && isEnabled()) { - - // Use the joystick X axis for lateral movement, Y axis for forward movement, and Z axis for rotation. - // This sample does not use field-oriented drive, so the gyro input is set to zero. - robotDrive.mecanumDrive_Cartesian(stick.getX(), stick.getY(), stick.getZ(), 0); - - Timer.delay(0.005); // wait 5ms to avoid hogging CPU cycles - } - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MotorControl/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MotorControl/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100755 index 3afd18751d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/MotorControl/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,44 +0,0 @@ -package $package; - - -import edu.wpi.first.wpilibj.Joystick; -import edu.wpi.first.wpilibj.SpeedController; -import edu.wpi.first.wpilibj.Talon; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.Timer; - -/** - * This sample program shows how to control a motor using a joystick. In the operator - * control part of the program, the joystick is read and the value is written to the motor. - * - * Joystick analog values range from -1 to 1 and speed controller inputs also range from -1 - * to 1 making it easy to work together. The program also delays a short time in the loop - * to allow other threads to run. This is generally a good idea, especially since the joystick - * values are only transmitted from the Driver Station once every 20ms. - */ -public class Robot extends SampleRobot { - - private SpeedController motor; // the motor to directly control with a joystick - private Joystick stick; - - private final double k_updatePeriod = 0.005; // update every 0.005 seconds/5 milliseconds (200Hz) - - public Robot() { - motor = new Talon(0); // initialize the motor as a Talon on channel 0 - stick = new Joystick(0); // initialize the joystick on port 0 - } - - /** - * Runs the motor from a joystick. - */ - public void operatorControl() { - while (isOperatorControl() && isEnabled()) { - // Set the motor's output. - // This takes a number from -1 (100% speed in reverse) to +1 (100% speed going forward) - motor.set(stick.getY()); - - Timer.delay(k_updatePeriod); // wait 5ms to the next update - } - - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/OI.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/OI.java deleted file mode 100644 index cdd515b3f4..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/OI.java +++ /dev/null @@ -1,48 +0,0 @@ -package $package; - -import $package.commands.Collect; -import $package.commands.DriveForward; -import $package.commands.LowGoal; -import $package.commands.SetCollectionSpeed; -import $package.commands.SetPivotSetpoint; -import $package.commands.Shoot; -import $package.subsystems.Collector; -import $package.subsystems.Pivot; -import $package.triggers.DoubleButton; - -import edu.wpi.first.wpilibj.Joystick; -import edu.wpi.first.wpilibj.buttons.JoystickButton; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; - -/** - * The operator interface of the robot, it has been simplified from the real - * robot to allow control with a single PS3 joystick. As a result, not all - * functionality from the real robot is available. - */ -public class OI { - public Joystick joystick; - - public OI() { - joystick = new Joystick(0); - - new JoystickButton(joystick, 12).whenPressed(new LowGoal()); - new JoystickButton(joystick, 10).whenPressed(new Collect()); - - new JoystickButton(joystick, 11).whenPressed(new SetPivotSetpoint(Pivot.SHOOT)); - new JoystickButton(joystick, 9).whenPressed(new SetPivotSetpoint(Pivot.SHOOT_NEAR)); - - new DoubleButton(joystick, 2, 3).whenActive(new Shoot()); - - - // SmartDashboard Buttons - SmartDashboard.putData("Drive Forward", new DriveForward(2.25)); - SmartDashboard.putData("Drive Backward", new DriveForward(-2.25)); - SmartDashboard.putData("Start Rollers", new SetCollectionSpeed(Collector.FORWARD)); - SmartDashboard.putData("Stop Rollers", new SetCollectionSpeed(Collector.STOP)); - SmartDashboard.putData("Reverse Rollers", new SetCollectionSpeed(Collector.REVERSE)); - } - - public Joystick getJoystick() { - return joystick; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/Robot.java deleted file mode 100644 index bd8376f452..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/Robot.java +++ /dev/null @@ -1,122 +0,0 @@ -package $package; - -import edu.wpi.first.wpilibj.IterativeRobot; -import edu.wpi.first.wpilibj.command.Command; -import edu.wpi.first.wpilibj.command.Scheduler; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; - -import $package.commands.DriveAndShootAutonomous; -import $package.commands.DriveForward; -import $package.subsystems.Collector; -import $package.subsystems.DriveTrain; -import $package.subsystems.Pivot; -import $package.subsystems.Pneumatics; -import $package.subsystems.Shooter; - -import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; - -/** - * This is the main class for running the PacGoat code. - * - * The VM is configured to automatically run this class, and to call the - * functions corresponding to each mode, as described in the IterativeRobot - * documentation. If you change the name of this class or the package after - * creating this project, you must also update the manifest file in the resource - * directory. - */ -public class Robot extends IterativeRobot { - Command autonomousCommand; - public static OI oi; - - public static DriveTrain drivetrain; - public static Collector collector; - public static Shooter shooter; - public static Pneumatics pneumatics; - public static Pivot pivot; - - public SendableChooser autoChooser; - public SendableChooser autonomousDirectionChooser; - - // This function is run when the robot is first started up and should be - // used for any initialization code. - public void robotInit() { - // Initialize the subsystems - drivetrain = new DriveTrain(); - collector = new Collector(); - shooter = new Shooter(); - pneumatics = new Pneumatics(); - pivot = new Pivot(); - SmartDashboard.putData(drivetrain); - SmartDashboard.putData(collector); - SmartDashboard.putData(shooter); - SmartDashboard.putData(pneumatics); - SmartDashboard.putData(pivot); - - // This MUST be here. If the OI creates Commands (which it very likely - // will), constructing it during the construction of CommandBase (from - // which commands extend), subsystems are not guaranteed to be - // yet. Thus, their requires() statements may grab null pointers. Bad - // news. Don't move it. - oi = new OI(); - - // instantiate the command used for the autonomous period - autoChooser = new SendableChooser(); - autoChooser.addDefault("Drive and Shoot", new DriveAndShootAutonomous()); - autoChooser.addObject("Drive Forward", new DriveForward()); - SmartDashboard.putData("Auto Mode", autoChooser); - - pneumatics.start(); // Pressurize the pneumatics. - } - - public void autonomousInit() { - autonomousCommand = (Command) autoChooser.getSelected(); - autonomousCommand.start(); - } - - // This function is called periodically during autonomous - public void autonomousPeriodic() { - Scheduler.getInstance().run(); - log(); - } - - public void teleopInit() { - // This makes sure that the autonomous stops running when - // teleop starts running. If you want the autonomous to - // continue until interrupted by another command, remove - // this line or comment it out. - if (autonomousCommand != null) { - autonomousCommand.cancel(); - } - } - - // This function is called periodically during operator control - public void teleopPeriodic() { - Scheduler.getInstance().run(); - log(); - } - - // This function called periodically during test mode - public void testPeriodic() { - LiveWindow.run(); - } - - public void disabledInit() { - Robot.shooter.unlatch(); - } - - // This function is called periodically while disabled - public void disabledPeriodic() { - log(); - } - - /** - * Log interesting values to the SmartDashboard. - */ - private void log() { - Robot.pneumatics.writePressure(); - SmartDashboard.putNumber("Pivot Pot Value", Robot.pivot.getAngle()); - SmartDashboard.putNumber("Left Distance", drivetrain.getLeftEncoder().getDistance()); - SmartDashboard.putNumber("Right Distance", drivetrain.getRightEncoder().getDistance()); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/CheckForHotGoal.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/CheckForHotGoal.java deleted file mode 100644 index dda0096921..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/CheckForHotGoal.java +++ /dev/null @@ -1,37 +0,0 @@ -package $package.commands; - -import $package.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/** - * This command looks for the hot goal and waits until it's detected or timed - * out. The timeout is because it's better to shoot and get some autonomous - * points than get none. When called sequentially, this command will block until - * the hot goal is detected or until it is timed out. - */ -public class CheckForHotGoal extends Command { - public CheckForHotGoal(double time) { - setTimeout(time); - } - - // Called just before this Command runs the first time - protected void initialize() {} - - // Called repeatedly when this Command is scheduled to run - protected void execute() {} - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return isTimedOut() || Robot.shooter.goalIsHot(); - } - - // Called once after isFinished returns true - protected void end() {} - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() { - end(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/CloseClaw.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/CloseClaw.java deleted file mode 100644 index 25529ec2cc..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/CloseClaw.java +++ /dev/null @@ -1,39 +0,0 @@ -package $package.commands; - -import $package.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/** - * Close the claw. - * - * NOTE: It doesn't wait for the claw to close since there is no sensor to - * detect that. - */ -public class CloseClaw extends Command { - - public CloseClaw() { - requires(Robot.collector); - } - - // Called just before this Command runs the first time - protected void initialize() { - Robot.collector.close(); - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() { - } - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return true; - } - - // Called once after isFinished returns true - protected void end() {} - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() {} -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/Collect.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/Collect.java deleted file mode 100644 index 96426946ba..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/Collect.java +++ /dev/null @@ -1,18 +0,0 @@ -package $package.commands; - -import $package.subsystems.Collector; -import $package.subsystems.Pivot; - -import edu.wpi.first.wpilibj.command.CommandGroup; - -/** - * Get the robot set to collect balls. - */ -public class Collect extends CommandGroup { - public Collect() { - addSequential(new SetCollectionSpeed(Collector.FORWARD)); - addParallel(new CloseClaw()); - addSequential(new SetPivotSetpoint(Pivot.COLLECT)); - addSequential(new WaitForBall()); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/DriveAndShootAutonomous.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/DriveAndShootAutonomous.java deleted file mode 100644 index a93f9fd033..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/DriveAndShootAutonomous.java +++ /dev/null @@ -1,23 +0,0 @@ -package $package.commands; - -import $package.Robot; - -import edu.wpi.first.wpilibj.command.CommandGroup; - -/** - * Drive over the line and then shoot the ball. If the hot goal is not detected, - * it will wait briefly. - */ -public class DriveAndShootAutonomous extends CommandGroup { - public DriveAndShootAutonomous() { - addSequential(new CloseClaw()); - addSequential(new WaitForPressure(), 2); - if (Robot.isReal()) { - // NOTE: Simulation doesn't currently have the concept of hot. - addSequential(new CheckForHotGoal(2)); - } - addSequential(new SetPivotSetpoint(45)); - addSequential(new DriveForward(8, 0.3)); - addSequential(new Shoot()); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/DriveForward.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/DriveForward.java deleted file mode 100644 index 7faf22a6a2..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/DriveForward.java +++ /dev/null @@ -1,58 +0,0 @@ -package $package.commands; - -import $package.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/** - * This command drives the robot over a given distance with simple proportional - * control This command will drive a given distance limiting to a maximum speed. - */ -public class DriveForward extends Command { - private double driveForwardSpeed; - private double distance; - private double error; - private final double TOLERANCE = .1; - private final double KP = -1.0 / 5.0; - - public DriveForward() { - this(10, 0.5); - } - - public DriveForward(double dist) { - this(dist, 0.5); - } - - public DriveForward(double dist, double maxSpeed) { - requires(Robot.drivetrain); - distance = dist; - driveForwardSpeed = maxSpeed; - } - - protected void initialize() { - Robot.drivetrain.getRightEncoder().reset(); - setTimeout(2); - } - - protected void execute() { - error = (distance - Robot.drivetrain.getRightEncoder().getDistance()); - if (driveForwardSpeed * KP * error >= driveForwardSpeed) { - Robot.drivetrain.tankDrive(driveForwardSpeed, driveForwardSpeed); - } else { - Robot.drivetrain.tankDrive(driveForwardSpeed * KP * error, - driveForwardSpeed * KP * error); - } - } - - protected boolean isFinished() { - return (Math.abs(error) <= TOLERANCE) || isTimedOut(); - } - - protected void end() { - Robot.drivetrain.stop(); - } - - protected void interrupted() { - end(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/DriveWithJoystick.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/DriveWithJoystick.java deleted file mode 100644 index 2d34b8b788..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/DriveWithJoystick.java +++ /dev/null @@ -1,34 +0,0 @@ -package $package.commands; - -import $package.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/** - * This command allows PS3 joystick to drive the robot. It is always running - * except when interrupted by another command. - */ -public class DriveWithJoystick extends Command { - public DriveWithJoystick() { - requires(Robot.drivetrain); - } - - protected void initialize() { - } - - protected void execute() { - Robot.drivetrain.tankDrive(Robot.oi.getJoystick()); - } - - protected boolean isFinished() { - return false; - } - - protected void end() { - Robot.drivetrain.stop(); - } - - protected void interrupted() { - end(); - } -} \ No newline at end of file diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/ExtendShooter.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/ExtendShooter.java deleted file mode 100644 index 2d585b6921..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/ExtendShooter.java +++ /dev/null @@ -1,41 +0,0 @@ -package $package.commands; - -import $package.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/** - * Extend the shooter and then retract it after a second. - */ -public class ExtendShooter extends Command { - - public ExtendShooter() { - requires(Robot.shooter); - setTimeout(1); - } - - // Called just before this Command runs the first time - protected void initialize() { - Robot.shooter.extendBoth(); - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() { - } - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return isTimedOut(); - } - - // Called once after isFinished returns true - protected void end() { - Robot.shooter.retractBoth(); - } - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() { - end(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/LowGoal.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/LowGoal.java deleted file mode 100644 index 5dd84f9566..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/LowGoal.java +++ /dev/null @@ -1,17 +0,0 @@ -package $package.commands; - -import $package.subsystems.Collector; -import $package.subsystems.Pivot; - -import edu.wpi.first.wpilibj.command.CommandGroup; - -/** - * Spit the ball out into the low goal assuming that the robot is in front of it. - */ -public class LowGoal extends CommandGroup { - public LowGoal() { - addSequential(new SetPivotSetpoint(Pivot.LOW_GOAL)); - addSequential(new SetCollectionSpeed(Collector.REVERSE)); - addSequential(new ExtendShooter()); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/OpenClaw.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/OpenClaw.java deleted file mode 100644 index b4eb35bcfb..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/OpenClaw.java +++ /dev/null @@ -1,36 +0,0 @@ -package $package.commands; - -import $package.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/** - * Opens the claw - */ -public class OpenClaw extends Command { - - public OpenClaw() { - requires(Robot.collector); - } - - // Called just before this Command runs the first time - protected void initialize() { - Robot.collector.open(); - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() { - } - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return Robot.collector.isOpen(); - } - - // Called once after isFinished returns true - protected void end() {} - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() {} -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/SetCollectionSpeed.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/SetCollectionSpeed.java deleted file mode 100644 index ec39826bee..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/SetCollectionSpeed.java +++ /dev/null @@ -1,39 +0,0 @@ -package $package.commands; - -import $package.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/** - * This command sets the collector rollers spinning at the given speed. Since - * there is no sensor for detecting speed, it finishes immediately. As a result, - * the spinners may still be adjusting their speed. - */ -public class SetCollectionSpeed extends Command { - private double speed; - - public SetCollectionSpeed(double speed) { - requires(Robot.collector); - this.speed = speed; - } - - // Called just before this Command runs the first time - protected void initialize() { - Robot.collector.setSpeed(speed); - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() {} - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return true; - } - - // Called once after isFinished returns true - protected void end() {} - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() {} -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/SetPivotSetpoint.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/SetPivotSetpoint.java deleted file mode 100644 index 4a1643eed6..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/SetPivotSetpoint.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package $package.commands; - -import $package.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/** - * Moves the pivot to a given angle. This command finishes when it is within - * the tolerance, but leaves the PID loop running to maintain the position. - * Other commands using the pivot should make sure they disable PID! - */ -public class SetPivotSetpoint extends Command { - private double setpoint; - - public SetPivotSetpoint(double setpoint) { - this.setpoint = setpoint; - requires(Robot.pivot); - } - - // Called just before this Command runs the first time - protected void initialize() { - Robot.pivot.enable(); - Robot.pivot.setSetpoint(setpoint); - } - - // Called repeatedly when this Command is scheduled to run - protected void execute() {} - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return Robot.pivot.onTarget(); - } - - // Called once after isFinished returns true - protected void end() {} - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() {} -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/Shoot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/Shoot.java deleted file mode 100644 index d08200ef28..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/Shoot.java +++ /dev/null @@ -1,17 +0,0 @@ -package $package.commands; - -import $package.subsystems.Collector; - -import edu.wpi.first.wpilibj.command.CommandGroup; - -/** - * Shoot the ball at the current angle. - */ -public class Shoot extends CommandGroup { - public Shoot() { - addSequential(new WaitForPressure()); - addSequential(new SetCollectionSpeed(Collector.STOP)); - addSequential(new OpenClaw()); - addSequential(new ExtendShooter()); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/WaitForBall.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/WaitForBall.java deleted file mode 100644 index 5684d26af9..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/WaitForBall.java +++ /dev/null @@ -1,35 +0,0 @@ -package $package.commands; - -import $package.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/** - * Wait until the collector senses that it has the ball. This command does - * nothing and is intended to be used in command groups to wait for this - * condition. - */ -public class WaitForBall extends Command { - - public WaitForBall() { - requires(Robot.collector); - } - - // Called just before this Command runs the first time - protected void initialize() {} - - // Called repeatedly when this Command is scheduled to run - protected void execute() {} - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return Robot.collector.hasBall(); - } - - // Called once after isFinished returns true - protected void end() {} - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() {} -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/WaitForPressure.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/WaitForPressure.java deleted file mode 100644 index f1b6ab9d75..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/commands/WaitForPressure.java +++ /dev/null @@ -1,34 +0,0 @@ -package $package.commands; - -import $package.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/** - * Wait until the pneumatics are fully pressurized. This command does nothing - * and is intended to be used in command groups to wait for this condition. - */ -public class WaitForPressure extends Command { - - public WaitForPressure() { - requires(Robot.pneumatics); - } - - // Called just before this Command runs the first time - protected void initialize() {} - - // Called repeatedly when this Command is scheduled to run - protected void execute() {} - - // Make this return true when this Command no longer needs to run execute() - protected boolean isFinished() { - return Robot.pneumatics.isPressurized(); - } - - // Called once after isFinished returns true - protected void end() {} - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - protected void interrupted() {} -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/Collector.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/Collector.java deleted file mode 100644 index 898be2651d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/Collector.java +++ /dev/null @@ -1,91 +0,0 @@ -package $package.subsystems; - -import edu.wpi.first.wpilibj.DigitalInput; -import edu.wpi.first.wpilibj.Solenoid; -import edu.wpi.first.wpilibj.SpeedController; -import edu.wpi.first.wpilibj.Victor; -import edu.wpi.first.wpilibj.command.Subsystem; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; - -/** - * The Collector subsystem has one motor for the rollers, a limit switch for ball - * detection, a piston for opening and closing the claw, and a reed switch to - * check if the piston is open. - */ -public class Collector extends Subsystem { - // Constants for some useful speeds - public static final double FORWARD = 1; - public static final double STOP = 0; - public static final double REVERSE = -1; - - // Subsystem devices - private SpeedController rollerMotor; - private DigitalInput ballDetector; - private Solenoid piston; - private DigitalInput openDetector; - - public Collector() { - // Configure devices - rollerMotor = new Victor(6); - ballDetector = new DigitalInput(10); - openDetector = new DigitalInput(6); - piston = new Solenoid(1, 1); - - // Put everything to the LiveWindow for testing. - LiveWindow.addActuator("Collector", "Roller Motor", (Victor) rollerMotor); - LiveWindow.addSensor("Collector", "Ball Detector", ballDetector); - LiveWindow.addSensor("Collector", "Claw Open Detector", openDetector); - LiveWindow.addActuator("Collector", "Piston", piston); - } - - /** - * NOTE: The current simulation model uses the the lower part of the claw - * since the limit switch wasn't exported. At some point, this will be - * updated. - * - * @return Whether or not the robot has the ball. - */ - public boolean hasBall() { - return ballDetector.get(); // TODO: prepend ! to reflect real robot - } - - /** - * @param speed The speed to spin the rollers. - */ - public void setSpeed(double speed) { - rollerMotor.set(-speed); - } - - /** - * Stop the rollers from spinning - */ - public void stop() { - rollerMotor.set(0); - } - - /** - * @return Whether or not the claw is open. - */ - public boolean isOpen() { - return openDetector.get(); // TODO: prepend ! to reflect real robot - } - - /** - * Open the claw up. (For shooting) - */ - public void open() { - piston.set(true); - } - - /** - * Close the claw. (For collecting and driving) - */ - public void close() { - piston.set(false); - } - - /** - * No default command. - */ - @Override protected void initDefaultCommand() {} -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/DriveTrain.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/DriveTrain.java deleted file mode 100644 index e6c9e11159..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/DriveTrain.java +++ /dev/null @@ -1,127 +0,0 @@ -package $package.subsystems; - -import $package.Robot; -import $package.commands.DriveWithJoystick; - -import edu.wpi.first.wpilibj.AnalogGyro; -import edu.wpi.first.wpilibj.CounterBase.EncodingType; -import edu.wpi.first.wpilibj.Encoder; -import edu.wpi.first.wpilibj.Joystick; -import edu.wpi.first.wpilibj.PIDSource.PIDSourceParameter; -import edu.wpi.first.wpilibj.RobotDrive; -import edu.wpi.first.wpilibj.SpeedController; -import edu.wpi.first.wpilibj.Victor; -import edu.wpi.first.wpilibj.command.Subsystem; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; - -/** - * The DriveTrain subsystem controls the robot's chassis and reads in - * information about it's speed and position. - */ -public class DriveTrain extends Subsystem { - // Subsystem devices - private SpeedController frontLeftCIM, frontRightCIM; - private SpeedController backLeftCIM, backRightCIM; - private RobotDrive drive; - private Encoder rightEncoder, leftEncoder; - private AnalogGyro gyro; - - public DriveTrain() { - // Configure drive motors - frontLeftCIM = new Victor(1); - frontRightCIM = new Victor(2); - backLeftCIM = new Victor(3); - backRightCIM = new Victor(4); - LiveWindow.addActuator("DriveTrain", "Front Left CIM", (Victor) frontLeftCIM); - LiveWindow.addActuator("DriveTrain", "Front Right CIM", (Victor) frontRightCIM); - LiveWindow.addActuator("DriveTrain", "Back Left CIM", (Victor) backLeftCIM); - LiveWindow.addActuator("DriveTrain", "Back Right CIM", (Victor) backRightCIM); - - // Configure the RobotDrive to reflect the fact that all our motors are - // wired backwards and our drivers sensitivity preferences. - drive = new RobotDrive(frontLeftCIM, backLeftCIM, frontRightCIM, backRightCIM); - drive.setSafetyEnabled(true); - drive.setExpiration(0.1); - drive.setSensitivity(0.5); - drive.setMaxOutput(1.0); - drive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, true); - drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, true); - drive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, true); - drive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true); - - // Configure encoders - rightEncoder = new Encoder(1, 2, true, EncodingType.k4X); - leftEncoder = new Encoder(3, 4, false, EncodingType.k4X); - rightEncoder.setPIDSourceParameter(PIDSourceParameter.kDistance); - leftEncoder.setPIDSourceParameter(PIDSourceParameter.kDistance); - - if (Robot.isReal()) { // Converts to feet - rightEncoder.setDistancePerPulse(0.0785398); - leftEncoder.setDistancePerPulse(0.0785398); - } else { // Convert to feet 4in diameter wheels with 360 tick simulated encoders - rightEncoder.setDistancePerPulse((4.0/*in*/*Math.PI)/(360.0*12.0/*in/ft*/)); - leftEncoder.setDistancePerPulse((4.0/*in*/*Math.PI)/(360.0*12.0/*in/ft*/)); - } - - LiveWindow.addSensor("DriveTrain", "Right Encoder", rightEncoder); - LiveWindow.addSensor("DriveTrain", "Left Encoder", leftEncoder); - - // Configure gyro - gyro = new AnalogGyro(2); - if (Robot.isReal()) { - gyro.setSensitivity(0.007); // TODO: Handle more gracefully? - } - LiveWindow.addSensor("DriveTrain", "Gyro", gyro); - } - - /** - * When other commands aren't using the drivetrain, allow tank drive with - * the joystick. - */ - public void initDefaultCommand() { - setDefaultCommand(new DriveWithJoystick()); - } - - /** - * @param joy PS3 style joystick to use as the input for tank drive. - */ - public void tankDrive(Joystick joy) { - drive.tankDrive(joy.getY(), joy.getRawAxis(4)); - } - - /** - * @param leftAxis Left sides value - * @param rightAxis Right sides value - */ - public void tankDrive(double leftAxis, double rightAxis) { - drive.tankDrive(leftAxis, rightAxis); - } - - /** - * Stop the drivetrain from moving. - */ - public void stop() { - drive.tankDrive(0, 0); - } - - /** - * @return The encoder getting the distance and speed of left side of the drivetrain. - */ - public Encoder getLeftEncoder() { - return leftEncoder; - } - - /** - * @return The encoder getting the distance and speed of right side of the drivetrain. - */ - public Encoder getRightEncoder() { - return rightEncoder; - } - - /** - * @return The current angle of the drivetrain. - */ - public double getAngle() { - return gyro.getAngle(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/Pivot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/Pivot.java deleted file mode 100644 index fee1cf5b94..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/Pivot.java +++ /dev/null @@ -1,94 +0,0 @@ -package $package.subsystems; - -import $package.Robot; - -import edu.wpi.first.wpilibj.*; -import edu.wpi.first.wpilibj.command.PIDSubsystem; -import edu.wpi.first.wpilibj.interfaces.Potentiometer; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; - -/** - * The Pivot subsystem contains the Van-door motor and the pot for PID control - * of angle of the pivot and claw. - */ -public class Pivot extends PIDSubsystem { - // Constants for some useful angles - public static final double COLLECT = 105; - public static final double LOW_GOAL = 90; - public static final double SHOOT = 45; - public static final double SHOOT_NEAR = 30; - - // Subsystem devices - private DigitalInput upperLimitSwitch; - private DigitalInput lowerLimitSwitch; - private Potentiometer pot; - private SpeedController motor; - - public Pivot() { - super("Pivot", 7.0, 0.0, 8.0); - setAbsoluteTolerance(0.005); - getPIDController().setContinuous(false); - if (Robot.isSimulation()) { // PID is different in simulation. - getPIDController().setPID(0.5, 0.001, 2); - setAbsoluteTolerance(5); - } - - // Motor to move the pivot. - motor = new Victor(5); - - // Sensors for measuring the position of the pivot. - upperLimitSwitch = new DigitalInput(13); - lowerLimitSwitch = new DigitalInput(12); - - // 0 degrees is vertical facing up. - // Angle increases the more forward the pivot goes. - pot = new AnalogPotentiometer(1); - - // Put everything to the LiveWindow for testing. - LiveWindow.addSensor("Pivot", "Upper Limit Switch", upperLimitSwitch); - LiveWindow.addSensor("Pivot", "Lower Limit Switch", lowerLimitSwitch); - LiveWindow.addSensor("Pivot", "Pot", (AnalogPotentiometer) pot); - LiveWindow.addActuator("Pivot", "Motor", (Victor) motor); - LiveWindow.addActuator("Pivot", "PIDSubsystem Controller", getPIDController()); - } - - /** - * No default command, if PID is enabled, the current setpoint will be maintained. - */ - public void initDefaultCommand() {} - - /** - * @return The angle read in by the potentiometer - */ - protected double returnPIDInput() { - return pot.get(); - } - - /** - * Set the motor speed based off of the PID output - */ - protected void usePIDOutput(double output) { - motor.pidWrite(output); - } - - /** - * @return If the pivot is at its upper limit. - */ - public boolean isAtUpperLimit() { - return upperLimitSwitch.get(); // TODO: inverted from real robot (prefix with !) - } - - /** - * @return If the pivot is at its lower limit. - */ - public boolean isAtLowerLimit() { - return lowerLimitSwitch.get(); // TODO: inverted from real robot (prefix with !) - } - - /** - * @return The current angle of the pivot. - */ - public double getAngle() { - return pot.get(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/Pneumatics.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/Pneumatics.java deleted file mode 100644 index dd6c4a815d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/Pneumatics.java +++ /dev/null @@ -1,61 +0,0 @@ -package $package.subsystems; - -import $package.Robot; - -import edu.wpi.first.wpilibj.*; -import edu.wpi.first.wpilibj.command.Subsystem; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; - -/** - * The Pneumatics subsystem contains the compressor and a pressure sensor. - * - * NOTE: The simulator currently doesn't support the compressor or pressure sensors. - */ -public class Pneumatics extends Subsystem { - AnalogInput pressureSensor; - Compressor compressor; - - private static final double MAX_PRESSURE = 2.55; - - public Pneumatics() { - pressureSensor = new AnalogInput(3); - if (Robot.isReal()) { - compressor = new Compressor(); - } - - LiveWindow.addSensor("Pneumatics", "Pressure Sensor", pressureSensor); - } - - /** - * No default command - */ - public void initDefaultCommand() {} - - /** - * Start the compressor going. The compressor automatically starts and stops as it goes above and below maximum pressure. - */ - public void start() { - if (Robot.isReal()) { - compressor.start(); - } - } - - /** - * @return Whether or not the system is fully pressurized. - */ - public boolean isPressurized() { - if (Robot.isReal()) { - return MAX_PRESSURE <= pressureSensor.getVoltage(); - } else { - return true; // NOTE: Simulation always has full pressure - } - } - - /** - * Puts the pressure on the SmartDashboard. - */ - public void writePressure() { - SmartDashboard.putNumber("Pressure", pressureSensor.getVoltage()); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/Shooter.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/Shooter.java deleted file mode 100644 index 67ffcda623..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/subsystems/Shooter.java +++ /dev/null @@ -1,166 +0,0 @@ -package $package.subsystems; - -import edu.wpi.first.wpilibj.DigitalInput; -import edu.wpi.first.wpilibj.DoubleSolenoid; -import edu.wpi.first.wpilibj.Solenoid; -import edu.wpi.first.wpilibj.command.Subsystem; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; - -/** - * The Shooter subsystem handles shooting. The mechanism for shooting is - * slightly complicated because it has to pneumatic cylinders for shooting, and - * a third latch to allow the pressure to partially build up and reduce the - * effect of the airflow. For shorter shots, when full power isn't needed, only - * one cylinder fires. - * - * NOTE: Simulation currently approximates this as as single pneumatic cylinder - * and ignores the latch. - */ -public class Shooter extends Subsystem { - // Devices - DoubleSolenoid piston1; - DoubleSolenoid piston2; - Solenoid latchPiston; - DigitalInput piston1ReedSwitchFront; - DigitalInput piston1ReedSwitchBack; - DigitalInput hotGoalSensor; // NOTE: Currently ignored in simulation - - public Shooter() { - // Configure Devices - hotGoalSensor = new DigitalInput(3); - piston1 = new DoubleSolenoid(1, 3, 4); - piston2 = new DoubleSolenoid(1, 5, 6); - latchPiston = new Solenoid(1, 2); - piston1ReedSwitchFront = new DigitalInput(9); - piston1ReedSwitchBack = new DigitalInput(11); - - // Put everything to the LiveWindow for testing. - LiveWindow.addSensor("Shooter", "Hot Goal Sensor", hotGoalSensor); - LiveWindow.addSensor("Shooter", "Piston1 Reed Switch Front ", - piston1ReedSwitchFront); - LiveWindow.addSensor("Shooter", "Piston1 Reed Switch Back ", - piston1ReedSwitchBack); - LiveWindow.addActuator("Shooter", "Latch Piston", latchPiston); - } - - /** - * No default command. - */ - public void initDefaultCommand() {} - - /** - * Extend both solenoids to shoot. - */ - public void extendBoth() { - piston1.set(DoubleSolenoid.Value.kForward); - piston2.set(DoubleSolenoid.Value.kForward); - } - - /** - * Retract both solenoids to prepare to shoot. - */ - public void retractBoth() { - piston1.set(DoubleSolenoid.Value.kReverse); - piston2.set(DoubleSolenoid.Value.kReverse); - } - - /** - * Extend solenoid 1 to shoot. - */ - public void extend1() { - piston1.set(DoubleSolenoid.Value.kForward); - } - - /** - * Retract solenoid 1 to prepare to shoot. - */ - public void retract1() { - piston1.set(DoubleSolenoid.Value.kReverse); - } - - /** - * Extend solenoid 2 to shoot. - */ - public void extend2() { - piston2.set(DoubleSolenoid.Value.kReverse); - } - - /** - * Retract solenoid 2 to prepare to shoot. - */ - public void retract2() { - piston2.set(DoubleSolenoid.Value.kForward); - } - - /** - * Turns off the piston1 double solenoid. This won't actuate anything - * because double solenoids preserve their state when turned off. This - * should be called in order to reduce the amount of time that the coils are - * powered. - */ - public void off1() { - piston1.set(DoubleSolenoid.Value.kOff); - } - - /** - * Turns off the piston1 double solenoid. This won't actuate anything - * because double solenoids preserve their state when turned off. This - * should be called in order to reduce the amount of time that the coils are - * powered. - */ - public void off2() { - piston2.set(DoubleSolenoid.Value.kOff); - } - - /** - * Release the latch so that we can shoot - */ - public void unlatch() { - latchPiston.set(true); - } - - /** - * Latch so that pressure can build up and we aren't limited by air flow. - */ - public void latch() { - latchPiston.set(false); - } - - /** - * Toggles the latch postions - */ - public void toggleLatchPosition() { - latchPiston.set(!latchPiston.get()); - } - - /** - * @return Whether or not piston 1 is fully extended. - */ - public boolean piston1IsExtended() { - return !piston1ReedSwitchFront.get(); - } - - /** - * @return Whether or not piston 1 is fully retracted. - */ - public boolean piston1IsRetracted() { - return !piston1ReedSwitchBack.get(); - } - - /** - * Turns off all double solenoids. Double solenoids hold their position when - * they are turned off. We should turn them off whenever possible to extend - * the life of the coils - */ - public void offBoth() { - piston1.set(DoubleSolenoid.Value.kOff); - piston2.set(DoubleSolenoid.Value.kOff); - } - - /** - * @return Whether or not the goal is hot as read by the banner sensor - */ - public boolean goalIsHot() { - return hotGoalSensor.get(); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/triggers/DoubleButton.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/triggers/DoubleButton.java deleted file mode 100644 index 773ae627e9..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PacGoat/src/org/usfirst/frc/team190/pacgoat/triggers/DoubleButton.java +++ /dev/null @@ -1,23 +0,0 @@ -package $package.triggers; - -import edu.wpi.first.wpilibj.Joystick; -import edu.wpi.first.wpilibj.buttons.*; - -/** - * A custom button that is triggered when two buttons on a Joystick are - * simultaneously pressed. - */ -public class DoubleButton extends Trigger { - private Joystick joy; - private int button1, button2; - - public DoubleButton(Joystick joy, int button1, int button2) { - this.joy = joy; - this.button1 = button1; - this.button2 = button2; - } - - public boolean get() { - return joy.getRawButton(button1) && joy.getRawButton(button2); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Potentiometer/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Potentiometer/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100644 index c95388981a..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Potentiometer/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,83 +0,0 @@ - -package $package; - -import edu.wpi.first.wpilibj.AnalogInput; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.Joystick; -import edu.wpi.first.wpilibj.Victor; - -/** - * This is a sample program to demonstrate the use of a soft potentiometer and proportional - * control to reach and maintain position setpoints on an elevator mechanism. A joystick - * button is used to switch elevator setpoints. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -public class Robot extends SampleRobot { - final int potChannel = 1; //analog input pin - final int motorChannel = 7; //PWM channel - final int joystickChannel = 0; //usb number in DriverStation - final int buttonNumber = 4; //joystick button - - final double setpoints[] = {1.0, 2.6, 4.3}; //bottom, middle, and top elevator setpoints - - final double pGain = 1.0; //proportional speed constant - double motorSpeed; - double currentPosition; //sensor voltage reading corresponding to current elevator position - - AnalogInput potentiometer; - Victor elevatorMotor; - Joystick joystick; - - public Robot() { - //make objects for the potentiometer, elevator motor controller, and joystick - potentiometer = new AnalogInput(potChannel); - elevatorMotor = new Victor(motorChannel); - joystick = new Joystick(joystickChannel); - } - - /** - * Runs during autonomous. - */ - public void autonomous() { - - } - - /** - * Moves elevator to a selectable setpoint that can be changed by pressing a button on - * the joystick. Proportional control is used to reach and maintain the desired setpoint - * by obtaining values from the potentiometer and comparing them to the setpoint value. - */ - public void operatorControl() { - boolean buttonState; - boolean prevButtonState = false; - - int index = 0; //setpoint array index - double currentSetpoint; //holds desired setpoint - currentSetpoint = setpoints[0]; //set to first setpoint - - while (isOperatorControl() && isEnabled()) { - buttonState = joystick.getRawButton(buttonNumber); //check if button is pressed - - //if button has been pressed and released once - if(buttonState && !prevButtonState) { - index = (index + 1) % setpoints.length; //increment set point, reset if at end of array - currentSetpoint = setpoints[index]; //set setpoint - } - prevButtonState = buttonState; //record previous button state - - currentPosition = potentiometer.getAverageVoltage(); //get position value - motorSpeed = (currentPosition - currentSetpoint)*pGain; //convert position error to speed - elevatorMotor.set(motorSpeed); //drive elevator motor - } - } - - /** - * Runs during test mode - */ - public void test() { - - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PotentiometerPID/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PotentiometerPID/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100644 index b45781c67f..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/PotentiometerPID/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,85 +0,0 @@ - -package $package; - -import edu.wpi.first.wpilibj.AnalogInput; -import edu.wpi.first.wpilibj.PIDController; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.Joystick; -import edu.wpi.first.wpilibj.Victor; - -/** - * This is a sample program to demonstrate how to use a soft potentiometer and a PID - * controller to reach and maintain position setpoints on an elevator mechanism. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -public class Robot extends SampleRobot { - final int potChannel = 1; //analog input pin - final int motorChannel = 7; //PWM channel - final int joystickChannel = 0; //usb number in DriverStation - final int buttonNumber = 4; //button on joystick - - final double setPoints[] = {1.0, 2.6, 4.3}; //bottom, middle, and top elevator setpoints - - //proportional, integral, and derivative speed constants; motor inverted - //DANGER: when tuning PID constants, high/inappropriate values for pGain, iGain, - //and dGain may cause dangerous, uncontrollable, or undesired behavior! - final double pGain = -5.0, iGain = -0.02, dGain = -2.0; //these may need to be positive for a non-inverted motor - - PIDController pidController; - AnalogInput potentiometer; - Victor elevatorMotor; - Joystick joystick; - - public Robot() { - //make objects for potentiometer, the elevator motor controller, and the joystick - potentiometer = new AnalogInput(potChannel); - elevatorMotor = new Victor(motorChannel); - joystick = new Joystick(joystickChannel); - - //potentiometer (AnalogInput) and elevatorMotor (Victor) can be used as a - //PIDSource and PIDOutput respectively - pidController = new PIDController(pGain, iGain, dGain, potentiometer, elevatorMotor); - } - - /** - * Runs during autonomous. - */ - public void autonomous() { - - } - - /** - * Uses a PIDController and an array of setpoints to switch and maintain elevator - * positions. The elevator setpoint is selected by a joystick button. - */ - public void operatorControl() { - pidController.setInputRange(0, 5); //0 to 5V - pidController.setSetpoint(setPoints[0]); //set to first setpoint - - int index = 0; - boolean currentValue; - boolean previousValue = false; - - while (isOperatorControl() && isEnabled()) { - pidController.enable(); //begin PID control - - //when the button is pressed once, the selected elevator setpoint is incremented - currentValue = joystick.getRawButton(buttonNumber); - if(currentValue && !previousValue){ - pidController.setSetpoint(setPoints[index]); - index = (index + 1) % setPoints.length; //index of elevator setpoint wraps around - } - previousValue = currentValue; - } - } - - /** - * Runs during test mode. - */ - public void test() { - - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/QuickVision/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/QuickVision/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100755 index bc7835bfd1..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/QuickVision/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,35 +0,0 @@ -package $package; - -import edu.wpi.first.wpilibj.CameraServer; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.Timer; - -/** - * This is a demo program showing the use of the CameraServer class. - * With start automatic capture, there is no opportunity to process the image. - * Look at the IntermediateVision sample for how to process the image before sending it to the FRC PC Dashboard. - */ -public class Robot extends SampleRobot { - - CameraServer server; - - public Robot() { - server = CameraServer.getInstance(); - server.setQuality(50); - //the camera name (ex "cam0") can be found through the roborio web interface - server.startAutomaticCapture("cam0"); - } - - /** - * start up automatic capture you should see the video stream from the - * webcam in your FRC PC Dashboard. - */ - public void operatorControl() { - - while (isOperatorControl() && isEnabled()) { - /** robot code here! **/ - Timer.delay(0.005); // wait for a motor update time - } - } - -} \ No newline at end of file diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/TankDrive/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/TankDrive/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100755 index 3af139b29f..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/TankDrive/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,46 +0,0 @@ -package $package; - - -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.RobotDrive; -import edu.wpi.first.wpilibj.Joystick; -import edu.wpi.first.wpilibj.Timer; - -/** - * This is a demo program showing the use of the RobotDrive class, specifically it - * contains the code necessary to operate a robot with tank drive. - * - * The VM is configured to automatically run this class, and to call the - * functions corresponding to each mode, as described in the SampleRobot - * documentation. If you change the name of this class or the package after - * creating this project, you must also update the manifest file in the resource - * directory. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -public class Robot extends SampleRobot { - RobotDrive myRobot; // class that handles basic drive operations - Joystick leftStick; // set to ID 1 in DriverStation - Joystick rightStick; // set to ID 2 in DriverStation - public Robot() { - myRobot = new RobotDrive(0, 1); - myRobot.setExpiration(0.1); - leftStick = new Joystick(0); - rightStick = new Joystick(1); - } - - - /** - * Runs the motors with tank steering. - */ - public void operatorControl() { - myRobot.setSafetyEnabled(true); - while (isOperatorControl() && isEnabled()) { - myRobot.tankDrive(leftStick, rightStick); - Timer.delay(0.005); // wait for a motor update time - } - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Ultrasonic/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Ultrasonic/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100644 index 79940f5501..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/Ultrasonic/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,69 +0,0 @@ - -package $package; - -import edu.wpi.first.wpilibj.CANTalon; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.RobotDrive; -import edu.wpi.first.wpilibj.AnalogInput; - -/** - * This is a sample program demonstrating how to use an ultrasonic sensor and proportional - * control to maintain a set distance from an object. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ - -public class Robot extends SampleRobot { - AnalogInput ultrasonic; //ultrasonic sensor - RobotDrive myRobot; - - final int ultrasonicChannel = 3; //analog input pin - - //channels for motors - final int leftMotorChannel = 1; - final int rightMotorChannel = 0; - final int leftRearMotorChannel = 3; - final int rightRearMotorChannel = 2; - - int holdDistance = 12; //distance in inches the robot wants to stay from an object - final double valueToInches = 0.125; //factor to convert sensor values to a distance in inches - final double pGain = 0.05; //proportional speed constant - - - public Robot() { - //make objects for the sensor and the drive train - ultrasonic = new AnalogInput(ultrasonicChannel); - myRobot = new RobotDrive(new CANTalon(leftMotorChannel), new CANTalon(leftRearMotorChannel), - new CANTalon(rightMotorChannel), new CANTalon(rightRearMotorChannel)); - } - - /** - * Runs during autonomous. - */ - public void autonomous() { - - } - - /** - * Tells the robot to drive to a set distance (in inches) from an object using proportional control. - */ - public void operatorControl() { - - double currentDistance; //distance measured from the ultrasonic sensor values - double currentSpeed; //speed to set the drive train motors - - while (isOperatorControl() && isEnabled()) { - currentDistance = ultrasonic.getValue()*valueToInches; //sensor returns a value from 0-4095 that is scaled to inches - currentSpeed = (holdDistance - currentDistance)*pGain; //convert distance error to a motor speed - myRobot.drive(currentSpeed, 0); //drive robot - } - } - - /** - * Runs during test mode - */ - public void test() { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/UltrasonicPID/src/org/usfirst/frc/team190/robot/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/UltrasonicPID/src/org/usfirst/frc/team190/robot/Robot.java deleted file mode 100644 index 45f39ea185..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/UltrasonicPID/src/org/usfirst/frc/team190/robot/Robot.java +++ /dev/null @@ -1,89 +0,0 @@ - -package $package; - -import edu.wpi.first.wpilibj.AnalogInput; -import edu.wpi.first.wpilibj.CANTalon; -import edu.wpi.first.wpilibj.PIDOutput; -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.RobotDrive; -import edu.wpi.first.wpilibj.PIDController; - -/** - * This is a sample program to demonstrate the use of a PID Controller with an ultrasonic - * sensor to reach and maintain a set distance from an object. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -public class Robot extends SampleRobot { - AnalogInput ultrasonic; //ultrasonic sensor - RobotDrive myRobot; - PIDController pidController; - - final int ultrasonicChannel = 3; //analog input - - //channels for motors - final int leftMotorChannel = 1; - final int rightMotorChannel = 0; - final int leftRearMotorChannel = 3; - final int rightRearMotorChannel = 2; - - int holdDistance = 12; //distance in inches the robot wants to stay from an object - - //proportional, integral, and derivative speed constants - //DANGER: when tuning PID constants, high/inappropriate values for pGain, iGain, - //and dGain may cause dangerous, uncontrollable, or undesired behavior! - final double pGain = 7, iGain = .018, dGain = 1.5; - - //conversion factor specific to the sensor being used. For this sensor, - //the sensor returned values from 0.0V to 5.0V with a resolution of 9.8mV/in. - final double VoltsToInches = 0.0098; - - //internal class to write to myRobot (a RobotDrive object) using a PIDOutput - public class MyPIDOutput implements PIDOutput { - @Override - public void pidWrite(double output) { - myRobot.drive(output, 0); //drive robot from PID output - } - } - - public Robot() { - //make objects for the sensor and drive train - ultrasonic = new AnalogInput(ultrasonicChannel); - myRobot = new RobotDrive(new CANTalon(leftMotorChannel), new CANTalon(leftRearMotorChannel), - new CANTalon(rightMotorChannel), new CANTalon(rightRearMotorChannel)); - - //ultrasonic (AnalogInput) can be used as a PIDSource without modification, - //PIDOutput is an instance of the internal class MyPIDOutput made earlier - pidController = new PIDController(pGain, iGain, dGain, ultrasonic, new MyPIDOutput()); - } - - /** - * Runs during autonomous. - */ - public void autonomous() { - } - - /** - * Drives the robot a set distance from an object using PID control and the - * ultrasonic sensor. - */ - public void operatorControl() { - pidController.setSetpoint(holdDistance*VoltsToInches); //set setpoint to 12 inches - - //Set expected range to 0-24 inches; e.g. at 24 inches from object go - //full forward, at 0 inches from object go full backward. - pidController.setInputRange(0, 24*VoltsToInches); - - while (isOperatorControl() && isEnabled()) { - pidController.enable(); //begin PID control - } - } - - /** - * Runs during test mode - */ - public void test() { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/examples.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/examples.xml deleted file mode 100755 index ebe02c943b..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/examples/examples.xml +++ /dev/null @@ -1,511 +0,0 @@ - - - - - Getting Started with Java - Examples for getting started with FRC Java - - - - Actuators - Example programs that demonstrate the use of various actuators - - - - Analog - Examples programs that show different uses of analog inputs, - outputs and various analog sensors - - - - CAN - Example programs that demonstrate the use of the CAN components in the control system - - - - Complete List - Complete list of all sample programs across all categories - - - - Digital - Example programs that demonstrate the sensors that use the digital I/O ports - - - - I2C - Example programs that demonstrate the use of I2C and various sensors that use it - - - - Joystick - Example programs that demonstate different uses of joysticks for robot driving - - - - Pneumatics - Example programs that demonstrate the use of the compressor and solenoids - - - - Robot and Motor - Example programs that demonstrate driving a robot and motors including safety, servos, etc. - - - - SPI - Example programs that demonstrate the use of the SPI bus and sensors that connect to it - - - - Safety - Example programs that demonstate the motor safety classes and how to use them with your programs - - - - Sensors - Example programs that demonstrate the use of the various commonly used sensors on FRC robots - - - - Vision - Example programs that demonstrate the use of USB Cameras and image processing - - - - Getting Started - An example program which demonstrates the simplest autonomous and - teleoperated routines. - - Getting Started with Java - Complete List - - - src/$package-dir - - - - - - - - Tank Drive - Demonstrate the use of the RobotDrive class doing teleop driving with tank steering - - Actuators - Complete List - Joystick - Robot and Motor - Safety - - - src/$package-dir - - - - - - - - Mecanum Drive - Demonstrate the use of the RobotDrive class doing teleop driving with Mecanum steering - - Actuators - Complete List - Joystick - Robot and Motor - Safety - - - src/$package-dir - - - - - - - - - Ultrasonic - Demonstrate maintaining a set distance using an ultrasonic sensor. - - Sensors - Complete List - Robot and Motor - CAN - Analog - - - src/$package-dir - - - - - - - - - Ultrasonic PID - Demonstrate maintaining a set distance using an ultrasonic sensor and PID Control. - - Sensors - Complete List - Robot and Motor - CAN - Analog - - - src/$package-dir - - - - - - - - - Potentiometer PID - An example to demonstrate the use of a potentiometer and PID control to reach elevator position setpoints. - - Sensors - Complete List - Actuators - Analog - Joystick - - - src/$package-dir - - - - - - - - - Potentiometer - An example to demonstrate the use of a potentiometer and basic proportional control to reach elevator position setpoints. - - Sensors - Complete List - Actuators - Analog - Joystick - - - src/$package-dir - - - - - - - - - Gyro - An example program showing how to drive straight with using a gyro sensor. - - Sensors - Complete List - Robot and Motor - CAN - Analog - Joystick - - - src/$package-dir - - - - - - - - - Gyro Mecanum - An example program showing how to perform mecanum drive with field oriented controls. - - Sensors - Complete List - Robot and Motor - CAN - Analog - Joystick - - - src/$package-dir - - - - - - - - - Motor Controller - Demonstrate controlling a single motor with a joystick - - Actuators - Complete List - Joystick - Robot and Motor - - - src/$package-dir - - - - - - - - CAN Talon SRX - Demonstrate running a Talon SRX with the basic throttle mode. - - Actuators - Complete List - Robot and Motor - - - src/$package-dir - - - - - - - - CAN Talon SRX PID - Demonstrate running a Talon SRX with PID Closed Loop control. - - Actuators - Complete List - Robot and Motor - - - src/$package-dir - - - - - - - - - CommandBased Robot - Examples for CommandBased robot programs. - - - - GearsBot - A fully functional example CommandBased program for WPIs GearsBot robot. This code can run on your computer if it supports simulation. - - CommandBased Robot - - /usr/share/frcsim/worlds/GearsBotDemo.world - - src/$package-dir - src/$package-dir/commands - src/$package-dir/subsystems - - - - - - - - - - - - - - - - - - - - - - - - PacGoat - A fully functional example CommandBased program for FRC Team 190's 2014 robot. This code can run on your computer if it supports simulation. - - CommandBased Robot - - /usr/share/frcsim/worlds/PacGoat2014.world - - src/$package-dir - src/$package-dir/commands - src/$package-dir/subsystems - src/$package-dir/triggers - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Simple Vision - Demonstrate the use of the CameraServer class to stream from a USB Webcam without processing the images. - - Vision - Complete List - - - src/$package-dir - - - - - - - - Intermediate Vision - Demonstrate the use of the NIVision class to capture image from a Webcam, process them, and then send them to the dashboard. - - Vision - Complete List - - - src/$package-dir - - - - - - - - 2015 Vision Color Sample - An example program that demonstrates image processing to locate Yellow totes by color. - This example uses a file which must be copied over to the roboRIO via FTP to demonstrate processing. - To use this code with a camera, you must integrate the code for image acquisition from the appropriate - camera example; - - - Vision - Complete List - - - src/$package-dir - - - - - - - - 2015 Vision Retro Sample - An example program that demonstrates image processing to locate Yellow totes by the retroreflective target. - This example uses a file which must be copied over to the roboRIO via FTP to demonstrate processing. - To use this code with a camera, you must integrate the code for image acquisition from the appropriate - camera example; - - - Vision - Complete List - - - src/$package-dir - - - - - - - - Axis Camera Sample - An example program that acquires images from an Axis network camera and adds some - annotation to the image as you might do for showing operators the result of some image - recognition, and sends it to the dashboard for display. This demonstrates the use of the - AxisCamera class. - - - Vision - Complete List - - - src/$package-dir - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/iterative/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/iterative/Robot.java deleted file mode 100644 index b59c24f886..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/iterative/Robot.java +++ /dev/null @@ -1,43 +0,0 @@ - -package $package; - -import edu.wpi.first.wpilibj.IterativeRobot; - -/** - * The VM is configured to automatically run this class, and to call the - * functions corresponding to each mode, as described in the IterativeRobot - * documentation. If you change the name of this class or the package after - * creating this project, you must also update the manifest file in the resource - * directory. - */ -public class Robot extends IterativeRobot { - /** - * This function is run when the robot is first started up and should be - * used for any initialization code. - */ - public void robotInit() { - - } - - /** - * This function is called periodically during autonomous - */ - public void autonomousPeriodic() { - - } - - /** - * This function is called periodically during operator control - */ - public void teleopPeriodic() { - - } - - /** - * This function is called periodically during test mode - */ - public void testPeriodic() { - - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/sample/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/sample/Robot.java deleted file mode 100644 index 9bed59e805..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/sample/Robot.java +++ /dev/null @@ -1,62 +0,0 @@ - -package $package; - - -import edu.wpi.first.wpilibj.SampleRobot; -import edu.wpi.first.wpilibj.RobotDrive; -import edu.wpi.first.wpilibj.Joystick; -import edu.wpi.first.wpilibj.Timer; - -/** - * This is a demo program showing the use of the RobotDrive class. - * The SampleRobot class is the base of a robot application that will automatically call your - * Autonomous and OperatorControl methods at the right time as controlled by the switches on - * the driver station or the field controls. - * - * The VM is configured to automatically run this class, and to call the - * functions corresponding to each mode, as described in the SampleRobot - * documentation. If you change the name of this class or the package after - * creating this project, you must also update the manifest file in the resource - * directory. - * - * WARNING: While it may look like a good choice to use for your code if you're inexperienced, - * don't. Unless you know what you are doing, complex code will be much more difficult under - * this system. Use IterativeRobot or Command-Based instead if you're new. - */ -public class Robot extends SampleRobot { - RobotDrive myRobot; - Joystick stick; - - public Robot() { - myRobot = new RobotDrive(0, 1); - myRobot.setExpiration(0.1); - stick = new Joystick(0); - } - - /** - * Drive left & right motors for 2 seconds then stop - */ - public void autonomous() { - myRobot.setSafetyEnabled(false); - myRobot.drive(-0.5, 0.0); // drive forwards half speed - Timer.delay(2.0); // for 2 seconds - myRobot.drive(0.0, 0.0); // stop robot - } - - /** - * Runs the motors with arcade steering. - */ - public void operatorControl() { - myRobot.setSafetyEnabled(true); - while (isOperatorControl() && isEnabled()) { - myRobot.arcadeDrive(stick); // drive with arcade style (use right stick) - Timer.delay(0.005); // wait for a motor update time - } - } - - /** - * Runs during test mode - */ - public void test() { - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/WPILibJavaPlugin.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/WPILibJavaPlugin.java deleted file mode 100644 index 4ad4033bad..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/WPILibJavaPlugin.java +++ /dev/null @@ -1,145 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java; - -import java.io.File; -import java.io.FileInputStream; -import java.util.Properties; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.ui.IStartup; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; -import edu.wpi.first.wpilib.plugins.core.ant.AntPropertiesParser; -import edu.wpi.first.wpilib.plugins.java.installer.JavaInstaller; - -/** - * The activator class controls the plug-in life cycle - */ -public class WPILibJavaPlugin extends AbstractUIPlugin implements IStartup { - - // The plug-in ID - public static final String PLUGIN_ID = "WPILib_Java_Robot_Development"; //$NON-NLS-1$ - - // The shared instance - private static WPILibJavaPlugin plugin; - - /** - * The constructor - */ - public WPILibJavaPlugin() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static WPILibJavaPlugin getDefault() { - return plugin; - } - - public String getCurrentVersion() { - try { - Properties props = new AntPropertiesParser(WPILibJavaPlugin.class.getResourceAsStream("/resources/configuration.properties")).getProperties(); - if (props.getProperty("version").startsWith("$")) { - return "DEVELOPMENT"; - } else { - return props.getProperty("version"); - } - } catch (CoreException e) { - WPILibJavaPlugin.logError("Error getting properties.", e); - return "DEVELOPMENT"; - } - } - public String getJavaPath() { - return WPILibCore.getDefault().getWPILibBaseDir() - + File.separator + "java" + File.separator + "current"; - } - - public Properties getProjectProperties(IProject project) { - Properties defaults = WPILibCore.getDefault().getProjectProperties(project); - Properties props; - try { - File file = new File(WPILibCore.getDefault().getWPILibBaseDir()+"/java/current/ant/build.properties"); - props = new AntPropertiesParser(new FileInputStream(file)).getProperties(defaults); - } catch (Exception e) { - WPILibJavaPlugin.logError("Error getting properties.", e); - props = new Properties(defaults); - } - return props; - } - - public void updateProjects() { - // Get the root of the workspace - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IWorkspaceRoot root = workspace.getRoot(); - // Get all projects in the workspace - IProject[] projects = root.getProjects(); - // Loop over all projects - for (IProject project : projects) { - try { - if(project.hasNature("edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature")){ - WPILibJavaPlugin.logInfo("Updating project"); - updateVariables(project); - } else { - } - } catch (CoreException e) { - WPILibJavaPlugin.logError("Error updating projects.", e); - } - } - } - - public void updateVariables(IProject project) throws CoreException { - Properties props = WPILibJavaPlugin.getDefault().getProjectProperties(project); - - try { - JavaCore.setClasspathVariable("wpilib", new Path(props.getProperty("wpilib.jar")), null); - JavaCore.setClasspathVariable("wpilib.sources", new Path(props.getProperty("wpilib.sources")), null); - JavaCore.setClasspathVariable("networktables", new Path(props.getProperty("networktables.jar")), null); - JavaCore.setClasspathVariable("networktables.sources", new Path(props.getProperty("networktables.sources")), null); - } catch (JavaModelException e) { - // Classpath variables didn't get set - WPILibJavaPlugin.logError("Error setting classpath..", e); - } - } - - @Override - public void earlyStartup() { - new JavaInstaller(getCurrentVersion()).installIfNecessary(); - } - - public static void logInfo(String msg) { - getDefault().getLog().log(new Status(Status.INFO, PLUGIN_ID, Status.OK, msg, null)); - } - - public static void logError(String msg, Exception e) { - getDefault().getLog().log(new Status(Status.ERROR, PLUGIN_ID, Status.OK, msg, e)); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/installer/JavaInstaller.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/installer/JavaInstaller.java deleted file mode 100644 index 3dade7364e..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/installer/JavaInstaller.java +++ /dev/null @@ -1,39 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.installer; - -import java.io.InputStream; -import org.eclipse.jface.preference.IPreferenceStore; - -import edu.wpi.first.wpilib.plugins.core.installer.AbstractInstaller; -import edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin; -import edu.wpi.first.wpilib.plugins.java.preferences.PreferenceConstants; - -/** - * Installs the given version of WPILib into the correct location. Where the - * install directory is usually ~/wpilib/java/version. - * - * @author alex - */ -public class JavaInstaller extends AbstractInstaller { - - public JavaInstaller(String version) { - super(version, - WPILibJavaPlugin.getDefault().getPreferenceStore().getString(PreferenceConstants.LIBRARY_INSTALLED), - WPILibJavaPlugin.getDefault().getJavaPath()); - } - - @Override - protected String getFeatureName() { - return "java"; - } - - @Override - protected void updateInstalledVersion(String version) { - IPreferenceStore prefs = WPILibJavaPlugin.getDefault().getPreferenceStore(); - prefs.setValue(PreferenceConstants.LIBRARY_INSTALLED, version); - } - - @Override - protected InputStream getInstallResourceStream() { - return JavaInstaller.class.getResourceAsStream("/resources/java.zip"); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/launching/DeployLaunchShortcut.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/launching/DeployLaunchShortcut.java deleted file mode 100644 index f107d763fc..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/launching/DeployLaunchShortcut.java +++ /dev/null @@ -1,24 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.launching; - -import org.eclipse.core.resources.IProject; - -/** - * Launch shortcut base functionality, common for deploying to the robot. - * Retrieves the project the operation is being called on, and runs the correct - * ant targets based on polymorphically determined data values - * - * @author Ryan O'Meara - * @author Alex Henning - */ -public class DeployLaunchShortcut extends JavaLaunchShortcut { - - /** - * Runs the ant script using the correct target for the indicated mode (deploy to cRIO or just compile) - * @param activeProj The project that the script will be run on/from - * @param mode The mode it will be run in (ILaunchManager.RUN_MODE or ILaunchManager.DEBUG_MODE) - */ - public void runConfig(IProject activeProj, String mode){ - runConfigHelper(activeProj, mode, "deploy", "debug-deploy"); - } -} - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/launching/JavaLaunchShortcut.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/launching/JavaLaunchShortcut.java deleted file mode 100644 index 481a4638ab..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/launching/JavaLaunchShortcut.java +++ /dev/null @@ -1,214 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.launching; - -import java.io.File; -import java.lang.reflect.Method; -import java.text.MessageFormat; -import java.util.HashMap; -import java.util.Map; -import java.util.Vector; - -import org.eclipse.core.internal.resources.Resource; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.debug.ui.ILaunchShortcut; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; -import org.eclipse.jdt.launching.IVMConnector; -import org.eclipse.jdt.launching.JavaRuntime; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PlatformUI; - -import com.sun.jdi.connect.Connector.Argument; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; -import edu.wpi.first.wpilib.plugins.core.launching.AntLauncher; -import edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin; - -@SuppressWarnings("restriction") -public abstract class JavaLaunchShortcut implements ILaunchShortcut { - private static final int DEBUG_ATTACH_ATTEMPTS = 20; - private static final int DEBUG_ATTACH_RETRY_DELAY_SEC = 2; - - //Class constants - used to delineate types for launch shortcuts - public static final String DEPLOY_TYPE = "edu.wpi.first.wpilib.plugins.core.deploy"; - private static final String ANT_SERVER_THREAD_NAME = "Ant Build Server Connection"; - - private static ILaunch lastDeploy = null; - - /** - * Returns the launch type of the shortcut that was used, one of the constants - * defined in BaseLaunchShortcut - * @return Launch shortcut type - */ - public String getLaunchType() {return DEPLOY_TYPE;} - - public void launch(ISelection selection, String mode) { - // Extract resource from selection - StructuredSelection sel = (StructuredSelection)selection; - IProject activeProject = null; - // NOTE: This caused issues earlier, as the sel return was treated as a workspace, instead of a project - // When it is a valid FIRST project, the selection is always a JavaProject - if(sel.getFirstElement() instanceof IProject) { - activeProject = ((IProject)sel.getFirstElement()).getProject(); - } else if(sel.getFirstElement() instanceof IJavaElement) { - activeProject = ((IJavaElement)sel.getFirstElement()).getJavaProject().getProject(); - } else { - WPILibJavaPlugin.logError("Selection isn't a project: "+sel.toString(), null); - return; - } - - // Run config using project found in extracted resource, with indicated mode - runConfig(activeProject, mode); - } - - @Override - public void launch(IEditorPart editor, String mode) { - // Extract resource from editor - if (editor != null) { - IFileEditorInput input = (IFileEditorInput)editor.getEditorInput(); - IFile file = input.getFile(); - IProject activeProject = file.getProject(); - - // If editor existed, run config using extracted resource in indicated mode - runConfig(activeProject, mode); - } else { - WPILibJavaPlugin.logError("Editor was null.", null); - } - - } - - /** - * Runs the ant script using the correct target for the indicated mode (deploy to cRIO or just compile) - * @param activeProj The project that the script will be run on/from - * @param mode The mode it will be run in (ILaunchManager.RUN_MODE or ILaunchManager.DEBUG_MODE) - * @return - */ - public abstract void runConfig(IProject activeProj, String mode); - - /** - * Runs the ant script using the correct target for the indicated mode (deploy to cRIO or just compile) - * @param activeProj The project that the script will be run on/from - * @param mode The mode it will be run in (ILaunchManager.RUN_MODE or ILaunchManager.DEBUG_MODE) - */ - protected void runConfigHelper(IProject activeProj, String mode, String runTarget, String debugTarget){ - String targets = runTarget; - - if(mode.equals(ILaunchManager.RUN_MODE)){ - if(getLaunchType().equals(DEPLOY_TYPE)){ - targets = runTarget; - } - } else if ((mode.equals(ILaunchManager.DEBUG_MODE))&&(getLaunchType().equals(DEPLOY_TYPE))) { - targets = debugTarget; - try{ - PlatformUI.getWorkbench().showPerspective(IDebugUIConstants.ID_DEBUG_PERSPECTIVE, - PlatformUI.getWorkbench().getActiveWorkbenchWindow()); - - }catch(Exception e){} - } - - if((lastDeploy != null)&&(!lastDeploy.isTerminated())){ - WPILibJavaPlugin.logInfo("Last deploy running"); - //Find the server connection thread and kill it - Vector threadGroups = new Vector(); - ThreadGroup root = Thread.currentThread().getThreadGroup().getParent(); - while (root.getParent() != null) {root = root.getParent();} - threadGroups.add(root); - ThreadGroup threadGroup = threadGroups.remove(0); - int numThreads = threadGroup.activeCount(); - Thread[] threads = new Thread[numThreads*100]; - numThreads = threadGroup.enumerate(threads, true); - - for(Thread current: threads){ - if(current != null){ - if(current.getName().equals(ANT_SERVER_THREAD_NAME)){ - try{ - //Manually end thread and then try terminating launch - Method stopMethod = current.getClass().getMethod("stop"); - stopMethod.invoke(current); - lastDeploy.terminate(); - break; - } catch(Exception e) { - WPILibJavaPlugin.logError("Error stopping ant", e); - } - } - } - } - - WPILibJavaPlugin.logInfo("Waiting"); - try{wait(1000);}catch(Exception e){} - - } - - WPILibJavaPlugin.logInfo("Running ant file: " + activeProj.getLocation().toOSString() + File.separator + "build.xml"); - WPILibJavaPlugin.logInfo("Targets: " + targets + ", Mode: " + mode); - lastDeploy = AntLauncher.runAntFile(new File (activeProj.getLocation().toOSString() + File.separator + "build.xml"), targets, null, mode); - - if((mode.equals(ILaunchManager.DEBUG_MODE))&&(getLaunchType().equals(DEPLOY_TYPE))) { - try { - startDebugConfig(getRemoteDebugConfig(activeProj)); - } catch (CoreException | InterruptedException e) { - WPILibJavaPlugin.logError("Debug attach failed", e); - } - } - - try { - activeProj.refreshLocal(Resource.DEPTH_INFINITE, null); - } catch (Exception e) {} - } - - private ILaunchConfigurationWorkingCopy getRemoteDebugConfig(IProject activeProj) throws CoreException { - ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); - ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_REMOTE_JAVA_APPLICATION); - ILaunchConfigurationWorkingCopy config = type.newInstance(null, "Debug "+activeProj.getName()); - config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, activeProj.getName()); - config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE, true); - config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, IJavaLaunchConfigurationConstants.ID_SOCKET_ATTACH_VM_CONNECTOR); - IVMConnector connector = JavaRuntime.getVMConnector(IJavaLaunchConfigurationConstants.ID_SOCKET_ATTACH_VM_CONNECTOR); - Map def = connector.getDefaultArguments(); - Map argMap = new HashMap(def.size()); - argMap.put("hostname", getHostname(activeProj)); - argMap.put("port", "8348"); - WPILibJavaPlugin.logInfo(argMap.toString()); - config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, argMap); - return config; - } - - protected String getHostname(IProject proj) { - return WPILibCore.getDefault().getTargetIP(proj); - } - - private void startDebugConfig(final ILaunchConfigurationWorkingCopy config) - throws CoreException, InterruptedException { - int remainingAttempts = DEBUG_ATTACH_ATTEMPTS; - - // Retry until success or rethrow of exception on failure - while (true) { - try { - WPILibJavaPlugin.logInfo("Attemping to attach debugger..."); - config.launch(ILaunchManager.DEBUG_MODE, null); - WPILibJavaPlugin.logInfo("Debugger attached."); - break; - } catch (CoreException e) { - if (--remainingAttempts > 0) { - String errorMsg = MessageFormat.format("Unable to attach debugger. " - + "{0} attempts remain - waiting {1} second(s) before retrying...", - remainingAttempts, DEBUG_ATTACH_RETRY_DELAY_SEC); - WPILibJavaPlugin.logError(errorMsg, null); - Thread.sleep(DEBUG_ATTACH_RETRY_DELAY_SEC * 1000); - } else { - throw e; - } - } - } - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/launching/SimulateLaunchShortcut.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/launching/SimulateLaunchShortcut.java deleted file mode 100644 index cb4fca6ca9..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/launching/SimulateLaunchShortcut.java +++ /dev/null @@ -1,26 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.launching; - -import org.eclipse.core.resources.IProject; - -import edu.wpi.first.wpilib.plugins.core.launching.SimulationNotification; - -public class SimulateLaunchShortcut extends JavaLaunchShortcut { - - - /** - * Runs the ant script using the correct target for the indicated mode (deploy to cRIO or just compile) - * @param activeProj The project that the script will be run on/from - * @param mode The mode it will be run in (ILaunchManager.RUN_MODE or ILaunchManager.DEBUG_MODE) - */ - public void runConfig(IProject activeProj, String mode){ - if (SimulationNotification.supportsSimulation()) { - runConfigHelper(activeProj, mode, "simulate", "debug-simulate"); - } else { - SimulationNotification.showUnsupported(); - } - } - - protected String getHostname(IProject proj) { - return "localhost"; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/preferences/PreferenceConstants.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/preferences/PreferenceConstants.java deleted file mode 100644 index 396e04d797..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/preferences/PreferenceConstants.java +++ /dev/null @@ -1,8 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.preferences; - -/** - * Constant definitions for plug-in preferences - */ -public class PreferenceConstants { - public static final String LIBRARY_INSTALLED = "libraryVersion_current"; -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/preferences/PreferenceInitializer.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/preferences/PreferenceInitializer.java deleted file mode 100644 index 575f3fa440..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/preferences/PreferenceInitializer.java +++ /dev/null @@ -1,24 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.preferences; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.preference.IPreferenceStore; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; -import edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin; - -/** - * Class used to initialize default preference values. - */ -public class PreferenceInitializer extends AbstractPreferenceInitializer { - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() - */ - public void initializeDefaultPreferences() { - IPreferenceStore store = WPILibJavaPlugin.getDefault().getPreferenceStore(); - if (!store.contains(PreferenceConstants.LIBRARY_INSTALLED)) - store.setValue(PreferenceConstants.LIBRARY_INSTALLED, "none"); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/examples/ExampleJavaProject.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/examples/ExampleJavaProject.java deleted file mode 100644 index 2aec019ece..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/examples/ExampleJavaProject.java +++ /dev/null @@ -1,59 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.wizards.examples; - -import java.util.List; -import java.util.Map; - -import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject; -import edu.wpi.first.wpilib.plugins.java.wizards.newproject.JavaProjectType; - -public class ExampleJavaProject extends JavaProjectType implements IExampleProject { - private String name, description, world; - private List tags; - private List packages; - private List files; - - public ExampleJavaProject(String name, String description, List tags, - String world, List packages, List files) { - this.name = name; - this.description = description; - this.tags = tags; - this.world = world; - this.packages = packages; - this.files = files; - } - - public String getName() { - return name; - } - - public String getContent() { - return "

"+name+"

"+description+"

"; - } - - public List getTags() { - return tags; - } - - public String getWorld() { - return world; - } - - @Override - public String[] getFolders(String packageName) { - String packageDir = packageName.replace(".", "/"); - for (int i = 0; i < packages.size(); i++) { - packages.set(i, packages.get(i).replaceAll("\\$package-dir", packageDir)); - } - return packages.toArray(new String[0]); - } - - @Override - public Map getFiles(String packageName) { - String packageDir = packageName.replace(".", "/"); - Map files = super.getFiles(packageName); - for (ExportFile file : this.files) { - files.put(file.destination.replaceAll("\\$package-dir", packageDir), file.source); - } - return files; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/examples/ExampleJavaWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/examples/ExampleJavaWizard.java deleted file mode 100644 index eb66e780ff..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/examples/ExampleJavaWizard.java +++ /dev/null @@ -1,67 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.wizards.examples; - -import java.net.URL; -import java.util.List; -import java.util.Properties; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.wizard.IWizardPage; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; -import edu.wpi.first.wpilib.plugins.core.wizards.ExampleWizard; -import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject; -import edu.wpi.first.wpilib.plugins.core.wizards.INewProjectInfo; -import edu.wpi.first.wpilib.plugins.core.wizards.IExampleProject.ExportFile; -import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage; -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils; -import edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin; -import edu.wpi.first.wpilib.plugins.java.wizards.newproject.WPIRobotJavaProjectCreator; - -public class ExampleJavaWizard extends ExampleWizard { - private NewProjectMainPage detailsPage; - - /** - * Constructor for SampleNewWizard. - */ - public ExampleJavaWizard() { - super(); - setNeedsProgressMonitor(true); - } - - @Override - protected void doFinish(IExampleProject ex, String teamNumber) throws CoreException { - Properties props = WPILibCore.getDefault().getProjectProperties(null); - props.setProperty("team-number", teamNumber); - WPILibCore.getDefault().saveGlobalProperties(props); - - final String projectName = detailsPage.getProjectName(); - final String packageName = detailsPage.getPackage(); - final String worldName = detailsPage.getWorld(); - ProjectCreationUtils.createProject(new WPIRobotJavaProjectCreator(projectName, packageName, ex, worldName)); - } - - @Override - protected IWizardPage getDetailsPage(INewProjectInfo info) { - if (detailsPage != null) return detailsPage; - detailsPage = new NewProjectMainPage(selection, getTeamNumberPage(), info); - detailsPage.setTitle("Create Example Robot Java Project"); - detailsPage.setDescription("This wizard creates a new example project based on your selection."); - return detailsPage; - } - - @Override - public IExampleProject makeExampleProject(String name, String description, - List tags, String world, List folders, List files) { - return new ExampleJavaProject(name, description, tags, world, folders, files); - } - - @Override - public URL getResourceURL() { - return WPILibJavaPlugin.getDefault().getBundle().getEntry("/resources/templates/examples"); - } - - @Override - public String getXMLFile() { - return "examples.xml"; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/CommandGroupWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/CommandGroupWizard.java deleted file mode 100644 index b2a22fa196..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/CommandGroupWizard.java +++ /dev/null @@ -1,9 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.wizards.file_template; - -public class CommandGroupWizard extends FileTemplateWizard { - - public CommandGroupWizard() { - super("CommandGroup", "command-based/CommandGroup.java", "commands"); - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/CommandWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/CommandWizard.java deleted file mode 100644 index fe277fe1d5..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/CommandWizard.java +++ /dev/null @@ -1,9 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.wizards.file_template; - -public class CommandWizard extends FileTemplateWizard { - - public CommandWizard() { - super("Command", "command-based/Command.java", "commands"); - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/FileTemplateWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/FileTemplateWizard.java deleted file mode 100644 index 73a653bca1..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/FileTemplateWizard.java +++ /dev/null @@ -1,126 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.wizards.file_template; - -import java.lang.reflect.InvocationTargetException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWizard; - -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils; -import edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin; - -public class FileTemplateWizard extends Wizard implements INewWizard { - private String type, source, ending; - private FileTemplateWizardMainPage page; - private ISelection selection; - private IProject project; - - /** - * Constructor for SampleNewWizard. - */ - public FileTemplateWizard(String type, String source, String ending) { - super(); - setNeedsProgressMonitor(true); - this.type = type; - this.source = source; - this.ending = ending; - } - - /** - * Adding the page to the wizard. - */ - - public void addPages() { - page = new FileTemplateWizardMainPage(type, project, ending, selection); - addPage(page); - } - - /** - * This method is called when 'Finish' button is pressed in - * the wizard. We will create an operation and run it - * using wizard as execution context. - */ - public boolean performFinish() { - final IProject project = page.getProject(); - final String className = page.getClassName(); - final String packageName = page.getPackage(); - WPILibJavaPlugin.logInfo("Class: "+className+" Package: "+packageName); - IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException { - try { - doFinish(project, className, packageName, monitor); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }; - try { - getContainer().run(true, false, op); - } catch (InterruptedException e) { - return false; - } catch (InvocationTargetException e) { - Throwable realException = e.getTargetException(); - MessageDialog.openError(getShell(), "Error", realException.getMessage()); - return false; - } - return true; - } - - /** - * The worker method. It will find the container, create the - * file if missing or just replace its contents, and open - * the editor on the newly created file. - */ - private void doFinish(IProject project, String className, String packageName, IProgressMonitor monitor) throws CoreException { - Map map = new HashMap(); - map.put("$classname", className); - map.put("$package", packageName); - String filepath = "src/"+packageName.replace(".", "/")+"/"+className+".java"; - try { - URL url = new URL(WPILibJavaPlugin.getDefault().getBundle().getEntry("/resources/templates/"), source); - ProjectCreationUtils.createTemplateFile(project, filepath, url, map); - } catch (MalformedURLException e) { - WPILibJavaPlugin.logError("Error finishing making file: "+className, e); - } - } - - /** - * We will accept the selection in the workbench to see if - * we can initialize from it. - * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - WPILibJavaPlugin.logInfo(selection.toString()); - Object element = ((StructuredSelection) selection).getFirstElement(); - if (element != null) WPILibJavaPlugin.logInfo(element.getClass().toString()); - if (element instanceof IResource) { - project = ((IResource) element).getProject(); - } else if (element instanceof IPackageFragment) { - project = ((IPackageFragment) element).getJavaProject().getProject(); - } else if (element instanceof IPackageFragmentRoot) { - project = ((IPackageFragmentRoot) element).getJavaProject().getProject(); - } else if (element instanceof ICompilationUnit) { - project = ((ICompilationUnit) element).getJavaProject().getProject(); - } else WPILibJavaPlugin.logInfo("Element not instance of IResource"); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/FileTemplateWizardMainPage.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/FileTemplateWizardMainPage.java deleted file mode 100644 index 07d43953dc..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/FileTemplateWizardMainPage.java +++ /dev/null @@ -1,215 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.wizards.file_template; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jface.dialogs.IDialogPage; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -import edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature; -import edu.wpi.first.wpilib.plugins.core.wizards.IProjectFilter; -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectComboField; -import edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin; - -/** - * The "New" wizard page allows setting the container for the new file as well - * as the file name. The page will only accept file name without the extension - * OR with the extension that matches the expected one (mpe). - */ - -public class FileTemplateWizardMainPage extends WizardPage { - private IProject project; - private String ending; - private ProjectComboField projectsCombo; - private Text classNameText; - private Text packageText; - - /** - * Constructor for SampleNewWizardPage. - * - * @param pageName - */ - public FileTemplateWizardMainPage(String type, IProject project, String ending, ISelection selection) { - super("wizardPage"); - setTitle("Create New "+type); - setDescription("This wizard creates a new "+type.toLowerCase()+" from a template."); - this.project = project; - this.ending = ending; - } - - /** - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite container = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 2; - layout.verticalSpacing = 9; - - Label label = new Label(container, SWT.NULL); - label.setText("Pro&ject:"); - - projectsCombo = new ProjectComboField(container, SWT.BORDER | SWT.SINGLE, - new IProjectFilter() { - @Override public boolean accept(IProject project) { - try { - return project.hasNature(FRCProjectNature.FRC_PROJECT_NATURE) - && project.hasNature(JavaCore.NATURE_ID); - } catch (CoreException e) { - WPILibJavaPlugin.logError("Error looking for FRCJava project.", e); - return false; - } - } - }); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - projectsCombo.setLayoutData(gd); - projectsCombo.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e){ - if (project == null){ - project = projectsCombo.getProject(); - } - packageText.setText(getDefaultPackage()); - } - public void widgetDefaultSelected(SelectionEvent e){} - }); - projectsCombo.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - label = new Label(container, SWT.NULL); - label.setText("Class &Name:"); - - classNameText = new Text(container, SWT.BORDER | SWT.SINGLE); - gd = new GridData(GridData.FILL_HORIZONTAL); - classNameText.setLayoutData(gd); - classNameText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - label = new Label(container, SWT.NULL); - label.setText("&Package:"); - - packageText = new Text(container, SWT.BORDER | SWT.SINGLE); - gd = new GridData(GridData.FILL_HORIZONTAL); - packageText.setLayoutData(gd); - packageText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - initialize(); - dialogChanged(); - setControl(container); - } - - /** - * Tests if the current workbench selection is a suitable container to use. - */ - - private void initialize() { - WPILibJavaPlugin.logInfo("initialize"); - projectsCombo.setProject(project); - packageText.setText(getDefaultPackage()); - } - - /** - * Ensures that both text fields are set. - */ - - private void dialogChanged() { - String className = getClassName(); - String packageString = getPackage(); - - // Update the default package if necessary - if (project == null || !project.equals(projectsCombo.getProject())) { - String oldDefault = getDefaultPackage(); - project = projectsCombo.getProject(); - if (packageString.equals(oldDefault)) { - packageText.setText(getDefaultPackage()); - } - } - - if (!projectsCombo.isValid()) { - updateStatus("Must select a project."); - return; - } - if (className.length() == 0) { - updateStatus("Class name must be specified"); - return; - } - if (!className.matches("^([a-zA-Z_]{1}[a-zA-Z0-9_]*)$")) { - updateStatus("Must be a valid java class name"); - return; - } - if (packageString.length() == 0) { - updateStatus("Package must be specified"); - return; - } - if (!packageString.matches("^([a-zA-Z_]{1}[a-zA-Z0-9_]*(\\.[a-zA-Z_]{1}[a-zA-Z0-9_]*)*)$")) { - updateStatus("Must be valid java package"); - return; - } - updateStatus(null); - } - - private void updateStatus(String message) { - setErrorMessage(message); - setPageComplete(message == null); - } - - public IProject getProject() { - return projectsCombo.getProject(); - } - - public String getClassName() { - return classNameText.getText(); - } - - public String getPackage() { - return packageText.getText(); - } - - public String getDefaultPackage() { - WPILibJavaPlugin.logInfo("Project: "+project); - String defaultPackage = null; - if (project != null) { - try { - IPackageFragmentRoot root = JavaCore.create(project) - .getPackageFragmentRoot(project.getFolder("src")); - String backupPackage = ""; - for (IJavaElement child : root.getChildren()) { - if (child.getElementType()==IJavaElement.PACKAGE_FRAGMENT - && child.getElementName().endsWith("."+ending)) { - defaultPackage = child.getElementName(); - } - backupPackage = child.getElementName(); - } - if (defaultPackage == null) defaultPackage = backupPackage; - } catch (JavaModelException e) { - WPILibJavaPlugin.logError("Error getting default package.", e); - } - } - if (defaultPackage != null) return defaultPackage; - else return ""; - } -} \ No newline at end of file diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/PIDSubsystemWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/PIDSubsystemWizard.java deleted file mode 100644 index d61cc1ad25..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/PIDSubsystemWizard.java +++ /dev/null @@ -1,9 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.wizards.file_template; - -public class PIDSubsystemWizard extends FileTemplateWizard { - - public PIDSubsystemWizard() { - super("PIDSubsystem", "command-based/PIDSubsystem.java", "subsystems"); - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/SubsystemWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/SubsystemWizard.java deleted file mode 100644 index 35c20b4da2..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/SubsystemWizard.java +++ /dev/null @@ -1,9 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.wizards.file_template; - -public class SubsystemWizard extends FileTemplateWizard { - - public SubsystemWizard() { - super("Subsystem", "command-based/Subsystem.java", "subsystems"); - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/TriggerWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/TriggerWizard.java deleted file mode 100644 index c2f3ac3b14..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/file_template/TriggerWizard.java +++ /dev/null @@ -1,9 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.wizards.file_template; - -public class TriggerWizard extends FileTemplateWizard { - - public TriggerWizard() { - super("Trigger", "command-based/Trigger.java", "triggers"); - } - -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/newproject/JavaProjectType.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/newproject/JavaProjectType.java deleted file mode 100644 index 376ad57da6..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/newproject/JavaProjectType.java +++ /dev/null @@ -1,69 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.wizards.newproject; - -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType; -import edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin; - -public class JavaProjectType implements ProjectType { - static ProjectType SAMPLE = new JavaProjectType() { - @Override public Map getFiles(String packageName) { - Map files = super.getFiles(packageName); - files.put("src/"+packageName.replace(".", "/")+"/Robot.java", "sample/Robot.java"); - return files; - } - }; - static ProjectType ITERATIVE = new JavaProjectType() { - @Override public Map getFiles(String packageName) { - Map files = super.getFiles(packageName); - files.put("src/"+packageName.replace(".", "/")+"/Robot.java", "iterative/Robot.java"); - return files; - } - }; - static ProjectType COMMAND_BASED = new JavaProjectType() { - @Override public String[] getFolders(String packageName) { - String[] paths = {"src/"+packageName.replace(".", "/"), - "src/"+packageName.replace(".", "/")+"/commands", - "src/"+packageName.replace(".", "/")+"/subsystems", - "src/"+packageName.replace(".", "/")+"/triggers"}; - return paths; - } - @Override public Map getFiles(String packageName) { - Map files = super.getFiles(packageName); - files.put("src/"+packageName.replace(".", "/")+"/Robot.java", "command-based/Robot.java"); - files.put("src/"+packageName.replace(".", "/")+"/RobotMap.java", "command-based/RobotMap.java"); - files.put("src/"+packageName.replace(".", "/")+"/OI.java", "command-based/OI.java"); - files.put("src/"+packageName.replace(".", "/")+"/commands/ExampleCommand.java", "command-based/ExampleCommand.java"); - files.put("src/"+packageName.replace(".", "/")+"/subsystems/ExampleSubsystem.java", "command-based/ExampleSubsystem.java"); - return files; - } - }; - @SuppressWarnings("serial") - static Map TYPES = new HashMap() {{ - put(ProjectType.SAMPLE, SAMPLE); - put(ProjectType.ITERATIVE, ITERATIVE); - put(ProjectType.COMMAND_BASED, COMMAND_BASED); - }}; - - @Override - public String[] getFolders(String packageName) { - String[] paths = {"src/"+packageName.replace(".", "/")}; - return paths; - } - - @Override - public Map getFiles(String packageName) { - HashMap files = new HashMap(); - files.put("build.xml", "build.xml"); - files.put("build.properties", "build.properties"); - files.put(".classpath", ".classpath"); - return files; - } - - @Override - public URL getBaseURL() { - return WPILibJavaPlugin.getDefault().getBundle().getEntry("/resources/templates/"); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/newproject/NewJavaWizard.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/newproject/NewJavaWizard.java deleted file mode 100644 index d73018698c..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/newproject/NewJavaWizard.java +++ /dev/null @@ -1,123 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.wizards.newproject; - -import java.lang.reflect.InvocationTargetException; -import java.util.Properties; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWizard; - -import edu.wpi.first.wpilib.plugins.core.WPILibCore; -import edu.wpi.first.wpilib.plugins.core.wizards.INewProjectInfo; -import edu.wpi.first.wpilib.plugins.core.wizards.NewProjectMainPage; -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectCreationUtils; -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType; -import edu.wpi.first.wpilib.plugins.core.wizards.TeamNumberPage; -import edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin; - -/** - * - * Example Docs: - * This is a sample new wizard. Its role is to create a new file - * resource in the provided container. If the container resource - * (a folder or a project) is selected in the workspace - * when the wizard is opened, it will accept it as the target - * container. The wizard creates one file with the extension - * "mpe". If a sample multi-page editor (also available - * as a template) is registered for the same extension, it will - * be able to open it. - */ - -public class NewJavaWizard extends Wizard implements INewWizard { - private TeamNumberPage teamNumberPage; - private NewProjectMainPage page; - private ISelection selection; - - /** - * Constructor for SampleNewWizard. - */ - public NewJavaWizard() { - super(); - setNeedsProgressMonitor(true); - } - - /** - * Adding the page to the wizard. - */ - - public void addPages() { - if (TeamNumberPage.needsTeamNumberPage()) { - teamNumberPage = new TeamNumberPage(selection); - addPage(teamNumberPage); - } - page = new NewProjectMainPage(selection, teamNumberPage, INewProjectInfo.Null); - page.setProjectTypes(JavaProjectType.TYPES); - page.setTitle("Create New Robot Java Project"); - page.setDescription("This wizard creates a new Robot Java Project configured to use WPILib for programming FRC robots."); - addPage(page); - } - - /** - * This method is called when 'Finish' button is pressed in - * the wizard. We will create an operation and run it - * using wizard as execution context. - */ - public boolean performFinish() { - final String projectName = page.getProjectName(); - final String teamNumber = TeamNumberPage.getTeamNumberFromPage(teamNumberPage); - final String packageName = page.getPackage(); - final ProjectType projectType = page.getProjectType(); - final String worldName = page.getWorld(); - WPILibJavaPlugin.logInfo("Project: "+projectName+" Package: "+packageName+" Project Type: "+projectType); - IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException { - try { - doFinish(projectName, teamNumber, packageName, projectType, worldName, monitor); - } catch (CoreException e) { - throw new InvocationTargetException(e); - } finally { - monitor.done(); - } - } - }; - try { - getContainer().run(true, false, op); - } catch (InterruptedException e) { - return false; - } catch (InvocationTargetException e) { - Throwable realException = e.getTargetException(); - MessageDialog.openError(getShell(), "Error", realException.getMessage()); - return false; - } - return true; - } - - /** - * The worker method. It will find the container, create the - * file if missing or just replace its contents, and open - * the editor on the newly created file. - */ - - private void doFinish(String projectName, String teamNumber, String packageName, ProjectType projectType, String worldName, IProgressMonitor monitor) throws CoreException { - Properties props = WPILibCore.getDefault().getProjectProperties(null); - props.setProperty("team-number", teamNumber); - WPILibCore.getDefault().saveGlobalProperties(props); - ProjectCreationUtils.createProject(new WPIRobotJavaProjectCreator(projectName, packageName, projectType, worldName)); - } - - /** - * We will accept the selection in the workbench to see if - * we can initialize from it. - * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/newproject/WPIRobotJavaProjectCreator.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/newproject/WPIRobotJavaProjectCreator.java deleted file mode 100644 index 458b561293..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/java/edu/wpi/first/wpilib/plugins/java/wizards/newproject/WPIRobotJavaProjectCreator.java +++ /dev/null @@ -1,69 +0,0 @@ -package edu.wpi.first.wpilib.plugins.java.wizards.newproject; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.JavaCore; - -import edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature; -import edu.wpi.first.wpilib.plugins.core.wizards.IProjectCreator; -import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType; -import edu.wpi.first.wpilib.plugins.java.WPILibJavaPlugin; - -public class WPIRobotJavaProjectCreator implements IProjectCreator { - String projectName, packageName, worldName; - ProjectType projectType; - - public WPIRobotJavaProjectCreator(String projectName, String packageName, ProjectType projectType, String worldName) { - this.projectName = projectName; - this.packageName = packageName; - this.projectType = projectType; - this.worldName = worldName; - } - - @Override - public String getName() { - return projectName; - } - - @Override - public String getPackageName() { - return packageName; - } - - @Override - public Map getValues() { - Map vals = new HashMap(); - vals.put("$project", projectName); - vals.put("$package", packageName); - vals.put("$world", worldName); - return vals; - } - - @Override - public List getNatures() { - List natures = new ArrayList<>(); - natures.add(JavaCore.NATURE_ID); - natures.add(FRCProjectNature.FRC_PROJECT_NATURE); - return natures; - } - - @Override - public ProjectType getProjectType() { - return projectType; - } - - @Override - public void initialize(IProject project) { - JavaCore.create(project); - } - - @Override - public void finalize(IProject project) throws CoreException { - WPILibJavaPlugin.getDefault().updateVariables(project); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/ant-classloadertask.jar b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/ant-classloadertask.jar deleted file mode 100644 index d2f58d9f1d..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/ant-classloadertask.jar and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/ant-contrib.jar b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/ant-contrib.jar deleted file mode 100644 index ea817cd434..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/ant-contrib.jar and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/build.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/build.properties deleted file mode 100644 index 9538706b1d..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/build.properties +++ /dev/null @@ -1,42 +0,0 @@ -# Deployment information -username=lvuser -password= -deploy.dir=/home/lvuser -deploy.kill.command=. /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t -r -debug.flag.dir=/tmp/ -debug.flag.command=chown lvuser:ni ${debug.flag.dir}frcdebug -command.dir=/home/lvuser/ -version=current -roboRIOJRE.dir=/usr/local/frc/JRE - -# Libraries to use -wpilib=${user.home}/wpilib/java/${version} -wpilib.lib=${wpilib}/lib -wpilib.jar=${wpilib.lib}/WPILib.jar -wpilib.sources=${wpilib.lib}/WPILib-sources.jar -networktables.jar=${wpilib.lib}/NetworkTables.jar -networktables.sources=${wpilib.lib}/NetworkTables-sources.jar -#jna.jar=${wpilib.lib}/jna-4.0.0.jar -#jnaerator.jar=${wpilib.lib}/jnaerator-runtime.jar -#classpath=${wpilib.jar}:${networktables.jar}:${jna.jar}:${jnaerator.jar} -classpath=${wpilib.jar}:${networktables.jar} -roboRIOAllowedImages=15 - -# Ant support -wpilib.ant.dir=${wpilib}/ant -jsch.jar=${wpilib.ant.dir}/jsch-0.1.50.jar -classloadertask.jar=${wpilib.ant.dir}/ant-classloadertask.jar - -# Build information -jar=FRCUserProgram.jar -src.dir=src -build.dir=build -build.jars=${build.dir}/jars -dist.dir=dist -dist.jar=${dist.dir}/${jar} - -# Simulation Information -simulation.dist.jar=${dist.dir}/FRCUserProgramSim.jar -wpilib.sim=${wpilib}/sim -wpilib.sim.lib=${wpilib.sim}/lib -wpilib.sim.tools=${wpilib.sim}/tools diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/build.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/build.xml deleted file mode 100644 index 58f0e52708..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/build.xml +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - Trying Target: ${target} - - - - roboRIO found via mDNS - - - - roboRIO not found via mDNS, falling back to static USB - - - - - roboRIO found via static USB - - - - - - - roboRIO not found via USB, falling back to static address of ${target} - - - - - - roboRIO found via Ethernet static - - - - - - - - - [athena-compile] Compiling ${src.dir} with classpath=${classpath} to ${build.dir} - - - - - - - [athena-jar] Making jar ${dist.jar}. - - - - [athena-jar] Copying jars from ${classpath} to ${build.jars}. - - - - - - - - - - - - - - - - - - - - - - - - [athena-deploy] Copying code over. - - - - - - - - [athena-deploy] Starting program. - - - - - - - - [athena-deploy] Copying code over. - - - - - - - - [athena-deploy] Starting Debug program. - - - - - - - [jar-for-simulation] Building jar. - - - - - - - - - - - - - - - - - - - - - - [simulate] You may now run Gazebo - - - - [debug-simulate] You may now run your DriverStation. - - - - [simulate] Running Code. - - - - - - - - - - - [debug-simulate] Running Gazebo. - - - - - - - [debug-simulate] you may now run your DriverStation. - - - - [debug-simulate] Running Code. - - - - - - - - - - - - - - - - - - - - - - - - roboRIO image version validated - Checking for JRE. If this fails install the JRE using these instructions: https://wpilib.screenstepslive.com/s/4485/m/13503/l/288822-installing-java-8-on-the-roborio-using-the-frc-roborio-java-installer-java-only - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/frcdebug b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/frcdebug deleted file mode 100644 index 206e7f86e8..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/frcdebug +++ /dev/null @@ -1,2 +0,0 @@ -# This file is used as a flag to determine if debugging should be used. -# It is uploaded to the robot when launched in debug mode and should be removed automatically once used. \ No newline at end of file diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/jsch-0.1.50.jar b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/jsch-0.1.50.jar deleted file mode 100644 index 85c044f216..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/jsch-0.1.50.jar and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/robotCommand b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/robotCommand deleted file mode 100644 index c1333b7408..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/robotCommand +++ /dev/null @@ -1,2 +0,0 @@ -env LD_LIBRARY_PATH=/usr/local/frc/rpath-lib/ /usr/local/frc/bin/netconsole-host /usr/local/frc/JRE/bin/java -jar /home/lvuser/FRCUserProgram.jar - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/robotDebugCommand b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/robotDebugCommand deleted file mode 100644 index 2c26f35d8f..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/src/main/resources/java-zip/ant/robotDebugCommand +++ /dev/null @@ -1,2 +0,0 @@ -env LD_LIBRARY_PATH=/usr/local/frc/rpath-lib/ /usr/local/frc/bin/netconsole-host /usr/local/frc/JRE/bin/java -XX:+UsePerfData -agentlib:jdwp=transport=dt_socket,address=8348,server=y,suspend=y -jar /home/lvuser/FRCUserProgram.jar - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/META-INF/MANIFEST.MF b/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/META-INF/MANIFEST.MF deleted file mode 100644 index 4e6a849bd8..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/META-INF/MANIFEST.MF +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: WPILib_Riolog -Bundle-SymbolicName: edu.wpi.first.wpilib.plugins.riolog;singleton:=true -Bundle-Version: 0.1.0.qualifier -Bundle-Activator: netconsole2.Activator -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Bundle-ActivationPolicy: lazy -Bundle-Vendor: WPI & FIRST diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/README b/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/README deleted file mode 100644 index 09ee25990a..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/README +++ /dev/null @@ -1,13 +0,0 @@ - - Riolog - -This is an Eclipse plugin that receives and displays text from UDP port 6666. It -defines a new view that displays the received text. - -To compile, open project in an Eclipse instance with the appropriate plugin -development tools, and Export as a deployable plugin/fragment. - -To install, copy the resulting jar file into $eclipse/dropins/, and start -Eclipse (-clean may be necessary). - -To enable, go to Window>Show View>Other... and choose General>Riolog. diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/build.properties b/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/build.properties deleted file mode 100644 index caaec514ba..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = plugin.xml,\ - META-INF/,\ - .,\ - icons/,\ - contexts.xml diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/contexts.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/contexts.xml deleted file mode 100644 index c3ed6a6474..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/contexts.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - This is the context help for the Riolog It was generated by a PDE template. - - - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/icons/riolog.png b/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/icons/riolog.png deleted file mode 100644 index 2d6bb56c0b..0000000000 Binary files a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/icons/riolog.png and /dev/null differ diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/plugin.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/plugin.xml deleted file mode 100644 index 57fe851dc4..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/plugin.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/pom.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/pom.xml deleted file mode 100644 index 75dffb853c..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - 4.0.0 - edu.wpi.first.wpilib.plugins.riolog - eclipse-plugin - - - edu.wpi.first.wpilib.plugins - edu.wpi.first.wpilib.plugins - 0.1.0.qualifier - .. - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/src/netconsole2/Activator.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/src/netconsole2/Activator.java deleted file mode 100644 index 60d069df71..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/src/netconsole2/Activator.java +++ /dev/null @@ -1,61 +0,0 @@ -package netconsole2; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "riolog"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given - * plug-in relative path - * - * @param path the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - return imageDescriptorFromPlugin(PLUGIN_ID, path); - } -} diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/src/netconsole2/views/RiologView.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/src/netconsole2/views/RiologView.java deleted file mode 100644 index 29d36d7829..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.riolog/src/netconsole2/views/RiologView.java +++ /dev/null @@ -1,414 +0,0 @@ -package netconsole2.views; - -import java.io.IOException; -import java.net.DatagramPacket; -import java.net.DatagramSocket; -import java.net.InetSocketAddress; -import java.net.SocketException; -import java.util.ArrayList; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; - - -public class RiologView extends ViewPart { - public static Action confAction(String name, String tooltip, String img, - Action e) { - e.setText(name); - e.setToolTipText(tooltip); - e.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages() - .getImageDescriptor(img)); - return e; - } - - public static byte[] getPacket(DatagramSocket socket, DatagramPacket buf) { - try { - socket.receive(buf); - } catch (IOException e) { - return null; - } - byte[] ret = new byte[buf.getLength()]; - System.arraycopy(buf.getData(), 0, ret, 0, ret.length); - return ret; - } - - public static DatagramSocket makeRecvSocket() { - DatagramSocket socket = null; - try { - socket = new DatagramSocket(null); - socket.setReuseAddress(true); - socket.bind(new InetSocketAddress(6666)); - } catch (SocketException e) { - e.printStackTrace(); - socket.close(); - return null; - } - return socket; - } - - public static Thread startDaemonThread(Runnable r, String name) { - Thread t = new Thread(r, name); - t.setDaemon(true); - t.start(); - return t; - } - - /** - * The ID of the view as specified by the extension. - */ - public static final String ID = "netconsole2.views.RiologView"; - - Text text; - Thread listener; - Thread transferer; - - volatile DatagramSocket socket_hook = null; - volatile boolean discard = false; - volatile boolean paused = false; - volatile boolean cleanup = false; - - private Action clearAction; - private Action pauseAction; - private Action discardAction; - private Action unpauseAction; - private Action undiscardAction; - private Button discardButton; - private Button pauseButton; - - /** - * The constructor. - */ - public RiologView() { - } - - private void contributeToActionBars() { - IActionBars bars = getViewSite().getActionBars(); - fillLocalPullDown(bars.getMenuManager()); - fillLocalToolBar(bars.getToolBarManager()); - } - - /** - * This is a callback that will allow us to create the viewer and initialize - * it. - */ - public void createPartControl(Composite parent) { - GridLayout glayout = new GridLayout(); - glayout.numColumns = 1; - parent.setLayout(glayout); - - text = new Text(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL - | SWT.READ_ONLY); - { - GridData gdata = new GridData(); - gdata.grabExcessVerticalSpace = true; - gdata.grabExcessHorizontalSpace = true; - gdata.horizontalAlignment = SWT.FILL; - gdata.verticalAlignment = SWT.FILL; - text.setLayoutData(gdata); - } - - Composite row = new Composite(parent, SWT.NONE); - - row.setLayout(new FillLayout(SWT.HORIZONTAL)); - - { - GridData gdata = new GridData(); - gdata.grabExcessVerticalSpace = false; - gdata.grabExcessHorizontalSpace = true; - gdata.horizontalAlignment = SWT.FILL; - gdata.verticalAlignment = SWT.CENTER; - row.setLayoutData(gdata); - } - - - - // Create the help context id for the viewer's control - PlatformUI.getWorkbench().getHelpSystem() - .setHelp(parent, "netconsole2.text"); - makeActions(); - makeButtons(row); - hookContextMenu(); - contributeToActionBars(); - startListening(); - } - - public void makeButtons(Composite parent) { - pauseButton = new Button(parent, SWT.TOGGLE); - pauseButton.setText(pauseAction.getText()); - pauseButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (pauseButton.getSelection()) { - pauseAction.run(); - } else { - unpauseAction.run(); - } - } - }); - discardButton = new Button(parent, SWT.TOGGLE); - discardButton.setText(discardAction.getText()); - discardButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (discardButton.getSelection()) { - discardAction.run(); - } else { - undiscardAction.run(); - } - } - }); - Button clearButton = new Button(parent, SWT.PUSH); - clearButton.setText(clearAction.getText()); - clearButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - clearAction.run(); - } - }); - } - - @Override - public void dispose() { - stopListening(); - super.dispose(); - } - - private void fillContextMenu(IMenuManager manager) { - manager.add(pauseAction); - manager.add(unpauseAction); - manager.add(new Separator()); - manager.add(clearAction); - manager.add(new Separator()); - manager.add(discardAction); - manager.add(undiscardAction); - manager.add(new Separator()); - manager.add(confAction("Copy", "Copy selected text", - ISharedImages.IMG_TOOL_COPY, new Action() { - @Override - public void run() { - text.copy(); - } - })); - manager.add(confAction("Select All", "Select all text", "", - new Action() { - @Override - public void run() { - text.selectAll(); - } - })); - } - - private void fillLocalPullDown(IMenuManager manager) { - manager.add(pauseAction); - manager.add(unpauseAction); - manager.add(new Separator()); - manager.add(clearAction); - manager.add(new Separator()); - manager.add(discardAction); - manager.add(undiscardAction); - } - - private void fillLocalToolBar(IToolBarManager manager) { - manager.add(pauseAction); - manager.add(unpauseAction); - manager.add(new Separator()); - manager.add(clearAction); - manager.add(new Separator()); - manager.add(discardAction); - manager.add(undiscardAction); - } - - private void hookContextMenu() { - MenuManager menuMgr = new MenuManager("#PopupMenu"); - menuMgr.setRemoveAllWhenShown(true); - menuMgr.addMenuListener(new IMenuListener() { - public void menuAboutToShow(IMenuManager manager) { - RiologView.this.fillContextMenu(manager); - } - }); - Menu menu = menuMgr.createContextMenu(text); - text.setMenu(menu); - } - - private void makeActions() { - clearAction = confAction("Clear Log", "Empty the textbox", - ISharedImages.IMG_ETOOL_CLEAR, new Action() { - public void run() { - text.setText(""); - } - }); - - pauseAction = confAction("Pause Display", - "Stop adding packets to the textbox", - ISharedImages.IMG_ELCL_STOP, new Action() { - public void run() { - pauseAction.setEnabled(false); - unpauseAction.setEnabled(true); - pauseButton.setSelection(true); - pauseButton.setText("Show 0 Packets"); - paused = true; - } - }); - pauseAction.setEnabled(true); - unpauseAction = confAction("Continue Display", - "Continue adding packets to the textbox", - ISharedImages.IMG_TOOL_FORWARD, new Action() { - public void run() { - paused = false; - transferer.interrupt(); - pauseAction.setEnabled(true); - unpauseAction.setEnabled(false); - pauseButton.setSelection(false); - pauseButton.setText(pauseAction.getText()); - } - }); - unpauseAction.setEnabled(false); - - discardAction = confAction("Discard Incoming", - "Drop all incoming packets", ISharedImages.IMG_ETOOL_DELETE, - new Action() { - public void run() { - discard = true; - discardAction.setEnabled(false); - undiscardAction.setEnabled(true); - discardButton.setSelection(true); - discardButton.setText(undiscardAction.getText()); - } - }); - discardAction.setEnabled(true); - undiscardAction = confAction("Accept Incoming", - "Accept all incoming packets", ISharedImages.IMG_OBJ_ADD, - new Action() { - public void run() { - discard = false; - discardAction.setEnabled(true); - undiscardAction.setEnabled(false); - discardButton.setSelection(false); - discardButton.setText(discardAction.getText()); - } - }); - undiscardAction.setEnabled(false); - } - - /** - * Passing the focus request to the viewer's control. - */ - public void setFocus() { - text.setFocus(); - } - - public static String drainToString(ArrayList arr) { - int netlength = 0; - for (byte[] b : arr) { - netlength += b.length; - } - - byte[] sum = new byte[netlength]; - int mark = 0; - for (int i=0;i queue = new LinkedBlockingQueue<>(); - listener = startDaemonThread(new Runnable() { - @Override - public void run() { - DatagramSocket socket = makeRecvSocket(); - if (socket == null) - return; - socket_hook = socket; - byte[] buf = new byte[4096]; - DatagramPacket datagram = new DatagramPacket(buf, buf.length); - while (!Thread.interrupted()) { - byte[] s = getPacket(socket, datagram); - if (s != null && !discard) { - try { - queue.put(s); - } catch (InterruptedException e) { - socket.close(); - return; - } - } - } - socket.close(); - } - }, "Riolog-Listener"); - transferer = startDaemonThread(new Runnable() { - @Override - public void run() { - final ArrayList temp = new ArrayList<>(); - while (!cleanup) { - try { - temp.add(queue.take()); - } catch (InterruptedException e) { - if (cleanup) { - return; - } - } - queue.drainTo(temp); - if (!paused) { - Display.getDefault().syncExec(new Runnable() { - @Override - public void run() { - if (text.isDisposed()) - return; - text.append(drainToString(temp)); - } - }); - } else { - Display.getDefault().syncExec(new Runnable() { - @Override - public void run() { - if (paused) { - if (temp.size() == 1) { - pauseButton.setText("Show 1 Packet\u2002"); - } else { - pauseButton.setText("Show " + String.valueOf(temp.size()) + " Packets"); - } - } - } - }); - } - } - } - }, "Riolog-Transfer"); - } - - void stopListening() { - cleanup = true; - if (socket_hook != null) { - socket_hook.close(); - } - listener.interrupt(); - transferer.interrupt(); - } -} \ No newline at end of file diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/index.html b/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/index.html deleted file mode 100644 index 3763331b5e..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/index.html +++ /dev/null @@ -1,60 +0,0 @@ - - -WPILib Update Site - - - - - - -
- - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/pom.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/pom.xml deleted file mode 100644 index 8c1f3a81f4..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - 4.0.0 - edu.wpi.first.wpilib.plugins.updatesite - eclipse-update-site - - - edu.wpi.first.wpilib.plugins - edu.wpi.first.wpilib.plugins - 0.1.0.qualifier - .. - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/site.xml b/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/site.xml deleted file mode 100644 index f6498c4bba..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/site.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - Core WPILib Robot Development Tools. - - - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/web/site.css b/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/web/site.css deleted file mode 100644 index 62c6f9ffa4..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/web/site.css +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/web/site.xsl b/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/web/site.xsl deleted file mode 100644 index c25380716c..0000000000 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.updatesite/web/site.xsl +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - - - WPILib Update Site - - - -

WPILib Update Site

-

- - - - - - - - - - - - - - - - dark-row - - - light-row - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dark-row - - - light-row - - - - - - - - - - - - - - - dark-row - - - light-row - - - - - - - - -
- - - -
- - - -
-
- ( - ) -
-
- - - - -
-
-
- - - - - - - - - - - - - - - - - - - - - -
Operating Systems:
Windows Systems:
Languages:
Architecture:
-


- Uncategorized -
- - - -
-
- ( - ) -
-
- - - - -
-

-
- - - - - - - - - - - - - - - - - - - - - -
Operating Systems:
Windows Systems:
Languages:
Architecture:
-
- - - -
-
- ( - ) -
-
- - - - -
-

-
- - - - - - - - - - - - - - - - - - - - - -
Operating Systems:
Windows Systems:
Languages:
Architecture:
-
- - -
-
-
diff --git a/eclipse-plugins/pom.xml b/eclipse-plugins/pom.xml deleted file mode 100644 index fe3ab7034e..0000000000 --- a/eclipse-plugins/pom.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - 4.0.0 - edu.wpi.first.wpilib.plugins - edu.wpi.first.wpilib.plugins - 0.1.0.qualifier - pom - - - edu.wpi.first.wpilib.plugins.core - edu.wpi.first.wpilib.plugins.core.feature - edu.wpi.first.wpilib.plugins.cpp - edu.wpi.first.wpilib.plugins.cpp.feature - edu.wpi.first.wpilib.plugins.java - edu.wpi.first.wpilib.plugins.java.feature - edu.wpi.first.wpilib.plugins.riolog - edu.wpi.first.wpilib.plugins.updatesite - - - - - 0.21.0 - - - - - juno - p2 - http://download.eclipse.org/releases/luna - - - FRC Binaries - http://first.wpi.edu/FRC/c/maven/ - - - - - - - org.eclipse.tycho - tycho-maven-plugin - ${tycho-version} - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - docline-java8-disable - - [1.8, - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - -Xdoclint:none - - - - - - - - diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index fd7e590e51..e8c6bf7bb4 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 91bbe18ecc..b396175bc4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 14 19:05:24 PDT 2015 +#Sat Nov 21 18:19:09 EST 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-bin.zip diff --git a/gradlew b/gradlew index 91a7e269e1..97fac783e1 100755 --- a/gradlew +++ b/gradlew @@ -42,11 +42,6 @@ case "`uname`" in ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - # Attempt to set APP_HOME # Resolve links: $0 may be a link PRG="$0" @@ -114,6 +109,7 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt deleted file mode 100644 index 5ad2e641a6..0000000000 --- a/hal/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(HAL) - -file(GLOB_RECURSE SRC_FILES lib/Athena/*.cpp) -include_directories(lib/Athena lib/Athena/FRC_FPGA_ChipObject include) -add_library(HALAthena STATIC ${SRC_FILES}) -target_link_libraries(HALAthena ${NI_LIBS}) -INSTALL(TARGETS HALAthena ARCHIVE DESTINATION lib COMPONENT lib) -INSTALL(FILES ${NI_LIBS} ${WPI_LD_LIBS} DESTINATION lib COMPONENT ni_lib) -INSTALL(DIRECTORY include DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT headers) - -add_library(HALAthena_shared SHARED ${SRC_FILES}) -target_link_libraries(HALAthena_shared ${NI_LIBS}) -INSTALL(TARGETS HALAthena_shared LIBRARY DESTINATION lib COMPONENT lib) -# lib/ c m gcc_s ld-linux -# usr/lib -# FRC_NetworkCommunication FRC_FPGA_ChipObject RoboRIO_FRC_ChipObject diff --git a/hal/README.org b/hal/README.org deleted file mode 100644 index 9eb132a406..0000000000 --- a/hal/README.org +++ /dev/null @@ -1,94 +0,0 @@ - -* Purpose -The HAL is a hardware abstraction layer that provides a uniform -interface that can be used to access a number of primarily I/O -features in the underlying platform. The features include: -- Analog input, accumulation and triggers -- PWM, Relay and Solenoid output -- Digital input and output -- I2C and SPI communication -- Encoders and counters -- Interrupts and Notifiers - -The initial goal is to allow a higher level like WPILib to support -both the CRIO and the upcoming Athena platform only by changing which -version of the HAL it's running on. - -* Editing -You can always use any text editor and then build with Maven. There -are also eclipse project files so that it can be edited in the same -eclipse environment that teams develop with. For the AthenaXX, this -can be found in the =root= directory of this project. It imports as an -FRC Robot C++ Eclipse project. The Windriver project can be imported -from the =src= directory. - -* Building with Maven -There are multiple build targets that the HAL supports. Instructions -for setting up the environment and building each of these is described -below. Current targets are listed below: -- All: All of the following targets. -- include: The header files for the HAL. -- Azalea: CRIO C++ build. -- AthenaXX: Athena Dos Equis C++ build. -- AthenaXXJava: Athena Dos Equis Java build with auto-generated JNA - wrappers. - -Output from each build target is placed in the directory -=target/=. So, the Azalea output is placed in -=target/Azalea=. - -** All -Note: Windows only due to the Windriver requirement. -1. Ensure that =C:\WindRiver\gnu\3.4.4-vxworks-6.3\x86-win32\bin= is - on the system path so that =ccppc= and =arppc= can be accessed. -2. Set the environment variable =WIND_BASE= to =C:\WindRiver\vxworks-6.3=. -3. Ensure that - =$HOME/wpilib/toolchains/arm-none-linux-gnueabi-4.4.1/bin/= is on - the system path so that =arm-none-linux-gnueabi-g++= and - =arm-none-linux-gnueabi-ar= can be accessed. -4. Checkout and install the NI-Libraries from Github: - [[https://github.com/first/NI-Libraries]]. -5. Run the following maven command: - =mvn clean install= -6. Success - -** include -1. =cd= into the include directory: =cd include= -2. Run the following maven command: - =mvn clean install= -3. Success - -** Azalea -Note: Windows only. -1. Ensure that =C:\WindRiver\gnu\3.4.4-vxworks-6.3\x86-win32\bin= is - on the system path so that =ccppc= and =arppc= can be accessed. -2. Set the environment variable =WIND_BASE= to =C:\WindRiver\vxworks-6.3=. -3. =cd= into the AthenaXX directory: =cd AthenaXX= -4. =cd= into the Azalea directory: =cd Azalea= -5. Run the following maven command: - =mvn clean install= -6. Success - -** AthenaXX -1. Ensure that - =$HOME/wpilib/toolchains/arm-none-linux-gnueabi-4.4.1/bin/= is on - the system path so that =arm-none-linux-gnueabi-g++= and - =arm-none-linux-gnueabi-ar= can be accessed. -2. Install the include target. -3. =cd= into the AthenaXX directory: =cd AthenaXX= -4. Run the following maven command: - =mvn clean install= -5. Success - -** AthenaXXJava -1. Ensure that - =$HOME/wpilib/toolchains/arm-none-linux-gnueabi-4.4.1/bin/= is on - the system path so that =arm-none-linux-gnueabi-g++= and - =arm-none-linux-gnueabi-ar= can be accessed. -2. Checkout and install the NI-Libraries from Github: - [[https://github.com/first/NI-Libraries]]. -3. Install the include target. -4. =cd= into the AthenaXXJava directory: =cd AthenaXXJava= -5. Run the following maven command: - =mvn clean install= -6. Success diff --git a/jenkins/README b/jenkins/README deleted file mode 100644 index 099793941e..0000000000 --- a/jenkins/README +++ /dev/null @@ -1 +0,0 @@ -This directory contains special jenkins build options. \ No newline at end of file diff --git a/jenkins/build.gradle b/jenkins/build.gradle deleted file mode 100644 index 419c05922a..0000000000 --- a/jenkins/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -evaluationDependsOn(':wpilibj') -evaluationDependsOn(':wpilibc') - -task publishJavadoc(type: Copy) { - description = 'Publishes the generated javadoc to the docs/site/java folder' - group = 'WPILib' - def javadoc = project(':wpilibj').javadoc - dependsOn javadoc - from javadoc.destinationDir - destinationDir file('docs/site/java') -} - -task publishDoxygen(type: Copy) { - description = 'Publishes the generated doxygen to the docs/site/cpp folder' - group = 'WPILib' - def doxygen = project(':wpilibc').doxygen - dependsOn doxygen - from doxygen.outputDir - destinationDir file('docs/site/cpp') -} - -task publishDocs() { - description = 'Publishes the generated javadoc and doxygen to the docs/site/ folder' - group = 'WPILib' - dependsOn publishJavadoc - dependsOn publishDoxygen -} - -task clean(type: Delete) { - delete 'docs/site' -} diff --git a/jenkins/docs/.gitignore b/jenkins/docs/.gitignore deleted file mode 100644 index da3d33790f..0000000000 --- a/jenkins/docs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -build/ -site/ \ No newline at end of file diff --git a/jenkins/docs/Makefile b/jenkins/docs/Makefile deleted file mode 100644 index 64600a90ed..0000000000 --- a/jenkins/docs/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -allwpilib=../.. -version=DEVELOPMENT - -all: java cpp site - -java: - mkdir -p build/java/ - mkdir -p site/java/ - cp -r $(allwpilib)/wpilibj/wpilibJava/src/main/java/* build/java/ - cp -r $(allwpilib)/wpilibj/wpilibJavaDevices/src/main/java/* build/java/ - # cp -r $(allwpilib)/networktables/java/src/main/java/* build/java/ - ( cat java.doxy ; echo "PROJECT_NUMBER=${version}" ) | doxygen - - -cpp: - mkdir -p build/cpp/ - mkdir -p site/cpp/ - cp -r $(allwpilib)/wpilibc/wpilibC++/src build/cpp/ - cp -r $(allwpilib)/wpilibc/wpilibC++/include build/cpp/ - cp -r $(allwpilib)/wpilibc/wpilibC++Devices/src build/cpp/ - cp -r $(allwpilib)/wpilibc/wpilibC++Devices/include build/cpp/ - # cp -r $(allwpilib)/networktables/cpp/lib build/cpp/ - # cp -r $(allwpilib)/networktables/cpp/include build/cpp/ - ( cat cpp.doxy ; echo "PROJECT_NUMBER=${version}" ) | doxygen - - -# TODO: HAL - -site: - mkdir -p build/site/ - -clean: - rm -rf build/ - rm -rf site/ diff --git a/jenkins/docs/cpp.doxy b/jenkins/docs/cpp.doxy deleted file mode 100644 index 604e293342..0000000000 --- a/jenkins/docs/cpp.doxy +++ /dev/null @@ -1,2305 +0,0 @@ -# Doxyfile 1.8.6 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = "WPILibC++" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = 2015-Alpha-0.1 - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify an logo or icon that is included in -# the documentation. The maximum height of the logo should not exceed 55 pixels -# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo -# to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = site/cpp - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = YES - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a -# new page for each member. If set to NO, the documentation of a member will be -# part of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. -# -# Note For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by by putting a % sign in front of the word -# or globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO these classes will be included in the various overviews. This option has -# no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the -# todo list. This list is created by putting \todo commands in the -# documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the -# test list. This list is created by putting \test commands in the -# documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES the list -# will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. Do not use file names with spaces, bibtex cannot handle them. See -# also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO doxygen will only warn about wrong or incomplete parameter -# documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. -# Note: If this tag is empty the current directory is searched. - -INPUT = build/cpp - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank the -# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, -# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, -# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, -# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, -# *.qsf, *.as and *.js. - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = nivision.h \ - pcre.h \ - */NetworkCommunication/* - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER ) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES, then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = . - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- -# defined cascading style sheet that is included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefor more robust against future updates. -# Doxygen will copy the style sheet file to the output directory. For an example -# see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the stylesheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler ( hhc.exe). If non-empty -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated ( -# YES) or a normal table of contents ( NO) in the .chm file. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = YES - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = YES - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using prerendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /