Skip to content

Commit d3082f9

Browse files
committed
Made the scadlib package
1 parent 7f63a56 commit d3082f9

18 files changed

Lines changed: 42 additions & 31 deletions

src/PathTest.java

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
import org.math.plot.Plot2DPanel;
88

9-
import extra.GoodGraphing;
10-
import paths.FastPathPlanner;
11-
import paths.MotionPath;
12-
import paths.Point;
13-
import paths.Position;
14-
import paths.Util;
9+
import scadlib.extra.GoodGraphing;
10+
import scadlib.paths.FastPathPlanner;
11+
import scadlib.paths.MotionPath;
12+
import scadlib.paths.Point;
13+
import scadlib.paths.Position;
14+
import scadlib.paths.Util;
1515

1616
/**
1717
* Overarching class to run various paths.
@@ -48,18 +48,19 @@ public static void main(String[] args) {
4848
figure.yGridOn();
4949
figure.setYLabel("Y (inches)");
5050
figure.setXLabel("X (inches)");
51-
double width = 648, height = 324.5;
52-
double robotWidth = 22;
53-
double robotLength = 32;
54-
figure.setXTic(0, width, 12);
55-
figure.setYTic(0, height, 12);
56-
// Add the close switch
57-
// 38.719 is length of switch
51+
double width = 648;
52+
double height = 324.5;
53+
double robotWidth = 25.75;
54+
double robotLength = 37.25;
5855
double switchLength = 38.719;
5956
double distanceToSwitchFromWall = 85.25;
6057
double distanceToSwitchFromAlliance = 140;
6158
double delta = 10;
6259
double widthOfSwitch = 56;
60+
figure.setXTic(0, width, 12);
61+
figure.setYTic(0, height, 12);
62+
// Add the close switch
63+
// 38.719 is length of switch
6364
figure.addData(new double[][]{
6465
{distanceToSwitchFromAlliance, distanceToSwitchFromWall},
6566
{distanceToSwitchFromAlliance, height-distanceToSwitchFromWall},
@@ -110,6 +111,8 @@ public static void main(String[] args) {
110111
figure.addData(fpp.leftPath, Color.red);
111112
figure.addData(fpp.rightPath, Color.green);
112113

114+
115+
113116
GoodGraphing fig = new GoodGraphing(fpp.smoothCenterVelocity, null, Color.blue);
114117
fig.yGridOn();
115118
fig.xGridOn();
@@ -119,6 +122,14 @@ public static void main(String[] args) {
119122
fig.addData(fpp.smoothLeftVelocity, Color.red);
120123
fig.addData(fpp.smoothRightVelocity, Color.green);
121124

125+
double[][] leftV = fpp.smoothLeftVelocity;
126+
double[][] rightV = fpp.smoothRightVelocity;
127+
128+
for (int i = 0; i < leftV.length; i++) {
129+
System.out.print(leftV[i][0]);
130+
System.out.println(", "+leftV[i][1]);
131+
}
132+
122133
GoodGraphing pos = new GoodGraphing(fpp.nodeOnlyPath, Color.blue, Color.green);
123134
pos.yGridOn();
124135
pos.xGridOn();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package extra;
1+
package scadlib.extra;
22

33
import java.awt.*;
44
import java.awt.datatransfer.Clipboard;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package extra;
1+
package scadlib.extra;
22

33
public class PIDF {
44
private double p,i,d,f;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package extra;
1+
package scadlib.extra;
22

3-
import paths.RobotPath;
3+
import scadlib.paths.RobotPath;
44

55
public class RobotPathFollower {
66
private double width,wheelDiameter,ticksPerRevolution;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paths;
1+
package scadlib.paths;
22
/**
33
* Provides handling for multiple MotionPaths combined together.
44
* DOES NOT INTEGRATE ANY OF THE PROVIDED PATHS
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paths;
1+
package scadlib.paths;
22

33
import java.util.LinkedList;
44
import java.util.List;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paths;
1+
package scadlib.paths;
22
/**
33
* A class for simple flat lines.
44
* An easier to use alternative over {@link LinearDerivativePath} as it does not need velocity.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paths;
1+
package scadlib.paths;
22
public class IntegralPath implements MotionPath {
33
private MotionPath speedPath;
44
private double position;

src/paths/LinearDerivativePath.java renamed to src/scadlib/paths/LinearDerivativePath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paths;
1+
package scadlib.paths;
22
/**
33
* A Linear velocity curve {@link MotionPath}. This is one of the simplest {@link MotionPath}s.
44
* It uses kinematic equations to determine position, speed, and acceleration based off of input.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paths;
1+
package scadlib.paths;
22
/**
33
* The overall MotionPath interface. This could also be rewritten to an abstract class.
44
* This makes creating new paths trivial. One can also visualize any MotionPath.

0 commit comments

Comments
 (0)