dummy.cpp
Go to the documentation of this file.
1 
10 /*
11  * Copyright 2013,2016 Vladimir Ermakov.
12  *
13  * This file is part of the mavros package and subject to the license terms
14  * in the top-level LICENSE file of the mavros repository.
15  * https://github.com/mavlink/mavros/tree/master/LICENSE.md
16  */
17 
18 #include <mavros/mavros_plugin.h>
19 
20 namespace mavros {
21 namespace std_plugins {
22 
29 public:
31  nh("~")
32  { }
33 
37  void initialize(UAS &uas_) override
38  {
39  PluginBase::initialize(uas_);
40 
41  ROS_INFO_NAMED("dummy", "Dummy::initialize");
42  }
43 
53  return {
54  /* automatic message deduction by second argument */
57  /* handle raw message, check framing! */
58  make_handler(mavlink::common::msg::STATUSTEXT::MSG_ID, &DummyPlugin::handle_statustext_raw),
60  };
61  }
62 
63 private:
65 
66  void handle_heartbeat(const mavlink::mavlink_message_t *msg, mavlink::minimal::msg::HEARTBEAT &hb) {
67  ROS_INFO_STREAM_NAMED("dummy", "Dummy::handle_heartbeat: " << hb.to_yaml());
68  }
69 
70  void handle_sys_status(const mavlink::mavlink_message_t *msg, mavlink::common::msg::SYS_STATUS &st) {
71  ROS_INFO_STREAM_NAMED("dummy", "Dummy::handle_sys_status: " << st.to_yaml());
72  }
73 
74  void handle_statustext(const mavlink::mavlink_message_t *msg, mavlink::common::msg::STATUSTEXT &st) {
75  ROS_INFO_STREAM_NAMED("dummy", "Dummy::handle_statustext: " << st.to_yaml());
76  }
77 
78  void handle_statustext_raw(const mavlink::mavlink_message_t *msg, const mavconn::Framing f) {
79  ROS_INFO_NAMED("dummy", "Dummy::handle_statustext_raw(%p, %d) from %u.%u", msg, utils::enum_value(f), msg->sysid, msg->compid);
80  }
81 };
82 
83 } // namespace std_plugins
84 } // namespace mavros
85 
MAVROS Plugin base class.
Definition: mavros_plugin.h:36
Subscriptions get_subscriptions() override
Definition: dummy.cpp:52
#define ROS_INFO_NAMED(name,...)
MAVROS Plugin base.
HandlerInfo make_handler(const mavlink::msgid_t id, void(_C::*fn)(const mavlink::mavlink_message_t *msg, const mavconn::Framing framing))
Definition: mavros_plugin.h:87
#define ROS_INFO_STREAM_NAMED(name, args)
PluginBase()
Plugin constructor Should not do anything before initialize()
Definition: mavros_plugin.h:74
void handle_statustext(const mavlink::mavlink_message_t *msg, mavlink::common::msg::STATUSTEXT &st)
Definition: dummy.cpp:74
UAS for plugins.
Definition: mavros_uas.h:67
void handle_heartbeat(const mavlink::mavlink_message_t *msg, mavlink::minimal::msg::HEARTBEAT &hb)
Definition: dummy.cpp:66
void handle_statustext_raw(const mavlink::mavlink_message_t *msg, const mavconn::Framing f)
Definition: dummy.cpp:78
void initialize(UAS &uas_) override
Definition: dummy.cpp:37
std::vector< HandlerInfo > Subscriptions
Subscriptions vector.
Definition: mavros_plugin.h:47
void handle_sys_status(const mavlink::mavlink_message_t *msg, mavlink::common::msg::SYS_STATUS &st)
Definition: dummy.cpp:70
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
constexpr std::underlying_type< _T >::type enum_value(_T e)
Definition: utils.h:55


mavros
Author(s): Vladimir Ermakov
autogenerated on Tue Jun 1 2021 02:36:26