Skip to content

Commit

Permalink
bug fix in ROS1
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Feb 19, 2024
1 parent 5932e98 commit 35b9de9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/DataLoadROS/dataload_ros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ bool DataLoadROS::readDataFromFile(PJ::FileLoadInfo* info, PJ::PlotDataMapRef& p
xmlLoadState(info->plugin_config.firstChildElement());
}

if (info->plugin_config.hasChildNodes() || _config.topics.empty())
if (!info->plugin_config.hasChildNodes() || _config.topics.empty())
{
QSettings settings;
_config.loadFromSettings(settings, "DataLoadROS");
Expand Down
11 changes: 6 additions & 5 deletions src/DataStreamROS/datastream_ROS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ void DataStreamROS::topicCallback(const RosIntrospection::ShapeShifter::ConstPtr
const auto& definition = msg->getMessageDefinition();

// register the message type
auto ros_parser = CreateParserROS(*parserFactories(), topic_name, datatype, definition, dataMap());
_parser.addParser(topic_name, ros_parser);

RosIntrospectionFactory::registerMessage(topic_name, md5sum, datatype, definition);
if(!_parser.hasParser(topic_name))
{
auto ros_parser = CreateParserROS(*parserFactories(), topic_name, datatype, definition, dataMap());
_parser.addParser(topic_name, ros_parser);
RosIntrospectionFactory::registerMessage(topic_name, md5sum, datatype, definition);
}

//------------------------------------
std::vector<uint8_t> buffer;

buffer.resize(msg->size());

ros::serialization::OStream stream(buffer.data(), buffer.size());
Expand Down
2 changes: 1 addition & 1 deletion src/ros_parsers/ros1_parser.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <PlotJuggler/messageparser_base.h>

#include <iostream>

inline std::shared_ptr<PJ::MessageParser>
CreateParserROS(const PJ::ParserFactories &factories,
Expand Down

0 comments on commit 35b9de9

Please sign in to comment.