forked from rerun-io/cpp-example-ros2-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualizer_node.cpp
More file actions
631 lines (562 loc) · 24.3 KB
/
Copy pathvisualizer_node.cpp
File metadata and controls
631 lines (562 loc) · 24.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
#include "visualizer_node.hpp"
#include "rerun_bridge/rerun_ros_interface.hpp"
#include <algorithm>
#include <chrono>
#include <memory>
#include <ament_index_cpp/get_package_prefix.hpp>
#include <ament_index_cpp/get_package_share_directory.hpp>
using namespace std::chrono_literals;
ImageOptions image_options_from_topic_options(const TopicOptions& topic_options) {
ImageOptions options;
if (topic_options.find("min_depth") != topic_options.end()) {
options.min_depth = topic_options.at("min_depth").as<float>();
}
if (topic_options.find("max_depth") != topic_options.end()) {
options.max_depth = topic_options.at("max_depth").as<float>();
}
return options;
}
PointCloud2Options point_cloud2_options_from_topic_options(const TopicOptions& topic_options) {
PointCloud2Options options;
if (topic_options.find("colormap") != topic_options.end()) {
options.colormap = topic_options.at("colormap").as<std::string>();
}
if (topic_options.find("colormap_field") != topic_options.end()) {
options.colormap_field = topic_options.at("colormap_field").as<std::string>();
}
if (topic_options.find("colormap_min") != topic_options.end()) {
options.colormap_min = topic_options.at("colormap_min").as<float>();
}
if (topic_options.find("colormap_max") != topic_options.end()) {
options.colormap_max = topic_options.at("colormap_max").as<float>();
}
return options;
}
std::string parent_entity_path(const std::string& entity_path) {
auto last_slash = entity_path.rfind('/');
if (last_slash == std::string::npos) {
return "";
}
return entity_path.substr(0, last_slash);
}
std::string resolve_ros_path(const std::string& path) {
if (path.find("package://") == 0) {
std::string package_name = path.substr(10, path.find('/', 10) - 10);
std::string relative_path = path.substr(10 + package_name.size());
try {
std::string package_path = ament_index_cpp::get_package_share_directory(package_name);
return package_path + relative_path;
} catch (ament_index_cpp::PackageNotFoundError& e) {
throw std::runtime_error(
"Could not resolve " + path +
". Replace with relative / absolute path, source the correct ROS environment, or install " +
package_name + "."
);
}
} else if (path.find("file://") == 0) {
return path.substr(7);
} else {
return path;
}
}
RerunLoggerNode::RerunLoggerNode() : Node("rerun_logger_node") {
_rec.spawn().exit_on_failure();
_parallel_callback_group = this->create_callback_group(rclcpp::CallbackGroupType::Reentrant);
_tf_buffer = std::make_unique<tf2_ros::Buffer>(this->get_clock());
_tf_listener = std::make_unique<tf2_ros::TransformListener>(*_tf_buffer);
_last_tf_update_time = this->get_clock()->now();
// Read additional config from yaml file
// NOTE We're not using the ROS parameter server for this, because roscpp doesn't support
// reading nested data structures.
std::string yaml_path;
this->declare_parameter("yaml_path", "");
if (this->get_parameter("yaml_path", yaml_path)) {
RCLCPP_INFO(this->get_logger(), "Read yaml config at %s", yaml_path.c_str());
}
_read_yaml_config(yaml_path);
// check for new topics every 0.1 seconds
_create_subscriptions_timer = this->create_wall_timer(
100ms,
[&]() -> void { _create_subscriptions(); },
_parallel_callback_group
);
if (_tf_fixed_rate != 0.0) {
_update_tf_timer = this->create_wall_timer(
std::chrono::duration<float>(1. / _tf_fixed_rate),
[&]() { _update_tf(); },
_parallel_callback_group
);
}
}
/// Convert a topic name to its entity path.
/// If the topic is explicitly mapped to an entity path, use that.
/// Otherwise, the topic name will be automatically converted to a flattened entity path like this:
/// "/one/two/three/four" -> "/topics/one-two-three/four"
std::string RerunLoggerNode::_resolve_entity_path(
const std::string& topic, const TopicOptions& topic_options
) const {
if (topic_options.find("entity_path") != topic_options.end()) {
return topic_options.at("entity_path").as<std::string>();
} else {
std::string flattened_topic = topic;
auto last_slash =
(std::find(flattened_topic.rbegin(), flattened_topic.rend(), '/') + 1).base();
if (last_slash != flattened_topic.begin()) {
// keep leading slash and last slash
std::replace(flattened_topic.begin() + 1, last_slash, '/', '-');
}
return "/topics" + flattened_topic;
}
}
// Resolve topic options for a given topic.
// The options are merged from all matching keys overwriting previous values in the following order:
// 1. Options for partial topic names (such as /, /ns, etc.)
// 2. Options for message types (such as sensor_msgs::msg::Image)
// 3. Options for the exact topic name (such as /ns/topic)
// Aside from these rules, the options are merged in the order they are defined in the yaml file.
TopicOptions RerunLoggerNode::_resolve_topic_options(
const std::string& topic, const std::string& message_type
) const {
TopicOptions merged_options;
// 1. partial topic names
for (const auto& [prefix, options] : _raw_topic_options) {
if (topic.find(prefix) == 0) {
merged_options.insert(options.begin(), options.end());
}
}
// 2. message types
if (_raw_topic_options.find(message_type) != _raw_topic_options.end()) {
auto options = _raw_topic_options.at(message_type);
merged_options.insert(options.begin(), options.end());
}
// 3. exact topic name
if (_raw_topic_options.find(topic) != _raw_topic_options.end()) {
auto options = _raw_topic_options.at(topic);
merged_options.insert(options.begin(), options.end());
}
return merged_options;
}
void RerunLoggerNode::_read_yaml_config(std::string yaml_path) {
const YAML::Node config = YAML::LoadFile(yaml_path);
// see https://www.rerun.io/docs/howto/ros2-nav-turtlebot#tf-to-rrtransform3d
if (config["extra_transform3ds"]) {
for (const auto& extra_transform3d : config["extra_transform3ds"]) {
const std::array<float, 3> translation = {
extra_transform3d["transform"][3].as<float>(),
extra_transform3d["transform"][7].as<float>(),
extra_transform3d["transform"][11].as<float>()};
// Rerun uses column-major order for Mat3x3
const std::array<float, 9> mat3x3 = {
extra_transform3d["transform"][0].as<float>(),
extra_transform3d["transform"][4].as<float>(),
extra_transform3d["transform"][8].as<float>(),
extra_transform3d["transform"][1].as<float>(),
extra_transform3d["transform"][5].as<float>(),
extra_transform3d["transform"][9].as<float>(),
extra_transform3d["transform"][2].as<float>(),
extra_transform3d["transform"][6].as<float>(),
extra_transform3d["transform"][10].as<float>()};
_rec.log_static(
extra_transform3d["entity_path"].as<std::string>(),
rerun::Transform3D(
rerun::Vec3D(translation),
rerun::Mat3x3(mat3x3),
extra_transform3d["from_parent"].as<bool>()
)
);
}
}
if (config["extra_pinholes"]) {
for (const auto& extra_pinhole : config["extra_pinholes"]) {
// Rerun uses column-major order for Mat3x3
const std::array<float, 9> image_from_camera = {
extra_pinhole["image_from_camera"][0].as<float>(),
extra_pinhole["image_from_camera"][3].as<float>(),
extra_pinhole["image_from_camera"][6].as<float>(),
extra_pinhole["image_from_camera"][1].as<float>(),
extra_pinhole["image_from_camera"][4].as<float>(),
extra_pinhole["image_from_camera"][7].as<float>(),
extra_pinhole["image_from_camera"][2].as<float>(),
extra_pinhole["image_from_camera"][5].as<float>(),
extra_pinhole["image_from_camera"][8].as<float>(),
};
_rec.log_static(
extra_pinhole["entity_path"].as<std::string>(),
rerun::Pinhole(image_from_camera)
.with_resolution(
extra_pinhole["width"].as<int>(),
extra_pinhole["height"].as<int>()
)
);
}
}
if (config["tf"]) {
if (config["tf"]["update_rate"]) {
_tf_fixed_rate = config["tf"]["update_rate"].as<float>();
}
if (config["tf"]["tree"] && config["tf"]["tree"].size()) {
// set root frame, all messages with frame_id will be logged relative to this frame
_root_frame = config["tf"]["tree"].begin()->first.as<std::string>();
// recurse through the tree and add all transforms
_add_tf_tree(config["tf"]["tree"], "", "");
}
}
if (config["topic_options"]) {
_raw_topic_options = config["topic_options"].as<std::map<std::string, TopicOptions>>();
}
if (config["urdf"]) {
std::string urdf_entity_path;
if (config["urdf"]["entity_path"]) {
urdf_entity_path = config["urdf"]["entity_path"].as<std::string>();
}
if (config["urdf"]["file_path"]) {
std::string urdf_file_path =
resolve_ros_path(config["urdf"]["file_path"].as<std::string>());
if (urdf_file_path.size()) {
RCLCPP_INFO(
this->get_logger(),
"Logging URDF from file path %s",
urdf_file_path.c_str()
);
_rec.log_file_from_path(urdf_file_path, urdf_entity_path, true);
}
}
}
}
void RerunLoggerNode::_add_tf_tree(
const YAML::Node& topic_options, const std::string& parent_entity_path,
const ::std::string& parent_frame
) {
for (const auto& child : topic_options) {
auto frame = child.first.as<std::string>();
auto value = child.second;
const std::string entity_path = parent_entity_path + "/" + frame;
_tf_frame_to_entity_path[frame] = entity_path;
_tf_frame_to_parent[frame] = parent_frame;
RCLCPP_INFO(
this->get_logger(),
"Mapping tf frame %s to entity path %s",
frame.c_str(),
entity_path.c_str()
);
if (value.size() >= 1) {
_add_tf_tree(value, entity_path, frame);
}
}
}
void RerunLoggerNode::_create_subscriptions() {
for (const auto& [topic_name, topic_types] : this->get_topic_names_and_types()) {
// already subscribed to this topic?
if (_topic_to_subscription.find(topic_name) != _topic_to_subscription.end()) {
continue;
}
if (topic_types.size() != 1) {
RCLCPP_WARN(
this->get_logger(),
"Skipping topic %s with multiple types",
topic_name.c_str()
);
continue;
}
const auto topic_type = topic_types[0];
const auto message_type = topic_types[0];
const auto topic_options = _resolve_topic_options(topic_name, message_type);
if (topic_type == "sensor_msgs/msg/Image") {
_topic_to_subscription[topic_name] =
_create_image_subscription(topic_name, topic_options);
} else if (topic_type == "sensor_msgs/msg/Imu") {
_topic_to_subscription[topic_name] =
_create_imu_subscription(topic_name, topic_options);
} else if (topic_type == "geometry_msgs/msg/PoseStamped") {
_topic_to_subscription[topic_name] =
_create_pose_stamped_subscription(topic_name, topic_options);
} else if (topic_type == "tf2_msgs/msg/TFMessage") {
_topic_to_subscription[topic_name] =
_create_tf_message_subscription(topic_name, topic_options);
} else if (topic_type == "nav_msgs/msg/Odometry") {
_topic_to_subscription[topic_name] =
_create_odometry_subscription(topic_name, topic_options);
} else if (topic_type == "sensor_msgs/msg/CameraInfo") {
_topic_to_subscription[topic_name] =
_create_camera_info_subscription(topic_name, topic_options);
} else if (topic_type == "sensor_msgs/msg/PointCloud2") {
_topic_to_subscription[topic_name] =
_create_point_cloud2_subscription(topic_name, topic_options);
} else if (topic_type == "sensor_msgs/msg/JointState") {
_topic_to_subscription[topic_name] =
_create_joint_state_subscription(topic_name, topic_options);
}
}
}
void RerunLoggerNode::_update_tf() {
// NOTE We log the interpolated transforms with an offset assuming the whole tree has
// been updated after this offset. This is not an ideal solution. If a frame is updated
// with a delay longer than this offset we will never log interpolated transforms for it.
// It might be possible to always log the interpolated transforms on a per frame basis whenever
// a new message is received for that frame. This would require maintaining the latest
// transform for each frame. However, this would not work if transforms for a frame arrive
// out of order (maybe this is not a problem in practice?).
auto now = this->get_clock()->now();
// If no time has passed since the last update, don't do anything
// This can happen when using simulation time that does not keep going at the end
if (now - _last_tf_update_time == 0s) {
return;
}
for (const auto& [frame, entity_path] : _tf_frame_to_entity_path) {
auto parent = _tf_frame_to_parent.find(frame);
if (parent == _tf_frame_to_parent.end() or parent->second.empty()) {
continue;
}
try {
auto transform = std::make_shared<geometry_msgs::msg::TransformStamped>(
_tf_buffer->lookupTransform(parent->second, frame, now - rclcpp::Duration(1, 0))
);
log_transform(_rec, entity_path, transform);
_last_tf_update_time = now;
} catch (tf2::TransformException& ex) {
RCLCPP_WARN_THROTTLE(
this->get_logger(),
*this->get_clock(),
1000,
"Could not lookup transform: %s",
ex.what()
);
}
}
}
std::shared_ptr<rclcpp::Subscription<sensor_msgs::msg::Image>>
RerunLoggerNode::_create_image_subscription(
const std::string& topic, const TopicOptions& topic_options
) {
std::string entity_path = _resolve_entity_path(topic, topic_options);
bool lookup_transform = (topic_options.find("entity_path") == topic_options.end());
bool restamp = false;
if (topic_options.find("restamp") != topic_options.end()) {
restamp = topic_options.at("restamp").as<bool>();
}
auto image_options = image_options_from_topic_options(topic_options);
rclcpp::SubscriptionOptions subscription_options;
subscription_options.callback_group = _parallel_callback_group;
RCLCPP_INFO(
this->get_logger(),
"Subscribing to Image topic %s, logging to entity path %s",
topic.c_str(),
entity_path.c_str()
);
return this->create_subscription<sensor_msgs::msg::Image>(
topic,
1000,
[&, entity_path, lookup_transform, restamp, image_options](
const sensor_msgs::msg::Image::SharedPtr msg
) {
_handle_msg_header(
restamp,
lookup_transform,
parent_entity_path(entity_path),
msg->header
);
log_image(_rec, entity_path, msg, image_options);
},
subscription_options
);
}
std::shared_ptr<rclcpp::Subscription<sensor_msgs::msg::Imu>>
RerunLoggerNode::_create_imu_subscription(
const std::string& topic, const TopicOptions& topic_options
) {
std::string entity_path = _resolve_entity_path(topic, topic_options);
bool restamp = false;
if (topic_options.find("restamp") != topic_options.end()) {
restamp = topic_options.at("restamp").as<bool>();
}
rclcpp::SubscriptionOptions subscription_options;
subscription_options.callback_group = _parallel_callback_group;
return this->create_subscription<sensor_msgs::msg::Imu>(
topic,
1000,
[&, entity_path, restamp](const sensor_msgs::msg::Imu::SharedPtr msg) {
_handle_msg_header(restamp, false, entity_path, msg->header);
log_imu(_rec, entity_path, msg);
},
subscription_options
);
}
std::shared_ptr<rclcpp::Subscription<geometry_msgs::msg::PoseStamped>>
RerunLoggerNode::_create_pose_stamped_subscription(
const std::string& topic, const TopicOptions& topic_options
) {
std::string entity_path = _resolve_entity_path(topic, topic_options);
bool lookup_transform = (topic_options.find("entity_path") == topic_options.end());
bool restamp = false;
if (topic_options.find("restamp") != topic_options.end()) {
restamp = topic_options.at("restamp").as<bool>();
}
rclcpp::SubscriptionOptions subscription_options;
subscription_options.callback_group = _parallel_callback_group;
return this->create_subscription<geometry_msgs::msg::PoseStamped>(
topic,
1000,
[&, entity_path, lookup_transform, restamp](
const geometry_msgs::msg::PoseStamped::SharedPtr msg
) {
_handle_msg_header(restamp, lookup_transform, entity_path, msg->header);
log_pose_stamped(_rec, entity_path, msg);
},
subscription_options
);
}
std::shared_ptr<rclcpp::Subscription<tf2_msgs::msg::TFMessage>>
RerunLoggerNode::_create_tf_message_subscription(
const std::string& topic, const TopicOptions& topic_options
) {
std::string entity_path = _resolve_entity_path(topic, topic_options);
rclcpp::SubscriptionOptions subscription_options;
subscription_options.callback_group = _parallel_callback_group;
return this->create_subscription<tf2_msgs::msg::TFMessage>(
topic,
1000,
[&, entity_path](const tf2_msgs::msg::TFMessage::SharedPtr msg) {
log_tf_message(_rec, _tf_frame_to_entity_path, msg);
},
subscription_options
);
}
std::shared_ptr<rclcpp::Subscription<nav_msgs::msg::Odometry>>
RerunLoggerNode::_create_odometry_subscription(
const std::string& topic, const TopicOptions& topic_options
) {
std::string entity_path = _resolve_entity_path(topic, topic_options);
bool lookup_transform = (topic_options.find("entity_path") == topic_options.end());
bool restamp = false;
if (topic_options.find("restamp") != topic_options.end()) {
restamp = topic_options.at("restamp").as<bool>();
}
rclcpp::SubscriptionOptions subscription_options;
subscription_options.callback_group = _parallel_callback_group;
return this->create_subscription<nav_msgs::msg::Odometry>(
topic,
1000,
[&, entity_path, lookup_transform, restamp](const nav_msgs::msg::Odometry::SharedPtr msg) {
_handle_msg_header(restamp, lookup_transform, entity_path, msg->header);
log_odometry(_rec, entity_path, msg);
},
subscription_options
);
}
std::shared_ptr<rclcpp::Subscription<sensor_msgs::msg::CameraInfo>>
RerunLoggerNode::_create_camera_info_subscription(
const std::string& topic, const TopicOptions& topic_options
) {
std::string entity_path = _resolve_entity_path(topic, topic_options);
bool restamp = false;
if (topic_options.find("restamp") != topic_options.end()) {
restamp = topic_options.at("restamp").as<bool>();
}
rclcpp::SubscriptionOptions subscription_options;
subscription_options.callback_group = _parallel_callback_group;
// If the camera_info topic has not been explicility mapped to an entity path,
// we assume that the camera_info topic is a sibling of the image topic, and
// hence use the parent as the entity path for the pinhole model.
if (topic_options.find("entity_path") == topic_options.end()) {
entity_path = parent_entity_path(entity_path);
}
return this->create_subscription<sensor_msgs::msg::CameraInfo>(
topic,
1,
[&, entity_path, restamp](const sensor_msgs::msg::CameraInfo::SharedPtr msg) {
_handle_msg_header(restamp, false, entity_path, msg->header);
log_camera_info(_rec, entity_path, msg);
},
subscription_options
);
}
std::shared_ptr<rclcpp::Subscription<sensor_msgs::msg::PointCloud2>>
RerunLoggerNode::_create_point_cloud2_subscription(
const std::string& topic, const TopicOptions& topic_options
) {
std::string entity_path = _resolve_entity_path(topic, topic_options);
bool lookup_transform = (topic_options.find("entity_path") == topic_options.end());
bool restamp = false;
if (topic_options.find("restamp") != topic_options.end()) {
restamp = topic_options.at("restamp").as<bool>();
}
auto point_cloud2_options = point_cloud2_options_from_topic_options(topic_options);
rclcpp::SubscriptionOptions subscription_options;
subscription_options.callback_group = _parallel_callback_group;
RCLCPP_INFO(
this->get_logger(),
"Subscribing to PointCloud2 topic %s, logging to entity path %s",
topic.c_str(),
entity_path.c_str()
);
return this->create_subscription<sensor_msgs::msg::PointCloud2>(
topic,
1000,
[&, entity_path, lookup_transform, restamp, point_cloud2_options](
const sensor_msgs::msg::PointCloud2::SharedPtr msg
) {
_handle_msg_header(restamp, lookup_transform, entity_path, msg->header);
log_point_cloud2(_rec, entity_path, msg, point_cloud2_options);
},
subscription_options
);
}
std::shared_ptr<rclcpp::Subscription<sensor_msgs::msg::JointState>>
RerunLoggerNode::_create_joint_state_subscription(
const std::string& topic, const TopicOptions& topic_options
) {
std::string entity_path = _resolve_entity_path(topic, topic_options);
bool lookup_transform = false; // Joint states don't need coordinate transformations
bool restamp = false;
if (topic_options.find("restamp") != topic_options.end()) {
restamp = topic_options.at("restamp").as<bool>();
}
rclcpp::SubscriptionOptions subscription_options;
subscription_options.callback_group = _parallel_callback_group;
RCLCPP_INFO(
this->get_logger(),
"Subscribing to JointState topic %s, logging to entity path %s",
topic.c_str(),
entity_path.c_str()
);
return this->create_subscription<sensor_msgs::msg::JointState>(
topic,
1000,
[&, entity_path, lookup_transform, restamp](
const sensor_msgs::msg::JointState::SharedPtr msg
) {
_handle_msg_header(restamp, lookup_transform, entity_path, msg->header);
log_joint_state(_rec, entity_path, msg);
},
subscription_options
);
}
void RerunLoggerNode::_handle_msg_header(
bool restamp, bool lookup_transform, const std::string& entity_path,
std_msgs::msg::Header& header
) {
if (restamp) {
auto now = this->get_clock()->now();
header.stamp = now;
}
if (!_root_frame.empty() && lookup_transform) {
try {
auto transform = std::make_shared<geometry_msgs::msg::TransformStamped>(
_tf_buffer->lookupTransform(_root_frame, header.frame_id, header.stamp, 100ms)
);
log_transform(_rec, entity_path, transform);
} catch (tf2::TransformException& ex) {
RCLCPP_WARN(this->get_logger(), "%s", ex.what());
}
}
}
int main(int argc, char** argv) {
rclcpp::init(argc, argv);
rclcpp::executors::MultiThreadedExecutor executor;
// Executor does not take ownership of the topic_options, so we have to maintain a shared_ptr
auto rerun_logger_node = std::make_shared<RerunLoggerNode>();
executor.add_node(rerun_logger_node);
executor.spin();
rclcpp::shutdown();
return 0;
}