void QNode::run() { while ( ros::ok() ) { ros::spinOnce(); } std::cout << "Ros shutdown, proceeding to close the gui." << std::endl; Q_EMIT rosShutdown(); // used to signal the gui for a shutdown (useful to roslaunch) }
void QNode::run() { ros::Rate loop_rate(1); while ( ros::ok() ) { ros::spinOnce(); loop_rate.sleep(); } Q_EMIT rosShutdown(); }
void QNode::run() { ros::Rate loop_rate(50); while ( ros::ok() ) { ros::spinOnce(); loop_rate.sleep(); } std::cout << "Ros shutdown, proceeding to close the gui." << std::endl; emit rosShutdown(); // used to signal the gui for a shutdown (useful to roslaunch) }
void QNode::run() { log("Started moving around"); update_navigator_action_(ranger_librarian_helpers::NavigatorAction::MOVE); //the same as ros::spin(); while (ros::ok()) { ros::getGlobalCallbackQueue()->callAvailable(ros::WallDuration(0.1)); } std::cout << "Ros shutdown, proceeding to close the gui." << std::endl; Q_EMIT rosShutdown(); // used to signal the gui for a shutdown (useful to roslaunch) }
//------------------------------------------------------------------------------ void QNode::run() { //ros::Rate loop_rate(40); // 0.025sec while ( ros::ok() ) { ros::spin(); //ros::spinOnce(); //loop_rate.sleep(); } std::cout << "ROS shutdown, proceeding to close the gui." << std::endl; rosShutdown(); // used to signal the gui for a shutdown (useful to roslaunch) }
void QNode::run() { ros::Rate loop_rate(1); int count = 0; while ( ros::ok() ) { std_msgs::String msg; std::stringstream ss; ss << "hello world " << count; msg.data = ss.str(); chatter_publisher.publish(msg); log(Info,std::string("I sent: ")+msg.data); ros::spinOnce(); loop_rate.sleep(); ++count; } std::cout << "Ros shutdown, proceeding to close the gui." << std::endl; Q_EMIT rosShutdown(); // used to signal the gui for a shutdown (useful to roslaunch) }
MainWindow::MainWindow(int argc, char** argv, QWidget *parent) : QMainWindow(parent) , qnode(argc,argv) { ui.setupUi(this); // Calling this incidentally connects all ui's triggers to on_...() callbacks in this class. /********************* ** a simple uas table view **********************/ model = new QStandardItemModel(2,4,this); //2 Rows and 4 Columns model->setHorizontalHeaderItem(0, new QStandardItem(QString("Sensor type"))); model->setHorizontalHeaderItem(1, new QStandardItem(QString("FoV size (m)"))); model->setHorizontalHeaderItem(2, new QStandardItem(QString("Autonomy %"))); model->setHorizontalHeaderItem(3, new QStandardItem(QString("Task"))); model->setHorizontalHeaderItem(4, new QStandardItem(QString("Latitude"))); model->setHorizontalHeaderItem(5, new QStandardItem(QString("Longitude"))); ui.table_view_uas->setModel(model); /*******************************************/ QObject::connect(ui.actionAbout_Qt, SIGNAL(triggered(bool)), qApp, SLOT(aboutQt())); ReadSettings(); ui.tab_manager->setCurrentIndex(1); // ensure the second tab is showing - qt-designer should have this already hardwired, but often loses it (settings?). QObject::connect(&qnode, SIGNAL(rosShutdown()), this, SLOT(close())); /********************* ** Logging **********************/ ui.view_logging->setModel(qnode.loggingModel()); QObject::connect(&qnode, SIGNAL(loggingUpdated()), this, SLOT(updateLoggingView())); /********************* ** Auto Start **********************/ if ( ui.checkbox_remember_settings->isChecked() ) { on_button_connect_clicked(true); } }
void QNode::run() { ros::Rate loop_rate(10); int count = 0; while ( ros::ok() ) { std_msgs::String msg, ang; std::stringstream ss,ssang; ss << "hello world " << count; ssang<<newTiltAngle; msg.data = ss.str(); ang.data = ssang.str(); chatter_publisher.publish(msg); newTiltAngle.data=tiltAngle; pubTiltAngle.publish(newTiltAngle); log(Info,std::string("I sent: ")+msg.data + " " + ang.data); ros::spinOnce(); loop_rate.sleep(); ++count; } std::cout << "Ros shutdown, proceeding to close the gui." << std::endl; emit rosShutdown(); // used to signal the gui for a shutdown (useful to roslaunch) }
void QNode::run() { cout << "run start" << endl; t = time(0); // get time now struct tm * now = localtime( & t ); char buffer [80]; strftime (buffer,80,"%H:%M:%S_%d-%m-%Y.txt",now); logfile.open (buffer); ros::Rate Loop_rate(100); cout << "running" << endl; if(logfile.is_open()) { while(ros::ok()) { ros::spinOnce(); Loop_rate.sleep(); } } std::cout << "Ros shutdown, proceeding to close the gui." << std::endl; Q_EMIT rosShutdown(); // used to signal the gui for a shutdown (useful to roslaunch) }
void Listener::run() { ros::spin(); std::cout << "Ros shutdown, proceeding to close the gui." << std::endl; Q_EMIT rosShutdown(); // used to signal the gui for a shutdown (useful to roslaunch) }
void QNode::run() { ros::spin(); std::cout << "Ros shutdown, proceeding to close the gui." << std::endl; emit rosShutdown(); //used to signal the gui to shutdown (useful to roslaunch) }
void QNode::run() { //std::cout << "in run" << std::endl; ros::Rate loop_rate(1); int count = 0; while ( ros::ok() ) { // check if something has been called: if (rviz_objects.is_polygon_ready()){ std_msgs::String msg; std::stringstream ss; ss << "Center points(waypoints): " << rviz_objects.get_center_points().points.size() << ", CDT edges: " << rviz_objects.get_edges().points.size() ; msg.data = ss.str(); chatter_publisher.publish(msg); log(Info,std::string("CDT: ")+msg.data); polygon_pub.publish(rviz_objects.get_polygonStamped()); edges_pub.publish(rviz_objects.get_edges()); center_pub.publish(rviz_objects.get_center_points()); grid_marker_pub.publish(rviz_objects.get_grid_points()); triangulation_mesh_pub.publish(rviz_objects.get_triangulation_mesh()); rviz_objects.set_polygon_ready(false); } if (rviz_objects.is_planning_ready()){ path_pub.publish(rviz_objects.get_path()); std::cout << "Number of waypoints: " << rviz_objects.get_number_of_waypoints() << std::endl; // waypoints_s_client.publish(this->tnp_update.get_waypoint_list()); // mavros_msgs::WaypointPush push_srv; // mavros_msgs::WaypointClear clear_wp; // for (int i=0; i< tnp_update.get_waypoint_list().waypoints.size(); i++){ // push_srv.request.waypoints.push_back(tnp_update.get_waypoint_list().waypoints[i]); // waypoints_s_client.call(push_srv); // ros::Duration(0.3).sleep(); // } // std::vector<mavros_msgs::Waypoint> the_list = push_srv.request.waypoints; // for (std::vector<mavros_msgs::Waypoint>::iterator it = the_list.begin(); // it != the_list.end(); it++){ // std::cout << "lat: " << it->x_lat << "lat: " << it->y_long << std::endl; // } // std::cout << "total:" << the_list.size() << std::endl; // waypoints_s_client.call(push_srv); // TODO define data file or log //dataFile << rviz_objects.get_number_of_waypoints() << " "; rviz_objects.set_planning_ready(false); } if (broadcasting_constraints){ global_constraints_pub.publish(tnp_update.get_global_constraints()); } ros::spinOnce(); loop_rate.sleep(); ++count; } std::cout << "Ros shutdown, proceeding to close the gui." << std::endl; Q_EMIT rosShutdown(); // used to signal the gui for a shutdown (useful to roslaunch) }
MainWindow::MainWindow(int argc, char** argv, QWidget *parent) : QMainWindow(parent) , qnode(argc,argv) ,timer() ,scene() //, gps(argc,argv) { ui.setupUi(this); // Calling this incidentally connects all ui's triggers to on_...() callbacks in this class. QObject::connect(ui.actionAbout_Qt, SIGNAL(triggered(bool)), qApp, SLOT(aboutQt())); // qApp is a global variable for the application ReadSettings(); setWindowIcon(QIcon(":/images/icon.png")); ui.tab_manager->setCurrentIndex(0); // ensure the first tab is showing - qt-designer should have this already hardwired, but often loses it (settings?). QObject::connect(&qnode, SIGNAL(rosShutdown()), this, SLOT(close())); //QObject::connect(&gps, SIGNAL(rosShutdown()), this, SLOT(close())); /********************* ** Logging **********************/ ui.view_logging->setModel(qnode.loggingModel()); QObject::connect(&qnode, SIGNAL(loggingUpdated()), this, SLOT(updateLoggingView())); //Mesaj detayları //QImuMesajEditGrup egrup; ui.viewFrontCamera->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); ui.viewFrontCamera->setScaledContents(true); ui.viewPTZCamera->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); ui.viewPTZCamera->setScaledContents(true); QObject::connect(&qnode,SIGNAL(imuSignal_accelX(QString)),ui.lineAccelX,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(imuSignal_accelY(QString)),ui.lineAccelY,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(imuSignal_accelZ(QString)),ui.lineAccelZ,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(imuSignal_gyroX(QString)),ui.lineGyroX,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(imuSignal_gyroY(QString)),ui.lineGyroY,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(imuSignal_gyroZ(QString)),ui.lineGyroZ,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(imuSignal_magnetomX(QString)),ui.lineMagnetomX,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(imuSignal_magnetomY(QString)),ui.lineMagnetomY,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(imuSignal_magnetomZ(QString)),ui.lineMagnetomZ,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(imuSignal_raw(QString)),ui.lineIMURaw,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(gpsSignal_raw(QString)),ui.lineGPSRaw,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(gpsSignal_latitude(QString)),ui.lineLatitude,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(gpsSignal_longtitude(QString)),ui.lineLongtitude,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(gpsSignal_cog(QString)),ui.lineGPSCOG,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(gpsSignal_vog(QString)),ui.lineGPSVOG,SLOT(setText(QString))); QObject::connect(&qnode,SIGNAL(gpsSignal_quality(QString)),ui.lineGPSQuality,SLOT(setText(QString))); qRegisterMetaType<sensor_msgs::LaserScan>("sensor_msgs::LaserScan"); QObject::connect(&qnode,SIGNAL(scanSignal(const sensor_msgs::LaserScan)),this,SLOT(updateScan(sensor_msgs::LaserScan))); qRegisterMetaType<cv::Mat>("cv::Mat"); QObject::connect(&qnode,SIGNAL(frontCamera_signal(cv::Mat)),this,SLOT(getFrontCameraImage(cv::Mat))); QObject::connect(&qnode,SIGNAL(ptzCamera_signal(cv::Mat)),this,SLOT(getPTZCameraImage(cv::Mat))); qRegisterMetaType<axis_camera::Axis>("axis_camera::Axis"); QObject::connect(&qnode,SIGNAL(ptzStatus_signal(axis_camera::Axis)),this,SLOT(getPTZCameraStatus(axis_camera::Axis))); QObject::connect(ui.buttonPTZPan,SIGNAL(clicked()),this,SLOT(button_PTZPan_clicked())); QObject::connect(ui.buttonPTZTilt,SIGNAL(clicked()),this,SLOT(button_PTZTilt_clicked())); QObject::connect(ui.buttonSendVelocity,SIGNAL(clicked()),this,SLOT(on_buttonSendVelocity_clicked())); QObject::connect(ui.buttonSendVelocity_2,SIGNAL(clicked()),this,SLOT(on_buttonSendVelocity_2_clicked())); QObject::connect(ui.buttonSendVelocity_3,SIGNAL(clicked()),this,SLOT(on_buttonSendVelocity_3_clicked())); QObject::connect(ui.buttonSendVelocity_4,SIGNAL(clicked()),this,SLOT(on_buttonSendVelocity_4_clicked())); /********************* ** Auto Start **********************/ if ( ui.checkbox_remember_settings->isChecked() ) { on_button_connect_clicked(true); } //////////////////////////////////////////////////////////////////////// qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); scene.setSceneRect(-1600,-1600, 3200, 3200); scene.setItemIndexMethod(QGraphicsScene::NoIndex); scanview = new ScanWiew(); scanview->setPos(0,0); scene.addItem(scanview); /* for (int i = 0; i < MouseCount; ++i) { ScanWiew *mouse = new ScanWiew; mouse->setPos(::sin((i * 6.28) / MouseCount) * 200, ::cos((i * 6.28) / MouseCount) * 200); scene.addItem(mouse); }*/ // QGraphicsView view(&scene); ui.graphicsView->setScene(&scene); ui.graphicsView->setRenderHint(QPainter::Antialiasing); QColor color( 0, 0, 0); ui.graphicsView->setBackgroundBrush(color);//QPixmap(":/images/cheese.jpg")); ui.graphicsView->setCacheMode(QGraphicsView::CacheBackground); ui.graphicsView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); ui.graphicsView->setDragMode(QGraphicsView::ScrollHandDrag); #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) ui.graphicsView->showMaximized(); #else //ui.graphicsView.resize(400, 300); //view.show(); #endif //QObject::connect(&timer, SIGNAL(timeout()), &scene, SLOT(advance())); QObject::connect(this, SIGNAL(sceneUpdate()), &scene, SLOT(update())); QObject::connect(ui.spinBox_ArcDistanceInMeter,SIGNAL( valueChanged (int)),this,SLOT(setArcDistanceInMeter(int))); QObject::connect(ui.spinBox_arcDistanceInPixels,SIGNAL( valueChanged (int)),this,SLOT(setArcDistanceInPixels(int))); QObject::connect(ui.spinBox_LaserRange,SIGNAL( valueChanged (int)),this,SLOT(setRange(int))); //timer.start(1000 / 33); ui.line_log_dir_path->setText( QDir::currentPath()); QObject::connect(ui.button_single_save,SIGNAL(clicked()),this,SLOT(button_single_save_clicked())); QObject::connect(ui.checkbox_enable_sensor_logging,SIGNAL(stateChanged(int)),this,SLOT(checkbox_enable_sensor_logging_changed(int))); }