Skip to content

Commit

Permalink
Merge branch 'mission/rep19' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	conf/consoles/lauv.ncon
  • Loading branch information
paulosousadias committed Oct 24, 2019
2 parents a74f5d1 + a8d8a36 commit 4e541e3
Show file tree
Hide file tree
Showing 23 changed files with 770 additions and 41 deletions.
8 changes: 5 additions & 3 deletions conf/consoles/lauv.ncon
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,14 @@
<child class="pt.lsts.neptus.plugins.sweepplangen.SweepPlanGen" x="0" y="0" width="0" height="0">
<properties/>
</child>
<child class="pt.lsts.ripples.RipplesUpload" x="0" y="0" width="0" height="0">
<properties/>
</child>
<child class="pt.lsts.neptus.plugins.rtplot.RealTimePlotGroovy" x="0" y="0" width="300" height="272">
<properties/>
</child>
<child class="pt.lsts.ripples.RipplesUpdater" x="0" y="0" width="0" height="0">
<properties>
<entry key="connected">false</entry>
</properties>
</child>
</subpanel>
</mainpanel>
<mainpanel name="console alarm panel"/>
Expand Down
Binary file added missions/REP19/airops.nmisz
Binary file not shown.
Binary file added missions/REP19/cdc3.nmisz
Binary file not shown.
Binary file added missions/REP19/endurance.nmisz
Binary file not shown.
Binary file added missions/REP19/sado_25set.nmisz
Binary file not shown.
Binary file added missions/REP19/savel.nmisz
Binary file not shown.
Binary file added missions/REP19/subauv.nmisz
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public void setMTShip(MTShip ship) {
}
else {
contact = contacts.get(mmsi);
contact.setLastUpdate((long)ship.TIME);
contact.setLastUpdate((long)(ship.TIME * 1000.0));
contacts.replace(mmsi, contact);
}
contact.setLocation(new LocationType(ship.LAT, ship.LON));
Expand All @@ -332,7 +332,7 @@ public void setMTShip(MTShip ship) {
additionalProps.setShipType(ship.TYPE);
additionalProps.setDestination(ship.DESTINATION);
contact.update(additionalProps);
long time = System.currentTimeMillis()-(ship.ELAPSED*60_000);
long time = System.currentTimeMillis()-ship.ELAPSED;
contact.setLastUpdate(time);
updateSystem(mmsi,new LocationType(ship.LAT,ship.LON),ship.HEADING,time);
}
Expand All @@ -346,6 +346,7 @@ public void updateSystem(int mmsi, LocationType loc, double heading,long millis)
AisContact contact = contacts.get(mmsi);
String name = contact.getLabel();
ExternalSystem sys = NMEAUtils.getAndRegisterExternalSystem(mmsi, name);

sys.setLocation(loc, millis);
sys.setAttitudeDegrees(heading > 360 ? contact.getCog() : heading,millis);

Expand Down Expand Up @@ -449,7 +450,7 @@ public synchronized void purge(long maximumAgeMillis) {
}

