コード例 #1
0
ファイル: my_plugin.cpp プロジェクト: ayodejiige/rqt_mypkg
void MyPlugin::initPlugin(qt_gui_cpp::PluginContext& context)
{
  // access standalone command line arguments
  QStringList argv = context.argv();
  // create QWidget
  widget_ = new QWidget();
  // extend the widget with all attributes and children from UI file
  ui_.setupUi(widget_);
  // add widget to the user interface
  context.addWidget(widget_);
}
コード例 #2
0
ファイル: topic_gui.cpp プロジェクト: MorS25/nimbro_network
void TopicGUI::initPlugin(qt_gui_cpp::PluginContext& ctx)
{
    m_w = new DotWidget;
    ctx.addWidget(m_w);

    qRegisterMetaType<nimbro_topic_transport::SenderStatsConstPtr>();
    qRegisterMetaType<nimbro_topic_transport::ReceiverStatsConstPtr>();

    connect(
        this, SIGNAL(senderStatsReceived(nimbro_topic_transport::SenderStatsConstPtr)),
        this, SLOT(handleSenderStats(nimbro_topic_transport::SenderStatsConstPtr)),
        Qt::QueuedConnection
    );

    m_sub_senderStats = getPrivateNodeHandle().subscribe(
                            "/network/sender_stats", 1, &TopicGUI::senderStatsReceived, this
                        );

    connect(
        this, SIGNAL(receiverStatsReceived(nimbro_topic_transport::ReceiverStatsConstPtr)),
        this, SLOT(handleReceiverStats(nimbro_topic_transport::ReceiverStatsConstPtr)),
        Qt::QueuedConnection
    );

    m_sub_receiverStats = getPrivateNodeHandle().subscribe(
                              "/network/receiver_stats", 1, &TopicGUI::receiverStatsReceived, this
                          );

    QTimer* updateTimer = new QTimer(this);
    connect(updateTimer, SIGNAL(timeout()), SLOT(update()));
    updateTimer->start(2000);
}
コード例 #3
0
ファイル: rov_status.cpp プロジェクト: SyllogismRXS/syllo-ros
     void rov_status::initPlugin(qt_gui_cpp::PluginContext& context)
     {
          widget_ = new QWidget();
          ui_.setupUi(widget_);

          if (context.serialNumber() > 1)
          {
               widget_->setWindowTitle(widget_->windowTitle() + " (" + QString::number(context.serialNumber()) + ")");
          }
          context.addWidget(widget_);

          this->subscriber_ = getNodeHandle().subscribe<videoray::Status>("videoray_status", 1, &rov_status::callback_status, this);

          ui_.firmware_label->setText("not set");

     }
	void ControllerManagerPlugin::initPlugin(qt_gui_cpp::PluginContext& context)
	{
		setupROSComponents_();
		
		// create a main widget named widget_
		widget_ = new QWidget();
		widget_->setWindowTitle("Controller Manager");
		
		// create layouts
        vlayout_outer_ = new QVBoxLayout();
        vlayout_outer_->setObjectName("vertical_layout_outer");
        
        hlayout_top_ = new QHBoxLayout();
        hlayout_top_->setObjectName("horizontal_layout_top");
        
		vlayout_outer_->addLayout(hlayout_top_);
		
		// create content of horizontal layout
		// create a label
		ns_label_ = new QLabel();
        ns_label_->setObjectName("ns_label_");
        ns_label_->setText("Kuka Namespace :");
        QSizePolicy fixed_policy(QSizePolicy::Fixed, QSizePolicy::Fixed);
        ns_label_->setSizePolicy(fixed_policy);
        hlayout_top_->addWidget(ns_label_);
        
        // create a combo box for kuka namespaces
        ns_combo_ = new QComboBox();
        ns_combo_->setObjectName("ns_combo_");
        ns_combo_->addItem("kuka_lwr_left");
        ns_combo_->addItem("kuka_lwr_right");
        
        connect(ns_combo_, SIGNAL(currentIndexChanged(int)), this, SLOT(ns_combo_changed(int)));
        
		hlayout_top_->addWidget(ns_combo_);
		
		// create tree/list widget of kuka controllers
		tree_controllers_widget_ = new QTreeWidget();
		tree_controllers_widget_ ->setObjectName("tree_controllers_widget_");
		
		column_names_list_ << "name" << "state" << "type" << "hw_iface" << "resources";
		column_names_pretty_list_ << "Controller Name" << "State" << "Type" << "HW Interface" << "Claimed Resources";
		
		tree_controllers_widget_->setColumnCount(column_names_list_.size());
		tree_controllers_widget_->setHeaderLabels(column_names_pretty_list_);
		tree_controllers_widget_->sortByColumn(0, Qt::AscendingOrder);
		tree_controllers_widget_->setContextMenuPolicy(Qt::CustomContextMenu);
		
		connect(tree_controllers_widget_, SIGNAL( customContextMenuRequested( const QPoint& ) ),
             this, SLOT( tree_controllers_widget_ContextMenu( const QPoint& ) ) );
             
		vlayout_outer_->addWidget(tree_controllers_widget_);
		
		// set widget_ to main widget
		widget_->setLayout(vlayout_outer_);
		context.addWidget(widget_);
		
		updateListControllers_();
	}
