Mavlink Command C++

Hi to all.

I have a problem. I am trying to command my 3dr robotics drone with mavlink message. I have write a c++ program and I am able to send mavlink commands. My code is

mavlink_message_t messaggio; //messaggio da inviare
mavlink_command_long_t comando; //struttura dati relativa al comando mavlink long
char buf[300];

comando.command = id_comando; //settaggio valori della struct relativa al comando
comando.target_system = 1;
comando.target_component = 250;
comando.confirmation = true;
comando.param1 = param1;
comando.param2 = param2;
comando.param3 = param3;
comando.param4 = param4;
comando.param5 = param5;
comando.param6 = param6;
comando.param7 = param7;

mavlink_msg_command_long_encode(1, 250, &messaggio, &comando);
unsigned len = mavlink_msg_to_send_buffer((uint8_t*)buf, &messaggio);
SP->WriteData(buf,len);

With this code I can arm and takeoff my drone. But If I send a CMD_NAV_WAYPOINT the command ack is 3, Command UNKNOWN/UNSUPPORTED. There is a way to send my drone in a specific waypoint ? I use APM 2.6. Sorry for my english

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • You're welcome! I would like have this help2 month ago ;-)

    With some friend, we are involving in the "Dassault UAV Challenge", that mean we have one year to code an application in order to realize some mission designed by Dassault.

    Yes, we have a c_uart_interface and I am french.

    Camille

  • Thanks for this information !! I'm bit stuck in my intership and you have just saved my life ! ahah

    Can you explain me your project quickly ? Do you also use the c_uart_interface_example ?

    Are you french ? 

  • Yes, I found why this didn't work:

    Indeed, when you are in GUIDED mode, you have only access to certain message like ARM, TAKE-OFF, LAND but you can not use WAYPOINT. The autopilot will give you a "3" response.

    You can find the list : http://ardupilot.org/dev/docs/copter-commands-in-guided-mode.html

    You can use SET_POSITION_TARGET_GLOBAL_INT

    Copter Commands in Guided Mode — Dev documentation
  • Hi everyone,

    I got approximatively same problem. Can we work together on this issue ?

    Thanks,

    Thomas

  • Hey

    Thanks you to explain this problem, I have exactly the same!

    I will be really grateful, if someone could help us.

This reply was deleted.

Activity