-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrew Duffy
authored and
Andrew Duffy
committed
Aug 21, 2012
0 parents
commit b21c8c6
Showing
83 changed files
with
4,188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
GRT Framework v6 | ||
================ | ||
|
||
GRTFramework is an asynchronous, event-driven framework built on top of [WPILibJ](http://firstforge.wpi.edu/sf/projects/wpilib), which is provided by FIRST and includes a host of useful low-level hardware classes. | ||
|
||
The purpose of GRTFramework is: | ||
* To provide a framework for rapid FRC robot development | ||
* An asynchronous design and a focus on quality code design | ||
* Coder happiness :) | ||
|
||
Please feel free to email any of the developers if you have questions about the code. | ||
|
||
-FRC Team 192: Gunn Robotics Team (A.K.A "GRT") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><project basedir="." default="help" name="Insert Name Here"> | ||
|
||
<!-- 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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>grtframeworkv6</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">/home/gerberduffy/sunspotfrcsdk/lib/WPILibJ/classes.jar</classpath> | ||
<built-to>build</built-to> | ||
<source-level>1.4</source-level> | ||
</compilation-unit> | ||
</java-data> | ||
</configuration> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
MIDlet-Name: Base2012-redesign | ||
MIDlet-Version: 1.0.0 | ||
MIDlet-Vendor: FIRST | ||
MIDlet-1: MainRobot, , deploy.MainRobot | ||
MicroEdition-Profile: IMP-1.0 | ||
MicroEdition-Configuration: CLDC-1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* To change this template, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package actuator; | ||
|
||
import core.Actuator; | ||
import edu.wpi.first.wpilibj.PWM; | ||
|
||
/** | ||
* Abstraction of a standard LED | ||
* @author gerberduffy | ||
*/ | ||
public class GRTLed extends Actuator { | ||
|
||
private static final int DEFAULT_BRIGHTNESS = 255; | ||
private static final int HIGHEST_BRIGHTNESS = 255; | ||
private static final int OFF_BRIGHTNESS = 0; | ||
|
||
|
||
private final PWM led; //The PWM input controlling the LED | ||
private int brightness; | ||
|
||
public GRTLed(int channel, String id){ | ||
this(channel, DEFAULT_BRIGHTNESS, id); | ||
} | ||
|
||
public GRTLed(int channel, int brightness, String id){ | ||
super(id); | ||
|
||
this.brightness = brightness; | ||
|
||
led = new PWM(channel); | ||
led.setRaw(brightness); | ||
} | ||
|
||
public void setToBrightness(int bright){ | ||
if (bright > HIGHEST_BRIGHTNESS){ | ||
bright = HIGHEST_BRIGHTNESS; | ||
} else if (bright < OFF_BRIGHTNESS){ | ||
bright = OFF_BRIGHTNESS; | ||
} | ||
|
||
led.setRaw(bright); | ||
|
||
this.brightness = bright; | ||
} | ||
|
||
public void toggleState(){ | ||
if (isOn()){ | ||
led.setRaw(OFF_BRIGHTNESS); | ||
brightness = OFF_BRIGHTNESS; | ||
|
||
} else { | ||
led.setRaw(HIGHEST_BRIGHTNESS); | ||
brightness = HIGHEST_BRIGHTNESS; | ||
} | ||
} | ||
|
||
public int getBrightness(){ | ||
return this.brightness; | ||
} | ||
|
||
public boolean isOn(){ | ||
return this.brightness > OFF_BRIGHTNESS; | ||
} | ||
|
||
public void executeCommand(double command) { | ||
led.setRaw((int) command); | ||
brightness = (int) command; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* To change this template, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package actuator; | ||
|
||
import edu.wpi.first.wpilibj.Relay; | ||
import core.Actuator; | ||
|
||
/** | ||
* | ||
* @author calvin | ||
*/ | ||
public class GRTRelay extends Actuator{ | ||
private Relay relay; | ||
|
||
private static final double FORWARD = 1.0; | ||
private static final double REVERSE = -1.0; | ||
private static final double OFF = 0.0; | ||
|
||
public GRTRelay(int channel, String name){ | ||
super(name); | ||
relay = new Relay(channel); | ||
} | ||
|
||
/** | ||
* Sends command to relay. If the value of the command is -1.0 the relay is in reverse, | ||
* 1.0 is forward, and 0.0 is off. | ||
* @param c | ||
*/ | ||
public void executeCommand(double command) { | ||
if (command == OFF) { | ||
relay.set(Relay.Value.kOff); | ||
} else if(command == FORWARD) { | ||
relay.set(Relay.Value.kForward); | ||
} else if(command == REVERSE) { | ||
relay.set(Relay.Value.kReverse); | ||
} | ||
} | ||
/** | ||
* SEts the state of the relay to off | ||
*/ | ||
public void halt() { | ||
relay.set(Relay.Value.kOff); | ||
} | ||
/** | ||
* Returns String | ||
* @return | ||
*/ | ||
public String toString() { | ||
return "Relay"; | ||
} | ||
} |
Oops, something went wrong.