diff --git a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.cpp b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.cpp index e92508fb91679b65f8b6bd51d6296915bae5bce9..c2ba86f192f4281e0ee249be2ba9e50f050104fc 100755 --- a/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.cpp +++ b/pps_ws/src/d_fall_pps/GUI_Qt/CrazyFlyGUI/src/mainguiwindow.cpp @@ -73,39 +73,39 @@ void MainGUIWindow::doNumCrazyFlyZonesChanged(int n) // first check if size of tabs is greater than size of vector or viceversa. Have we removed or added a zone? qDebug("tabWidgetCount : %d", ui->tabWidget->count()); - // if(ui->tabWidget->count() > scene->crazyfly_zones.size()) - // { - // // we removed one crazyfly_zone, n means index of the one we removed. Look for that index tab and remove it - // QString qstr = "CrazyFly "; - // qstr.append(QString::number(n+1)); - // if(scene->crazyfly_zones.size() == 0) - // { - // ui->tabWidget->clear(); - // } - // int found_index = getTabIndexFromName(qstr); - // if(found_index != -1) - // { - // ui->tabWidget->widget(found_index)->deleteLater(); - // // ui->tabWidget->removeTab(found_index); - // } - - // // now unlink it from table also: - // #ifdef CATKIN_MAKE - // if(cf_linker->isCFZoneLinked(n)) - // { - // cf_linker->unlink_cf_zone(n); - // } - // #endif - // } - // else if(ui->tabWidget->count() < scene->crazyfly_zones.size()) - // { - // // we added one crazyfly_zone, n means index of the new one. New tab will be labeld index + 1 - // QString qstr = "CrazyFly "; - // qstr.append(QString::number(n+1)); - // crazyFlyZoneTab* widget = new crazyFlyZoneTab(n); - // ui->tabWidget->insertTab(n, widget, qstr); - // connect(widget, SIGNAL(centerButtonClickedSignal(int)), this, SLOT(centerViewIndex(int))); - // } + if(ui->tabWidget->count() > scene->crazyfly_zones.size()) + { + // we removed one crazyfly_zone, n means index of the one we removed. Look for that index tab and remove it + QString qstr = "CrazyFly "; + qstr.append(QString::number(n+1)); + if(scene->crazyfly_zones.size() == 0) + { + ui->tabWidget->clear(); + } + int found_index = getTabIndexFromName(qstr); + if(found_index != -1) + { + ui->tabWidget->widget(found_index)->deleteLater(); + // ui->tabWidget->removeTab(found_index); + } + + // now unlink it from table also: + #ifdef CATKIN_MAKE + if(cf_linker->isCFZoneLinked(n)) + { + cf_linker->unlink_cf_zone(n); + } + #endif + } + else if(ui->tabWidget->count() < scene->crazyfly_zones.size()) + { + // we added one crazyfly_zone, n means index of the new one. New tab will be labeld index + 1 + QString qstr = "CrazyFly "; + qstr.append(QString::number(n+1)); + crazyFlyZoneTab* widget = new crazyFlyZoneTab(n); + ui->tabWidget->insertTab(n, widget, qstr); + connect(widget, SIGNAL(centerButtonClickedSignal(int)), this, SLOT(centerViewIndex(int))); + } // for(int index = 0; index < ui->tabWidget->count(); index++) // { @@ -116,20 +116,20 @@ void MainGUIWindow::doNumCrazyFlyZonesChanged(int n) // // unlink all? // // cf_linker->clear_all_links(); - ui->tabWidget->clear(); + // ui->tabWidget->clear(); - for(int i = 0; i < scene->crazyfly_zones.size(); i++) - { - ROS_INFO("inside for loop"); - QString qstr = "CrazyFly "; - int CF_index = scene->crazyfly_zones[i]->getIndex(); - qstr.append(QString::number(CF_index + 1)); - crazyFlyZoneTab* widget = new crazyFlyZoneTab(i); - // ui->tabWidget->insertTab(i, widget, qstr); - ui->tabWidget->addTab(widget, qstr); - ROS_INFO("Added tab"); - connect(widget, SIGNAL(centerButtonClickedSignal(int)), this, SLOT(centerViewIndex(int))); - } + // for(int i = 0; i < scene->crazyfly_zones.size(); i++) + // { + // ROS_INFO("inside for loop"); + // QString qstr = "CrazyFly "; + // int CF_index = scene->crazyfly_zones[i]->getIndex(); + // qstr.append(QString::number(CF_index + 1)); + // crazyFlyZoneTab* widget = new crazyFlyZoneTab(i); + // // ui->tabWidget->insertTab(i, widget, qstr); + // ui->tabWidget->addTab(widget, qstr); + // ROS_INFO("Added tab"); + // connect(widget, SIGNAL(centerButtonClickedSignal(int)), this, SLOT(centerViewIndex(int))); + // } // for(int i = 0; i < n; i++) diff --git a/pps_ws/src/d_fall_pps/param/Crazyflie.db b/pps_ws/src/d_fall_pps/param/Crazyflie.db index ae58bf5902b521fe11110da12a124a6dd08608e6..8b5dace76c5fb24625f3bc80dbb4e29dd6654395 100644 --- a/pps_ws/src/d_fall_pps/param/Crazyflie.db +++ b/pps_ws/src/d_fall_pps/param/Crazyflie.db @@ -1,3 +1,2 @@ -2,CF1,123,0,0.66,0.11,-0.2,3.46,1.76,2 -1,CF2,1234,1,0.78,-2.09,-0.2,3.38,-0.45,2 -5,CF3,12346,2,3.94,-1.07,-0.2,5.33,0.81,2 +2,CF1,1,0,0.52,0.41,-0.2,1.56,1.55,2 +1,CF2,3,1,-1.15,-0.69,-0.2,0.94,0.46,2