Skip to content

Commit 640dab8

Browse files
committed
Adding Ceres options
1 parent 532bc51 commit 640dab8

File tree

3 files changed

+90
-107
lines changed

3 files changed

+90
-107
lines changed

fuse_core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ add_library(
4343
# src/async_motion_model.cpp
4444
# src/async_publisher.cpp
4545
# src/async_sensor_model.cpp
46-
# src/ceres_options.cpp
46+
src/ceres_options.cpp
4747
src/constraint.cpp
4848
src/graph.cpp
4949
src/graph_deserializer.cpp

fuse_core/include/fuse_core/ceres_options.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636

3737
#include <fuse_core/ceres_macros.h>
3838

39-
#include <ros/console.h>
40-
#include <ros/node_handle.h>
39+
#include <rclcpp/logging.hpp>
40+
#include <rclcpp/node.hpp>
4141

4242
#include <ceres/version.h>
4343
#include <ceres/covariance.h>
@@ -185,23 +185,23 @@ CERES_OPTION_STRING_DEFINITIONS(VisibilityClusteringType)
185185
/**
186186
* @brief Helper function that loads a Ceres Option (e.g. ceres::LinearSolverType) value from the parameter server
187187
*
188-
* @param[in] node_handle - The node handle used to load the parameter
188+
* @param[in] node - The node handle used to load the parameter
189189
* @param[in] parameter_name - The parameter name to load
190190
* @param[in] default_value - A default value to use if the provided parameter name does not exist
191191
* @return The loaded (or default) value
192192
*/
193193
template <class T>
194-
T getParam(const ros::NodeHandle& node_handle, const std::string& parameter_name, const T& default_value)
194+
T getParam(rclcpp::Node& node, const std::string& parameter_name, const T& default_value)
195195
{
196196
const std::string default_string_value{ ToString(default_value) };
197197

198198
std::string string_value;
199-
node_handle.param(parameter_name, string_value, default_string_value);
199+
string_value = node.declare_parameter(parameter_name, default_string_value);
200200

201201
T value;
202202
if (!FromString(string_value, &value))
203203
{
204-
ROS_WARN_STREAM("The requested " << parameter_name << " (" << string_value
204+
RCLCPP_WARN_STREAM(node.get_logger(), "The requested " << parameter_name << " (" << string_value
205205
<< ") is not supported. Using the default value (" << default_string_value
206206
<< ") instead.");
207207
value = default_value;
@@ -216,23 +216,23 @@ T getParam(const ros::NodeHandle& node_handle, const std::string& parameter_name
216216
* @param[in] nh - A node handle in a namespace containing ceres::Covariance::Options settings
217217
* @param[out] covariance_options - The ceres::Covariance::Options object to update
218218
*/
219-
void loadCovarianceOptionsFromROS(const ros::NodeHandle& nh, ceres::Covariance::Options& covariance_options);
219+
void loadCovarianceOptionsFromROS(rclcpp::Node& nh, ceres::Covariance::Options& covariance_options);
220220

221221
/**
222222
* @brief Populate a ceres::Problem::Options object with information from the parameter server
223223
*
224224
* @param[in] nh - A node handle in a namespace containing ceres::Problem::Options settings
225225
* @param[out] problem_options - The ceres::Problem::Options object to update
226226
*/
227-
void loadProblemOptionsFromROS(const ros::NodeHandle& nh, ceres::Problem::Options& problem_options);
227+
void loadProblemOptionsFromROS(rclcpp::Node& nh, ceres::Problem::Options& problem_options);
228228

229229
/**
230230
* @brief Populate a ceres::Solver::Options object with information from the parameter server
231231
*
232232
* @param[in] nh - A node handle in a namespace containing ceres::Solver::Options settings
233233
* @param[out] solver_options - The ceres::Solver::Options object to update
234234
*/
235-
void loadSolverOptionsFromROS(const ros::NodeHandle& nh, ceres::Solver::Options& solver_options);
235+
void loadSolverOptionsFromROS(rclcpp::Node& nh, ceres::Solver::Options& solver_options);
236236

237237
} // namespace fuse_core
238238

0 commit comments

Comments
 (0)