From 5ba9ddbf8548d0d1c268c4956ff9701e007d6b06 Mon Sep 17 00:00:00 2001
From: Paul Beuchat <beuchatp@control.ee.ethz.ch>
Date: Thu, 28 Nov 2019 06:31:52 +0100
Subject: [PATCH] Updates to the CS1 GUI

---
 .../forms/csonecontrollertab.ui               | 575 +++++++++++++-----
 .../include/csonecontrollertab.h              |   6 +-
 .../flyingAgentGUI/src/csonecontrollertab.cpp | 117 +++-
 3 files changed, 539 insertions(+), 159 deletions(-)

diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/csonecontrollertab.ui b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/csonecontrollertab.ui
index d1a886d8..0c954eb7 100644
--- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/csonecontrollertab.ui
+++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/forms/csonecontrollertab.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>1494</width>
-    <height>597</height>
+    <width>1891</width>
+    <height>1336</height>
    </rect>
   </property>
   <property name="font">
@@ -35,28 +35,6 @@
      </property>
     </spacer>
    </item>
-   <item row="4" column="0">
-    <widget class="QChartView" name="chartView_for_x">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="minimumSize">
-      <size>
-       <width>0</width>
-       <height>0</height>
-      </size>
-     </property>
-     <property name="maximumSize">
-      <size>
-       <width>16777215</width>
-       <height>16777215</height>
-      </size>
-     </property>
-    </widget>
-   </item>
    <item row="1" column="0">
     <widget class="Line" name="line">
      <property name="orientation">
@@ -119,50 +97,82 @@
      </item>
     </layout>
    </item>
+   <item row="5" column="0">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="4" column="0">
+    <widget class="QChartView" name="chartView_for_x">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>16777215</height>
+      </size>
+     </property>
+    </widget>
+   </item>
    <item row="0" column="0">
     <layout class="QGridLayout" name="gridLayout">
-     <property name="rightMargin">
+     <property name="topMargin">
       <number>50</number>
      </property>
-     <item row="6" column="2">
-      <widget class="QPushButton" name="perform_step_button">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
+     <property name="rightMargin">
+      <number>0</number>
+     </property>
+     <item row="0" column="4">
+      <spacer name="horizontalSpacer_3">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
        </property>
-       <property name="maximumSize">
+       <property name="sizeType">
+        <enum>QSizePolicy::Fixed</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
         <size>
-         <width>1000</width>
-         <height>60</height>
+         <width>100</width>
+         <height>20</height>
         </size>
        </property>
-       <property name="text">
-        <string>Perform Step</string>
-       </property>
-      </widget>
+      </spacer>
      </item>
-     <item row="6" column="0">
-      <widget class="QPushButton" name="set_controller_parameters_button">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="maximumSize">
-        <size>
-         <width>1000</width>
-         <height>60</height>
-        </size>
+     <item row="0" column="0">
+      <widget class="QLabel" name="label_lead_compenstor">
+       <property name="font">
+        <font>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
        </property>
        <property name="text">
-        <string>Set</string>
+        <string>Lead Compensator</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
        </property>
       </widget>
      </item>
-     <item row="5" column="3">
+     <item row="0" column="6">
       <spacer name="horizontalSpacer_2">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
@@ -175,49 +185,155 @@
        </property>
       </spacer>
      </item>
-     <item row="5" column="0">
-      <layout class="QGridLayout" name="gridLayout_3">
-       <property name="leftMargin">
-        <number>0</number>
-       </property>
-       <property name="topMargin">
-        <number>0</number>
-       </property>
-       <property name="rightMargin">
-        <number>0</number>
-       </property>
-       <property name="bottomMargin">
-        <number>0</number>
-       </property>
-       <item row="1" column="2">
-        <widget class="QLineEdit" name="lineEdit_alpha">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
+     <item row="1" column="0">
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <layout class="QGridLayout" name="gridLayout_3">
+         <property name="leftMargin">
+          <number>0</number>
          </property>
-         <property name="maximumSize">
-          <size>
-           <width>180</width>
-           <height>60</height>
-          </size>
+         <property name="topMargin">
+          <number>0</number>
          </property>
