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
00180 for(unsigned int l = 0 ; l < msg.robots[i].robot.laserSensors.size() ;
00181 l++)
00182 {
00183 QTreeWidgetItem *lname;
00184 lname=new QTreeWidgetItem();
00185 lname->setText(0,
00186 msg.robots[i].robot.laserSensors[l].frame_id.c_str());
00187
00188 lname->setIcon(2,visible_icon_on_);
00189 lname->setToolTip(2,"Visibility status");
00190 lname->setIcon(3,visible_icon_);
00191 lname->setToolTip(3,"Visualize topic");
00192
00193 QTreeWidgetItem *lrays = new QTreeWidgetItem();
00194 QTreeWidgetItem *lmaxrange = new QTreeWidgetItem();
00195 QTreeWidgetItem *lminrange = new QTreeWidgetItem();
00196 QTreeWidgetItem *lmaxangle = new QTreeWidgetItem();
00197 QTreeWidgetItem *lminangle = new QTreeWidgetItem();
00198 QTreeWidgetItem *lnoisemean = new QTreeWidgetItem();
00199 QTreeWidgetItem *lnoisestd = new QTreeWidgetItem();
00200 QTreeWidgetItem *lfreq = new QTreeWidgetItem();
00201 QTreeWidgetItem *lposex = new QTreeWidgetItem();
00202 QTreeWidgetItem *lposey = new QTreeWidgetItem();
00203 QTreeWidgetItem *lorientation = new QTreeWidgetItem();
00204
00205 lrays->setText(0,"Rays");
00206 lrays->setText(1,QString().setNum(
00207 msg.robots[i].robot.laserSensors[l].numRays));
00208 lmaxrange->setText(0,"Max dist");
00209 lmaxrange->setText(1,(QString().setNum(
00210 msg.robots[i].robot.laserSensors[l].maxRange) + QString(" m")));
00211 lminrange->setText(0,"Min dist");
00212 lminrange->setText(1,(QString().setNum(
00213 msg.robots[i].robot.laserSensors[l].minRange) + QString(" m")));
00214 lmaxangle->setText(0,"Max angle");
00215 lmaxangle->setText(1,(QString().setNum(
00216 msg.robots[i].robot.laserSensors[l].maxAngle) + QString(" rad")));
00217 lminangle->setText(0,"Min angle");
00218 lminangle->setText(1,(QString().setNum(
00219 msg.robots[i].robot.laserSensors[l].minAngle) + QString(" rad")));
00220 lnoisemean->setText(0,"Noise (mean)");
00221 lnoisemean->setText(1,(QString().setNum(
00222 msg.robots[i].robot.laserSensors[l].noise.noiseMean) + QString(" m")));
00223 lnoisestd->setText(0,"Noise (std)");
00224 lnoisestd->setText(1,(QString().setNum(
00225 msg.robots[i].robot.laserSensors[l].noise.noiseStd) + QString(" m")));
00226 lfreq->setText(0,"Frequency");
00227 lfreq->setText(1,(QString().setNum(
00228 msg.robots[i].robot.laserSensors[l].frequency) + QString(" Hz")));
00229
00230 lposex->setText(0,"x pose");
00231 lposex->setText(1,(QString().setNum(
00232 msg.robots[i].robot.laserSensors[l].pose.x) + QString(" m")));
00233 lposey->setText(0,"y pose");
00234 lposey->setText(1,(QString().setNum(
00235 msg.robots[i].robot.laserSensors[l].pose.y) + QString(" m")));
00236 lorientation->setText(0,"Orientation");
00237 lorientation->setText(1,(QString().setNum(
00238 msg.robots[i].robot.laserSensors[l].pose.theta) + QString(" rad")));
00239
00240 lname->addChild(lrays);
00241 lname->addChild(lmaxrange);
00242 lname->addChild(lminrange);
00243 lname->addChild(lmaxangle);
00244 lname->addChild(lminangle);
00245 lname->addChild(lnoisemean);
00246 lname->addChild(lnoisestd);
00247 lname->addChild(lfreq);
00248 lname->addChild(lposex);
00249 lname->addChild(lposey);
00250 lname->addChild(lorientation);
00251
00252 lasers->addChild(lname);
00253 }
00254
00255 for(unsigned int l = 0; l < msg.robots[i].robot.sonarSensors.size() ;
00256 l++)
00257 {
00258 QTreeWidgetItem *sname;
00259 sname = new QTreeWidgetItem();
00260 sname->setText(0,
00261 msg.robots[i].robot.sonarSensors[l].frame_id.c_str());
00262 sname->setIcon(2,visible_icon_on_);
00263 sname->setIcon(3,visible_icon_);
00264
00265 sname->setToolTip(2,"Visibility status");
00266 sname->setToolTip(3,"Visualize topic");
00267
00268 QTreeWidgetItem *smaxrange = new QTreeWidgetItem();
00269 QTreeWidgetItem *sminrange = new QTreeWidgetItem();
00270 QTreeWidgetItem *scone = new QTreeWidgetItem();
00271 QTreeWidgetItem *sorientation = new QTreeWidgetItem();
00272 QTreeWidgetItem *snoisemean = new QTreeWidgetItem();
00273 QTreeWidgetItem *snoisestd = new QTreeWidgetItem();
00274 QTreeWidgetItem *sfreq = new QTreeWidgetItem();
00275 QTreeWidgetItem *sposex = new QTreeWidgetItem();
00276 QTreeWidgetItem *sposey = new QTreeWidgetItem();
00277
00278 smaxrange->setText(0,"Max dist");
00279 smaxrange->setText(1,(QString().setNum(
00280 msg.robots[i].robot.sonarSensors[l].maxRange) + QString(" m")));
00281 sminrange->setText(0,"Min dist");
00282 sminrange->setText(1,(QString().setNum(
00283 msg.robots[i].robot.sonarSensors[l].minRange) + QString(" m")));
00284 scone->setText(0,"Cone");
00285 scone->setText(1,(QString().setNum(
00286 msg.robots[i].robot.sonarSensors[l].coneAngle) + QString(" rad")));
00287 sorientation->setText(0,"Orientation");
00288 sorientation->setText(1,(QString().setNum(
00289 msg.robots[i].robot.sonarSensors[l].pose.theta) + QString(" rad")));
00290 snoisemean->setText(0,"Noise (mean)");
00291 snoisemean->setText(1,(QString().setNum(
00292 msg.robots[i].robot.sonarSensors[l].noise.noiseMean) +
00293 QString(" m")));
00294 snoisestd->setText(0,"Noise (std)");
00295 snoisestd->setText(1,(QString().setNum(
00296 msg.robots[i].robot.sonarSensors[l].noise.noiseStd) + QString(" m")));
00297 sfreq->setText(0,"Frequency");
00298 sfreq->setText(1,(QString().setNum(
00299 msg.robots[i].robot.sonarSensors[l].frequency) + QString(" Hz")));
00300
00301 sposex->setText(0,"x pose");
00302 sposex->setText(1,(QString().setNum(
00303 msg.robots[i].robot.sonarSensors[l].pose.x) + QString(" m")));
00304 sposey->setText(0,"y pose");
00305 sposey->setText(1,(QString().setNum(
00306 msg.robots[i].robot.sonarSensors[l].pose.y) + QString(" m")));
00307
00308 sname->addChild(smaxrange);
00309 sname->addChild(sminrange);
00310 sname->addChild(scone);
00311 sname->addChild(sorientation);
00312 sname->addChild(snoisemean);
00313 sname->addChild(snoisestd);
00314 sname->addChild(sfreq);
00315 sname->addChild(sposex);
00316 sname->addChild(sposey);
00317
00318 sonars->addChild(sname);
00319 }
00320
00321 for(unsigned int l = 0; l < msg.robots[i].robot.rfidSensors.size() ;
00322 l++)
00323 {
00324 QTreeWidgetItem *sname;
00325 sname = new QTreeWidgetItem();
00326 sname->setText(0,
00327 msg.robots[i].robot.rfidSensors[l].frame_id.c_str());
00328 sname->setIcon(2,visible_icon_on_);
00329
00330
00331 sname->setToolTip(2,"Visibility status");
00332
00333
00334 QTreeWidgetItem *smaxrange = new QTreeWidgetItem();
00335 QTreeWidgetItem *sspan = new QTreeWidgetItem();
00336 QTreeWidgetItem *sorientation = new QTreeWidgetItem();
00337 QTreeWidgetItem *sfreq = new QTreeWidgetItem();
00338 QTreeWidgetItem *scutoff = new QTreeWidgetItem();
00339 QTreeWidgetItem *sposex = new QTreeWidgetItem();
00340 QTreeWidgetItem *sposey = new QTreeWidgetItem();
00341
00342 smaxrange->setText(0,"Max dist");
00343 smaxrange->setText(1,(QString().setNum(
00344 msg.robots[i].robot.rfidSensors[l].maxRange) + QString(" m")));
00345
00346 sspan->setText(0,"Angle span");
00347 sspan->setText(1,(QString().setNum(
00348 msg.robots[i].robot.rfidSensors[l].angleSpan)
00349 + QString(" rad")));
00350
00351 sorientation->setText(0,"Orientation");
00352 sorientation->setText(1,(QString().setNum(
00353 msg.robots[i].robot.rfidSensors[l].pose.theta) +
00354 QString(" rad")));
00355
00356 scutoff->setText(0,"Signal Cutoff");
00357 scutoff->setText(1,(QString().setNum(
00358 msg.robots[i].robot.rfidSensors[l].signalCutoff) +
00359 QString("")));
00360
00361 sfreq->setText(0,"Frequency");
00362 sfreq->setText(1,(QString().setNum(
00363 msg.robots[i].robot.rfidSensors[l].frequency) + QString(" Hz")));
00364
00365 sposex->setText(0,"x pose");
00366 sposex->setText(1,(QString().setNum(
00367 msg.robots[i].robot.rfidSensors[l].pose.x) + QString(" m")));
00368
00369 sposey->setText(0,"y pose");
00370 sposey->setText(1,(QString().setNum(
00371 msg.robots[i].robot.rfidSensors[l].pose.y) + QString(" m")));
00372
00373 sname->addChild(smaxrange);
00374 sname->addChild(sspan);
00375 sname->addChild(sorientation);
00376 sname->addChild(scutoff);
00377 sname->addChild(sfreq);
00378 sname->addChild(sposex);
00379 sname->addChild(sposey);
00380
00381 rfids->addChild(sname);
00382 }
00383 for(unsigned int l = 0; l < msg.robots[i].robot.co2Sensors.size() ;
00384 l++)
00385 {
00386 QTreeWidgetItem *sname;
00387 sname = new QTreeWidgetItem();
00388 sname->setText(0,
00389 msg.robots[i].robot.co2Sensors[l].frame_id.c_str());
00390 sname->setIcon(2,visible_icon_on_);
00391
00392
00393 sname->setToolTip(2,"Visibility status");
00394
00395
00396 QTreeWidgetItem *smaxrange = new QTreeWidgetItem();
00397
00398 QTreeWidgetItem *sorientation = new QTreeWidgetItem();
00399 QTreeWidgetItem *sfreq = new QTreeWidgetItem();
00400
00401 QTreeWidgetItem *sposex = new QTreeWidgetItem();
00402 QTreeWidgetItem *sposey = new QTreeWidgetItem();
00403
00404 smaxrange->setText(0,"Max dist");
00405 smaxrange->setText(1,(QString().setNum(
00406 msg.robots[i].robot.co2Sensors[l].maxRange) + QString(" m")));
00407
00408
00409
00410
00411
00412
00413 sorientation->setText(0,"Orientation");
00414 sorientation->setText(1,(QString().setNum(
00415 msg.robots[i].robot.co2Sensors[l].pose.theta) +
00416 QString(" rad")));
00417
00418
00419
00420
00421
00422
00423 sfreq->setText(0,"Frequency");
00424 sfreq->setText(1,(QString().setNum(
00425 msg.robots[i].robot.co2Sensors[l].frequency) + QString(" Hz")));
00426
00427 sposex->setText(0,"x pose");
00428 sposex->setText(1,(QString().setNum(
00429 msg.robots[i].robot.co2Sensors[l].pose.x) + QString(" m")));
00430
00431 sposey->setText(0,"y pose");
00432 sposey->setText(1,(QString().setNum(
00433 msg.robots[i].robot.co2Sensors[l].pose.y) + QString(" m")));
00434
00435 sname->addChild(smaxrange);
00436
00437 sname->addChild(sorientation);
00438
00439 sname->addChild(sfreq);
00440 sname->addChild(sposex);
00441 sname->addChild(sposey);
00442
00443 co2_sensors->addChild(sname);
00444 }
00445 for(unsigned int l = 0; l < msg.robots[i].robot.thermalSensors.size() ;
00446 l++)
00447 {
00448 QTreeWidgetItem *sname;
00449 sname = new QTreeWidgetItem();
00450 sname->setText(0,
00451 msg.robots[i].robot.thermalSensors[l].frame_id.c_str());
00452 sname->setIcon(2,visible_icon_on_);
00453
00454
00455 sname->setToolTip(2,"Visibility status");
00456
00457
00458 QTreeWidgetItem *smaxrange = new QTreeWidgetItem();
00459 QTreeWidgetItem *sspan = new QTreeWidgetItem();
00460 QTreeWidgetItem *sorientation = new QTreeWidgetItem();
00461 QTreeWidgetItem *sfreq = new QTreeWidgetItem();
00462
00463 QTreeWidgetItem *sposex = new QTreeWidgetItem();
00464 QTreeWidgetItem *sposey = new QTreeWidgetItem();
00465
00466 smaxrange->setText(0,"Max dist");
00467 smaxrange->setText(1,(QString().setNum(
00468 msg.robots[i].robot.thermalSensors[l].maxRange) + QString(" m")));
00469
00470 sspan->setText(0,"Angle span");
00471 sspan->setText(1,(QString().setNum(
00472 msg.robots[i].robot.thermalSensors[l].angleSpan)
00473 + QString(" rad")));
00474
00475 sorientation->setText(0,"Orientation");
00476 sorientation->setText(1,(QString().setNum(
00477 msg.robots[i].robot.thermalSensors[l].pose.theta) +
00478 QString(" rad")));
00479
00480
00481
00482
00483
00484
00485 sfreq->setText(0,"Frequency");
00486 sfreq->setText(1,(QString().setNum(
00487 msg.robots[i].robot.thermalSensors[l].frequency) + QString(" Hz")));
00488
00489 sposex->setText(0,"x pose");
00490 sposex->setText(1,(QString().setNum(
00491 msg.robots[i].robot.thermalSensors[l].pose.x) + QString(" m")));
00492
00493 sposey->setText(0,"y pose");
00494 sposey->setText(1,(QString().setNum(
00495 msg.robots[i].robot.thermalSensors[l].pose.y) + QString(" m")));
00496
00497 sname->addChild(smaxrange);
00498 sname->addChild(sspan);
00499 sname->addChild(sorientation);
00500
00501 sname->addChild(sfreq);
00502 sname->addChild(sposex);
00503 sname->addChild(sposey);
00504
00505 thermal_sensors->addChild(sname);
00506 }
00507 for(unsigned int l = 0; l < msg.robots[i].robot.soundSensors.size() ;
00508 l++)
00509 {
00510 QTreeWidgetItem *sname;
00511 sname = new QTreeWidgetItem();
00512 sname->setText(0,
00513 msg.robots[i].robot.soundSensors[l].frame_id.c_str());
00514 sname->setIcon(2,visible_icon_on_);
00515
00516
00517 sname->setToolTip(2,"Visibility status");
00518
00519
00520 QTreeWidgetItem *smaxrange = new QTreeWidgetItem();
00521 QTreeWidgetItem *sspan = new QTreeWidgetItem();
00522 QTreeWidgetItem *sorientation = new QTreeWidgetItem();
00523 QTreeWidgetItem *sfreq = new QTreeWidgetItem();
00524
00525 QTreeWidgetItem *sposex = new QTreeWidgetItem();
00526 QTreeWidgetItem *sposey = new QTreeWidgetItem();
00527
00528 smaxrange->setText(0,"Max dist");
00529 smaxrange->setText(1,(QString().setNum(
00530 msg.robots[i].robot.soundSensors[l].maxRange) + QString(" m")));
00531
00532 sspan->setText(0,"Angle span");
00533 sspan->setText(1,(QString().setNum(
00534 msg.robots[i].robot.soundSensors[l].angleSpan)
00535 + QString(" rad")));
00536
00537 sorientation->setText(0,"Orientation");
00538 sorientation->setText(1,(QString().setNum(
00539 msg.robots[i].robot.soundSensors[l].pose.theta) +
00540 QString(" rad")));
00541
00542
00543
00544
00545
00546
00547 sfreq->setText(0,"Frequency");
00548 sfreq->setText(1,(QString().setNum(
00549 msg.robots[i].robot.soundSensors[l].frequency) + QString(" Hz")));
00550
00551 sposex->setText(0,"x pose");
00552 sposex->setText(1,(QString().setNum(
00553 msg.robots[i].robot.soundSensors[l].pose.x) + QString(" m")));
00554
00555 sposey->setText(0,"y pose");
00556 sposey->setText(1,(QString().setNum(
00557 msg.robots[i].robot.soundSensors[l].pose.y) + QString(" m")));
00558
00559 sname->addChild(smaxrange);
00560 sname->addChild(sspan);
00561 sname->addChild(sorientation);
00562
00563 sname->addChild(sfreq);
00564 sname->addChild(sposex);
00565 sname->addChild(sposey);
00566
00567 sound_sensors->addChild(sname);
00568 }
00569
00570 rnode->addChild(lasers);
00571 rnode->addChild(sonars);
00572 rnode->addChild(rfids);
00573 rnode->addChild(co2_sensors);
00574 rnode->addChild(thermal_sensors);
00575 rnode->addChild(sound_sensors);
00576 rnode->addChild(kinematics);
00577
00578 robotsInfo.addChild(rnode);
00579 }
00580 }
00581 }