Mavlink common error

Hi, I updated my cargo.toml , by changing the version of mavlink = {version="0.9.0"} , to mavlink ={version="0.11.2"} but now I am getting the following error MavMessage::common(common::Mavmessage::HEARTBEAT(commin::HEART_DATA{

MavMessage::common(common:
                              ^^^  variant or associated item not found in MavMessage

I am importing it as


use mavlink::ardupilotmega::MavMessage;

use mavlink::common;

use mavlink::common::{MavAutopilot, MavModeFlag, MavState, MavType};

my cargo.toml is looks like

[dependencies]
mavlink = { version = "0.9", features = ["ardupilotmega", "emit-extensions"] }

tracing = "0.1"
tokio = { version = "0.2", features = ["full"] }
tokio-fd = "0.3.0"
libc = "0.2"

The API was changed in mavlink v0.11.0 by mavlink/rust-mavlink#113. Now, instead of writing MavMessage::common(common::MavMessage::HEARTBEAT(...)), you should write MavMessage::HEARTBEAT(...).

1 Like

I used

 pub fn heartbeat_message() -> mavlink::ardupilotmega::MavMessage {
    mavlink::ardupilotmega::MavMessage::HEARTBEAT(mavlink::ardupilotmega::HEARTBEAT_DATA {

from link to resolve it , rust-mavlink/mavlink-dump.rs at master · mavlink/rust-mavlink · GitHub

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.