Esempio n. 1
0
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_);
}
Esempio n. 2
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);
  }
Esempio n. 3
0
  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);
  }
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);
}
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();
}