-         <property name="font">
-          <font>
-           <family>Courier</family>
-          </font>
+         <property name="rightMargin">
+          <number>0</number>
          </property>
-         <property name="text">
-          <string>1.0</string>
+         <property name="bottomMargin">
+          <number>0</number>
          </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-         </property>
-        </widget>
+         <item row="1" column="2">
+          <widget class="QLineEdit" name="lineEdit_alpha">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>180</width>
+             <height>60</height>
+            </size>
+           </property>
+           <property name="font">
+            <font>
+             <family>Courier</family>
+            </font>
+           </property>
+           <property name="text">
+            <string>0.1</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="QLabel" name="label_T">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>T</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="2">
+          <widget class="QLabel" name="label_alpha">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>alpha</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0">
+          <widget class="QLineEdit" name="lineEdit_k">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>180</width>
+             <height>60</height>
+            </size>
+           </property>
+           <property name="font">
+            <font>
+             <family>Courier</family>
+            </font>
+           </property>
+           <property name="text">
+            <string>0.2</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QLineEdit" name="lineEdit_T">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>180</width>
+             <height>60</height>
+            </size>
+           </property>
+           <property name="font">
+            <font>
+             <family>Courier</family>
+            </font>
+           </property>
+           <property name="text">
+            <string>1.5</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="0">
+          <widget class="QLabel" name="label_k">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>k</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignCenter</set>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </item>
-       <item row="1" column="0">
-        <widget class="QLineEdit" name="lineEdit_k">
+       <item>
+        <widget class="QPushButton" name="set_lead_compensator_parameters_button">
          <property name="sizePolicy">
           <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
            <horstretch>0</horstretch>
@@ -226,25 +342,21 @@
          </property>
          <property name="maximumSize">
           <size>
-           <width>180</width>
+           <width>1000</width>
            <height>60</height>
           </size>
          </property>
-         <property name="font">
-          <font>
-           <family>Courier</family>
-          </font>
-         </property>
          <property name="text">
-          <string>0.1</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+          <string>Set</string>
          </property>
         </widget>
        </item>
-       <item row="1" column="1">
-        <widget class="QLineEdit" name="lineEdit_T">
+      </layout>
+     </item>
+     <item row="1" column="2">
+      <layout class="QGridLayout" name="gridLayout_6">
+       <item row="1" column="0">
+        <widget class="QPushButton" name="set_pd_controller_parameters_button">
          <property name="sizePolicy">
           <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
            <horstretch>0</horstretch>
@@ -253,25 +365,142 @@
          </property>
          <property name="maximumSize">
           <size>
-           <width>180</width>
+           <width>1000</width>
            <height>60</height>
           </size>
          </property>
-         <property name="font">
-          <font>
-           <family>Courier</family>
-          </font>
-         </property>
          <property name="text">
-          <string>1.0</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+          <string>Set</string>
          </property>
         </widget>
        </item>
        <item row="0" column="0">
-        <widget class="QLabel" name="label_k">
+        <layout class="QGridLayout" name="gridLayout_5">
+         <property name="rightMargin">
+          <number>0</number>
+         </property>
+         <item row="0" column="2">
+          <widget class="QLabel" name="label_kd">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>k_d</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="QLabel" name="label_kp">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="text">
+            <string>k_p</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="2">
+          <widget class="QLineEdit" name="lineEdit_kd">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>240</width>
+             <height>60</height>
+            </size>
+           </property>
+           <property name="font">
+            <font>
+             <family>Courier</family>
+            </font>
+           </property>
+           <property name="text">
+            <string>0.2</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QLineEdit" name="lineEdit_kp">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>240</width>
+             <height>60</height>
+            </size>
+           </property>
+           <property name="font">
+            <font>
+             <family>Courier</family>
+            </font>
+           </property>
+           <property name="text">
+            <string>0.5</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </item>
+     <item row="0" column="5">
+      <widget class="QLabel" name="label_step_details">
+       <property name="font">
+        <font>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="text">
+        <string>Step Details</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="5">
+      <layout class="QGridLayout" name="gridLayout_4">
+       <property name="leftMargin">
+        <number>0</number>
+       </property>
+       <property name="topMargin">
+        <number>0</number>
+       </property>
+       <property name="rightMargin">
+        <number>0</number>
+       </property>
+       <property name="bottomMargin">
+        <number>0</number>
+       </property>
+       <item row="0" column="0">
+        <widget class="QLabel" name="label_step_size">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
            <horstretch>0</horstretch>
