MAVSDK icon indicating copy to clipboard operation
MAVSDK copied to clipboard

Cannot subscribe to/from messages using MavlinkPassthrough

Open codymarquardt opened this issue 1 year ago • 10 comments

I am running Ardusub on a blueROV and we have a Jetson Nano onboard that is communicating over serial cable with the onboard Pixhawk. My jetson nano is running Ubuntu 18.04 and I built the main branch of MAVSDK from source two days ago. I installed system-wide (so /usr/local) and I am using Qt to run a program that pulls state information from the vehicle and publishes thruster commands.

I can publish commands just fine using MavlinkPassthrough, but I cannot utilize the subscribe methods to asynchronously update state information.

If I create a method as follows

void BlueROV_Controls::set_message_callback(MavlinkPassthrough &mavlink_pass_) {

MavlinkPassthrough::MessageCallback m_callback;

m_callback = [](const mavlink_message_t &msg_)
{
    const mavlink_message_t* msg = &msg_;
    auto pitch = mavlink_msg_nav_controller_output_get_nav_pitch(msg);
    qDebug() << QString::number(pitch) << "\n";
};

uint16_t value = 62;
auto const result = mavlink_pass_.subscribe_message(value, m_callback);

}

And call that method from main.cpp, I get the following error

error: undefined reference to `mavsdk::MavlinkPassthrough::subscribe_message(unsigned short, std::function<void (__mavlink_message const&)> const&)'

It should not be a linking issue, I can run MavlinkPassthrough::send_message() and MavlinkPassthrough::send_command_long(), for example, with no issue.

I checked the header files for MavlinkPassthrough and the API is matching the syntax I am using the best of my knowledge.

Any help on this would be greatly appreciated!

codymarquardt avatar Sep 21 '23 16:09 codymarquardt