29 #include "ui_editConstraintDialog.h"
35 #define M_PI 3.14159265358979323846
43 _ui =
new Ui_EditConstraintDialog();
55 UASSERT(covariance.empty() || (covariance.cols == 6 && covariance.rows == 6 && covariance.type() == CV_64FC1));
57 _ui->checkBox_radians->setChecked(
true);
58 _ui->linear_sigma_x->setValue(covariance.empty() || covariance.at<
double>(0,0)>=9999 || covariance.at<
double>(0,0)<=0?0:
sqrt(covariance.at<
double>(0,0)));
59 _ui->linear_sigma_y->setValue(covariance.empty() || covariance.at<
double>(1,1)>=9999 || covariance.at<
double>(1,1)<=0?0:
sqrt(covariance.at<
double>(1,1)));
60 _ui->linear_sigma_z->setValue(covariance.empty() || covariance.at<
double>(2,2)>=9999 || covariance.at<
double>(2,2)<=0?0:
sqrt(covariance.at<
double>(2,2)));
61 _ui->angular_sigma_roll->setValue(covariance.empty() || covariance.at<
double>(3,3)>=9999 || covariance.at<
double>(3,3)<=0?0:
sqrt(covariance.at<
double>(3,3)));
62 _ui->angular_sigma_pitch->setValue(covariance.empty() || covariance.at<
double>(4,4)>=9999 || covariance.at<
double>(4,4)<=0?0:
sqrt(covariance.at<
double>(4,4)));
63 _ui->angular_sigma_yaw->setValue(covariance.empty() || covariance.at<
double>(5,5)>=9999 || covariance.at<
double>(5,5)<=0?0:
sqrt(covariance.at<
double>(5,5)));
65 connect(
_ui->checkBox_radians, SIGNAL(stateChanged(
int)),
this, SLOT(
switchUnits()));
75 _ui->groupBox_pose->setVisible(visible);
79 _ui->groupBox_covariance->setVisible(visible);
84 double conversion = 180.0/
M_PI;
85 if(
_ui->checkBox_radians->isChecked())
87 conversion =
M_PI/180.0;
89 QVector<QDoubleSpinBox*> boxes;
90 boxes.push_back(
_ui->roll);
91 boxes.push_back(
_ui->pitch);
92 boxes.push_back(
_ui->yaw);
93 boxes.push_back(
_ui->angular_sigma_roll);
94 boxes.push_back(
_ui->angular_sigma_pitch);
95 boxes.push_back(
_ui->angular_sigma_yaw);
96 for(
int i=0;
i<boxes.size(); ++
i)
98 double value = boxes[
i]->value()*conversion;
99 if(
_ui->checkBox_radians->isChecked())
101 if(boxes[
i]!=
_ui->angular_sigma_roll && boxes[
i]!=
_ui->angular_sigma_pitch && boxes[
i]!=
_ui->angular_sigma_yaw)
103 boxes[
i]->setMinimum(-
M_PI);
105 boxes[
i]->setMaximum(
M_PI);
106 boxes[
i]->setSuffix(
" rad");
107 boxes[
i]->setSingleStep(0.01);
111 if(boxes[
i]!=
_ui->angular_sigma_roll && boxes[
i]!=
_ui->angular_sigma_pitch && boxes[
i]!=
_ui->angular_sigma_yaw)
113 boxes[
i]->setMinimum(-180);
115 boxes[
i]->setMaximum(180);
116 boxes[
i]->setSuffix(
" deg");
117 boxes[
i]->setSingleStep(1);
119 boxes[
i]->setValue(
value);
125 double conversion = 1.0f;
126 if(!
_ui->checkBox_radians->isChecked())
128 conversion =
M_PI/180.0;
130 return Transform(
_ui->x->value(),
_ui->y->value(),
_ui->z->value(),
_ui->roll->value()*conversion,
_ui->pitch->value()*conversion,
_ui->yaw->value()*conversion);
135 cv::Mat covariance = cv::Mat::eye(6,6,CV_64FC1);
136 covariance.at<
double>(0,0) =
_ui->linear_sigma_x->value()==0?9999:
_ui->linear_sigma_x->value()*
_ui->linear_sigma_x->value();
137 covariance.at<
double>(1,1) =
_ui->linear_sigma_y->value()==0?9999:
_ui->linear_sigma_y->value()*
_ui->linear_sigma_y->value();
138 covariance.at<
double>(2,2) =
_ui->linear_sigma_z->value()==0?9999:
_ui->linear_sigma_z->value()*
_ui->linear_sigma_z->value();
139 double conversion = 1.0f;
140 if(!
_ui->checkBox_radians->isChecked())
142 conversion =
M_PI/180.0;
144 double sigma =
_ui->angular_sigma_roll->value()*conversion;
145 covariance.at<
double>(3,3) = sigma==0?9999:sigma*sigma;
146 sigma =
_ui->angular_sigma_pitch->value()*conversion;
147 covariance.at<
double>(4,4) = sigma==0?9999:sigma*sigma;
148 sigma =
_ui->angular_sigma_yaw->value()*conversion;
149 covariance.at<
double>(5,5) = sigma==0?9999:sigma*sigma;