00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "stdr_gui/stdr_info_loader.h"
00023
00024 namespace stdr_gui{
00025
00032 CInfoLoader::CInfoLoader(int argc, char **argv):
00033 argc_(argc),
00034 argv_(argv)
00035 {
00036 setupUi(this);
00037
00038 stdrInformationTree->header()->setDefaultSectionSize(20);
00039 stdrInformationTree->header()->setMinimumSectionSize(10);
00040
00041 stdrInformationTree->setColumnCount(4);
00042 stdrInformationTree->setColumnWidth(0,200);
00043 stdrInformationTree->setColumnWidth(1,100);
00044 stdrInformationTree->setColumnWidth(2,20);
00045 stdrInformationTree->setColumnWidth(3,20);
00046
00047 QStringList ColumnNames;
00048 ColumnNames << "" << "" << "" << "" << "";
00049
00050 stdrInformationTree->setHeaderLabels(ColumnNames);
00051
00052 generalInfo.setText(0,"Information");
00053 robotsInfo.setText(0,"Robots");
00054
00055 mapWidth.setText(0,"Map width");
00056 mapWidth.setText(1,"-");
00057 generalInfo.addChild(&mapWidth);
00058 mapHeight.setText(0,"Map height");
00059 mapHeight.setText(1,"-");
00060 generalInfo.addChild(&mapHeight);
00061 mapOcgd.setText(0,"Resolution");
00062 mapOcgd.setText(1,"-");
00063 generalInfo.addChild(&mapOcgd);
00064
00065 stdrInformationTree->addTopLevelItem(&generalInfo);
00066 stdrInformationTree->addTopLevelItem(&robotsInfo);
00067
00068 generalInfo.setExpanded(true);
00069 robotsInfo.setExpanded(true);
00070
00071 visible_icon_.addFile(QString((
00072 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00073 std::string("/resources/images/visible.png")).c_str()));
00074
00075 visible_icon_on_.addFile(QString((
00076 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00077 std::string("/resources/images/visible_on.png")).c_str()));
00078 visible_icon_off_.addFile(QString((
00079 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00080 std::string("/resources/images/visible_off.png")).c_str()));
00081 visible_icon_trans_.addFile(QString((
00082 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00083 std::string("/resources/images/visible_transparent.png")).c_str()));
00084 }
00085
00090 CInfoLoader::~CInfoLoader(void)
00091 {
00092
00093 }
00094
00100 void CInfoLoader::deleteTreeNode(QTreeWidgetItem *item)
00101 {
00102 int count = item->childCount();
00103 for(int i = count - 1 ; i >= 0 ; i--)
00104 {
00105 deleteTreeNode(item->child(i));
00106 QTreeWidgetItem *child = item->child(i);
00107 item->removeChild(item->child(i));
00108 delete child;
00109 }
00110 }
00111
00116 void CInfoLoader::deleteTree(void)
00117 {
00118 int count = robotsInfo.childCount();
00119 for(int i = count - 1 ; i >= 0 ; i--)
00120 {
00121
00122 QTreeWidgetItem *child = robotsInfo.child(i);
00123 robotsInfo.removeChild(robotsInfo.child(i));
00124
00125 }
00126 }
00127
00135 void CInfoLoader::updateMapInfo(float width,float height,float ocgd)
00136 {
00137 mapWidth.setText(1,(QString().setNum(width) + QString(" m")));
00138 mapHeight.setText(1,(QString().setNum(height) + QString(" m")));
00139 mapOcgd.setText(1,(QString().setNum(ocgd) + QString(" m/px")));
00140 }
00141
00147 void CInfoLoader::updateRobots(const stdr_msgs::RobotIndexedVectorMsg& msg)
00148 {
00149 for(unsigned int i = 0 ; i < msg.robots.size() ; i++)
00150 {
00151 QTreeWidgetItem *rnode = new QTreeWidgetItem();
00152 rnode->setText(0,QString(msg.robots[i].name.c_str()));
00153 rnode->setIcon(2,visible_icon_on_);
00154 rnode->setIcon(3,visible_icon_);
00155 rnode->setToolTip(2,"Visibility status");
00156 rnode->setToolTip(3,"Visualize robot topics");
00157
00158 QTreeWidgetItem *radius = new QTreeWidgetItem();
00159 radius->setText(0,"Radius");
00160 radius->setText(1,(QString().setNum(
00161 msg.robots[i].robot.footprint.radius) + QString("m")));
00162 rnode->addChild(radius);
00163
00164 QTreeWidgetItem *lasers = new QTreeWidgetItem(),
00165 *sonars = new QTreeWidgetItem(),
00166 *rfids = new QTreeWidgetItem(),
00167 *co2_sensors = new QTreeWidgetItem(),
00168 *thermal_sensors = new QTreeWidgetItem(),
00169 *sound_sensors = new QTreeWidgetItem(),
00170 *kinematics = new QTreeWidgetItem();
00171
00172 lasers->setText(0,"Lasers");
00173 sonars->setText(0,"Sonars");
00174 rfids->setText(0,"RFID readers");
00175 co2_sensors->setText(0,"CO2 sensors");
00176 thermal_sensors->setText(0,"Thermal sensors");
00177 sound_sensors->setText(0,"Sound sensors");
00178 kinematics->setText(0,"Kinematic");
00179 kinematics->setText(1,
00180 QString(msg.robots[i].robot.kinematicModel.type.c_str()));
00181
00182 for(unsigned int l = 0 ; l < msg.robots[i].robot.laserSensors.size() ;
00183 l++)
00184 {
00185 QTreeWidgetItem *lname;
00186 lname=new QTreeWidgetItem();
00187 lname->setText(0,
00188 msg.robots[i].robot.laserSensors[l].frame_id.c_str());
00189
00190 lname->setIcon(2,visible_icon_on_);
00191 lname->setToolTip(2,"Visibility status");
00192 lname->setIcon(3,visible_icon_);
00193 lname->setToolTip(3,"Visualize topic");
00194
00195 QTreeWidgetItem *lrays = new QTreeWidgetItem();
00196 QTreeWidgetItem *lmaxrange = new QTreeWidgetItem();
00197 QTreeWidgetItem *lminrange = new QTreeWidgetItem();
00198 QTreeWidgetItem *lmaxangle = new QTreeWidgetItem();
00199 QTreeWidgetItem *lminangle = new QTreeWidgetItem();
00200 QTreeWidgetItem *lnoisemean = new QTreeWidgetItem();
00201 QTreeWidgetItem *lnoisestd = new QTreeWidgetItem();
00202 QTreeWidgetItem *lfreq = new QTreeWidgetItem();
00203 QTreeWidgetItem *lposex = new QTreeWidgetItem();
00204 QTreeWidgetItem *lposey = new QTreeWidgetItem();
00205 QTreeWidgetItem *lorientation = new QTreeWidgetItem();
00206
00207 lrays->setText(0,"Rays");
00208 lrays->setText(1,QString().setNum(
00209 msg.robots[i].robot.laserSensors[l].numRays));
00210 lmaxrange->setText(0,"Max dist");
00211 lmaxrange->setText(1,(QString().setNum(
00212 msg.robots[i].robot.laserSensors[l].maxRange) + QString(" m")));
00213 lminrange->setText(0,"Min dist");
00214 lminrange->setText(1,(QString().setNum(
00215 msg.robots[i].robot.laserSensors[l].minRange) + QString(" m")));
00216 lmaxangle->setText(0,"Max angle");
00217 lmaxangle->setText(1,(QString().setNum(
00218 msg.robots[i].robot.laserSensors[l].maxAngle) + QString(" rad")));
00219 lminangle->setText(0,"Min angle");
00220 lminangle->setText(1,(QString().setNum(
00221 msg.robots[i].robot.laserSensors[l].minAngle) + QString(" rad")));
00222 lnoisemean->setText(0,"Noise (mean)");
00223 lnoisemean->setText(1,(QString().setNum(
00224 msg.robots[i].robot.laserSensors[l].noise.noiseMean) + QString(" m")));
00225 lnoisestd->setText(0,"Noise (std)");
00226 lnoisestd->setText(1,(QString().setNum(
00227 msg.robots[i].robot.laserSensors[l].noise.noiseStd) + QString(" m")));
00228 lfreq->setText(0,"Frequency");
00229 lfreq->setText(1,(QString().setNum(
00230 msg.robots[i].robot.laserSensors[l].frequency) + QString(" Hz")));
00231
00232 lposex->setText(0,"x pose");
00233 lposex->setText(1,(QString().setNum(
00234 msg.robots[i].robot.laserSensors[l].pose.x) + QString(" m")));
00235 lposey->setText(0,"y pose");
00236 lposey->setText(1,(QString().setNum(
00237 msg.robots[i].robot.laserSensors[l].pose.y) + QString(" m")));
00238 lorientation->setText(0,"Orientation");
00239 lorientation->setText(1,(QString().setNum(
00240 msg.robots[i].robot.laserSensors[l].pose.theta) + QString(" rad")));
00241
00242 lname->addChild(lrays);
00243 lname->addChild(lmaxrange);
00244 lname->addChild(lminrange);
00245 lname->addChild(lmaxangle);
00246 lname->addChild(lminangle);
00247 lname->addChild(lnoisemean);
00248 lname->addChild(lnoisestd);
00249 lname->addChild(lfreq);
00250 lname->addChild(lposex);
00251 lname->addChild(lposey);
00252 lname->addChild(lorientation);
00253
00254 lasers->addChild(lname);
00255 }
00256
00257 for(unsigned int l = 0; l < msg.robots[i].robot.sonarSensors.size() ;
00258 l++)
00259 {
00260 QTreeWidgetItem *sname;
00261 sname = new QTreeWidgetItem();
00262 sname->setText(0,
00263 msg.robots[i].robot.sonarSensors[l].frame_id.c_str());
00264 sname->setIcon(2,visible_icon_on_);
00265 sname->setIcon(3,visible_icon_);
00266
00267 sname->setToolTip(2,"Visibility status");
00268 sname->setToolTip(3,"Visualize topic");
00269
00270 QTreeWidgetItem *smaxrange = new QTreeWidgetItem();
00271 QTreeWidgetItem *sminrange = new QTreeWidgetItem();
00272 QTreeWidgetItem *scone = new QTreeWidgetItem();
00273 QTreeWidgetItem *sorientation = new QTreeWidgetItem();
00274 QTreeWidgetItem *snoisemean = new QTreeWidgetItem();
00275 QTreeWidgetItem *snoisestd = new QTreeWidgetItem();
00276 QTreeWidgetItem *sfreq = new QTreeWidgetItem();
00277 QTreeWidgetItem *sposex = new QTreeWidgetItem();
00278 QTreeWidgetItem *sposey = new QTreeWidgetItem();
00279
00280 smaxrange->setText(0,"Max dist");
00281 smaxrange->setText(1,(QString().setNum(
00282 msg.robots[i].robot.sonarSensors[l].maxRange) + QString(" m")));
00283 sminrange->setText(0,"Min dist");
00284 sminrange->setText(1,(QString().setNum(
00285 msg.robots[i].robot.sonarSensors[l].minRange) + QString(" m")));
00286 scone->setText(0,"Cone");
00287 scone->setText(1,(QString().setNum(
00288 msg.robots[i].robot.sonarSensors[l].coneAngle) + QString(" rad")));
00289 sorientation->setText(0,"Orientation");
00290 sorientation->setText(1,(QString().setNum(
00291 msg.robots[i].robot.sonarSensors[l].pose.theta) + QString(" rad")));
00292 snoisemean->setText(0,"Noise (mean)");
00293 snoisemean->setText(1,(QString().setNum(
00294 msg.robots[i].robot.sonarSensors[l].noise.noiseMean) +
00295 QString(" m")));
00296 snoisestd->setText(0,"Noise (std)");
00297 snoisestd->setText(1,(QString().setNum(
00298 msg.robots[i].robot.sonarSensors[l].noise.noiseStd) + QString(" m")));
00299 sfreq->setText(0,"Frequency");
00300 sfreq->setText(1,(QString().setNum(
00301 msg.robots[i].robot.sonarSensors[l].frequency) + QString(" Hz")));
00302
00303 sposex->setText(0,"x pose");
00304 sposex->setText(1,(QString().setNum(
00305 msg.robots[i].robot.sonarSensors[l].pose.x) + QString(" m")));
00306 sposey->setText(0,"y pose");
00307 sposey->setText(1,(QString().setNum(
00308 msg.robots[i].robot.sonarSensors[l].pose.y) + QString(" m")));
00309
00310 sname->addChild(smaxrange);
00311 sname->addChild(sminrange);
00312 sname->addChild(scone);
00313 sname->addChild(sorientation);
00314 sname->addChild(snoisemean);
00315 sname->addChild(snoisestd);
00316 sname->addChild(sfreq);
00317 sname->addChild(sposex);
00318 sname->addChild(sposey);
00319
00320 sonars->addChild(sname);
00321 }
00322
00323 for(unsigned int l = 0; l < msg.robots[i].robot.rfidSensors.size() ;
00324 l++)
00325 {
00326 QTreeWidgetItem *sname;
00327 sname = new QTreeWidgetItem();
00328 sname->setText(0,
00329 msg.robots[i].robot.rfidSensors[l].frame_id.c_str());
00330 sname->setIcon(2,visible_icon_on_);
00331
00332
00333 sname->setToolTip(2,"Visibility status");
00334
00335
00336 QTreeWidgetItem *smaxrange = new QTreeWidgetItem();
00337 QTreeWidgetItem *sspan = new QTreeWidgetItem();
00338 QTreeWidgetItem *sorientation = new QTreeWidgetItem();
00339 QTreeWidgetItem *sfreq = new QTreeWidgetItem();
00340 QTreeWidgetItem *scutoff = new QTreeWidgetItem();
00341 QTreeWidgetItem *sposex = new QTreeWidgetItem();
00342 QTreeWidgetItem *sposey = new QTreeWidgetItem();
00343
00344 smaxrange->setText(0,"Max dist");
00345 smaxrange->setText(1,(QString().setNum(
00346 msg.robots[i].robot.rfidSensors[l].maxRange) + QString(" m")));
00347
00348 sspan->setText(0,"Angle span");
00349 sspan->setText(1,(QString().setNum(
00350 msg.robots[i].robot.rfidSensors[l].angleSpan)
00351 + QString(" rad")));
00352
00353 sorientation->setText(0,"Orientation");
00354 sorientation->setText(1,(QString().setNum(
00355 msg.robots[i].robot.rfidSensors[l].pose.theta) +
00356 QString(" rad")));
00357
00358 scutoff->setText(0,"Signal Cutoff");
00359 scutoff->setText(1,(QString().setNum(
00360 msg.robots[i].robot.rfidSensors[l].signalCutoff) +
00361 QString("")));
00362
00363 sfreq->setText(0,"Frequency");
00364 sfreq->setText(1,(QString().setNum(
00365 msg.robots[i].robot.rfidSensors[l].frequency) + QString(" Hz")));
00366
00367 sposex->setText(0,"x pose");
00368 sposex->setText(1,(QString().setNum(
00369 msg.robots[i].robot.rfidSensors[l].pose.x) + QString(" m")));
00370
00371 sposey->setText(0,"y pose");
00372 sposey->setText(1,(QString().setNum(
00373 msg.robots[i].robot.rfidSensors[l].pose.y) + QString(" m")));
00374
00375 sname->addChild(smaxrange);
00376 sname->addChild(sspan);
00377 sname->addChild(sorientation);
00378 sname->addChild(scutoff);
00379 sname->addChild(sfreq);
00380 sname->addChild(sposex);
00381 sname->addChild(sposey);
00382
00383 rfids->addChild(sname);
00384 }
00385 for(unsigned int l = 0; l < msg.robots[i].robot.co2Sensors.size() ;
00386 l++)
00387 {
00388 QTreeWidgetItem *sname;
00389 sname = new QTreeWidgetItem();
00390 sname->setText(0,
00391 msg.robots[i].robot.co2Sensors[l].frame_id.c_str());
00392 sname->setIcon(2,visible_icon_on_);
00393
00394
00395 sname->setToolTip(2,"Visibility status");
00396
00397
00398 QTreeWidgetItem *smaxrange = new QTreeWidgetItem();
00399
00400 QTreeWidgetItem *sorientation = new QTreeWidgetItem();
00401 QTreeWidgetItem *sfreq = new QTreeWidgetItem();
00402
00403 QTreeWidgetItem *sposex = new QTreeWidgetItem();
00404 QTreeWidgetItem *sposey = new QTreeWidgetItem();
00405
00406 smaxrange->setText(0,"Max dist");
00407 smaxrange->setText(1,(QString().setNum(
00408 msg.robots[i].robot.co2Sensors[l].maxRange) + QString(" m")));
00409
00410
00411
00412
00413
00414
00415 sorientation->setText(0,"Orientation");
00416 sorientation->setText(1,(QString().setNum(
00417 msg.robots[i].robot.co2Sensors[l].pose.theta) +
00418 QString(" rad")));
00419
00420
00421
00422
00423
00424
00425 sfreq->setText(0,"Frequency");
00426 sfreq->setText(1,(QString().setNum(
00427 msg.robots[i].robot.co2Sensors[l].frequency) + QString(" Hz")));
00428
00429 sposex->setText(0,"x pose");
00430 sposex->setText(1,(QString().setNum(
00431 msg.robots[i].robot.co2Sensors[l].pose.x) + QString(" m")));
00432
00433 sposey->setText(0,"y pose");
00434 sposey->setText(1,(QString().setNum(
00435 msg.robots[i].robot.co2Sensors[l].pose.y) + QString(" m")));
00436
00437 sname->addChild(smaxrange);
00438
00439 sname->addChild(sorientation);
00440
00441 sname->addChild(sfreq);
00442 sname->addChild(sposex);
00443 sname->addChild(sposey);
00444
00445 co2_sensors->addChild(sname);
00446 }
00447 for(unsigned int l = 0; l < msg.robots[i].robot.thermalSensors.size() ;
00448 l++)
00449 {
00450 QTreeWidgetItem *sname;
00451 sname = new QTreeWidgetItem();
00452 sname->setText(0,
00453 msg.robots[i].robot.thermalSensors[l].frame_id.c_str());
00454 sname->setIcon(2,visible_icon_on_);
00455
00456
00457 sname->setToolTip(2,"Visibility status");
00458
00459
00460 QTreeWidgetItem *smaxrange = new QTreeWidgetItem();
00461 QTreeWidgetItem *sspan = new QTreeWidgetItem();
00462 QTreeWidgetItem *sorientation = new QTreeWidgetItem();
00463 QTreeWidgetItem *sfreq = new QTreeWidgetItem();
00464
00465 QTreeWidgetItem *sposex = new QTreeWidgetItem();
00466 QTreeWidgetItem *sposey = new QTreeWidgetItem();
00467
00468 smaxrange->setText(0,"Max dist");
00469 smaxrange->setText(1,(QString().setNum(
00470 msg.robots[i].robot.thermalSensors[l].maxRange) + QString(" m")));
00471
00472 sspan->setText(0,"Angle span");
00473 sspan->setText(1,(QString().setNum(
00474 msg.robots[i].robot.thermalSensors[l].angleSpan)
00475 + QString(" rad")));
00476
00477 sorientation->setText(0,"Orientation");
00478 sorientation->setText(1,(QString().setNum(
00479 msg.robots[i].robot.thermalSensors[l].pose.theta) +
00480 QString(" rad")));
00481
00482
00483
00484
00485
00486
00487 sfreq->setText(0,"Frequency");
00488 sfreq->setText(1,(QString().setNum(
00489 msg.robots[i].robot.thermalSensors[l].frequency) + QString(" Hz")));
00490
00491 sposex->setText(0,"x pose");
00492 sposex->setText(1,(QString().setNum(
00493 msg.robots[i].robot.thermalSensors[l].pose.x) + QString(" m")));
00494
00495 sposey->setText(0,"y pose");
00496 sposey->setText(1,(QString().setNum(
00497 msg.robots[i].robot.thermalSensors[l].pose.y) + QString(" m")));
00498
00499 sname->addChild(smaxrange);
00500 sname->addChild(sspan);
00501 sname->addChild(sorientation);
00502
00503 sname->addChild(sfreq);
00504 sname->addChild(sposex);
00505 sname->addChild(sposey);
00506
00507 thermal_sensors->addChild(sname);
00508 }
00509 for(unsigned int l = 0; l < msg.robots[i].robot.soundSensors.size() ;
00510 l++)
00511 {
00512 QTreeWidgetItem *sname;
00513 sname = new QTreeWidgetItem();
00514 sname->setText(0,
00515 msg.robots[i].robot.soundSensors[l].frame_id.c_str());
00516 sname->setIcon(2,visible_icon_on_);
00517
00518
00519 sname->setToolTip(2,"Visibility status");
00520
00521
00522 QTreeWidgetItem *smaxrange = new QTreeWidgetItem();
00523 QTreeWidgetItem *sspan = new QTreeWidgetItem();
00524 QTreeWidgetItem *sorientation = new QTreeWidgetItem();
00525 QTreeWidgetItem *sfreq = new QTreeWidgetItem();
00526
00527 QTreeWidgetItem *sposex = new QTreeWidgetItem();
00528 QTreeWidgetItem *sposey = new QTreeWidgetItem();
00529
00530 smaxrange->setText(0,"Max dist");
00531 smaxrange->setText(1,(QString().setNum(
00532 msg.robots[i].robot.soundSensors[l].maxRange) + QString(" m")));
00533
00534 sspan->setText(0,"Angle span");
00535 sspan->setText(1,(QString().setNum(
00536 msg.robots[i].robot.soundSensors[l].angleSpan)
00537 + QString(" rad")));
00538
00539 sorientation->setText(0,"Orientation");
00540 sorientation->setText(1,(QString().setNum(
00541 msg.robots[i].robot.soundSensors[l].pose.theta) +
00542 QString(" rad")));
00543
00544
00545
00546
00547
00548
00549 sfreq->setText(0,"Frequency");
00550 sfreq->setText(1,(QString().setNum(
00551 msg.robots[i].robot.soundSensors[l].frequency) + QString(" Hz")));
00552
00553 sposex->setText(0,"x pose");
00554 sposex->setText(1,(QString().setNum(
00555 msg.robots[i].robot.soundSensors[l].pose.x) + QString(" m")));
00556
00557 sposey->setText(0,"y pose");
00558 sposey->setText(1,(QString().setNum(
00559 msg.robots[i].robot.soundSensors[l].pose.y) + QString(" m")));
00560
00561 sname->addChild(smaxrange);
00562 sname->addChild(sspan);
00563 sname->addChild(sorientation);
00564
00565 sname->addChild(sfreq);
00566 sname->addChild(sposex);
00567 sname->addChild(sposey);
00568
00569 sound_sensors->addChild(sname);
00570 }
00571
00572 rnode->addChild(lasers);
00573 rnode->addChild(sonars);
00574 rnode->addChild(rfids);
00575 rnode->addChild(co2_sensors);
00576 rnode->addChild(thermal_sensors);
00577 rnode->addChild(sound_sensors);
00578 rnode->addChild(kinematics);
00579
00580 robotsInfo.addChild(rnode);
00581 }
00582 }
00583 }