Help sending command_long

Hi!

So I am needed some help regarding sending the mavlink_msg_command_long command from my gcs to pixhawk.

I am using swift and when I run this code:

func sendData(){

        var message = mavlink_message_t()

        

        mavlink_msg_command_long_pack(255, 0, &message, 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, 0)

        

        let length = Int(mavlink_msg_get_send_buffer_length(&message))

        var bytes = [UInt8](count:length, repeatedValue: 0)

        mavlink_msg_to_send_buffer(&bytes, &message)

        let sendData = NSData(bytes: (bytes as [UInt8]), length: length)

        bluetooth.write(sendData)

    }

I do not get any response from the quad, however if I changes just the line

        mavlink_msg_command_long_pack(0, 0, &message, 1, 0, 400, 0, 0, 0, 0, 0, 0, 0, 0)

to

        

        mavlink_msg_set_mode_pack(0, 0, &message, 1, 89, 1)

My mode does change from stabilize to guided, and I get a command_ak response back from the pixhawk.

What am I doing wrong in this case?

Thanks!

 

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

Join diydrones

Email me when people reply –

Replies

  • I trying send messages, like you. I also get sucess on set_mode (When I mean sucess, I talking about answer from APM, even the answer is failure), and with the request_param_list, but no sucess in data stream or commando long.

    Did you found the answer?

This reply was deleted.

Activity