From e65ca7aea887aef7297bab404b88aebb4ff6a09e Mon Sep 17 00:00:00 2001
From: Paul Beuchat <beuchatp@control.ee.ethz.ch>
Date: Wed, 20 Mar 2019 16:44:14 +0100
Subject: [PATCH] Fixed System Conig GUI so that objects with naming convention
 CFXX are plotted as question marks for an XX id that is greater than 9
 (previously nothing was plotted)

---
 .../systemConfigGUI/src/mainguiwindow.cpp     | 31 +++++++++++++------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/dfall_ws/src/dfall_pkg/GUI_Qt/systemConfigGUI/src/mainguiwindow.cpp b/dfall_ws/src/dfall_pkg/GUI_Qt/systemConfigGUI/src/mainguiwindow.cpp
index b8615d17..b17fab5a 100755
--- a/dfall_ws/src/dfall_pkg/GUI_Qt/systemConfigGUI/src/mainguiwindow.cpp
+++ b/dfall_ws/src/dfall_pkg/GUI_Qt/systemConfigGUI/src/mainguiwindow.cpp
@@ -410,16 +410,27 @@ void MainGUIWindow::updateNewViconData(const ptrToMessage& p_msg) //connected to
 
             QString filename(":/images/drone_fixed_");
 
-            if(std::regex_search(s, m, e))
-            {
-                std::string found_string = m[1].str();
-                filename.append(QString::fromStdString(found_string));
-                filename.append(".svg");
-            }
-            else
-            {
-                filename.append("unk.svg");
-            }
+			if(std::regex_search(s, m, e))
+			{
+				// Get the string that was found
+				// > it should be a zero-padded 2-digit number
+				std::string found_string = m[1].str();
+				// Convert to an integer
+				int found_string_as_int = QString::fromStdString(found_string).toInt();
+				if ((1 <= found_string_as_int) && (found_string_as_int <= 9))
+				{
+					filename.append(QString::fromStdString(found_string));
+					filename.append(".svg");
+				}
+				else
+				{
+					filename.append("unk.svg");
+				}
+			}
+			else
+			{
+				filename.append("unk.svg");
+			}
 
             crazyFly* tmp_p_crazyfly = new crazyFly(&(p_msg->crazyflies[i]), filename);
             tmp_p_crazyfly->setScaleCFs(ui->scaleSpinBox->value());
-- 
GitLab