From 43103417298829550a2c74afcb0a65319d74d3b4 Mon Sep 17 00:00:00 2001
From: Angel <roangel@student.ethz.ch>
Date: Tue, 17 Oct 2017 16:46:46 +0200
Subject: [PATCH] fixed problem

---
 pps_ws/src/d_fall_pps/CMakeLists.txt                  | 2 +-
 pps_ws/src/d_fall_pps/msg/{Debug.msg => DebugMsg.msg} | 0
 pps_ws/src/d_fall_pps/msg/Debugging.msg               | 9 ---------
 pps_ws/src/d_fall_pps/src/CustomControllerService.cpp | 8 +++++---
 4 files changed, 6 insertions(+), 13 deletions(-)
 rename pps_ws/src/d_fall_pps/msg/{Debug.msg => DebugMsg.msg} (100%)
 delete mode 100644 pps_ws/src/d_fall_pps/msg/Debugging.msg

diff --git a/pps_ws/src/d_fall_pps/CMakeLists.txt b/pps_ws/src/d_fall_pps/CMakeLists.txt
index db7be180..08a1abf8 100755
--- a/pps_ws/src/d_fall_pps/CMakeLists.txt
+++ b/pps_ws/src/d_fall_pps/CMakeLists.txt
@@ -133,7 +133,7 @@ add_message_files(
   CrazyflieEntry.msg
   CrazyflieDB.msg
   #----------------------------------------------------------------------
-  Debug.msg
+  DebugMsg.msg
 )
 
 ## Generate services in the 'srv' folder
diff --git a/pps_ws/src/d_fall_pps/msg/Debug.msg b/pps_ws/src/d_fall_pps/msg/DebugMsg.msg
similarity index 100%
rename from pps_ws/src/d_fall_pps/msg/Debug.msg
rename to pps_ws/src/d_fall_pps/msg/DebugMsg.msg
diff --git a/pps_ws/src/d_fall_pps/msg/Debugging.msg b/pps_ws/src/d_fall_pps/msg/Debugging.msg
deleted file mode 100644
index 77f25c31..00000000
--- a/pps_ws/src/d_fall_pps/msg/Debugging.msg
+++ /dev/null
@@ -1,9 +0,0 @@
-float64 x
-float64 y
-float64 z
-float64 vx
-float64 vy
-float64 vz
-float64 roll
-float64 pitch
-float64 yaw
diff --git a/pps_ws/src/d_fall_pps/src/CustomControllerService.cpp b/pps_ws/src/d_fall_pps/src/CustomControllerService.cpp
index 2d88f411..4f94cd19 100644
--- a/pps_ws/src/d_fall_pps/src/CustomControllerService.cpp
+++ b/pps_ws/src/d_fall_pps/src/CustomControllerService.cpp
@@ -6,13 +6,14 @@
 #include <math.h>
 #include <stdlib.h>
 #include "ros/ros.h"
+#include <ros/package.h>
 
 //the generated structs from the msg-files have to be included
 #include "d_fall_pps/ViconData.h"
 #include "d_fall_pps/Setpoint.h"
 #include "d_fall_pps/ControlCommand.h"
 #include "d_fall_pps/Controller.h"
-#include "d_fall_pps/Debug.h"
+#include "d_fall_pps/DebugMsg.h"
 
 #include <std_msgs/Int32.h>
 
@@ -129,7 +130,7 @@ bool calculateControlOutput(Controller::Request &request, Controller::Response &
 
 
     // ************ Fill the debugging message with information to be displayed in rqt_plot ****************
-    Debug debugMsg;
+    DebugMsg debugMsg;
     debugMsg.vicon_x = request.ownCrazyflie.x;
     debugMsg.vicon_y = request.ownCrazyflie.y;
     debugMsg.vicon_z = request.ownCrazyflie.z;
@@ -242,6 +243,8 @@ int main(int argc, char* argv[]) {
     ros::NodeHandle nodeHandle("~");
     loadCustomParameters(nodeHandle);
 
+    debugPublisher = nodeHandle.advertise<DebugMsg>("DebugTopic", 1);
+
     ros::Subscriber setpointSubscriber = nodeHandle.subscribe("Setpoint", 1, setpointCallback);
 
     ros::ServiceServer service = nodeHandle.advertiseService("CustomController", calculateControlOutput);
@@ -249,7 +252,6 @@ int main(int argc, char* argv[]) {
     ros::NodeHandle namespace_nodeHandle(ros::this_node::getNamespace());
     ros::Subscriber customYAMLloadedSubscriber = namespace_nodeHandle.subscribe("student_GUI/customYAMLloaded", 1, customYAMLloadedCallback);
 
-    ros::Publisher debugPublisher = nodeHandle.advertise<Debug>("Debug", 1);
 
     ROS_INFO("CustomControllerService ready");
     ros::spin();
-- 
GitLab