Skip to content
Open

Demo #39

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
4f604b1
initial commit
lydiaxing Feb 18, 2017
d93f584
working??? I want to sleep
camilo86 Feb 18, 2017
03db5b6
merged with week 0
lydiaxing Feb 18, 2017
880a5ae
only bug need to press b to start driving
camilo86 Feb 18, 2017
2f0183b
pressed ctrl-alt-l
camilo86 Feb 18, 2017
aa27b90
dt auto
Feb 18, 2017
f5bf989
auto
camilo86 Feb 18, 2017
7a17711
updated framework
camilo86 Feb 18, 2017
3a783a8
merged week0 into
Feb 18, 2017
9265b9c
switched to 1 second auto
NUTRONSDS Feb 19, 2017
c95192f
updated to add drive distance auto
NUTRONSDS Feb 19, 2017
a521b69
Added drive hold heading command and changed holdHeading to
Brinbri Feb 19, 2017
e0117d8
Updated to latest commit of week0-auto Framework and added drivetele …
NUTRONSDS Feb 19, 2017
3680227
updated some stuff
NUTRONSDS Feb 19, 2017
1a9574f
doing stuff on Escape Velocity
NUTRONSDS Feb 19, 2017
e251556
updated framework
NUTRONSDS Feb 19, 2017
4db3495
updated to have better interfaces
NUTRONSDS Feb 19, 2017
502898b
reverted RobotMap
NUTRONSDS Feb 19, 2017
4091e14
added turn to angle
Feb 20, 2017
c14460e
Added Gearplace subsystem, works with FRamework
Feb 20, 2017
84f3063
Merged with master
Feb 20, 2017
cc05ddf
turret working, pid nees to be tuned
lydiaxing Feb 20, 2017
ef8964f
working turret
lydiaxing Feb 20, 2017
ace0949
updated framework
Feb 20, 2017
c34b149
with new framework version
NUTRONSDS Feb 20, 2017
25d175f
reverted robotmap
NUTRONSDS Feb 20, 2017
f7b521c
fixed climbtake bug
lydiaxing Feb 20, 2017
2d60401
working distance
NUTRONSDS Feb 20, 2017
e2f2b41
fixed turn
NUTRONSDS Feb 20, 2017
798fe06
Updated tunable in Framework
Brinbri Feb 20, 2017
d5e1742
Tried tuneables in shooter
Brinbri Feb 20, 2017
8c23e66
some testing
NUTRONSDS Feb 21, 2017
2d4682d
joystick stuff added but untested
lydiaxing Feb 21, 2017
0665efc
starting on step #3 of email
lydiaxing Feb 21, 2017
786f93c
added 254 app, still getting red bar munching error
lydiaxing Feb 21, 2017
95aa811
update variable stays null
lydiaxing Feb 21, 2017
879ddcf
working
NUTRONSDS Feb 21, 2017
2648765
updated to newest week0-auto
Feb 21, 2017
7b6302b
merged master into week0-auto
Feb 21, 2017
1270283
updated framework submodule, fixed checkstyle warnings
Feb 21, 2017
b359013
test reimplementation
Feb 21, 2017
0366787
ready to test turret with new vision
lydiaxing Feb 21, 2017
1f24a0b
fixed angle calculation
lydiaxing Feb 21, 2017
90062f2
merged master
lydiaxing Feb 21, 2017
f2ceb07
merged with master
lydiaxing Feb 21, 2017
b2730cc
made edits on style and consistency with master
lydiaxing Feb 21, 2017
7849ddf
updated FRamework
lydiaxing Feb 21, 2017
fb655b8
Merged!
Feb 21, 2017
378717c
Fixed merge conflicts
Feb 21, 2017
ecf07d8
added distance function, but need to edit constants
lydiaxing Feb 21, 2017
0f8e8bb
updated FRamework
lydiaxing Feb 21, 2017
2c8019b
figured out what constants are and renamed accordingly
lydiaxing Feb 21, 2017
b71f902
Created testing evniornment for tuneables
Brinbri Feb 21, 2017
0529ab8
working encoder and gyro pid
NUTRONSDS Feb 21, 2017
a8b757b
merged master into drive-holdheading-encoder-pid
Feb 21, 2017
0d519d8
removed duplicate method, added javadoc, added auto
Feb 21, 2017
1a2b576
(Brian)added implimentation of tuneables
Feb 22, 2017
87b0bc3
Fixed merge conflicts
Brinbri Feb 22, 2017
8c92b0a
pid turret working
lydiaxing Feb 22, 2017
0561178
updated frameworK'
Feb 22, 2017
a479f5a
Merge branch 'master' into Gear-Placer
Feb 22, 2017
79c78b7
Added Tuneables to subsystems
Brinbri Feb 22, 2017
5305da8
Renamed stuffs
Feb 22, 2017
cc2f7c6
Turns checkstyle back on
Feb 22, 2017
e547039
style and javadocs
Feb 22, 2017
cd51c5c
Merge branch 'master' into drive-holdheading-encoder-pid
Feb 22, 2017
990ac7c
FIXED CHECKSTYLE!
lydiaxing Feb 22, 2017
3baf0e7
Merge branch 'workingAndroidVision' of https://github.com/frc125/NU17…
lydiaxing Feb 22, 2017
7377590
changed to constant naming convention
Feb 22, 2017
08d279b
Merge branch 'master' into Gear-Placer
Feb 22, 2017
fa180d5
Changed port!
Feb 22, 2017
d4aa8a7
change controls
NUTRONSDS Feb 22, 2017
e9ef5c3
fixed merge conflicts
lydiaxing Feb 22, 2017
8be8ccf
merged master
lydiaxing Feb 22, 2017
117ec1a
merged
NUTRONSDS Feb 22, 2017
87fead1
merged with climbtake-cmd
Feb 24, 2017
0ad91e6
moved vision stuff into NU17-FRamework
Feb 24, 2017
2a8ca7f
updated FRamework
Feb 24, 2017
27f4091
merged android vision stuff
Feb 24, 2017
f6f24f0
Merge branch 'master' into tuneables
Feb 24, 2017
44d696e
tuneable merge
Feb 24, 2017
633fc6b
merged Gearplacer and Servo things
Feb 24, 2017
92a120d
auto now uses chooser
Feb 24, 2017
20b6237
made angle update faster and added distance calculation
lydiaxing Feb 24, 2017
9a40f38
fixed checkstyle
lydiaxing Feb 25, 2017
5da39cd
checkstyle
lydiaxing Feb 25, 2017
b0ac081
Checkstyle
Feb 25, 2017
7be8b70
coment out for testing
lydiaxing Feb 25, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ install:
- sed -i 's/compiler="javac1.8"//g' wpilib/ant/build.xml
- sed -i 's/compiler="javac1.8"//g' *.xml
- sed -i 's/compiler="javac1.8"//g' FRamework/*.xml
- ant checkstyle
- ant compile
- ant checkstyle
2 changes: 1 addition & 1 deletion FRamework
Submodule FRamework updated 26 files
+9 −0 .idea/FRamework.iml
+1 −0 ivy.xml
+8 −5 src/com/nutrons/framework/StreamManager.java
+24 −11 src/com/nutrons/framework/commands/Command.java
+1 −0 src/com/nutrons/framework/commands/CommandWorkUnit.java
+1 −0 src/com/nutrons/framework/commands/ParallelCommand.java
+1 −0 src/com/nutrons/framework/commands/SerialCommand.java
+1 −0 src/com/nutrons/framework/controllers/ControllerEvent.java
+2 −0 src/com/nutrons/framework/controllers/Events.java
+1 −0 src/com/nutrons/framework/controllers/FollowEvent.java
+44 −0 src/com/nutrons/framework/controllers/RevServo.java
+10 −0 src/com/nutrons/framework/controllers/ServoCommand.java
+17 −0 src/com/nutrons/framework/controllers/ServoController.java
+13 −0 src/com/nutrons/framework/controllers/ServoInstr.java
+31 −0 src/com/nutrons/framework/controllers/SetAngleCommand.java
+33 −0 src/com/nutrons/framework/controllers/SetCommand.java
+3 −3 src/com/nutrons/framework/controllers/Talon.java
+19 −0 src/com/nutrons/framework/controllers/Tuneable.java
+27 −0 src/com/nutrons/framework/controllers/TuneablePID.java
+43 −0 src/com/nutrons/framework/inputs/RadioBox.java
+4 −5 src/com/nutrons/framework/inputs/Serial.java
+3 −5 src/com/nutrons/framework/subsystems/Settings.java
+4 −1 src/com/nutrons/framework/subsystems/WpiSmartDashboard.java
+25 −14 src/com/nutrons/framework/util/FlowOperators.java
+4 −3 test/com/nutrons/framework/test/MultiCommandTest.java
+8 −10 test/com/nutrons/framework/test/TestCommand.java
107 changes: 0 additions & 107 deletions arduino/vision_runner/vision_runner.ino

This file was deleted.

12 changes: 6 additions & 6 deletions docs/google_checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,32 +108,32 @@
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<property name="format" value="^[a-zPos][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterName">
<property name="id" value="ParameterNameNonPublic"/>
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<property name="format" value="^[a-zPos]([a-z0-9][a-zA-Z0-9]*)?$"/>
<property name="excludeScope" value="public"/>
<message key="name.invalidPattern"
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterName">
<property name="id" value="ParameterNamePublic"/>
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<property name="format" value="^[a-zPos][a-z0-9][a-zA-Z0-9]*$"/>
<property name="scope" value="public"/>
<message key="name.invalidPattern"
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="CatchParameterName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<property name="format" value="^[a-zPos][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LocalVariableName">
<property name="tokens" value="VARIABLE_DEF"/>
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<property name="format" value="^[a-zPos][a-z0-9][a-zA-Z0-9]*$"/>
<property name="allowOneCharVarInForLoop" value="true"/>
<message key="name.invalidPattern"
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
Expand Down Expand Up @@ -221,7 +221,7 @@
<property name="allowThrowsTagsForSubclasses" value="true"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
<property name="format" value="^[a-zPos][a-z0-9][a-zA-Z0-9_]*$"/>
<message key="name.invalidPattern"
value="Method name ''{0}'' must match pattern ''{1}''."/>
</module>
Expand Down
2 changes: 1 addition & 1 deletion install-ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
ivy is in at least one of ant's lib dir or the local dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
Expand Down
1 change: 1 addition & 0 deletions ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
<dependency org="junit" name="junit" rev="4.12"/>
<dependency org="org.apache.ant" name="ant-junit" rev="1.9.7"/>
<dependency org="com.puppycrawl.tools" name="checkstyle" rev="7.4"/>
<dependency org="com.googlecode.json-simple" name="json-simple" rev="1.1.1"/>
</dependencies>
</ivy-module>
129 changes: 129 additions & 0 deletions src/com/nutrons/libKudos254/Rotation2d.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
package com.nutrons.libKudos254;

import java.text.DecimalFormat;

/**
* A rotation in a 2d coordinate frame represented a point on the unit circle
* (cosine and sine).
* Inspired by Sophus (https://github.com/strasdat/Sophus/tree/master/sophus)
*/
public class Rotation2d {
protected static final double kEpsilon = 1E-9;

protected double cosAngle;
protected double sinAngle;

public Rotation2d() {
this(1, 0, false);
}

/**
* Makes a Rotation2d.
* @param xparam posX
* @param yparam posY
* @param normalize normalize
*/
public Rotation2d(double xparam, double yparam, boolean normalize) {
cosAngle = xparam;
sinAngle = yparam;
if (normalize) {
normalize();
}
}

public Rotation2d(Rotation2d other) {
cosAngle = other.cosAngle;
sinAngle = other.sinAngle;
}

public static Rotation2d fromRadians(double angleRadians) {
return new Rotation2d(Math.cos(angleRadians), Math.sin(angleRadians), false);
}

public static Rotation2d fromDegrees(double angleDegrees) {
return fromRadians(Math.toRadians(angleDegrees));
}

/**
* From trig, we know that sin^2 + cos^2 == 1, but as we do math on this
* object we might accumulate rounding errors. Normalizing forces us to
* re-scale the sin and cos to reset rounding errors.
*/
public void normalize() {
double magnitude = Math.hypot(cosAngle, sinAngle);
if (magnitude > kEpsilon) {
sinAngle /= magnitude;
cosAngle /= magnitude;
} else {
sinAngle = 0;
cosAngle = 1;
}
}

/**
* Returns the cos angle of the object.
* @return the cos angle.
*/
public double cos() {
return cosAngle;
}

/**
* Returns the sin angle of the object.
* @return the sin angle.
*/
public double sin() {
return sinAngle;
}

/**
* Returns the tan angle of the object.
* @return the tan angle.
*/
public double tan() {
if (cosAngle < kEpsilon) {
if (sinAngle >= 0.0) {
return Double.POSITIVE_INFINITY;
} else {
return Double.NEGATIVE_INFINITY;
}
}
return sinAngle / cosAngle;
}

public double getRadians() {
return Math.atan2(sinAngle, cosAngle);
}

public double getDegrees() {
return Math.toDegrees(getRadians());
}

/**
* We can rotate this Rotation2d by adding together the effects of it and
* another rotation.
*
* @param other The other rotation. See:
* https://en.wikipedia.org/wiki/Rotation_matrix
* @return This rotation rotated by other.
*/
public Rotation2d rotateBy(Rotation2d other) {
return new Rotation2d(cosAngle * other.cosAngle - sinAngle * other.sinAngle,
cosAngle * other.sinAngle + sinAngle * other.cosAngle, true);
}

/**
* The inverse of a Rotation2d "undoes" the effect of this rotation.
*
* @return The opposite of this rotation.
*/
public Rotation2d inverse() {
return new Rotation2d(cosAngle, -sinAngle, false);
}

@Override
public String toString() {
final DecimalFormat fmt = new DecimalFormat("#0.000");
return "(" + fmt.format(getDegrees()) + " deg)";
}
}
88 changes: 88 additions & 0 deletions src/com/nutrons/libKudos254/vision/AdbBridge.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package com.nutrons.libKudos254.vision;

