Skip to content

Commit

Permalink
style(pre-commit): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Mar 5, 2024
1 parent f62a230 commit 99524bd
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ include_directories(src/include/)


ament_auto_package(INSTALL_TO_SHARE
launch)
launch)
4 changes: 2 additions & 2 deletions localization/aw_pose_covariance_modifier_node/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<build_depend>rosidl_default_generators</build_depend>

<depend>geometry_msgs</depend>
<depend>rcl_interfaces</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>rcl_interfaces</depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,23 @@ AWPoseCovarianceModifierNode::AWPoseCovarianceModifierNode() : Node("AWPoseCovar
new_pose_estimator_pub_ = this->create_publisher<geometry_msgs::msg::PoseWithCovarianceStamped>(

Check warning on line 28 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L28

Added line #L28 was not covered by tests
"output_pose_with_covariance_topic", 10);

client_ =
this->create_client<rcl_interfaces::srv::SetParameters>("/localization/pose_estimator/ndt_scan_matcher/set_parameters");
client_ = this->create_client<rcl_interfaces::srv::SetParameters>(

Check warning on line 31 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L31

Added line #L31 was not covered by tests
"/localization/pose_estimator/ndt_scan_matcher/set_parameters");

while (!client_->wait_for_service(std::chrono::seconds(1)) && rclcpp::ok()) {
RCLCPP_INFO(
this->get_logger(),
"Waiting for aw_pose_covariance_modifier_node service...");
RCLCPP_INFO(this->get_logger(), "Waiting for aw_pose_covariance_modifier_node service...");

Check warning on line 35 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L34-L35

Added lines #L34 - L35 were not covered by tests
}

activateNDTCovModifier = AWPoseCovarianceModifierNode::callNDTCovarianceModifier();
if (activateNDTCovModifier == 1) {
RCLCPP_INFO(get_logger(), "NDT pose covariance modifier activated ...");

Check warning on line 40 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L38-L40

Added lines #L38 - L40 were not covered by tests
}
else{
} else {
RCLCPP_WARN(get_logger(), "Failed to enable NDT pose covariance modifier ...");

Check warning on line 42 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L42

Added line #L42 was not covered by tests
}
}

Check warning on line 44 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L44

Added line #L44 was not covered by tests

bool AWPoseCovarianceModifierNode::callNDTCovarianceModifier()

Check warning on line 46 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L46

Added line #L46 was not covered by tests
{

auto request = std::make_shared<rcl_interfaces::srv::SetParameters::Request>();

rcl_interfaces::msg::Parameter parameter;

Check warning on line 50 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L50

Added line #L50 was not covered by tests
Expand All @@ -66,14 +62,18 @@ bool AWPoseCovarianceModifierNode::callNDTCovarianceModifier()
auto response = result_.get();

if (response && response->results.data()) {
RCLCPP_INFO(this->get_logger(), "aw_pose_covariance_modifier.enable parameter set successfully.");
RCLCPP_INFO(

Check warning on line 65 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L64-L65

Added lines #L64 - L65 were not covered by tests
this->get_logger(), "aw_pose_covariance_modifier.enable parameter set successfully.");
return true;

Check warning on line 67 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L67

Added line #L67 was not covered by tests
} else {
RCLCPP_ERROR(this->get_logger(), "An error occurred while setting the aw_pose_covariance_modifier.enable parameter.");
RCLCPP_ERROR(

Check warning on line 69 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L69

Added line #L69 was not covered by tests
this->get_logger(),
"An error occurred while setting the aw_pose_covariance_modifier.enable parameter.");
return false;

Check warning on line 72 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L72

Added line #L72 was not covered by tests
}
} else {
RCLCPP_ERROR(this->get_logger(), "The request was not completed within the specified time.");
RCLCPP_ERROR(

Check warning on line 75 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L75

Added line #L75 was not covered by tests
this->get_logger(), "The request was not completed within the specified time.");
return false;

Check warning on line 77 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L77

Added line #L77 was not covered by tests
}
});
Expand Down Expand Up @@ -109,4 +109,4 @@ int main(int argc, char * argv[])
rclcpp::spin(std::make_shared<AWPoseCovarianceModifierNode>());
rclcpp::shutdown();

Check warning on line 110 in localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp

View check run for this annotation

Codecov / codecov/patch

localization/aw_pose_covariance_modifier_node/src/aw_pose_covariance_modifier_node.cpp#L108-L110

