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!

 

Views: 156

Reply to This

Replies to This Discussion

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?

Reply to Discussion

RSS

© 2017   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service