Commit ae2cb346 authored by beuchatp's avatar beuchatp
Browse files

Started process of adding a template controller. Still need to connect the GUI...

Started process of adding a template controller. Still need to connect the GUI elements and add the ROS Controller Service node
parent 9e640f93
......@@ -28,7 +28,9 @@ SOURCES += src/main.cpp\
src/studentcontrollertab.cpp \
src/defaultcontrollertab.cpp \
src/pickercontrollertab.cpp \
src/tuningcontrollertab.cpp
src/templatecontrollertab.cpp \
src/tuningcontrollertab.cpp \
HEADERS += include/mainwindow.h \
include/topbanner.h \
......@@ -41,8 +43,10 @@ HEADERS += include/mainwindow.h \
include/studentcontrollertab.h \
include/defaultcontrollertab.h \
include/pickercontrollertab.h \
include/templatecontrollertab.h \
include/tuningcontrollertab.h \
include/Constants_for_Qt_compile.h
include/Constants_for_Qt_compile.h \
FORMS += forms/mainwindow.ui \
......@@ -56,7 +60,9 @@ FORMS += forms/mainwindow.ui \
forms/studentcontrollertab.ui \
forms/defaultcontrollertab.ui \
forms/pickercontrollertab.ui \
forms/tuningcontrollertab.ui
forms/templatecontrollertab.ui \
forms/tuningcontrollertab.ui \
RESOURCES += \
flyingagentgui.qrc
......@@ -28,7 +28,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="controller_tabs_widget">
<property name="currentIndex">
<number>3</number>
<number>4</number>
</property>
<property name="movable">
<bool>true</bool>
......@@ -73,13 +73,13 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="safe_tab">
<widget class="QWidget" name="template_tab">
<attribute name="title">
<string>Safe</string>
<string>Template</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="SafeControllerTab" name="safe_controller_tab_widget" native="true"/>
<widget class="TemplateControllerTab" name="template_controller_tab_widget" native="true"/>
</item>
</layout>
</widget>
......@@ -88,12 +88,6 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>SafeControllerTab</class>
<extends>QWidget</extends>
<header>safecontrollertab.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>StudentControllerTab</class>
<extends>QWidget</extends>
......@@ -118,6 +112,12 @@
<header>tuningcontrollertab.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TemplateControllerTab</class>
<extends>QWidget</extends>
<header>templatecontrollertab.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
......
......@@ -109,7 +109,7 @@
</spacer>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="enable_safe_button">
<widget class="QPushButton" name="enable_template_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -135,7 +135,7 @@
</font>
</property>
<property name="text">
<string>Safe</string>
<string>Template</string>
</property>
</widget>
</item>
......@@ -255,7 +255,7 @@
</widget>
</item>
<item row="1" column="5">
<widget class="QPushButton" name="load_yaml_safe_button">
<widget class="QPushButton" name="load_yaml_template_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -275,7 +275,7 @@
</size>
</property>
<property name="text">
<string>Safe</string>
<string>Template</string>
</property>
</widget>
</item>
......
......@@ -214,7 +214,7 @@
<addaction name="action_showHideController_student"/>
<addaction name="action_showHideController_picker"/>
<addaction name="action_showHideController_tuning"/>
<addaction name="action_showHideController_safe"/>
<addaction name="action_showHideController_template"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuLoad_YAML"/>
......@@ -302,6 +302,17 @@
<string>Tuning</string>
</property>
</action>
<action name="action_showHideController_template">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Template</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
......
......@@ -114,6 +114,7 @@
#define REMOTE_CONTROLLER 5
#define TUNING_CONTROLLER 6
#define PICKER_CONTROLLER 7
#define TEMPLATE_CONTROLLER 8
// The constants that "command" changes in the
// operation state of this agent
......@@ -124,6 +125,7 @@
#define CMD_USE_REMOTE_CONTROLLER 5
#define CMD_USE_TUNING_CONTROLLER 6
#define CMD_USE_PICKER_CONTROLLER 7
#define CMD_USE_TEMPLATE_CONTROLLER 8
#define CMD_CRAZYFLY_TAKE_OFF 11
......@@ -252,6 +254,7 @@
#define LOAD_YAML_REMOTE_CONTROLLER_AGENT 5
#define LOAD_YAML_TUNING_CONTROLLER_AGENT 6
#define LOAD_YAML_PICKER_CONTROLLER_AGENT 7
#define LOAD_YAML_TEMPLATE_CONTROLLER_AGENT 8
#define LOAD_YAML_SAFE_CONTROLLER_COORDINATOR 11
#define LOAD_YAML_DEMO_CONTROLLER_COORDINATOR 12
......@@ -260,6 +263,7 @@
#define LOAD_YAML_REMOTE_CONTROLLER_COORDINATOR 15
#define LOAD_YAML_TUNING_CONTROLLER_COORDINATOR 16
#define LOAD_YAML_PICKER_CONTROLLER_COORDINATOR 17
#define LOAD_YAML_TEMPLATE_CONTROLLER_COORDINATOR 18
// For sending commands to the controller node informing
......@@ -276,6 +280,7 @@
#define FETCH_YAML_REMOTE_CONTROLLER_FROM_OWN_AGENT 5
#define FETCH_YAML_TUNING_CONTROLLER_FROM_OWN_AGENT 6
#define FETCH_YAML_PICKER_CONTROLLER_FROM_OWN_AGENT 7
#define FETCH_YAML_TEMPLATE_CONTROLLER_FROM_OWN_AGENT 8
#define FETCH_YAML_SAFE_CONTROLLER_FROM_COORDINATOR 11
#define FETCH_YAML_DEMO_CONTROLLER_FROM_COORDINATOR 12
......@@ -283,4 +288,4 @@
#define FETCH_YAML_MPC_CONTROLLER_FROM_COORDINATOR 14
#define FETCH_YAML_REMOTE_CONTROLLER_FROM_COORDINATOR 15
#define FETCH_YAML_TUNING_CONTROLLER_FROM_COORDINATOR 16
#define FETCH_YAML_PICKER_CONTROLLER_FROM_COORDINATOR 17
\ No newline at end of file
#define FETCH_YAML_TEMPLATE_CONTROLLER_FROM_COORDINATOR 18
......@@ -90,7 +90,7 @@ public:
void showHideController_student_changed();
void showHideController_picker_changed();
void showHideController_tuning_changed();
void showHideController_safe_changed();
void showHideController_template_changed();
public slots:
......
......@@ -102,7 +102,7 @@ public:
void showHideController_student_changed();
void showHideController_picker_changed();
void showHideController_tuning_changed();
void showHideController_safe_changed();
void showHideController_template_changed();
public slots:
......@@ -112,18 +112,19 @@ public slots:
private slots:
// ENABLE CONTROLLER BUTTONS ON-CLICK CALLBACK
void on_enable_safe_button_clicked();
void on_enable_tuning_button_clicked();
void on_enable_picker_button_clicked();
void on_enable_student_button_clicked();
void on_enable_default_button_clicked();
void on_enable_student_button_clicked();
void on_enable_picker_button_clicked();
void on_enable_tuning_button_clicked();
void on_enable_template_button_clicked();
// LOAD YAML BUTTONS ON-CLICK CALLBACK
void on_load_yaml_safe_button_clicked();
void on_load_yaml_tuning_button_clicked();
void on_load_yaml_picker_button_clicked();
void on_load_yaml_student_button_clicked();
void on_load_yaml_default_button_clicked();
void on_load_yaml_student_button_clicked();
void on_load_yaml_picker_button_clicked();
void on_load_yaml_tuning_button_clicked();
void on_load_yaml_template_button_clicked();
private:
Ui::EnableControllerLoadYamlBar *ui;
......
......@@ -131,7 +131,7 @@ private slots:
void on_action_showHideController_student_changed();
void on_action_showHideController_picker_changed();
void on_action_showHideController_tuning_changed();
void on_action_showHideController_safe_changed();
void on_action_showHideController_template_changed();
};
......
#ifndef TEMPLATECONTROLLERTAB_H
#define TEMPLATECONTROLLERTAB_H
#include <QWidget>
namespace Ui {
class TemplateControllerTab;
}
class TemplateControllerTab : public QWidget
{
Q_OBJECT
public:
explicit TemplateControllerTab(QWidget *parent = 0);
~TemplateControllerTab();
private:
Ui::TemplateControllerTab *ui;
};
#endif // TEMPLATECONTROLLERTAB_H
......@@ -232,9 +232,9 @@ void ControllerTabs::showHideController_tuning_changed()
showHideController_toggle("Tuning",ui->tuning_tab);
}
void ControllerTabs::showHideController_safe_changed()
void ControllerTabs::showHideController_template_changed()
{
showHideController_toggle("Safe",ui->safe_tab);
showHideController_toggle("Template",ui->template_tab);
}
......@@ -384,9 +384,14 @@ void ControllerTabs::setControllerEnabled(int new_controller)
{
case SAFE_CONTROLLER:
{
//ui->controller_enabled_label->setText("Safe");
setTextColourOfTabLabel( m_tab_text_colour_highlight , ui->default_tab );
break;
}
// case DEFAULT_CONTROLLER:
// {
// setTextColourOfTabLabel( m_tab_text_colour_highlight , ui->default_tab );
// break;
// }
case DEMO_CONTROLLER:
{
//ui->controller_enabled_label->setText("Demo");
......@@ -417,6 +422,11 @@ void ControllerTabs::setControllerEnabled(int new_controller)
setTextColourOfTabLabel( m_tab_text_colour_highlight , ui->picker_tab );
break;
}
case TEMPLATE_CONTROLLER:
{
setTextColourOfTabLabel( m_tab_text_colour_highlight , ui->template_tab );
break;
}
default:
{
//ui->controller_enabled_label->setText("Unknown");
......@@ -432,7 +442,7 @@ void ControllerTabs::setAllTabLabelsToNormalColouring()
setTextColourOfTabLabel( m_tab_text_colour_normal , ui->student_tab );
setTextColourOfTabLabel( m_tab_text_colour_normal , ui->picker_tab );
setTextColourOfTabLabel( m_tab_text_colour_normal , ui->tuning_tab );
setTextColourOfTabLabel( m_tab_text_colour_normal , ui->safe_tab );
setTextColourOfTabLabel( m_tab_text_colour_normal , ui->template_tab );
}
void ControllerTabs::setTextColourOfTabLabel(QColor color , QWidget * tab_widget)
......
......@@ -108,20 +108,19 @@ void EnableControllerLoadYamlBar::showHideController_tuning_changed()
ui->load_yaml_tuning_button->setHidden( !(ui->load_yaml_tuning_button->isHidden()) );
}
void EnableControllerLoadYamlBar::showHideController_safe_changed()
void EnableControllerLoadYamlBar::showHideController_template_changed()
{
ui->enable_safe_button ->setHidden( !(ui->enable_safe_button->isHidden()) );
ui->load_yaml_safe_button->setHidden( !(ui->load_yaml_safe_button->isHidden()) );
ui->enable_template_button ->setHidden( !(ui->enable_template_button->isHidden()) );
ui->load_yaml_template_button->setHidden( !(ui->load_yaml_template_button->isHidden()) );
}
// ENABLE CONTROLLER BUTTONS ON-CLICK CALLBACK
void EnableControllerLoadYamlBar::on_enable_safe_button_clicked()
void EnableControllerLoadYamlBar::on_enable_default_button_clicked()
{
#ifdef CATKIN_MAKE
dfall_pkg::IntWithHeader msg;
......@@ -132,14 +131,14 @@ void EnableControllerLoadYamlBar::on_enable_safe_button_clicked()
#endif
}
void EnableControllerLoadYamlBar::on_enable_tuning_button_clicked()
void EnableControllerLoadYamlBar::on_enable_student_button_clicked()
{
#ifdef CATKIN_MAKE
dfall_pkg::IntWithHeader msg;
fillIntMessageHeader(msg);
msg.data = CMD_USE_TUNING_CONTROLLER;
msg.data = CMD_USE_STUDENT_CONTROLLER;
this->commandPublisher.publish(msg);
ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Enable Tuning Controller");
ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Enable Student Controller");
#endif
}
......@@ -154,39 +153,53 @@ void EnableControllerLoadYamlBar::on_enable_picker_button_clicked()
#endif
}
void EnableControllerLoadYamlBar::on_enable_student_button_clicked()
void EnableControllerLoadYamlBar::on_enable_tuning_button_clicked()
{
#ifdef CATKIN_MAKE
dfall_pkg::IntWithHeader msg;
fillIntMessageHeader(msg);
msg.data = CMD_USE_STUDENT_CONTROLLER;
msg.data = CMD_USE_TUNING_CONTROLLER;
this->commandPublisher.publish(msg);
ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Enable Student Controller");
ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Enable Tuning Controller");
#endif
}
void EnableControllerLoadYamlBar::on_enable_default_button_clicked()
void EnableControllerLoadYamlBar::on_enable_template_button_clicked()
{
#ifdef CATKIN_MAKE
dfall_pkg::IntWithHeader msg;
fillIntMessageHeader(msg);
msg.data = CMD_USE_SAFE_CONTROLLER;
msg.data = CMD_USE_TEMPLATE_CONTROLLER;
this->commandPublisher.publish(msg);
ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Enable Safe Controller");
ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Enable Template Controller");
#endif
}
// LOAD YAML BUTTONS ON-CLICK CALLBACK
void EnableControllerLoadYamlBar::on_load_yaml_safe_button_clicked()
void EnableControllerLoadYamlBar::on_load_yaml_default_button_clicked()
{
#ifdef CATKIN_MAKE
#ifdef CATKIN_MAKE
// Create a local variable for the message
dfall_pkg::StringWithHeader yaml_filename_msg;
// Set for whom this applies to
fillStringMessageHeader(yaml_filename_msg);
// Specify the data
yaml_filename_msg.data = "DefaultController";
// Send the message
m_requestLoadYamlFilenamePublisher.publish(yaml_filename_msg);
// Inform the user that the menu item was selected
ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Load Default Controller YAML was clicked.");
#endif
}
void EnableControllerLoadYamlBar::on_load_yaml_tuning_button_clicked()
void EnableControllerLoadYamlBar::on_load_yaml_student_button_clicked()
{
#ifdef CATKIN_MAKE
// Create a local variable for the message
......@@ -194,11 +207,11 @@ void EnableControllerLoadYamlBar::on_load_yaml_tuning_button_clicked()
// Set for whom this applies to
fillStringMessageHeader(yaml_filename_msg);
// Specify the data
yaml_filename_msg.data = "TuningController";
yaml_filename_msg.data = "StudentController";
// Send the message
m_requestLoadYamlFilenamePublisher.publish(yaml_filename_msg);
// Inform the user that the menu item was selected
ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Load Tuning Controller YAML was clicked.");
ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Load Student Controller YAML was clicked.");
#endif
}
......@@ -218,7 +231,7 @@ void EnableControllerLoadYamlBar::on_load_yaml_picker_button_clicked()
#endif
}
void EnableControllerLoadYamlBar::on_load_yaml_student_button_clicked()
void EnableControllerLoadYamlBar::on_load_yaml_tuning_button_clicked()
{
#ifdef CATKIN_MAKE
// Create a local variable for the message
......@@ -226,27 +239,27 @@ void EnableControllerLoadYamlBar::on_load_yaml_student_button_clicked()
// Set for whom this applies to
fillStringMessageHeader(yaml_filename_msg);
// Specify the data
yaml_filename_msg.data = "StudentController";
yaml_filename_msg.data = "TuningController";
// Send the message
m_requestLoadYamlFilenamePublisher.publish(yaml_filename_msg);
// Inform the user that the menu item was selected
ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Load Student Controller YAML was clicked.");
ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Load Tuning Controller YAML was clicked.");
#endif
}
void EnableControllerLoadYamlBar::on_load_yaml_default_button_clicked()
void EnableControllerLoadYamlBar::on_load_yaml_template_button_clicked()
{
#ifdef CATKIN_MAKE
#ifdef CATKIN_MAKE
// Create a local variable for the message
dfall_pkg::StringWithHeader yaml_filename_msg;
// Set for whom this applies to
fillStringMessageHeader(yaml_filename_msg);
// Specify the data
yaml_filename_msg.data = "DefaultController";
yaml_filename_msg.data = "TemplateController";
// Send the message
m_requestLoadYamlFilenamePublisher.publish(yaml_filename_msg);
// Inform the user that the menu item was selected
ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Load Default Controller YAML was clicked.");
ROS_INFO("[ENABLE CONTROLLER LOAD YAML GUI BAR] Load Template Controller YAML was clicked.");
#endif
}
......@@ -254,6 +267,7 @@ void EnableControllerLoadYamlBar::on_load_yaml_default_button_clicked()
// ----------------------------------------------------------------------------------
// A GGGG EEEEE N N TTTTT III DDDD SSSS
// A A G E NN N T I D D S
......
......@@ -145,9 +145,8 @@ MainWindow::MainWindow(int argc, char **argv, QWidget *parent) :
ui->action_showHideController_picker->trigger();
// > For the tuning controller
ui->action_showHideController_tuning->trigger();
// > For the safe controller
ui->action_showHideController_safe->trigger();
// > For the template controller
ui->action_showHideController_template->trigger();
}
......@@ -246,11 +245,11 @@ void MainWindow::on_action_showHideController_tuning_changed()
ui->customWidget_controller_tabs->showHideController_tuning_changed();
}
void MainWindow::on_action_showHideController_safe_changed()
void MainWindow::on_action_showHideController_template_changed()
{
// Notify the UI elements of this change
ui->customWidget_enableControllerLoadYamlBar->showHideController_safe_changed();
ui->customWidget_controller_tabs->showHideController_safe_changed();
ui->customWidget_enableControllerLoadYamlBar->showHideController_template_changed();
ui->customWidget_controller_tabs->showHideController_template_changed();
}
......
#include "templatecontrollertab.h"
#include "ui_templatecontrollertab.h"
TemplateControllerTab::TemplateControllerTab(QWidget *parent) :
QWidget(parent),
ui(new Ui::TemplateControllerTab)
{
ui->setupUi(this);
}
TemplateControllerTab::~TemplateControllerTab()
{
delete ui;
}
......@@ -127,6 +127,7 @@
#define REMOTE_CONTROLLER 5
#define TUNING_CONTROLLER 6
#define PICKER_CONTROLLER 7
#define TEMPLATE_CONTROLLER 8
// The constants that "command" changes in the
// operation state of this agent
......@@ -137,6 +138,7 @@
#define CMD_USE_REMOTE_CONTROLLER 5
#define CMD_USE_TUNING_CONTROLLER 6
#define CMD_USE_PICKER_CONTROLLER 7
#define CMD_USE_TEMPLATE_CONTROLLER 8
#define CMD_CRAZYFLY_TAKE_OFF 11
......@@ -266,6 +268,7 @@
#define LOAD_YAML_REMOTE_CONTROLLER_AGENT 5
#define LOAD_YAML_TUNING_CONTROLLER_AGENT 6
#define LOAD_YAML_PICKER_CONTROLLER_AGENT 7
#define LOAD_YAML_TEMPLATE_CONTROLLER_AGENT 7
#define LOAD_YAML_SAFE_CONTROLLER_COORDINATOR 11
#define LOAD_YAML_DEMO_CONTROLLER_COORDINATOR 12
......@@ -274,6 +277,7 @@
#define LOAD_YAML_REMOTE_CONTROLLER_COORDINATOR 15
#define LOAD_YAML_TUNING_CONTROLLER_COORDINATOR 16
#define LOAD_YAML_PICKER_CONTROLLER_COORDINATOR 17
#define LOAD_YAML_TEMPLATE_CONTROLLER_COORDINATOR 18
// For sending commands to the controller node informing
......@@ -290,6 +294,7 @@
#define FETCH_YAML_REMOTE_CONTROLLER_FROM_OWN_AGENT 5
#define FETCH_YAML_TUNING_CONTROLLER_FROM_OWN_AGENT 6
#define FETCH_YAML_PICKER_CONTROLLER_FROM_OWN_AGENT 7
#define FETCH_YAML_TEMPLATE_CONTROLLER_FROM_OWN_AGENT 8
#define FETCH_YAML_SAFE_CONTROLLER_FROM_COORDINATOR 11
#define FETCH_YAML_DEMO_CONTROLLER_FROM_COORDINATOR 12
......@@ -297,4 +302,5 @@
#define FETCH_YAML_MPC_CONTROLLER_FROM_COORDINATOR 14
#define FETCH_YAML_REMOTE_CONTROLLER_FROM_COORDINATOR 15
#define FETCH_YAML_TUNING_CONTROLLER_FROM_COORDINATOR 16
#define FETCH_YAML_PICKER_CONTROLLER_FROM_COORDINATOR 17
\ No newline at end of file
#define FETCH_YAML_PICKER_CONTROLLER_FROM_COORDINATOR 17
#define FETCH_YAML_TEMPLATE_CONTROLLER_FROM_COORDINATOR 18
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment