-
Notifications
You must be signed in to change notification settings - Fork 0
Jarius - telemetry update (4/5/2022) #1
base: master
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,22 +6,22 @@ | |||||
|
|
||||||
| <title>Sailbot Dashboard</title> | ||||||
| <meta name="description" content="Recieves and Displays data from WPI Sailbot"> | ||||||
| <meta name="author" content="Sailbot Team 20-21"> | ||||||
| <meta name="author" content="Sailbot Team 20-21 & Sailbot Team 21-22"> | ||||||
|
|
||||||
| <link rel="stylesheet" href="css/dashboard.css"> | ||||||
| <link rel="stylesheet" href="css/simple-grid.min.css"> | ||||||
| <link rel="stylesheet" href="css/foundation.css"> | ||||||
| <link rel="shortcut icon" href="/assets/favicon.ico" type="image/x-icon"> | ||||||
| <link rel="icon" href="/assets/favicon.ico" type="image/x-icon"> | ||||||
| <link rel="shortcut icon" href="../public/assets/favicon.ico" type="image/x-icon"> | ||||||
| <link rel="icon" href="../public/assets/favicon.ico" type="image/x-icon"> | ||||||
| </head> | ||||||
|
|
||||||
| <body> | ||||||
| <!-- Dependencies --> | ||||||
| <script type="text/javascript" src="/js/dependencies/socket.io.min.js"></script> | ||||||
| <script type="text/javascript" src="https://maps.google.com/maps/api/js?key=AIzaSyAqEpMAFofxAxfTmpXh_u_vNm0VDSQ-VqE"></script> | ||||||
| <script type="text/javascript" src="/js/dependencies/d3.min.js" charset="utf-8"></script> | ||||||
| <script type="text/javascript" src="/js/dependencies/d3gauge.js" charset="utf-8"></script> | ||||||
| <script type="text/javascript" src="/js/dependencies/FileSaver.min.js" charset="utf-8"></script> | ||||||
| <script type="text/javascript" src="./js/dependencies/socket.io.min.js"></script> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| <script type="text/javascript" src="https://maps.google.com/maps/api/js?key=AIzaSyANLnjPosvfrcYA9AZRGoknt8qciDAqbz0"></script> | ||||||
| <script type="text/javascript" src="./js/dependencies/d3.min.js" charset="utf-8"></script> | ||||||
| <script type="text/javascript" src="./js/dependencies/d3gauge.js" charset="utf-8"></script> | ||||||
| <script type="text/javascript" src="./js/dependencies/FileSaver.min.js" charset="utf-8"></script> | ||||||
|
|
||||||
| <!-- Componenents --> | ||||||
| <script type="text/javascript" src="js/pitchrollGen.js"></script> | ||||||
|
|
@@ -57,7 +57,25 @@ <h4 class="horiList" style="margin-left: 20px;">Grid Corners:</h4> | |||||
| <div class="grid-container fluid"> | ||||||
| <div id="data-display"> | ||||||
| <div class="grid-x center"> | ||||||
| <div class="cell small-3"></div> | ||||||
| <div class="cell small-2"> | ||||||
| <div id="currentHeading" class=" center"> | ||||||
| <div class="degree"> | ||||||
| <h6 id="currentHeadingAngle" class="font-light">60</h6> | ||||||
| <h6 class="font-light">°</h6> | ||||||
| </div> | ||||||
| <div id="currentHeadingVector" class="vector"></div> | ||||||
| <h6 id="currentHeadingTitle" class="bot-text font-heavy">Current Heading</h6> | ||||||
| </div> | ||||||
| </div> | ||||||
| <div id="intendedHeading" class=" center"> | ||||||
| <div class="degree"> | ||||||
| <h6 id="intendedHeadingAngle" class="font-light">60</h6> | ||||||
| <h6 class="font-light">°</h6> | ||||||
| </div> | ||||||
| <div id="intendedHeadingVector" class="vector"></div> | ||||||
| <h6 id="intendedHeadingTitle" class="bot-text font-heavy">Intended Heading</h6> | ||||||
| </div> | ||||||
|
|
||||||
| <div id="coursetrack" class="datum cell small-2"> | ||||||
| <div id="coursetrackDisp"></div> | ||||||
| <h6 id="coursetrackTitle" class="font-heavy">Course Track Error</h6> | ||||||
|
|
@@ -127,6 +145,7 @@ <h6 id="theoreticalWindTitle" class="bot-text font-heavy">True Wind</h6> | |||||
| </div> | ||||||
| <h6 id="gyroTitle" class="font-heavy">Rate Gyro</h6> | ||||||
| </div> | ||||||
|
|
||||||
| </div> | ||||||
|
|
||||||
| <div class="cell small-4 grid-x"> | ||||||
|
|
@@ -136,6 +155,26 @@ <h6 id="gyroTitle" class="font-heavy">Rate Gyro</h6> | |||||
| <h6 id="pitchrollTitle" class="font-heavy">Pitch and Roll</h6> | ||||||
| </div> | ||||||
| </div> | ||||||
| <div id="batteryVoltage" class="datum cell small-2 small-offset-8 center"> | ||||||
| <div id="batteryVoltageDisp" class="module center" style=" | ||||||
| width: 13vw;"> | ||||||
| <div class="labels"> | ||||||
| <text>Hull Battery:</text> | ||||||
| <text>Hull Status:</text> | ||||||
| <text>Bluetooth:</text> | ||||||
| <text>Trim Battery:</text> | ||||||
| </div> | ||||||
| <div class="values"> | ||||||
| <text id="voltage">14.8 V</text> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we don't actually get a voltage value right now, it might be nice to have an icon or graphic here instead
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. graphic is set |
||||||
| <text id="hull-status">Battery Low.</text> | ||||||
| <text id="btstatus">OK</text> | ||||||
| <text id="trimtab-voltage">5.0 V</text> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't actually get a voltage from the trim tab controller. We get a percentage.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing representation to a % symbol in the next commit |
||||||
|
|
||||||
| </div> | ||||||
| </div> | ||||||
| <h6 id="gyroTitle" class="font-heavy">Electronics Status: </h6> | ||||||
| </div> | ||||||
| </div> | ||||||
| </div> | ||||||
| </div> | ||||||
| </div> | ||||||
|
|
||||||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,11 @@ | ||
| const socket = io(); // socket initialization | ||
| //const socket = io("http://localhost:3000/", { transports: ['polling', 'flashsocket'] }); // socket initialization | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should keep this. This way we won't need to manually change this IP address every time we use a different one.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will be re-implemented using localhost |
||
| //const socket = io("http://192.168.17.20:3000/", { transports: ['polling', 'flashsocket'] }); // socket initialization | ||
| const socket = io("http://192.168.17.19:3000/", { transports: ['polling', 'flashsocket'] }); // socket initialization | ||
| console.log("we think weve connected to port 3000") | ||
| socket.emit('client'); | ||
| socket.on('updateDashboard', (data) => { | ||
| console.log("we do not care"); | ||
| }); | ||
|
|
||
| let counter = 0; | ||
| let dataInterval; | ||
|
|
@@ -31,6 +38,31 @@ while (waypoints.length > 0){ | |
| console.log(boatWaypoints); | ||
| } | ||
|
|
||
| function recalculateSimWaypoints() | ||
| { | ||
| console.log("re-simulating......"); | ||
| boatWaypoints = []; | ||
| let waypoints2 = [ | ||
| { x: 3, y: 6, lat: 42.84780, lng: -70.9849 }, | ||
| { x: 7, y: 6, lat: 42.84780, lng: -70.9809 }, | ||
| { x: 5, y: 4, lat: 42.8499, lng: -70.9829 }, | ||
| { x: 0, y: 4, lat: 42.84964938719152, lng: -70.98783200038395 }, | ||
| ]; | ||
| while (waypoints2.length > 0){ | ||
| let tempDest = waypoints2.shift(); | ||
| console.log(boatStart[0], tempDest); | ||
| let path = runAstar(boatStart, tempDest).reverse() | ||
| waypoints2.length > 1 ? path.pop() : undefined; | ||
| boatWaypoints.push(...path); | ||
| boatStart = [{ weight: 0, ...tempDest }]; // has to be in an array so it looks like a path | ||
| console.log(boatWaypoints); | ||
| } | ||
| } | ||
|
|
||
| function randomizer(multiplier) { | ||
| return (Math.random() * multiplier); | ||
| } | ||
|
|
||
| // getting intermediate points | ||
| // let mockCoords = []; | ||
| // for (let i = 0; i < boatWaypoints.length - 1; i++){ | ||
|
|
@@ -44,25 +76,49 @@ while (waypoints.length > 0){ | |
| // } | ||
| // console.log(mockCoords); | ||
|
|
||
| function dataMaker(){ //the 'simulator' | ||
| var rand_ground_speed = randomizer(25); | ||
|
|
||
| var data_JSON = { | ||
| apparentWind: {speed: 10 + Math.floor(randomizer(50)), direction: Math.floor(randomizer(295))}, | ||
| trueWind: {speed: 10 + Math.floor(randomizer(50)), direction: Math.floor(randomizer(295))}, | ||
| intendedHeading: 60 + Math.floor(randomizer(180)), | ||
| currentHeading: 20 + Math.floor(randomizer(179)), | ||
| magneticSensorHeading: Math.floor(randomizer(360)), | ||
| hullVoltage: Math.floor(randomizer(15)), | ||
| trimtabVoltage:Math.floor(randomizer(5)), | ||
| compass: {x: Math.floor(randomizer(360)), y: Math.floor(randomizer(360)), z: 'garbo'}, | ||
| //airtemp: Math.floor(Math.random() * 35), | ||
| //windchill: Math.floor(Math.random() * 35), | ||
| //pressure: 950 + Math.floor(Math.random() * 100), | ||
| groundspeed: rand_ground_speed, | ||
| gps: {latitude: boatWaypoints[counter].lat, longitude: boatWaypoints[counter].lng}, | ||
| pitchroll: {pitch: 15+Math.floor(randomizer(20)) - 20, roll: Math.floor(Math.random() * 180) - 90}, | ||
| gyro: {phi: Math.floor(randomizer(100000)/1000), theta: Math.floor(randomizer(100000)/1000), psi: Math.floor(randomizer(100000))/1000} | ||
| }; | ||
|
|
||
| return data_JSON; | ||
| } | ||
|
|
||
| // sends data every 500ms | ||
| const sendMockMessages = () => { | ||
| var sendMockMessages = () => { | ||
| // timeout variable holds the timeout | ||
| dataInterval = setInterval(() => {socket.emit('data', { | ||
| apparentWind: {speed: 10 + Math.floor(Math.random() * 50), direction: Math.floor(Math.random() * 295)}, | ||
| theoreticalWind: {speed: 10 + Math.floor(Math.random() * 50), direction: Math.floor(Math.random() * 295)}, | ||
| compass: {x: Math.floor(Math.random() * 360), y: Math.floor(Math.random() * 360), z: 'garbo'}, | ||
| airtemp: Math.floor(Math.random() * 35), | ||
| windchill: Math.floor(Math.random() * 35), | ||
| pressure: 950 + Math.floor(Math.random() * 100), | ||
| groundspeed: Math.floor(Math.random() * 25), | ||
| gps: {latitude: boatWaypoints[counter].lat, longitude: boatWaypoints[counter].lng}, | ||
| pitchroll: {pitch: Math.floor(Math.random() * 20) - 20, roll: Math.floor(Math.random() * 180) - 90}, | ||
| gyro: {phi: Math.floor(Math.random() * 100000)/1000, theta: Math.floor(Math.random() * 100000)/1000, psi: Math.floor(Math.random() * 100000)/1000} | ||
| }); | ||
|
|
||
|
|
||
|
|
||
| dataInterval = setInterval(() => { | ||
| data_JSON = dataMaker(); | ||
| socket.emit('data', data_JSON); | ||
| counter++; | ||
| console.log(boatWaypoints[counter].lat +' '+ boatWaypoints[counter].lng); | ||
| if (typeof boatWaypoints[counter] === 'undefined') { //re-simulate when data runs out! | ||
| recalculateSimWaypoints(); | ||
| counter = 0; | ||
| } | ||
| //console.log(boatWaypoints[counter].lat +' '+ boatWaypoints[counter].lng); | ||
| console.log('counter: ' + counter + "/" + boatWaypoints.length); | ||
| var today = new Date(); | ||
| var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds(); | ||
| console.log(time) | ||
| console.log('lat: ' + boatWaypoints[counter].lat + " long: " + boatWaypoints[counter].lng); | ||
| }, 1000); | ||
|
|
||
| document.querySelector('#message').innerHTML = 'Sending...'; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a relative path you should be able to do the following where applicable:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using this in new commit