Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added button to delete latest sample #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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