Hi, I am trying to add a custom mavros message. Therefore I have already add a new plugin called gazebo_pos.cpp
/*
Plugin to transport data from Gazebo via MAVLink to PX4 without coordinate transformation
*/
#include <mavros/mavros_plugin.h>
#include <pluginlib/class_list_macros.h>
#include <geometry_msgs/PoseStamped.h> // this is the message type which will be used
namespace mavros {
namespace extra_plugins{
/**
* brief Gazebo to PX4 plugin
*/
class GazeboPosPlugin : public plugin::PluginBase
{
public:
GazeboPosPlugin() : PluginBase(),
mp_nh("~gazebo")
{ }
void initialize(UAS &uas_)
{
PluginBase::initialize(uas_);
gazebo_pos_sub = mp_nh.subscribe("pose", 1, &GazeboPosPlugin::gazebo_pos_cb, this);
}
Subscriptions get_subscriptions()
{
return { /* Rx disabled */ };
}
private:
ros::NodeHandle mp_nh;
ros::Subscriber gazebo_pos_sub;
// callback function
void gazebo_pos_cb(const geometry_msgs::PoseStamped::ConstPtr &pose)
{
mavlink::common::msg::GAZEBO_POS pos;
pos.qw = pose->pose.orientation.w;
pos.qx = pose->pose.orientation.x;
pos.qy = pose->pose.orientation.y;
pos.qz = pose->pose.orientation.z;
pos.x = pose->pose.position.x;
pos.y = pose->pose.position.y;
pos.z = pose->pose.position.z;
UAS_FCU(m_uas)->send_message_ignore_drop(pos);
}
};
} // namespace extra_plugins
} // namespace mavros
PLUGINLIB_EXPORT_CLASS(mavros::extra_plugins::GazeboPosPlugin, mavros::plugin::PluginBase)
The problem is when I try to compile the code I get the error message:
error: ‘GAZEBO_POS’ is not a member of ‘mavlink::common::msg’
mavlink::common::msg::GAZEBO_POS pos;
I already added into my MAVLink repo the necessary message. The question is how can I make the message visible for mavros?
Best
Nils