Skip to content

Commit

Permalink
fix(fault_injection): modify build error in rolling (tier4#762)
Browse files Browse the repository at this point in the history
* fix(fault_injection): modify build error in rolling

Signed-off-by: wep21 <border_goldenmarket@yahoo.co.jp>

* ci(pre-commit): autofix

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and boyali committed Oct 3, 2022
1 parent 639b05b commit 13108eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions simulator/fault_injection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ ament_auto_add_library(fault_injection_node_component SHARED
src/fault_injection_node/fault_injection_node.cpp
)

if(${rosidl_generator_cpp_VERSION} VERSION_LESS 2.5.0)
target_compile_definitions(fault_injection_node_component PRIVATE
USE_DEPRECATED_TO_YAML
)
endif()

rclcpp_components_register_node(fault_injection_node_component
PLUGIN "fault_injection::FaultInjectionNode"
EXECUTABLE fault_injection_node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ std::vector<std::string> split(const std::string & str, const char delim)

namespace fault_injection
{
#ifdef USE_DEPRECATED_TO_YAML
using rosidl_generator_traits::to_yaml;
#else
using tier4_simulation_msgs::msg::to_yaml;
#endif

FaultInjectionNode::FaultInjectionNode(rclcpp::NodeOptions node_options)
: Node("fault_injection", node_options.automatically_declare_parameters_from_overrides(true)),
updater_(this)
Expand Down Expand Up @@ -64,8 +70,7 @@ FaultInjectionNode::FaultInjectionNode(rclcpp::NodeOptions node_options)

void FaultInjectionNode::onSimulationEvents(const SimulationEvents::ConstSharedPtr msg)
{
RCLCPP_DEBUG(
this->get_logger(), "Received data: %s", rosidl_generator_traits::to_yaml(*msg).c_str());
RCLCPP_DEBUG(this->get_logger(), "Received data: %s", to_yaml(*msg).c_str());
for (const auto & event : msg->fault_injection_events) {
if (diagnostic_storage_.isEventRegistered(event.name)) {
diagnostic_storage_.updateLevel(event.name, event.level);
Expand Down

0 comments on commit 13108eb

Please sign in to comment.