From dd4a10ddda96a200b9e54471c6558f1a5ed5d919 Mon Sep 17 00:00:00 2001 From: Cameron Tressler Date: Wed, 1 Jun 2022 10:25:23 -0400 Subject: [PATCH] [teleop] fix generate report (#1135) --- .../gui/src/components/Chlorophyll.vue | 32 +++++++------------ .../gui/src/components/GenerateReport.vue | 12 +++---- base_station/gui/src/components/ISHTask.vue | 32 +++++++++++++++++-- 3 files changed, 48 insertions(+), 28 deletions(-) diff --git a/base_station/gui/src/components/Chlorophyll.vue b/base_station/gui/src/components/Chlorophyll.vue index 47904aba8a..c0fdd14d47 100644 --- a/base_station/gui/src/components/Chlorophyll.vue +++ b/base_station/gui/src/components/Chlorophyll.vue @@ -53,21 +53,21 @@ Spec 1 - {{ spectral_1_conversion(spectral_data.d1_1).toFixed(0) }} - {{ spectral_1_conversion(spectral_data.d1_2).toFixed(0) }} - {{ spectral_1_conversion(spectral_data.d1_3).toFixed(0) }} - {{ spectral_1_conversion(spectral_data.d1_4).toFixed(0) }} - {{ spectral_1_conversion(spectral_data.d1_5).toFixed(0) }} - {{ spectral_1_conversion(spectral_data.d1_6).toFixed(0) }} + {{ spectral_data.d1_1.toFixed(0) }} + {{ spectral_data.d1_2.toFixed(0) }} + {{ spectral_data.d1_3.toFixed(0) }} + {{ spectral_data.d1_4.toFixed(0) }} + {{ spectral_data.d1_5.toFixed(0) }} + {{ spectral_data.d1_6.toFixed(0) }} Spec 2 - {{ spectral_2_conversion(spectral_data.d2_1).toFixed(0) }} - {{ spectral_2_conversion(spectral_data.d2_2).toFixed(0) }} - {{ spectral_2_conversion(spectral_data.d2_3).toFixed(0) }} - {{ spectral_2_conversion(spectral_data.d2_4).toFixed(0) }} - {{ spectral_2_conversion(spectral_data.d2_5).toFixed(0) }} - {{ spectral_2_conversion(spectral_data.d2_6).toFixed(0) }} + {{ spectral_data.d2_1.toFixed(0) }} + {{ spectral_data.d2_2.toFixed(0) }} + {{ spectral_data.d2_3.toFixed(0) }} + {{ spectral_data.d2_4.toFixed(0) }} + {{ spectral_data.d2_5.toFixed(0) }} + {{ spectral_data.d2_6.toFixed(0) }} @@ -114,14 +114,6 @@ export default { 'device': id, 'enable': enabled }) - }, - - spectral_1_conversion: function(sensor_reading) { - return (1 / 0.94) * (sensor_reading - 23.28) - }, - - spectral_2_conversion: function(sensor_reading) { - return (1 / 0.9969) * (sensor_reading + 32.8575) } }, components: { diff --git a/base_station/gui/src/components/GenerateReport.vue b/base_station/gui/src/components/GenerateReport.vue index bb40312940..eed33e31fe 100644 --- a/base_station/gui/src/components/GenerateReport.vue +++ b/base_station/gui/src/components/GenerateReport.vue @@ -24,12 +24,12 @@ export default { const timeString = time.toTimeString().substring(0,17) +" "+time.toDateString() this.csvFileData = [ - [timeString, spectral_data.d0_1, spectral_data.d1_1, spectral_data.d2_1], - [timeString, spectral_data.d0_2, spectral_data.d1_2, spectral_data.d2_2], - [timeString, spectral_data.d0_3, spectral_data.d1_3, spectral_data.d2_3], - [timeString, spectral_data.d0_4, spectral_data.d1_4, spectral_data.d2_4], - [timeString, spectral_data.d0_5, spectral_data.d1_5, spectral_data.d2_5], - [timeString, spectral_data.d0_6, spectral_data.d1_6, spectral_data.d2_6] + [timeString, spectral_data.d0_1.toFixed(0), spectral_data.d1_1.toFixed(0), spectral_data.d2_1.toFixed(0)], + [timeString, spectral_data.d0_2.toFixed(0), spectral_data.d1_2.toFixed(0), spectral_data.d2_2.toFixed(0)], + [timeString, spectral_data.d0_3.toFixed(0), spectral_data.d1_3.toFixed(0), spectral_data.d2_3.toFixed(0)], + [timeString, spectral_data.d0_4.toFixed(0), spectral_data.d1_4.toFixed(0), spectral_data.d2_4.toFixed(0)], + [timeString, spectral_data.d0_5.toFixed(0), spectral_data.d1_5.toFixed(0), spectral_data.d2_5.toFixed(0)], + [timeString, spectral_data.d0_6.toFixed(0), spectral_data.d1_6.toFixed(0), spectral_data.d2_6.toFixed(0)] ]; //define the heading for each row of the data diff --git a/base_station/gui/src/components/ISHTask.vue b/base_station/gui/src/components/ISHTask.vue index 73e2a6635b..f62c3f2c13 100644 --- a/base_station/gui/src/components/ISHTask.vue +++ b/base_station/gui/src/components/ISHTask.vue @@ -100,6 +100,14 @@ export default { console.error("Callback Function is invalid (should take 1 parameter)") } this.lcm_.subscribe(channel, callbackFn) + }, + + spectral_1_conversion: function(sensor_reading) { + return (1 / 0.94) * (sensor_reading - 23.28) + }, + + spectral_2_conversion: function(sensor_reading) { + return (1 / 0.9969) * (sensor_reading + 32.8575) } }, @@ -122,8 +130,28 @@ export default { // Subscribed LCM message received (msg) => { if (msg.topic ==='/spectral_data'){ - this.spectral_data = msg.message - } else if (msg.topic ==='/thermistor_data'){ + this.spectral_data.d0_1 = msg.message.d0_1 + this.spectral_data.d0_2 = msg.message.d0_2 + this.spectral_data.d0_3 = msg.message.d0_3 + this.spectral_data.d0_4 = msg.message.d0_4 + this.spectral_data.d0_5 = msg.message.d0_5 + this.spectral_data.d0_6 = msg.message.d0_6 + + this.spectral_data.d1_1 = this.spectral_1_conversion(msg.message.d1_1) + this.spectral_data.d1_2 = this.spectral_1_conversion(msg.message.d1_2) + this.spectral_data.d1_3 = this.spectral_1_conversion(msg.message.d1_3) + this.spectral_data.d1_4 = this.spectral_1_conversion(msg.message.d1_4) + this.spectral_data.d1_5 = this.spectral_1_conversion(msg.message.d1_5) + this.spectral_data.d1_6 = this.spectral_1_conversion(msg.message.d1_6) + + this.spectral_data.d2_1 = this.spectral_2_conversion(msg.message.d2_1) + this.spectral_data.d2_2 = this.spectral_2_conversion(msg.message.d2_2) + this.spectral_data.d2_3 = this.spectral_2_conversion(msg.message.d2_3) + this.spectral_data.d2_4 = this.spectral_2_conversion(msg.message.d2_4) + this.spectral_data.d2_5 = this.spectral_2_conversion(msg.message.d2_5) + this.spectral_data.d2_6 = this.spectral_2_conversion(msg.message.d2_6) + } + else if (msg.topic ==='/thermistor_data'){ this.thermistor_data = msg.message } },