ros_writer.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 
5 #include "proc/threshold.h"
7 #include "proc/spatial-filter.h"
8 #include "proc/temporal-filter.h"
10 #include "proc/zero-order.h"
11 #include "proc/depth-decompress.h"
12 #include "proc/hdr-merge.h"
14 #include "ros_writer.h"
15 #include "l500/l500-motion.h"
16 #include "l500/l500-depth.h"
17 
18 namespace librealsense
19 {
20  using namespace device_serializer;
21 
22  ros_writer::ros_writer(const std::string& file, bool compress_while_record) : m_file_path(file)
23  {
24  LOG_INFO("Compression while record is set to " << (compress_while_record ? "ON" : "OFF"));
26  if (compress_while_record)
27  {
29  }
31  }
32 
34  {
35  for (auto&& device_extension_snapshot : device_description.get_device_extensions_snapshots().get_snapshots())
36  {
37  write_extension_snapshot(get_device_index(), get_static_file_info_timestamp(), device_extension_snapshot.first, device_extension_snapshot.second);
38  }
39 
40  for (auto&& sensors_snapshot : device_description.get_sensors_snapshots())
41  {
42  for (auto&& sensor_extension_snapshot : sensors_snapshot.get_sensor_extensions_snapshots().get_snapshots())
43  {
44  write_extension_snapshot(get_device_index(), sensors_snapshot.get_sensor_index(), get_static_file_info_timestamp(), sensor_extension_snapshot.first, sensor_extension_snapshot.second);
45  }
46  }
47  }
48 
50  {
51  if (Is<video_frame>(frame.frame))
52  {
53  write_video_frame(stream_id, timestamp, std::move(frame));
54  return;
55  }
56 
57  if (Is<motion_frame>(frame.frame))
58  {
59  write_motion_frame(stream_id, timestamp, std::move(frame));
60  return;
61  }
62 
63  if (Is<pose_frame>(frame.frame))
64  {
65  write_pose_frame(stream_id, timestamp, std::move(frame));
66  return;
67  }
68  }
69 
70  void ros_writer::write_snapshot(uint32_t device_index, const nanoseconds& timestamp, rs2_extension type, const std::shared_ptr<extension_snapshot>& snapshot)
71  {
72  write_extension_snapshot(device_index, -1, timestamp, type, snapshot);
73  }
74 
75  void ros_writer::write_snapshot(const sensor_identifier& sensor_id, const nanoseconds& timestamp, rs2_extension type, const std::shared_ptr<extension_snapshot>& snapshot)
76  {
77  write_extension_snapshot(sensor_id.device_index, sensor_id.sensor_index, timestamp, type, snapshot);
78  }
79 
81  {
82  return m_file_path;
83  }
84 
86  {
87  std_msgs::UInt32 msg;
88  msg.data = get_file_version();
90  }
91 
93  {
94  auto metadata_topic = ros_topic::frame_metadata_topic(stream_id);
96  system_time.key = SYSTEM_TIME_MD_STR;
97  system_time.value = std::to_string(frame->get_frame_system_time());
98  write_message(metadata_topic, timestamp, system_time);
99 
100  diagnostic_msgs::KeyValue timestamp_domain;
101  timestamp_domain.key = TIMESTAMP_DOMAIN_MD_STR;
102  timestamp_domain.value = librealsense::get_string(frame->get_frame_timestamp_domain());
103  write_message(metadata_topic, timestamp, timestamp_domain);
104 
105  for (int i = 0; i < static_cast<rs2_frame_metadata_value>(rs2_frame_metadata_value::RS2_FRAME_METADATA_COUNT); i++)
106  {
108  if (frame->supports_frame_metadata(type))
109  {
110  auto md = frame->get_frame_metadata(type);
112  md_msg.key = librealsense::get_string(type);
113  md_msg.value = std::to_string(md);
114  write_message(metadata_topic, timestamp, md_msg);
115  }
116  }
117  }
118 
120  {
121  if (m_extrinsics_msgs.find(stream_id) != m_extrinsics_msgs.end())
122  {
123  return; //already wrote it
124  }
125  auto& dev = frame->get_sensor()->get_device();
126  uint32_t reference_id = 0;
127  rs2_extrinsics ext;
128  std::tie(reference_id, ext) = dev.get_extrinsics(*frame->get_stream());
130  convert(ext, tf_msg);
132  m_extrinsics_msgs[stream_id] = tf_msg;
133  }
134 
136  {
138  noti_msg.category = get_string(n.category);
139  noti_msg.severity = get_string(n.severity);
140  noti_msg.description = n.description;
141  auto secs = std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::duration<double, std::nano>(n.timestamp));
142  noti_msg.timestamp = rs2rosinternal::Time(secs.count());
143  noti_msg.serialized_data = n.serialized_data;
144  return noti_msg;
145  }
146 
148  {
150  write_message(ros_topic::notification_topic({ sensor_id.device_index, sensor_id.sensor_index }, n.category), timestamp, noti_msg);
151  }
152 
154  {
155  try
156  {
157  write_frame_metadata(stream_id, timestamp, frame);
158  }
159  catch (std::exception const& e)
160  {
161  LOG_WARNING("Failed to write frame metadata for " << stream_id.stream_type << ". Exception: " << e.what());
162  }
163 
164  try
165  {
166  write_extrinsics(stream_id, frame);
167  }
168  catch (std::exception const& e)
169  {
170  LOG_WARNING("Failed to write stream extrinsics for " << stream_id.stream_type << ". Exception: " << e.what());
171  }
172  }
173 
175  {
177  auto vid_frame = dynamic_cast<librealsense::video_frame*>(frame.frame);
178  assert(vid_frame != nullptr);
179 
180  image.width = static_cast<uint32_t>(vid_frame->get_width());
181  image.height = static_cast<uint32_t>(vid_frame->get_height());
182  image.step = static_cast<uint32_t>(vid_frame->get_stride());
183  convert(vid_frame->get_stream()->get_format(), image.encoding);
184  image.is_bigendian = is_big_endian();
185  auto size = vid_frame->get_stride() * vid_frame->get_height();
186  auto p_data = vid_frame->get_frame_data();
187  image.data.assign(p_data, p_data + size);
188  image.header.seq = static_cast<uint32_t>(vid_frame->get_frame_number());
189  std::chrono::duration<double, std::milli> timestamp_ms(vid_frame->get_frame_timestamp());
190  image.header.stamp = rs2rosinternal::Time(std::chrono::duration<double>(timestamp_ms).count());
191  std::string TODO_CORRECT_ME = "0";
192  image.header.frame_id = TODO_CORRECT_ME;
193  auto image_topic = ros_topic::frame_data_topic(stream_id);
194  write_message(image_topic, timestamp, image);
195  write_additional_frame_messages(stream_id, timestamp, frame);
196  }
197 
199  {
200  sensor_msgs::Imu imu_msg;
201  if (!frame)
202  {
203  throw io_exception("Null frame passed to write_motion_frame");
204  }
205 
206  imu_msg.header.seq = static_cast<uint32_t>(frame.frame->get_frame_number());
207  std::chrono::duration<double, std::milli> timestamp_ms(frame.frame->get_frame_timestamp());
208  imu_msg.header.stamp = rs2rosinternal::Time(std::chrono::duration<double>(timestamp_ms).count());
209  std::string TODO_CORRECT_ME = "0";
210  imu_msg.header.frame_id = TODO_CORRECT_ME;
211  auto data_ptr = reinterpret_cast<const float*>(frame.frame->get_frame_data());
212  if (stream_id.stream_type == RS2_STREAM_ACCEL)
213  {
214  imu_msg.linear_acceleration.x = data_ptr[0];
215  imu_msg.linear_acceleration.y = data_ptr[1];
216  imu_msg.linear_acceleration.z = data_ptr[2];
217  }
218 
219  else if (stream_id.stream_type == RS2_STREAM_GYRO)
220  {
221  imu_msg.angular_velocity.x = data_ptr[0];
222  imu_msg.angular_velocity.y = data_ptr[1];
223  imu_msg.angular_velocity.z = data_ptr[2];
224  }
225  else
226  {
227  throw io_exception("Unsupported stream type for a motion frame");
228  }
229 
230  auto topic = ros_topic::frame_data_topic(stream_id);
231  write_message(topic, timestamp, imu_msg);
232  write_additional_frame_messages(stream_id, timestamp, frame);
233  }
234 
236  {
238  v.x = f.x;
239  v.y = f.y;
240  v.z = f.z;
241  return v;
242  }
243 
245  {
247  q.x = f.x;
248  q.y = f.y;
249  q.z = f.z;
250  q.w = f.w;
251  return q;
252  }
253 
255  {
256  auto pose = As<librealsense::pose_frame>(frame.frame);
257  if (!frame)
258  {
259  throw io_exception("Null frame passed to write_motion_frame");
260  }
261  auto rotation = pose->get_rotation();
262 
265  geometry_msgs::Twist twist;
266 
267  transform.rotation = to_quaternion(pose->get_rotation());
268  transform.translation = to_vector3(pose->get_translation());
269  accel.angular = to_vector3(pose->get_angular_acceleration());
270  accel.linear = to_vector3(pose->get_acceleration());
271  twist.angular = to_vector3(pose->get_angular_velocity());
272  twist.linear = to_vector3(pose->get_velocity());
273 
274  std::string transform_topic = ros_topic::pose_transform_topic(stream_id);
275  std::string accel_topic = ros_topic::pose_accel_topic(stream_id);
276  std::string twist_topic = ros_topic::pose_twist_topic(stream_id);
277 
278  //Write the the pose frame as 3 separate messages (each with different topic)
279  write_message(transform_topic, timestamp, transform);
280  write_message(accel_topic, timestamp, accel);
281  write_message(twist_topic, timestamp, twist);
282 
283  // Write the pose confidence as metadata for the pose frame
284  std::string md_topic = ros_topic::frame_metadata_topic(stream_id);
285 
286  diagnostic_msgs::KeyValue tracker_confidence_msg;
287  tracker_confidence_msg.key = TRACKER_CONFIDENCE_MD_STR;
288  tracker_confidence_msg.value = std::to_string(pose->get_tracker_confidence());
289  write_message(md_topic, timestamp, tracker_confidence_msg);
290 
291  diagnostic_msgs::KeyValue mapper_confidence_msg;
292  mapper_confidence_msg.key = MAPPER_CONFIDENCE_MD_STR;
293  mapper_confidence_msg.value = std::to_string(pose->get_mapper_confidence());
294  write_message(md_topic, timestamp, mapper_confidence_msg);
295 
296  //Write frame's timestamp as metadata
297  diagnostic_msgs::KeyValue frame_timestamp_msg;
298  frame_timestamp_msg.key = FRAME_TIMESTAMP_MD_STR;
299  frame_timestamp_msg.value = to_string() << std::hexfloat << std::fixed << pose->get_frame_timestamp();
300  write_message(md_topic, timestamp, frame_timestamp_msg);
301 
302  //Write frame's number as external param
303  diagnostic_msgs::KeyValue frame_num_msg;
304  frame_num_msg.key = FRAME_NUMBER_MD_STR;
305  frame_num_msg.value = to_string() << pose->get_frame_number();
306  write_message(md_topic, timestamp, frame_num_msg);
307 
308  // Write the rest of the frame metadata and stream extrinsics
309  write_additional_frame_messages(stream_id, timestamp, frame);
310  }
311 
312  void ros_writer::write_stream_info(nanoseconds timestamp, const sensor_identifier& sensor_id, std::shared_ptr<stream_profile_interface> profile)
313  {
314  realsense_msgs::StreamInfo stream_info_msg;
315  stream_info_msg.is_recommended = profile->get_tag() & profile_tag::PROFILE_TAG_DEFAULT;
316  convert(profile->get_format(), stream_info_msg.encoding);
317  stream_info_msg.fps = profile->get_framerate();
318  write_message(ros_topic::stream_info_topic({ sensor_id.device_index, sensor_id.sensor_index, profile->get_stream_type(), static_cast<uint32_t>(profile->get_stream_index()) }), timestamp, stream_info_msg);
319  }
320 
321  void ros_writer::write_streaming_info(nanoseconds timestamp, const sensor_identifier& sensor_id, std::shared_ptr<video_stream_profile_interface> profile)
322  {
323  write_stream_info(timestamp, sensor_id, profile);
324 
325  sensor_msgs::CameraInfo camera_info_msg;
326  camera_info_msg.width = profile->get_width();
327  camera_info_msg.height = profile->get_height();
329  try {
330  intrinsics = profile->get_intrinsics();
331  }
332  catch (...)
333  {
334  LOG_ERROR("Error trying to get intrinsc data for stream " << profile->get_stream_type() << ", " << profile->get_stream_index());
335  }
336  camera_info_msg.K[0] = intrinsics.fx;
337  camera_info_msg.K[2] = intrinsics.ppx;
338  camera_info_msg.K[4] = intrinsics.fy;
339  camera_info_msg.K[5] = intrinsics.ppy;
340  camera_info_msg.K[8] = 1;
341  camera_info_msg.D.assign(std::begin(intrinsics.coeffs), std::end(intrinsics.coeffs));
342  camera_info_msg.distortion_model = rs2_distortion_to_string(intrinsics.model);
343  write_message(ros_topic::video_stream_info_topic({ sensor_id.device_index, sensor_id.sensor_index, profile->get_stream_type(), static_cast<uint32_t>(profile->get_stream_index()) }), timestamp, camera_info_msg);
344  }
345 
346  void ros_writer::write_streaming_info(nanoseconds timestamp, const sensor_identifier& sensor_id, std::shared_ptr<motion_stream_profile_interface> profile)
347  {
348  write_stream_info(timestamp, sensor_id, profile);
349 
350  realsense_msgs::ImuIntrinsic motion_info_msg;
351 
353  try {
354  intrinsics = profile->get_intrinsics();
355  }
356  catch (...)
357  {
358  LOG_ERROR("Error trying to get intrinsc data for stream " << profile->get_stream_type() << ", " << profile->get_stream_index());
359  }
360  //Writing empty in case of failure
361  std::copy(&intrinsics.data[0][0], &intrinsics.data[0][0] + motion_info_msg.data.size(), std::begin(motion_info_msg.data));
362  std::copy(std::begin(intrinsics.bias_variances), std::end(intrinsics.bias_variances), std::begin(motion_info_msg.bias_variances));
363  std::copy(std::begin(intrinsics.noise_variances), std::end(intrinsics.noise_variances), std::begin(motion_info_msg.noise_variances));
364 
365  std::string topic = ros_topic::imu_intrinsic_topic({ sensor_id.device_index, sensor_id.sensor_index, profile->get_stream_type(), static_cast<uint32_t>(profile->get_stream_index()) });
366  write_message(topic, timestamp, motion_info_msg);
367  }
368  void ros_writer::write_streaming_info(nanoseconds timestamp, const sensor_identifier& sensor_id, std::shared_ptr<pose_stream_profile_interface> profile)
369  {
370  write_stream_info(timestamp, sensor_id, profile);
371  }
372  void ros_writer::write_extension_snapshot(uint32_t device_id, const nanoseconds& timestamp, rs2_extension type, std::shared_ptr<librealsense::extension_snapshot> snapshot)
373  {
374  const auto ignored = 0u;
375  write_extension_snapshot(device_id, ignored, timestamp, type, snapshot, true);
376  }
377 
378  void ros_writer::write_extension_snapshot(uint32_t device_id, uint32_t sensor_id, const nanoseconds& timestamp, rs2_extension type, std::shared_ptr<librealsense::extension_snapshot> snapshot)
379  {
380  write_extension_snapshot(device_id, sensor_id, timestamp, type, snapshot, false);
381  }
382 
383  void ros_writer::write_extension_snapshot(uint32_t device_id, uint32_t sensor_id, const nanoseconds& timestamp, rs2_extension type, std::shared_ptr<librealsense::extension_snapshot> snapshot, bool is_device)
384  {
385  switch (type)
386  {
387  case RS2_EXTENSION_INFO:
388  {
389  auto info = SnapshotAs<RS2_EXTENSION_INFO>(snapshot);
390  if (is_device)
391  {
392  write_vendor_info(ros_topic::device_info_topic(device_id), timestamp, info);
393  }
394  else
395  {
396  write_vendor_info(ros_topic::sensor_info_topic({ device_id, sensor_id }), timestamp, info);
397  }
398  break;
399  }
400  case RS2_EXTENSION_DEBUG:
401  break;
402  //case RS2_EXTENSION_OPTION:
403  //{
404  // auto option = SnapshotAs<RS2_EXTENSION_OPTION>(snapshot);
405  // write_sensor_option({ device_id, sensor_id }, timestamp, *option);
406  // break;
407  //}
409  {
410  auto options = SnapshotAs<RS2_EXTENSION_OPTIONS>(snapshot);
411  write_sensor_options({ device_id, sensor_id }, timestamp, options);
412  break;
413  }
414 
416  {
417  auto l500_depth_sensor_data = SnapshotAs<RS2_EXTENSION_L500_DEPTH_SENSOR>(snapshot);
418  write_l500_data({ device_id, sensor_id }, timestamp, l500_depth_sensor_data);
419  break;
420  }
421  case RS2_EXTENSION_VIDEO:
422  case RS2_EXTENSION_ROI:
428  break;
430  {
431  auto profile = SnapshotAs<RS2_EXTENSION_VIDEO_PROFILE>(snapshot);
432  write_streaming_info(timestamp, { device_id, sensor_id }, profile);
433  break;
434  }
436  {
437  auto profile = SnapshotAs<RS2_EXTENSION_MOTION_PROFILE>(snapshot);
438  write_streaming_info(timestamp, { device_id, sensor_id }, profile);
439  break;
440  }
442  {
443  auto profile = SnapshotAs<RS2_EXTENSION_POSE_PROFILE>(snapshot);
444  write_streaming_info(timestamp, { device_id, sensor_id }, profile);
445  break;
446  }
448  {
449  auto filters = SnapshotAs<RS2_EXTENSION_RECOMMENDED_FILTERS>(snapshot);
450  write_sensor_processing_blocks({ device_id, sensor_id }, timestamp, filters);
451  break;
452  }
453  default:
454  throw invalid_value_exception(to_string() << "Failed to Write Extension Snapshot: Unsupported extension \"" << librealsense::get_string(type) << "\"");
455  }
456  }
457 
458  void ros_writer::write_vendor_info(const std::string& topic, nanoseconds timestamp, std::shared_ptr<info_interface> info_snapshot)
459  {
460  for (uint32_t i = 0; i < static_cast<uint32_t>(RS2_CAMERA_INFO_COUNT); i++)
461  {
462  auto camera_info = static_cast<rs2_camera_info>(i);
463  if (info_snapshot->supports_info(camera_info))
464  {
466  msg.key = rs2_camera_info_to_string(camera_info);
467  msg.value = info_snapshot->get_info(camera_info);
468  write_message(topic, timestamp, msg);
469  }
470  }
471  }
472 
474  {
475  float value = option.query();
476  const char* str = option.get_description();
477  std::string description = str ? std::string(str) : (to_string() << "Read only option of " << librealsense::get_string(type));
478 
479  //One message for value
480  std_msgs::Float32 option_msg;
481  option_msg.data = value;
482  write_message(ros_topic::option_value_topic(sensor_id, type), timestamp, option_msg);
483 
484  //Another message for description, should be written once per topic
485 
486  if (m_written_options_descriptions[sensor_id.sensor_index].find(type) == m_written_options_descriptions[sensor_id.sensor_index].end())
487  {
488  std_msgs::String option_msg_desc;
489  option_msg_desc.data = description;
491  m_written_options_descriptions[sensor_id.sensor_index].insert(type);
492  }
493  }
494 
495  void ros_writer::write_sensor_options(device_serializer::sensor_identifier sensor_id, const nanoseconds& timestamp, std::shared_ptr<options_interface> options)
496  {
497  for (int i = 0; i < static_cast<int>(RS2_OPTION_COUNT); i++)
498  {
499  auto option_id = static_cast<rs2_option>(i);
500  try
501  {
502  if (options->supports_option(option_id))
503  {
504  write_sensor_option(sensor_id, timestamp, option_id, options->get_option(option_id));
505  }
506  }
507  catch (std::exception& e)
508  {
509  LOG_WARNING("Failed to get or write option " << option_id << " for sensor " << sensor_id.sensor_index << ". Exception: " << e.what());
510  }
511  }
512  }
513 
514  void ros_writer::write_l500_data(device_serializer::sensor_identifier sensor_id, const nanoseconds & timestamp, std::shared_ptr<l500_depth_sensor_interface> l500_depth_sensor)
515  {
516  auto intrinsics = l500_depth_sensor->get_intrinsic();
517 
518  std_msgs::Float32MultiArray intrinsics_data;
519  intrinsics_data.data.push_back(intrinsics.resolution.num_of_resolutions);
520  for (auto i = 0; i < intrinsics.resolution.num_of_resolutions; i++)
521  {
522  auto intrins = intrinsics.resolution.intrinsic_resolution[i];
523  intrinsics_data.data.push_back(intrins.raw.pinhole_cam_model.width);
524  intrinsics_data.data.push_back(intrins.raw.pinhole_cam_model.height);
525  intrinsics_data.data.push_back(intrins.raw.zo.x);
526  intrinsics_data.data.push_back(intrins.raw.zo.y);
527 
528  intrinsics_data.data.push_back(intrins.world.pinhole_cam_model.width);
529  intrinsics_data.data.push_back(intrins.world.pinhole_cam_model.height);
530  intrinsics_data.data.push_back(intrins.world.zo.x);
531  intrinsics_data.data.push_back(intrins.world.zo.y);
532  }
533 
534  intrinsics_data.data.push_back(l500_depth_sensor->read_baseline());
535  write_message(ros_topic::l500_data_blocks_topic(sensor_id), timestamp, intrinsics_data);
536  }
537 
538  rs2_extension ros_writer::get_processing_block_extension(const std::shared_ptr<processing_block_interface> block)
539  {
540 #define RETURN_IF_EXTENSION(E, T)\
541  if (Is<ExtensionToType<T>::type>(E))\
542  return T;\
543 
554 
555 #undef RETURN_IF_EXTENSION
556 
557  throw invalid_value_exception(to_string() << "processing block "<< block->get_info(RS2_CAMERA_INFO_NAME) <<"has no map to extension");
558  }
559 
560  void ros_writer::write_sensor_processing_blocks(device_serializer::sensor_identifier sensor_id, const nanoseconds& timestamp, std::shared_ptr<recommended_proccesing_blocks_interface> proccesing_blocks)
561  {
562  rs2_extension ext;
563  for (auto block : proccesing_blocks->get_recommended_processing_blocks())
564  {
565  try
566  {
567  try
568  {
569  ext = get_processing_block_extension(block);
570  }
571  catch (std::exception& e)
572  {
573  LOG_WARNING("Failed to write proccesing block " << " for sensor " << sensor_id.sensor_index << ". Exception: " << e.what());
574  }
575  std_msgs::String processing_block_msg;
576  processing_block_msg.data = rs2_extension_type_to_string(ext);
577  write_message(ros_topic::post_processing_blocks_topic(sensor_id), timestamp, processing_block_msg);
578  }
579  catch (std::exception& e)
580  {
581  LOG_WARNING("Failed to get or write recommended proccesing blocks " << " for sensor " << sensor_id.sensor_index << ". Exception: " << e.what());
582  }
583  }
584  }
585 
587  {
588  int num = 1;
589  return (*reinterpret_cast<char*>(&num) == 1) ? 0 : 1; //Little Endian: (char)0x0001 => 0x01, Big Endian: (char)0x0001 => 0x00,
590  }
591 }
virtual rs2_metadata_type get_frame_metadata(const rs2_frame_metadata_value &frame_metadata) const =0
rs2_camera_info
Read-only strings that can be queried from the device. Not all information attributes are available o...
Definition: rs_sensor.h:22
constexpr uint32_t get_file_version()
static std::string frame_data_topic(const device_serializer::stream_identifier &stream_id)
void write_extension_snapshot(uint32_t device_id, const nanoseconds &timestamp, rs2_extension type, std::shared_ptr< librealsense::extension_snapshot > snapshot)
Definition: ros_writer.cpp:372
void write_pose_frame(const stream_identifier &stream_id, const nanoseconds &timestamp, frame_holder &&frame)
Definition: ros_writer.cpp:254
_width_type width
Definition: Image.h:56
virtual rs2_timestamp_domain get_frame_timestamp_domain() const =0
GLuint GLuint end
static std::string post_processing_blocks_topic(const device_serializer::sensor_identifier &sensor_id)
void write_sensor_options(device_serializer::sensor_identifier sensor_id, const nanoseconds &timestamp, std::shared_ptr< options_interface > options)
Definition: ros_writer.cpp:495
constexpr const char * FRAME_NUMBER_MD_STR
static std::string l500_data_blocks_topic(const device_serializer::sensor_identifier &sensor_id)
_encoding_type encoding
Definition: Image.h:59
const char * get_string(rs2_rs400_visual_preset value)
virtual const char * get_description() const =0
static std::string sensor_info_topic(const device_serializer::sensor_identifier &sensor_id)
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
Definition: rs_option.h:22
_linear_acceleration_type linear_acceleration
Definition: Imu.h:79
#define RETURN_IF_EXTENSION(E, T)
rs2_notification_category category
Definition: src/types.h:1107
void write_streaming_info(nanoseconds timestamp, const sensor_identifier &sensor_id, std::shared_ptr< video_stream_profile_interface > profile)
Definition: ros_writer.cpp:321
void open(std::string const &filename, uint32_t mode=bagmode::Read)
Open a bag file.
Definition: bag.cpp:101
#define LOG_WARNING(...)
Definition: src/types.h:241
constexpr const char * FRAME_TIMESTAMP_MD_STR
static std::string stream_extrinsic_topic(const device_serializer::stream_identifier &stream_id, uint32_t ref_id)
const char * rs2_distortion_to_string(rs2_distortion distortion)
Definition: rs.cpp:1264
GLfloat value
std::map< uint32_t, std::set< rs2_option > > m_written_options_descriptions
Definition: ros_writer.h:79
realsense_msgs::Notification to_notification_msg(const notification &n)
Definition: ros_writer.cpp:135
static std::string video_stream_info_topic(const device_serializer::stream_identifier &stream_id)
_description_type description
Definition: Notification.h:54
void convert(rs2_format source, std::string &target)
void write_frame(const stream_identifier &stream_id, const nanoseconds &timestamp, frame_holder &&frame) override
Definition: ros_writer.cpp:49
static std::string device_info_topic(uint32_t device_id)
GLsizei const GLchar *const * string
constexpr const char * TRACKER_CONFIDENCE_MD_STR
GLdouble n
Definition: glext.h:1966
unsigned char uint8_t
Definition: stdint.h:78
e
Definition: rmse.py:177
void write_stream_info(nanoseconds timestamp, const sensor_identifier &sensor_id, std::shared_ptr< stream_profile_interface > profile)
Definition: ros_writer.cpp:312
virtual float query() const =0
rs2_extension get_processing_block_extension(const std::shared_ptr< processing_block_interface > block)
Definition: ros_writer.cpp:538
std::map< rs2_extension, std::shared_ptr< extension_snapshot > > get_snapshots() const
GLuint num
Definition: glext.h:5648
_serialized_data_type serialized_data
Definition: Notification.h:57
GLenum GLenum GLsizei void * image
static uint8_t is_big_endian()
Definition: ros_writer.cpp:586
void write_motion_frame(const stream_identifier &stream_id, const nanoseconds &timestamp, frame_holder &&frame)
Definition: ros_writer.cpp:198
def info(name, value, persistent=False)
Definition: test.py:301
_data_type data
Definition: Float32.h:37
not_this_one begin(...)
GLdouble f
std::map< stream_identifier, geometry_msgs::Transform > m_extrinsics_msgs
Definition: ros_writer.h:76
ros_writer(const std::string &file, bool compress_while_record)
Definition: ros_writer.cpp:22
void write_extrinsics(const stream_identifier &stream_id, frame_interface *frame)
Definition: ros_writer.cpp:119
_angular_type angular
Definition: Twist.h:44
GLsizeiptr size
std::string m_file_path
Definition: ros_writer.h:77
const std::string & get_file_name() const override
Definition: ros_writer.cpp:80
static std::string accel
Definition: hid-types.h:24
_data_type data
Definition: Image.h:68
_angular_type angular
Definition: Accel.h:44
unsigned int uint32_t
Definition: stdint.h:80
_seq_type seq
Definition: Header.h:41
static std::string pose_accel_topic(const device_serializer::stream_identifier &stream_id)
const char * rs2_extension_type_to_string(rs2_extension type)
Definition: rs.cpp:1274
_data_type data
Definition: UInt32.h:37
static std::string notification_topic(const device_serializer::sensor_identifier &sensor_id, rs2_notification_category nc)
void setCompression(CompressionType compression)
Set the compression method to use for writing chunks.
Definition: bag.cpp:241
void write_sensor_processing_blocks(device_serializer::sensor_identifier sensor_id, const nanoseconds &timestamp, std::shared_ptr< recommended_proccesing_blocks_interface > proccesing_blocks)
Definition: ros_writer.cpp:560
_rotation_type rotation
Definition: Transform.h:44
void write_additional_frame_messages(const stream_identifier &stream_id, const nanoseconds &timestamp, frame_interface *frame)
Definition: ros_writer.cpp:153
geometry_msgs::Vector3 to_vector3(const float3 &f)
Definition: ros_writer.cpp:235
static std::string file_version_topic()
void write_notification(const sensor_identifier &sensor_id, const nanoseconds &timestamp, const notification &n) override
Definition: ros_writer.cpp:147
#define LOG_ERROR(...)
Definition: src/types.h:242
constexpr const char * SYSTEM_TIME_MD_STR
static std::string imu_intrinsic_topic(const device_serializer::stream_identifier &stream_id)
_bias_variances_type bias_variances
Definition: ImuIntrinsic.h:57
constexpr const char * MAPPER_CONFIDENCE_MD_STR
dictionary intrinsics
Definition: t265_stereo.py:142
_header_type header
Definition: Image.h:50
virtual std::shared_ptr< sensor_interface > get_sensor() const =0
constexpr const char * TIMESTAMP_DOMAIN_MD_STR
std::chrono::duration< uint64_t, std::nano > nanoseconds
static std::string pose_twist_topic(const device_serializer::stream_identifier &stream_id)
static std::string frame_metadata_topic(const device_serializer::stream_identifier &stream_id)
float3 transform(const rs2_extrinsics *extrin, const float3 &point)
Definition: pointcloud.cpp:47
_distortion_model_type distortion_model
Definition: CameraInfo.h:79
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
Definition: rs_sensor.h:96
void write_snapshot(uint32_t device_index, const nanoseconds &timestamp, rs2_extension type, const std::shared_ptr< extension_snapshot > &snapshot) override
Definition: ros_writer.cpp:70
LOG_INFO("Log message using LOG_INFO()")
virtual std::shared_ptr< stream_profile_interface > get_stream() const =0
void write_device_description(const librealsense::device_snapshot &device_description) override
Definition: ros_writer.cpp:33
const char * rs2_camera_info_to_string(rs2_camera_info info)
Definition: rs.cpp:1266
_angular_velocity_type angular_velocity
Definition: Imu.h:73
GLdouble GLdouble GLdouble q
constexpr device_serializer::nanoseconds get_static_file_info_timestamp()
static std::string option_value_topic(const device_serializer::sensor_identifier &sensor_id, rs2_option option_type)
virtual rs2_time_t get_frame_system_time() const =0
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:166
int stream_id
Definition: sync.h:17
GLenum type
void write_frame_metadata(const stream_identifier &stream_id, const nanoseconds &timestamp, frame_interface *frame)
Definition: ros_writer.cpp:92
_noise_variances_type noise_variances
Definition: ImuIntrinsic.h:54
GLint GLsizei count
_linear_type linear
Definition: Twist.h:41
_height_type height
Definition: Image.h:53
_frame_id_type frame_id
Definition: Header.h:47
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
Video stream intrinsics.
Definition: rs_types.h:58
static std::string option_description_topic(const device_serializer::sensor_identifier &sensor_id, rs2_option option_type)
void write_video_frame(const stream_identifier &stream_id, const nanoseconds &timestamp, frame_holder &&frame)
Definition: ros_writer.cpp:174
_is_bigendian_type is_bigendian
Definition: Image.h:62
_is_recommended_type is_recommended
Definition: StreamInfo.h:47
_encoding_type encoding
Definition: StreamInfo.h:44
_translation_type translation
Definition: Transform.h:41
Motion device intrinsics: scale, bias, and variances.
Definition: rs_types.h:103
std::ios_base & hexfloat(std::ios_base &str)
geometry_msgs::Quaternion to_quaternion(const float4 &f)
Definition: ros_writer.cpp:244
int i
_stamp_type stamp
Definition: Header.h:44
static std::string pose_transform_topic(const device_serializer::stream_identifier &stream_id)
::std_msgs::Time_< std::allocator< void > > Time
Definition: Time.h:47
_linear_type linear
Definition: Accel.h:41
rs2_log_severity severity
Definition: src/types.h:1109
std::vector< sensor_snapshot > get_sensors_snapshots() const
_step_type step
Definition: Image.h:65
GLdouble v
void write_message(std::string const &topic, nanoseconds const &time, T const &msg)
Definition: ros_writer.h:62
_header_type header
Definition: Imu.h:64
rs2_frame_metadata_value
Per-Frame-Metadata is the set of read-only properties that might be exposed for each individual frame...
Definition: rs_frame.h:29
void write_l500_data(device_serializer::sensor_identifier sensor_id, const nanoseconds &timestamp, std::shared_ptr< l500_depth_sensor_interface > l500_depth_sensor)
Definition: ros_writer.cpp:514
void write_sensor_option(device_serializer::sensor_identifier sensor_id, const nanoseconds &timestamp, rs2_option type, const librealsense::option &option)
Definition: ros_writer.cpp:473
void copy(void *dst, void const *src, size_t size)
Definition: types.cpp:836
void write_vendor_info(const std::string &topic, nanoseconds timestamp, std::shared_ptr< info_interface > info_snapshot)
Definition: ros_writer.cpp:458
virtual bool supports_frame_metadata(const rs2_frame_metadata_value &frame_metadata) const =0
constexpr uint32_t get_device_index()
static std::string stream_info_topic(const device_serializer::stream_identifier &stream_id)
_data_type data
Definition: String.h:37
std::string to_string(T value)


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:40