Skip to content
Snippets Groups Projects
Commit 3b2802d9 authored by Paul Beuchat's avatar Paul Beuchat
Browse files

Hacked together a change controller for all

parent f9f3d40e
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,35 @@
#include <QWidget>
#ifdef CATKIN_MAKE
#include <std_msgs/Int32.h>
#include <std_msgs/Float32.h>
#include <ros/ros.h>
#include <ros/network.h>
#include <ros/package.h>
// #include "d_fall_pps/AreaBounds.h"
// #include "d_fall_pps/CrazyflieContext.h"
// #include "d_fall_pps/CMQuery.h"
// using namespace d_fall_pps;
#endif
// COMMANDS FOR THE FLYING STATE/CONTROLLER USED
// The constants that "command" changes in the
// operation state of this agent. These "commands"
// are sent from this GUI node to the "PPSClient"
// node where the command is enacted
#define CMD_USE_SAFE_CONTROLLER 1
#define CMD_USE_DEMO_CONTROLLER 2
#define CMD_USE_STUDENT_CONTROLLER 3
#define CMD_USE_MPC_CONTROLLER 4
#define CMD_USE_REMOTE_CONTROLLER 5
#define CMD_USE_TUNING_CONTROLLER 6
namespace Ui {
class EnableControllerLoadYamlBar;
}
......@@ -31,6 +60,15 @@ private slots:
private:
Ui::EnableControllerLoadYamlBar *ui;
#ifdef CATKIN_MAKE
// --------------------------------------------------- //
// PRIVATE VARIABLES FOR ROS
// PUBLISHERS AND SUBSRIBERS
// > For Crazyradio commands based on button clicks
ros::Publisher commandAllPublisher;
#endif
};
#endif // ENABLECONTROLLERLOADYAMLBAR_H
......@@ -6,6 +6,16 @@ EnableControllerLoadYamlBar::EnableControllerLoadYamlBar(QWidget *parent) :
ui(new Ui::EnableControllerLoadYamlBar)
{
ui->setupUi(this);
#ifdef CATKIN_MAKE
//ros::init();
// CREATE A NODE HANDLE TO THE ROOT OF THE D-FaLL SYSTEM
ros::NodeHandle dfall_root_nodeHandle("/dfall");
commandAllPublisher = dfall_root_nodeHandle.advertise<std_msgs::Int32>("/my_GUI/commandAllAgents", 1);
#endif
}
EnableControllerLoadYamlBar::~EnableControllerLoadYamlBar()
......@@ -20,17 +30,32 @@ EnableControllerLoadYamlBar::~EnableControllerLoadYamlBar()
void EnableControllerLoadYamlBar::on_enable_safe_button_clicked()
{
#ifdef CATKIN_MAKE
std_msgs::Int32 msg;
msg.data = CMD_USE_SAFE_CONTROLLER;
this->commandAllPublisher.publish(msg);
ROS_INFO("[FLYING AGENT GUI] Enable Safe Controller");
#endif
}
void EnableControllerLoadYamlBar::on_enable_demo_button_clicked()
{
#ifdef CATKIN_MAKE
std_msgs::Int32 msg;
msg.data = CMD_USE_DEMO_CONTROLLER;
this->commandAllPublisher.publish(msg);
ROS_INFO("[FLYING AGENT GUI] Enable Demo Controller");
#endif
}
void EnableControllerLoadYamlBar::on_enable_student_button_clicked()
{
#ifdef CATKIN_MAKE
std_msgs::Int32 msg;
msg.data = CMD_USE_STUDENT_CONTROLLER;
this->commandAllPublisher.publish(msg);
ROS_INFO("[FLYING AGENT GUI] Enable Student Controller");
#endif
}
void EnableControllerLoadYamlBar::on_enable_mpc_button_clicked()
......
......@@ -40,15 +40,17 @@ MainWindow::MainWindow(int argc, char **argv, QWidget *parent) :
//ROS_INFO("[flyingAgentGUI] Debug Point 5");
m_rosNodeThread = new rosNodeThread(argc, argv, "flyingAgentGUI");
#endif
#ifdef CATKIN_MAKE
m_rosNodeThread->init();
#endif
ui->setupUi(this);
// ADD KEYBOARD SHORTCUTS
// > For "kill GUI node", press "CTRL+C" while the GUI window is the focus
m_close_GUI_shortcut = new QShortcut(QKeySequence(tr("CTRL+C")), this, SLOT(close()));
#ifdef CATKIN_MAKE
m_rosNodeThread->init();
#endif
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment