Skip to content

Commit

Permalink
First ROS2 (Galactic) version
Browse files Browse the repository at this point in the history
  • Loading branch information
ajtudela committed Dec 12, 2022
1 parent 0b12a96 commit ec3c07d
Show file tree
Hide file tree
Showing 24 changed files with 812 additions and 1,011 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Changelog for package object_detection_openvino
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

4.0.0 (12-12-2022)
------------------
* First ROS2 (Galactic) version.

3.2.2 (26-05-2022)
------------------
* Improve documentation.
Expand Down
162 changes: 74 additions & 88 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,78 +1,57 @@
cmake_minimum_required(VERSION 3.0.2)
cmake_minimum_required(VERSION 3.8)
project(object_detection_openvino)

# Boost
find_package(Boost REQUIRED)
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
#add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# OpenCV
find_package(OpenCV 3 REQUIRED COMPONENTS core imgproc imgcodecs highgui QUIET)
################################################
## Find dependencies ##
################################################
## Find ament macros and libraries
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(tf2 REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(vision_msgs REQUIRED)
find_package(image_transport REQUIRED)
find_package(message_filters REQUIRED)
find_package(visualization_msgs REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(pcl_ros REQUIRED)
find_package(pcl_conversions REQUIRED)
find_package(Boost REQUIRED)

# Ngraph and InferenceEngine
find_package(ngraph REQUIRED)
find_package(InferenceEngine 2.0 REQUIRED)
find_package(InferenceEngine 2021.4.1 REQUIRED)
if(NOT(InferenceEngine_FOUND))
message(WARNING "InferenceEngine is disabled or not found.")
return()
else()
include_directories(${InferenceEngine_INCLUDE_DIRS}/../samples/cpp/common/)
#include_directories(${InferenceEngine_INCLUDE_DIRS}/../samples/cpp/common/utils/include/)
include_directories(${InferenceEngine_INCLUDE_DIRS}/../samples/cpp/common/utils/include/)
endif()

if(TARGET IE::ie_cpu_extension)
add_definitions(-DWITH_EXTENSIONS)
endif()

# Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
roscpp
nodelet
std_msgs
sensor_msgs
geometry_msgs
cv_bridge
image_transport
message_filters
vision_msgs
pcl_ros
pcl_conversions
)


################################################
## Declare ROS messages, services and actions ##
################################################

###################################
## catkin specific configuration ##
###################################
# The catkin_package macro generates cmake config files for your package
# Declare things to be passed to dependent projects
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS
roscpp
nodelet
std_msgs
sensor_msgs
geometry_msgs
cv_bridge
image_transport
message_filters
vision_msgs
pcl_ros
pcl_conversions
DEPENDS Boost
)

###########
## Build ##
###########

# Specify additional locations of header files
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
include
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
include
${Boost_INCLUDE_DIRS}
${InferenceEngine_INCLUDE_DIRS}
)

# Set SOURCES
Expand All @@ -81,29 +60,30 @@ set(SOURCES
src/openvino.cpp
)

# Declare a C++ executable
add_executable(${PROJECT_NAME}_node ${SOURCES} src/objectDetectionVPU_node.cpp)

# Declare a C++ library
add_library(${PROJECT_NAME}_nodelet ${SOURCES} src/objectDetectionVPU_nodelet.cpp)

# Specify libraries to link a library or executable target against
target_link_libraries(${PROJECT_NAME}_node
PRIVATE
${InferenceEngine_LIBRARIES}
${OpenCV_LIBRARIES}
${NGRAPH_LIBRARIES}
${Boost_LIBRARIES}
${catkin_LIBRARIES}
# Executable node
add_executable (${PROJECT_NAME}
${SOURCES}
src/objectDetectionVPU_node.cpp
)
ament_target_dependencies(${PROJECT_NAME}
rclcpp
tf2
std_msgs
sensor_msgs
vision_msgs
image_transport
message_filters
visualization_msgs
cv_bridge
pcl_ros
pcl_conversions
)

target_link_libraries(${PROJECT_NAME}_nodelet
PRIVATE
# Specify libraries to link a library or executable target against
target_link_libraries(${PROJECT_NAME}
${InferenceEngine_LIBRARIES}
${OpenCV_LIBRARIES}
${NGRAPH_LIBRARIES}
${Boost_LIBRARIES}
${catkin_LIBRARIES}
)

if(TARGET IE::ie_cpu_extension)
Expand All @@ -114,26 +94,32 @@ endif()
#############
## Install ##
#############

# Mark executables and/or libraries for installation
install(TARGETS ${PROJECT_NAME}_node ${PROJECT_NAME}_nodelet
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION lib/${PROJECT_NAME}
)

## Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
DESTINATION include/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.hpp"
# PATTERN ".svn" EXCLUDE
)

install(FILES nodelet_plugins.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME}/
)

## Mark launch files for installation
install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
FILES_MATCHING PATTERN "*.launch"
install(DIRECTORY params
DESTINATION share/${PROJECT_NAME}/
)

#############
## Testing ##
#############
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

ament_package()
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*
* DETECTION OBJECT STRUCT
*
* Copyright (c) 2020-2021 Alberto José Tudela Roldán <[email protected]>
* Copyright (c) 2020-2022 Alberto José Tudela Roldán <[email protected]>
*
* This file is part of object_detection_openvino project.
*
* All rights reserved.
*
*/

#ifndef DETECTION_OBJECT_H
#define DETECTION_OBJECT_H
#ifndef OBJECT_DETECTION_OPENVINO__DETECTION_OBJECT_HPP_
#define OBJECT_DETECTION_OPENVINO__DETECTION_OBJECT_HPP_

#include <string>

Expand Down Expand Up @@ -118,12 +118,7 @@ struct DetectionObject{
}

/**
* @brief Relational operator of the confidence of the detected object.
*
* @param s2 Object to compare to.
* @return True if the left object has lower confidence than the right one. False, otherwise.
*/
bool operator<(const DetectionObject &s2) const {
* @brief Relational operator of OBJECT_DETECTION_OPENVINO__YOLO_PARAMS_HPP_bject &s2) const {
return this->confidence < s2.confidence;
}
Expand All @@ -138,4 +133,4 @@ struct DetectionObject{
}
};

#endif
#endif // OBJECT_DETECTION_OPENVINO__DETECTION_OBJECT_HPP_
29 changes: 0 additions & 29 deletions include/object_detection_openvino/nodeletHelper.h

This file was deleted.

Loading

0 comments on commit ec3c07d

Please sign in to comment.