I am trying a custom gcs written in swift using the Mavlink c library.
I can manage to send the request data stream command, but I can't seem to get command_long working

Here is an example for sending the arm command.

func sendData(){
var message = mavlink_message_t()

mavlink_msg_command_long_pack(255, 0, &message, 1, 0, 400, 0, 1, 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)

Also when sending the command for requesting data stream, I have to add 1 to get the correct data, eg to get sys_status stream I use Id of 2 not 1.


Views: 130

Reply to This

Replies to This Discussion

I'm looking for the same thing. I'm working to make the arduino listen and decode the APM's telemtry, using the mavlinks library. The reading part is easy, but the writing part... 
The only command that I had sucess was the "mavlink_msg_request_param_list", where I get a status text saying two informations.
I'm looking for the command long or data stream with the correct method.

I tried: 
mavlink_msg_data_stream_pack(1, 1,&sendMSG,0,1000, 1);

uint16_t len = mavlink_msg_to_send_buffer(buf, &sendMSG);


But I get no answer, and also tried 255 and 0 on the system_id parameter, 190, 1 and 0 on the componet, but no sucess.

Reply to Discussion


© 2018   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service