diff --git a/moveit_calibration_gui/handeye_calibration_rviz_plugin/include/moveit/handeye_calibration_rviz_plugin/handeye_control_widget.h b/moveit_calibration_gui/handeye_calibration_rviz_plugin/include/moveit/handeye_calibration_rviz_plugin/handeye_control_widget.h index f2a0a3b..47a661d 100644 --- a/moveit_calibration_gui/handeye_calibration_rviz_plugin/include/moveit/handeye_calibration_rviz_plugin/handeye_control_widget.h +++ b/moveit_calibration_gui/handeye_calibration_rviz_plugin/include/moveit/handeye_calibration_rviz_plugin/handeye_control_widget.h @@ -169,6 +169,8 @@ private Q_SLOTS: void takeSampleBtnClicked(bool clicked); + void deleteLatestSampleBtnClicked(bool clicked); + void clearSamplesBtnClicked(bool clicked); void solveBtnClicked(bool clicked); @@ -221,6 +223,7 @@ private Q_SLOTS: // Manual calibration QPushButton* take_sample_btn_; + QPushButton* delete_latest_btn_; QPushButton* reset_sample_btn_; QPushButton* solve_btn_; diff --git a/moveit_calibration_gui/handeye_calibration_rviz_plugin/src/handeye_control_widget.cpp b/moveit_calibration_gui/handeye_calibration_rviz_plugin/src/handeye_control_widget.cpp index 455b030..00c5836 100644 --- a/moveit_calibration_gui/handeye_calibration_rviz_plugin/src/handeye_control_widget.cpp +++ b/moveit_calibration_gui/handeye_calibration_rviz_plugin/src/handeye_control_widget.cpp @@ -181,23 +181,28 @@ ControlTabWidget::ControlTabWidget(HandEyeCalibrationDisplay* pdisplay, QWidget* // Manual calibration area QGroupBox* manual_cal_group = new QGroupBox("Manual Calibration"); layout_right->addWidget(manual_cal_group); - QHBoxLayout* control_cal_layout = new QHBoxLayout(); + QGridLayout* control_cal_layout = new QGridLayout(); manual_cal_group->setLayout(control_cal_layout); take_sample_btn_ = new QPushButton("Take sample"); - take_sample_btn_->setMinimumHeight(35); + take_sample_btn_->setMinimumHeight(25); connect(take_sample_btn_, SIGNAL(clicked(bool)), this, SLOT(takeSampleBtnClicked(bool))); - control_cal_layout->addWidget(take_sample_btn_); + control_cal_layout->addWidget(take_sample_btn_, 0, 0); - reset_sample_btn_ = new QPushButton("Clear samples"); - reset_sample_btn_->setMinimumHeight(35); + delete_latest_btn_ = new QPushButton("Delete latest sample"); + delete_latest_btn_->setMinimumHeight(25); + connect(delete_latest_btn_, SIGNAL(clicked(bool)), this, SLOT(deleteLatestSampleBtnClicked(bool))); + control_cal_layout->addWidget(delete_latest_btn_, 0, 1); + + reset_sample_btn_ = new QPushButton("Clear all samples"); + reset_sample_btn_->setMinimumHeight(25); connect(reset_sample_btn_, SIGNAL(clicked(bool)), this, SLOT(clearSamplesBtnClicked(bool))); - control_cal_layout->addWidget(reset_sample_btn_); + control_cal_layout->addWidget(reset_sample_btn_, 1, 0); solve_btn_ = new QPushButton("Solve"); - solve_btn_->setMinimumHeight(35); + solve_btn_->setMinimumHeight(25); connect(solve_btn_, SIGNAL(clicked(bool)), this, SLOT(solveBtnClicked(bool))); - control_cal_layout->addWidget(solve_btn_); + control_cal_layout->addWidget(solve_btn_, 1, 1); // Auto calibration area QGroupBox* auto_cal_group = new QGroupBox("Calibrate With Recorded Joint States"); @@ -580,6 +585,24 @@ void ControlTabWidget::takeSampleBtnClicked(bool clicked) } } +void ControlTabWidget::deleteLatestSampleBtnClicked(bool clicked) +{ + if (joint_states_.empty()) + { + QMessageBox::warning(this, tr("Empty Pose samples"), tr("Cannot delete last sample, list is already empty.")); + return; + } + + // Delete latest recorded transform + effector_wrt_world_.pop_back(); + object_wrt_sensor_.pop_back(); + + // Delete latest recorded joint state, update progress bar + joint_states_.pop_back(); + tree_view_model_->takeRow(joint_states_.size()); + auto_progress_->setMax(joint_states_.size()); +} + void ControlTabWidget::clearSamplesBtnClicked(bool clicked) { // Clear recorded transforms