From cc4765b8c8b6bac68e6c578ed81b18b487935ac6 Mon Sep 17 00:00:00 2001
From: Angel <roangel@student.ethz.ch>
Date: Wed, 18 Oct 2017 16:25:12 +0200
Subject: [PATCH] added kind of fix for voltage update

---
 .../GUI_Qt/studentGUI/src/MainWindow.cpp      |  6 +--
 .../GUI_Qt/studentGUI/src/MainWindow.ui       | 41 ++++++++++++++++---
 pps_ws/src/d_fall_pps/param/Crazyflie.db      |  2 +-
 3 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp
index 57f10101..ce54c47b 100644
--- a/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp
+++ b/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.cpp
@@ -296,11 +296,11 @@ void MainWindow::updateBatteryVoltage(float battery_voltage)
     // Need to take voltage, display it and transform it to percentage
     // int percentage = (int) fromVoltageToPercent(m_battery_voltage);
 
-    QString qstr = "Raw voltage: ";
+    QString qstr = "";
     qstr.append(QString::number(battery_voltage, 'f', 2));
+    qstr.append(" V");
     ROS_INFO_STREAM("battery voltage " << battery_voltage);
-    ui->raw_voltage->clear();
-    ui->raw_voltage->setText(qstr);
+    ui->voltage_field->setText(qstr);
 }
 
 void MainWindow::CFBatteryCallback(const std_msgs::Float32& msg)
diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.ui b/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.ui
index 57f6f428..3dd33614 100644
--- a/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.ui
+++ b/pps_ws/src/d_fall_pps/GUI_Qt/studentGUI/src/MainWindow.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>1056</width>
-    <height>670</height>
+    <width>1027</width>
+    <height>619</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -1137,6 +1137,12 @@
        </item>
        <item row="1" column="0">
         <widget class="QGroupBox" name="groupBox">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
          <property name="font">
           <font>
            <pointsize>18</pointsize>
@@ -1146,8 +1152,14 @@
           <string>StudentID # connected to CF #</string>
          </property>
          <layout class="QGridLayout" name="gridLayout_2">
-          <item row="0" column="2">
-           <widget class="QLabel" name="raw_voltage">
+          <item row="1" column="0">
+           <widget class="QLabel" name="raw_voltage_label">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
             <property name="font">
              <font>
               <pointsize>18</pointsize>
@@ -1159,6 +1171,25 @@
             </property>
            </widget>
           </item>
+          <item row="1" column="1">
+           <widget class="QLineEdit" name="voltage_field">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>80</width>
+              <height>16777215</height>
+             </size>
+            </property>
+            <property name="readOnly">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
          </layout>
         </widget>
        </item>
@@ -1239,7 +1270,7 @@
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>1056</width>
+     <width>1027</width>
      <height>25</height>
     </rect>
    </property>
diff --git a/pps_ws/src/d_fall_pps/param/Crazyflie.db b/pps_ws/src/d_fall_pps/param/Crazyflie.db
index f18cf79b..ac310142 100644
--- a/pps_ws/src/d_fall_pps/param/Crazyflie.db
+++ b/pps_ws/src/d_fall_pps/param/Crazyflie.db
@@ -1 +1 @@
-5,PPS_CF05,0/32/2M/E7E7E7E705,0,-1.10209,-0.137356,-0.2,0.453276,1.22247,2
+5,PPS_CF05,0/32/2M/E7E7E7E705,0,-0.868587,-0.673046,-0.2,0.686782,0.686782,2
-- 
GitLab