コード例 #5
0
ファイル: image_view.cpp プロジェクト: jack-oquin/bwi_common
void ImageView::initPlugin(qt_gui_cpp::PluginContext& context)
{
  widget_ = new QWidget();
  ui_.setupUi(widget_);

  if (context.serialNumber() > 1)
  {
    widget_->setWindowTitle(widget_->windowTitle() + " (" + QString::number(context.serialNumber()) + ")");
  }
  context.addWidget(widget_);

  ros::NodeHandle nh;
  topic = nh.resolveName("image");
  connect(ui_.image_topic, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged(QString)));
  ui_.image_topic->setText(QString::fromStdString(topic));

}
コード例 #6
0
  void ActiveRobots::initPlugin (qt_gui_cpp::PluginContext& context)
  {
    // access standalone command line arguments
    QStringList argv = context.argv();
    // create QWidget
    widget_ = new QWidget();
    // extend the widget with all attributes and children from UI file
    ui_.setupUi (widget_);

    ui_.table->horizontalHeader()->setResizeMode (QHeaderView::Stretch);

    // add widget to the user interface
    context.addWidget (widget_);

    core_rcv_.start ("/core/to_gui", getNodeHandle());

    connect (&update_timer_, SIGNAL (timeout()), this, SLOT (update()));
    update_timer_.start (100);
  }
コード例 #7
0
void MapViewCustom::initPlugin(qt_gui_cpp::PluginContext& context)
{
  context_ = &context;

  widget_ = new MapViewWidget();
  context.addWidget(widget_);

  // trigger deleteLater for plugin when widget or frame is closed
  widget_->installEventFilter(this);
}
コード例 #8
0
ファイル: core_status.cpp プロジェクト: pmiraldo/at_home_rsbb
  void CoreStatus::initPlugin (qt_gui_cpp::PluginContext& context)
  {
    // access standalone command line arguments
    QStringList argv = context.argv();
    // create QWidget
    widget_ = new QWidget();
    // extend the widget with all attributes and children from UI file
    ui_.setupUi (widget_);

    connect (ui_.shutdown, SIGNAL (released()), this, SLOT (exit()));

    // add widget to the user interface
    context.addWidget (widget_);

    core_rcv_.start ("/core/to_gui", getNodeHandle());

    connect (&update_timer_, SIGNAL (timeout()), this, SLOT (update()));
    update_timer_.start (200);
  }
コード例 #9
0
ファイル: autopilot.cpp プロジェクト: SyllogismRXS/syllo-ros
     void Autopilot::initPlugin(qt_gui_cpp::PluginContext& context)
     {
          widget_ = new QWidget();
          ui_.setupUi(widget_);

          if (context.serialNumber() > 1)
          {
               widget_->setWindowTitle(widget_->windowTitle() + " (" + QString::number(context.serialNumber()) + ")");
          }
          context.addWidget(widget_);

          // Enable / disable Heading/Depth checkboxes
          connect(ui_.desired_heading_checkbox, SIGNAL(toggled(bool)), this, SLOT(onEnableDesiredHeading(bool)));
          connect(ui_.desired_depth_checkbox, SIGNAL(toggled(bool)), this, SLOT(onEnableDesiredDepth(bool)));

          // Connect change of value in double spin box to function call
          connect(ui_.set_heading_button, SIGNAL(clicked(bool)), this, SLOT(onSetHeading(bool)));
          connect(ui_.set_depth_button, SIGNAL(clicked(bool)), this, SLOT(onSetDepth(bool)));
          
          // Create publisher
          this->desired_pub_ = getNodeHandle().advertise<videoray::DesiredTrajectory>("desired_trajectory", 1000);
     }
