MAVLink ARM/DISARM Procedure

I have been trying to arm/disarm my pixhawk using the following command

mavlink_msg_command_long_pack(GCS.ID, GCS.Component_ID, &tx_msg, 1, 250, MAV_CMD_COMPONENT_ARM_DISARM, 0, 0.0, 0, 0, 0, 0, 0, 0);

from within Matlab, but it gets rejected everytime. I am also using the 3DR radio for communication.

I have tried various combinations of Sys_ID and Comp_ID such as (1,1), (1,50), (1,0) and (1,250), with the same result.

I am not sure if I am missing a step, either in software or on the UAV itself that needs to be executed prior to arming the UAV.
My “GCS” in Matlab has the following settings, Sys_ID = 255, and Comp_ID = 190.

I would really appreciate your help on this,


The command you show here disarms the system. If its already disarmed nothing will happen.

Thanks for your reply. Yes, I see that this particular command disarms the Quad, but when I tried it with a 1.0, I still get it rejected by the Pixhawk.

That is why I am wondering if I am missing a step somewhere?

Also, are my settings for the Sys_ID, Sys_Comp_ID, and more importantly the target_ID and target_Comp_ID correct?