Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ament_lint tests to cmakelists instead of github workflows #7

Merged
merged 3 commits into from Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 0 additions & 19 deletions .github/workflows/ci-rolling.yml
Expand Up @@ -25,22 +25,3 @@ jobs:
uses: actions/checkout@v3
- name: Source tests
uses: "ros-industrial/industrial_ci@master"

ament_lint:
name: ament_${{ matrix.linter }}
runs-on: ubuntu-20.04
container:
image: ros:rolling
strategy:
fail-fast: false
matrix:
linter: [copyright, lint_cmake, uncrustify, xmllint]
steps:
- uses: actions/checkout@v3
- uses: ros-tooling/action-ros-lint@v0.1
with:
distribution: rolling
linter: ${{ matrix.linter }}
package-name: |
aruco_opencv
aruco_opencv_msgs
5 changes: 5 additions & 0 deletions aruco_opencv/CMakeLists.txt
Expand Up @@ -55,4 +55,9 @@ install(
DESTINATION share/${PROJECT_NAME}
)

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

ament_package()
5 changes: 4 additions & 1 deletion aruco_opencv/include/aruco_opencv/parameters.hpp
Expand Up @@ -20,6 +20,9 @@

#pragma once

#include <map>
#include <string>

#include "rclcpp/rclcpp.hpp"
#include "rclcpp_lifecycle/lifecycle_node.hpp"

Expand Down Expand Up @@ -220,4 +223,4 @@ void retrieve_aruco_parameters(
}
}

} // namespace aruco_opencv
} // namespace aruco_opencv
3 changes: 2 additions & 1 deletion aruco_opencv/include/aruco_opencv/utils.hpp
Expand Up @@ -20,6 +20,7 @@

#pragma once

#include <string>
#include <unordered_map>

#include <opencv2/aruco.hpp>
Expand All @@ -35,4 +36,4 @@ geometry_msgs::msg::Pose convert_rvec_tvec(const cv::Vec3d & rvec, const cv::Vec

extern const std::unordered_map<std::string, cv::aruco::PREDEFINED_DICTIONARY_NAME> ARUCO_DICT_MAP;

} // namespace aruco_opencv
} // namespace aruco_opencv
7 changes: 7 additions & 0 deletions aruco_opencv/package.xml
Expand Up @@ -35,6 +35,13 @@
<exec_depend>tf2_ros</exec_depend>
<exec_depend>tf2_geometry_msgs</exec_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_cmake_copyright</test_depend>
<test_depend>ament_cmake_cpplint</test_depend>
<test_depend>ament_cmake_lint_cmake</test_depend>
<test_depend>ament_cmake_uncrustify</test_depend>
<test_depend>ament_cmake_xmllint</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down
10 changes: 5 additions & 5 deletions aruco_opencv/src/single_marker_tracker.cpp
Expand Up @@ -87,7 +87,7 @@ class SingleMarkerTracker : public rclcpp_lifecycle::LifecycleNode
std::shared_ptr<tf2_ros::TransformBroadcaster> tf_broadcaster_;

public:
SingleMarkerTracker(rclcpp::NodeOptions options)
explicit SingleMarkerTracker(rclcpp::NodeOptions options)
: LifecycleNode("single_marker_tracker", options),
camera_matrix_(3, 3, CV_64FC1),
distortion_coeffs_(4, 1, CV_64FC1, cv::Scalar(0)),
Expand Down Expand Up @@ -275,7 +275,7 @@ class SingleMarkerTracker : public rclcpp_lifecycle::LifecycleNode
result.successful = true;

// Validate parameters
for (auto & param: parameters) {
for (auto & param : parameters) {
if (param.get_name() == "marker_size") {
if (param.as_double() <= 0.0) {
result.successful = false;
Expand Down Expand Up @@ -359,7 +359,7 @@ class SingleMarkerTracker : public rclcpp_lifecycle::LifecycleNode
std::vector<int> marker_ids;
std::vector<std::vector<cv::Point2f>> marker_corners;

// TODO: mutex
// TODO(bjsowa): mutex
cv::aruco::detectMarkers(
cv_ptr->image, dictionary_, marker_corners, marker_ids,
detector_parameters_);
Expand Down Expand Up @@ -454,7 +454,7 @@ class SingleMarkerTracker : public rclcpp_lifecycle::LifecycleNode
class SingleMarkerTrackerAutostart : public SingleMarkerTracker
{
public:
SingleMarkerTrackerAutostart(rclcpp::NodeOptions options)
explicit SingleMarkerTrackerAutostart(rclcpp::NodeOptions options)
: SingleMarkerTracker(options)
{
auto new_state = configure();
Expand All @@ -464,7 +464,7 @@ class SingleMarkerTrackerAutostart : public SingleMarkerTracker
}
};

} // namespace aruco_opencv
} // namespace aruco_opencv

#include "rclcpp_components/register_node_macro.hpp"
RCLCPP_COMPONENTS_REGISTER_NODE(aruco_opencv::SingleMarkerTracker)
Expand Down
2 changes: 1 addition & 1 deletion aruco_opencv/src/utils.cpp
Expand Up @@ -73,4 +73,4 @@ const std::unordered_map<std::string, cv::aruco::PREDEFINED_DICTIONARY_NAME> ARU
{"APRILTAG_36h11", PREDEFINED_DICTIONARY_NAME::DICT_APRILTAG_36h11},
};

} // namespace aruco_opencv
} // namespace aruco_opencv
5 changes: 5 additions & 0 deletions aruco_opencv_msgs/CMakeLists.txt
Expand Up @@ -12,4 +12,9 @@ rosidl_generate_interfaces(${PROJECT_NAME}
DEPENDENCIES std_msgs geometry_msgs
)

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

ament_package()
3 changes: 3 additions & 0 deletions aruco_opencv_msgs/package.xml
Expand Up @@ -24,6 +24,9 @@

<exec_depend>rosidl_default_runtime</exec_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_cmake_lint_cmake</test_depend>

<member_of_group>rosidl_interface_packages</member_of_group>

<export>
Expand Down