Skip to content

Commit

Permalink
rename files
Browse files Browse the repository at this point in the history
  • Loading branch information
Ar-Ray-code committed Dec 5, 2023
1 parent 9793312 commit f5efcf5
Show file tree
Hide file tree
Showing 27 changed files with 128 additions and 128 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci_humble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:
target-ros2-distro: ${{ matrix.ros_distribution }}
import-token: ${{ secrets.GITHUB_TOKEN }}
package-name: |
panel_detector_base
panel_detector_node
panel_detector_param
panel_detector_plugins
panel_detector
detector2d_base
detector2d_node
detector2d_param
detector2d_plugins
detector2d
vcs-repo-file-url: build_depends.repos
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# PanelDetector
Panel detection node for CoRE-1 2024
# Detector2d
Detection 2d node for CoRE-1 2024

## Node Structure

Expand All @@ -13,22 +13,22 @@ Panel detection node for CoRE-1 2024

| Topic Name | Type | Description |
| --- | --- | --- |
| positions | geometry_msgs/msg/Detection2DArray | Detected panel poses |
| positions | geometry_msgs/msg/Detection2DArray | Detected 2d poses |

### Class Diagram

```mermaid
---
title: Panel Detector Plugin hierarchy
title: Detector2d Plugin hierarchy
---
classDiagram
PanelDetectorNode <-- DetectorPluginA : load as dll
PanelDetectorNode <-- DetectorPluginB : load as dll
Detector2dNode <-- DetectorPluginA : load as dll
Detector2dNode <-- DetectorPluginB : load as dll
DetectorPluginA <|-- DetectorBase : include
DetectorPluginB <|-- DetectorBase : include
PanelDetectorNode <|-- DetectorBase : include
PanelDetectorNode: params
PanelDetectorNode: image_callback(Image)
Detector2dNode <|-- DetectorBase : include
Detector2dNode: params
Detector2dNode: image_callback(Image)
class DetectorPluginA{
filter_kernel_param_a
init(params)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
project(panel_detector)
project(detector2d)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions panel_detector/package.xml → detector2d/package.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>panel_detector</name>
<name>detector2d</name>
<version>0.0.0</version>
<description>Panel detection pkg for CoRE-1 2024</description>
<description>Detector2d pkg for CoRE-1 2024</description>
<maintainer email="[email protected]">Ar-Ray-code</maintainer>
<license>Apache-2.0</license>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
project(panel_detector_base)
project(detector2d_base)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#pragma once

#include <panel_detector_param/panel_detector_param.hpp>
#include <detector2d_param/detector2d_param.hpp>
#include <vector>
#include <vision_msgs/msg/detection2_d_array.hpp>
#include <opencv2/opencv.hpp>

namespace panel_detector_base
namespace detector2d_base
{
class Detector
{
public:
virtual void init(const panel_detector_parameters::ParamListener & param_listener) = 0;
virtual void init(const detector2d_parameters::ParamListener & param_listener) = 0;
virtual vision_msgs::msg::Detection2DArray detect(const cv::Mat & image) = 0;
virtual ~Detector() {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>panel_detector_base</name>
<name>detector2d_base</name>
<version>0.0.0</version>
<description>Panel detector plugin base</description>
<description>Detector2d plugin base</description>
<maintainer email="[email protected]">Ar-Ray-code</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_auto</buildtool_depend>

<depend>libopencv-dev</depend>
<depend>panel_detector_param</depend>
<depend>detector2d_param</depend>
<depend>rclcpp_lifecycle</depend>
<depend>vision_msgs</depend>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
project(panel_detector_node)
project(detector2d_node)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
Expand All @@ -10,13 +10,13 @@ ament_auto_find_build_dependencies()
find_package(OpenCV REQUIRED)

ament_auto_add_library(${PROJECT_NAME} SHARED
src/panel_detector.cpp
src/detector2d_node.cpp
)
ament_target_dependencies(${PROJECT_NAME} OpenCV)

rclcpp_components_register_node(
${PROJECT_NAME}
PLUGIN "${PROJECT_NAME}::PanelDetectorNode"
PLUGIN "${PROJECT_NAME}::Detector2dNode"
EXECUTABLE ${PROJECT_NAME}_exec)

if(BUILD_TESTING)
Expand Down
27 changes: 27 additions & 0 deletions detector2d_node/include/detector2d_node/detector2d_node.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once

#include <cv_bridge/cv_bridge.h>
#include <detector2d_base/detector2d_base.hpp>
#include <detector2d_param/detector2d_param.hpp>
#include <pluginlib/class_loader.hpp>
#include <rclcpp/rclcpp.hpp>
#include <sensor_msgs/msg/image.hpp>
#include <vision_msgs/msg/detection2_d_array.hpp>

namespace detector2d_node
{
class Detector2dNode : public rclcpp::Node
{
public:
Detector2dNode(const rclcpp::NodeOptions &);
void image_callback(const sensor_msgs::msg::Image::SharedPtr msg);

private:
rclcpp::Subscription<sensor_msgs::msg::Image>::SharedPtr image_sub_;
rclcpp::Publisher<vision_msgs::msg::Detection2DArray>::SharedPtr pose_pub_;
pluginlib::ClassLoader<detector2d_base::Detector> detection_loader_;
std::shared_ptr<detector2d_base::Detector> detector_;

std::shared_ptr<detector2d_parameters::ParamListener> param_listener_;
};
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>panel_detector_node</name>
<name>detector2d_node</name>
<version>0.0.0</version>
<description>Panel detector node for CoRE-1</description>
<description>Detector2d node for CoRE-1</description>
<maintainer email="[email protected]">Ar-Ray-code</maintainer>
<license>Apache License 2.0</license>

Expand All @@ -12,7 +12,7 @@
<depend>cv_bridge</depend>
<depend>libopencv-dev</depend>
<depend>pluginlib</depend>
<depend>panel_detector_plugins</depend>
<depend>detector2d_plugins</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>sensor_msgs</depend>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <panel_detector_node/panel_detector_node.hpp>
#include <detector2d_node/detector2d_node.hpp>

namespace panel_detector_node
namespace detector2d_node
{

PanelDetectorNode::PanelDetectorNode(const rclcpp::NodeOptions & options)
: rclcpp::Node("panel_detector_node", options),
detection_loader_("panel_detector_base", "panel_detector_base::Detector")
Detector2dNode::Detector2dNode(const rclcpp::NodeOptions & options)
: rclcpp::Node("detector2d_node", options),
detection_loader_("detector2d_base", "detector2d_base::Detector")
{
this->param_listener_ = std::make_shared<panel_detector_parameters::ParamListener>(
this->param_listener_ = std::make_shared<detector2d_parameters::ParamListener>(
this->get_node_parameters_interface());
const auto params = this->param_listener_->get_params();

Expand All @@ -23,10 +23,10 @@ PanelDetectorNode::PanelDetectorNode(const rclcpp::NodeOptions & options)
this->pose_pub_ = this->create_publisher<vision_msgs::msg::Detection2DArray>(
"positions", 1);
this->image_sub_ = this->create_subscription<sensor_msgs::msg::Image>(
"image_raw", 1, std::bind(&PanelDetectorNode::image_callback, this, std::placeholders::_1));
"image_raw", 1, std::bind(&Detector2dNode::image_callback, this, std::placeholders::_1));
}

void PanelDetectorNode::image_callback(const sensor_msgs::msg::Image::SharedPtr msg)
void Detector2dNode::image_callback(const sensor_msgs::msg::Image::SharedPtr msg)
{
vision_msgs::msg::Detection2DArray bboxes =
this->detector_->detect(cv_bridge::toCvShare(msg, "bgr8")->image);
Expand All @@ -37,7 +37,7 @@ void PanelDetectorNode::image_callback(const sensor_msgs::msg::Image::SharedPtr
}
this->pose_pub_->publish(bboxes);
}
} // namespace panel_detector_node
} // namespace detector2d_node

#include "rclcpp_components/register_node_macro.hpp"
RCLCPP_COMPONENTS_REGISTER_NODE(panel_detector_node::PanelDetectorNode)
RCLCPP_COMPONENTS_REGISTER_NODE(detector2d_node::Detector2dNode)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
project(panel_detector_param)
project(detector2d_param)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
Expand All @@ -11,7 +11,7 @@ ament_auto_find_build_dependencies()
find_package(generate_parameter_library REQUIRED)

generate_parameter_library(${PROJECT_NAME}
src/panel_detector_parameters.yaml
src/detector2d_parameters.yaml
)

if(BUILD_TESTING)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>panel_detector_param</name>
<name>detector2d_param</name>
<version>0.0.0</version>
<description>Panel detector parameter package</description>
<description>Detector2d parameter package</description>
<maintainer email="[email protected]">Ar-Ray-code</maintainer>
<license>Apache-2.0</license>

Expand Down
6 changes: 6 additions & 0 deletions detector2d_param/src/detector2d_parameters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
detector2d_parameters:
load_target_plugin:
type: string
description: "load target plugin"
default_value: "detector2d_plugins::PublishCenter"

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.8)
project(panel_detector_plugins)
project(detector2d_plugins)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
Expand All @@ -10,7 +10,7 @@ ament_auto_find_build_dependencies()
find_package(OpenCV REQUIRED)

file(GLOB_RECURSE SRCS src/*.cpp)
ament_auto_add_library(panel_detector_plugins SHARED
ament_auto_add_library(detector2d_plugins SHARED
${SRCS}
)
ament_target_dependencies(${PROJECT_NAME} OpenCV)
Expand All @@ -32,7 +32,7 @@ if(BUILD_TESTING)
endforeach()
endif()

pluginlib_export_plugin_description_file(panel_detector_base panel_detector_plugins.xml)
pluginlib_export_plugin_description_file(detector2d_base detector2d_plugins.xml)

include_directories(include)
ament_auto_package()
5 changes: 5 additions & 0 deletions detector2d_plugins/detector2d_plugins.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<library path="detector2d_plugins">
<class type="detector2d_plugins::PublishCenter" base_class_type="detector2d_base::Detector">
<description>publish image center example</description>
</class>
</library>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include <detector2d_base/detector2d_base.hpp>
#include <detector2d_param/detector2d_param.hpp>
#include <vision_msgs/msg/detection2_d_array.hpp>

namespace detector2d_plugins
{
typedef vision_msgs::msg::Detection2DArray Detection2DArray;
class PublishCenter : public detector2d_base::Detector
{
public:
void init(const detector2d_parameters::ParamListener &) override;
Detection2DArray detect(const cv::Mat &) override;
};
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>panel_detector_plugins</name>
<name>detector2d_plugins</name>
<version>0.0.0</version>
<description>Panel detector plugins for CoRE-1</description>
<description>Detector2d plugins for CoRE-1</description>
<maintainer email="[email protected]">Ar-Ray-code</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_auto</buildtool_depend>

<depend>libopencv-dev</depend>
<depend>panel_detector_base</depend>
<depend>panel_detector_param</depend>
<depend>detector2d_base</depend>
<depend>detector2d_param</depend>
<depend>pluginlib</depend>
<depend>rclcpp_lifecycle</depend>
<depend>vision_msgs</depend>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "panel_detector_plugins/publish_center_plugin.hpp"
#include "detector2d_plugins/publish_center_plugin.hpp"

namespace panel_detector_plugins
namespace detector2d_plugins
{

void PublishCenter::init(const panel_detector_parameters::ParamListener & param_listener)
void PublishCenter::init(const detector2d_parameters::ParamListener & param_listener)
{
(void)param_listener;
}
Expand All @@ -21,4 +21,4 @@ Detection2DArray PublishCenter::detect(const cv::Mat & image)
}

#include <pluginlib/class_list_macros.hpp>
PLUGINLIB_EXPORT_CLASS(panel_detector_plugins::PublishCenter, panel_detector_base::Detector)
PLUGINLIB_EXPORT_CLASS(detector2d_plugins::PublishCenter, detector2d_base::Detector)
Loading

0 comments on commit f5efcf5

Please sign in to comment.