forked from FRC-Dozer/Dozer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actually move everything into the maven build path
- Loading branch information
1 parent
967feba
commit 716f782
Showing
34 changed files
with
148 additions
and
160 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
90 changes: 45 additions & 45 deletions
90
...er/coroutine/helpers/RunParallelTask.java → ...er/coroutine/helpers/RunParallelTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
package com.github.dozer.coroutine.helpers; | ||
|
||
import java.util.Arrays; | ||
import java.util.Iterator; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
|
||
import com.github.dozer.coroutine.Task; | ||
import com.github.dozer.coroutine.helpers.RunContinuousTask; | ||
|
||
public class RunParallelTask extends RunContinuousTask { | ||
|
||
private List<Task> tasks; | ||
|
||
public RunParallelTask(Task... tasks) { | ||
System.out.println("Parallel task constructor"); | ||
this.tasks = new LinkedList<>(); | ||
this.tasks.addAll(Arrays.asList(tasks)); | ||
} | ||
|
||
@Override | ||
protected boolean runContinuously() { | ||
for (Iterator<Task> taskIterator = tasks.iterator(); taskIterator.hasNext();) { | ||
|
||
Task task = taskIterator.next(); | ||
if (task.iterator == null) { | ||
task.iterator = task.iterator(); | ||
} | ||
|
||
if (task.waiter != null && task.waiter.getAsBoolean()) { | ||
if (task.iterator.hasNext()) { | ||
// System.out.println(task.toString() + " has next"); | ||
task.waiter = task.iterator.next(); | ||
} else { | ||
// System.out.println(task.toString() + " removed"); | ||
|
||
taskIterator.remove(); | ||
} | ||
} | ||
} | ||
return tasks.isEmpty(); | ||
} | ||
} | ||
package com.github.dozer.coroutine.helpers; | ||
|
||
import java.util.Arrays; | ||
import java.util.Iterator; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
|
||
import com.github.dozer.coroutine.Task; | ||
import com.github.dozer.coroutine.helpers.RunContinuousTask; | ||
|
||
public class RunParallelTask extends RunContinuousTask { | ||
|
||
private List<Task> tasks; | ||
|
||
public RunParallelTask(Task... tasks) { | ||
System.out.println("Parallel task constructor"); | ||
this.tasks = new LinkedList<>(); | ||
this.tasks.addAll(Arrays.asList(tasks)); | ||
} | ||
|
||
@Override | ||
protected boolean runContinuously() { | ||
for (Iterator<Task> taskIterator = tasks.iterator(); taskIterator.hasNext();) { | ||
|
||
Task task = taskIterator.next(); | ||
if (task.iterator == null) { | ||
task.iterator = task.iterator(); | ||
} | ||
|
||
if (task.waiter != null && task.waiter.getAsBoolean()) { | ||
if (task.iterator.hasNext()) { | ||
// System.out.println(task.toString() + " has next"); | ||
task.waiter = task.iterator.next(); | ||
} else { | ||
// System.out.println(task.toString() + " removed"); | ||
|
||
taskIterator.remove(); | ||
} | ||
} | ||
} | ||
return tasks.isEmpty(); | ||
} | ||
} | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.github.dozer.output; | ||
|
||
public interface Motor{ | ||
public void set(double speed); | ||
public double get(); | ||
public void stop(); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.github.dozer.output; | ||
|
||
import edu.wpi.first.wpilibj.SpeedController; | ||
|
||
public class MotorSimple implements Motor { | ||
private SpeedController speedController; | ||
|
||
MotorSimple(SpeedController speedController, boolean inverted) { | ||
this.speedController = speedController; | ||
this.speedController.setInverted(inverted); | ||
} | ||
|
||
private double setpoint = 0; | ||
private double current = 0; | ||
|
||
public double get(){ | ||
return speedController.get(); | ||
} | ||
|
||
|
||
public void set(double speed) { | ||
this.speedController.set(speed); | ||
} | ||
|
||
public void stop() { | ||
speedController.stopMotor(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.github.dozer.output; | ||
|
||
public interface Servo { | ||
public void setAngle(double angle); | ||
public double getAngle(); | ||
public void setRadians(double rads); | ||
public double getRadians(); | ||
public void setPosition(double pos); | ||
public double getPosition(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.github.dozer.output; | ||
|
||
|
||
public class ServoWrapper implements Servo { | ||
|
||
private edu.wpi.first.wpilibj.Servo servo; | ||
|
||
ServoWrapper(int pin) { | ||
this.servo = new edu.wpi.first.wpilibj.Servo(pin); | ||
} | ||
|
||
|
||
public void setAngle(double degrees) { | ||
servo.setAngle(degrees); | ||
} | ||
|
||
public double getAngle(){ | ||
return servo.getAngle(); | ||
} | ||
|
||
public void setRadians(double radians) { | ||
this.setAngle(Math.toDegrees(radians)); | ||
} | ||
|
||
public double getRadians(){ | ||
return Math.toDegrees(this.getAngle()); | ||
} | ||
|
||
public void setPosition(double pos){ | ||
servo.setPosition(pos); | ||
} | ||
|
||
public double getPosition(){ | ||
return servo.get(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.