Added lines #L108 - L110 were not covered by tests
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
#ifndef AW_POSE_COVARIANCE_MODIFIER_NODE_HPP_
#define AW_POSE_COVARIANCE_MODIFIER_NODE_HPP_

#include <rcl_interfaces/srv/set_parameters.hpp>
#include <rclcpp/rclcpp.hpp>

#include <geometry_msgs/msg/pose_with_covariance_stamped.hpp>
#include <rcl_interfaces/srv/set_parameters.hpp>

#include <string>

class AWPoseCovarianceModifierNode : public rclcpp::Node
Expand All @@ -41,4 +42,4 @@ class AWPoseCovarianceModifierNode : public rclcpp::Node
bool activateNDTCovModifier = 0;
};

#endif // AW_POSE_COVARIANCE_MODIFIER_NODE_HPP_
#endif // AW_POSE_COVARIANCE_MODIFIER_NODE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "localization_util/smart_pose_buffer.hpp"
#include "ndt_scan_matcher/hyper_parameters.hpp"
#include "ndt_scan_matcher/map_update_module.hpp"
#include "rcl_interfaces/srv/set_parameters.hpp"

#include <rclcpp/rclcpp.hpp>
#include <tier4_autoware_utils/ros/logger_level_configure.hpp>
Expand All @@ -42,7 +43,6 @@
#include <tf2/transform_datatypes.h>
#include <tf2_ros/buffer.h>
#include <tf2_ros/transform_listener.h>
#include "rcl_interfaces/srv/set_parameters.hpp"

#ifdef ROS_DISTRO_GALACTIC
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
Expand Down
2 changes: 1 addition & 1 deletion localization/ndt_scan_matcher/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<depend>nav_msgs</depend>
<depend>ndt_omp</depend>
<depend>pcl_conversions</depend>
<depend>rcl_interfaces</depend>
<depend>rclcpp</depend>
<depend>sensor_msgs</depend>
<depend>std_msgs</depend>
Expand All @@ -42,7 +43,6 @@
<depend>tier4_localization_msgs</depend>
<depend>tree_structured_parzen_estimator</depend>
<depend>visualization_msgs</depend>
<depend>rcl_interfaces</depend>

<test_depend>ament_cmake_cppcheck</test_depend>
<test_depend>ament_lint_auto</test_depend>
Expand Down
15 changes: 8 additions & 7 deletions localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ void NDTScanMatcher::setParametersCallback(
{
std::lock_guard<std::mutex> lock(mutex_cov_modifier_);

Check warning on line 199 in localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp

View check run for this annotation

Codecov / codecov/patch

localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp#L199

Added line #L199 was not covered by tests

for (const auto &param : request->parameters) {

if(param.name == "aw_pose_covariance_modifier.enable"){

for (const auto & param : request->parameters) {
if (param.name == "aw_pose_covariance_modifier.enable") {
activate_pose_covariance_modifier_ = param.value.bool_value;

Check warning on line 203 in localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp

View check run for this annotation

Codecov / codecov/patch

localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp#L203

Added line #L203 was not covered by tests
RCLCPP_INFO(this->get_logger(), "aw_pose_covariance_modifier.enable set to : %d", activate_pose_covariance_modifier_);
RCLCPP_INFO(
this->get_logger(), "aw_pose_covariance_modifier.enable set to : %d",
activate_pose_covariance_modifier_);

rcl_interfaces::msg::SetParametersResult result;
result.successful = true;
Expand All @@ -213,11 +213,12 @@ void NDTScanMatcher::setParametersCallback(
}
}

if(activate_pose_covariance_modifier_ == 1){
if (activate_pose_covariance_modifier_ == 1) {
NDTScanMatcher::createTrustedSourcePoseSubscriber();
}
}
void NDTScanMatcher::createTrustedSourcePoseSubscriber(){
void NDTScanMatcher::createTrustedSourcePoseSubscriber()

Check warning on line 220 in localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp

View check run for this annotation

Codecov / codecov/patch

localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp#L219-L220

Added lines #L219 - L220 were not covered by tests
{
trusted_source_pose_sub_ =
this->create_subscription<geometry_msgs::msg::PoseWithCovarianceStamped>(
"input_trusted_pose_topic", 100,
Expand Down

0 comments on commit 99524bd

Please sign in to comment.