15 #ifndef CONCEALER__PUBLISHER_HPP_
16 #define CONCEALER__PUBLISHER_HPP_
18 #include <get_parameter/get_parameter.hpp>
19 #include <nav_msgs/msg/odometry.hpp>
21 #include <rclcpp/rclcpp.hpp>
29 const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &,
const std::string &)
34 constexpr
auto operator()(T && x)
const -> decltype(
auto)
36 return std::forward<decltype(x)>(x);
46 std::random_device::result_type
seed;
56 std::normal_distribution<double>
additive, multiplicative;
59 const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr & node,
62 common::getParameter<double>(node, prefix +
".additive.mean"),
63 common::getParameter<double>(node, prefix +
".additive.standard_deviation")),
65 common::getParameter<double>(node, prefix +
".multiplicative.mean"),
66 common::getParameter<double>(node, prefix +
".multiplicative.standard_deviation"))
70 auto apply(std::mt19937_64 & engine,
double value) -> decltype(
auto)
72 return value * (multiplicative(engine) + 1.0) + additive(engine);
92 const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &,
const std::string &);
94 auto operator()(nav_msgs::msg::Odometry odometry) -> nav_msgs::msg::Odometry;
97 template <
typename Message,
template <
typename>
typename Randomizer =
Identity>
100 typename rclcpp::Publisher<Message>::SharedPtr publisher;
102 Randomizer<Message> randomize;
105 template <
typename Node>
107 : publisher(node.template create_publisher<Message>(topic, rclcpp::QoS(1).reliable())),
108 randomize(node.get_node_parameters_interface(), topic)
112 template <
typename... Ts>
115 return publisher->publish(randomize(std::forward<decltype(
xs)>(
xs)...));
Definition: publisher.hpp:99
auto operator()(Ts &&... xs) -> decltype(auto)
Definition: publisher.hpp:113
Publisher(const std::string &topic, Node &node)
Definition: publisher.hpp:106
Definition: concatenate.hpp:24
Definition: autoware_universe.hpp:40
Definition: junit5.hpp:25
std::string string
Definition: junit5.hpp:26
Definition: publisher.hpp:27
constexpr Identity(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &, const std::string &)
Definition: publisher.hpp:28
constexpr auto operator()(T &&x) const -> decltype(auto)
Definition: publisher.hpp:34
std::normal_distribution< double > additive
Definition: publisher.hpp:56
Error(const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &node, const std::string &prefix)
Definition: publisher.hpp:58
auto apply(std::mt19937_64 &engine, double value) -> decltype(auto)
Definition: publisher.hpp:70
std::mt19937_64 engine
Definition: publisher.hpp:50
Error linear_z_error
Definition: publisher.hpp:85
Error angular_x_error
Definition: publisher.hpp:86
std::random_device device
Definition: publisher.hpp:48
Error orientation_r_error
Definition: publisher.hpp:80
Error angular_z_error
Definition: publisher.hpp:88
Error linear_y_error
Definition: publisher.hpp:84
Error position_local_x_error
Definition: publisher.hpp:77
double speed_threshold
Definition: publisher.hpp:52
std::random_device::result_type seed
Definition: publisher.hpp:46
Error position_local_z_error
Definition: publisher.hpp:79
Error angular_y_error
Definition: publisher.hpp:87
Error orientation_y_error
Definition: publisher.hpp:82
Error orientation_p_error
Definition: publisher.hpp:81
Error linear_x_error
Definition: publisher.hpp:83
Error position_local_y_error
Definition: publisher.hpp:78
Definition: publisher.hpp:41