.. _program_listing_file__tmp_ws_src_diagnostics_diagnostic_aggregator_include_diagnostic_aggregator_aggregator.hpp: Program Listing for File aggregator.hpp ======================================= |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/aggregator.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /********************************************************************* * Software License Agreement (BSD License) * * Copyright (c) 2009, Willow Garage, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of the Willow Garage nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *********************************************************************/ #ifndef DIAGNOSTIC_AGGREGATOR__AGGREGATOR_HPP_ #define DIAGNOSTIC_AGGREGATOR__AGGREGATOR_HPP_ #include #include #include #include #include #include "diagnostic_aggregator/analyzer.hpp" #include "diagnostic_aggregator/analyzer_group.hpp" #include "diagnostic_aggregator/other_analyzer.hpp" #include "diagnostic_aggregator/status_item.hpp" #include "diagnostic_aggregator/visibility_control.hpp" #include "diagnostic_msgs/msg/diagnostic_array.hpp" #include "diagnostic_msgs/msg/diagnostic_status.hpp" #include "diagnostic_msgs/msg/key_value.hpp" #include "diagnostic_msgs/srv/add_diagnostics.hpp" #include "rclcpp/rclcpp.hpp" namespace diagnostic_aggregator { class Aggregator { public: DIAGNOSTIC_AGGREGATOR_PUBLIC Aggregator(); DIAGNOSTIC_AGGREGATOR_PUBLIC virtual ~Aggregator(); DIAGNOSTIC_AGGREGATOR_PUBLIC void publishData(); DIAGNOSTIC_AGGREGATOR_PUBLIC rclcpp::Node::SharedPtr get_node() const; private: rclcpp::Node::SharedPtr n_; rclcpp::Logger logger_; rclcpp::TimerBase::SharedPtr publish_timer_; rclcpp::Service::SharedPtr add_srv_; rclcpp::Subscription::SharedPtr diag_sub_; rclcpp::Publisher::SharedPtr agg_pub_; rclcpp::Publisher::SharedPtr toplevel_state_pub_; std::mutex mutex_; double pub_rate_; int history_depth_; rclcpp::Clock::SharedPtr clock_; void diagCallback(const diagnostic_msgs::msg::DiagnosticArray::SharedPtr diag_msg); std::unique_ptr analyzer_group_; std::unique_ptr other_analyzer_; std::string base_path_; bool critical_; std::uint8_t last_top_level_state_; std::set ros_warnings_; /* *!\brief Checks timestamp of message, and warns if timestamp is 0 (not set) */ void checkTimestamp(const diagnostic_msgs::msg::DiagnosticArray::SharedPtr diag_msg); }; } // namespace diagnostic_aggregator #endif // DIAGNOSTIC_AGGREGATOR__AGGREGATOR_HPP_