Skip to content
Snippets Groups Projects
Commit a549188c authored by beuchatp's avatar beuchatp
Browse files

Remove the StudentGUI because it is was not updated to the new node naming...

Remove the StudentGUI because it is was not updated to the new node naming convention and because it was re-factored as the FlyingAgentGUI
parent 2b5e9da2
No related branches found
No related tags found
No related merge requests found
// Copyright (C) 2017, ETH Zurich, D-ITET, Angel Romero
//
// This file is part of D-FaLL-System.
//
// D-FaLL-System is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// D-FaLL-System is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with D-FaLL-System. If not, see <http://www.gnu.org/licenses/>.
//
//
// ----------------------------------------------------------------------------------
// DDDD FFFFF L L SSSS Y Y SSSS TTTTT EEEEE M M
// D D F aaa L L S Y Y S T E MM MM
// D D --- FFFF a a L L --- SSS Y SSS T EEE M M M
// D D F a aa L L S Y S T E M M
// DDDD F aa a LLLL LLLL SSSS Y SSSS T EEEEE M M
//
//
// DESCRIPTION:
// Main program of the Student's GUI
//
// ----------------------------------------------------------------------------------
#include "MainWindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w(argc, argv);
w.show();
return a.exec();
}
// Copyright (C) 2017, ETH Zurich, D-ITET, Angel Romero
//
// This file is part of D-FaLL-System.
//
// D-FaLL-System is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// D-FaLL-System is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with D-FaLL-System. If not, see <http://www.gnu.org/licenses/>.
//
//
// ----------------------------------------------------------------------------------
// DDDD FFFFF L L SSSS Y Y SSSS TTTTT EEEEE M M
// D D F aaa L L S Y Y S T E MM MM
// D D --- FFFF a a L L --- SSS Y SSS T EEE M M M
// D D F a aa L L S Y S T E M M
// DDDD F aa a LLLL LLLL SSSS Y SSSS T EEEEE M M
//
//
// DESCRIPTION:
// Takes care of creating a ros node thread.
//
// ----------------------------------------------------------------------------------
#include "rosNodeThread_for_studentGUI.h"
#include "dfall_pkg/CMRead.h"
#include "dfall_pkg/CMUpdate.h"
#include "dfall_pkg/CMCommand.h"
rosNodeThread::rosNodeThread(int argc, char** pArgv, const char * node_name, QObject* parent)
: QObject(parent),
m_Init_argc(argc),
m_pInit_argv(pArgv),
m_node_name(node_name)
{
/** Constructor for the node thread **/
}
rosNodeThread::~rosNodeThread()
{
if (ros::isStarted())
{
ros::shutdown();
ros::waitForShutdown();
} // end if
m_pThread->wait();
} // end destructor
bool rosNodeThread::init()
{
m_pThread = new QThread();
this->moveToThread(m_pThread); // QObject method
connect(m_pThread, SIGNAL(started()), this, SLOT(run()));
ros::init(m_Init_argc, m_pInit_argv, m_node_name); // student_GUI is the name of this node
if (!ros::master::check())
{
ROS_ERROR("Master not found, please check teacher computer is running and try again");
return false; // do not start without ros.
}
ros::start();
ros::Time::init();
ros::NodeHandle nh("~");
m_vicon_subscriber = nh.subscribe("/ViconDataPublisher/ViconData", 100, &rosNodeThread::messageCallback, this);
// clients for db services:
m_read_db_client = nh.serviceClient<CMRead>("/CentralManagerService/Read", false);
m_update_db_client = nh.serviceClient<CMUpdate>("/CentralManagerService/Update", false);
m_command_db_client = nh.serviceClient<CMCommand>("/CentralManagerService/Command", false);
m_pThread->start();
return true;
} // set up the thread
void rosNodeThread::messageCallback(const ptrToMessage& p_msg) // When a message arrives to the topic, this callback is executed
{
emit newViconData(p_msg); //pass the message to other places
}
void rosNodeThread::run()
{
ros::Rate loop_rate(100);
QMutex * pMutex;
while (ros::ok())
{
pMutex = new QMutex();
// geometry_msgs::Twist cmd_msg;
pMutex->lock();
// cmd_msg.linear.x = m_speed;
// cmd_msg.angular.z = m_angle;
pMutex->unlock();
// ROS_INFO("RUNNING");
// sim_velocity.publish(cmd_msg);
ros::spinOnce();
loop_rate.sleep();
delete pMutex;
} // do ros things.
}
#-------------------------------------------------
#
# Project created by QtCreator 2017-08-21T11:01:25
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = studentGUI
TEMPLATE = app
INCLUDEPATH += $$PWD/include
CONFIG += c++11
SOURCES += \
src/main.cpp \
src/MainWindow.cpp
HEADERS += \
include/MainWindow.h \
FORMS += \
src/MainWindow.ui
RESOURCES += \
studentgui.qrc
<RCC>
<qresource prefix="/">
<file>images/battery_20.png</file>
<file>images/battery_40.png</file>
<file>images/battery_60.png</file>
<file>images/battery_80.png</file>
<file>images/battery_empty.png</file>
<file>images/battery_full.png</file>
<file>images/rf_connected.png</file>
<file>images/rf_connecting.png</file>
<file>images/rf_disconnected.png</file>
<file>images/battery_unknown.png</file>
<file>images/flying_state_disabling.png</file>
<file>images/flying_state_enabling.png</file>
<file>images/flying_state_flying.png</file>
<file>images/flying_state_off.png</file>
<file>images/flying_state_unknown.png</file>
</qresource>
</RCC>
......@@ -710,7 +710,8 @@ void loadPickerController()
void sendMessageUsingController(int controller)
{
// send a message in topic for the studentGUI to read it
// Send a message on the topic for informing the Flying
// Agent GUI about this update
std_msgs::Int32 controller_used_msg;
controller_used_msg.data = controller;
controllerUsedPublisher.publish(controller_used_msg);
......
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