play_tune.cpp
Go to the documentation of this file.
1 #include <mavros/mavros_plugin.h>
2 #include <mavros_msgs/PlayTuneV2.h>
3 #include <cstring>
4 
5 namespace mavros
6 {
7 namespace extra_plugins
8 {
10 {
11 public:
12  PlayTunePlugin() : PluginBase(), nh("~") {}
13 
14  void initialize(UAS& uas_) override
15  {
17  sub = nh.subscribe("play_tune", 1, &PlayTunePlugin::callback, this);
18  }
19 
21  return { /* No subscriptions */ };
22  }
23 
24 private:
27 
29  {
30  auto msg = mavlink::common::msg::PLAY_TUNE_V2{};
32  msg.format = tune->format;
33  mavlink::set_string_z(msg.tune, tune->tune);
34  UAS_FCU(m_uas)->send_message_ignore_drop(msg);
35  }
36 };
37 } // namespace extra_plugins
38 } // namespace mavros
39 
msg
void initialize(UAS &uas_) override
Definition: play_tune.cpp:14
std::shared_ptr< MAVConnInterface const > ConstPtr
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void msg_set_target(_T &msg)
#define UAS_FCU(uasobjptr)
std::vector< HandlerInfo > Subscriptions
void initialize(UAS &uas_) override
void callback(const mavros_msgs::PlayTuneV2::ConstPtr &tune)
Definition: play_tune.cpp:28
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
Subscriptions get_subscriptions() override
Definition: play_tune.cpp:20


mavros_extras
Author(s): Vladimir Ermakov , Amilcar Lucas
autogenerated on Tue Jun 1 2021 02:36:36