@@ -279,7 +508,7 @@
           </sizepolicy>
          </property>
          <property name="text">
-          <string>k</string>
+          <string>Size</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignCenter</set>
@@ -287,7 +516,7 @@
         </widget>
        </item>
        <item row="0" column="1">
-        <widget class="QLabel" name="label_T">
+        <widget class="QLabel" name="label_step_duration">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
            <horstretch>0</horstretch>
@@ -295,63 +524,59 @@
           </sizepolicy>
          </property>
          <property name="text">
-          <string>T</string>
+          <string>Duraion</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignCenter</set>
          </property>
         </widget>
        </item>
-       <item row="0" column="2">
-        <widget class="QLabel" name="label_alpha">
+       <item row="1" column="0">
+        <widget class="QLineEdit" name="lineEdit_step_size">
          <property name="sizePolicy">
-          <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+          <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
            <horstretch>0</horstretch>
            <verstretch>0</verstretch>
           </sizepolicy>
          </property>
+         <property name="maximumSize">
+          <size>
+           <width>300</width>
+           <height>60</height>
+          </size>
+         </property>
          <property name="text">
-          <string>alpha</string>
+          <string>0.2</string>
          </property>
          <property name="alignment">
-          <set>Qt::AlignCenter</set>
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
          </property>
         </widget>
        </item>
-      </layout>
-     </item>
-     <item row="5" column="2">
-      <layout class="QGridLayout" name="gridLayout_4">
-       <property name="leftMargin">
-        <number>0</number>
-       </property>
-       <property name="topMargin">
-        <number>0</number>
-       </property>
-       <property name="rightMargin">
-        <number>0</number>
-       </property>
-       <property name="bottomMargin">
-        <number>0</number>
-       </property>
-       <item row="0" column="0">
-        <widget class="QLabel" name="label_step_size">
+       <item row="1" column="1">
+        <widget class="QLineEdit" name="lineEdit_step_duration">
          <property name="sizePolicy">
-          <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+          <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
            <horstretch>0</horstretch>
            <verstretch>0</verstretch>
           </sizepolicy>
          </property>
+         <property name="maximumSize">
+          <size>
+           <width>300</width>
+           <height>60</height>
+          </size>
+         </property>
          <property name="text">
-          <string>Step Size</string>
+          <string>20</string>
          </property>
          <property name="alignment">
-          <set>Qt::AlignCenter</set>
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
          </property>
         </widget>
        </item>
-       <item row="1" column="0">
-        <widget class="QLineEdit" name="lineEdit_step_size">
+       <item row="2" column="0">
+        <widget class="QPushButton" name="perform_step_button">
          <property name="sizePolicy">
           <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
            <horstretch>0</horstretch>
@@ -360,21 +585,37 @@
          </property>
          <property name="maximumSize">
           <size>
-           <width>16777215</width>
+           <width>1000</width>
            <height>60</height>
           </size>
          </property>
          <property name="text">
-          <string>0.2</string>
+          <string>Perform</string>
          </property>
-         <property name="alignment">
-          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </widget>
+       </item>
+       <item row="2" column="1">
+        <widget class="QPushButton" name="log_data_button">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>1000</width>
+           <height>60</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Log</string>
          </property>
         </widget>
        </item>
       </layout>
      </item>
-     <item row="5" column="1">
+     <item row="0" column="1">
       <spacer name="horizontalSpacer">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
@@ -384,12 +625,28 @@
        </property>
        <property name="sizeHint" stdset="0">
         <size>
-         <width>188</width>
+         <width>100</width>
          <height>20</height>
         </size>
        </property>
       </spacer>
      </item>
