Преглед изворни кода

shenlan test add turn light control

chenxiaowei пре 1 година
родитељ
комит
f930e144ed

+ 40 - 0
src/chassis_test/shenlan_test/mainwindow.cpp

@@ -45,6 +45,8 @@ MainWindow::MainWindow(QWidget *parent) :
     decition_debug.set_wheelangle(5);
     decition_debug.set_torque(1);
     decition_debug.set_brake(2);
+    decition_debug.set_leftlamp(0);
+    decition_debug.set_rightlamp(0);
 
 }
 
@@ -105,6 +107,21 @@ void MainWindow::ShareChassisDebug()
     char * str = new char[nsize];
     std::shared_ptr<char> pstr;
     pstr.reset(str);
+    if(ui->left_turn->isChecked())
+    {
+        decition_debug.set_leftlamp(1);
+        decition_debug.set_rightlamp(0);
+    }
+    else if(ui->right_turn->isChecked())
+    {
+        decition_debug.set_leftlamp(0);
+        decition_debug.set_rightlamp(1);
+    }
+    else
+    {
+        decition_debug.set_leftlamp(0);
+        decition_debug.set_rightlamp(0);
+    }
     if(decition_debug.SerializeToArray(str,nsize))
     {
         if(ui->start_send->isChecked())
@@ -155,3 +172,26 @@ void MainWindow::on_brake_valueChanged(double arg1)
       decition_debug.set_brake(arg1);
     }
 }
+
+void MainWindow::on_left_turn_clicked()
+{
+
+}
+void MainWindow::on_left_turn_clicked(bool checked)
+{
+//    if(checked)
+//    {
+//        decition_debug.set_leftlamp(1);
+//        decition_debug.set_rightlamp(0);
+//    }
+//    else
+//        decition_debug.set_leftlamp(0);
+}
+
+void MainWindow::on_right_turn_clicked(bool checked)
+{
+//    if(checked)
+//        decition_debug.set_rightlamp(1);
+//    else
+//        decition_debug.set_rightlamp(0);
+}

+ 6 - 0
src/chassis_test/shenlan_test/mainwindow.h

@@ -25,6 +25,12 @@ private slots:
 
      void on_brake_valueChanged(double arg1);
 
+     void on_left_turn_clicked();
+
+     void on_left_turn_clicked(bool checked);
+
+     void on_right_turn_clicked(bool checked);
+
 public:
     explicit MainWindow(QWidget *parent = 0);
     ~MainWindow();

+ 8 - 1
src/chassis_test/shenlan_test/mainwindow.ui

@@ -1341,6 +1341,9 @@
             <property name="tristate">
              <bool>false</bool>
             </property>
+            <attribute name="buttonGroup">
+             <string notr="true">buttonGroup</string>
+            </attribute>
            </widget>
           </item>
           <item row="0" column="4">
@@ -1398,6 +1401,9 @@
             <property name="text">
              <string>右转向</string>
             </property>
+            <attribute name="buttonGroup">
+             <string notr="true">buttonGroup</string>
+            </attribute>
            </widget>
           </item>
           <item row="1" column="1">
@@ -1599,8 +1605,9 @@
  </resources>
  <connections/>
  <buttongroups>
-  <buttongroup name="engineer_buttonGroup"/>
   <buttongroup name="gear_buttonGroup"/>
   <buttongroup name="EPB_buttonGroup"/>
+  <buttongroup name="engineer_buttonGroup"/>
+  <buttongroup name="buttonGroup"/>
  </buttongroups>
 </ui>