Go to the documentation of this file.
37 #ifndef DIAGNOSTIC_UPDATER__PUBLISHER_HPP_
38 #define DIAGNOSTIC_UPDATER__PUBLISHER_HPP_
44 #include "diagnostic_msgs/msg/diagnostic_array.hpp"
45 #include "diagnostic_updater/update_functions.hpp"
47 #include "rclcpp/clock.hpp"
48 #include "rclcpp/publisher.hpp"
49 #include "rclcpp/subscription.hpp"
56 template<
typename T,
typename =
void>
57 struct has_header :
public std::false_type
65 typename
std::enable_if<std::is_same<std_msgs::msg::Header,
66 decltype(std::declval<T>().header)>::value>
::type>
67 :
public std::true_type
82 class HeaderlessTopicDiagnostic :
public CompositeDiagnosticTask
129 class TopicDiagnostic :
public HeaderlessTopicDiagnostic
154 const rclcpp::Clock::SharedPtr & clock = std::make_shared<rclcpp::Clock>())
157 error_logger_(rclcpp::get_logger(
"TopicDiagnostic_error_logger"))
172 std::string error_msg =
"tick(void) has been called on a TopicDiagnostic.";
173 error_msg +=
" This is never correct. Use tick(rclcpp::Time &) instead.";
174 RCLCPP_FATAL(error_logger_, error_msg);
191 rclcpp::Logger error_logger_;
201 template<
typename MessageT,
typename AllocatorT = std::allocator<
void>>
202 class DiagnosedPublisher :
public TopicDiagnostic
220 using PublisherT = rclcpp::Publisher<MessageT, AllocatorT>;
223 const typename PublisherT::SharedPtr &
pub,
230 static_assert(has_header<MessageT>::value,
"Message type has to have a header.");
241 virtual void publish(
typename PublisherT::MessageUniquePtr message)
253 virtual void publish(
const MessageT & message)
262 typename PublisherT::SharedPtr
281 #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