+     <item row="0" column="2">
+      <widget class="QLabel" name="label_lead_compenstor_2">
+       <property name="font">
+        <font>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
+       <property name="text">
+        <string>PD Controller</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignCenter</set>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
   </layout>
@@ -401,6 +658,20 @@
    <header>QtCharts</header>
   </customwidget>
  </customwidgets>
+ <tabstops>
+  <tabstop>lineEdit_k</tabstop>
+  <tabstop>lineEdit_T</tabstop>
+  <tabstop>lineEdit_alpha</tabstop>
+  <tabstop>lineEdit_kp</tabstop>
+  <tabstop>lineEdit_kd</tabstop>
+  <tabstop>lineEdit_step_size</tabstop>
+  <tabstop>lineEdit_step_duration</tabstop>
+  <tabstop>set_lead_compensator_parameters_button</tabstop>
+  <tabstop>set_pd_controller_parameters_button</tabstop>
+  <tabstop>perform_step_button</tabstop>
+  <tabstop>log_data_button</tabstop>
+  <tabstop>chartView_for_x</tabstop>
+ </tabstops>
  <resources/>
  <connections/>
 </ui>
diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/csonecontrollertab.h b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/csonecontrollertab.h
index 445ebdd3..c4c4aefd 100644
--- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/csonecontrollertab.h
+++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/include/csonecontrollertab.h
@@ -109,11 +109,15 @@ private slots:
     void on_lineEdit_k_returnPressed();
     void on_lineEdit_T_returnPressed();
     void on_lineEdit_alpha_returnPressed();
+    void on_lineEdit_kp_returnPressed();
+    void on_lineEdit_kd_returnPressed();
     void on_lineEdit_step_size_returnPressed();
+    void on_lineEdit_step_duration_returnPressed();
 
-    void on_set_controller_parameters_button_clicked();
+    void on_set_lead_compensator_parameters_button_clicked();
 
     void on_perform_step_button_clicked();
+    void on_log_data_button_clicked();
 
 
 
diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/csonecontrollertab.cpp b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/csonecontrollertab.cpp
index 0e0ea299..e2b06377 100644
--- a/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/csonecontrollertab.cpp
+++ b/dfall_ws/src/dfall_pkg/GUI_Qt/flyingAgentGUI/src/csonecontrollertab.cpp
@@ -179,9 +179,41 @@ void CsoneControllerTab::on_perform_step_button_clicked()
     // Set the flag that a step should be performed
     m_shouldPerformStep = true;
 
-    // Set the time back to zero
+    // Set the time back to be less than zero
     m_time_for_step = -1.0;
 
+    // Set the minimum of the x-axis to agree with this
+    ui->chartView_for_x->chart()->axisX()->setMin(m_time_for_step);
+
+    // Update the duration from the field
+    if(!ui->lineEdit_step_duration->text().isEmpty())
+    {
+        float temp_duration = (ui->lineEdit_step_duration->text()).toFloat();
+        // Ensure that it is in the range [2,60]
+        if (temp_duration < 2.0)
+        {
+            temp_duration = 2.0;
+            ui->lineEdit_step_duration->setText(QString::number( temp_duration, 'f', 0));
+        }
+        else if (temp_duration > 60.0)
+        {
+            temp_duration = 60.0;
+            ui->lineEdit_step_duration->setText(QString::number( temp_duration, 'f', 0));
+        }
+        // Update the global variable
+        m_step_response_data_recording_duration = temp_duration;
+    }
+    else
+    {
+        // Default the duration to 10
+        m_step_response_data_recording_duration = 10.0;
+        ui->lineEdit_step_duration->setText(QString::number( m_step_response_data_recording_duration, 'f', 0));
+    }
+
+    // Set the minimum of the x-axis to agree with the duration
+    ui->chartView_for_x->chart()->axisX()->setMax(m_step_response_data_recording_duration);
+
+
     // Clear any data from the line series
     m_lineSeries_for_setpoint_x->removePoints(0,m_lineSeries_for_setpoint_x->count());
     m_lineSeries_for_measured_x->removePoints(0,m_lineSeries_for_measured_x->count());
