ros1_parsers/header_msg.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <geometry_msgs/Quaternion.h>
4 #include "ros1_parser.h"
5 
7 {
8 
9  public:
10  HeaderMsgParser(const std::string& topic_name, PJ::PlotDataMapRef& plot_data)
11  : _topic_name( topic_name )
12  , _plot_data( plot_data )
13  {
14 
15  }
16 
17  void parse(const std_msgs::Header& msg,
18  double& timestamp,
19  bool use_header_stamp)
20  {
21  if( !_initialized )
22  {
23  _initialized = true;
24 
28  }
29 
30  double header_stamp = msg.stamp.toSec();
31  timestamp = (use_header_stamp && header_stamp > 0) ? header_stamp : timestamp;
32 
33  _sequence->pushBack({ timestamp, double(msg.seq) });
34  _stamp->pushBack({ timestamp, header_stamp });
35  _frame_id->pushBack({ timestamp, msg.frame_id });
36  }
37 
38  private:
39  const std::string _topic_name;
41  bool _initialized = false;
42 
46 };
HeaderMsgParser(const std::string &topic_name, PJ::PlotDataMapRef &plot_data)
PlotData & getOrCreateNumeric(const std::string &name, PlotGroup::Ptr group={})
PJ::PlotDataMapRef & _plot_data
PJ::PlotData * _sequence
StringSeries & getOrCreateStringSeries(const std::string &name, PlotGroup::Ptr group={})
const std::string _topic_name
void parse(const std_msgs::Header &msg, double &timestamp, bool use_header_stamp)
PJ::StringSeries * _frame_id
void pushBack(const Point &p) override
void pushBack(const Point &p) override


plotjuggler_ros
Author(s): Davide Faconti
autogenerated on Fri Jun 23 2023 02:28:03