3 #include <rclcpp/rclcpp.hpp> 6 #include "pj_msgs/msg/dictionary.hpp" 7 #include "pj_msgs/msg/data_points.hpp" 11 pj_msgs::msg::DataPoint
CreateDataPoint(uint16_t name_index,
double time,
double value)
13 pj_msgs::msg::DataPoint point;
15 point.name_index = name_index;
20 int main(
int argc,
char * argv[])
22 rclcpp::init(argc, argv);
23 auto node = rclcpp::Node::make_shared(
"pj_test");
25 auto publisher_dict = node->create_publisher<pj_msgs::msg::Dictionary>(
"pj_msg_dictionary",
26 rclcpp::QoS(10).transient_local());
27 auto publisher = node->create_publisher<pj_msgs::msg::DataPoints>(
"pj_msg_data", 10);
29 std::random_device rd;
30 const uint32_t UUID = rd();
32 pj_msgs::msg::Dictionary dictionary;
34 dictionary.dictionary_uuid = UUID;
35 dictionary.names.push_back(
"sensor_a");
36 dictionary.names.push_back(
"sensor_b");
37 dictionary.names.push_back(
"sensor_c");
39 publisher_dict->publish(dictionary);
42 rclcpp::WallRate loop_rate(50ms);
44 while (rclcpp::ok()) {
47 pj_msgs::msg::DataPoints msg;
48 msg.dictionary_uuid = UUID;
53 publisher->publish(msg);
54 rclcpp::spin_some(node);
pj_msgs::msg::DataPoint CreateDataPoint(uint16_t name_index, double time, double value)
int main(int argc, char *argv[])