2 #include "ui_qnodedialog.h" 3 #include <boost/make_shared.hpp> 9 if( qgetenv(
"ROS_MASTER_URI").isEmpty() )
12 msgBox.setText(
"WARNINGS: the ROS_MASTER_URI is not defined in your environment\n" 13 "Using the default value [http://localhost:11311]\n");
15 return "http://localhost:11311";
18 auto master_uri = ( qgetenv(
"ROS_MASTER_URI"));
19 return std::string( master_uri.data() );
31 auto master_ui = settings.value(
"QNode.master_uri", tr(
"http://localhost:11311")).toString();
32 auto host_ip = settings.value(
"QNode.host_ip", tr(
"localhost")).toString();
34 ui->lineEditMaster->setText( master_ui );
35 ui->lineEditHost->setText( host_ip );
40 void init(
const M_string& remappings);
45 const std::string& hostname)
47 std::map<std::string,std::string> remappings;
48 remappings[
"__master"] = ros_master_uri;
49 remappings[
"__hostname"] = hostname;
51 static bool first_time =
true;
54 ros::init(remappings,
"PlotJugglerListener");
64 msgBox.setText( QString(
"Could not connect to the ros master [%1]").
65 arg(QString::fromStdString(ros_master_uri)));
75 settings.setValue (
"QNode.master_uri",
ui->lineEditMaster->text() );
76 settings.setValue(
"QNode.host_ip",
ui->lineEditHost->text() );
82 bool connected =
false;
83 if(
ui->checkBoxUseEnvironment->isChecked() )
89 std::string ros_master_uri =
ui->lineEditMaster->text().toStdString();
90 std::string hostname =
ui->lineEditHost->text().toStdString();
104 ui->lineEditMaster->setEnabled( !checked );
105 ui->lineEditHost->setEnabled( !checked );
150 if( !manager.
_node ){
158 return manager.
_node;
ROSCPP_DECL bool isInitialized()
void init(const M_string &remappings)
std::string getDefaultMasterURI()
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
static bool Connect(const std::string &ros_master_uri, const std::string &hostname="localhost")
void on_checkBoxUseEnvironment_toggled(bool checked)
boost::shared_ptr< NodeHandle > NodeHandlePtr
std::map< std::string, std::string > M_string
void on_pushButtonConnect_pressed()
void on_pushButtonCancel_pressed()
static ros::NodeHandlePtr getNode()
static RosManager & get()
QNodeDialog(QWidget *parent=0)
ROSCPP_DECL bool isStarted()
ROSCPP_DECL void shutdown()
ROSCPP_DECL void waitForShutdown()