mount_control.cpp
Go to the documentation of this file.
1 
9 /*
10  * Copyright 2019 Jaeyoung Lim.
11  *
12  * This file is part of the mavros package and subject to the license terms
13  * in the top-level LICENSE file of the mavros repository.
14  * https://github.com/mavlink/mavros/tree/master/LICENSE.md
15  */
16 
17 #include <mavros/mavros_plugin.h>
18 
19 #include <mavros_msgs/MountControl.h>
20 
21 namespace mavros {
22 namespace extra_plugins {
23 
25 using mavlink::common::MAV_MOUNT_MODE;
26 using mavlink::common::MAV_CMD;
27 using utils::enum_value;
28 
36 public:
38  mount_nh("~mount_control")
39  { }
40 
41  void initialize(UAS &uas_)
42  {
44 
46  }
47 
49  {
50  return { /* Rx disabled */ };
51  }
52 
53 private:
56 
64  {
65  mavlink::common::msg::COMMAND_LONG cmd {};
66 
67  cmd.target_system = m_uas->get_tgt_system();
68  cmd.target_component = m_uas->get_tgt_component();
69  cmd.command = enum_value(MAV_CMD::DO_MOUNT_CONTROL);
70  cmd.param1 = req->pitch;
71  cmd.param2 = req->roll;
72  cmd.param3 = req->yaw;
73  cmd.param4 = req->altitude; //
74  cmd.param5 = req->latitude; // lattitude in degrees * 1E7
75  cmd.param6 = req->longitude; // longitude in degrees * 1E7
76  cmd.param7 = req->mode; // MAV_MOUNT_MODE
77 
78  UAS_FCU(m_uas)->send_message_ignore_drop(cmd);
79  }
80 };
81 } // namespace extra_plugins
82 } // namespace mavros
83 
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())
string cmd
uint8_t get_tgt_system()
#define UAS_FCU(uasobjptr)
std::vector< HandlerInfo > Subscriptions
void initialize(UAS &uas_)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
uint8_t get_tgt_component()
void command_cb(const mavros_msgs::MountControl::ConstPtr &req)
Send mount control commands to vehicle.
constexpr std::underlying_type< _T >::type enum_value(_T e)


mavros_extras
Author(s): Vladimir Ermakov
autogenerated on Mon Jul 8 2019 03:20:18