26 const std::string& item_name)
30 uint64_t val_i = value.
extract<uint64_t>();
31 double val_d =
static_cast<double>(val_i);
32 bool error = (val_i !=
static_cast<uint64_t
>(val_d));
42 int64_t val_i = value.
extract<int64_t>();
43 double val_d =
static_cast<double>(val_i);
44 bool error = (val_i !=
static_cast<int64_t
>(val_d));
52 double val_d = value.
convert<
double>();
67 const std::string &topic_name,
68 const std::string &md5sum)
70 if( md5sum != T::getCompatibleKey() )
74 if( parsers.find(topic_name) == parsers.end())
76 parsers.emplace( std::piecewise_construct,
77 std::forward_as_tuple(topic_name),
78 std::forward_as_tuple(
new T()) );
84 const std::string &md5sum,
86 const std::string &definition)
92 InsertParser<OdometryMsgParser>( _builtin_parsers, topic_name, md5sum ) ||
94 InsertParser<FiveAiDiagnosticMsg>( _builtin_parsers, topic_name, md5sum ) ||
95 InsertParser<PalStatisticsNamesParser>(
_builtin_parsers, topic_name, md5sum ) ||
96 InsertParser<PalStatisticsValuesParser>( _builtin_parsers, topic_name, md5sum );
111 builtin_it->second->pushMessageRef( builtin_it->first, msg, timestamp );
138 for (
const auto& it: flat_container.
value)
146 if( leaf2 && leaf2->
value() ==
"header" && leaf1->
value() ==
"stamp")
148 double heder_stamp = it.second.convert<
double>();
150 if( heder_stamp > 0 ) {
151 timestamp = heder_stamp;
190 for(
const auto& it: renamed_values )
192 const auto& field_name = it.first;
202 PlotData& plot_data = plot_pair->second;
203 size_t data_size = plot_data.
size();
207 if( !std::isnan(val_d) && !std::isinf(val_d) )
209 plot_data.
pushBack( PlotData::Point(timestamp, val_d) );
219 QString message = QString(
"The following topics contain arrays with more than %1 elements.\n").arg(
_max_array_size);
222 message += QString(
"The fields containing the extra large arrays have been discarded\n");
225 message += QString(
"These arrays were trunkated to the maximum size %1\n").arg(
_max_array_size);
232 QString message =
"During the parsing process, one or more conversions to double failed" 233 " because of numerical cancellation.\n" 234 "This happens when the absolute value of a long integer exceed 2^52.\n\n" 235 "You have been warned... don't trust the following timeseries\n";
244 appendData( destination, prefix + it.first, it.second );
250 it.second->extractData( destination, prefix + it.first );
std::unordered_set< std::string > _warn_cancellation
std::unordered_map< std::string, PlotData > numeric
double extractRealValue(const RosIntrospection::Variant &value, const std::string &item_name)
std::unordered_set< std::string > _registered_md5sum
std::unordered_set< std::string > _warn_max_arraysize
bool _discard_large_array
const TreeNode * parent() const
void setMaxArrayPolicy(size_t max_array_size, bool discard_entire_array)
void pushMessageRef(const std::string &topic_name, const MessageRef &msg, double timestamp) override
std::vector< std::pair< StringTreeLeaf, Variant > > value
BuiltinType getTypeID() const
virtual void extractData(PlotDataMapRef &destination, const std::string &prefix) override
const uint8_t * data() const
virtual size_t size() const
std::unordered_map< std::string, std::unique_ptr< RosParserBase > > ParsersMap
bool InsertParser(RosMessageParser::ParsersMap &parsers, const std::string &topic_name, const std::string &md5sum)
ParsersMap _builtin_parsers
std::vector< std::pair< std::string, Variant > > RenamedValues
static void warning(const QString &message, std::unordered_set< std::string > list)
std::unordered_map< std::string, PlotData >::iterator addNumeric(const std::string &name)
static void appendData(PlotDataMapRef &destination_plot_map, const std::string &field_name, PlotData &in_data)
std::unique_ptr< RosIntrospection::Parser > _introspection_parser
bool registerSchema(const std::string &topic_name, const std::string &md5sum, RosIntrospection::ROSType type, const std::string &definition)