Permalink
Browse files

First post! This year's robot name hasn't been finalized yet, so we'r…

…e tentatively giving it the codename "refbatch".
  • Loading branch information...
0 parents commit a89035a39a98c0e8eb756690991b34ea54aa7648 @kevinwang kevinwang committed Jan 9, 2012
@@ -0,0 +1,24 @@
+* Copyright (c) 2009 FIRST
+* 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.
@@ -0,0 +1,10 @@
+# Properties file for a Sun Spot Application
+#
+# build.properties
+#
+# This file is the default location for user properties that over-ride the
+# defaults in ${sunspot.home}/default.properties. See that file for a full
+# listing of the properties that may be set. This file is minimal and contains
+# only those properties that a user would generally need to set right away.
+#
+user.classpath=${wpilibj.home}/src
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project basedir="." default="help" name="refbatch">
+
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+
+ <!--
+
+ The master build file lives at: ${sunspot.home}/build.xml.
+
+ If you do not have a Sun SPOT properties file for some reason,
+ then you can set the sunspot.home property manually.
+
+ <property name="sunspot.home" value="/opt/sunspot"/>
+
+ The behavior of the build is also controled through properties.
+ For example, to use a different source directory, you can set
+ the property 'src.dir'.
+
+ <property name="src.dir" value="mysrc"/>
+
+ For a complete listing of properties that are used, and their
+ explanations, see the file ${sunspot.home}/default.properties.
+
+ -->
+
+ <property name="user.properties.file" value="build.properties"/>
+ <property file="${user.home}/.sunspotfrc.properties"/>
+ <import file="${sunspot.home}/build.xml"/>
+
+ <!--
+
+ This file imports the master build file for compiling and deploying sunspot
+ applications. This file provides hooks for the user build file, so that
+ you can accomplish almost anything without having to rewrite any of the
+ build procedures. However, if need be, you can just look at the imported
+ build file to determine how exactly any step is accomplished.
+
+ Of course, another useful way to find out exactly what is happening is to
+ run the targets listed below with ant's 'verbose' flag (ant -v). This will
+ display exactly what is happening at each step.
+
+ Some important targets that are defined within the master build file are:
+ (Do "ant help" to see the full list.)
+
+ init: initialize and check all properties
+ help: display useful a help message
+ environment displays information about setting up your environment
+ sdk-info displays information about the current SDK installation
+ find-spots locate USB ports where SPOTs are connected
+ info displays information about the configuration of a SPOT
+ slots displays a list of the applications deployed on the SPOT
+
+ clean: delete all compiled/generated files
+ compile: compiles java source files to classes
+ jar-app Create a jar for this application
+ deploy deploy the application to a SPOT as an IMlet
+ jar-deploy deploy an IMlet jar
+ run connect to a device and watch the application
+ debug-run configure the SPOT ro run the debug agent and then start the debug proxy
+ debug-proxy-run start the proxy for the high-level debugger
+
+ Some useful command line properties:
+
+ -Dbasestation.addr=1234 set the address of the basestation
+ -DremoteId=1234 set the target for remote run/deploy/debug-proxy-run
+ -Dsquawk.startup.class=com.example.MyStartUp
+ set an alternative startup class name
+ -Dspotport=COM2 set the port name for communicating with the SPOT
+ -Djar.file=example.jar set the jar file for jar-app, jar-deploy and make-host-jar
+ -Dmidlet=2 select a midlet to run for selectapplication
+ or deploy targets (defaults to 1)
+ -Dutility.jars=utils.jar a classpath separator delimited list of jars to be
+ included with the application
+
+ There exist several targets which are by default empty and which can be
+ used for execution of your tasks. These targets are usually executed
+ before and after some main targets. They are defined as follows:
+
+ For each target above (except help),
+
+ -pre-<target>: called before the target
+ -post-<target>: called after the target
+
+ For example, inserting an echo statement after compilation could look like this:
+
+ <target name="-post-compile">
+ <echo>Compile finished!</echo>
+ </target>
+
+ For more information on using ant, see http://ant.apache.org.
+
+ -->
+</project>
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
+
+ This is a sample netbeans project file for a Sun Spot Application project.
+ You may edit it freely, it doesn't affect the ant-powered build.
+
+ --><project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.ant.freeform</type>
+ <configuration>
+ <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+ <name>refbatch</name>
+ <properties>
+ <property-file>${user.home}/.sunspotfrc.properties</property-file>
+ <property-file>build.properties</property-file>
+ <property-file>${sunspot.home}/default.properties</property-file>
+ </properties>
+ <folders>
+ <source-folder>
+ <label>src</label>
+ <type>java</type>
+ <location>src</location>
+ </source-folder>
+ </folders>
+ <ide-actions>
+ <action name="build">
+ <target>jar-app</target>
+ </action>
+ <action name="clean">
+ <target>clean</target>
+ </action>
+ <action name="run">
+ <target>deploy</target>
+ <target>run</target>
+ </action>
+ <action name="rebuild">
+ <target>clean</target>
+ <target>jar-app</target>
+ </action>
+ <action name="debug">
+ <target>deploy</target>
+ <target>debug-run</target>
+ </action>
+ <action name="javadoc">
+ <target>javadoc</target>
+ </action>
+ </ide-actions>
+ <export>
+ <type>folder</type>
+ <location>build</location>
+ <build-target>jar-app</build-target>
+ </export>
+ <view>
+ <items>
+ <source-folder style="packages">
+ <label>src</label>
+ <location>src</location>
+ </source-folder>
+ <source-file>
+ <location>build.xml</location>
+ </source-file>
+ </items>
+ <context-menu>
+ <ide-action name="build"/>
+ <ide-action name="clean"/>
+ <ide-action name="run"/>
+ <ide-action name="rebuild"/>
+ <ide-action name="debug"/>
+ <ide-action name="javadoc"/>
+ <action>
+ <label>Sun SPOT-deploy</label>
+ <target>deploy</target>
+ </action>
+ <action>
+ <label>Sun SPOT-jar-deploy</label>
+ <target>jar-deploy</target>
+ </action>
+ <separator/>
+ </context-menu>
+ </view>
+ <subprojects/>
+ </general-data>
+ <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
+ <compilation-unit>
+ <package-root>src</package-root>
+ <classpath mode="boot">${sunspot.bootclasspath}</classpath>
+ <classpath mode="compile">${wpilibj.home}/classes.jar</classpath>
+ <built-to>build</built-to>
+ <source-level>1.4</source-level>
+ </compilation-unit>
+ </java-data>
+ </configuration>
+</project>
@@ -0,0 +1,6 @@
+MIDlet-Name: refbatch
+MIDlet-Version: 1.0.0
+MIDlet-Vendor: FIRST
+MIDlet-1: Refbatch, , edu.stuy.Refbatch
+MicroEdition-Profile: IMP-1.0
+MicroEdition-Configuration: CLDC-1.1
@@ -0,0 +1,7 @@
+
+package edu.stuy;
+
+public class OI {
+ // Process operator interface input here.
+}
+
@@ -0,0 +1,67 @@
+/*----------------------------------------------------------------------------*/
+/* 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 edu.stuy;
+
+
+import edu.wpi.first.wpilibj.IterativeRobot;
+import edu.wpi.first.wpilibj.command.Command;
+import edu.wpi.first.wpilibj.command.Scheduler;
+import edu.stuy.commands.CommandBase;
+import edu.stuy.commands.ExampleCommand;
+import edu.stuy.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 Refbatch extends IterativeRobot {
+
+ Command autonomousCommand;
+
+ /**
+ * This function is run when the robot is first started up and should be
+ * used for any initialization code.
+ */
+ public void robotInit() {
+ // instantiate the command used for the autonomous period
+ autonomousCommand = new ExampleCommand();
+
+ // Initialize all subsystems
+ CommandBase.init();
+ }
+
+ public void autonomousInit() {
+ // schedule the autonomous command (example)
+ 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.
+ autonomousCommand.cancel();
+ }
+
+ /**
+ * This function is called periodically during operator control
+ */
+ public void teleopPeriodic() {
+ Scheduler.getInstance().run();
+ }
+}
@@ -0,0 +1,19 @@
+package edu.stuy;
+
+/**
+ * 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 final int leftMotor = 1;
+ // public static final 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 final int rangefinderPort = 1;
+ // public static final int rangefinderModule = 1;
+}
@@ -0,0 +1,39 @@
+package edu.stuy.commands;
+
+import edu.wpi.first.wpilibj.command.Command;
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
+import edu.stuy.OI;
+import edu.stuy.subsystems.ExampleSubsystem;
+
+/**
+ * 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
+ * @author Author
+ */
+public abstract class CommandBase extends Command {
+
+ public static OI oi;
+ // Create a single static instance of all of your subsystems
+ public static ExampleSubsystem exampleSubsystem = new ExampleSubsystem();
+
+ public static void init() {
+ // 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();
+
+ // Show what command your subsystem is running on the SmartDashboard
+ SmartDashboard.putData(exampleSubsystem);
+ }
+
+ public CommandBase(String name) {
+ super(name);
+ }
+
+ public CommandBase() {
+ super();
+ }
+}
Oops, something went wrong.

0 comments on commit a89035a

Please sign in to comment.