Skip to content

Commit

Permalink
Made the scadlib package
Browse files Browse the repository at this point in the history
  • Loading branch information
sc2ad committed Feb 18, 2018
1 parent 7f63a56 commit d3082f9
Show file tree
Hide file tree
Showing 18 changed files with 42 additions and 31 deletions.
37 changes: 24 additions & 13 deletions src/PathTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

import org.math.plot.Plot2DPanel;

import extra.GoodGraphing;
import paths.FastPathPlanner;
import paths.MotionPath;
import paths.Point;
import paths.Position;
import paths.Util;
import scadlib.extra.GoodGraphing;
import scadlib.paths.FastPathPlanner;
import scadlib.paths.MotionPath;
import scadlib.paths.Point;
import scadlib.paths.Position;
import scadlib.paths.Util;

/**
* Overarching class to run various paths.
Expand Down Expand Up @@ -48,18 +48,19 @@ public static void main(String[] args) {
figure.yGridOn();
figure.setYLabel("Y (inches)");
figure.setXLabel("X (inches)");
double width = 648, height = 324.5;
double robotWidth = 22;
double robotLength = 32;
figure.setXTic(0, width, 12);
figure.setYTic(0, height, 12);
// Add the close switch
// 38.719 is length of switch
double width = 648;
double height = 324.5;
double robotWidth = 25.75;
double robotLength = 37.25;
double switchLength = 38.719;
double distanceToSwitchFromWall = 85.25;
double distanceToSwitchFromAlliance = 140;
double delta = 10;
double widthOfSwitch = 56;
figure.setXTic(0, width, 12);
figure.setYTic(0, height, 12);
// Add the close switch
// 38.719 is length of switch
figure.addData(new double[][]{
{distanceToSwitchFromAlliance, distanceToSwitchFromWall},
{distanceToSwitchFromAlliance, height-distanceToSwitchFromWall},
Expand Down Expand Up @@ -110,6 +111,8 @@ public static void main(String[] args) {
figure.addData(fpp.leftPath, Color.red);
figure.addData(fpp.rightPath, Color.green);



GoodGraphing fig = new GoodGraphing(fpp.smoothCenterVelocity, null, Color.blue);
fig.yGridOn();
fig.xGridOn();
Expand All @@ -119,6 +122,14 @@ public static void main(String[] args) {
fig.addData(fpp.smoothLeftVelocity, Color.red);
fig.addData(fpp.smoothRightVelocity, Color.green);

double[][] leftV = fpp.smoothLeftVelocity;
double[][] rightV = fpp.smoothRightVelocity;

for (int i = 0; i < leftV.length; i++) {
System.out.print(leftV[i][0]);
System.out.println(", "+leftV[i][1]);
}

GoodGraphing pos = new GoodGraphing(fpp.nodeOnlyPath, Color.blue, Color.green);
pos.yGridOn();
pos.xGridOn();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package extra;
package scadlib.extra;

import java.awt.*;
import java.awt.datatransfer.Clipboard;
Expand Down
2 changes: 1 addition & 1 deletion src/extra/PIDF.java → src/scadlib/extra/PIDF.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package extra;
package scadlib.extra;

public class PIDF {
private double p,i,d,f;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package extra;
package scadlib.extra;

import paths.RobotPath;
import scadlib.paths.RobotPath;

public class RobotPathFollower {
private double width,wheelDiameter,ticksPerRevolution;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;
/**
* Provides handling for multiple MotionPaths combined together.
* DOES NOT INTEGRATE ANY OF THE PROVIDED PATHS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;

import java.util.LinkedList;
import java.util.List;
Expand Down
2 changes: 1 addition & 1 deletion src/paths/Hold.java → src/scadlib/paths/Hold.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;
/**
* A class for simple flat lines.
* An easier to use alternative over {@link LinearDerivativePath} as it does not need velocity.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;
public class IntegralPath implements MotionPath {
private MotionPath speedPath;
private double position;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;
/**
* A Linear velocity curve {@link MotionPath}. This is one of the simplest {@link MotionPath}s.
* It uses kinematic equations to determine position, speed, and acceleration based off of input.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;
/**
* The overall MotionPath interface. This could also be rewritten to an abstract class.
* This makes creating new paths trivial. One can also visualize any MotionPath.
Expand Down
2 changes: 1 addition & 1 deletion src/paths/Point.java → src/scadlib/paths/Point.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;

public class Point {
public double x,y,vx,vy,ax,ay = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;

public class Position {
public double x, y, theta;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;

public interface PotentialSpline {
public double get(double t);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;

public class RobotPath {
Trajectory traj;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;

public class SimplePoint {
public double pos,vel,accel;
Expand Down
2 changes: 1 addition & 1 deletion src/paths/Spline.java → src/scadlib/paths/Spline.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;
import java.util.ArrayList;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;

public class Trajectory {
private static final int ARCLENGTH_SAMPLES = 10000;
Expand Down
2 changes: 1 addition & 1 deletion src/paths/Util.java → src/scadlib/paths/Util.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package paths;
package scadlib.paths;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
Expand Down

0 comments on commit d3082f9

Please sign in to comment.