diff --git a/experiments/WebUI/src/assets/jc2.js b/experiments/WebUI/src/assets/jc2.js
index f820ab7..db42c5b 100644
--- a/experiments/WebUI/src/assets/jc2.js
+++ b/experiments/WebUI/src/assets/jc2.js
@@ -639,66 +639,3 @@ export class UpdateMissionReq extends AbstractRequest {
super('org.arl.jc2.messages.management.UpdateMissionReq', params);
}
}
-
-
-//*************** Classes for different Mission types ***************
-
-export class SimpleMT extends AbstractRequest {
-
- /**
- * Constructs an SimpleMT mission task.
- *
- * @param {Object} params parameters.
- */
- constructor(params) {
- super('org.arl.jc2.mtt.SimpleMT', params);
- }
-}
-
-export class LawnMowerMT extends AbstractRequest {
-
- /**
- * Constructs an LawnMowerMT mission task.
- *
- * @param {Object} params parameters.
- */
- constructor(params) {
- super('org.arl.jc2.mtt.LawnMowerMT', params);
- }
-}
-
-export class StationKeepingMT extends AbstractRequest {
-
- /**
- * Constructs an StationKeepingMT mission task.
- *
- * @param {Object} params parameters.
- */
- constructor(params) {
- super('org.arl.jc2.mtt.StationKeepingMT', params);
- }
-}
-
-export class SwanArmMT extends AbstractRequest {
-
- /**
- * Constructs an SwanArmMT mission task.
- *
- * @param {Object} params parameters.
- */
- constructor(params) {
- super('org.arl.jc2.mtt.SwanArmMT', params);
- }
-}
-
-export class TargetLocMT extends AbstractRequest {
-
- /**
- * Constructs an TargetLocMT mission task.
- *
- * @param {Object} params parameters.
- */
- constructor(params) {
- super('org.arl.jc2.mtt.TargetLocMT', params);
- }
-}
diff --git a/experiments/WebUI/src/components/content/DiagnosticsComponent.js b/experiments/WebUI/src/components/content/DiagnosticsComponent.js
index 102ff9a..63d12c3 100644
--- a/experiments/WebUI/src/components/content/DiagnosticsComponent.js
+++ b/experiments/WebUI/src/components/content/DiagnosticsComponent.js
@@ -38,9 +38,18 @@ class DiagnosticsComponent extends React.Component {
this.gateway.subscribe(this.gateway.topic('org.arl.jc2.enums.C2Topics.VEHICLESTATUS'));
this.gateway.subscribe(this.gateway.topic('org.arl.jc2.enums.C2Topics.MISSIONSTATUS'));
- const management = new Management(this.gateway);
+ this.management = new Management(this.gateway);
+
+ this.management.getVehicleId()
+ .then(vehicleId => {
+ console.log('vehicleId', vehicleId);
+ this.vehicleId = vehicleId;
+ })
+ .catch(reason => {
+ console.log('could not get vehicle ID', reason);
+ });
- management.getHealth()
+ this.management.getHealth()
.then(response => {
// console.log(response);
this.setState({
@@ -66,7 +75,11 @@ class DiagnosticsComponent extends React.Component {
}
render() {
- document.title = "Diagnostics";
+ if (this.vehicleId) {
+ document.title = this.vehicleId + " Diagnostics";
+ } else {
+ document.title = "Diagnostics";
+ }
// console.log(this.state.diagnostics);
var diagnosticsRows = [];
for (var i = 0; i < this.state.diagnostics.length; i++) {
diff --git a/experiments/WebUI/src/components/content/GaugeDashboard.js b/experiments/WebUI/src/components/content/GaugeDashboard.js
index ebf95d1..2823bce 100644
--- a/experiments/WebUI/src/components/content/GaugeDashboard.js
+++ b/experiments/WebUI/src/components/content/GaugeDashboard.js
@@ -8,6 +8,7 @@ import D3BearingComponent from './D3BearingComponent';
import {FjageHelper} from "../../assets/fjageHelper.js";
import {Message, Performative} from '../../assets/fjage.js';
+import { Management} from "../../assets/jc2.js";
import FrontIcon from '../../assets/img/submarine-front-view.svg';
import SideIcon from '../../assets/img/submarine-side-view.svg';
@@ -135,6 +136,16 @@ class GaugeDashboard extends React.Component {
console.log(msg);
}
});
+
+ this.management = new Management(this.gateway);
+ this.management.getVehicleId()
+ .then(vehicleId => {
+ console.log('vehicleId', vehicleId);
+ this.vehicleId = vehicleId;
+ })
+ .catch(reason => {
+ console.log('could not get vehicle ID', reason);
+ });
}
});
}
@@ -149,7 +160,11 @@ class GaugeDashboard extends React.Component {
}
render() {
- document.title = "Dashboard";
+ if (this.vehicleId) {
+ document.title = this.vehicleId + " Dashboard";
+ } else {
+ document.title = "Dashboard";
+ }
const gaugeContainerStyle = {
padding: "10px",
margin: "5px",
diff --git a/experiments/WebUI/src/components/content/MLegInfoComponent.js b/experiments/WebUI/src/components/content/MLegInfoComponent.js
index 928f27a..07feab7 100644
--- a/experiments/WebUI/src/components/content/MLegInfoComponent.js
+++ b/experiments/WebUI/src/components/content/MLegInfoComponent.js
@@ -1,7 +1,17 @@
import React from 'react';
import { StyleSheet, css } from 'aphrodite';
-import { Table, ListGroup, Tab, FormControl, Button } from 'react-bootstrap';
-
+import { Table, ListGroup, Tab, FormControl, Button, Form } from 'react-bootstrap';
+
+const MissionTypes = [
+ "BioCastMT",
+ "CoopPosMT",
+ "LawnMowerMT",
+ "SimpleMT",
+ "StationKeepingMT",
+ "SwanArmMT",
+ "TargetLocMT",
+ "WaterSampleMT",
+];
const styles = StyleSheet.create({
MLegInfoContainer: {
@@ -76,32 +86,45 @@ class MLegInfoComponent extends React.Component {
this.modifyEditedMissionsArr();
}
+ onMissionTaskEdit(e) {
+ var missionLeg = this.state.missionLeg;
+ this.state.missionLeg[e.target.name] = e.target.value;
+ this.setState({
+ missionLeg: missionLeg
+ });
+ this.modifyEditedMissionsArr();
+ }
+
+ onMissionTypeChange(e) {
+ // console.log(e.target.value);
+ this.props.changeMissionType(e.target.value);
+ this.modifyEditedMissionsArr();
+ }
+
render() {
var propertyTableRows = [];
var paramTableRows = [];
var payloadObject = {};
+ var missionTaskTableRows = [];
+
// var actionButtons = null;
if (this.state.missionLeg !== null) {
//Property table - TODO currently hard coded, find better way to do this.
- propertyTableRows.push(
-
- x |
- this.onPropertyChange(e)} value={this.state.missionLeg.mp.x}> |
-
- );
- propertyTableRows.push(
-
- y |
- this.onPropertyChange(e)} value={this.state.missionLeg.mp.y}> |
-
- );
- propertyTableRows.push(
-
- z |
- this.onPropertyChange(e)} value={this.state.missionLeg.mp.z}> |
-
- );
+
+ var missionPoint = this.state.missionLeg.mp;
+ for (var key in missionPoint) {
+ if (missionPoint.hasOwnProperty(key)) {
+ if (key === "x" || key === "y" || key === "z") {
+ propertyTableRows.push(
+
+ {key} |
+ this.onPropertyChange(e)} value={this.state.missionLeg.mp[key]}> |
+
+ );
+ }
+ }
+ }
// console.log(this.state.missionLeg);
var params = this.state.missionLeg.mp.params;
@@ -118,6 +141,41 @@ class MLegInfoComponent extends React.Component {
}
payloadObject = this.state.missionLeg.payload;
+ var MissionTypeOptions = [];
+
+ var missionTaskObject = this.state.missionLeg;
+ var selectedType = missionTaskObject.taskID.substring(0, missionTaskObject.taskID.indexOf("MT") + 2);
+ MissionTypes.forEach((missionType) => {
+ if (missionType === selectedType) {
+ MissionTypeOptions.push();
+ } else {
+ MissionTypeOptions.push();
+ }
+ });
+
+ for (var key in missionTaskObject) {
+ if (missionTaskObject.hasOwnProperty(key)) {
+ if (key == "taskID") {
+ missionTaskTableRows.push(
+
+ Task Type |
+
+ this.onMissionTypeChange(e)}>
+ {MissionTypeOptions}
+
+ |
+
+ );
+ } else if (key !== "mp" && key !== "payload") {
+ missionTaskTableRows.push(
+
+ {key} |
+ this.onMissionTaskEdit(e)} value={this.state.missionLeg[key]}> |
+
+ );
+ }
+ }
+ }
}
const Properties =
@@ -150,6 +208,19 @@ class MLegInfoComponent extends React.Component {
this.onPayloadChange(e)} value={JSON.stringify(payloadObject, null, 0)}>
;
+
+ const MissionTask =
+
+
+ Name |
+ Value |
+
+
+
+ {missionTaskTableRows}
+
+
;
+
return (
@@ -157,6 +228,7 @@ class MLegInfoComponent extends React.Component {
Property
Parameters
Payload
+ Mission Task
@@ -169,6 +241,9 @@ class MLegInfoComponent extends React.Component {
{Payload}
+
+ {MissionTask}
+
{/* {actionButtons} */}
diff --git a/experiments/WebUI/src/components/content/MapComponent.js b/experiments/WebUI/src/components/content/MapComponent.js
index fd95618..5f53733 100644
--- a/experiments/WebUI/src/components/content/MapComponent.js
+++ b/experiments/WebUI/src/components/content/MapComponent.js
@@ -3,12 +3,13 @@ import { Map as LeafletMap, Marker, Popup, TileLayer, Circle, Polygon, Polyline
import CursorPositionComponent from './CursorPositionComponent';
-import MissionPlanner from './MissionPlanner';
+import MissionTreeViewComponent from './MissionTreeViewComponent';
+import '../../assets/MissionPlanner.css';
import CoordSys from '../../assets/CoordSys.js';
import { FjageHelper } from "../../assets/fjageHelper.js";
-import { Management, TargetLocMT } from "../../assets/jc2.js";
+import { Management } from "../../assets/jc2.js";
import { mapPin, mapPinSelected, readyMarker, notReadyMarker } from "../../assets/MapIcons.js";
// import ManualCommands from '../../assets/ManualCommands.js';
import ToolbarComponent from '../ToolbarComponent';
@@ -65,13 +66,27 @@ function MissionTask() {
this.payload = {};
}
-function SimpleMT() {
- this.taskID = "SimpleMT";
- this.endHeading = 0.0;
+function BioCastMT() {
+ this.taskID = "BioCastMT";
+ this.SourceSLevel = 0.0;
+ this.mtTime = 0;
+ this.resamplingTime = 0;
+ this.sourceX = 0.0;
+ this.sourceY = 0.0;
+ MissionTask.call(this);
+}
+
+function CoopPosMT() {
+ this.taskID = "CoopPosMT";
+ this.lookAheadLevel = [];
+ this.missionNum = [];
+ this.numOfSurveyAuv = 0;
+ this.posInterval = [];
+ this.vehicleID = [];
MissionTask.call(this);
}
-function LawnMoverMT() {
+function LawnMowerMT() {
this.taskID = "LawnMoverMT";
this.xLength = 0.0;
this.yLength = 0.0;
@@ -80,6 +95,38 @@ function LawnMoverMT() {
MissionTask.call(this);
}
+function SimpleMT() {
+ this.taskID = "SimpleMT";
+ this.endHeading = 0.0;
+ MissionTask.call(this);
+}
+
+function StationKeepingMT() {
+ this.taskID = "StationKeepingMT";
+ this.duration = 0.0;
+ MissionTask.call(this);
+}
+
+function SwanArmMT() {
+ this.taskID = "SwanArmMT";
+ this.armDepth = {};
+ this.missionTaskTimeout = {};
+ this.reposeBehavior = {};
+ MissionTask.call(this);
+}
+
+function TargetLocMT() {
+ this.taskID = "TargetLocMT";
+ this.mtTimeOut = 0;
+ MissionTask.call(this);
+}
+
+function WaterSampleMT() {
+ this.taskID = "WaterSampleMT";
+ this.armDepth = 0.0;
+ MissionTask.call(this);
+}
+
class MapComponent extends React.Component {
constructor(props, context) {
super(props, context);
@@ -172,6 +219,8 @@ class MapComponent extends React.Component {
this.abortMission = this.abortMission.bind(this);
this.stationKeep = this.stationKeep.bind(this);
this.goHome = this.goHome.bind(this);
+
+ this.changeMissionType = this.changeMissionType.bind(this);
}
componentDidMount() {
@@ -216,6 +265,7 @@ class MapComponent extends React.Component {
.then(vehicleId => {
console.log('vehicleId', vehicleId);
this.vehicleId = vehicleId;
+ document.title = vehicleId + " StarControl";
})
.catch(reason => {
console.log('could not get vehicle ID', reason);
@@ -301,9 +351,6 @@ class MapComponent extends React.Component {
positionError: this.state.positionError - 1
})},
200);
-
- var x = new TargetLocMT();
- console.log(x);
}
componentDidUpdate() {
@@ -496,6 +543,16 @@ class MapComponent extends React.Component {
var w = window.open(url, tab, "width=600,height=600,menubar=0,toolbar=0,location=0,personalBar=0,status=0,resizable=1").focus();
}
+ closeAllChildWindows(){
+ var windowsArr = ["Dashboard", "Diagnostics", "Sentuators", "ScriptControl"];
+ windowsArr.forEach((tab) => {
+ const href = window.location.href;
+ const url = href.substring(0, href.lastIndexOf('/') + 1) + tab;
+ var w = window.open(url, tab, "width=600,height=600,menubar=0,toolbar=0,location=0,personalBar=0,status=0,resizable=1");
+ w.close();
+ });
+ }
+
checkCollinear(pointArray, point) {
// epsilon accounts for the error in checking if a point is collinear. Larger epsilon will result in wider range of points getting accepted as collinear(even those that lie further from the line segment).
var epsilon = 0.0000005;
@@ -584,7 +641,6 @@ class MapComponent extends React.Component {
}
dragEndGeoFenceMarker(e) {
- // console.log(e);
var newlat = e.target._latlng.lat;
var newlng = e.target._latlng.lng;
var oldlat = e.target.options.position[0];
@@ -640,6 +696,9 @@ class MapComponent extends React.Component {
this.viewMission(this.state.missionNumber);
}
+ onMissionPtClick(i){
+ this.refs.missionTreeView.selectMleg(i+1);
+ }
toggleMissionPlanner(e) {
if (this.state.MissionPlannerEnabled) {
@@ -670,6 +729,46 @@ class MapComponent extends React.Component {
this.management.abortToHome();
}
+ changeMissionType(missionLegIndex, newType) {
+ var currentMissionArr = this.state.currentMission;
+
+ var constructorName = newType + "()";
+ // var mission_task = new window[constructorName]();
+ var mission_task;
+ if (newType === "BioCastMT") {
+ mission_task = new BioCastMT();
+ } else if (newType === "CoopPosMT") {
+ mission_task = new CoopPosMT();
+ } else if (newType === "LawnMowerMT") {
+ mission_task = new LawnMowerMT();
+ } else if (newType === "StationKeepingMT") {
+ mission_task = new StationKeepingMT();
+ } else if (newType === "SwanArmMT") {
+ mission_task = new SwanArmMT();
+ } else if (newType === "TargetLocMT") {
+ mission_task = new TargetLocMT();
+ } else if (newType === "WaterSampleMT") {
+ mission_task = new WaterSampleMT();
+ } else {
+ mission_task = new SimpleMT();
+ }
+
+ var missions = this.state.missions;
+ console.log(mission_task);
+ var oldMissionTask = missions[this.state.missionNumber][missionLegIndex - 1];
+ console.log(oldMissionTask);
+
+ mission_task.mp = oldMissionTask.mp;
+ mission_task.payload = oldMissionTask.payload;
+
+
+ missions[this.state.missionNumber][missionLegIndex - 1] = mission_task;
+
+ this.setState({
+ missions: missions
+ });
+ }
+
render() {
const position = [this.state.vehiclePosition.latitude, this.state.vehiclePosition.longitude];
const mapCenter = [this.state.mapCenter.latitude, this.state.mapCenter.longitude];
@@ -706,7 +805,7 @@ class MapComponent extends React.Component {
);
} else {
MissionPointsMarkers.push(
-
+
Lat: {lat.toFixed(4)}, Long: {long.toFixed(4)}
x: {x.toFixed(4)}, y: {y.toFixed(4)}
@@ -752,7 +851,7 @@ class MapComponent extends React.Component {
const MissionPlannerPanels = (this.state.MissionPlannerEnabled) ?
-
+
:
null;
@@ -785,6 +884,9 @@ class MapComponent extends React.Component {
{missionList}
+
+
+
diff --git a/experiments/WebUI/src/components/content/MissionPlanner.js b/experiments/WebUI/src/components/content/MissionPlanner.js
deleted file mode 100644
index bbd6d59..0000000
--- a/experiments/WebUI/src/components/content/MissionPlanner.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import React from 'react';
-import { StyleSheet, css } from 'aphrodite';
-
-import MissionTreeViewComponent from './MissionTreeViewComponent';
-
-import '../../assets/MissionPlanner.css';
-
-
-class MissionPlanner extends React.Component {
- constructor(props, context) {
- super(props, context);
-
- }
-
-
- render() {
-
- return (
-
-
-
- );
- }
-}
-
-export default MissionPlanner;
diff --git a/experiments/WebUI/src/components/content/MissionTreeViewComponent.js b/experiments/WebUI/src/components/content/MissionTreeViewComponent.js
index 93fdc39..26bab55 100644
--- a/experiments/WebUI/src/components/content/MissionTreeViewComponent.js
+++ b/experiments/WebUI/src/components/content/MissionTreeViewComponent.js
@@ -23,7 +23,7 @@ const styles = StyleSheet.create({
}
});
-class CursorPositionComponent extends React.Component {
+class MissionTreeViewComponent extends React.Component {
constructor(props, context) {
super(props, context);
@@ -34,6 +34,8 @@ class CursorPositionComponent extends React.Component {
selectedMLeg: 0
}
+ this.changeMissionType = this.changeMissionType.bind(this);
+
}
selectMission(index) {
@@ -55,6 +57,7 @@ class CursorPositionComponent extends React.Component {
}
selectMleg(index) {
+ // console.log(index);
this.setState({
selectedMLeg: index
});
@@ -148,6 +151,10 @@ class CursorPositionComponent extends React.Component {
this.props.viewMissionFunc(missionNumber);
}
+ changeMissionType(newType){
+ this.props.changeMissionType(this.state.selectedMLeg, newType);
+ }
+
render() {
var missionList = [];
@@ -161,8 +168,8 @@ class CursorPositionComponent extends React.Component {
mission.forEach((missionLeg, j) => {
var activeMleg = (this.state.selectedMLeg == j+1) ? "active" : "" ;
missionLegList.push(
-
- this.selectMleg(j+1)}>{missionLeg.taskID.substring(0, missionLeg.taskID.indexOf("MT") + 2)} : {missionLeg.mp.x.toFixed(2)}, {missionLeg.mp.y.toFixed(2)}, {missionLeg.mp.z.toFixed(2)}
+ this.selectMleg(j+1)}>
+ {missionLeg.taskID.substring(0, missionLeg.taskID.indexOf("MT") + 2)} : {missionLeg.mp.x.toFixed(2)}, {missionLeg.mp.y.toFixed(2)}, {missionLeg.mp.z.toFixed(2)}
this.deleteMissionPt(i,j)} title="Delete Mission Point"/>
);
@@ -204,10 +211,10 @@ class CursorPositionComponent extends React.Component {
{missionList}
-
+
);
}
}
-export default CursorPositionComponent;
+export default MissionTreeViewComponent;
diff --git a/experiments/WebUI/src/components/content/ScriptControl.js b/experiments/WebUI/src/components/content/ScriptControl.js
index 4c1205c..16ebf36 100644
--- a/experiments/WebUI/src/components/content/ScriptControl.js
+++ b/experiments/WebUI/src/components/content/ScriptControl.js
@@ -76,6 +76,15 @@ class ScriptControl extends React.Component {
this.management = new Management(this.gateway);
+ this.management.getVehicleId()
+ .then(vehicleId => {
+ console.log('vehicleId', vehicleId);
+ this.vehicleId = vehicleId;
+ })
+ .catch(reason => {
+ console.log('could not get vehicle ID', reason);
+ });
+
this.management.getScript()
.then(script => {
// console.log('script', script);
@@ -194,8 +203,11 @@ class ScriptControl extends React.Component {
}
render() {
- document.title = "Script Control";
-
+ if (this.vehicleId) {
+ document.title = this.vehicleId + " Script Control";
+ } else {
+ document.title = "Script Control";
+ }
var subroutines = this.getSubroutines();
var subroutineOptions = [];
subroutines.forEach((subroutine, i) => {
diff --git a/experiments/WebUI/src/components/content/SentuatorsComponent.js b/experiments/WebUI/src/components/content/SentuatorsComponent.js
index d3fd9fc..08bcaa5 100644
--- a/experiments/WebUI/src/components/content/SentuatorsComponent.js
+++ b/experiments/WebUI/src/components/content/SentuatorsComponent.js
@@ -29,6 +29,15 @@ class SentuatorsComponent extends React.Component {
if (connected) {
this.management = new Management(this.gateway);
+ this.management.getVehicleId()
+ .then(vehicleId => {
+ console.log('vehicleId', vehicleId);
+ this.vehicleId = vehicleId;
+ })
+ .catch(reason => {
+ console.log('could not get vehicle ID', reason);
+ });
+
this.management.getSentuators()
.then(response => {
// console.log(response);
@@ -88,7 +97,11 @@ class SentuatorsComponent extends React.Component {
}
render() {
- document.title = "Sentuators";
+ if (this.vehicleId) {
+ document.title = this.vehicleId + " Sentuators";
+ } else {
+ document.title = "Sentuators";
+ }
var selectOptions = [];
const tick = ;
diff --git a/experiments/WebUI/src/components/sidebar/MenuItemComponent.js b/experiments/WebUI/src/components/sidebar/MenuItemComponent.js
deleted file mode 100644
index e5231ab..0000000
--- a/experiments/WebUI/src/components/sidebar/MenuItemComponent.js
+++ /dev/null
@@ -1,61 +0,0 @@
-import React from 'react';
-import { bool, string } from 'prop-types';
-import { Row, Container } from 'react-bootstrap';
-import { StyleSheet, css } from 'aphrodite';
-import { NavLink } from 'react-router-dom';
-
-const styles = StyleSheet.create({
- activeBar: {
- height: 56,
- width: 3,
- backgroundColor: '#DDE2FF',
- position: 'absolute',
- left: 0
- },
- activeContainer: {
- backgroundColor: 'rgba(221,226,255, 0.08)'
- },
- activeTitle: {
- color: '#DDE2FF'
- },
- container: {
- height: 56,
- cursor: 'pointer',
- ':hover': {
- backgroundColor: 'rgba(221,226,255, 0.08)'
- },
- paddingLeft: 32,
- paddingRight: 32
- },
- title: {
- margin: 'auto',
- fontSize: 16,
- lineHeight: '20px',
- letterSpacing: '0.2px',
- color: '#A4A6B3',
- marginLeft: 24
- }
-});
-
-function MenuItemComponent(props){
- const {active, icon, title, ...otherProps} = props;
- // const Icon = icon;
- return (
-
- {/**/}
-
- {active && }
- {title}
-
- {/**/}
-
- );
-}
-
-MenuItemComponent.propTypes = {
- active: bool,
- icon: string,
- title: string
-};
-
-export default MenuItemComponent;
diff --git a/experiments/WebUI/src/components/sidebar/SidebarComponent.js b/experiments/WebUI/src/components/sidebar/SidebarComponent.js
index 8d426e4..ca3e542 100644
--- a/experiments/WebUI/src/components/sidebar/SidebarComponent.js
+++ b/experiments/WebUI/src/components/sidebar/SidebarComponent.js
@@ -1,7 +1,6 @@
import React from 'react';
import { Row, Container, Button } from 'react-bootstrap';
import { StyleSheet, css } from 'aphrodite';
-// import MenuItemComponent from './MenuItemComponent';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faSlidersH } from '@fortawesome/free-solid-svg-icons';