Skip to content

Commit

Permalink
Resovled naming conventions regarding custom messages. Renamed publis…
Browse files Browse the repository at this point in the history
…hing topic to follow lowercase conventions
  • Loading branch information
DavidGuamanDavila committed Jan 14, 2024
1 parent 1936556 commit 5496992
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pkg_check_modules(JSONCPP jsoncpp)
## Generate messages in the 'msg' folder
add_message_files(
FILES
ObjDetected.msg
DetectedObj.msg
DetectedObjsArray.msg
)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion msg/DetectedObjsArray.msg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ObjDetected[] objects
DetectedObj[] objects
6 changes: 3 additions & 3 deletions src/object_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <geometry_msgs/Vector3.h>
#include <std_msgs/String.h>
#include <image_transport/image_transport.h>
#include <object_detection_pkg/ObjDetected.h>
#include <object_detection_pkg/DetectedObj.h>
#include <object_detection_pkg/DetectedObjsArray.h>
#include <fstream>
#include <cstdlib>
Expand All @@ -28,7 +28,7 @@ class Image_Finder {
// Subscribing to a camera topic to receive image data
sub_img_ = nh_.subscribe("/camera/color/image_raw", 1, &Image_Finder::imageCallback, this);
// Setting up a publisher for the detected objects
publisher = nh_.advertise<object_detection_pkg::DetectedObjsArray>("/Detected_Objects", 1);
publisher = nh_.advertise<object_detection_pkg::DetectedObjsArray>("/detected_objects", 1);
}

// Function to continue the life of the node
Expand Down Expand Up @@ -124,7 +124,7 @@ class Image_Finder {
}
// Parsing each object in the JSON array
for (const auto& obj : root) {
object_detection_pkg::ObjDetected detected_obj;
object_detection_pkg::DetectedObj detected_obj;
detected_obj.class_name = obj["class_name"].asString();
detected_obj.confidence = obj["confidence"].asDouble();
detected_obj.x_min = obj["x_min"].asInt();
Expand Down

0 comments on commit 5496992

Please sign in to comment.