Go to the documentation of this file.
36 #ifndef DIAGNOSTIC_UPDATER__PUBLISHER_HPP_
37 #define DIAGNOSTIC_UPDATER__PUBLISHER_HPP_
43 #include "diagnostic_msgs/msg/diagnostic_array.hpp"
44 #include "diagnostic_updater/update_functions.hpp"
46 #include "rclcpp/clock.hpp"
47 #include "rclcpp/publisher.hpp"
48 #include "rclcpp/subscription.hpp"
55 template<
typename T,
typename =
void>
56 struct has_header :
public std::false_type
64 typename
std::enable_if<std::is_same<std_msgs::msg::Header,
65 decltype(std::declval<T>().header)>::value>
::type>
66 :
public std::true_type
81 class HeaderlessTopicDiagnostic :
public CompositeDiagnosticTask
128 class TopicDiagnostic :
public HeaderlessTopicDiagnostic
153 const rclcpp::Clock::SharedPtr & clock = std::make_shared<rclcpp::Clock>())
156 error_logger_(rclcpp::get_logger(
"TopicDiagnostic_error_logger"))
171 std::string error_msg =
"tick(void) has been called on a TopicDiagnostic.";
172 error_msg +=
" This is never correct. Use tick(rclcpp::Time &) instead.";
173 RCLCPP_FATAL(error_logger_,
"%s", error_msg.c_str());
190 rclcpp::Logger error_logger_;
200 template<
typename MessageT,
typename AllocatorT = std::allocator<
void>>
201 class DiagnosedPublisher :
public TopicDiagnostic
219 using PublisherT = rclcpp::Publisher<MessageT, AllocatorT>;
222 const typename PublisherT::SharedPtr &
pub,
229 static_assert(has_header<MessageT>::value,
"Message type has to have a header.");
240 virtual void publish(
typename PublisherT::MessageUniquePtr message)
252 virtual void publish(
const MessageT & message)
261 typename PublisherT::SharedPtr
280 #endif // DIAGNOSTIC_UPDATER__PUBLISHER_HPP_
void addTask(DiagnosticTask *t)
A diagnostic task that monitors the frequency of an event.
virtual ~DiagnosedPublisher()
A structure that holds the constructor parameters for the TimeStampStatus class.
DiagnosedPublisher(const ros::Publisher &pub, diagnostic_updater::Updater &diag, const diagnostic_updater::FrequencyStatusParam &freq, const diagnostic_updater::TimeStampStatusParam &stamp)
Manages a list of diagnostic tasks, and calls them in a rate-limited manner.
TopicDiagnostic(std::string name, diagnostic_updater::Updater &diag, const diagnostic_updater::FrequencyStatusParam &freq, const diagnostic_updater::TimeStampStatusParam &stamp)
void publish(const boost::shared_ptr< M > &message) const
def message(msg, *args, **kwargs)
virtual void publish(const boost::shared_ptr< T > &message)
void tick(const ros::Time t)
virtual ~TopicDiagnostic()
::std_msgs::Time_< std::allocator< void > > Time
ros::Publisher getPublisher() const
CompositeDiagnosticTask(const std::string name)
void setPublisher(ros::Publisher pub)
void add(const std::string &name, TaskFunction f)
ros::Publisher publisher_
A structure that holds the constructor parameters for the FrequencyStatus class.
sick_scan_xd
Author(s): Michael Lehning
, Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:10