@@ -198,8 +230,66 @@ void CsoneControllerTab::on_perform_step_button_clicked()
 #endif
 }
 
+void CsoneControllerTab::on_log_data_button_clicked()
+{
+    // Lock the mutex
+    m_chart_mutex.lock();
+
+    // Set the flag that a step should be performed
+    m_shouldPerformStep = false;
 
-void CsoneControllerTab::on_set_controller_parameters_button_clicked()
+    // Set the time back to zero
+    m_time_for_step = 0.0;
+
+    // Set the minimum of the x-axis to agree with this
+    ui->chartView_for_x->chart()->axisX()->setMin(m_time_for_step);
+
+    // Update the duration from the field
+    if(!ui->lineEdit_step_duration->text().isEmpty())
+    {
+        float temp_duration = (ui->lineEdit_step_duration->text()).toFloat();
+        // Ensure that it is in the range [2,60]
+        if (temp_duration < 2.0)
+        {
+            temp_duration = 2.0;
+            ui->lineEdit_step_duration->setText(QString::number( temp_duration, 'f', 0));
+        }
+        else if (temp_duration > 60.0)
+        {
+            temp_duration = 60.0;
+            ui->lineEdit_step_duration->setText(QString::number( temp_duration, 'f', 0));
+        }
+        // Update the global variable
+        m_step_response_data_recording_duration = temp_duration;
+    }
+    else
+    {
+        // Default the duration to 10
+        m_step_response_data_recording_duration = 10.0;
+        ui->lineEdit_step_duration->setText(QString::number( m_step_response_data_recording_duration, 'f', 0));
+    }
+
+    // Set the minimum of the x-axis to agree with the duration
+    ui->chartView_for_x->chart()->axisX()->setMax(m_step_response_data_recording_duration);
+
+    // Clear any data from the line series
+    m_lineSeries_for_setpoint_x->removePoints(0,m_lineSeries_for_setpoint_x->count());
+    m_lineSeries_for_measured_x->removePoints(0,m_lineSeries_for_measured_x->count());
+
+    // Set the flag that should store data
+    m_shouldStoreData_for_plotting = true;
+
+    // Unlock the mutex
+    m_chart_mutex.unlock();
+
+    // Inform the user about the change
+#ifdef CATKIN_MAKE
+    ROS_INFO_STREAM("[CSONE CONTROLLER TAB GUI] Perform step started");
+#endif
+}
+
+
+void CsoneControllerTab::on_set_lead_compensator_parameters_button_clicked()
 {
     // Initialise local variable for each of (x,y,z,yaw)
     float k = 1.0f, T = 1.0f, alpha = 1.0f;
@@ -305,22 +395,37 @@ void CsoneControllerTab::publishControllerParamters(float k, float T, float alph
 
 void CsoneControllerTab::on_lineEdit_k_returnPressed()
 {
-    ui->set_controller_parameters_button->animateClick();
+    ui->set_lead_compensator_parameters_button->animateClick();
 }
 
 void CsoneControllerTab::on_lineEdit_T_returnPressed()
 {
-    ui->set_controller_parameters_button->animateClick();
+    ui->set_lead_compensator_parameters_button->animateClick();
 }
 
 void CsoneControllerTab::on_lineEdit_alpha_returnPressed()
 {
-    ui->set_controller_parameters_button->animateClick();
+    ui->set_lead_compensator_parameters_button->animateClick();
+}
+
+void CsoneControllerTab::on_lineEdit_kp_returnPressed()
+{
+    ui->set_pd_controller_parameters_button->animateClick();
+}
+
+void CsoneControllerTab::on_lineEdit_kd_returnPressed()
+{
+    ui->set_pd_controller_parameters_button->animateClick();
 }
 
 void CsoneControllerTab::on_lineEdit_step_size_returnPressed()
 {
-    ui->set_controller_parameters_button->animateClick();
+    ui->perform_step_button->animateClick();
+}
+
+void CsoneControllerTab::on_lineEdit_step_duration_returnPressed()
+{
+    ui->log_data_button->animateClick();
 }
 
 
-- 
GitLab