for (int rem : toRemove) {
NeptusLog.pub().info("Removing " + rem + " because is more than " + maximumAgeMillis + " milliseconds old.");
NeptusLog.pub().debug("Removing " + rem + " because is more than " + maximumAgeMillis + " milliseconds old.");
contacts.remove(rem);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ public boolean userControlsOpacity() {

@Periodic(millisBetweenUpdates = 60000)
public void purgeOldContacts() {
if (maximumAisAgeMinutes >= 0)
if (maximumAisAgeMinutes > 0)
contactDb.purge(maximumAisAgeMinutes * 60 * 1000);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static MTShip parse(JsonObject object) {
try {
Date timestamp = sdf.parse(object.getString("timestamp", sdf.format(new Date())));
ship.TIME = timestamp.getTime()/1000.0;
ship.ELAPSED = (System.currentTimeMillis() - timestamp.getTime()) / 1000;
ship.ELAPSED = (System.currentTimeMillis() - timestamp.getTime());
}
catch (ParseException e) {
NeptusLog.pub().error("Error parsing date: "+object.getString("timestamp", "N/A"));
Expand Down
77 changes: 58 additions & 19 deletions plugins-dev/cdc3/pt/lsts/neptus/plugins/cdc3/Cdc3Panel.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
package pt.lsts.neptus.plugins.cdc3;

import java.awt.Color;
import java.awt.Rectangle;
import java.nio.ByteBuffer;
import java.time.LocalDateTime;
import java.util.ArrayList;
Expand Down Expand Up @@ -66,6 +67,7 @@
import pt.lsts.imc.TransmissionRequest.DATA_MODE;
import pt.lsts.imc.TransmissionStatus;
import pt.lsts.imc.UamRxFrame;
import pt.lsts.imc.UamRxRange;
import pt.lsts.neptus.NeptusLog;
import pt.lsts.neptus.console.ConsoleLayout;
import pt.lsts.neptus.console.ConsolePanel;
Expand All @@ -91,6 +93,7 @@
import pt.lsts.neptus.types.mission.plan.PlanType;
import pt.lsts.neptus.util.DateTimeUtil;
import pt.lsts.neptus.util.GuiUtils;
import pt.lsts.neptus.util.MathMiscUtils;
import pt.lsts.neptus.util.ReflectionUtil;
import pt.lsts.neptus.util.conf.GeneralPreferences;

Expand Down Expand Up @@ -126,6 +129,8 @@ public class Cdc3Panel extends ConsolePanel implements IEditorMenuExtension, Sub

private Vector<IMapPopup> renderersPopups;

private int planDepth = 0;

/**
* @param console
*/
Expand Down Expand Up @@ -258,6 +263,11 @@ public void subPanelChanged(SubPanelChangeEvent panelChange) {
// }
// }

private void appendText(String txt) {
textArea.append(txt);
textArea.scrollRectToVisible(new Rectangle(0, textArea.getHeight() + 22, 1, 1));
}

@Subscribe
public void on(TransmissionStatus msg) {
Pair<TransmissionRequest, LocalDateTime> rqst = requests.get(msg.getReqId());
Expand All @@ -266,7 +276,7 @@ public void on(TransmissionStatus msg) {
// return;

String txtNot = I18n.textf("The request %s1 for %s2", msg.getStatusStr(), rqst.getLeft().asJSON(false));
textArea.append("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>TransmissionStatus::>" + txtNot + "\n");
appendText("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>TransmissionStatus::>" + txtNot + "\n");
switch(msg.getStatus()) {
case DELIVERED:
post(Notification.success(I18n.text(this.getName()), txtNot));
Expand Down Expand Up @@ -317,10 +327,17 @@ private void on(UamRxFrame msg) {
recMsg.setSource(sourceName);

NeptusLog.pub().warn(recMsg + "\nBuffer::" + Cdc3Serializer.bufferToString(buf));
textArea.append("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>UamRxFrame::>" + recMsg + "\n");
appendText("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>UamRxFrame::>" + recMsg + "\n");
}
}


@Subscribe
private void on(UamRxRange msg) {
String sourceName = msg.getSourceName();
NeptusLog.pub().warn(">UamRxRange from " + sourceName +"::>" + msg.getSys() + " @" + MathMiscUtils.round(msg.getValue(), 1) + "m");
appendText("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>UamRxRange::>" + msg.getSys() + " @" + MathMiscUtils.round(msg.getValue(), 1) + "m\n");
}

/**
* @param msg
*/
Expand Down Expand Up @@ -373,7 +390,7 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
byte[] rawData = ArrayUtils.subarray(serBuf.array(), serBuf.arrayOffset(), serBuf.position());

TransmissionRequest txRqst = new TransmissionRequest();
txRqst.setReqId(requestIdCounter.getAndIncrement());
txRqst.setReqId(requestIdCounter.getAndIncrement() & 0xFFFF);
txRqst.setDestination(vehicleDestination);
txRqst.setCommMean(COMM_MEAN.ACOUSTIC);
txRqst.setDataMode(DATA_MODE.RAW);
Expand All @@ -387,7 +404,7 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
}
NeptusLog.pub().warn(msg);
NeptusLog.pub().warn(txRqst.asJSON());
textArea.append("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>SENT Plan " + vehicleDestination + " start::>"
appendText("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>SENT Plan " + vehicleDestination + " start::>"
+ "\nBuffer::" + Cdc3Serializer.bufferToString(serBuf) + "\n"
+ msg + "\n" + txRqst.asJSON(false) + "\n");
}
Expand Down Expand Up @@ -427,7 +444,7 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
pc.setType(PlanControl.TYPE.REQUEST);
pc.setOp(PlanControl.OP.START);
pc.setPlanId(opt.toString());
int req = requestIdCounter.getAndIncrement();
int req = requestIdCounter.getAndIncrement() & 0xFFFF;
pc.setRequestId(req);

TransmissionRequest txRqst = new TransmissionRequest();
Expand All @@ -444,7 +461,7 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
requests.put(txRqst.getReqId(), pair);
}
NeptusLog.pub().warn(txRqst.asJSON());
textArea.append("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>IMC SENT Plan " + vehicleDestination + " start::>"
appendText("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>IMC SENT Plan " + vehicleDestination + " start::>"
+ "\nPlan ID::" + pc.getPlanId() + "\n"
+ txRqst.asJSON(false) + "\n");
}
Expand All @@ -458,6 +475,17 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
JMenuItem planWp = new JMenuItem("Plan " + vehicleDestination + " WP here");
planWp.addActionListener(e -> {
try {
String opt = JOptionPane.showInputDialog(getConsole(), "Plan depth", planDepth);
if (opt != null) {
try {
planDepth = Integer.parseInt(opt);
}
catch (NumberFormatException e1) {
e1.printStackTrace();
return;
}
}

LocationType locCp = loc.getNewAbsoluteLatLonDepth();
RetaskToWaypointMessage msg = new RetaskToWaypointMessage();
msg.setLatitudeRads((float) locCp.getLatitudeRads());
Expand All @@ -469,15 +497,15 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour

PlanCreator creator = new PlanCreator(getConsole().getMission());
creator.setLocation(locCp);
creator.setZ(0, ManeuverLocation.Z_UNITS.DEPTH);
creator.setZ(planDepth, ManeuverLocation.Z_UNITS.DEPTH);
creator.addManeuver("Goto", "speed", vehicleSpeed, "speedUnits", "m/s");
PlanType plan = creator.getPlan();
plan.setVehicle(vehicleDestination);
plan.setId("cdc-wp-" + vehicleDestination);
plan = addPlanToMission(plan);

TransmissionRequest txRqst = new TransmissionRequest();
txRqst.setReqId(requestIdCounter.getAndIncrement());
txRqst.setReqId(requestIdCounter.getAndIncrement() & 0xFFFF);
txRqst.setDestination(vehicleDestination);
txRqst.setCommMean(COMM_MEAN.ACOUSTIC);
txRqst.setDataMode(DATA_MODE.RAW);
Expand All @@ -491,7 +519,7 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
}
NeptusLog.pub().warn(msg);
NeptusLog.pub().warn(txRqst.asJSON());
textArea.append("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>SENT Plan " + vehicleDestination + " WP here::>"
appendText("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>SENT Plan " + vehicleDestination + " WP here::>"
+ "\nBuffer::" + Cdc3Serializer.bufferToString(serBuf) + "\n"
+ msg + "\n" + txRqst.asJSON(false) + "\n");
}
Expand All @@ -504,11 +532,22 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
JMenuItem planWp1 = new JMenuItem("Plan " + vehicleDestination + " WP here");
planWp1.addActionListener(e -> {
try {
String opt = JOptionPane.showInputDialog(getConsole(), "Plan depth", planDepth);
if (opt != null) {
try {
planDepth = Integer.parseInt(opt);
}
catch (NumberFormatException e1) {
e1.printStackTrace();
return;
}
}

LocationType locCp = loc.getNewAbsoluteLatLonDepth();

PlanCreator creator = new PlanCreator(getConsole().getMission());
creator.setLocation(locCp);
creator.setZ(0, ManeuverLocation.Z_UNITS.DEPTH);
creator.setZ(planDepth, ManeuverLocation.Z_UNITS.DEPTH);
creator.addManeuver("Goto", "speed", vehicleSpeed, "speedUnits", "m/s");
PlanType plan = creator.getPlan();
plan.setVehicle(vehicleDestination);
Expand All @@ -521,7 +560,7 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
pc.setOp(PlanControl.OP.START);
pc.setPlanId(imcPlan.getPlanId());
pc.setArg(imcPlan);
int req = requestIdCounter.getAndIncrement();
int req = requestIdCounter.getAndIncrement() & 0xFFFF;
pc.setRequestId(req);

TransmissionRequest txRqst = new TransmissionRequest();
Expand All @@ -538,7 +577,7 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
requests.put(txRqst.getReqId(), pair);
}
NeptusLog.pub().warn(txRqst.asJSON());
textArea.append("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>SENT Plan " + vehicleDestination + " WP here::>"
appendText("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>SENT Plan " + vehicleDestination + " WP here::>"
+ "\n" + txRqst.asJSON(false) + "\n");
}
catch (NumberFormatException e1) {
Expand All @@ -553,7 +592,7 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
Abort ab = new Abort();

TransmissionRequest txRqst = new TransmissionRequest();
txRqst.setReqId(requestIdCounter.getAndIncrement());
txRqst.setReqId(requestIdCounter.getAndIncrement() & 0xFFFF);
txRqst.setDestination(vehicleDestination);
txRqst.setCommMean(COMM_MEAN.ACOUSTIC);
txRqst.setDataMode(DATA_MODE.INLINEMSG);
Expand All @@ -566,7 +605,7 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
requests.put(txRqst.getReqId(), pair);
}
NeptusLog.pub().warn(txRqst.asJSON());
textArea.append("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>IMC SENT Abort " + vehicleDestination + "::>"
appendText("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>IMC SENT Abort " + vehicleDestination + "::>"
+ txRqst.asJSON(false) + "\n");
}
catch (NumberFormatException e1) {
Expand All @@ -579,7 +618,7 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
range1.addActionListener(e -> {
try {
TransmissionRequest txRqst = new TransmissionRequest();
txRqst.setReqId(requestIdCounter.getAndIncrement());
txRqst.setReqId(requestIdCounter.getAndIncrement() & 0xFFFF);
txRqst.setDestination(vehicleDestination);
txRqst.setCommMean(COMM_MEAN.ACOUSTIC);
txRqst.setDataMode(DATA_MODE.RANGE);
Expand All @@ -591,7 +630,7 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
requests.put(txRqst.getReqId(), pair);
}
NeptusLog.pub().warn(txRqst.asJSON());
textArea.append("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>IMC SENT Range " + vehicleDestination + "::>"
appendText("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>IMC SENT Range " + vehicleDestination + "::>"
+ txRqst.asJSON(false) + "\n");
}
catch (NumberFormatException e1) {
Expand All @@ -616,7 +655,7 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
byte[] rawData = ArrayUtils.subarray(serBuf.array(), serBuf.arrayOffset(), serBuf.position());

TransmissionRequest txRqst = new TransmissionRequest();
txRqst.setReqId(requestIdCounter.getAndIncrement());
txRqst.setReqId(requestIdCounter.getAndIncrement() & 0xFFFF);
txRqst.setDestination(vehicleDestination);
txRqst.setCommMean(COMM_MEAN.ACOUSTIC);
txRqst.setDataMode(DATA_MODE.RAW);
Expand All @@ -630,7 +669,7 @@ public Collection<JMenuItem> getApplicableItems(LocationType loc, IMapPopup sour
}
NeptusLog.pub().warn(msg);
NeptusLog.pub().warn(txRqst.asJSON());
textArea.append("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>SENT Enable " + vehicleDestination + " start::>"
appendText("\n" + DateTimeUtil.timeFormatterUTC.format(new Date()) + "UTC>SENT Enable " + vehicleDestination + " start::>"
+ "\nBuffer::" + Cdc3Serializer.bufferToString(serBuf) + "\n"
+ msg + "\n" + txRqst.asJSON(false) + "\n");
}
Expand Down
1 change: 1 addition & 0 deletions plugins-dev/cloud/plugins.lst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pt.lsts.ripples.RipplesUpload
pt.lsts.ripples.RipplesPositions
pt.lsts.ripples.RipplesUpdater
com.inovaworks.InovaWorksUploaderExporter
com.inovaworks.InovaWorksUploader
Loading

0 comments on commit 4e541e3

Please sign in to comment.