diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0a828475a..04cb37985 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,7 @@ if( CATKIN_DEVEL_PREFIX OR catkin_FOUND OR CATKIN_BUILD_BINARY_PACKAGE)
rosbag_storage
roscpp
roscpp_serialization
+ ros_type_introspection
tf2_ros
plotjuggler )
diff --git a/package.xml b/package.xml
index bdfcc2eae..bdb5e5a2b 100644
--- a/package.xml
+++ b/package.xml
@@ -17,6 +17,7 @@
rosbag_storage
roscpp
roscpp_serialization
+ ros_type_introspection
ament_cmake
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index 537d8ce30..523621a26 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -28,10 +28,12 @@ SET( COMMON_SRC
if(COMPILING_WITH_CATKIN)
+ include_directories(
+ ${catkin_INCLUDE_DIRS} )
+
list(APPEND COMMON_SRC
qnodedialog.cpp
rule_editing.cpp
- ros_parsers/ros1_parser.cpp
)
add_library( commonROS STATIC ${COMMON_SRC} ${COMMON_UI_SRC} )
@@ -39,32 +41,32 @@ if(COMPILING_WITH_CATKIN)
target_link_libraries( commonROS PRIVATE
${Qt5Widgets_LIBRARIES}
${Qt5Xml_LIBRARIES}
- ${catkin_LIBRARIES}
- ros_type_introspection_static )
+ ${catkin_LIBRARIES})
#########
add_library( DataLoadROS SHARED
DataLoadROS/dataload_ros.cpp)
target_link_libraries( DataLoadROS commonROS)
#############
- add_library( DataStreamROS SHARED
- DataStreamROS/datastream_ROS.cpp )
- target_link_libraries( DataStreamROS commonROS )
- #############
- add_library( RosTopicPublisher SHARED
- TopicPublisherROS/statepublisher_rostopic.cpp)
- target_link_libraries( RosTopicPublisher commonROS )
- #############
- QT5_WRAP_UI ( ROSOUT_UI RosoutPublisher/logwidget.ui )
- add_library( RosoutPublisher SHARED ${ROSOUT_UI}
- RosoutPublisher/rosout_publisher.cpp
- RosoutPublisher/logs_table_model.cpp
- RosoutPublisher/logwidget.cpp
- RosoutPublisher/modelfilter.cpp
- )
- target_link_libraries( RosoutPublisher commonROS )
+ # add_library( DataStreamROS SHARED
+ # DataStreamROS/datastream_ROS.cpp )
+ # target_link_libraries( DataStreamROS commonROS )
+ # #############
+ # add_library( RosTopicPublisher SHARED
+ # TopicPublisherROS/statepublisher_rostopic.cpp)
+ # target_link_libraries( RosTopicPublisher commonROS )
+ # #############
+ # QT5_WRAP_UI ( ROSOUT_UI RosoutPublisher/logwidget.ui )
+ # add_library( RosoutPublisher SHARED ${ROSOUT_UI}
+ # RosoutPublisher/rosout_publisher.cpp
+ # RosoutPublisher/logs_table_model.cpp
+ # RosoutPublisher/logwidget.cpp
+ # RosoutPublisher/modelfilter.cpp
+ # )
+ # target_link_libraries( RosoutPublisher commonROS )
#######################################################################
elseif(COMPILING_WITH_AMENT)
+
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
list( APPEND COMMON_SRC ros_parsers/ros2_parser.cpp )
@@ -118,9 +120,9 @@ endif()
if(COMPILING_WITH_CATKIN)
install(TARGETS
DataLoadROS
- DataStreamROS
- RosTopicPublisher
- RosoutPublisher
+ # DataStreamROS
+ # RosTopicPublisher
+ # RosoutPublisher
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}/
)
elseif(COMPILING_WITH_AMENT)
diff --git a/plugins/DataLoadROS/dataload_ros.cpp b/plugins/DataLoadROS/dataload_ros.cpp
index 55e700caa..67dfa3129 100644
--- a/plugins/DataLoadROS/dataload_ros.cpp
+++ b/plugins/DataLoadROS/dataload_ros.cpp
@@ -45,7 +45,7 @@ const std::vector& DataLoadROS::compatibleFileExtensions() const
}
std::vector>
-DataLoadROS::getAllTopics(const rosbag::Bag* bag, RosCompositeParser& parser)
+DataLoadROS::getAllTopics(const rosbag::Bag* bag, PJ::CompositeParser& parser)
{
std::vector> all_topics;
rosbag::View bag_view(*bag, ros::TIME_MIN, ros::TIME_MAX, true);
@@ -62,8 +62,8 @@ DataLoadROS::getAllTopics(const rosbag::Bag* bag, RosCompositeParser& parser)
all_topics.push_back(std::make_pair(QString(topic.c_str()), QString(datatype.c_str())));
try
{
- parser.registerMessageType(topic, datatype, definition);
-
+ auto ros_parser = CreateParserROS(*parserFactories(), topic, datatype, definition, *_plot_map);
+ parser.addParser(topic, ros_parser);
RosIntrospectionFactory::registerMessage(topic, md5sum, datatype, definition);
}
catch (std::exception& ex)
@@ -107,6 +107,7 @@ DataLoadROS::getAllTopics(const rosbag::Bag* bag, RosCompositeParser& parser)
bool DataLoadROS::readDataFromFile(PJ::FileLoadInfo* info, PJ::PlotDataMapRef& plot_map)
{
+ _plot_map = &plot_map;
auto temp_bag = std::make_shared();
try
@@ -119,7 +120,7 @@ bool DataLoadROS::readDataFromFile(PJ::FileLoadInfo* info, PJ::PlotDataMapRef& p
return false;
}
- RosCompositeParser ros_parser(plot_map);
+ PJ::CompositeParser ros_parser;
auto all_topics = getAllTopics(temp_bag.get(), ros_parser);
//----------------------------------
@@ -182,7 +183,7 @@ bool DataLoadROS::readDataFromFile(PJ::FileLoadInfo* info, PJ::PlotDataMapRef& p
QElapsedTimer timer;
timer.start();
- PlotDataAny& plot_consecutive = plot_map.addUserDefined("plotjuggler::rosbag1::consecutive_messages")->second;
+ PJ::PlotDataAny& plot_consecutive = plot_map.addUserDefined("plotjuggler::rosbag1::consecutive_messages")->second;
std::vector buffer;
@@ -215,13 +216,13 @@ bool DataLoadROS::readDataFromFile(PJ::FileLoadInfo* info, PJ::PlotDataMapRef& p
ros::serialization::OStream stream(buffer.data(), msg_size);
msg_instance.write(stream);
- MessageRef msg_serialized(buffer.data(), buffer.size());
+ PJ::MessageRef msg_serialized(buffer.data(), buffer.size());
double tmp_timestamp = msg_time;
ros_parser.parseMessage(topic_name, msg_serialized, tmp_timestamp);
//------ save msg reference in PlotAny ----
- auto data_point = PlotDataAny::Point(tmp_timestamp, std::any(msg_instance));
+ auto data_point = PJ::PlotDataAny::Point(tmp_timestamp, std::any(msg_instance));
plot_consecutive.pushBack(data_point);
auto plot_pair = plot_map.user_defined.find(topic_name);
@@ -229,7 +230,7 @@ bool DataLoadROS::readDataFromFile(PJ::FileLoadInfo* info, PJ::PlotDataMapRef& p
{
plot_pair = plot_map.addUserDefined(topic_name);
}
- PlotDataAny& plot_raw = plot_pair->second;
+ PJ::PlotDataAny& plot_raw = plot_pair->second;
plot_raw.pushBack(data_point);
}
diff --git a/plugins/DataLoadROS/dataload_ros.h b/plugins/DataLoadROS/dataload_ros.h
index cd8ca8fec..b8723b906 100644
--- a/plugins/DataLoadROS/dataload_ros.h
+++ b/plugins/DataLoadROS/dataload_ros.h
@@ -9,13 +9,13 @@
#include
#include "dialog_select_ros_topics.h"
-#include "ros1_parsers/ros1_parser.h"
+#include "ros_parsers/ros1_parser.h"
+#include "parser_configuration.h"
class DataLoadROS : public PJ::DataLoader
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID "facontidavide.PlotJuggler3.DataLoader"
- "../dataloader.json")
+ Q_PLUGIN_METADATA(IID "facontidavide.PlotJuggler3.ROSDataLoader")
Q_INTERFACES(PJ::DataLoader)
public:
@@ -45,9 +45,11 @@ class DataLoadROS : public PJ::DataLoader
private:
std::vector _extensions;
- RosParserConfig _config;
+ PJ::RosParserConfig _config;
- std::vector> getAllTopics(const rosbag::Bag* bag, RosCompositeParser &parser);
+ std::vector> getAllTopics(const rosbag::Bag* bag, PJ::CompositeParser &parser);
+
+ PJ::PlotDataMapRef* _plot_map = nullptr;
};
#endif // DATALOAD_CSV_H
diff --git a/plugins/ros_parsers/ros1_parser.cpp b/plugins/ros_parsers/ros1_parser.cpp
deleted file mode 100644
index ef2d65ad4..000000000
--- a/plugins/ros_parsers/ros1_parser.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "ros_parsers/ros1_parser.h"
-
diff --git a/plugins/ros_parsers/ros1_parser.h b/plugins/ros_parsers/ros1_parser.h
index 7e0413c07..7b83c7da5 100644
--- a/plugins/ros_parsers/ros1_parser.h
+++ b/plugins/ros_parsers/ros1_parser.h
@@ -1,12 +1,15 @@
#pragma once
-#include
#include
-#include "ros_type_introspection/ros_introspection.hpp"
-#include "parser_configuration.h"
-std::shared_ptr
+
+inline std::shared_ptr
CreateParserROS(const PJ::ParserFactories &factories,
- const std::string &topic_name,
- const std::string &type_name,
- PJ::PlotDataMapRef &data);
+ const std::string& topic_name,
+ const std::string& type_name,
+ const std::string& definition,
+ PJ::PlotDataMapRef& data)
+{
+ return factories.at("ros1msg")->createParser(topic_name, type_name, definition, data);
+}
+