thread.cpp
Go to the documentation of this file.
1 
9 #include <model/thread.hpp>
10 #include <QMessageBox>
11 
12 
14 void ROSserver::run() { // no exec() call = no event handling
15  // seperate the terminal command from what it should start
16  QProcess ROS_process;
17  ROS_process.start( workspace.c_str() );
18  /* The signal errorOccurred only appears in Qt 5.6!!!
19  connect( &ROSprocess,
20  SIGNAL( errorOccurred(QProcess::ProcessError) ),
21  this, SLOT( threadError(QProcess::ProcessError) ) ); */
22  ROS_process.waitForStarted(); // waits up to 30 s
23  if (ROS_process.state() == QProcess::NotRunning)
24  threadError( ROS_process.error() );
25  //exec(); // solution 1, does not stop ROSprocess
26  while (ROS_run); // wait for a ROSserver::stop() (sol. 2)
27  ROS_process.close(); // OK with solution 2
28 } // end of void run()
void threadError(QProcess::ProcessError error)
Signals which error occured when starting the process.
Definition: thread.hpp:36
void run()
The main method of this thread.
Definition: thread.cpp:14
std::string workspace
Name of the workspace selected.
Definition: thread.hpp:28
Qt based thread for qt_ctrl package.
bool ROS_run
Should the ROS server continue to run?
Definition: thread.hpp:25


qt_ctrl
Author(s): Alexis Scheuer
autogenerated on Wed Dec 16 2020 15:51:32