Unable to fine-control (simulated) ANAFI 4K drone using Mavlink

Hello!

I am trying to control the ANAFI 4K drone using the Mavlink protocol because I want to control the drone from both Linux and Windows. I tried to use the official MAVSDK C++ implementation, but that did not work, so I just used the generator to create the v2 version of the mavlink headers and implemented my own C++ wrapper.

I am currently using the Parrot Sphinx simulator for tests. I connected to the simulator with the FreeFlight 6 app, and it reports the firmware version 1.7.7, and prompts me to upgrade to 1.8.0. Is there a way to upgrade the firmware on the simulator? I assume the app does not work because I’m using a simulator.

The issue I have is the fact that MANUAL_CONTROL does not allow controlling the drone using low speeds (e.g.: under 0.6m/s for ‘z’ axis) and I will explain why.
First of all, to enable manual control I send the command MAV_CMD_DO_SET_MODE with mode as MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | MAV_MODE_FLAG_SAFETY_ARMED, and custom_mode as PX4_CUSTOM_MAIN_MODE_MANUAL. Not sure if there’s another way that I missed.
To control the drone, I send the MAVLINK_MSG_ID_MANUAL_CONTROL message containing the values for x, y, z, and r. What I observed is that these values have a dead zone between 0 and ±150. Taking for example z axis, I use values in the range [0; 1000], with 500 being the hover value. When I try to ascend, until 650 the drone does not move. At 651, the drone starts ascending with ~0.6m/s, which is a lot for my purpose. I want to be able to fine-control the drone and to achieve that I need to control the drone with a lower speed than 0.6m/s, when necessary.

Is there a way to control the drone in a similar way (speed) as MANUAL_CONTROL, but without these dead zones? Even if the dead zones exist, in the case of ‘z’ axis for example, I would expect the drone to start ascending with a way lower speed (maybe under 0.1m/s) for values like 660.

Thank you!

Hi there! Are there any updates on this topic? I have a similar problem, using the same firmware version (1.7.7) on the simulator. My application requires a softer control of the drone, and currently, I am not able to achieve that.

This topic was automatically closed after 30 days. New replies are no longer allowed.

You can change the threshold using a mavlink parameter named “NEUTRAL_CMD_THR”
you can set the parameter to any value you want (default 150) using mavlink parameters protocol:
https://mavlink.io/en/messages/common.html#PARAM_SET

Please be aware that anafi will follow the wind if the commands are sent above the threshold. If the threshold is 0, the drone will drift under windy conditions unless the command is a perfect 0.

1 Like

Hello!

Thank you! Setting the threshold works! I’ll take your warning about the wind into consideration. Theoretically, there should be no wind, except the one generated by the drone, since we use it indoors.

There’s one more problem with Mavlink. I can’t land the drone using the MAV_CMD_NAV_LAND command. The problem is also described here: Mavlink land command to Parrot Anafi or Sphinx not working.

Here’s an example of how I send the command:

    mavlink_message_t msg;
    mavlink_msg_command_long_pack(
        system_id,
        component_id,
        &msg,
        target_system,
        MAV_COMP_ID_AUTOPILOT1,
        MAV_CMD_NAV_LAND,
        0 /*confirmation*/,
        0 /*param1*/,
        0 /*param2*/,
        0 /*param3*/,
        NAN /*param4*/,
        0 /*param5*/,
        0 /*param6*/,
        0 /*param7*/);

    m_connection->send(&msg);

In the documentation, I see that the last fields represent GPS coordinates, but I don’t have them available. I just want the drone to land at the current position.
I didn’t know if I should make a new thread about this issue. If needed, I will.

Thanks again for the help.

I answered to the landing command in the thread you mentionned, basically, you need to change the flight mode as the land command is a mission one

Awesome. Thanks!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.