mavlink / mavros

MAVLink to ROS gateway with proxy for Ground Control Station
Other
879 stars 990 forks source link

Mavros can not see mavlink Function #962

Closed wazzan88 closed 6 years ago

wazzan88 commented 6 years ago

This is only bug and feature tracker, please use it to report bugs or request features.


Issue details

Hi I hav a custom message I wrote plugin I want to send mavlink message to Fcu but I hav this message error

/home/pi/MavRosL/src/mavros/mavros/src/plugins/lisnter2.cpp: In member function ‘void mavros::std_plugins::lisnter2Plugin::lisnter_cb(const ConstPtr&)’: /home/pi/MavRosL/src/mavros/mavros/src/plugins/lisnter2.cpp:102:45: error: ‘mavlink_msg_num_encode’ was not declared in this scope mavlink_msg_num_encode(0, 0, &msg, req1.num); ^

but mavlink_msg_num_encode is in mavlink_msg_num.h

the code is /**

@brief Dummy plugin @file dummy.cpp @author Vladimir Ermakov vooon341@gmail.com */

include <mavconn/interface.h>

include <mavros/mavros_plugin.h>

include <mavconn/msgbuffer.h>

include <mavconn/mavlink_dialect.h>

include <mavros/mavlink_diag.h>

include <mavros_msgs/Num.h>

namespace mavros { namespace std_plugins {

using mavlink::mavlink_message_t;

class lisnter2Plugin : public plugin::PluginBase { public: lisnter2Plugin() : PluginBase(), nh("~") { }

/**

ROS_INFO(" mode is %d ",req_msg->num); mavlink::definitions::msg::Num req1;
req1.num = req_msg->num; mavlink_message_t msg; mavlink_msg_num_encode(0, 0, &msg, req1.num); UAS_FCU(m_uas)->send_message(&msg); ROS_INFO("Send is ok");

} };

} // namespace std_plugins } // namespace mavros

include <pluginlib/class_list_macros.h>

PLUGINLIB_EXPORT_CLASS(mavros::std_plugins::lisnter2Plugin, mavros::plugin::PluginBase) I tried to insert interface.h mavlink_dialect.h it does not work

do u have any ideas ??

MAVROS version and platform

Mavros: ?0.18.4? ROS: ?Kinetic? Ubuntu: ?16.04?

Autopilot type and version

[ ] ArduPilot [ ] PX4

Version: ?3.7.1?

Node logs

copy output of mavros_node. Usually console where you run roslaunch

Diagnostics

place here result of:
rostopic echo -n1 /diagnostics

Check ID

rosrun mavros checkid
vooon commented 6 years ago

Look at other plugins and you will find what you do incorrect.