Skip to content

Commit 16486aa

Browse files
committed
Adding graph deserializer
1 parent f17c7f0 commit 16486aa

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

fuse_core/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1111
add_compile_options(-Wall -Werror -Wextra -Wpedantic)
1212
endif()
1313

14+
set(CMAKE_BUILD_TYPE Release)
15+
1416
find_package(Boost REQUIRED COMPONENTS serialization)
1517
find_package(Ceres REQUIRED)
1618
find_package(Eigen3 REQUIRED)
@@ -44,7 +46,7 @@ add_library(
4446
# src/ceres_options.cpp
4547
src/constraint.cpp
4648
src/graph.cpp
47-
# src/graph_deserializer.cpp
49+
src/graph_deserializer.cpp
4850
src/loss.cpp
4951
src/serialization.cpp
5052
# src/timestamp_manager.cpp
@@ -56,6 +58,7 @@ add_library(
5658
ament_target_dependencies(
5759
${PROJECT_NAME}
5860
fuse_msgs
61+
pluginlib
5962
rclcpp
6063
std_msgs
6164
)
@@ -64,10 +67,10 @@ target_include_directories(
6467
${PROJECT_NAME} PUBLIC
6568
include
6669
${Boost_INCLUDE_DIRS}
67-
${catkin_INCLUDE_DIRS}
6870
${CERES_INCLUDE_DIRS}
6971
${EIGEN3_INCLUDE_DIRS}
7072
${GLOG_INCLUDE_DIRS}
73+
${pluginlib_INCLUDE_DIRS}
7174
)
7275
target_link_libraries(
7376
${PROJECT_NAME}
@@ -76,6 +79,7 @@ target_link_libraries(
7679
${CERES_LIBRARIES}
7780
${GLOG_LIBRARIES}
7881
)
82+
target_compile_definitions(${PROJECT_NAME} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")
7983

8084
# fuse_echo executable
8185
# add_executable(fuse_echo

fuse_core/include/fuse_core/graph_deserializer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#ifndef FUSE_CORE_GRAPH_DESERIALIZER_H
3535
#define FUSE_CORE_GRAPH_DESERIALIZER_H
3636

37-
#include <fuse_msgs/msg/SerializedGraph.hpp>
37+
#include <fuse_msgs/msg/serialized_graph.hpp>
3838
#include <fuse_core/constraint.h>
3939
#include <fuse_core/graph.h>
4040
#include <fuse_core/variable.h>
@@ -47,7 +47,7 @@ namespace fuse_core
4747
/**
4848
* @brief Serialize a graph into a message
4949
*/
50-
void serializeGraph(const fuse_core::Graph& graph, fuse_msgs::SerializedGraph& msg);
50+
void serializeGraph(const fuse_core::Graph& graph, fuse_msgs::msg::SerializedGraph& msg);
5151

5252
/**
5353
* @brief Deserialize a graph
@@ -73,7 +73,7 @@ class GraphDeserializer
7373
* @param[in] msg The SerializedGraph message to be deserialized
7474
* @return A unique_ptr to a derived Graph object
7575
*/
76-
fuse_core::Graph::UniquePtr deserialize(const fuse_msgs::SerializedGraph::ConstPtr& msg) const;
76+
fuse_core::Graph::UniquePtr deserialize(const fuse_msgs::msg::SerializedGraph::ConstSharedPtr& msg) const;
7777

7878
/**
7979
* @brief Deserialize a SerializedGraph message into a fuse Graph object.
@@ -84,7 +84,7 @@ class GraphDeserializer
8484
* @param[in] msg The SerializedGraph message to be deserialized
8585
* @return A unique_ptr to a derived Graph object
8686
*/
87-
fuse_core::Graph::UniquePtr deserialize(const fuse_msgs::SerializedGraph& msg) const;
87+
fuse_core::Graph::UniquePtr deserialize(const fuse_msgs::msg::SerializedGraph& msg) const;
8888

8989
private:
9090
pluginlib::ClassLoader<fuse_core::Variable> variable_loader_; //!< Pluginlib class loader for Variable types

fuse_core/src/graph_deserializer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
#include <fuse_core/graph_deserializer.h>
3535

3636
#include <fuse_core/serialization.h>
37-
#include <fuse_msgs/SerializedGraph.h>
37+
#include <fuse_msgs/msg/serialized_graph.hpp>
3838

3939
#include <boost/iostreams/stream.hpp>
4040

4141

4242
namespace fuse_core
4343
{
4444

45-
void serializeGraph(const fuse_core::Graph& graph, fuse_msgs::SerializedGraph& msg)
45+
void serializeGraph(const fuse_core::Graph& graph, fuse_msgs::msg::SerializedGraph& msg)
4646
{
4747
// Serialize the graph into the msg.data field
4848
boost::iostreams::stream<fuse_core::MessageBufferStreamSink> stream(msg.data);
@@ -78,12 +78,12 @@ GraphDeserializer::GraphDeserializer() :
7878
}
7979
}
8080

81-
fuse_core::Graph::UniquePtr GraphDeserializer::deserialize(const fuse_msgs::SerializedGraph::ConstPtr& msg) const
81+
fuse_core::Graph::UniquePtr GraphDeserializer::deserialize(const fuse_msgs::msg::SerializedGraph::ConstSharedPtr& msg) const
8282
{
8383
return deserialize(*msg);
8484
}
8585

86-
fuse_core::Graph::UniquePtr GraphDeserializer::deserialize(const fuse_msgs::SerializedGraph& msg) const
86+
fuse_core::Graph::UniquePtr GraphDeserializer::deserialize(const fuse_msgs::msg::SerializedGraph& msg) const
8787
{
8888
// Create a Graph object using pluginlib. This will throw if the plugin name is not found.
8989
// The unique ptr returned by pluginlib has a custom deleter. This makes it annoying to return

0 commit comments

Comments
 (0)