Skip to content

Commit

Permalink
Use C-style strings for RCLCPP_ macros. (#12)
Browse files Browse the repository at this point in the history
Since ros2/rclcpp#1442 , only
C-style strings can be used with the RCLCPP_ macros.
More information is available in
https://index.ros.org/doc/ros2/Releases/Release-Galactic-Geochelone/#change-in-rclcpp-s-logging-macros

Fix the code here to use C-style strings.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
  • Loading branch information
clalancette committed Jan 26, 2021
1 parent 69a327b commit 6567f87
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/laser_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void LaserPublisher::publish(const sensor_msgs::msg::MultiEchoLaserScan & msg) c
} catch (std::runtime_error & e) {
auto err = std::string("Could not publish to topic ") + impl_->pubs_[i]->get_topic_name();
auto logger = rclcpp::get_logger("laser_publisher");
RCLCPP_ERROR(logger, err);
RCLCPP_ERROR(logger, "%s", err.c_str());
RCLCPP_ERROR(logger, e.what());
}
}
Expand Down Expand Up @@ -187,7 +187,7 @@ void LaserPublisher::publish(sensor_msgs::msg::MultiEchoLaserScan::ConstSharedPt
} catch (std::runtime_error & e) {
auto err = std::string("Could not publish to topic ") + impl_->pubs_[i]->get_topic_name();
auto logger = rclcpp::get_logger("laser_publisher");
RCLCPP_ERROR(logger, err);
RCLCPP_ERROR(logger, "%s", err.c_str());
RCLCPP_ERROR(logger, e.what());
}
}
Expand Down

0 comments on commit 6567f87

Please sign in to comment.