Modulo 4.2.2
Loading...
Searching...
No Matches
message_writers.hpp
1#pragma once
2
3#include <geometry_msgs/msg/accel_stamped.hpp>
4#include <geometry_msgs/msg/pose_stamped.hpp>
5#include <geometry_msgs/msg/transform_stamped.hpp>
6#include <geometry_msgs/msg/twist_stamped.hpp>
7#include <geometry_msgs/msg/wrench_stamped.hpp>
8#include <rclcpp/time.hpp>
9#include <sensor_msgs/msg/joint_state.hpp>
10#include <std_msgs/msg/bool.hpp>
11#include <std_msgs/msg/float64.hpp>
12#include <std_msgs/msg/float64_multi_array.hpp>
13#include <std_msgs/msg/int32.hpp>
14#include <std_msgs/msg/string.hpp>
15#include <tf2_msgs/msg/tf_message.hpp>
16
17#include <clproto.hpp>
18#include <state_representation/parameters/Parameter.hpp>
19#include <state_representation/space/cartesian/CartesianState.hpp>
20#include <state_representation/space/joint/JointState.hpp>
21
22#include "modulo_core/EncodedState.hpp"
23#include "modulo_core/exceptions.hpp"
24
26
35 geometry_msgs::msg::Accel& message, const state_representation::CartesianState& state, const rclcpp::Time& time);
36
45 geometry_msgs::msg::AccelStamped& message, const state_representation::CartesianState& state,
46 const rclcpp::Time& time);
47
56 geometry_msgs::msg::Pose& message, const state_representation::CartesianState& state, const rclcpp::Time& time);
57
66 geometry_msgs::msg::PoseStamped& message, const state_representation::CartesianState& state,
67 const rclcpp::Time& time);
68
77 geometry_msgs::msg::Transform& message, const state_representation::CartesianState& state,
78 const rclcpp::Time& time);
79
88 geometry_msgs::msg::TransformStamped& message, const state_representation::CartesianState& state,
89 const rclcpp::Time& time);
90
99 geometry_msgs::msg::Twist& message, const state_representation::CartesianState& state, const rclcpp::Time& time);
100
109 geometry_msgs::msg::TwistStamped& message, const state_representation::CartesianState& state,
110 const rclcpp::Time& time);
111
120 geometry_msgs::msg::Wrench& message, const state_representation::CartesianState& state, const rclcpp::Time& time);
121
130 geometry_msgs::msg::WrenchStamped& message, const state_representation::CartesianState& state,
131 const rclcpp::Time& time);
132
141 sensor_msgs::msg::JointState& message, const state_representation::JointState& state, const rclcpp::Time& time);
142
151 tf2_msgs::msg::TFMessage& message, const state_representation::CartesianState& state, const rclcpp::Time& time);
152
162template<typename U, typename T>
163void write_message(U& message, const state_representation::Parameter<T>& state, const rclcpp::Time&);
164
171void write_message(std_msgs::msg::Bool& message, const bool& state, const rclcpp::Time& time);
172
179void write_message(std_msgs::msg::Float64& message, const double& state, const rclcpp::Time& time);
180
187void write_message(
188 std_msgs::msg::Float64MultiArray& message, const std::vector<double>& state, const rclcpp::Time& time);
189
196void write_message(std_msgs::msg::Int32& message, const int& state, const rclcpp::Time& time);
197
204void write_message(std_msgs::msg::String& message, const std::string& state, const rclcpp::Time& time);
205
214template<typename T>
215inline void write_message(EncodedState& message, const T& state, const rclcpp::Time&) {
216 try {
217 std::string tmp = clproto::encode<T>(state);
218 message.data = std::vector<unsigned char>(tmp.begin(), tmp.end());
219 } catch (const std::exception& ex) {
221 }
222}
223}// namespace modulo_core::translators
An exception class to notify that the translation of a ROS message failed.
Modulo Core translation module for converting between ROS2 and state_representation data types.
void write_message(geometry_msgs::msg::Accel &message, const state_representation::CartesianState &state, const rclcpp::Time &time)
Convert a CartesianState to a ROS geometry_msgs::msg::Accel.