1 #ifndef DIAGNOSTIC_MSG_H 2 #define DIAGNOSTIC_MSG_H 5 #include <diagnostic_msgs/DiagnosticArray.h> 33 double timestamp)
override 35 diagnostic_msgs::DiagnosticArray status_array;
41 timestamp = status_array.header.stamp.toSec();
44 _header_data[0].pushBack( {timestamp, (double)status_array.header.seq} );
45 _header_data[1].pushBack( {timestamp, status_array.header.stamp.toSec()} );
47 for(
const auto& status: status_array.status)
49 for(
const auto& kv: status.values)
51 const char *start_ptr = kv.value.data();
54 if( start_ptr == res.ptr )
continue;
56 std::string status_prefix;
57 if( status.hardware_id.empty()){
62 status_prefix =
absl::StrCat(
"/",status.hardware_id,
"/",
66 auto it =
_data.find(status_prefix);
67 if( it ==
_data.end() )
69 it =
_data.emplace( std::piecewise_construct,
70 std::forward_as_tuple(status_prefix),
71 std::forward_as_tuple(status_prefix)
74 it->second.pushBack( { timestamp, val } );
88 appendData(plot_map, prefix + it.first, it.second);
94 std::unordered_map<std::string,PlotData>
_data;
99 #endif // DIAGNOSTIC_MSG_H std::vector< PlotData > _header_data
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
virtual void pushMessageRef(const std::string &, const MessageRef &msg, double timestamp) override
const std::unordered_set< std::string > & getCompatibleKeys() const override
static const std::string & getCompatibleKey()
const uint8_t * data() const
static const char * value()
std::unordered_map< std::string, PlotData > _data
from_chars_result from_chars(const char *first, const char *last, double &value, chars_format fmt)
static void appendData(PlotDataMapRef &destination_plot_map, const std::string &field_name, PlotData &in_data)
void extractData(PlotDataMapRef &plot_map, const std::string &prefix) override
void deserialize(Stream &stream, T &t)