"Int messages are not supported" error using MissionRaw

I’m trying to send mission items between two apps both using mavsdk.
Sending segment:

void sendMission()
{
    mavsdk::MissionRaw mission{system};

    std::vector<mavsdk::MissionRaw::MissionItem> mission_plan{};

    mavsdk::MissionRaw::MissionItem new_item;
    new_item.x = 47;
    new_item.y = 8;

    mission_plan.push_back(new_item);

    mavsdk::MissionRaw::MissionItem new_item2;
    new_item2.x = 47;
    new_item2.y = 8;

    mission_plan.push_back(new_item2);

    const mavsdk::MissionRaw::Result result = mission->upload_mission(mission_plan);

    switch (result)
    {
        case mavsdk::MissionRaw::Result::Error:
            addMessage("upload_mission()->Error");
            break;

        case mavsdk::MissionRaw::Result::Busy:
            addMessage("upload_mission()->Busy");
            break;

        case mavsdk::MissionRaw::Result::InvalidArgument:
            addMessage("upload_mission()->InvalidArgument");
            break;

        case mavsdk::MissionRaw::Result::NoMissionAvailable:
            addMessage("upload_mission()->NoMissionAvailable");
            break;

        case mavsdk::MissionRaw::Result::NoSystem:
            addMessage("upload_mission()->NoSystem");
            break;

        case mavsdk::MissionRaw::Result::Success:
            addMessage("upload_mission()->Success");
            break;

        case mavsdk::MissionRaw::Result::Timeout:
            addMessage("upload_mission()->Timeout");
            break;

        case mavsdk::MissionRaw::Result::TooManyMissionItems:
            addMessage("upload_mission()->TooManyMissionItems");
            break;

        case mavsdk::MissionRaw::Result::TransferCancelled:
            addMessage("upload_mission()->TransferCancelled");
            break;

        case mavsdk::MissionRaw::Result::Unknown:
            addMessage("upload_mission()->Unknown");
            break;

        case mavsdk::MissionRaw::Result::Unsupported:
            addMessage("upload_mission()->Unsupported");
            break;

        default:
            addMessage("upload_mission()->?");
          break;
    }
}

Receiving segment:

	Mavsdk mavsdk;

	Mavsdk::Configuration configuration(
		Mavsdk::Configuration::UsageType::Autopilot);
	
        mavsdk.set_configuration(configuration);

       mavsdk.add_any_connection("udp://127.0.0.1:14550");

        auto gcs_system = mavsdk.systems().back();

	MissionRawServer mission_server = MissionRawServer{gcs_system};

	mission_server.subscribe_incoming_mission(
		[&](mavsdk::MissionRawServer::Result result, mavsdk::MissionRawServer::MissionPlan plan){
			cout << "Mission plan received!" << endl;
			result = mavsdk::MissionRawServer::Result::Success;
		}
	);

Receive segment callback is never triggered.
Send segment returns Unsupported.
The console reports following error message:

[12:10:04|Error] Int messages are not supported. (mavlink_mission_transfer.cpp:34)

P.S. I got the same error using Mission plugin instead MissionRaw.

Following mavlink_mission_transfer.cpp trail I got here:

void SystemImpl::process_autopilot_version(const mavlink_message_t& message)
{
    mavlink_autopilot_version_t autopilot_version;
    mavlink_msg_autopilot_version_decode(&message, &autopilot_version);

    _mission_transfer.set_int_messages_supported(
        autopilot_version.capabilities & MAV_PROTOCOL_CAPABILITY_MISSION_INT);
}

So I should set something particular to my received side fake autopilot in order to collect mission items properly? How?

Best regards,
Mike

Are you building on top of the main branch (which is going to be v2.0), or v1.4?

For v2.0 I have a system test which does exactly what you’re trying to do:

For v1.4, I assume you need to set the flag MAV_PROTOCOL_CAPABILITY_MISSION_INT using this method:

So on the autopilot side you need:

system->add_capabilities(MAV_PROTOCOL_CAPABILITY_MISSION_INT)

If you don’t have MAV_PROTOCOL_CAPABILITY_MISSION_INT, just use 4.

Let me know if that works.

I’m using 1.4:

MAVSDK version: v1.4.7-6-g0ba398ad (mavsdk_impl.cpp:20)

The code you suggested worked in part… now the error message is:

[11:51:09|Warn ] Invalid sequence (mavlink_mission_transfer.cpp:257)

And send segment returns InvalidArgument .

But anyway all this test was coded/started to check if it’s possibile to NACK the received mission…

It looks like that’s not possibile acting trough MissionRawServer, MissionRaw plugins. Can anyone confirm or suggest a way to do so?

You now need to get the sequence number correct of the MissionRaw items.

Why do you need to nack? I guess that’s not possible as it is accepted if the transfer is correct.

I fixed it switching to Mission plugin instead MissionRaw… anyway thnx for the hint.

BTW you are assuming that only mission syntactical errors should be managed trough protocol and this’s not so clearly stated in mission microservice definition.
If Result values could be managed by the mission recipient this could also evalutate mission semantic and refuse it if it cannot be executed for some NON syntactical reason.
This’s not limited to Mission protocol handling, also Action has the same behaviour…

But… assuming we cannot use Mission protocol to decline a mission: what’s the best practice to notify the GCS that the autopilot had refused uploaded mission because is “wrong”?

Yes, that’s a good question. The mission protocol doesn’t allow for that.

See: common: add not feasible mission results by julianoes · Pull Request #1710 · mavlink/mavlink · GitHub

So this means the only way to handle a “wrong” mission is to prevent take off in the preflight checks and prevent mission mode in flight by blocking/preventing the mode. The tricky bit there os that this can leave you without a valid mission if you don’t have a fallback implemented on the autopilot side.