Skip to content

Commit

Permalink
Restructured repository and added field image
Browse files Browse the repository at this point in the history
  • Loading branch information
FRCAluminati3555 committed Nov 19, 2019
1 parent f1790cd commit 79f9f2c
Show file tree
Hide file tree
Showing 99 changed files with 1,793 additions and 1,793 deletions.
Binary file added trajectory/res/field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
package com.team254.lib.util;

import java.util.LinkedList;

/**
* Implements a simple circular buffer.
* Can be used for any class.
*/
public class CircularBufferGeneric<E> {
final int mWindowSize;
final LinkedList<E> mSamples;
double mSum;

public CircularBufferGeneric(int window_size) {
mWindowSize = window_size;
mSamples = new LinkedList<>();
mSum = 0.0;
}


public void clear() {
mSamples.clear();
mSum = 0.0;
}

public void addValue(E val) {
mSamples.addLast(val);
if (mSamples.size() > mWindowSize) {
mSamples.removeFirst();
}
}

public int getNumValues() {
return mSamples.size();
}

public boolean isFull() {
return mWindowSize == mSamples.size();
}

public LinkedList<E> getLinkedList() {
/*
* NOTE: To get an Array of the specific class type which the instance is using,
* you have to use this specific code:
* specificCircularBufferGeneric.getLinkedList().toArray(new ClassThatIWant[specificCircularBufferGeneric
* .getLinkedList().size()]);
* The reason is that for some reason an array of a generic class(i.e. E[]) cannot be created because
* of some archaic data flow ambiguities
*/

return mSamples;
}
}
package com.team254.lib.util;

import java.util.LinkedList;

/**
* Implements a simple circular buffer.
* Can be used for any class.
*/
public class CircularBufferGeneric<E> {
final int mWindowSize;
final LinkedList<E> mSamples;
double mSum;

public CircularBufferGeneric(int window_size) {
mWindowSize = window_size;
mSamples = new LinkedList<>();
mSum = 0.0;
}


public void clear() {
mSamples.clear();
mSum = 0.0;
}

public void addValue(E val) {
mSamples.addLast(val);
if (mSamples.size() > mWindowSize) {
mSamples.removeFirst();
}
}

public int getNumValues() {
return mSamples.size();
}

public boolean isFull() {
return mWindowSize == mSamples.size();
}

public LinkedList<E> getLinkedList() {
/*
* NOTE: To get an Array of the specific class type which the instance is using,
* you have to use this specific code:
* specificCircularBufferGeneric.getLinkedList().toArray(new ClassThatIWant[specificCircularBufferGeneric
* .getLinkedList().size()]);
* The reason is that for some reason an array of a generic class(i.e. E[]) cannot be created because
* of some archaic data flow ambiguities
*/

return mSamples;
}
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package com.team254.lib.util;

/**
* InverseInterpolable is an interface used by an Interpolating Tree as the Key type. Given two endpoint keys and a
* third query key, an InverseInterpolable object can calculate the interpolation parameter of the query key on the
* interval [0, 1].
*
* @param <T> The Type of InverseInterpolable
* @see InterpolatingTreeMap
*/
public interface InverseInterpolable<T> {
/**
* Given this point (lower), a query point (query), and an upper point (upper), estimate how far (on [0, 1]) between
* 'lower' and 'upper' the query point lies.
*
* @param upper
* @param query
* @return The interpolation parameter on [0, 1] representing how far between this point and the upper point the
* query point lies.
*/
double inverseInterpolate(T upper, T query);
}
package com.team254.lib.util;

/**
* InverseInterpolable is an interface used by an Interpolating Tree as the Key type. Given two endpoint keys and a
* third query key, an InverseInterpolable object can calculate the interpolation parameter of the query key on the
* interval [0, 1].
*
* @param <T> The Type of InverseInterpolable
* @see InterpolatingTreeMap
*/
public interface InverseInterpolable<T> {
/**
* Given this point (lower), a query point (query), and an upper point (upper), estimate how far (on [0, 1]) between
* 'lower' and 'upper' the query point lies.
*
* @param upper
* @param query
* @return The interpolation parameter on [0, 1] representing how far between this point and the upper point the
* query point lies.
*/
double inverseInterpolate(T upper, T query);
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
/**
* Copyright (c) 2018 Team319
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package com.team319.follower;

//Generic Motion Profile Class
public class SrxMotionProfile {

public int numPoints;
// Position (rotations) Velocity (RPM) Duration (ms)
public double[][] points;

public SrxMotionProfile() {

}

public SrxMotionProfile(int numPoints, double[][] points) {
this.numPoints = numPoints;
this.points = points;
}
}
/**
* Copyright (c) 2018 Team319
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package com.team319.follower;

//Generic Motion Profile Class
public class SrxMotionProfile {

public int numPoints;
// Position (rotations) Velocity (RPM) Duration (ms)
public double[][] points;

public SrxMotionProfile() {

}

public SrxMotionProfile(int numPoints, double[][] points) {
this.numPoints = numPoints;
this.points = points;
}
}
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
/**
* Copyright (c) 2018 Team319
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package com.team319.follower;

//Combines left and right motion profiles in one object
public class SrxTrajectory {
public boolean flipped;
public boolean highGear;
public SrxMotionProfile leftProfile;
public SrxMotionProfile centerProfile;
public SrxMotionProfile rightProfile;

public SrxTrajectory() {

}

public SrxTrajectory(SrxMotionProfile left, SrxMotionProfile center, SrxMotionProfile right) {
this.leftProfile = left;
this.centerProfile = center;
this.rightProfile = right;
}
}
/**
* Copyright (c) 2018 Team319
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package com.team319.follower;

//Combines left and right motion profiles in one object
public class SrxTrajectory {
public boolean flipped;
public boolean highGear;
public SrxMotionProfile leftProfile;
public SrxMotionProfile centerProfile;
public SrxMotionProfile rightProfile;

public SrxTrajectory() {

}

public SrxTrajectory(SrxMotionProfile left, SrxMotionProfile center, SrxMotionProfile right) {
this.leftProfile = left;
this.centerProfile = center;
this.rightProfile = right;
}
}
Binary file added trajectory/src/jama/.DS_Store
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package jama.util;

public class Maths {

/** sqrt(a^2 + b^2) without under/overflow. **/

public static double hypot(double a, double b) {
double r;
if (Math.abs(a) > Math.abs(b)) {
r = b / a;
r = Math.abs(a) * Math.sqrt(1 + r * r);
} else if (b != 0) {
r = a / b;
r = Math.abs(b) * Math.sqrt(1 + r * r);
} else {
r = 0.0;
}
return r;
}
}
package jama.util;

public class Maths {

/** sqrt(a^2 + b^2) without under/overflow. **/

public static double hypot(double a, double b) {
double r;
if (Math.abs(a) > Math.abs(b)) {
r = b / a;
r = Math.abs(a) * Math.sqrt(1 + r * r);
} else if (b != 0) {
r = a / b;
r = Math.abs(b) * Math.sqrt(1 + r * r);
} else {
r = 0.0;
}
return r;
}
}
12 changes: 6 additions & 6 deletions trajectory/module-info.java → trajectory/src/module-info.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module aluminatipath2 {
opens org.aluminati3555.aluminatipath2;

requires javafx.base;
requires javafx.controls;
requires java.desktop;
module aluminatipath2 {
opens org.aluminati3555.aluminatipath2;

requires javafx.base;
requires javafx.controls;
requires java.desktop;
}
Loading

0 comments on commit 79f9f2c

Please sign in to comment.