Skip to content

Commit

Permalink
Added button to delete latest sample
Browse files Browse the repository at this point in the history
  • Loading branch information
cschindlbeck authored and Chris Schindlbeck committed Feb 13, 2023
1 parent ff6918e commit 8b24138
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ private Q_SLOTS:

void takeSampleBtnClicked(bool clicked);

void deleteLatestSampleBtnClicked(bool clicked);

void clearSamplesBtnClicked(bool clicked);

void solveBtnClicked(bool clicked);
Expand Down Expand Up @@ -221,6 +223,7 @@ private Q_SLOTS:

// Manual calibration
QPushButton* take_sample_btn_;
QPushButton* delete_latest_btn_;
QPushButton* reset_sample_btn_;
QPushButton* solve_btn_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8b24138

Please sign in to comment.