fixed package mismatch

This commit is contained in:
cs-powell
2024-11-24 15:05:33 -05:00
parent a5cf193a7d
commit 3579efea5d
23 changed files with 135 additions and 79 deletions

View File

@@ -1,7 +0,0 @@
package ProjectModels.CognitiveModel;
public enum ActionType{
VISION,
MOTOR,
DELAY
}

View File

@@ -1,4 +1,5 @@
package ProjectModels.CognitiveModel;
package ModelFiles;
public abstract class Action {

View File

@@ -0,0 +1,9 @@
package ModelFiles;
public enum ActionType{
VISION,
MOTOR,
DELAY,
}

View File

@@ -1,4 +1,5 @@
package ProjectModels.CognitiveModel;
package ModelFiles;
// package ProjectModels.CognitiveModel;
public class Delay extends Action {

View File

@@ -1,4 +1,5 @@
package ProjectModels.CognitiveModel;
package ModelFiles;
// package ProjectModels.CognitiveModel;
import java.util.LinkedList;

View File

@@ -1,12 +1,15 @@
package ProjectModels.CognitiveModel;
package ModelFiles;
import java.io.IOException;
import ModelFiles.ActionType;
import ModelFiles.MotorType;
public class Model {
private MindQueue q; //Queue for actions
boolean modelActive; // On/Off Switch for the model execution
XPlaneConnect xpc; //Allows connection to the simulator
float[] storedVision;
//Constructors
public Model() {
@@ -64,19 +67,22 @@ public class Model {
return q.queueLength();
}
public void createAction(int actionType,int delay,String target) {
public void createAction(ActionType actionType,int delay,String target) {
Action newAction = null;
switch(actionType){
case 1:
switch(actionType) {
case VISION:
newAction = new Vision(delay,target);
this.push(newAction);
case 2:
break;
case MOTOR:
newAction = new Motor(delay,target);
this.push(newAction);
break;
case 3:
case DELAY:
newAction = new Delay(delay);
this.push(newAction);
break;
}
}
@@ -112,14 +118,42 @@ public class Model {
String dref = tempV.getTarget();
try {
returnArray = xpc.getDREF(dref);
storedVision = returnArray.clone();
// System.out.println(returnArray[0]);
} catch (IOException e) {
}
}
private void handleMotorAction(Action temp){
private void handleMotorAction(Action temp) {
Motor tempM = (Motor) temp;
tempM.getDelay();
MotorType motorType = tempM.getMotorType();
float[] currentControls = null;
try {
switch(motorType){
case PITCHUP:
float[] pitchUp = {currentControls[0] + 0.01f};
if(storedVision[0] > 90) {
if(currentControls[0] < 0.1f) {
xpc.sendCTRL(pitchUp);
}
}
System.out.println("Pitching Up");
case PITCHDOWN:
float[] pitchDown = {currentControls[0] - 0.01f};
if(storedVision[0] < 50) {
if(currentControls[0] > 0.1f) {
xpc.sendCTRL(pitchDown);
}
}
System.out.println("Pitching Down");
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void handleDelayAction(Action temp){

View File

@@ -1,10 +1,11 @@
package ProjectModels.CognitiveModel;
package ModelFiles;
import java.io.IOException;
public class Motor extends Action {
float[] control;
MotorType motorType;
public Motor() {
super(ActionType.MOTOR,1000);
@@ -24,6 +25,11 @@ public void createMotorControl(){ // TODO: Maybe takes in a formatted set of vis
control = null;
}
public MotorType getMotorType(){
return motorType;
}
public void sendMotorControl(XPlaneConnect xpc) {
if(control != null) {
@@ -36,4 +42,5 @@ public void sendMotorControl(XPlaneConnect xpc) {
}
}
}

View File

@@ -0,0 +1,6 @@
package ModelFiles;
public enum MotorType{
PITCHUP,
PITCHDOWN
}

View File

@@ -1,4 +1,4 @@
package ProjectModels.CognitiveModel;
package ModelFiles;
public class Process {

View File

@@ -1,4 +1,4 @@
package ProjectModels.CognitiveModel;
package ModelFiles;
import org.junit.Test;
import static org.junit.Assert.assertEquals;

View File

@@ -0,0 +1,22 @@
package ModelFiles;
public class Vision extends Action {
public Vision(){
super(ActionType.VISION,1000);
}
public Vision(int delay){
super(ActionType.VISION,delay);
}
public Vision(String dref){
super(ActionType.VISION,1000,dref);
}
public Vision(int delay, String dref){
super(ActionType.VISION,delay, dref);
}
}

View File

@@ -1,4 +1,4 @@
package ProjectModels.CognitiveModel.XPCdependencies;
package ModelFiles.XPCdependencies;
import java.net.InetAddress;

View File

@@ -1,4 +1,4 @@
package ProjectModels.CognitiveModel.XPCdependencies;
package ModelFiles.XPCdependencies;
import java.io.IOException;
import java.net.DatagramPacket;

View File

@@ -1,4 +1,4 @@
package ProjectModels.CognitiveModel.XPCdependencies;
package ModelFiles.XPCdependencies;
public interface BeaconReceivedListener {

View File

@@ -1,6 +1,6 @@
package ProjectModels.CognitiveModel.XPCdependencies;
package ModelFiles.XPCdependencies;
import ProjectModels.CognitiveModel.*;
import ModelFiles.*;
public interface DiscoveryConnectionCallback {

View File

@@ -22,7 +22,7 @@
// HARMLESS THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
// PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR ANY SUCH MATTER
// SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT.
package ProjectModels.CognitiveModel.XPCdependencies;
package ModelFiles.XPCdependencies;
/**
* Represents a camera view in X-Plane

View File

@@ -22,7 +22,7 @@
// HARMLESS THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY
// PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR ANY SUCH MATTER
// SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT.
package ProjectModels.CognitiveModel.XPCdependencies;
package ModelFiles.XPCdependencies;
/**
* Represents operations that can be performed by the WYPT command.

View File

@@ -1,6 +1,6 @@
package ProjectModels.CognitiveModel.XPCdependencies;
package ModelFiles.XPCdependencies;
import ProjectModels.CognitiveModel.*;
import ModelFiles.*;
import java.io.IOException;
import java.net.DatagramPacket;

View File

@@ -23,11 +23,7 @@
// PRIOR RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR ANY SUCH MATTER
// SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT.
package ProjectModels.CognitiveModel;
import ProjectModels.CognitiveModel.XPCdependencies.*;
import src.discovery.ViewType;
import src.discovery.WaypointOp;
package ModelFiles;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -38,6 +34,8 @@ import java.nio.ByteOrder;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import ModelFiles.XPCdependencies.*;
/**
* Represents a client that can connect to and interact with the X-Plane Connect plugin.
*

View File

@@ -1,22 +0,0 @@
package ProjectModels.CognitiveModel;
public class Vision extends Action {
public Vision(){
super(ActionType.VISION,1000);
}
public Vision(int delay){
super(ActionType.VISION,delay);
}
public Vision(String dref){
super(ActionType.VISION,1000,dref);
}
public Vision(int delay, String dref){
super(ActionType.VISION,delay, dref);
}
}