コード例 #10
0
void Parametertuner::initPlugin(qt_gui_cpp::PluginContext& context)
{
	QWidget* w = new QWidget();
	m_ui.setupUi(w);

	connect(m_ui.joystick_button, SIGNAL(toggled(bool)), this, SLOT(handleJoystickButton()));
	connect(m_ui.save_button, SIGNAL(clicked(bool)), this, SLOT(save()));
	connect(m_ui.reset_button, SIGNAL(clicked(bool)), this, SLOT(reset()));

	m_sub_paramList = getNodeHandle().subscribe("/config_server/parameter_list", 1, &Parametertuner::handleList, this);
	m_sub_joystick = getNodeHandle().subscribe("/joy", 1, &Parametertuner::handleJoystickInput, this);
	connect(this, SIGNAL(updateRequested()), this, SLOT(update()), Qt::QueuedConnection);
	connect(this, SIGNAL(moveSelectionRequested(int)), this, SLOT(moveSelection(int)), Qt::QueuedConnection);
	connect(this, SIGNAL(ValueChangeRequested(int)), this, SLOT(ChangeValue(int)), Qt::QueuedConnection);

	m_ui.parameter_root_widget->setColumnCount(2);
	m_ui.parameter_root_widget->setColumnWidth(0, 200);

	context.addWidget(w);
}
コード例 #11
0
void Parametertuner::initPlugin(qt_gui_cpp::PluginContext& context)
{
	// Initialize config_server library with the correct node handle.
	// We cannot use getPrivateNodeHandle() here, as it returns something like
	// /parametertuner/Parametertuner_1 as namespace, which is not unique -.-
	// Instead, use the global node handle with the ROS node name, which is
	// unique up to the rqt process (which is what we want).
	m_nh = ros::NodeHandle(getNodeHandle(), ros::this_node::getName());
	config_server::ParameterClient::initialize(m_nh);

	QWidget* w = new QWidget();

	m_ui.setupUi(w);
	
	qRegisterMetaType<std::string>("std::string");

	connect(m_ui.joystick_button, SIGNAL(toggled(bool)), this, SLOT(handleJoystickButton()));
	connect(m_ui.reset_button, SIGNAL(clicked(bool)), this, SLOT(reset()));
	connect(m_ui.save_button, SIGNAL(clicked(bool)), this, SLOT(save()));

	connect(this, SIGNAL(updateRequested()), this, SLOT(update()), Qt::QueuedConnection);
	m_sub_paramList = getNodeHandle().subscribe("/config_server/parameter_list", 1, &Parametertuner::handleList, this);
	m_sub_joystick = getNodeHandle().subscribe("/joy", 1, &Parametertuner::handleJoystickInput, this);

	connect(this, SIGNAL(moveSelectionRequested(int)), this, SLOT(moveSelection(int)), Qt::QueuedConnection);
	connect(this, SIGNAL(valueChangeRequested(int)), this, SLOT(changeValue(int)), Qt::QueuedConnection);
	connect(this, SIGNAL(expansionRequested(int)), this, SLOT(handleExpansion(int)), Qt::QueuedConnection);

	m_ui.parameter_root_widget->setColumnCount(2);
	m_ui.parameter_root_widget->setColumnWidth(0, 260);

	context.addWidget(w);
	
	m_updateCounter = 0;
	m_updateTimer = m_nh.createWallTimer(ros::WallDuration(1.0), boost::bind(&Parametertuner::handleUpdateTimer, this), true, false);
}
コード例 #12
0
void ServiceWidget::initPlugin(qt_gui_cpp::PluginContext& ctx)
{
	QWidget* wrapper = new QWidget();
	m_view = new QTableView(wrapper);
	m_model = new ServiceStatusModel(wrapper);
	m_connectionBox = new QComboBox(wrapper);
	QVBoxLayout* vbl = new QVBoxLayout(wrapper);

	m_view->setModel(m_model);

	qRegisterMetaType<nimbro_service_transport::ServiceStatusConstPtr>();

	connect(
		m_connectionBox, SIGNAL(currentIndexChanged(int)),
		m_model, SLOT(clearData())
	);

	vbl->addWidget(m_view);
	vbl->addWidget(m_connectionBox);
	wrapper->setLayout(vbl);
	ctx.addWidget(wrapper);

	m_sub_serviceStatus = getPrivateNodeHandle().subscribe(
		"/network/service_status", 1, &ServiceWidget::serviceStatusRecieved, this
	);

	connect(
		this, SIGNAL(serviceStatusRecieved(const nimbro_service_transport::ServiceStatusConstPtr&)),
		this, SLOT(handleServiceStatus(const nimbro_service_transport::ServiceStatusConstPtr&))
	);

	connect(
		m_model, SIGNAL(rowsInserted(const QModelIndex&, int, int)),
		m_view, SLOT(scrollToBottom())
	);
}
コード例 #13
0
void LEDWidget::initPlugin(qt_gui_cpp::PluginContext& context)
{
	context.addWidget(view);
}
コード例 #14
0
void LabelToolPlugin::initPlugin(qt_gui_cpp::PluginContext &context)
{
  // access standalone command line arguments
  QStringList argv = context.argv();
  // create QWidget
  widget_ = new QWidget();
  // extend the widget with all attributes and children from UI file
  ui_.setupUi(widget_);
  // add widget to the user interface
  context.addWidget(widget_);

  // getting labels
  std::vector<std::string> labels;
  QList<QString> labls_qt;
  // adding empty string at beginning
  QString empty_str = QString("");
  labls_qt.push_back(empty_str);

  nh_.getParam("labels", labels);
  for(auto &label : labels)
  {
    ROS_INFO_STREAM("label with name " << label << " available");
    QString qstr = QString::fromStdString(label);
    labls_qt.push_back(qstr);
  }

  // setting labels to dropdown menu
  ui_.comboBox->addItems(labls_qt);

  // reading in path to save img
  if(!nh_.getParam("path_for_img_destination",path_to_dir_))
  {
    path_to_dir_ = "~/classification/";
    ROS_ERROR_STREAM("path_for_img_destination not specified assuming " << path_to_dir_);
  }

  // setting up srv
  visualize_img_srv_ = nh_.advertiseService("/label_images",&LabelToolPlugin::visualizeImgCb, this);
  visualize_img_with_selection_srv_ = nh_.advertiseService("/label_images_with_selection",
                                                           &LabelToolPlugin::visualizeImgWithSelectionCb, this);

  // setting up my scene to handle click events
  scene_ = new label_tool::Scene();
  ui_.graphicsView->setScene(scene_);
  ui_.graphicsView->show();


  // connect GUI elements
  connect(scene_, SIGNAL(mousePressed(QGraphicsSceneMouseEvent*)),
          this, SLOT(mousePressEventOnGraphicsView(QGraphicsSceneMouseEvent*)), Qt::QueuedConnection);
  connect(scene_, SIGNAL(mouseRelease(QGraphicsSceneMouseEvent*)),
          this, SLOT(mouseReleaseEventOnGraphicsView(QGraphicsSceneMouseEvent*)), Qt::QueuedConnection);
  connect(scene_, SIGNAL(mouseMove(QGraphicsSceneMouseEvent*)),
          this, SLOT(mouseMoveEventOnGraphicsView(QGraphicsSceneMouseEvent*)), Qt::QueuedConnection);
  connect(ui_.nextButton, SIGNAL(pressed()), this, SLOT(pushNextButton()),Qt::QueuedConnection);
  connect(ui_.prevButton, SIGNAL(pressed()), this, SLOT(pushPrevButton()),Qt::QueuedConnection);
  connect(ui_.saveCurrentImg, SIGNAL(pressed()), this, SLOT(pushSaveCurrentImgButton()),Qt::QueuedConnection);
  connect(ui_.saveSelection, SIGNAL(pressed()), this, SLOT(pushSaveCurrentSelectionButton()),Qt::QueuedConnection);
  connect(ui_.deleteSelectionButton, SIGNAL(pressed()), this, SLOT(pushDeleteSelectionButton()),Qt::QueuedConnection);
  connect(this, SIGNAL(dataAvailable()), this, SLOT(visualizeSlot()),Qt::QueuedConnection);


  reset();
}
コード例 #15
0
void tracker_plugin::initPlugin(qt_gui_cpp::PluginContext& context)
{

  widget_ = new QWidget();
  ui.setupUi(widget_);


  context.addWidget(widget_);

  img.create(100, 100, CV_8UC3);
  img.setTo(cv::Scalar(0,0,0));


  firstrun = true;
  //ui.face_choice_method->addItem("Hand Selection Trackings");
//  ui.face_choice_method->addItem("Remove on LOST");
//  ui.face_choice_method->addItem("Face Recognition Method");

//  const QStandardItemModel* model = qobject_cast<const QStandardItemModel*>(ui.face_choice_method->model());
//  QStandardItem* item = model->item(2);
//
//  item->setFlags(disable ? item->flags() & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled) : Qt::ItemIsSelectable|Qt::ItemIsEnabled);
//  item->setData(disable ? ui.face_choice_method->palette().color(QPalette::Disabled, QPalette::Text)
//                      : QVariant(), // clear item data in order to use default color
//              Qt::TextColorRole);

  ui.paramsetters->addItem("Dlib-CMT Method");
  ui.paramsetters->addItem("Show Pose(dlib)");
  ui.addToTrack->setText("Get Internal State of CMT");
  ui.addToTrack->setToolTip("Calls a cerfice to cmt_tracker_node querying the initial image the CMT is tracking");
  nh.getParam("camera_topic", subscribe_topic);
  nh.getParam("filtered_face_locations",subscribe_face);

  face_subscriber = (nh).subscribe(subscribe_face, 1, &rqt_tracker_view::tracker_plugin::list_of_faces_update, this);
  image_subscriber = it.subscribe(subscribe_topic, 1, &rqt_tracker_view::tracker_plugin::imageCb, this);
  tracked_locations = nh.subscribe("tracker_results", 1 , &rqt_tracker_view::tracker_plugin::tracker_resultsCb, this);
  temp_tracked_locations = nh.subscribe("temporary_trackers", 1 , &rqt_tracker_view::tracker_plugin::temp_tracker_resultsCb, this);

  tracker_locations_pub = (nh).advertise<cmt_tracker_msgs::Tracker>("tracking_location", 1);

  client = nh.serviceClient<cmt_tracker_msgs::Clear>("clear");
  image_client = nh.serviceClient<cmt_tracker_msgs::TrackedImages>("get_cmt_rects");
  check_update = nh.serviceClient<cmt_tracker_msgs::Update>("update");
  viewupdate_service  = nh.advertiseService("view_update", &rqt_tracker_view::tracker_plugin::updateTrackerNames,this);
  tracker_locations_sub = (nh).subscribe("tracking_location", 1 , &rqt_tracker_view::tracker_plugin::trackerCb, this);
  nh.getParam("tracking_method", tracking_method);

  ui.removeTracked->setEnabled(false);
  connect(ui.addToTrack, SIGNAL(pressed()), this, SLOT(on_updateTracked()));
  connect(ui.face_output_list, SIGNAL(itemPressed(QListWidgetItem *)), this, SLOT(on_addToTrack_clicked(QListWidgetItem *)));
  connect(ui.removeAllTracked, SIGNAL(pressed()), this, SLOT(on_removeAllTracked_clicked()));
  //connect(ui.removeTracked, SIGNAL(pressed()), this, SLOT(on_removeTracked_clicked()));
  connect(this, SIGNAL(updatefacelist()), this, SLOT(updateVisibleFaces()));
  connect(ui.paramsetters,SIGNAL(currentIndexChanged(int)), this, SLOT(on_ParamChanged(int)));

//  if (tracking_method.compare("handtracking") == 0) ui.face_choice_method->setCurrentIndex(0);
//  else if (tracking_method.compare("mustbeface") == 0) ui.face_choice_method->setCurrentIndex(1);
//  else  ui.face_choice_method->setCurrentIndex(2);



}
コード例 #16
0
ファイル: plotter.cpp プロジェクト: AIS-Bonn/humanoid_op_ros
void Plotter::initPlugin(qt_gui_cpp::PluginContext& context)
{
	m_w = new QWidget;

	m_ui = new Ui::Plotter;
	m_ui->setupUi(m_w);

	context.addWidget(m_w);

	m_plotModel = new PlotModel(this);
	m_plotModel->rootPlot()->setUsedSettings(&m_settings);

	m_plotFilter = new PlotFilterModel(this);
	m_plotFilter->setSourceModel(m_plotModel);

	new JointStatePlot(getNodeHandle(), m_plotModel->rootPlot()); // The created JointStatePlot gets deleted when the root plot does, or all of its child plots

	m_ui->plotView->setModel(m_plotFilter);
	m_ui->plotView->setDragEnabled(true);

	m_ui->plotView->setItemDelegateForColumn(PlotModel::COL_ENABLED, new CheckBoxDelegate);
	m_ui->plotView->setItemDelegateForColumn(PlotModel::COL_COLOR, new ColorDelegate);

	m_ui->plot->addPlot(m_plotModel->rootPlot());

	connect(m_ui->pauseButton, SIGNAL(clicked(bool)), SLOT(handlePaused(bool)));
	connect(m_ui->playButton, SIGNAL(clicked(bool)), SLOT(handlePlay(bool)));
	connect(m_plotModel, SIGNAL(modelReset()), SLOT(updateTreeGeometry()));

	connect(m_ui->searchEdit, SIGNAL(textChanged(QString)), m_plotFilter, SLOT(setFilterRegExp(QString)));
	connect(m_ui->hideCheckBox, SIGNAL(clicked(bool)), m_plotFilter, SLOT(setHideDisabledPlots(bool)));

	m_sub_plot = getNodeHandle().subscribe("/plot", 100, &Plotter::plotDataReceived, this);
	qRegisterMetaType<plot_msgs::PlotConstPtr>("plot_msgs::PlotConstPtr");
	connect(this, SIGNAL(plotDataReceived(plot_msgs::PlotConstPtr)), SLOT(handlePlotData(plot_msgs::PlotConstPtr)), Qt::QueuedConnection);

	m_sub_timewarpStatus = getNodeHandle().subscribe("/tw/control_status", 1, &Plotter::timewarpStatusReceived, this);
	qRegisterMetaType<timewarp::TimeWarpControlConstPtr>("timewarp::TimeWarpControlConstPtr");
	connect(this, SIGNAL(timewarpStatusReceived(timewarp::TimeWarpControlConstPtr)), SLOT(handleTimewarpStatus(timewarp::TimeWarpControlConstPtr)), Qt::QueuedConnection);

	m_pub_timewarpControl = getNodeHandle().advertise<timewarp::TimeWarpControl>("/tw/control", 1);

	m_ui->plotView->installEventFilter(this);

	handleSelectionChanged(0.0, 0.0, false);
	connect(m_ui->plot, SIGNAL(timeChanged()), SLOT(updateTimeWarp()));
	connect(m_ui->plot, SIGNAL(stopPlaying()), SLOT(handleStopPlaying()));
	connect(m_ui->plot, SIGNAL(selectionChanged(double,double,bool)), SLOT(handleSelectionChanged(double,double,bool)));

	QMenu* menu = new QMenu(m_w); // Standard icon names: https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html#names
	m_loadMenuAction = menu->addAction(QIcon::fromTheme("document-open"), "Load data", this, SLOT(load()));
	m_saveMenuAction = menu->addAction(QIcon::fromTheme("document-save"), "Save data", this, SLOT(save()));
	m_assignColoursAction = menu->addAction(QIcon::fromTheme("applications-graphics"), "Assign colours", this, SLOT(assignColours()));
	m_clearMenuAction = menu->addAction(QIcon::fromTheme("edit-delete"), "Clear data", this, SLOT(clear()));
	m_clearPlotMenuAction = menu->addAction(QIcon::fromTheme("edit-clear"), "Clear plot", this, SLOT(clearPlot()));
	m_refreshMenuAction = menu->addAction(QIcon::fromTheme("view-refresh"), "Refresh", this, SLOT(refresh()));
	m_ui->menuButton->setMenu(menu);

	connect(m_ui->pauseButton, SIGNAL(clicked(bool)), m_loadMenuAction, SLOT(setEnabled(bool)));
	connect(m_ui->pauseButton, SIGNAL(clicked(bool)), m_saveMenuAction, SLOT(setEnabled(bool)));
	m_loadMenuAction->setDisabled(true);
	m_saveMenuAction->setDisabled(true);

	m_io = new PlotIO(getNodeHandle(), m_plotModel->rootPlot(), this);
	connect(m_io, SIGNAL(progress(double)), SLOT(ioProgress(double)));

	m_progressDialog = new QProgressDialog(m_w);
	m_progressDialog->setLabelText(tr("I/O in progress"));
	m_progressDialog->setMinimum(0);
	m_progressDialog->setMaximum(100);
	m_progressDialog->setAutoClose(false);
	m_progressDialog->setAutoReset(false);
	m_progressDialog->setCancelButton(0);
}
コード例 #17
0
void BandwidthGui::initPlugin(qt_gui_cpp::PluginContext& ctx)
{
	m_plot = new QCustomPlot();
	m_plot->legend->setVisible(true);
	m_plot->legend->setIconBorderPen(Qt::NoPen);
	m_plot->yAxis->setLabel("Kb/s");


	QWidget* wrapper = new QWidget();
	m_connectionBox = new QComboBox(wrapper);
	QPushButton* groupBtn = new QPushButton("Group Settings", wrapper);
	QGridLayout* gl = new QGridLayout(wrapper);
	gl->addWidget(m_plot, 0, 0, 1, 2);
	gl->addWidget(m_connectionBox, 1, 0);
	gl->addWidget(groupBtn, 1, 1);
	wrapper->setLayout(gl);
	ctx.addWidget(wrapper);

	connect(
		m_plot, SIGNAL(legendClick(QCPLegend *, QCPAbstractLegendItem *, QMouseEvent *)),
		this, SLOT(handleClickedLegend(QCPLegend*, QCPAbstractLegendItem*, QMouseEvent*))
	);

	connect(
		m_connectionBox, SIGNAL(currentIndexChanged(int)),
		this, SLOT(clearPlot())
	);

	connect(
		groupBtn, SIGNAL(pressed()),
		this, SLOT(updateGroupInfo())
	);

	qRegisterMetaType<nimbro_topic_transport::SenderStatsConstPtr>();

	connect(
		this, SIGNAL(senderStatsReceived(nimbro_topic_transport::SenderStatsConstPtr)),
		this, SLOT(handleSenderStats(nimbro_topic_transport::SenderStatsConstPtr)),
		Qt::QueuedConnection
	);

	m_sub_senderStats = getPrivateNodeHandle().subscribe(
		"/network/sender_stats", 1, &BandwidthGui::senderStatsReceived, this
	);
	m_plot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
	m_plot->xAxis->setDateTimeFormat("hh:mm:ss");
	m_plot->xAxis->setAutoTickStep(true);
	m_plot->yAxis->setRangeLower(0);
	QCPLayoutGrid* subLayout = new QCPLayoutGrid();
	QCPLayoutElement* dummy = new QCPLayoutElement();
	m_plot->plotLayout()->addElement(0, 1, subLayout);
	subLayout->addElement(0, 0, m_plot->legend);
	subLayout->addElement(1, 0, dummy);
	subLayout->setRowStretchFactor(0, 0.01);
	m_plot->plotLayout()->setColumnStretchFactor(1, 0.01);

	connect(
		m_plot->xAxis, SIGNAL(rangeChanged(QCPRange)),
		m_plot->xAxis2, SLOT(setRange(QCPRange))
	);
	connect(
		m_plot->yAxis, SIGNAL(rangeChanged(QCPRange)),
		m_plot->yAxis2, SLOT(setRange(QCPRange))
	);

	connect(
		&m_plotTimer, SIGNAL(timeout()),
		this, SLOT(updatePlot())
	);
	m_plotTimer.start(0);

}
コード例 #18
0
ファイル: skiros_gui.cpp プロジェクト: frovida/skiros
void SkirosGui::initPlugin(qt_gui_cpp::PluginContext& context)
{
  ///Basic initializations
  nh_ptr_.reset(new ros::NodeHandle(""));
  widget_ = new QWidget();
  ui_.setupUi(widget_);
  wm_ptr_.reset(new skiros_wm::WorldModelInterface(*nh_ptr_, true));
  if(!wm_ptr_->isConnected()) FWARN("[SkirosGui::initPlugin] World model seems down, waiting...");
  if(!wm_ptr_->waitConnection(ros::Duration(3.0)) && ros::ok())
  {
      FWARN("[SkirosGui::initPlugin] World model seems down, waiting...");
  }
  if(!ros::ok())
      return;
  FINFO("[SkirosGui::initPlugin] Connected to world model");

  ros::Duration(0.5).sleep();//Wait half second to avoid a weird bug where I don't detect the presence of robots

  skill_interface_ptr.reset(new skiros_skill::SkillLayerInterface());
  if (context.serialNumber() > 1)
  {
    widget_->setWindowTitle(widget_->windowTitle() + " (" + QString::number(context.serialNumber()) + ")");
  }
  context.addWidget(widget_);

  ///Task manager interfaces
  task_exe_pub_ = nh_ptr_->advertise<skiros_msgs::TmTaskExe>(std::string(task_mgr_node_name) + task_exe_tpc_name, 10);
  task_monitor_sub_ = nh_ptr_->subscribe(std::string(task_mgr_node_name) + task_monitor_tpc_name, 5, &SkirosGui::tmFeedbackReceived,  this);
  task_modify_ = nh_ptr_->serviceClient<skiros_msgs::TmModifyTask>(std::string(task_mgr_node_name) + task_modify_srv_name);
  task_query_ = nh_ptr_->serviceClient<skiros_msgs::TmQueryTask>(std::string(task_mgr_node_name) + task_query_srv_name);

  ///General
  timer = new QTimer(this);
  connect(timer, SIGNAL(timeout()), this, SLOT(refreshTimerCb()));
  timer->start(200);
  ui_.robot_combo_box->setCurrentIndex(ui_.robot_combo_box->findText(""));
  connect(ui_.robot_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(robotIndexChanged(int)));
  connect(ui_.modality_checkBox, SIGNAL(toggled(bool)), this, SLOT(modalityButtonClicked()));
  connect(ui_.exe_task_button, SIGNAL(pressed()), this, SLOT(exeTaskButtonClicked()));
  connect(ui_.stop_task_button, SIGNAL(pressed()), this, SLOT(stopTaskButtonClicked()));
  connect(this, SIGNAL(robotFeedbackReceived(const skiros_msgs::ModuleStatus &)), this, SLOT(robotMonitorCb(const skiros_msgs::ModuleStatus &)));
  connect(this, SIGNAL(tmFeedbackReceived(const skiros_msgs::TmMonitor &)), this, SLOT(taskMonitorCb(const skiros_msgs::TmMonitor &)));

  ///Goal tab
  ui_.goal_table_view->setModel(&goal_model_);
  task_plan_ = nh_ptr_->serviceClient<skiros_msgs::TmGoal>(std::string(task_mgr_node_name) + task_plan_srv_name);
  connect(ui_.condition_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(conditionIndexChanged(int)));
  connect(ui_.condition_refresh_button, SIGNAL(pressed()), this, SLOT(refreshButtonClicked()));
  connect(ui_.condition_add_button, SIGNAL(pressed()), this, SLOT(addConditionButtonClicked()));
  connect(ui_.condition_remove_button, SIGNAL(pressed()), this, SLOT(removeConditionButtonClicked()));
  connect(ui_.plan_button, SIGNAL(pressed()), this, SLOT(taskPlanButtonClicked()));

  ///Task tab
  ui_.skills_table_view->setModel(&skill_model_);
  ui_.skill_combo_box->setCurrentIndex(ui_.skill_combo_box->findText(""));
  connect(ui_.skill_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(skillIndexChanged(int)));
  //ui_.refresh_topics_push_button->setIcon(QIcon::fromTheme("view-refresh"));
  connect(ui_.add_skill_button, SIGNAL(pressed()), this, SLOT(addSkillButtonClicked()));
  connect(ui_.remove_skill_button, SIGNAL(pressed()), this, SLOT(removeSkillButtonClicked()));
  updateTask();

  ///Modules tab
  ui_.module_combo_box->setCurrentIndex(ui_.module_combo_box->findText(""));
  connect(ui_.module_combo_box, SIGNAL(currentIndexChanged(int)), this, SLOT(moduleIndexChanged(int)));
  //ui_.refresh_topics_push_button->setIcon(QIcon::fromTheme("view-refresh"));
  connect(ui_.exe_module_button, SIGNAL(pressed()), this, SLOT(exeModuleButtonClicked()));
  connect(ui_.stop_module_button, SIGNAL(pressed()), this, SLOT(stopModuleButtonClicked()));

  ///World model tab
  wm_model_ptr_ = new TreeModel(wm_ptr_->getElement(0));
  ui_.world_model_tree_view->setModel(wm_model_ptr_);
  ui_.world_model_tree_view->setModel(wm_model_ptr_);
  connect(ui_.world_model_tree_view->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(onWmTreeSelectionChanged(const QModelIndex &, const QModelIndex &)));
  connect(ui_.remove_object_button, SIGNAL(pressed()), this, SLOT(removeWmElementButtonClicked()));
  connect(ui_.add_object_button, SIGNAL(pressed()), this, SLOT(addWmElementButtonClicked()));
  connect(ui_.modify_object_button, SIGNAL(pressed()), this, SLOT(modifyWmElementButtonClicked()));
  connect(ui_.saveScene_button, SIGNAL(pressed()), this, SLOT(saveSceneButtonClicked()));
  connect(ui_.loadScene_button, SIGNAL(pressed()), this, SLOT(loadSceneButtonClicked()));
  scene_load_save_ = nh_ptr_->serviceClient<skiros_msgs::WmSceneLoadAndSave>(std::string(world_model_node_name) + wm_scene_load_save_srv_name);
  interactive_m_server_.reset( new interactive_markers::InteractiveMarkerServer("skiros_obj_edit") );
  ///Logging tab
  connect(ui_.startstoplog_button, SIGNAL(pressed()), this, SLOT(startLogButtonClicked()));
  connect(ui_.logFile_lineEdit, SIGNAL(returnPressed()), this, SLOT(logFileChanged()));
}
コード例 #19
0
void PlaybackController::initPlugin(qt_gui_cpp::PluginContext& context)
{
    // access standalone command line arguments
    QStringList argv = context.argv();

    // create QWidget
    widget_ = new QWidget();

    ui_.setupUi(widget_);
    context.addWidget(widget_);


    // create status tree items
    status_model_ = new QStandardItemModel(widget_);
    statusTreeRoot(status_model_->invisibleRootItem())
        .appendRow(createStatusRow("Player", "disconnected")
            .appendRow(createStatusRow("Current Record", " - ")
                .appendRow(createStatusRow("Duration", "0 s"))
                .appendRow(createStatusRow("Vicon Frames", "0"))
                .appendRow(createStatusRow("Depth Sensor Frames", "0")))
            .appendRow(createStatusRow("Current Time", "0 s"))
            .appendRow(createStatusRow("Current Vicon Frame", "0"))
            .appendRow(createStatusRow("Current Depth Sensor Frames", "0"))
            .appendRow(createStatusRow("Playback", "Stopped"))
         );

    ui_.statusTreeView->setModel(status_model_);
    ui_.statusTreeView->expandAll();
    ui_.statusTreeView->resizeColumnToContents(0);
    ui_.statusTreeView->setMinimumHeight(20 * (status_tree_container_.size() - 1) - 10);
    ui_.statusTreeView->adjustSize();

    widget_->adjustSize();

    timer_ = new QTimer(widget_);

    connect(ui_.openButton, SIGNAL(clicked()), this, SLOT(onOpen()));
    connect(ui_.closeButton, SIGNAL(clicked()), this, SLOT(onClose()));
    connect(ui_.playButton, SIGNAL(clicked()), this, SLOT(onPlay()));
    connect(ui_.pauseButton, SIGNAL(clicked()), this, SLOT(onPause()));
    connect(ui_.stopButton, SIGNAL(clicked()), this, SLOT(onStop()));
    connect(ui_.selectButton, SIGNAL(clicked()), this, SLOT(onSelectRecordingDirectory()));
    connect(ui_.saveTimeOffsetButton, SIGNAL(clicked()), this, SLOT(onSaveOffset()));

    connect(ui_.frameSlider, SIGNAL(valueChanged(int)), this, SLOT(onSetFrame(int)));
    connect(ui_.playbackSpeedSpinBox, SIGNAL(valueChanged(double)),
            this, SLOT(onSetPlaybackSpeed(double)));
    connect(ui_.timeOffsetSpinBox, SIGNAL(valueChanged(double)),
            this, SLOT(onSetTimeOffset(double)));

    connect(ui_.stepsizeSpinBox, SIGNAL(valueChanged(double)),
            this, SLOT(onSetStepsize(double)));

    connect(timer_, SIGNAL(timeout()), this, SLOT(onUpdateStatus()));
    connect(this, SIGNAL(updateOpeningProgress(int,int,double,int,int,double)),
            this, SLOT(onUpdateOpeningProgress(int,int,double,int,int,double)));

    connect(this, SIGNAL(updatePlayback(double,int,int)),
            this, SLOT(onUpdatePlayback(double,int,int)));

    // load and render icons
    QPixmap empty_map(16, 16);
    empty_map.fill(QColor(0,0,0,0));
    empty_icon_ = QIcon(empty_map);
    ok_icon_ = QIcon(loadPixmap("package://rviz/icons/ok.png"));
    warn_icon_ = QIcon(loadPixmap("package://rviz/icons/warning.png"));
    failed_icon_ = QIcon(loadPixmap("package://rviz/icons/failed_display.png"));

    setActivity("open", false);
    setActivity("opening", false);
    setActivity("playing", false);

    timer_->start(40);
}