Loading files
069390583This file is pinned to the selected release. Download the original to open it in your design tool.
<template>
<div class="wrapper">
<div class="box header">
<img src="/static/mrover.png" alt="MRover" title="MRover" width="48" height="48" />
<h1>Auton Dashboard</h1>
<div class="spacer"></div>
<div class="comms">
<ul id="vitals">
<li><CommIndicator v-bind:connected="connections.websocket" name="Web Socket" /></li>
<li><CommIndicator v-bind:connected="connections.lcm" name="Rover Connection Status" /></li>
</ul>
</div>
<div class="spacer"></div>
<div class="help">
<img src="/static/help.png" alt="Help" title="Help" width="48" height="48" />
</div>
<div class="helpscreen"></div>
<div class="helpimages" style="display: flex; align-items: center; justify-content: space-evenly">
<img v-if="controlMode === 'arm'" src="/static/arm.png" alt="Robot Arm" title="Robot Arm Controls" style="width: auto; height: 70%; display: inline-block" />
<img v-else-if="controlMode === 'soil_ac'" src="/static/soil_ac.png" alt="Soil Acquisition" title="Soil Acquisition Controls" style="width: auto; height: 70%; display: inline-block" />
<img src="/static/joystick.png" alt="Joystick" title="Joystick Controls" style="width: auto; height: 70%; display: inline-block" />
</div>
</div>
<div class="box1 data">
<div class="box cameras light-bg">
<Cameras/>
</div>
<div class="box light-bg">
<br/>
<RawSensorData v-bind:GPS="GPS" v-bind:IMU="IMU" v-bind:TargetList="TargetList" v-bind:Obstacle="Obstacle" v-bind:RadioSignalStrength="RadioSignalStrength"/>
<RadioSignalStrength v-bind:RadioSignalStrength="RadioSignalStrength"/>
<Obstacle v-bind:Obstacle="Obstacle"/>
<TargetList v-bind:TargetList="TargetList"/>
<DriveVelDataH/>
</div>
<!--div class="box2">
< <div class="box odom light-bg">
<OdometryReading v-bind:odom="odom"/>
</div> >
</div-->
</div>
<div class="box map light-bg">
<RoverMap v-bind:odom="odom"/>
</div>
<div class="box waypoints light-bg">
<WaypointEditor v-bind:odom="odom" v-bind:repeater_dropped="repeater_dropped" v-bind:Joystick="Joystick"/>
</div>
<!-- <div class="box raw_sensors light-bg">
<RawSensorData v-bind:GPS="GPS" v-bind:IMU="IMU"/>
</div> -->
</div>
</template>
<script>
import { mapGetters, mapMutations } from 'vuex'
import Cameras from './Cameras.vue'
import RoverMap from './RoverMapAuton.vue'
import CommIndicator from './CommIndicator.vue'
import RadioSignalStrength from './RadioSignalStrength.vue'
// import OdometryReading from './OdometryReading.vue'
import ArmControls from './ArmControls.vue'
import DriveControls from './DriveControls.vue'
import EncoderCounts from './EncoderCounts.vue'
import WaypointEditor from './WaypointEditor_Auton.vue'
// import AutonJoystickReading from './AutonJoystickReading.vue'
import RawSensorData from './RawSensorData.vue'
import LCMBridge from 'lcm_bridge_client/dist/bridge.js'
import Obstacle from './Obstacle.vue'
import TargetList from './TargetList.vue'
import DriveVelDataH from './DriveVelDataH.vue'
let interval;
export default {
name: 'AutonTask',
data () {
return {
lcm_: null,
odom: {
latitude_deg: 38,
latitude_min: 24.38226,
longitude_deg: -110,
longitude_min: -47.51724,
bearing_deg: 0,
speed: 0
},
connections: {
websocket: false,
lcm: false
},
nav_status: {
completed_wps: 0,
total_wps: 0
},
GPS: {
latitude_deg: 38,
latitude_min: 24.38226,
longitude_deg: -110,
longitude_min: -47.51724,
bearing_deg: 0,
speed: 0
},
Obstacle: {
detected: false,
bearing: 0,
distance: 0
},
TargetList: {
targetList: [{bearing: 0, distance: 0, id: 0},
{bearing: 0, distance: 0, id: 0}]
},
Joystick: {
forward_back: 0,
left_right: 0,
dampen: 0,
kill: false,
restart: false
},
IMU: {
accel_x: 0,
accel_y: 0,
accel_z: 0,
gyro_x: 0,
gyro_y: 0,
gyro_z: 0,
mag_x: 0,
mag_y: 0,
mag_z: 0,
bearing: 0
},
RadioSignalStrength: {
signal_strength: '0'
}
}
},
methods: {
publish: function (channel, payload) {
this.lcm_.publish(channel, payload)
},
subscribe: function (channel, callbackFn) {
if( (typeof callbackFn !== "function") || (callbackFn.length !== 1)) {
console.error("Callback Function is invalid (should take 1 parameter)")
}
this.lcm_.subscribe(channel, callbackFn)
}
},
computed: {
...mapGetters('autonomy', {
autonEnabled: 'autonEnabled'
}),
...mapGetters('controls', {
controlMode: 'controlMode'
}),
},
created: function () {
this.lcm_ = new LCMBridge(
'ws://localhost:8001',
// Update WebSocket connection state
(online) => {
this.lcm_.setHomePage()
this.connections.websocket = online
},
// Update connection states
(online) => {
this.connections.lcm = online[0]
},
// Subscribed LCM message received
(msg) => {
if (msg.topic === '/odometry') {
this.odom = msg.message
} else if (msg.topic === '/gps') {
this.GPS = msg.message
} else if (msg.topic === '/imu') {
this.IMU = msg.message
} else if (msg.topic === '/radio') {
this.RadioSignalStrength.signal_strength = msg.message.signal_strength.toFixed(1)
}else if (msg.topic === '/autonomous') {
this.Joystick = msg.message
} else if (msg.topic === '/rr_drop_complete') {
this.repeater_dropped = true
} else if (msg.topic === '/obstacle') {
this.Obstacle = msg.message
} else if (msg.topic === '/target_list') {
this.TargetList = msg.message
} else if (msg.topic === '/debugMessage') {
if (msg['message']['isError']) {
console.error(msg['message']['message'])
} else {
console.log(msg['message']['message'])
}
}
},
// Subscriptions
[
{'topic': '/odometry', 'type': 'Odometry'},
{'topic': '/autonomous', 'type': 'Joystick'},
{'topic': '/encoder', 'type': 'Encoder'},
{'topic': '/nav_status', 'type': 'NavStatus'},
{'topic': '/gps', 'type': 'GPS'},
{'topic': '/imu', 'type': 'IMU'},
{'topic': '/rr_drop_complete', 'type': 'RepeaterDropComplete'},
{'topic': '/debugMessage', 'type': 'DebugMessage'},
{'topic': '/obstacle', 'type': 'Obstacle'},
{'topic': '/radio', 'type': 'RadioSignalStrength'},
{'topic': '/target_list', 'type': 'TargetList'},
{'topic': '/drive_vel_data', 'type': 'DriveVelData'},
{'topic': '/drive_state_data', 'type': 'DriveStateData'}
]
)
},
components: {
RoverMap,
Cameras,
CommIndicator,
ArmControls,
DriveControls,
EncoderCounts,
// OdometryReading,
// AutonJoystickReading,
RawSensorData,
WaypointEditor,
RadioSignalStrength,
Obstacle,
TargetList,
DriveVelDataH
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.wrapper {
display: grid;
overflow:hidden;
min-height: 98vh;
grid-gap: 10px;
grid-template-columns: 1fr 1fr;
grid-template-rows: 50px 2fr 1fr 30vh;
grid-template-areas: "header header"
"map waypoints"
"map waypoints"
"data waypoints";
font-family: sans-serif;
height: auto;
}
.box {
border-radius: 5px;
padding: 10px;
border: 1px solid black;
}
.box1 {
border-radius: 5px;
background-color: LightGrey;
padding: 10px;
border: 1px solid black;
overflow-y: scroll;
}
.box2 {
display: block;
}
.light-bg {
background-color: LightGrey;
}
img {
border: none;
border-radius: 0px;
}
.header {
grid-area: header;
display: flex;
align-items: center;
}
.header h1 {
margin-left: 5px;
}
.spacer {
flex-grow: 0.8;
}
.comms {
display: flex;
flex-direction: column;
align-items: flex-start;
}
.comms * {
margin-top: 2px;
margin-bottom: 2px;
}
.helpscreen {
z-index: 1000000000;
display: block;
visibility: hidden;
background-color: black;
opacity: 0.8;
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.helpimages {
z-index: 1000000001;
visibility: hidden;
position: absolute;
left: 5%;
top: 5%;
width: 90%;
height: 90%;
}
.help {
z-index: 1000000002;
display: flex;
float: right;
opacity: 0.8;
cursor: auto;
}
.help:hover {
opacity: 1.0;
cursor: pointer;
}
.help:hover ~ .helpscreen, .help:hover ~ .helpimages {
visibility: visible;
}
.odom {
font-size: 1em;
height: 41%;
display: inline-block;
}
.cameras{
width: 97%;
height: 85%;
}
.diags {
grid-area: diags;
}
.map {
grid-area: map;
}
.waypoints {
grid-area: waypoints;
}
.Joystick {
font-size: 1em;
height: 41%;
width: 93%;
display: inline-block;
}
.raw_sensors{
font-size: 1em;
height: 100px;
}
.GPS{
grid-area: gps;
}
.IMU{
grid-area: imu;
}
.radio_repeater {
font-size: 1em;
height: 100px;
}
.controls {
font-size: 1em;
height: 40.5%;
display: block;
}
ul#vitals li {
display: inline;
float: left;
padding: 0px 10px 0px 0px;
}
</style>