From 1fae2c0a03cc0dd8960dfab6f71b108c3bce74d1 Mon Sep 17 00:00:00 2001
From: Paul Beuchat <beuchatp@control.ee.ethz.ch>
Date: Tue, 14 Apr 2020 15:02:33 +0200
Subject: [PATCH] Corrected delaration of a quadrotor simulation in the
 CrazyRadioEmulator node, required editing the CMakeList

---
 dfall_ws/src/dfall_pkg/CMakeLists.txt              |  1 +
 .../dfall_pkg/include/nodes/CrazyRadioEmulator.h   |  3 +--
 .../src/dfall_pkg/src/nodes/CrazyRadioEmulator.cpp | 14 ++++++++++++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/dfall_ws/src/dfall_pkg/CMakeLists.txt b/dfall_ws/src/dfall_pkg/CMakeLists.txt
index 6542cb7f..2c1541a1 100755
--- a/dfall_ws/src/dfall_pkg/CMakeLists.txt
+++ b/dfall_ws/src/dfall_pkg/CMakeLists.txt
@@ -400,6 +400,7 @@ add_executable(FlyingAgentClient         src/nodes/FlyingAgentClient.cpp
 add_executable(BatteryMonitor            src/nodes/BatteryMonitor.cpp
                                          src/classes/GetParamtersAndNamespaces.cpp)
 add_executable(CrazyRadioEmulator        src/nodes/CrazyRadioEmulator.cpp
+                                         src/classes/QuadrotorSimulator.cpp
                                          src/classes/GetParamtersAndNamespaces.cpp)
 add_executable(CsoneControllerService    src/nodes/CsoneControllerService.cpp
                                          src/classes/GetParamtersAndNamespaces.cpp)
diff --git a/dfall_ws/src/dfall_pkg/include/nodes/CrazyRadioEmulator.h b/dfall_ws/src/dfall_pkg/include/nodes/CrazyRadioEmulator.h
index 3a4d7ee6..21b594e2 100644
--- a/dfall_ws/src/dfall_pkg/include/nodes/CrazyRadioEmulator.h
+++ b/dfall_ws/src/dfall_pkg/include/nodes/CrazyRadioEmulator.h
@@ -169,8 +169,7 @@ float yaml_cfStateEstimate_polling_period_in_seconds = 0.2f;
 
 
 // A QUADROTORS SIMULATOR
-//std::vector<QuadrotorSimulator> m_quadrotor_fleet;
-QuadrotorSimulator m_quadrotor_sim();
+QuadrotorSimulator m_quadrotor_sim;
 
 
 
diff --git a/dfall_ws/src/dfall_pkg/src/nodes/CrazyRadioEmulator.cpp b/dfall_ws/src/dfall_pkg/src/nodes/CrazyRadioEmulator.cpp
index c1b081b8..9bad1acf 100644
--- a/dfall_ws/src/dfall_pkg/src/nodes/CrazyRadioEmulator.cpp
+++ b/dfall_ws/src/dfall_pkg/src/nodes/CrazyRadioEmulator.cpp
@@ -548,6 +548,20 @@ int main(int argc, char* argv[])
 
 
 
+	// INITIALISE THE QUADROTOR SIMULATOR
+	// > First conver the agentID to a zero-padded string
+	// Convert the agent ID to a zero padded string
+	std::ostringstream str_stream;
+	str_stream << std::setw(3) << std::setfill('0') << m_agentID;
+	std::string agentID_as_string(str_stream.str());
+	// > Initialise the quadrotor simulator class variable
+	QuadrotorSimulator m_quadrotor_sim = QuadrotorSimulator( "CFSIM" + agentID_as_string , 0.032  );
+	// > Inform the user
+	ROS_INFO_STREAM("[CRAZY RADIO EMULATOR] Initilised quadrotor simulation with ID = " << m_quadrotor_sim.get_id_string() << ", and mass in kg = " << m_quadrotor_sim.get_mass_in_kg() );
+
+
+
+
 	// PUBLISHERS
 
 	// Get a node handle to the Flying Agent Client
-- 
GitLab