Skip to content

Commit f17c7f0

Browse files
committed
Adding graph and transaction classes
1 parent ad84876 commit f17c7f0

File tree

5 files changed

+24
-24
lines changed

5 files changed

+24
-24
lines changed

fuse_core/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ add_library(
4343
# src/async_sensor_model.cpp
4444
# src/ceres_options.cpp
4545
src/constraint.cpp
46-
# src/graph.cpp
46+
src/graph.cpp
4747
# src/graph_deserializer.cpp
4848
src/loss.cpp
4949
src/serialization.cpp
5050
# src/timestamp_manager.cpp
51-
# src/transaction.cpp
51+
src/transaction.cpp
5252
# src/transaction_deserializer.cpp
5353
src/uuid.cpp
5454
src/variable.cpp

fuse_core/include/fuse_core/graph.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ namespace fuse_core
149149
class Graph
150150
{
151151
public:
152-
FUSE_SMART_PTR_ALIASES_ONLY(Graph);
152+
FUSE_SMART_PTR_ALIASES_ONLY(Graph)
153153

154154
/**
155155
* @brief A range of fuse_ros::Constraint objects
@@ -379,7 +379,7 @@ class Graph
379379
* @return A Ceres Solver Summary structure containing information about the optimization process
380380
*/
381381
virtual ceres::Solver::Summary optimizeFor(
382-
const ros::Duration& max_optimization_time,
382+
const rclcpp::Duration& max_optimization_time,
383383
const ceres::Solver::Options& options = ceres::Solver::Options()) = 0;
384384

385385
/**

fuse_core/include/fuse_core/graph_deserializer.h

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

37-
#include <fuse_msgs/SerializedGraph.h>
37+
#include <fuse_msgs/msg/SerializedGraph.hpp>
3838
#include <fuse_core/constraint.h>
3939
#include <fuse_core/graph.h>
4040
#include <fuse_core/variable.h>
41-
#include <pluginlib/class_loader.h>
41+
#include <pluginlib/class_loader.hpp>
4242

4343

4444
namespace fuse_core

fuse_core/include/fuse_core/transaction.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include <fuse_core/serialization.h>
4040
#include <fuse_core/uuid.h>
4141
#include <fuse_core/variable.h>
42-
#include <ros/time.h>
42+
#include <rclcpp/time.hpp>
4343

4444
#include <boost/range/any_range.hpp>
4545
#include <boost/serialization/access.hpp>
@@ -66,7 +66,7 @@ namespace fuse_core
6666
class Transaction
6767
{
6868
public:
69-
FUSE_SMART_PTR_DEFINITIONS(Transaction);
69+
FUSE_SMART_PTR_DEFINITIONS(Transaction)
7070

7171
/**
7272
* @brief A range of Constraint::SharedPtr objects
@@ -78,13 +78,13 @@ class Transaction
7878
using const_constraint_range = boost::any_range<const Constraint, boost::forward_traversal_tag>;
7979

8080
/**
81-
* @brief A range of ros::Time objects
81+
* @brief A range of rclcpp::Time objects
8282
*
8383
* An object representing a range defined by two iterators. It has begin() and end() methods (which means it can
8484
* be used in range-based for loops), an empty() method, and a front() method for directly accessing the first
85-
* member. When dereferenced, an iterator returns a const ros::Time&.
85+
* member. When dereferenced, an iterator returns a const rclcpp::Time&.
8686
*/
87-
using const_stamp_range = boost::any_range<const ros::Time, boost::forward_traversal_tag>;
87+
using const_stamp_range = boost::any_range<const rclcpp::Time, boost::forward_traversal_tag>;
8888

8989
/**
9090
* @brief A range of UUID objects
@@ -107,12 +107,12 @@ class Transaction
107107
/**
108108
* @brief Read-only access to this transaction's timestamp
109109
*/
110-
const ros::Time& stamp() const { return stamp_; }
110+
const rclcpp::Time& stamp() const { return stamp_; }
111111

112112
/**
113113
* @brief Write access to this transaction's timestamp
114114
*/
115-
void stamp(const ros::Time& stamp) { stamp_ = stamp; }
115+
void stamp(const rclcpp::Time& stamp) { stamp_ = stamp; }
116116

117117
/**
118118
* @brief Read-only access to the set of timestamps involved in this transaction
@@ -127,15 +127,15 @@ class Transaction
127127
*
128128
* @return The minimum (oldest) timestamp.
129129
*/
130-
const ros::Time& minStamp() const;
130+
const rclcpp::Time& minStamp() const;
131131

132132
/**
133133
* @brief Read-only access to the maximum (newest) timestamp among the transaction's stamp and all involved
134134
* timestamps, if any
135135
*
136136
* @return The maximum (newest) timestamp.
137137
*/
138-
const ros::Time& maxStamp() const;
138+
const rclcpp::Time& maxStamp() const;
139139

140140
/**
141141
* @brief Read-only access to the added constraints
@@ -180,7 +180,7 @@ class Transaction
180180
*
181181
* @param[in] stamp The timestamp to be added
182182
*/
183-
void addInvolvedStamp(const ros::Time& stamp);
183+
void addInvolvedStamp(const rclcpp::Time& stamp);
184184

185185
/**
186186
* @brief Add a constraint to this transaction
@@ -282,10 +282,10 @@ class Transaction
282282
void deserialize(fuse_core::TextInputArchive& /* archive */);
283283

284284
private:
285-
ros::Time stamp_; //!< The transaction message timestamp
285+
rclcpp::Time stamp_; //!< The transaction message timestamp
286286
std::vector<Constraint::SharedPtr> added_constraints_; //!< The constraints to be added
287287
std::vector<Variable::SharedPtr> added_variables_; //!< The variables to be added
288-
std::set<ros::Time> involved_stamps_; //!< The set of timestamps involved in this transaction
288+
std::set<rclcpp::Time> involved_stamps_; //!< The set of timestamps involved in this transaction
289289
std::vector<UUID> removed_constraints_; //!< The constraint UUIDs to be removed
290290
std::vector<UUID> removed_variables_; //!< The variable UUIDs to be removed
291291

fuse_core/src/transaction.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <fuse_core/constraint.h>
3737
#include <fuse_core/uuid.h>
3838
#include <fuse_core/variable.h>
39-
#include <ros/time.h>
39+
#include <rclcpp/time.hpp>
4040

4141
#include <boost/iterator/transform_iterator.hpp>
4242
#include <boost/range/empty.hpp>
@@ -49,7 +49,7 @@
4949
namespace fuse_core
5050
{
5151

52-
const ros::Time& Transaction::minStamp() const
52+
const rclcpp::Time& Transaction::minStamp() const
5353
{
5454
if (involved_stamps_.empty())
5555
{
@@ -61,7 +61,7 @@ const ros::Time& Transaction::minStamp() const
6161
}
6262
}
6363

64-
const ros::Time& Transaction::maxStamp() const
64+
const rclcpp::Time& Transaction::maxStamp() const
6565
{
6666
if (involved_stamps_.empty())
6767
{
@@ -73,7 +73,7 @@ const ros::Time& Transaction::maxStamp() const
7373
}
7474
}
7575

76-
void Transaction::addInvolvedStamp(const ros::Time& stamp)
76+
void Transaction::addInvolvedStamp(const rclcpp::Time& stamp)
7777
{
7878
involved_stamps_.insert(stamp);
7979
}
@@ -236,11 +236,11 @@ void Transaction::merge(const Transaction& other, bool overwrite)
236236

237237
void Transaction::print(std::ostream& stream) const
238238
{
239-
stream << "Stamp: " << stamp_ << "\n";
239+
stream << "Stamp: " << stamp_.seconds() << "\n";
240240
stream << "Involved Timestamps:\n";
241241
for (const auto& involved_stamp : involved_stamps_)
242242
{
243-
stream << " - " << involved_stamp << "\n";
243+
stream << " - " << involved_stamp.seconds() << "\n";
244244
}
245245
stream << "Added Variables:\n";
246246
for (const auto& added_variable : added_variables_)

0 commit comments

Comments
 (0)