19 #include <mavros_msgs/ManualControl.h> 22 namespace std_plugins {
34 PluginBase::initialize(uas_);
54 void handle_manual_control(
const mavlink::mavlink_message_t *msg, mavlink::common::msg::MANUAL_CONTROL &manual_control)
56 auto manual_control_msg = boost::make_shared<mavros_msgs::ManualControl>();
59 manual_control_msg->x = (manual_control.x / 1000.0);
60 manual_control_msg->y = (manual_control.y / 1000.0);
61 manual_control_msg->z = (manual_control.z / 1000.0);
62 manual_control_msg->r = (manual_control.r / 1000.0);
63 manual_control_msg->buttons = manual_control.buttons;
65 control_pub.
publish(manual_control_msg);
72 mavlink::common::msg::MANUAL_CONTROL
msg;
79 msg.buttons = req->buttons;
MAVROS Plugin base class.
std::shared_ptr< MAVConnInterface const > ConstPtr
void publish(const boost::shared_ptr< M > &message) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
HandlerInfo make_handler(const mavlink::msgid_t id, void(_C::*fn)(const mavlink::mavlink_message_t *msg, const mavconn::Framing framing))
ros::Publisher control_pub
PluginBase()
Plugin constructor Should not do anything before initialize()
uint8_t get_tgt_system()
Return communication target system.
#define UAS_FCU(uasobjptr)
helper accessor to FCU link interface
void handle_manual_control(const mavlink::mavlink_message_t *msg, mavlink::common::msg::MANUAL_CONTROL &manual_control)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
std::vector< HandlerInfo > Subscriptions
Subscriptions vector.
void initialize(UAS &uas_)
Plugin initializer.
ros::NodeHandle manual_control_nh
Subscriptions get_subscriptions()
Return vector of MAVLink message subscriptions (handlers)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
void send_cb(const mavros_msgs::ManualControl::ConstPtr req)