Skip to content

Commit bbef51d

Browse files
authored
Expect bool return type for get_parameter calls (#638)
In some places, the code was expecting a PARAMETER_NOT_SET value from get_parameter when actually a bool is being returned. The code just happened to work before since PARAMETER_NOT_SET has value 0, which is equivalent to false. Signed-off-by: Jacob Perron <[email protected]>
1 parent a617893 commit bbef51d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ros_filter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ void RosFilter<T>::loadParams()
10691069
this->declare_parameter(odom_topic_name);
10701070

10711071
rclcpp::Parameter parameter;
1072-
if (rclcpp::PARAMETER_NOT_SET != this->get_parameter(odom_topic_name, parameter)) {
1072+
if (this->get_parameter(odom_topic_name, parameter)) {
10731073
more_params = true;
10741074
odom_topic = parameter.as_string();
10751075
} else {
@@ -1220,7 +1220,7 @@ void RosFilter<T>::loadParams()
12201220
this->declare_parameter(pose_topic_name);
12211221

12221222
rclcpp::Parameter parameter;
1223-
if (rclcpp::PARAMETER_NOT_SET != this->get_parameter(pose_topic_name, parameter)) {
1223+
if (this->get_parameter(pose_topic_name, parameter)) {
12241224
more_params = true;
12251225
pose_topic = parameter.as_string();
12261226
} else {
@@ -1338,7 +1338,7 @@ void RosFilter<T>::loadParams()
13381338
this->declare_parameter(twist_topic_name);
13391339

13401340
rclcpp::Parameter parameter;
1341-
if (rclcpp::PARAMETER_NOT_SET != this->get_parameter(twist_topic_name, parameter)) {
1341+
if (this->get_parameter(twist_topic_name, parameter)) {
13421342
more_params = true;
13431343
twist_topic = parameter.as_string();
13441344
} else {
@@ -1420,7 +1420,7 @@ void RosFilter<T>::loadParams()
14201420
this->declare_parameter(imu_topic_name);
14211421

14221422
rclcpp::Parameter parameter;
1423-
if (rclcpp::PARAMETER_NOT_SET != this->get_parameter(imu_topic_name, parameter)) {
1423+
if (this->get_parameter(imu_topic_name, parameter)) {
14241424
more_params = true;
14251425
imu_topic = parameter.as_string();
14261426
} else {

0 commit comments

Comments
 (0)