import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
* AdbBridge interfaces to an Android Debug Bridge (adb) binary, which is needed
* to communicate to Android devices over USB.
* adb binary provided by https://github.com/Spectrum3847/RIOdroid
*/
public class AdbBridge {
Path binLocation;
public static final Path DEFAULT_LOCATION = Paths.get("/usr/bin/adb");

/**
* Makes an ADBBridge.
*/
public AdbBridge() {
Path adbLocation;
String envVal = System.getenv("FRC_ADB_LOCATION");
if (envVal == null || "".equals(envVal)) {
adbLocation = DEFAULT_LOCATION;
} else {
adbLocation = Paths.get(envVal);
}
binLocation = adbLocation;
}

public AdbBridge(Path location) {
binLocation = location;
}

private boolean runCommand(String args) {
Runtime runtime = Runtime.getRuntime();
String cmd = binLocation.toString() + " " + args;

try {
Process process = runtime.exec(cmd);
process.waitFor();
} catch (IOException exception) {
System.err.println("AdbBridge: Could not run command " + cmd);
exception.printStackTrace();
return false;
} catch (InterruptedException exception) {
System.err.println("AdbBridge: Could not run command " + cmd);
exception.printStackTrace();
return false;
}
return true;
}

public void start() {
System.out.println("Starting adb");
runCommand("start");
}

public void stop() {
System.out.println("Stopping adb");
runCommand("kill-server");
}

/**
* Restarts the adbBridge.
*/
public void restartAdb() {
System.out.println("Restarting adb");
stop();
start();
}

public void portForward(int localPort, int remotePort) {
runCommand("forward tcp:" + localPort + " tcp:" + remotePort);
}

public void reversePortForward(int remotePort, int localPort) {
runCommand("reverse tcp:" + remotePort + " tcp:" + localPort);
}

/**
* Restarts the adb app.
*/
public void restartApp() {
System.out.println("Restarting app");
runCommand("shell am force-stop com.team254.cheezdroid \\; "
+ "am start com.team254.cheezdroid/com.team254.cheezdroid.VisionTrackerActivity");
}
}
Loading