Skip to content

Commit

Permalink
Changes to code
Browse files Browse the repository at this point in the history
  • Loading branch information
Endoman123 committed Feb 20, 2017
1 parent 1b7450a commit ece7538
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
12 changes: 6 additions & 6 deletions config/vision_gripless.grip
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<edu.wpi.grip.core.Pipeline>
<sources>
<edu.wpi.grip.core.sources.CameraSource>
<property name="address" value="http://10.10.89.20:1188/stream.mjpg"/>
<property name="address" value="http://10.10.89.20:1187/stream.mjpg"/>
</edu.wpi.grip.core.sources.CameraSource>
</sources>
<steps>
<edu.wpi.grip.core.Step name="HSL Threshold">
<edu.wpi.grip.core.sockets.InputSocketImpl step="0" socket="0"/>
<edu.wpi.grip.core.sockets.InputSocketImpl step="0" socket="1">
<value>
<double>69.60429759580393</double>
<double>94.94890927847149</double>
<double>45.32372205623558</double>
<double>70.90230375426623</double>
</value>
</edu.wpi.grip.core.sockets.InputSocketImpl>
<edu.wpi.grip.core.sockets.InputSocketImpl step="0" socket="2">
Expand All @@ -21,8 +21,8 @@
</edu.wpi.grip.core.sockets.InputSocketImpl>
<edu.wpi.grip.core.sockets.InputSocketImpl step="0" socket="3">
<value>
<double>32.692307692307686</double>
<double>255.0</double>
<double>80.84878251245158</double>
<double>133.1569965870307</double>
</value>
</edu.wpi.grip.core.sockets.InputSocketImpl>
<edu.wpi.grip.core.sockets.OutputSocketImpl step="0" socket="0" previewed="true"/>
Expand All @@ -37,7 +37,7 @@
<edu.wpi.grip.core.Step name="Filter Contours">
<edu.wpi.grip.core.sockets.InputSocketImpl step="2" socket="0"/>
<edu.wpi.grip.core.sockets.InputSocketImpl step="2" socket="1">
<value>20.0</value>
<value>100.0</value>
</edu.wpi.grip.core.sockets.InputSocketImpl>
<edu.wpi.grip.core.sockets.InputSocketImpl step="2" socket="2">
<value>0.0</value>
Expand Down
7 changes: 1 addition & 6 deletions src/org/usfirst/frc/team1089/robot/subsystems/Gear.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@
import edu.wpi.first.wpilibj.command.Subsystem;

/**
* The Gear Delivery Mechanism
*
* @author Luke Letourneau
* @version 1
*
* {@link}
*
*/
public class Gear extends Subsystem {

Expand Down
14 changes: 8 additions & 6 deletions src/org/usfirst/frc/team1089/robot/subsystems/Ultrasonic.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public class Ultrasonic extends Subsystem {
// here. Call these from Commands.

private AnalogInput ultrasonic;
private final double SCALING_FACTOR = 1/9.8;

/** Scaling factor - in / volts */
private final double SCALING_FACTOR = 1/9.8;

public Ultrasonic() {
ultrasonic = new AnalogInput(RobotMap.Analog.ULTRASONIC);
Expand All @@ -26,13 +28,13 @@ public AnalogInput getUltrasonic() {
}

/**
* Multiplies Analog Voltage on the sensor by the scaling factor in inches/V
* Scaling Factor = 9.8 V/inches
* Converts to Feet
* @return Distance
* Gets the range between the rangefinder board and the object across from it
* as perceived by the rangefinder by getting the voltage and multiplying it by the scaling factor
*
* @return range between the board and the object across from it in inches
*/
public double getRange() {
return ultrasonic.getVoltage() * SCALING_FACTOR / 12;
return ultrasonic.getVoltage() * SCALING_FACTOR;
}

public void initDefaultCommand() {
Expand Down
11 changes: 11 additions & 0 deletions src/org/usfirst/frc/team1089/robot/util/VisionProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,17 @@ public double getAngleFromCenter(TargetType type) {
return Math.abs(ratio * hfov) > 1.0 ? ratio * hfov : 0.0;
}

/**
* <pre>
* public double[] getAnglesFromGearTargets()
* </pre>
*
* Gets the angles that the robot needs
* to turn to center itself to the left and right target
*
* @return array of angles that the robot can turn to to face the left or right target;
* left target is element 1, right target is element 2
*/
public double[] getAnglesFromGearTargets() {
double centerX1, centerX2, dist1, dist2, ratio1, ratio2, hfov, hres;
double[] output = new double[2];
Expand Down

0 comments on commit ece7538

Please sign in to comment.