Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/afrl-rq/OpenAMASE
Browse files Browse the repository at this point in the history
# By derek.kingston
# Via derek.kingston
* 'master' of https://github.com/afrl-rq/OpenAMASE:
  Enable speed override actions
  Additional ports for external entities
  • Loading branch information
lhumphrey-usaf committed Jul 6, 2018
2 parents 9106757 + 36f32c7 commit 0985a59
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
2 changes: 2 additions & 0 deletions OpenAMASE/config/amase/EntityControl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<TcpConnection Id="5140" Port="5140" />
<TcpConnection Id="6050" Port="6050" />
<TcpConnection Id="6051" Port="6051" />
<TcpConnection Id="7056" Port="7056" />
<TcpConnection Id="7057" Port="7057" />
</Module>
</DefaultAircraft>
<DefaultEntity>
Expand Down
Binary file modified OpenAMASE/lib/lmcplib.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion OpenAMASE/src/Amase/avtas/amase/entity/modules/LoiterControl.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package avtas.amase.entity.modules;

import afrl.cmasi.*;
import uxas.messages.uxnative.*;
import avtas.amase.entity.EntityModule;
import java.util.ArrayDeque;
import java.util.ArrayList;
Expand Down Expand Up @@ -106,7 +107,7 @@ public void modelEventOccurred(Object object) {
currentCommandID = vc.getCommandID();
break;
}
else if ( !(a instanceof PayloadAction) ) {
else if ( !(a instanceof PayloadAction) && !(a instanceof SpeedOverrideAction) ) {
loiterList.clear();
currentLoiter = null;
data.autopilotCommands.navMode.setValue(NavigationMode.Loiter);
Expand Down
28 changes: 24 additions & 4 deletions OpenAMASE/src/Amase/avtas/amase/entity/modules/WaypointFollower.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package avtas.amase.entity.modules;

import afrl.cmasi.*;
import uxas.messages.uxnative.*;
import avtas.amase.entity.EntityModule;
import avtas.amase.util.CmasiUtils;
import avtas.data.Unit;
Expand Down Expand Up @@ -117,10 +118,9 @@ public void step(double timestep_sec, double simtime_sec) {
}

// make sure alt and speed are set
data.autopilotCommands.cmdAlt.setValue(currentWp.getAltitude());
data.autopilotCommands.cmdSpeed.setValue(currentWp.getSpeed());
data.autopilotCommands.speedCmdType.setValue(SpeedType.Airspeed);

//data.autopilotCommands.cmdAlt.setValue(currentWp.getAltitude());
//data.autopilotCommands.cmdSpeed.setValue(currentWp.getSpeed());
//data.autopilotCommands.speedCmdType.setValue(SpeedType.Airspeed);
}

/**
Expand All @@ -132,6 +132,18 @@ public void step(double timestep_sec, double simtime_sec) {
public void setWpFollow(boolean isEnabled) {
data.autopilotCommands.navMode.setValue(NavigationMode.Waypoint);
}

/**
* Overwrites current speed commanded value with desired speed value.
* Used in combination with Loiter or Waypoint mode to immediately change
* speed, disregarding original speed command.
*
* @param speed value to which commanded speed should be assigned.
*/
public void setSpeed(double speed) {
//System.out.println("Setting speed to " + speed);
data.autopilotCommands.cmdSpeed.setValue(speed);
}

/**
* Algorithm for doing a simple turn-past style turn. Called by the step
Expand Down Expand Up @@ -356,6 +368,10 @@ else if (object instanceof VehicleActionCommand) {
incrementWaypoint(wa.getWaypointNumber());
}
}
else if (va instanceof SpeedOverrideAction) {
SpeedOverrideAction sa = (SpeedOverrideAction) va;
setSpeed(sa.getSpeed());
}

}
}
Expand All @@ -367,6 +383,10 @@ else if (object instanceof GoToWaypointAction) {
incrementWaypoint(wa.getWaypointNumber());
}
}
else if (object instanceof SpeedOverrideAction) {
SpeedOverrideAction sa = (SpeedOverrideAction) object;
setSpeed(sa.getSpeed());
}
}
}

Expand Down

0 comments on commit 0985a59

Please sign in to comment.