forked from bluespace-ai/bluespace_ai_xsens_ros_mti_driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get rid of undeclared parameters as per ROS 2.0 guidelines, update th…
…e yaml parameter file descriptions accordingly
- Loading branch information
Showing
5 changed files
with
125 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2021 BlueSpace.ai, Inc. | ||
// | ||
// Source code modified from the source provided by Xsens Technologies | ||
|
||
|
||
#ifndef PUBLISHER_HELPER_FUNCTION_H | ||
#define PUBLISHER_HELPER_FUNCTION_H | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <rclcpp/rclcpp.hpp> | ||
|
||
class PublisherHelperFunctions | ||
{ | ||
public: | ||
PublisherHelperFunctions(/* args */); | ||
~PublisherHelperFunctions(); | ||
|
||
void variance_from_stddev_param(std::string param, double *variance_out, rclcpp::Node& node_handle) | ||
{ | ||
std::vector<double> stddev; | ||
if (node_handle.get_parameter(param, stddev)) | ||
{ | ||
if (stddev.size() == 3) | ||
{ | ||
auto squared = [](double x) { return x * x; }; | ||
std::transform(stddev.begin(), stddev.end(), variance_out, squared); | ||
} | ||
else | ||
{ | ||
RCLCPP_WARN(node_handle.get_logger(), "Wrong size of param: %s, must be of size 3", param.c_str()); | ||
} | ||
} | ||
else | ||
{ | ||
memset(variance_out, 0, 3 * sizeof(double)); | ||
} | ||
} | ||
|
||
}; | ||
|
||
PublisherHelperFunctions::PublisherHelperFunctions(/* args */) | ||
{ | ||
} | ||
|
||
PublisherHelperFunctions::~PublisherHelperFunctions() | ||
{ | ||
} | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters